@assistant-ui/react 0.5.51 → 0.5.53

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -373,7 +373,8 @@ var fromCoreMessages = (message) => {
373
373
  };
374
374
  var fromCoreMessage = (message, {
375
375
  id = generateId(),
376
- status = { type: "complete", reason: "unknown" }
376
+ status = { type: "complete", reason: "unknown" },
377
+ attachments = []
377
378
  } = {}) => {
378
379
  const commonProps = {
379
380
  id,
@@ -401,7 +402,7 @@ var fromCoreMessage = (message, {
401
402
  ...commonProps,
402
403
  role,
403
404
  content: message.content,
404
- attachments: []
405
+ attachments
405
406
  };
406
407
  case "system":
407
408
  return {
@@ -1218,20 +1219,16 @@ var LocalThreadRuntime = class {
1218
1219
  this.notifySubscribers();
1219
1220
  }
1220
1221
  async append(message) {
1221
- if (message.role !== "user")
1222
- throw new Error(
1223
- "Only appending user messages are supported in LocalRuntime. This is likely an internal bug in assistant-ui."
1224
- );
1225
- const userMessageId = generateId();
1226
- const userMessage = {
1227
- id: userMessageId,
1228
- role: "user",
1229
- content: message.content,
1230
- attachments: message.attachments ?? [],
1231
- createdAt: /* @__PURE__ */ new Date()
1232
- };
1233
- this.repository.addOrUpdateMessage(message.parentId, userMessage);
1234
- await this.startRun(userMessageId);
1222
+ const newMessage = fromCoreMessage(message, {
1223
+ attachments: message.attachments
1224
+ });
1225
+ this.repository.addOrUpdateMessage(message.parentId, newMessage);
1226
+ if (message.role === "user") {
1227
+ await this.startRun(newMessage.id);
1228
+ } else {
1229
+ this.repository.resetHead(newMessage.id);
1230
+ this.notifySubscribers();
1231
+ }
1235
1232
  }
1236
1233
  async startRun(parentId) {
1237
1234
  this.repository.resetHead(parentId);
@@ -2271,14 +2268,47 @@ var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
2271
2268
  };
2272
2269
  var AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);
2273
2270
 
2271
+ // src/context/providers/TextContentPartProvider.tsx
2272
+ import { useState as useState9 } from "react";
2273
+ import { create as create12 } from "zustand";
2274
+
2275
+ // src/context/react/ContentPartContext.ts
2276
+ import { createContext as createContext4, useContext as useContext4 } from "react";
2277
+ var ContentPartContext = createContext4(
2278
+ null
2279
+ );
2280
+ function useContentPartContext(options) {
2281
+ const context = useContext4(ContentPartContext);
2282
+ if (!options?.optional && !context)
2283
+ throw new Error(
2284
+ "This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
2285
+ );
2286
+ return context;
2287
+ }
2288
+
2289
+ // src/context/providers/TextContentPartProvider.tsx
2290
+ import { jsx as jsx9 } from "react/jsx-runtime";
2291
+ var TextContentPartProvider = ({ children, text }) => {
2292
+ const [context] = useState9(() => {
2293
+ const useContentPart = create12(() => ({
2294
+ status: { type: "complete" },
2295
+ part: { type: "text", text }
2296
+ }));
2297
+ return {
2298
+ useContentPart
2299
+ };
2300
+ });
2301
+ return /* @__PURE__ */ jsx9(ContentPartContext.Provider, { value: context, children });
2302
+ };
2303
+
2274
2304
  // src/context/react/ComposerContext.ts
2275
2305
  import { useMemo as useMemo3 } from "react";
2276
2306
 
2277
2307
  // src/context/react/MessageContext.ts
2278
- import { createContext as createContext4, useContext as useContext4 } from "react";
2279
- var MessageContext = createContext4(null);
2308
+ import { createContext as createContext5, useContext as useContext5 } from "react";
2309
+ var MessageContext = createContext5(null);
2280
2310
  function useMessageContext(options) {
2281
- const context = useContext4(MessageContext);
2311
+ const context = useContext5(MessageContext);
2282
2312
  if (!options?.optional && !context)
2283
2313
  throw new Error(
2284
2314
  "This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
@@ -2299,20 +2329,6 @@ var useComposerContext = () => {
2299
2329
  );
2300
2330
  };
2301
2331
 
2302
- // src/context/react/ContentPartContext.ts
2303
- import { createContext as createContext5, useContext as useContext5 } from "react";
2304
- var ContentPartContext = createContext5(
2305
- null
2306
- );
2307
- function useContentPartContext(options) {
2308
- const context = useContext5(ContentPartContext);
2309
- if (!options?.optional && !context)
2310
- throw new Error(
2311
- "This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
2312
- );
2313
- return context;
2314
- }
2315
-
2316
2332
  // src/hooks/useAppendMessage.tsx
2317
2333
  import { useCallback } from "react";
2318
2334
  var toAppendMessage = (useThreadMessages, message) => {
@@ -2487,11 +2503,8 @@ var useActionBarCopy = ({
2487
2503
  // src/primitive-hooks/actionBar/useActionBarEdit.tsx
2488
2504
  import { useCallback as useCallback4 } from "react";
2489
2505
  var useActionBarEdit = () => {
2490
- const { useMessage, useEditComposer } = useMessageContext();
2491
- const disabled = useCombinedStore(
2492
- [useMessage, useEditComposer],
2493
- (m, c) => m.message.role !== "user" || c.isEditing
2494
- );
2506
+ const { useEditComposer } = useMessageContext();
2507
+ const disabled = useEditComposer((c) => c.isEditing);
2495
2508
  const callback = useCallback4(() => {
2496
2509
  const { edit } = useEditComposer.getState();
2497
2510
  edit();
@@ -2829,7 +2842,7 @@ var useActionBarFloatStatus = ({
2829
2842
  };
2830
2843
 
2831
2844
  // src/primitives/actionBar/ActionBarRoot.tsx
2832
- import { jsx as jsx9 } from "react/jsx-runtime";
2845
+ import { jsx as jsx10 } from "react/jsx-runtime";
2833
2846
  var ActionBarPrimitiveRoot = forwardRef5(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {
2834
2847
  const hideAndfloatStatus = useActionBarFloatStatus({
2835
2848
  hideWhenRunning,
@@ -2837,7 +2850,7 @@ var ActionBarPrimitiveRoot = forwardRef5(({ hideWhenRunning, autohide, autohideF
2837
2850
  autohideFloat
2838
2851
  });
2839
2852
  if (hideAndfloatStatus === "hidden" /* Hidden */) return null;
2840
- return /* @__PURE__ */ jsx9(
2853
+ return /* @__PURE__ */ jsx10(
2841
2854
  Primitive2.div,
2842
2855
  {
2843
2856
  ...hideAndfloatStatus === "floating" /* Floating */ ? { "data-floating": "true" } : null,
@@ -2852,7 +2865,7 @@ ActionBarPrimitiveRoot.displayName = "ActionBarPrimitive.Root";
2852
2865
  import { forwardRef as forwardRef6 } from "react";
2853
2866
  import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
2854
2867
  import { composeEventHandlers } from "@radix-ui/primitive";
2855
- import { jsx as jsx10 } from "react/jsx-runtime";
2868
+ import { jsx as jsx11 } from "react/jsx-runtime";
2856
2869
  var createActionButton = (displayName, useActionButton, forwardProps = []) => {
2857
2870
  const ActionButton = forwardRef6((props, forwardedRef) => {
2858
2871
  const forwardedProps = {};
@@ -2865,7 +2878,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
2865
2878
  }
2866
2879
  });
2867
2880
  const callback = useActionButton(forwardedProps);
2868
- return /* @__PURE__ */ jsx10(
2881
+ return /* @__PURE__ */ jsx11(
2869
2882
  Primitive3.button,
2870
2883
  {
2871
2884
  type: "button",
@@ -2912,7 +2925,7 @@ import { forwardRef as forwardRef7 } from "react";
2912
2925
  import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
2913
2926
  import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
2914
2927
  import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
2915
- import { jsx as jsx11 } from "react/jsx-runtime";
2928
+ import { jsx as jsx12 } from "react/jsx-runtime";
2916
2929
  var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
2917
2930
  const callback = useActionBarStopSpeaking();
2918
2931
  useEscapeKeydown((e) => {
@@ -2921,7 +2934,7 @@ var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
2921
2934
  callback();
2922
2935
  }
2923
2936
  });
2924
- return /* @__PURE__ */ jsx11(
2937
+ return /* @__PURE__ */ jsx12(
2925
2938
  Primitive4.button,
2926
2939
  {
2927
2940
  type: "button",
@@ -2945,7 +2958,7 @@ __export(assistantModal_exports, {
2945
2958
  });
2946
2959
 
2947
2960
  // src/primitives/assistantModal/AssistantModalRoot.tsx
2948
- import { useState as useState9 } from "react";
2961
+ import { useState as useState10 } from "react";
2949
2962
  import * as PopoverPrimitive2 from "@radix-ui/react-popover";
2950
2963
  import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
2951
2964
 
@@ -2967,9 +2980,9 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
2967
2980
  var usePopoverScope = PopoverPrimitive.createPopoverScope();
2968
2981
 
2969
2982
  // src/primitives/assistantModal/AssistantModalRoot.tsx
2970
- import { jsx as jsx12 } from "react/jsx-runtime";
2983
+ import { jsx as jsx13 } from "react/jsx-runtime";
2971
2984
  var useAssistantModalOpenState = (defaultOpen = false) => {
2972
- const state = useState9(defaultOpen);
2985
+ const state = useState10(defaultOpen);
2973
2986
  const [, setOpen] = state;
2974
2987
  useOnComposerFocus(() => {
2975
2988
  setOpen(true);
@@ -2985,7 +2998,7 @@ var AssistantModalPrimitiveRoot = ({
2985
2998
  }) => {
2986
2999
  const scope = usePopoverScope(__scopeAssistantModal);
2987
3000
  const [modalOpen, setOpen] = useAssistantModalOpenState(defaultOpen);
2988
- return /* @__PURE__ */ jsx12(
3001
+ return /* @__PURE__ */ jsx13(
2989
3002
  PopoverPrimitive2.Root,
2990
3003
  {
2991
3004
  ...scope,
@@ -3000,14 +3013,14 @@ AssistantModalPrimitiveRoot.displayName = "AssistantModalPrimitive.Root";
3000
3013
  // src/primitives/assistantModal/AssistantModalTrigger.tsx
3001
3014
  import { forwardRef as forwardRef8 } from "react";
3002
3015
  import * as PopoverPrimitive3 from "@radix-ui/react-popover";
3003
- import { jsx as jsx13 } from "react/jsx-runtime";
3016
+ import { jsx as jsx14 } from "react/jsx-runtime";
3004
3017
  var AssistantModalPrimitiveTrigger = forwardRef8(
3005
3018
  ({
3006
3019
  __scopeAssistantModal,
3007
3020
  ...rest
3008
3021
  }, ref) => {
3009
3022
  const scope = usePopoverScope(__scopeAssistantModal);
3010
- return /* @__PURE__ */ jsx13(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
3023
+ return /* @__PURE__ */ jsx14(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
3011
3024
  }
3012
3025
  );
3013
3026
  AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
@@ -3016,7 +3029,7 @@ AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
3016
3029
  import { forwardRef as forwardRef9 } from "react";
3017
3030
  import * as PopoverPrimitive4 from "@radix-ui/react-popover";
3018
3031
  import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
3019
- import { jsx as jsx14 } from "react/jsx-runtime";
3032
+ import { jsx as jsx15 } from "react/jsx-runtime";
3020
3033
  var AssistantModalPrimitiveContent = forwardRef9(
3021
3034
  ({
3022
3035
  __scopeAssistantModal,
@@ -3027,7 +3040,7 @@ var AssistantModalPrimitiveContent = forwardRef9(
3027
3040
  ...props
3028
3041
  }, forwardedRef) => {
3029
3042
  const scope = usePopoverScope(__scopeAssistantModal);
3030
- return /* @__PURE__ */ jsx14(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx14(
3043
+ return /* @__PURE__ */ jsx15(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx15(
3031
3044
  PopoverPrimitive4.Content,
3032
3045
  {
3033
3046
  ...scope,
@@ -3048,14 +3061,14 @@ AssistantModalPrimitiveContent.displayName = "AssistantModalPrimitive.Content";
3048
3061
  // src/primitives/assistantModal/AssistantModalAnchor.tsx
3049
3062
  import { forwardRef as forwardRef10 } from "react";
3050
3063
  import * as PopoverPrimitive5 from "@radix-ui/react-popover";
3051
- import { jsx as jsx15 } from "react/jsx-runtime";
3064
+ import { jsx as jsx16 } from "react/jsx-runtime";
3052
3065
  var AssistantModalPrimitiveAnchor = forwardRef10(
3053
3066
  ({
3054
3067
  __scopeAssistantModal,
3055
3068
  ...rest
3056
3069
  }, ref) => {
3057
3070
  const scope = usePopoverScope(__scopeAssistantModal);
3058
- return /* @__PURE__ */ jsx15(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
3071
+ return /* @__PURE__ */ jsx16(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
3059
3072
  }
3060
3073
  );
3061
3074
  AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
@@ -3083,18 +3096,18 @@ var BranchPickerPrevious = createActionButton(
3083
3096
  );
3084
3097
 
3085
3098
  // src/primitives/branchPicker/BranchPickerCount.tsx
3086
- import { Fragment, jsx as jsx16 } from "react/jsx-runtime";
3099
+ import { Fragment, jsx as jsx17 } from "react/jsx-runtime";
3087
3100
  var BranchPickerPrimitiveCount = () => {
3088
3101
  const branchCount = useBranchPickerCount();
3089
- return /* @__PURE__ */ jsx16(Fragment, { children: branchCount });
3102
+ return /* @__PURE__ */ jsx17(Fragment, { children: branchCount });
3090
3103
  };
3091
3104
  BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
3092
3105
 
3093
3106
  // src/primitives/branchPicker/BranchPickerNumber.tsx
3094
- import { Fragment as Fragment2, jsx as jsx17 } from "react/jsx-runtime";
3107
+ import { Fragment as Fragment2, jsx as jsx18 } from "react/jsx-runtime";
3095
3108
  var BranchPickerPrimitiveNumber = () => {
3096
3109
  const branchNumber = useBranchPickerNumber();
3097
- return /* @__PURE__ */ jsx17(Fragment2, { children: branchNumber });
3110
+ return /* @__PURE__ */ jsx18(Fragment2, { children: branchNumber });
3098
3111
  };
3099
3112
  BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
3100
3113
 
@@ -3139,7 +3152,7 @@ var useManagedRef = (callback) => {
3139
3152
 
3140
3153
  // src/primitives/message/MessageRoot.tsx
3141
3154
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
3142
- import { jsx as jsx18 } from "react/jsx-runtime";
3155
+ import { jsx as jsx19 } from "react/jsx-runtime";
3143
3156
  var useIsHoveringRef = () => {
3144
3157
  const { useMessageUtils } = useMessageContext();
3145
3158
  const callbackRef = useCallback16(
@@ -3166,7 +3179,7 @@ var useIsHoveringRef = () => {
3166
3179
  var MessagePrimitiveRoot = forwardRef11(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef30) => {
3167
3180
  const isHoveringRef = useIsHoveringRef();
3168
3181
  const ref = useComposedRefs(forwardRef30, isHoveringRef);
3169
- return /* @__PURE__ */ jsx18(Primitive5.div, { ...rest, ref });
3182
+ return /* @__PURE__ */ jsx19(Primitive5.div, { ...rest, ref });
3170
3183
  });
3171
3184
  MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
3172
3185
 
@@ -3184,9 +3197,9 @@ MessagePrimitiveIf.displayName = "MessagePrimitive.If";
3184
3197
  import { memo as memo2 } from "react";
3185
3198
 
3186
3199
  // src/context/providers/ContentPartProvider.tsx
3187
- import { useEffect as useEffect9, useState as useState10 } from "react";
3188
- import { create as create12 } from "zustand";
3189
- import { jsx as jsx19 } from "react/jsx-runtime";
3200
+ import { useEffect as useEffect9, useState as useState11 } from "react";
3201
+ import { create as create13 } from "zustand";
3202
+ import { jsx as jsx20 } from "react/jsx-runtime";
3190
3203
  var COMPLETE_STATUS = {
3191
3204
  type: "complete"
3192
3205
  };
@@ -3214,6 +3227,8 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
3214
3227
  } else {
3215
3228
  return null;
3216
3229
  }
3230
+ } else if (message.content.length === 1 && part.type === "text" && part.text.length === 0) {
3231
+ part = EMPTY_CONTENT;
3217
3232
  }
3218
3233
  const status = toContentPartStatus(message, partIndex, part);
3219
3234
  const currentState = useContentPart?.getState();
@@ -3223,8 +3238,8 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
3223
3238
  };
3224
3239
  var useContentPartContext2 = (partIndex) => {
3225
3240
  const { useMessage } = useMessageContext();
3226
- const [context] = useState10(() => {
3227
- const useContentPart = create12(
3241
+ const [context] = useState11(() => {
3242
+ const useContentPart = create13(
3228
3243
  () => getContentPartState(useMessage.getState(), void 0, partIndex)
3229
3244
  );
3230
3245
  return { useContentPart };
@@ -3249,32 +3264,32 @@ var ContentPartProvider = ({
3249
3264
  children
3250
3265
  }) => {
3251
3266
  const context = useContentPartContext2(partIndex);
3252
- return /* @__PURE__ */ jsx19(ContentPartContext.Provider, { value: context, children });
3267
+ return /* @__PURE__ */ jsx20(ContentPartContext.Provider, { value: context, children });
3253
3268
  };
3254
3269
 
3255
3270
  // src/primitives/contentPart/ContentPartText.tsx
3256
3271
  import {
3257
3272
  forwardRef as forwardRef12
3258
3273
  } from "react";
3259
- import { jsx as jsx20 } from "react/jsx-runtime";
3274
+ import { jsx as jsx21 } from "react/jsx-runtime";
3260
3275
  var ContentPartPrimitiveText = forwardRef12(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
3261
3276
  const {
3262
3277
  part: { text },
3263
3278
  status
3264
3279
  } = useSmooth(useContentPartText(), smooth);
3265
- return /* @__PURE__ */ jsx20(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
3280
+ return /* @__PURE__ */ jsx21(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
3266
3281
  });
3267
3282
  ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
3268
3283
 
3269
3284
  // src/primitives/contentPart/ContentPartImage.tsx
3270
3285
  import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
3271
3286
  import { forwardRef as forwardRef13 } from "react";
3272
- import { jsx as jsx21 } from "react/jsx-runtime";
3287
+ import { jsx as jsx22 } from "react/jsx-runtime";
3273
3288
  var ContentPartPrimitiveImage = forwardRef13((props, forwardedRef) => {
3274
3289
  const {
3275
3290
  part: { image }
3276
3291
  } = useContentPartImage();
3277
- return /* @__PURE__ */ jsx21(Primitive6.img, { src: image, ...props, ref: forwardedRef });
3292
+ return /* @__PURE__ */ jsx22(Primitive6.img, { src: image, ...props, ref: forwardedRef });
3278
3293
  });
3279
3294
  ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
3280
3295
 
@@ -3296,7 +3311,7 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
3296
3311
  ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
3297
3312
 
3298
3313
  // src/primitives/message/MessageContent.tsx
3299
- import { jsx as jsx22, jsxs as jsxs3 } from "react/jsx-runtime";
3314
+ import { jsx as jsx23, jsxs as jsxs3 } from "react/jsx-runtime";
3300
3315
  var ToolUIDisplay = ({
3301
3316
  UI,
3302
3317
  ...props
@@ -3304,20 +3319,20 @@ var ToolUIDisplay = ({
3304
3319
  const { useToolUIs } = useAssistantContext();
3305
3320
  const Render = useToolUIs((s) => s.getToolUI(props.part.toolName)) ?? UI;
3306
3321
  if (!Render) return null;
3307
- return /* @__PURE__ */ jsx22(Render, { ...props });
3322
+ return /* @__PURE__ */ jsx23(Render, { ...props });
3308
3323
  };
3309
3324
  var defaultComponents = {
3310
3325
  Text: () => /* @__PURE__ */ jsxs3("p", { style: { whiteSpace: "pre-line" }, children: [
3311
- /* @__PURE__ */ jsx22(ContentPartPrimitiveText, {}),
3312
- /* @__PURE__ */ jsx22(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx22("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
3326
+ /* @__PURE__ */ jsx23(ContentPartPrimitiveText, {}),
3327
+ /* @__PURE__ */ jsx23(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx23("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
3313
3328
  ] }),
3314
- Image: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveImage, {}),
3315
- UI: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveDisplay, {})
3329
+ Image: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveImage, {}),
3330
+ UI: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveDisplay, {})
3316
3331
  };
3317
3332
  var MessageContentPartComponent = ({
3318
3333
  components: {
3319
- Empty = defaultComponents.Text,
3320
3334
  Text: Text2 = defaultComponents.Text,
3335
+ Empty,
3321
3336
  Image: Image2 = defaultComponents.Image,
3322
3337
  UI = defaultComponents.UI,
3323
3338
  tools: { by_name = {}, Fallback: Fallback2 = void 0 } = {}
@@ -3333,16 +3348,18 @@ var MessageContentPartComponent = ({
3333
3348
  case "text":
3334
3349
  if (status.type === "requires-action")
3335
3350
  throw new Error("Encountered unexpected requires-action status");
3336
- if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx22(Empty, { part, status });
3337
- return /* @__PURE__ */ jsx22(Text2, { part, status });
3351
+ if (part === EMPTY_CONTENT && !!Empty) {
3352
+ return /* @__PURE__ */ jsx23(Empty, { status });
3353
+ }
3354
+ return /* @__PURE__ */ jsx23(Text2, { part, status });
3338
3355
  case "image":
3339
3356
  if (status.type === "requires-action")
3340
3357
  throw new Error("Encountered unexpected requires-action status");
3341
- return /* @__PURE__ */ jsx22(Image2, { part, status });
3358
+ return /* @__PURE__ */ jsx23(Image2, { part, status });
3342
3359
  case "ui":
3343
3360
  if (status.type === "requires-action")
3344
3361
  throw new Error("Encountered unexpected requires-action status");
3345
- return /* @__PURE__ */ jsx22(UI, { part, status });
3362
+ return /* @__PURE__ */ jsx23(UI, { part, status });
3346
3363
  case "tool-call": {
3347
3364
  const Tool = by_name[part.toolName] || Fallback2;
3348
3365
  const addResult = (result) => addToolResult({
@@ -3351,7 +3368,7 @@ var MessageContentPartComponent = ({
3351
3368
  toolCallId: part.toolCallId,
3352
3369
  result
3353
3370
  });
3354
- return /* @__PURE__ */ jsx22(
3371
+ return /* @__PURE__ */ jsx23(
3355
3372
  ToolUIDisplay,
3356
3373
  {
3357
3374
  UI: Tool,
@@ -3370,7 +3387,7 @@ var MessageContentPartImpl = ({
3370
3387
  partIndex,
3371
3388
  components
3372
3389
  }) => {
3373
- return /* @__PURE__ */ jsx22(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx22(MessageContentPartComponent, { components }) });
3390
+ return /* @__PURE__ */ jsx23(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx23(MessageContentPartComponent, { components }) });
3374
3391
  };
3375
3392
  var MessageContentPart = memo2(
3376
3393
  MessageContentPartImpl,
@@ -3381,7 +3398,7 @@ var MessagePrimitiveContent = ({
3381
3398
  }) => {
3382
3399
  const { useMessage } = useMessageContext();
3383
3400
  const contentLength = useMessage((s) => s.message.content.length) || 1;
3384
- return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx22(MessageContentPart, { partIndex: index, components }, index));
3401
+ return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx23(MessageContentPart, { partIndex: index, components }, index));
3385
3402
  };
3386
3403
  MessagePrimitiveContent.displayName = "MessagePrimitive.Content";
3387
3404
 
@@ -3417,9 +3434,9 @@ function useAttachmentContext(options) {
3417
3434
  }
3418
3435
 
3419
3436
  // src/context/providers/MessageAttachmentProvider.tsx
3420
- import { useEffect as useEffect10, useState as useState11 } from "react";
3421
- import { create as create13 } from "zustand";
3422
- import { jsx as jsx23 } from "react/jsx-runtime";
3437
+ import { useEffect as useEffect10, useState as useState12 } from "react";
3438
+ import { create as create14 } from "zustand";
3439
+ import { jsx as jsx24 } from "react/jsx-runtime";
3423
3440
  var getAttachment = ({ message }, useAttachment, partIndex) => {
3424
3441
  if (message.role !== "user") return null;
3425
3442
  const attachments = message.attachments;
@@ -3431,9 +3448,9 @@ var getAttachment = ({ message }, useAttachment, partIndex) => {
3431
3448
  };
3432
3449
  var useMessageAttachmentContext = (partIndex) => {
3433
3450
  const { useMessage } = useMessageContext();
3434
- const [context] = useState11(
3451
+ const [context] = useState12(
3435
3452
  () => {
3436
- const useAttachment = create13(
3453
+ const useAttachment = create14(
3437
3454
  () => getAttachment(useMessage.getState(), void 0, partIndex)
3438
3455
  );
3439
3456
  return { type: "message", useAttachment };
@@ -3459,11 +3476,11 @@ var MessageAttachmentProvider = ({
3459
3476
  children
3460
3477
  }) => {
3461
3478
  const context = useMessageAttachmentContext(partIndex);
3462
- return /* @__PURE__ */ jsx23(AttachmentContext.Provider, { value: context, children });
3479
+ return /* @__PURE__ */ jsx24(AttachmentContext.Provider, { value: context, children });
3463
3480
  };
3464
3481
 
3465
3482
  // src/primitives/message/MessageAttachments.tsx
3466
- import { jsx as jsx24 } from "react/jsx-runtime";
3483
+ import { jsx as jsx25 } from "react/jsx-runtime";
3467
3484
  var getComponent = (components, attachment) => {
3468
3485
  const type = attachment.type;
3469
3486
  switch (type) {
@@ -3484,10 +3501,10 @@ var AttachmentComponent = ({ components }) => {
3484
3501
  (a) => getComponent(components, a.attachment)
3485
3502
  );
3486
3503
  if (!Component) return null;
3487
- return /* @__PURE__ */ jsx24(Component, {});
3504
+ return /* @__PURE__ */ jsx25(Component, {});
3488
3505
  };
3489
3506
  var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
3490
- return /* @__PURE__ */ jsx24(MessageAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx24(AttachmentComponent, { components }) });
3507
+ return /* @__PURE__ */ jsx25(MessageAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx25(AttachmentComponent, { components }) });
3491
3508
  };
3492
3509
  var MessageAttachment = memo3(
3493
3510
  MessageAttachmentImpl,
@@ -3499,7 +3516,7 @@ var MessagePrimitiveAttachments = ({ components }) => {
3499
3516
  if (message.role !== "user") return 0;
3500
3517
  return message.attachments.length;
3501
3518
  });
3502
- return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx24(
3519
+ return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx25(
3503
3520
  MessageAttachment,
3504
3521
  {
3505
3522
  attachmentIndex: index,
@@ -3511,9 +3528,9 @@ var MessagePrimitiveAttachments = ({ components }) => {
3511
3528
  MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
3512
3529
 
3513
3530
  // src/primitives/branchPicker/BranchPickerRoot.tsx
3514
- import { jsx as jsx25 } from "react/jsx-runtime";
3531
+ import { jsx as jsx26 } from "react/jsx-runtime";
3515
3532
  var BranchPickerPrimitiveRoot = forwardRef14(({ hideWhenSingleBranch, ...rest }, ref) => {
3516
- return /* @__PURE__ */ jsx25(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx25(Primitive7.div, { ...rest, ref }) });
3533
+ return /* @__PURE__ */ jsx26(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx26(Primitive7.div, { ...rest, ref }) });
3517
3534
  });
3518
3535
  BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
3519
3536
 
@@ -3535,7 +3552,7 @@ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
3535
3552
  import {
3536
3553
  forwardRef as forwardRef15
3537
3554
  } from "react";
3538
- import { jsx as jsx26 } from "react/jsx-runtime";
3555
+ import { jsx as jsx27 } from "react/jsx-runtime";
3539
3556
  var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) => {
3540
3557
  const send = useComposerSend();
3541
3558
  const handleSubmit = (e) => {
@@ -3543,7 +3560,7 @@ var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) =
3543
3560
  if (!send) return;
3544
3561
  send();
3545
3562
  };
3546
- return /* @__PURE__ */ jsx26(
3563
+ return /* @__PURE__ */ jsx27(
3547
3564
  Primitive8.form,
3548
3565
  {
3549
3566
  ...rest,
@@ -3566,7 +3583,7 @@ import {
3566
3583
  } from "react";
3567
3584
  import TextareaAutosize from "react-textarea-autosize";
3568
3585
  import { useEscapeKeydown as useEscapeKeydown2 } from "@radix-ui/react-use-escape-keydown";
3569
- import { jsx as jsx27 } from "react/jsx-runtime";
3586
+ import { jsx as jsx28 } from "react/jsx-runtime";
3570
3587
  var ComposerPrimitiveInput = forwardRef16(
3571
3588
  ({
3572
3589
  autoFocus = false,
@@ -3620,7 +3637,7 @@ var ComposerPrimitiveInput = forwardRef16(
3620
3637
  focus();
3621
3638
  }
3622
3639
  });
3623
- return /* @__PURE__ */ jsx27(
3640
+ return /* @__PURE__ */ jsx28(
3624
3641
  Component,
3625
3642
  {
3626
3643
  name: "input",
@@ -3662,9 +3679,9 @@ var ComposerPrimitiveAddAttachment = createActionButton(
3662
3679
  import { memo as memo4 } from "react";
3663
3680
 
3664
3681
  // src/context/providers/ComposerAttachmentProvider.tsx
3665
- import { useEffect as useEffect12, useState as useState12 } from "react";
3666
- import { create as create14 } from "zustand";
3667
- import { jsx as jsx28 } from "react/jsx-runtime";
3682
+ import { useEffect as useEffect12, useState as useState13 } from "react";
3683
+ import { create as create15 } from "zustand";
3684
+ import { jsx as jsx29 } from "react/jsx-runtime";
3668
3685
  var getAttachment2 = ({ attachments }, useAttachment, partIndex) => {
3669
3686
  let attachment = attachments[partIndex];
3670
3687
  if (!attachment) return null;
@@ -3674,9 +3691,9 @@ var getAttachment2 = ({ attachments }, useAttachment, partIndex) => {
3674
3691
  };
3675
3692
  var useComposerAttachmentContext = (partIndex) => {
3676
3693
  const { useComposer } = useThreadContext();
3677
- const [context] = useState12(
3694
+ const [context] = useState13(
3678
3695
  () => {
3679
- const useAttachment = create14(
3696
+ const useAttachment = create15(
3680
3697
  () => getAttachment2(useComposer.getState(), void 0, partIndex)
3681
3698
  );
3682
3699
  return { type: "composer", useAttachment };
@@ -3699,11 +3716,11 @@ var useComposerAttachmentContext = (partIndex) => {
3699
3716
  };
3700
3717
  var ComposerAttachmentProvider = ({ attachmentIndex: partIndex, children }) => {
3701
3718
  const context = useComposerAttachmentContext(partIndex);
3702
- return /* @__PURE__ */ jsx28(AttachmentContext.Provider, { value: context, children });
3719
+ return /* @__PURE__ */ jsx29(AttachmentContext.Provider, { value: context, children });
3703
3720
  };
3704
3721
 
3705
3722
  // src/primitives/composer/ComposerAttachments.tsx
3706
- import { jsx as jsx29 } from "react/jsx-runtime";
3723
+ import { jsx as jsx30 } from "react/jsx-runtime";
3707
3724
  var getComponent2 = (components, attachment) => {
3708
3725
  const type = attachment.type;
3709
3726
  switch (type) {
@@ -3724,10 +3741,10 @@ var AttachmentComponent2 = ({ components }) => {
3724
3741
  (a) => getComponent2(components, a.attachment)
3725
3742
  );
3726
3743
  if (!Component) return null;
3727
- return /* @__PURE__ */ jsx29(Component, {});
3744
+ return /* @__PURE__ */ jsx30(Component, {});
3728
3745
  };
3729
3746
  var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
3730
- return /* @__PURE__ */ jsx29(ComposerAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx29(AttachmentComponent2, { components }) });
3747
+ return /* @__PURE__ */ jsx30(ComposerAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx30(AttachmentComponent2, { components }) });
3731
3748
  };
3732
3749
  var ComposerAttachment = memo4(
3733
3750
  ComposerAttachmentImpl,
@@ -3736,7 +3753,7 @@ var ComposerAttachment = memo4(
3736
3753
  var ComposerPrimitiveAttachments = ({ components }) => {
3737
3754
  const { useComposer } = useThreadContext();
3738
3755
  const attachmentsCount = useComposer((s) => s.attachments.length);
3739
- return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx29(
3756
+ return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx30(
3740
3757
  ComposerAttachment,
3741
3758
  {
3742
3759
  attachmentIndex: index,
@@ -3781,9 +3798,9 @@ __export(thread_exports, {
3781
3798
  // src/primitives/thread/ThreadRoot.tsx
3782
3799
  import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
3783
3800
  import { forwardRef as forwardRef17 } from "react";
3784
- import { jsx as jsx30 } from "react/jsx-runtime";
3801
+ import { jsx as jsx31 } from "react/jsx-runtime";
3785
3802
  var ThreadPrimitiveRoot = forwardRef17((props, ref) => {
3786
- return /* @__PURE__ */ jsx30(Primitive9.div, { ...props, ref });
3803
+ return /* @__PURE__ */ jsx31(Primitive9.div, { ...props, ref });
3787
3804
  });
3788
3805
  ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
3789
3806
 
@@ -3918,13 +3935,13 @@ var useThreadViewportAutoScroll = ({
3918
3935
  };
3919
3936
 
3920
3937
  // src/primitives/thread/ThreadViewport.tsx
3921
- import { jsx as jsx31 } from "react/jsx-runtime";
3938
+ import { jsx as jsx32 } from "react/jsx-runtime";
3922
3939
  var ThreadPrimitiveViewport = forwardRef18(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
3923
3940
  const autoScrollRef = useThreadViewportAutoScroll({
3924
3941
  autoScroll
3925
3942
  });
3926
3943
  const ref = useComposedRefs4(forwardedRef, autoScrollRef);
3927
- return /* @__PURE__ */ jsx31(Primitive10.div, { ...rest, ref, children });
3944
+ return /* @__PURE__ */ jsx32(Primitive10.div, { ...rest, ref, children });
3928
3945
  });
3929
3946
  ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
3930
3947
 
@@ -3932,15 +3949,15 @@ ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
3932
3949
  import { memo as memo5 } from "react";
3933
3950
 
3934
3951
  // src/context/providers/MessageProvider.tsx
3935
- import { useEffect as useEffect14, useState as useState13 } from "react";
3936
- import { create as create17 } from "zustand";
3952
+ import { useEffect as useEffect14, useState as useState14 } from "react";
3953
+ import { create as create18 } from "zustand";
3937
3954
 
3938
3955
  // src/context/stores/EditComposer.ts
3939
- import { create as create15 } from "zustand";
3956
+ import { create as create16 } from "zustand";
3940
3957
  var makeEditComposerStore = ({
3941
3958
  onEdit,
3942
3959
  onSend
3943
- }) => create15()((set, get) => ({
3960
+ }) => create16()((set, get) => ({
3944
3961
  get value() {
3945
3962
  return get().text;
3946
3963
  },
@@ -3974,8 +3991,8 @@ var makeEditComposerStore = ({
3974
3991
  }));
3975
3992
 
3976
3993
  // src/context/stores/MessageUtils.ts
3977
- import { create as create16 } from "zustand";
3978
- var makeMessageUtilsStore = () => create16((set) => {
3994
+ import { create as create17 } from "zustand";
3995
+ var makeMessageUtilsStore = () => create17((set) => {
3979
3996
  let utterance = null;
3980
3997
  return {
3981
3998
  isCopied: false,
@@ -4001,7 +4018,7 @@ var makeMessageUtilsStore = () => create16((set) => {
4001
4018
  });
4002
4019
 
4003
4020
  // src/context/providers/MessageProvider.tsx
4004
- import { jsx as jsx32 } from "react/jsx-runtime";
4021
+ import { jsx as jsx33 } from "react/jsx-runtime";
4005
4022
  var getIsLast = (messages, message) => {
4006
4023
  return messages[messages.length - 1]?.id === message.id;
4007
4024
  };
@@ -4023,8 +4040,8 @@ var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
4023
4040
  };
4024
4041
  var useMessageContext2 = (messageIndex) => {
4025
4042
  const { useThreadMessages, useThreadActions } = useThreadContext();
4026
- const [context] = useState13(() => {
4027
- const useMessage = create17(
4043
+ const [context] = useState14(() => {
4044
+ const useMessage = create18(
4028
4045
  () => getMessageState(
4029
4046
  useThreadMessages.getState(),
4030
4047
  useThreadActions.getState().getBranches,
@@ -4036,19 +4053,11 @@ var useMessageContext2 = (messageIndex) => {
4036
4053
  const useEditComposer = makeEditComposerStore({
4037
4054
  onEdit: () => {
4038
4055
  const message = useMessage.getState().message;
4039
- if (message.role !== "user")
4040
- throw new Error(
4041
- "Tried to edit a non-user message. Editing is only supported for user messages. This is likely an internal bug in assistant-ui."
4042
- );
4043
4056
  const text = getThreadMessageText(message);
4044
4057
  return text;
4045
4058
  },
4046
4059
  onSend: (text) => {
4047
4060
  const { message, parentId } = useMessage.getState();
4048
- if (message.role !== "user")
4049
- throw new Error(
4050
- "Tried to edit a non-user message. Editing is only supported for user messages. This is likely an internal bug in assistant-ui."
4051
- );
4052
4061
  const previousText = getThreadMessageText(message);
4053
4062
  if (previousText === text) return;
4054
4063
  const nonTextParts = message.content.filter(
@@ -4056,7 +4065,7 @@ var useMessageContext2 = (messageIndex) => {
4056
4065
  );
4057
4066
  useThreadActions.getState().append({
4058
4067
  parentId,
4059
- role: "user",
4068
+ role: message.role,
4060
4069
  content: [{ type: "text", text }, ...nonTextParts],
4061
4070
  attachments: message.attachments
4062
4071
  });
@@ -4085,37 +4094,58 @@ var MessageProvider = ({
4085
4094
  children
4086
4095
  }) => {
4087
4096
  const context = useMessageContext2(messageIndex);
4088
- return /* @__PURE__ */ jsx32(MessageContext.Provider, { value: context, children });
4097
+ return /* @__PURE__ */ jsx33(MessageContext.Provider, { value: context, children });
4089
4098
  };
4090
4099
 
4091
4100
  // src/primitives/thread/ThreadMessages.tsx
4092
- import { jsx as jsx33, jsxs as jsxs4 } from "react/jsx-runtime";
4101
+ import { jsx as jsx34 } from "react/jsx-runtime";
4102
+ var isComponentsSame = (prev, next) => {
4103
+ return prev.Message === next.Message && prev.EditComposer === next.EditComposer && prev.UserEditComposer === next.UserEditComposer && prev.AssistantEditComposer === next.AssistantEditComposer && prev.SystemEditComposer === next.SystemEditComposer && prev.UserMessage === next.UserMessage && prev.AssistantMessage === next.AssistantMessage && prev.SystemMessage === next.SystemMessage;
4104
+ };
4093
4105
  var DEFAULT_SYSTEM_MESSAGE = () => null;
4094
- var getComponents = (components) => {
4095
- return {
4096
- EditComposer: components.EditComposer ?? components.UserMessage ?? components.Message,
4097
- UserMessage: components.UserMessage ?? components.Message,
4098
- AssistantMessage: components.AssistantMessage ?? components.Message,
4099
- SystemMessage: components.SystemMessage ?? DEFAULT_SYSTEM_MESSAGE
4100
- };
4106
+ var getComponent3 = (components, role, isEditing) => {
4107
+ switch (role) {
4108
+ case "user":
4109
+ if (isEditing) {
4110
+ return components.UserEditComposer ?? components.EditComposer ?? components.UserMessage ?? components.Message;
4111
+ } else {
4112
+ return components.UserMessage ?? components.Message;
4113
+ }
4114
+ case "assistant":
4115
+ if (isEditing) {
4116
+ return components.AssistantEditComposer ?? components.EditComposer ?? components.AssistantMessage ?? components.Message;
4117
+ } else {
4118
+ return components.AssistantMessage ?? components.Message;
4119
+ }
4120
+ case "system":
4121
+ if (isEditing) {
4122
+ return components.SystemEditComposer ?? components.EditComposer ?? components.SystemMessage ?? components.Message;
4123
+ } else {
4124
+ return components.SystemMessage ?? DEFAULT_SYSTEM_MESSAGE;
4125
+ }
4126
+ default:
4127
+ const _exhaustiveCheck = role;
4128
+ throw new Error(`Unknown message role: ${_exhaustiveCheck}`);
4129
+ }
4130
+ };
4131
+ var ThreadMessageComponent = ({
4132
+ components
4133
+ }) => {
4134
+ const { useMessage, useEditComposer } = useMessageContext();
4135
+ const role = useMessage((m) => m.message.role);
4136
+ const isEditing = useEditComposer((c) => c.isEditing);
4137
+ const Component = getComponent3(components, role, isEditing);
4138
+ return /* @__PURE__ */ jsx34(Component, {});
4101
4139
  };
4102
4140
  var ThreadMessageImpl = ({
4103
4141
  messageIndex,
4104
4142
  components
4105
4143
  }) => {
4106
- const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
4107
- return /* @__PURE__ */ jsxs4(MessageProvider, { messageIndex, children: [
4108
- /* @__PURE__ */ jsxs4(MessagePrimitiveIf, { user: true, children: [
4109
- /* @__PURE__ */ jsx33(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx33(UserMessage2, {}) }),
4110
- /* @__PURE__ */ jsx33(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx33(EditComposer2, {}) })
4111
- ] }),
4112
- /* @__PURE__ */ jsx33(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx33(AssistantMessage2, {}) }),
4113
- /* @__PURE__ */ jsx33(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx33(SystemMessage2, {}) })
4114
- ] });
4144
+ return /* @__PURE__ */ jsx34(MessageProvider, { messageIndex, children: /* @__PURE__ */ jsx34(ThreadMessageComponent, { components }) });
4115
4145
  };
4116
4146
  var ThreadMessage = memo5(
4117
4147
  ThreadMessageImpl,
4118
- (prev, next) => prev.messageIndex === next.messageIndex && prev.components.Message === next.components.Message && prev.components.UserMessage === next.components.UserMessage && prev.components.EditComposer === next.components.EditComposer && prev.components.AssistantMessage === next.components.AssistantMessage && prev.components.SystemMessage === next.components.SystemMessage
4148
+ (prev, next) => prev.messageIndex === next.messageIndex && isComponentsSame(prev.components, next.components)
4119
4149
  );
4120
4150
  var ThreadPrimitiveMessagesImpl = ({
4121
4151
  components
@@ -4123,12 +4153,12 @@ var ThreadPrimitiveMessagesImpl = ({
4123
4153
  const { useThreadMessages } = useThreadContext();
4124
4154
  const messagesLength = useThreadMessages((t) => t.length);
4125
4155
  if (messagesLength === 0) return null;
4126
- return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */ jsx33(ThreadMessage, { messageIndex: index, components }, index));
4156
+ return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */ jsx34(ThreadMessage, { messageIndex: index, components }, index));
4127
4157
  };
4128
4158
  ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
4129
4159
  var ThreadPrimitiveMessages = memo5(
4130
4160
  ThreadPrimitiveMessagesImpl,
4131
- (prev, next) => prev.components?.Message === next.components?.Message && prev.components?.UserMessage === next.components?.UserMessage && prev.components?.EditComposer === next.components?.EditComposer && prev.components?.AssistantMessage === next.components?.AssistantMessage && prev.components?.SystemMessage === next.components?.SystemMessage
4161
+ (prev, next) => isComponentsSame(prev.components, next.components)
4132
4162
  );
4133
4163
 
4134
4164
  // src/primitives/thread/ThreadScrollToBottom.tsx
@@ -4149,7 +4179,7 @@ import {
4149
4179
  createContext as createContext7,
4150
4180
  useContext as useContext7
4151
4181
  } from "react";
4152
- import { Fragment as Fragment3, jsx as jsx34 } from "react/jsx-runtime";
4182
+ import { Fragment as Fragment3, jsx as jsx35 } from "react/jsx-runtime";
4153
4183
  var ThreadConfigContext = createContext7({});
4154
4184
  var useThreadConfig = () => {
4155
4185
  return useContext7(ThreadConfigContext);
@@ -4159,14 +4189,14 @@ var ThreadConfigProvider = ({
4159
4189
  config
4160
4190
  }) => {
4161
4191
  const assistant = useAssistantContext({ optional: true });
4162
- const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx34(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx34(Fragment3, { children });
4192
+ const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx35(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx35(Fragment3, { children });
4163
4193
  if (!config?.runtime) return configProvider;
4164
4194
  if (assistant) {
4165
4195
  throw new Error(
4166
4196
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
4167
4197
  );
4168
4198
  }
4169
- return /* @__PURE__ */ jsx34(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
4199
+ return /* @__PURE__ */ jsx35(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
4170
4200
  };
4171
4201
  ThreadConfigProvider.displayName = "ThreadConfigProvider";
4172
4202
 
@@ -4179,7 +4209,7 @@ import {
4179
4209
  RefreshCwIcon,
4180
4210
  StopCircleIcon
4181
4211
  } from "lucide-react";
4182
- import { Fragment as Fragment4, jsx as jsx35, jsxs as jsxs5 } from "react/jsx-runtime";
4212
+ import { Fragment as Fragment4, jsx as jsx36, jsxs as jsxs4 } from "react/jsx-runtime";
4183
4213
  var useAllowCopy = (ensureCapability = false) => {
4184
4214
  const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
4185
4215
  const { useThread } = useThreadContext();
@@ -4203,16 +4233,16 @@ var AssistantActionBar = () => {
4203
4233
  const allowReload = useAllowReload(true);
4204
4234
  const allowSpeak = useAllowSpeak(true);
4205
4235
  if (!allowCopy && !allowReload && !allowSpeak) return null;
4206
- return /* @__PURE__ */ jsxs5(
4236
+ return /* @__PURE__ */ jsxs4(
4207
4237
  AssistantActionBarRoot,
4208
4238
  {
4209
4239
  hideWhenRunning: true,
4210
4240
  autohide: "not-last",
4211
4241
  autohideFloat: "single-branch",
4212
4242
  children: [
4213
- allowSpeak && /* @__PURE__ */ jsx35(AssistantActionBarSpeechControl, {}),
4214
- allowCopy && /* @__PURE__ */ jsx35(AssistantActionBarCopy, {}),
4215
- allowReload && /* @__PURE__ */ jsx35(AssistantActionBarReload, {})
4243
+ allowSpeak && /* @__PURE__ */ jsx36(AssistantActionBarSpeechControl, {}),
4244
+ allowCopy && /* @__PURE__ */ jsx36(AssistantActionBarCopy, {}),
4245
+ allowReload && /* @__PURE__ */ jsx36(AssistantActionBarReload, {})
4216
4246
  ]
4217
4247
  }
4218
4248
  );
@@ -4228,16 +4258,16 @@ var AssistantActionBarCopy = forwardRef19((props, ref) => {
4228
4258
  assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
4229
4259
  } = {}
4230
4260
  } = useThreadConfig();
4231
- return /* @__PURE__ */ jsx35(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx35(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
4232
- /* @__PURE__ */ jsx35(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx35(CheckIcon, {}) }),
4233
- /* @__PURE__ */ jsx35(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx35(CopyIcon, {}) })
4261
+ return /* @__PURE__ */ jsx36(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs4(Fragment4, { children: [
4262
+ /* @__PURE__ */ jsx36(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx36(CheckIcon, {}) }),
4263
+ /* @__PURE__ */ jsx36(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx36(CopyIcon, {}) })
4234
4264
  ] }) }) });
4235
4265
  });
4236
4266
  AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
4237
4267
  var AssistantActionBarSpeechControl = () => {
4238
- return /* @__PURE__ */ jsxs5(Fragment4, { children: [
4239
- /* @__PURE__ */ jsx35(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx35(AssistantActionBarSpeak, {}) }),
4240
- /* @__PURE__ */ jsx35(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx35(AssistantActionBarStopSpeaking, {}) })
4268
+ return /* @__PURE__ */ jsxs4(Fragment4, { children: [
4269
+ /* @__PURE__ */ jsx36(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx36(AssistantActionBarSpeak, {}) }),
4270
+ /* @__PURE__ */ jsx36(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx36(AssistantActionBarStopSpeaking, {}) })
4241
4271
  ] });
4242
4272
  };
4243
4273
  var AssistantActionBarSpeak = forwardRef19((props, ref) => {
@@ -4247,7 +4277,7 @@ var AssistantActionBarSpeak = forwardRef19((props, ref) => {
4247
4277
  } = {}
4248
4278
  } = useThreadConfig();
4249
4279
  const allowSpeak = useAllowSpeak();
4250
- return /* @__PURE__ */ jsx35(actionBar_exports.Speak, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx35(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx35(AudioLinesIcon, {}) }) });
4280
+ return /* @__PURE__ */ jsx36(actionBar_exports.Speak, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(AudioLinesIcon, {}) }) });
4251
4281
  });
4252
4282
  AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
4253
4283
  var AssistantActionBarStopSpeaking = forwardRef19((props, ref) => {
@@ -4259,7 +4289,7 @@ var AssistantActionBarStopSpeaking = forwardRef19((props, ref) => {
4259
4289
  } = {}
4260
4290
  } = useThreadConfig();
4261
4291
  const allowSpeak = useAllowSpeak();
4262
- return /* @__PURE__ */ jsx35(actionBar_exports.StopSpeaking, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx35(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx35(StopCircleIcon, {}) }) });
4292
+ return /* @__PURE__ */ jsx36(actionBar_exports.StopSpeaking, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(StopCircleIcon, {}) }) });
4263
4293
  });
4264
4294
  AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
4265
4295
  var AssistantActionBarReload = forwardRef19((props, ref) => {
@@ -4269,7 +4299,7 @@ var AssistantActionBarReload = forwardRef19((props, ref) => {
4269
4299
  } = {}
4270
4300
  } = useThreadConfig();
4271
4301
  const allowReload = useAllowReload();
4272
- return /* @__PURE__ */ jsx35(actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ jsx35(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx35(RefreshCwIcon, {}) }) });
4302
+ return /* @__PURE__ */ jsx36(actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx36(RefreshCwIcon, {}) }) });
4273
4303
  });
4274
4304
  AssistantActionBarReload.displayName = "AssistantActionBarReload";
4275
4305
  var exports = {
@@ -4291,7 +4321,7 @@ import { forwardRef as forwardRef21, useMemo as useMemo5 } from "react";
4291
4321
  // src/ui/branch-picker.tsx
4292
4322
  import { forwardRef as forwardRef20 } from "react";
4293
4323
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
4294
- import { jsx as jsx36, jsxs as jsxs6 } from "react/jsx-runtime";
4324
+ import { jsx as jsx37, jsxs as jsxs5 } from "react/jsx-runtime";
4295
4325
  var useAllowBranchPicker = (ensureCapability = false) => {
4296
4326
  const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
4297
4327
  const { useThread } = useThreadContext();
@@ -4301,10 +4331,10 @@ var useAllowBranchPicker = (ensureCapability = false) => {
4301
4331
  var BranchPicker = () => {
4302
4332
  const allowBranchPicker = useAllowBranchPicker();
4303
4333
  if (!allowBranchPicker) return null;
4304
- return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
4305
- /* @__PURE__ */ jsx36(BranchPickerPrevious2, {}),
4306
- /* @__PURE__ */ jsx36(BranchPickerState, {}),
4307
- /* @__PURE__ */ jsx36(BranchPickerNext, {})
4334
+ return /* @__PURE__ */ jsxs5(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
4335
+ /* @__PURE__ */ jsx37(BranchPickerPrevious2, {}),
4336
+ /* @__PURE__ */ jsx37(BranchPickerState, {}),
4337
+ /* @__PURE__ */ jsx37(BranchPickerNext, {})
4308
4338
  ] });
4309
4339
  };
4310
4340
  BranchPicker.displayName = "BranchPicker";
@@ -4319,17 +4349,17 @@ var BranchPickerPrevious2 = forwardRef20((props, ref) => {
4319
4349
  } = {}
4320
4350
  } = useThreadConfig();
4321
4351
  const allowBranchPicker = useAllowBranchPicker();
4322
- return /* @__PURE__ */ jsx36(branchPicker_exports.Previous, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(ChevronLeftIcon, {}) }) });
4352
+ return /* @__PURE__ */ jsx37(branchPicker_exports.Previous, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(ChevronLeftIcon, {}) }) });
4323
4353
  });
4324
4354
  BranchPickerPrevious2.displayName = "BranchPickerPrevious";
4325
4355
  var BranchPickerStateWrapper = withDefaults("span", {
4326
4356
  className: "aui-branch-picker-state"
4327
4357
  });
4328
4358
  var BranchPickerState = forwardRef20((props, ref) => {
4329
- return /* @__PURE__ */ jsxs6(BranchPickerStateWrapper, { ...props, ref, children: [
4330
- /* @__PURE__ */ jsx36(branchPicker_exports.Number, {}),
4359
+ return /* @__PURE__ */ jsxs5(BranchPickerStateWrapper, { ...props, ref, children: [
4360
+ /* @__PURE__ */ jsx37(branchPicker_exports.Number, {}),
4331
4361
  " / ",
4332
- /* @__PURE__ */ jsx36(branchPicker_exports.Count, {})
4362
+ /* @__PURE__ */ jsx37(branchPicker_exports.Count, {})
4333
4363
  ] });
4334
4364
  });
4335
4365
  BranchPickerState.displayName = "BranchPickerState";
@@ -4338,7 +4368,7 @@ var BranchPickerNext = forwardRef20((props, ref) => {
4338
4368
  strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
4339
4369
  } = useThreadConfig();
4340
4370
  const allowBranchPicker = useAllowBranchPicker();
4341
- return /* @__PURE__ */ jsx36(branchPicker_exports.Next, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(ChevronRightIcon, {}) }) });
4371
+ return /* @__PURE__ */ jsx37(branchPicker_exports.Next, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(ChevronRightIcon, {}) }) });
4342
4372
  });
4343
4373
  BranchPickerNext.displayName = "BranchPickerNext";
4344
4374
  var exports2 = {
@@ -4350,12 +4380,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
4350
4380
 
4351
4381
  // src/ui/base/avatar.tsx
4352
4382
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
4353
- import { jsx as jsx37, jsxs as jsxs7 } from "react/jsx-runtime";
4383
+ import { jsx as jsx38, jsxs as jsxs6 } from "react/jsx-runtime";
4354
4384
  var Avatar = ({ src, alt, fallback }) => {
4355
4385
  if (src == null && fallback == null) return null;
4356
- return /* @__PURE__ */ jsxs7(AvatarRoot, { children: [
4357
- src != null && /* @__PURE__ */ jsx37(AvatarImage, { src, alt }),
4358
- fallback != null && /* @__PURE__ */ jsx37(AvatarFallback, { children: fallback })
4386
+ return /* @__PURE__ */ jsxs6(AvatarRoot, { children: [
4387
+ src != null && /* @__PURE__ */ jsx38(AvatarImage, { src, alt }),
4388
+ fallback != null && /* @__PURE__ */ jsx38(AvatarFallback, { children: fallback })
4359
4389
  ] });
4360
4390
  };
4361
4391
  Avatar.displayName = "Avatar";
@@ -4374,10 +4404,10 @@ AvatarFallback.displayName = "AvatarFallback";
4374
4404
 
4375
4405
  // src/ui/content-part.tsx
4376
4406
  import classNames2 from "classnames";
4377
- import { jsx as jsx38 } from "react/jsx-runtime";
4407
+ import { jsx as jsx39 } from "react/jsx-runtime";
4378
4408
  var Text = () => {
4379
4409
  const status = useSmoothStatus();
4380
- return /* @__PURE__ */ jsx38(
4410
+ return /* @__PURE__ */ jsx39(
4381
4411
  contentPart_exports.Text,
4382
4412
  {
4383
4413
  className: classNames2(
@@ -4392,19 +4422,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) };
4392
4422
  var content_part_default = exports3;
4393
4423
 
4394
4424
  // src/ui/assistant-message.tsx
4395
- import { jsx as jsx39, jsxs as jsxs8 } from "react/jsx-runtime";
4425
+ import { jsx as jsx40, jsxs as jsxs7 } from "react/jsx-runtime";
4396
4426
  var AssistantMessage = () => {
4397
- return /* @__PURE__ */ jsxs8(AssistantMessageRoot, { children: [
4398
- /* @__PURE__ */ jsx39(AssistantMessageAvatar, {}),
4399
- /* @__PURE__ */ jsx39(AssistantMessageContent, {}),
4400
- /* @__PURE__ */ jsx39(branch_picker_default, {}),
4401
- /* @__PURE__ */ jsx39(assistant_action_bar_default, {})
4427
+ return /* @__PURE__ */ jsxs7(AssistantMessageRoot, { children: [
4428
+ /* @__PURE__ */ jsx40(AssistantMessageAvatar, {}),
4429
+ /* @__PURE__ */ jsx40(AssistantMessageContent, {}),
4430
+ /* @__PURE__ */ jsx40(branch_picker_default, {}),
4431
+ /* @__PURE__ */ jsx40(assistant_action_bar_default, {})
4402
4432
  ] });
4403
4433
  };
4404
4434
  AssistantMessage.displayName = "AssistantMessage";
4405
4435
  var AssistantMessageAvatar = () => {
4406
4436
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4407
- return /* @__PURE__ */ jsx39(Avatar, { ...avatar });
4437
+ return /* @__PURE__ */ jsx40(Avatar, { ...avatar });
4408
4438
  };
4409
4439
  var AssistantMessageRoot = withDefaults(message_exports.Root, {
4410
4440
  className: "aui-assistant-message-root"
@@ -4428,7 +4458,7 @@ var AssistantMessageContent = forwardRef21(({ components: componentsProp, ...res
4428
4458
  // eslint-disable-next-line react-hooks/exhaustive-deps
4429
4459
  [...tools ?? [], components.ToolFallback]
4430
4460
  );
4431
- return /* @__PURE__ */ jsx39(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx39(
4461
+ return /* @__PURE__ */ jsx40(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx40(
4432
4462
  message_exports.Content,
4433
4463
  {
4434
4464
  components: {
@@ -4463,9 +4493,9 @@ import { forwardRef as forwardRef23 } from "react";
4463
4493
  import { PaperclipIcon, SendHorizontalIcon } from "lucide-react";
4464
4494
 
4465
4495
  // src/ui/base/CircleStopIcon.tsx
4466
- import { jsx as jsx40 } from "react/jsx-runtime";
4496
+ import { jsx as jsx41 } from "react/jsx-runtime";
4467
4497
  var CircleStopIcon = () => {
4468
- return /* @__PURE__ */ jsx40(
4498
+ return /* @__PURE__ */ jsx41(
4469
4499
  "svg",
4470
4500
  {
4471
4501
  xmlns: "http://www.w3.org/2000/svg",
@@ -4473,7 +4503,7 @@ var CircleStopIcon = () => {
4473
4503
  fill: "currentColor",
4474
4504
  width: "16",
4475
4505
  height: "16",
4476
- children: /* @__PURE__ */ jsx40("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
4506
+ children: /* @__PURE__ */ jsx41("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
4477
4507
  }
4478
4508
  );
4479
4509
  };
@@ -4482,7 +4512,7 @@ CircleStopIcon.displayName = "CircleStopIcon";
4482
4512
  // src/ui/composer-attachment.tsx
4483
4513
  import { forwardRef as forwardRef22 } from "react";
4484
4514
  import { CircleXIcon } from "lucide-react";
4485
- import { jsx as jsx41, jsxs as jsxs9 } from "react/jsx-runtime";
4515
+ import { jsx as jsx42, jsxs as jsxs8 } from "react/jsx-runtime";
4486
4516
  var ComposerAttachmentRoot = withDefaults("div", {
4487
4517
  className: "aui-composer-attachment-root"
4488
4518
  });
@@ -4490,10 +4520,10 @@ ComposerAttachmentRoot.displayName = "ComposerAttachmentRoot";
4490
4520
  var ComposerAttachment2 = () => {
4491
4521
  const { useAttachment } = useAttachmentContext({ type: "composer" });
4492
4522
  const attachment = useAttachment((a) => a.attachment);
4493
- return /* @__PURE__ */ jsxs9(ComposerAttachmentRoot, { children: [
4523
+ return /* @__PURE__ */ jsxs8(ComposerAttachmentRoot, { children: [
4494
4524
  ".",
4495
4525
  attachment.name.split(".").pop(),
4496
- /* @__PURE__ */ jsx41(ComposerAttachmentRemove, {})
4526
+ /* @__PURE__ */ jsx42(ComposerAttachmentRemove, {})
4497
4527
  ] });
4498
4528
  };
4499
4529
  ComposerAttachment2.displayName = "ComposerAttachment";
@@ -4508,7 +4538,7 @@ var ComposerAttachmentRemove = forwardRef22((props, ref) => {
4508
4538
  const handleRemoveAttachment = () => {
4509
4539
  useComposer.getState().removeAttachment(useAttachment.getState().attachment.id);
4510
4540
  };
4511
- return /* @__PURE__ */ jsx41(
4541
+ return /* @__PURE__ */ jsx42(
4512
4542
  TooltipIconButton,
4513
4543
  {
4514
4544
  tooltip,
@@ -4517,7 +4547,7 @@ var ComposerAttachmentRemove = forwardRef22((props, ref) => {
4517
4547
  ...props,
4518
4548
  onClick: handleRemoveAttachment,
4519
4549
  ref,
4520
- children: props.children ?? /* @__PURE__ */ jsx41(CircleXIcon, {})
4550
+ children: props.children ?? /* @__PURE__ */ jsx42(CircleXIcon, {})
4521
4551
  }
4522
4552
  );
4523
4553
  });
@@ -4532,7 +4562,7 @@ var composer_attachment_default = Object.assign(
4532
4562
  );
4533
4563
 
4534
4564
  // src/ui/composer.tsx
4535
- import { Fragment as Fragment5, jsx as jsx42, jsxs as jsxs10 } from "react/jsx-runtime";
4565
+ import { Fragment as Fragment5, jsx as jsx43, jsxs as jsxs9 } from "react/jsx-runtime";
4536
4566
  var useAllowAttachments = (ensureCapability = false) => {
4537
4567
  const { composer: { allowAttachments = true } = {} } = useThreadConfig();
4538
4568
  const { useThread } = useThreadContext();
@@ -4541,11 +4571,11 @@ var useAllowAttachments = (ensureCapability = false) => {
4541
4571
  };
4542
4572
  var Composer = () => {
4543
4573
  const allowAttachments = useAllowAttachments(true);
4544
- return /* @__PURE__ */ jsxs10(ComposerRoot, { children: [
4545
- allowAttachments && /* @__PURE__ */ jsx42(ComposerAttachments, {}),
4546
- allowAttachments && /* @__PURE__ */ jsx42(ComposerAddAttachment, {}),
4547
- /* @__PURE__ */ jsx42(ComposerInput, { autoFocus: true }),
4548
- /* @__PURE__ */ jsx42(ComposerAction, {})
4574
+ return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
4575
+ allowAttachments && /* @__PURE__ */ jsx43(ComposerAttachments, {}),
4576
+ allowAttachments && /* @__PURE__ */ jsx43(ComposerAddAttachment, {}),
4577
+ /* @__PURE__ */ jsx43(ComposerInput, { autoFocus: true }),
4578
+ /* @__PURE__ */ jsx43(ComposerAction, {})
4549
4579
  ] });
4550
4580
  };
4551
4581
  Composer.displayName = "Composer";
@@ -4565,7 +4595,7 @@ var ComposerInput = forwardRef23(
4565
4595
  composer: { input: { placeholder = "Write a message..." } = {} } = {}
4566
4596
  } = {}
4567
4597
  } = useThreadConfig();
4568
- return /* @__PURE__ */ jsx42(ComposerInputStyled, { placeholder, ...props, ref });
4598
+ return /* @__PURE__ */ jsx43(ComposerInputStyled, { placeholder, ...props, ref });
4569
4599
  }
4570
4600
  );
4571
4601
  ComposerInput.displayName = "ComposerInput";
@@ -4573,7 +4603,7 @@ var ComposerAttachmentsContainer = withDefaults("div", {
4573
4603
  className: "aui-composer-attachments"
4574
4604
  });
4575
4605
  var ComposerAttachments = ({ components }) => {
4576
- return /* @__PURE__ */ jsx42(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx42(
4606
+ return /* @__PURE__ */ jsx43(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx43(
4577
4607
  composer_exports.Attachments,
4578
4608
  {
4579
4609
  components: {
@@ -4594,14 +4624,14 @@ var ComposerAddAttachment = forwardRef23((props, ref) => {
4594
4624
  } = {}
4595
4625
  } = useThreadConfig();
4596
4626
  const allowAttachments = useAllowAttachments();
4597
- return /* @__PURE__ */ jsx42(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx42(
4627
+ return /* @__PURE__ */ jsx43(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx43(
4598
4628
  ComposerAttachButton,
4599
4629
  {
4600
4630
  tooltip,
4601
4631
  variant: "ghost",
4602
4632
  ...props,
4603
4633
  ref,
4604
- children: props.children ?? /* @__PURE__ */ jsx42(PaperclipIcon, {})
4634
+ children: props.children ?? /* @__PURE__ */ jsx43(PaperclipIcon, {})
4605
4635
  }
4606
4636
  ) });
4607
4637
  });
@@ -4613,10 +4643,10 @@ var useAllowCancel = () => {
4613
4643
  };
4614
4644
  var ComposerAction = () => {
4615
4645
  const allowCancel = useAllowCancel();
4616
- if (!allowCancel) return /* @__PURE__ */ jsx42(ComposerSend, {});
4617
- return /* @__PURE__ */ jsxs10(Fragment5, { children: [
4618
- /* @__PURE__ */ jsx42(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx42(ComposerSend, {}) }),
4619
- /* @__PURE__ */ jsx42(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx42(ComposerCancel, {}) })
4646
+ if (!allowCancel) return /* @__PURE__ */ jsx43(ComposerSend, {});
4647
+ return /* @__PURE__ */ jsxs9(Fragment5, { children: [
4648
+ /* @__PURE__ */ jsx43(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx43(ComposerSend, {}) }),
4649
+ /* @__PURE__ */ jsx43(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx43(ComposerCancel, {}) })
4620
4650
  ] });
4621
4651
  };
4622
4652
  ComposerAction.displayName = "ComposerAction";
@@ -4628,7 +4658,7 @@ var ComposerSend = forwardRef23((props, ref) => {
4628
4658
  const {
4629
4659
  strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
4630
4660
  } = useThreadConfig();
4631
- return /* @__PURE__ */ jsx42(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx42(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx42(SendHorizontalIcon, {}) }) });
4661
+ return /* @__PURE__ */ jsx43(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx43(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx43(SendHorizontalIcon, {}) }) });
4632
4662
  });
4633
4663
  ComposerSend.displayName = "ComposerSend";
4634
4664
  var ComposerCancelButton = withDefaults(TooltipIconButton, {
@@ -4639,7 +4669,7 @@ var ComposerCancel = forwardRef23((props, ref) => {
4639
4669
  const {
4640
4670
  strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
4641
4671
  } = useThreadConfig();
4642
- return /* @__PURE__ */ jsx42(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx42(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx42(CircleStopIcon, {}) }) });
4672
+ return /* @__PURE__ */ jsx43(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx43(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx43(CircleStopIcon, {}) }) });
4643
4673
  });
4644
4674
  ComposerCancel.displayName = "ComposerCancel";
4645
4675
  var exports6 = {
@@ -4655,14 +4685,14 @@ var composer_default = Object.assign(Composer, exports6);
4655
4685
 
4656
4686
  // src/ui/thread-welcome.tsx
4657
4687
  import { forwardRef as forwardRef24 } from "react";
4658
- import { jsx as jsx43, jsxs as jsxs11 } from "react/jsx-runtime";
4688
+ import { jsx as jsx44, jsxs as jsxs10 } from "react/jsx-runtime";
4659
4689
  var ThreadWelcome = () => {
4660
- return /* @__PURE__ */ jsxs11(ThreadWelcomeRoot, { children: [
4661
- /* @__PURE__ */ jsxs11(ThreadWelcomeCenter, { children: [
4662
- /* @__PURE__ */ jsx43(ThreadWelcomeAvatar, {}),
4663
- /* @__PURE__ */ jsx43(ThreadWelcomeMessage, {})
4690
+ return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
4691
+ /* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
4692
+ /* @__PURE__ */ jsx44(ThreadWelcomeAvatar, {}),
4693
+ /* @__PURE__ */ jsx44(ThreadWelcomeMessage, {})
4664
4694
  ] }),
4665
- /* @__PURE__ */ jsx43(ThreadWelcomeSuggestions, {})
4695
+ /* @__PURE__ */ jsx44(ThreadWelcomeSuggestions, {})
4666
4696
  ] });
4667
4697
  };
4668
4698
  ThreadWelcome.displayName = "ThreadWelcome";
@@ -4674,20 +4704,20 @@ var ThreadWelcomeCenter = withDefaults("div", {
4674
4704
  });
4675
4705
  var ThreadWelcomeRoot = forwardRef24(
4676
4706
  (props, ref) => {
4677
- return /* @__PURE__ */ jsx43(thread_exports.Empty, { children: /* @__PURE__ */ jsx43(ThreadWelcomeRootStyled, { ...props, ref }) });
4707
+ return /* @__PURE__ */ jsx44(thread_exports.Empty, { children: /* @__PURE__ */ jsx44(ThreadWelcomeRootStyled, { ...props, ref }) });
4678
4708
  }
4679
4709
  );
4680
4710
  ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
4681
4711
  var ThreadWelcomeAvatar = () => {
4682
4712
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4683
- return /* @__PURE__ */ jsx43(Avatar, { ...avatar });
4713
+ return /* @__PURE__ */ jsx44(Avatar, { ...avatar });
4684
4714
  };
4685
4715
  var ThreadWelcomeMessageStyled = withDefaults("p", {
4686
4716
  className: "aui-thread-welcome-message"
4687
4717
  });
4688
4718
  var ThreadWelcomeMessage = forwardRef24(({ message: messageProp, ...rest }, ref) => {
4689
4719
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
4690
- return /* @__PURE__ */ jsx43(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
4720
+ return /* @__PURE__ */ jsx44(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
4691
4721
  });
4692
4722
  ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
4693
4723
  var ThreadWelcomeSuggestionContainer = withDefaults("div", {
@@ -4699,21 +4729,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
4699
4729
  var ThreadWelcomeSuggestion = ({
4700
4730
  suggestion: { text, prompt }
4701
4731
  }) => {
4702
- return /* @__PURE__ */ jsx43(
4732
+ return /* @__PURE__ */ jsx44(
4703
4733
  ThreadWelcomeSuggestionStyled,
4704
4734
  {
4705
4735
  prompt,
4706
4736
  method: "replace",
4707
4737
  autoSend: true,
4708
- children: /* @__PURE__ */ jsx43("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
4738
+ children: /* @__PURE__ */ jsx44("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
4709
4739
  }
4710
4740
  );
4711
4741
  };
4712
4742
  var ThreadWelcomeSuggestions = () => {
4713
4743
  const { welcome: { suggestions } = {} } = useThreadConfig();
4714
- return /* @__PURE__ */ jsx43(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
4744
+ return /* @__PURE__ */ jsx44(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
4715
4745
  const key = `${suggestion.prompt}-${idx}`;
4716
- return /* @__PURE__ */ jsx43(ThreadWelcomeSuggestion, { suggestion }, key);
4746
+ return /* @__PURE__ */ jsx44(ThreadWelcomeSuggestion, { suggestion }, key);
4717
4747
  }) });
4718
4748
  };
4719
4749
  ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
@@ -4733,7 +4763,7 @@ import { forwardRef as forwardRef26 } from "react";
4733
4763
  // src/ui/user-action-bar.tsx
4734
4764
  import { forwardRef as forwardRef25 } from "react";
4735
4765
  import { PencilIcon } from "lucide-react";
4736
- import { jsx as jsx44 } from "react/jsx-runtime";
4766
+ import { jsx as jsx45 } from "react/jsx-runtime";
4737
4767
  var useAllowEdit = (ensureCapability = false) => {
4738
4768
  const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
4739
4769
  const { useThread } = useThreadContext();
@@ -4743,7 +4773,7 @@ var useAllowEdit = (ensureCapability = false) => {
4743
4773
  var UserActionBar = () => {
4744
4774
  const allowEdit = useAllowEdit(true);
4745
4775
  if (!allowEdit) return null;
4746
- return /* @__PURE__ */ jsx44(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx44(UserActionBarEdit, {}) });
4776
+ return /* @__PURE__ */ jsx45(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx45(UserActionBarEdit, {}) });
4747
4777
  };
4748
4778
  UserActionBar.displayName = "UserActionBar";
4749
4779
  var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
@@ -4755,7 +4785,7 @@ var UserActionBarEdit = forwardRef25((props, ref) => {
4755
4785
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
4756
4786
  } = useThreadConfig();
4757
4787
  const allowEdit = useAllowEdit();
4758
- return /* @__PURE__ */ jsx44(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx44(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx44(PencilIcon, {}) }) });
4788
+ return /* @__PURE__ */ jsx45(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx45(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx45(PencilIcon, {}) }) });
4759
4789
  });
4760
4790
  UserActionBarEdit.displayName = "UserActionBarEdit";
4761
4791
  var exports8 = {
@@ -4765,7 +4795,7 @@ var exports8 = {
4765
4795
  var user_action_bar_default = Object.assign(UserActionBar, exports8);
4766
4796
 
4767
4797
  // src/ui/user-message-attachment.tsx
4768
- import { jsxs as jsxs12 } from "react/jsx-runtime";
4798
+ import { jsxs as jsxs11 } from "react/jsx-runtime";
4769
4799
  var UserMessageAttachmentRoot = withDefaults("div", {
4770
4800
  className: "aui-user-message-attachment-root"
4771
4801
  });
@@ -4773,7 +4803,7 @@ UserMessageAttachmentRoot.displayName = "UserMessageAttachmentRoot";
4773
4803
  var UserMessageAttachment = () => {
4774
4804
  const { useAttachment } = useAttachmentContext();
4775
4805
  const attachment = useAttachment((a) => a.attachment);
4776
- return /* @__PURE__ */ jsxs12(UserMessageAttachmentRoot, { children: [
4806
+ return /* @__PURE__ */ jsxs11(UserMessageAttachmentRoot, { children: [
4777
4807
  ".",
4778
4808
  attachment.name.split(".").pop()
4779
4809
  ] });
@@ -4788,13 +4818,13 @@ var user_message_attachment_default = Object.assign(
4788
4818
  );
4789
4819
 
4790
4820
  // src/ui/user-message.tsx
4791
- import { jsx as jsx45, jsxs as jsxs13 } from "react/jsx-runtime";
4821
+ import { jsx as jsx46, jsxs as jsxs12 } from "react/jsx-runtime";
4792
4822
  var UserMessage = () => {
4793
- return /* @__PURE__ */ jsxs13(UserMessageRoot, { children: [
4794
- /* @__PURE__ */ jsx45(UserMessageAttachments, {}),
4795
- /* @__PURE__ */ jsx45(user_action_bar_default, {}),
4796
- /* @__PURE__ */ jsx45(UserMessageContent, {}),
4797
- /* @__PURE__ */ jsx45(branch_picker_default, {})
4823
+ return /* @__PURE__ */ jsxs12(UserMessageRoot, { children: [
4824
+ /* @__PURE__ */ jsx46(UserMessageAttachments, {}),
4825
+ /* @__PURE__ */ jsx46(user_action_bar_default, {}),
4826
+ /* @__PURE__ */ jsx46(UserMessageContent, {}),
4827
+ /* @__PURE__ */ jsx46(branch_picker_default, {})
4798
4828
  ] });
4799
4829
  };
4800
4830
  UserMessage.displayName = "UserMessage";
@@ -4807,7 +4837,7 @@ var UserMessageContentWrapper = withDefaults("div", {
4807
4837
  });
4808
4838
  var UserMessageContent = forwardRef26(
4809
4839
  ({ components, ...props }, ref) => {
4810
- return /* @__PURE__ */ jsx45(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx45(
4840
+ return /* @__PURE__ */ jsx46(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx46(
4811
4841
  message_exports.Content,
4812
4842
  {
4813
4843
  components: {
@@ -4825,7 +4855,7 @@ var UserMessageAttachmentsContainer = withDefaults("div", {
4825
4855
  var UserMessageAttachments = ({
4826
4856
  components
4827
4857
  }) => {
4828
- return /* @__PURE__ */ jsx45(message_exports.If, { hasAttachments: true, children: /* @__PURE__ */ jsx45(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx45(
4858
+ return /* @__PURE__ */ jsx46(message_exports.If, { hasAttachments: true, children: /* @__PURE__ */ jsx46(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx46(
4829
4859
  message_exports.Attachments,
4830
4860
  {
4831
4861
  components: {
@@ -4844,13 +4874,13 @@ var user_message_default = Object.assign(UserMessage, exports10);
4844
4874
 
4845
4875
  // src/ui/edit-composer.tsx
4846
4876
  import { forwardRef as forwardRef27 } from "react";
4847
- import { jsx as jsx46, jsxs as jsxs14 } from "react/jsx-runtime";
4877
+ import { jsx as jsx47, jsxs as jsxs13 } from "react/jsx-runtime";
4848
4878
  var EditComposer = () => {
4849
- return /* @__PURE__ */ jsxs14(EditComposerRoot, { children: [
4850
- /* @__PURE__ */ jsx46(EditComposerInput, {}),
4851
- /* @__PURE__ */ jsxs14(EditComposerFooter, { children: [
4852
- /* @__PURE__ */ jsx46(EditComposerCancel, {}),
4853
- /* @__PURE__ */ jsx46(EditComposerSend, {})
4879
+ return /* @__PURE__ */ jsxs13(EditComposerRoot, { children: [
4880
+ /* @__PURE__ */ jsx47(EditComposerInput, {}),
4881
+ /* @__PURE__ */ jsxs13(EditComposerFooter, { children: [
4882
+ /* @__PURE__ */ jsx47(EditComposerCancel, {}),
4883
+ /* @__PURE__ */ jsx47(EditComposerSend, {})
4854
4884
  ] })
4855
4885
  ] });
4856
4886
  };
@@ -4874,7 +4904,7 @@ var EditComposerCancel = forwardRef27(
4874
4904
  editComposer: { cancel: { label = "Cancel" } = {} } = {}
4875
4905
  } = {}
4876
4906
  } = useThreadConfig();
4877
- return /* @__PURE__ */ jsx46(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx46(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4907
+ return /* @__PURE__ */ jsx47(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx47(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4878
4908
  }
4879
4909
  );
4880
4910
  EditComposerCancel.displayName = "EditComposerCancel";
@@ -4883,7 +4913,7 @@ var EditComposerSend = forwardRef27(
4883
4913
  const {
4884
4914
  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
4885
4915
  } = useThreadConfig();
4886
- return /* @__PURE__ */ jsx46(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx46(Button, { ...props, ref, children: props.children ?? label }) });
4916
+ return /* @__PURE__ */ jsx47(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx47(Button, { ...props, ref, children: props.children ?? label }) });
4887
4917
  }
4888
4918
  );
4889
4919
  EditComposerSend.displayName = "EditComposerSend";
@@ -4897,14 +4927,14 @@ var exports11 = {
4897
4927
  var edit_composer_default = Object.assign(EditComposer, exports11);
4898
4928
 
4899
4929
  // src/ui/thread.tsx
4900
- import { jsx as jsx47, jsxs as jsxs15 } from "react/jsx-runtime";
4930
+ import { jsx as jsx48, jsxs as jsxs14 } from "react/jsx-runtime";
4901
4931
  var Thread = (config) => {
4902
- return /* @__PURE__ */ jsx47(ThreadRoot, { config, children: /* @__PURE__ */ jsxs15(ThreadViewport, { children: [
4903
- /* @__PURE__ */ jsx47(thread_welcome_default, {}),
4904
- /* @__PURE__ */ jsx47(ThreadMessages, {}),
4905
- /* @__PURE__ */ jsxs15(ThreadViewportFooter, { children: [
4906
- /* @__PURE__ */ jsx47(ThreadScrollToBottom, {}),
4907
- /* @__PURE__ */ jsx47(composer_default, {})
4932
+ return /* @__PURE__ */ jsx48(ThreadRoot, { config, children: /* @__PURE__ */ jsxs14(ThreadViewport, { children: [
4933
+ /* @__PURE__ */ jsx48(thread_welcome_default, {}),
4934
+ /* @__PURE__ */ jsx48(ThreadMessages, {}),
4935
+ /* @__PURE__ */ jsxs14(ThreadViewportFooter, { children: [
4936
+ /* @__PURE__ */ jsx48(ThreadScrollToBottom, {}),
4937
+ /* @__PURE__ */ jsx48(composer_default, {})
4908
4938
  ] })
4909
4939
  ] }) });
4910
4940
  };
@@ -4913,7 +4943,7 @@ var ThreadRootStyled = withDefaults(thread_exports.Root, {
4913
4943
  });
4914
4944
  var ThreadRoot = forwardRef28(
4915
4945
  ({ config, ...props }, ref) => {
4916
- return /* @__PURE__ */ jsx47(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx47(ThreadRootStyled, { ...props, ref }) });
4946
+ return /* @__PURE__ */ jsx48(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx48(ThreadRootStyled, { ...props, ref }) });
4917
4947
  }
4918
4948
  );
4919
4949
  ThreadRoot.displayName = "ThreadRoot";
@@ -4927,7 +4957,7 @@ var ThreadViewportFooter = withDefaults("div", {
4927
4957
  ThreadViewportFooter.displayName = "ThreadViewportFooter";
4928
4958
  var SystemMessage = () => null;
4929
4959
  var ThreadMessages = ({ components, ...rest }) => {
4930
- return /* @__PURE__ */ jsx47(
4960
+ return /* @__PURE__ */ jsx48(
4931
4961
  thread_exports.Messages,
4932
4962
  {
4933
4963
  components: {
@@ -4951,7 +4981,7 @@ var ThreadScrollToBottom = forwardRef28((props, ref) => {
4951
4981
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
4952
4982
  } = {}
4953
4983
  } = useThreadConfig();
4954
- return /* @__PURE__ */ jsx47(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx47(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx47(ArrowDownIcon, {}) }) });
4984
+ return /* @__PURE__ */ jsx48(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx48(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx48(ArrowDownIcon, {}) }) });
4955
4985
  });
4956
4986
  ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
4957
4987
  var exports12 = {
@@ -4964,20 +4994,20 @@ var exports12 = {
4964
4994
  var thread_default = Object.assign(Thread, exports12);
4965
4995
 
4966
4996
  // src/ui/assistant-modal.tsx
4967
- import { Fragment as Fragment6, jsx as jsx48, jsxs as jsxs16 } from "react/jsx-runtime";
4997
+ import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs15 } from "react/jsx-runtime";
4968
4998
  var AssistantModal = (config) => {
4969
- return /* @__PURE__ */ jsxs16(AssistantModalRoot, { config, children: [
4970
- /* @__PURE__ */ jsx48(AssistantModalTrigger, {}),
4971
- /* @__PURE__ */ jsx48(AssistantModalContent, { children: /* @__PURE__ */ jsx48(thread_default, {}) })
4999
+ return /* @__PURE__ */ jsxs15(AssistantModalRoot, { config, children: [
5000
+ /* @__PURE__ */ jsx49(AssistantModalTrigger, {}),
5001
+ /* @__PURE__ */ jsx49(AssistantModalContent, { children: /* @__PURE__ */ jsx49(thread_default, {}) })
4972
5002
  ] });
4973
5003
  };
4974
5004
  AssistantModal.displayName = "AssistantModal";
4975
5005
  var AssistantModalRoot = ({ config, ...props }) => {
4976
- return /* @__PURE__ */ jsx48(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx48(assistantModal_exports.Root, { ...props }) });
5006
+ return /* @__PURE__ */ jsx49(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx49(assistantModal_exports.Root, { ...props }) });
4977
5007
  };
4978
5008
  AssistantModalRoot.displayName = "AssistantModalRoot";
4979
5009
  var AssistantModalTrigger = forwardRef29((props, ref) => {
4980
- return /* @__PURE__ */ jsx48(AssistantModalAnchor, { children: /* @__PURE__ */ jsx48(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx48(AssistantModalButton, { ...props, ref }) }) });
5010
+ return /* @__PURE__ */ jsx49(AssistantModalAnchor, { children: /* @__PURE__ */ jsx49(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx49(AssistantModalButton, { ...props, ref }) }) });
4981
5011
  });
4982
5012
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
4983
5013
  var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
@@ -5002,7 +5032,7 @@ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref)
5002
5032
  } = {}
5003
5033
  } = useThreadConfig();
5004
5034
  const tooltip = state === "open" ? openTooltip : closedTooltip;
5005
- return /* @__PURE__ */ jsx48(
5035
+ return /* @__PURE__ */ jsx49(
5006
5036
  ModalButtonStyled,
5007
5037
  {
5008
5038
  side: "left",
@@ -5010,15 +5040,15 @@ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref)
5010
5040
  "data-state": state,
5011
5041
  ...rest,
5012
5042
  ref,
5013
- children: rest.children ?? /* @__PURE__ */ jsxs16(Fragment6, { children: [
5014
- /* @__PURE__ */ jsx48(
5043
+ children: rest.children ?? /* @__PURE__ */ jsxs15(Fragment6, { children: [
5044
+ /* @__PURE__ */ jsx49(
5015
5045
  BotIcon,
5016
5046
  {
5017
5047
  "data-state": state,
5018
5048
  className: "aui-modal-button-closed-icon"
5019
5049
  }
5020
5050
  ),
5021
- /* @__PURE__ */ jsx48(
5051
+ /* @__PURE__ */ jsx49(
5022
5052
  ChevronDownIcon,
5023
5053
  {
5024
5054
  "data-state": state,
@@ -5065,6 +5095,7 @@ export {
5065
5095
  message_exports as MessagePrimitive,
5066
5096
  SimpleImageAttachmentAdapter,
5067
5097
  SimpleTextAttachmentAdapter,
5098
+ TextContentPartProvider,
5068
5099
  thread_default as Thread,
5069
5100
  ThreadConfigProvider,
5070
5101
  thread_exports as ThreadPrimitive,