@assistant-ui/react 0.5.50 → 0.5.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2271,14 +2271,47 @@ var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
2271
2271
  };
2272
2272
  var AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);
2273
2273
 
2274
+ // src/context/providers/TextContentPartProvider.tsx
2275
+ import { useState as useState9 } from "react";
2276
+ import { create as create12 } from "zustand";
2277
+
2278
+ // src/context/react/ContentPartContext.ts
2279
+ import { createContext as createContext4, useContext as useContext4 } from "react";
2280
+ var ContentPartContext = createContext4(
2281
+ null
2282
+ );
2283
+ function useContentPartContext(options) {
2284
+ const context = useContext4(ContentPartContext);
2285
+ if (!options?.optional && !context)
2286
+ throw new Error(
2287
+ "This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
2288
+ );
2289
+ return context;
2290
+ }
2291
+
2292
+ // src/context/providers/TextContentPartProvider.tsx
2293
+ import { jsx as jsx9 } from "react/jsx-runtime";
2294
+ var TextContentPartProvider = ({ children, text }) => {
2295
+ const [context] = useState9(() => {
2296
+ const useContentPart = create12(() => ({
2297
+ status: { type: "complete" },
2298
+ part: { type: "text", text }
2299
+ }));
2300
+ return {
2301
+ useContentPart
2302
+ };
2303
+ });
2304
+ return /* @__PURE__ */ jsx9(ContentPartContext.Provider, { value: context, children });
2305
+ };
2306
+
2274
2307
  // src/context/react/ComposerContext.ts
2275
2308
  import { useMemo as useMemo3 } from "react";
2276
2309
 
2277
2310
  // src/context/react/MessageContext.ts
2278
- import { createContext as createContext4, useContext as useContext4 } from "react";
2279
- var MessageContext = createContext4(null);
2311
+ import { createContext as createContext5, useContext as useContext5 } from "react";
2312
+ var MessageContext = createContext5(null);
2280
2313
  function useMessageContext(options) {
2281
- const context = useContext4(MessageContext);
2314
+ const context = useContext5(MessageContext);
2282
2315
  if (!options?.optional && !context)
2283
2316
  throw new Error(
2284
2317
  "This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
@@ -2299,20 +2332,6 @@ var useComposerContext = () => {
2299
2332
  );
2300
2333
  };
2301
2334
 
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
2335
  // src/hooks/useAppendMessage.tsx
2317
2336
  import { useCallback } from "react";
2318
2337
  var toAppendMessage = (useThreadMessages, message) => {
@@ -2829,7 +2848,7 @@ var useActionBarFloatStatus = ({
2829
2848
  };
2830
2849
 
2831
2850
  // src/primitives/actionBar/ActionBarRoot.tsx
2832
- import { jsx as jsx9 } from "react/jsx-runtime";
2851
+ import { jsx as jsx10 } from "react/jsx-runtime";
2833
2852
  var ActionBarPrimitiveRoot = forwardRef5(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {
2834
2853
  const hideAndfloatStatus = useActionBarFloatStatus({
2835
2854
  hideWhenRunning,
@@ -2837,7 +2856,7 @@ var ActionBarPrimitiveRoot = forwardRef5(({ hideWhenRunning, autohide, autohideF
2837
2856
  autohideFloat
2838
2857
  });
2839
2858
  if (hideAndfloatStatus === "hidden" /* Hidden */) return null;
2840
- return /* @__PURE__ */ jsx9(
2859
+ return /* @__PURE__ */ jsx10(
2841
2860
  Primitive2.div,
2842
2861
  {
2843
2862
  ...hideAndfloatStatus === "floating" /* Floating */ ? { "data-floating": "true" } : null,
@@ -2852,7 +2871,7 @@ ActionBarPrimitiveRoot.displayName = "ActionBarPrimitive.Root";
2852
2871
  import { forwardRef as forwardRef6 } from "react";
2853
2872
  import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
2854
2873
  import { composeEventHandlers } from "@radix-ui/primitive";
2855
- import { jsx as jsx10 } from "react/jsx-runtime";
2874
+ import { jsx as jsx11 } from "react/jsx-runtime";
2856
2875
  var createActionButton = (displayName, useActionButton, forwardProps = []) => {
2857
2876
  const ActionButton = forwardRef6((props, forwardedRef) => {
2858
2877
  const forwardedProps = {};
@@ -2865,13 +2884,13 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
2865
2884
  }
2866
2885
  });
2867
2886
  const callback = useActionButton(forwardedProps);
2868
- return /* @__PURE__ */ jsx10(
2887
+ return /* @__PURE__ */ jsx11(
2869
2888
  Primitive3.button,
2870
2889
  {
2871
2890
  type: "button",
2872
- disabled: !callback,
2873
2891
  ...primitiveProps,
2874
2892
  ref: forwardedRef,
2893
+ disabled: primitiveProps.disabled || !callback,
2875
2894
  onClick: composeEventHandlers(primitiveProps.onClick, () => {
2876
2895
  callback?.();
2877
2896
  })
@@ -2912,7 +2931,7 @@ import { forwardRef as forwardRef7 } from "react";
2912
2931
  import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
2913
2932
  import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
2914
2933
  import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
2915
- import { jsx as jsx11 } from "react/jsx-runtime";
2934
+ import { jsx as jsx12 } from "react/jsx-runtime";
2916
2935
  var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
2917
2936
  const callback = useActionBarStopSpeaking();
2918
2937
  useEscapeKeydown((e) => {
@@ -2921,7 +2940,7 @@ var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
2921
2940
  callback();
2922
2941
  }
2923
2942
  });
2924
- return /* @__PURE__ */ jsx11(
2943
+ return /* @__PURE__ */ jsx12(
2925
2944
  Primitive4.button,
2926
2945
  {
2927
2946
  type: "button",
@@ -2945,7 +2964,7 @@ __export(assistantModal_exports, {
2945
2964
  });
2946
2965
 
2947
2966
  // src/primitives/assistantModal/AssistantModalRoot.tsx
2948
- import { useState as useState9 } from "react";
2967
+ import { useState as useState10 } from "react";
2949
2968
  import * as PopoverPrimitive2 from "@radix-ui/react-popover";
2950
2969
  import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
2951
2970
 
@@ -2967,9 +2986,9 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
2967
2986
  var usePopoverScope = PopoverPrimitive.createPopoverScope();
2968
2987
 
2969
2988
  // src/primitives/assistantModal/AssistantModalRoot.tsx
2970
- import { jsx as jsx12 } from "react/jsx-runtime";
2989
+ import { jsx as jsx13 } from "react/jsx-runtime";
2971
2990
  var useAssistantModalOpenState = (defaultOpen = false) => {
2972
- const state = useState9(defaultOpen);
2991
+ const state = useState10(defaultOpen);
2973
2992
  const [, setOpen] = state;
2974
2993
  useOnComposerFocus(() => {
2975
2994
  setOpen(true);
@@ -2985,7 +3004,7 @@ var AssistantModalPrimitiveRoot = ({
2985
3004
  }) => {
2986
3005
  const scope = usePopoverScope(__scopeAssistantModal);
2987
3006
  const [modalOpen, setOpen] = useAssistantModalOpenState(defaultOpen);
2988
- return /* @__PURE__ */ jsx12(
3007
+ return /* @__PURE__ */ jsx13(
2989
3008
  PopoverPrimitive2.Root,
2990
3009
  {
2991
3010
  ...scope,
@@ -3000,14 +3019,14 @@ AssistantModalPrimitiveRoot.displayName = "AssistantModalPrimitive.Root";
3000
3019
  // src/primitives/assistantModal/AssistantModalTrigger.tsx
3001
3020
  import { forwardRef as forwardRef8 } from "react";
3002
3021
  import * as PopoverPrimitive3 from "@radix-ui/react-popover";
3003
- import { jsx as jsx13 } from "react/jsx-runtime";
3022
+ import { jsx as jsx14 } from "react/jsx-runtime";
3004
3023
  var AssistantModalPrimitiveTrigger = forwardRef8(
3005
3024
  ({
3006
3025
  __scopeAssistantModal,
3007
3026
  ...rest
3008
3027
  }, ref) => {
3009
3028
  const scope = usePopoverScope(__scopeAssistantModal);
3010
- return /* @__PURE__ */ jsx13(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
3029
+ return /* @__PURE__ */ jsx14(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
3011
3030
  }
3012
3031
  );
3013
3032
  AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
@@ -3016,7 +3035,7 @@ AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
3016
3035
  import { forwardRef as forwardRef9 } from "react";
3017
3036
  import * as PopoverPrimitive4 from "@radix-ui/react-popover";
3018
3037
  import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
3019
- import { jsx as jsx14 } from "react/jsx-runtime";
3038
+ import { jsx as jsx15 } from "react/jsx-runtime";
3020
3039
  var AssistantModalPrimitiveContent = forwardRef9(
3021
3040
  ({
3022
3041
  __scopeAssistantModal,
@@ -3027,7 +3046,7 @@ var AssistantModalPrimitiveContent = forwardRef9(
3027
3046
  ...props
3028
3047
  }, forwardedRef) => {
3029
3048
  const scope = usePopoverScope(__scopeAssistantModal);
3030
- return /* @__PURE__ */ jsx14(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx14(
3049
+ return /* @__PURE__ */ jsx15(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx15(
3031
3050
  PopoverPrimitive4.Content,
3032
3051
  {
3033
3052
  ...scope,
@@ -3048,14 +3067,14 @@ AssistantModalPrimitiveContent.displayName = "AssistantModalPrimitive.Content";
3048
3067
  // src/primitives/assistantModal/AssistantModalAnchor.tsx
3049
3068
  import { forwardRef as forwardRef10 } from "react";
3050
3069
  import * as PopoverPrimitive5 from "@radix-ui/react-popover";
3051
- import { jsx as jsx15 } from "react/jsx-runtime";
3070
+ import { jsx as jsx16 } from "react/jsx-runtime";
3052
3071
  var AssistantModalPrimitiveAnchor = forwardRef10(
3053
3072
  ({
3054
3073
  __scopeAssistantModal,
3055
3074
  ...rest
3056
3075
  }, ref) => {
3057
3076
  const scope = usePopoverScope(__scopeAssistantModal);
3058
- return /* @__PURE__ */ jsx15(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
3077
+ return /* @__PURE__ */ jsx16(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
3059
3078
  }
3060
3079
  );
3061
3080
  AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
@@ -3083,18 +3102,18 @@ var BranchPickerPrevious = createActionButton(
3083
3102
  );
3084
3103
 
3085
3104
  // src/primitives/branchPicker/BranchPickerCount.tsx
3086
- import { Fragment, jsx as jsx16 } from "react/jsx-runtime";
3105
+ import { Fragment, jsx as jsx17 } from "react/jsx-runtime";
3087
3106
  var BranchPickerPrimitiveCount = () => {
3088
3107
  const branchCount = useBranchPickerCount();
3089
- return /* @__PURE__ */ jsx16(Fragment, { children: branchCount });
3108
+ return /* @__PURE__ */ jsx17(Fragment, { children: branchCount });
3090
3109
  };
3091
3110
  BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
3092
3111
 
3093
3112
  // src/primitives/branchPicker/BranchPickerNumber.tsx
3094
- import { Fragment as Fragment2, jsx as jsx17 } from "react/jsx-runtime";
3113
+ import { Fragment as Fragment2, jsx as jsx18 } from "react/jsx-runtime";
3095
3114
  var BranchPickerPrimitiveNumber = () => {
3096
3115
  const branchNumber = useBranchPickerNumber();
3097
- return /* @__PURE__ */ jsx17(Fragment2, { children: branchNumber });
3116
+ return /* @__PURE__ */ jsx18(Fragment2, { children: branchNumber });
3098
3117
  };
3099
3118
  BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
3100
3119
 
@@ -3139,7 +3158,7 @@ var useManagedRef = (callback) => {
3139
3158
 
3140
3159
  // src/primitives/message/MessageRoot.tsx
3141
3160
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
3142
- import { jsx as jsx18 } from "react/jsx-runtime";
3161
+ import { jsx as jsx19 } from "react/jsx-runtime";
3143
3162
  var useIsHoveringRef = () => {
3144
3163
  const { useMessageUtils } = useMessageContext();
3145
3164
  const callbackRef = useCallback16(
@@ -3166,7 +3185,7 @@ var useIsHoveringRef = () => {
3166
3185
  var MessagePrimitiveRoot = forwardRef11(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef30) => {
3167
3186
  const isHoveringRef = useIsHoveringRef();
3168
3187
  const ref = useComposedRefs(forwardRef30, isHoveringRef);
3169
- return /* @__PURE__ */ jsx18(Primitive5.div, { ...rest, ref });
3188
+ return /* @__PURE__ */ jsx19(Primitive5.div, { ...rest, ref });
3170
3189
  });
3171
3190
  MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
3172
3191
 
@@ -3184,9 +3203,9 @@ MessagePrimitiveIf.displayName = "MessagePrimitive.If";
3184
3203
  import { memo as memo2 } from "react";
3185
3204
 
3186
3205
  // 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";
3206
+ import { useEffect as useEffect9, useState as useState11 } from "react";
3207
+ import { create as create13 } from "zustand";
3208
+ import { jsx as jsx20 } from "react/jsx-runtime";
3190
3209
  var COMPLETE_STATUS = {
3191
3210
  type: "complete"
3192
3211
  };
@@ -3223,8 +3242,8 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
3223
3242
  };
3224
3243
  var useContentPartContext2 = (partIndex) => {
3225
3244
  const { useMessage } = useMessageContext();
3226
- const [context] = useState10(() => {
3227
- const useContentPart = create12(
3245
+ const [context] = useState11(() => {
3246
+ const useContentPart = create13(
3228
3247
  () => getContentPartState(useMessage.getState(), void 0, partIndex)
3229
3248
  );
3230
3249
  return { useContentPart };
@@ -3249,32 +3268,32 @@ var ContentPartProvider = ({
3249
3268
  children
3250
3269
  }) => {
3251
3270
  const context = useContentPartContext2(partIndex);
3252
- return /* @__PURE__ */ jsx19(ContentPartContext.Provider, { value: context, children });
3271
+ return /* @__PURE__ */ jsx20(ContentPartContext.Provider, { value: context, children });
3253
3272
  };
3254
3273
 
3255
3274
  // src/primitives/contentPart/ContentPartText.tsx
3256
3275
  import {
3257
3276
  forwardRef as forwardRef12
3258
3277
  } from "react";
3259
- import { jsx as jsx20 } from "react/jsx-runtime";
3278
+ import { jsx as jsx21 } from "react/jsx-runtime";
3260
3279
  var ContentPartPrimitiveText = forwardRef12(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
3261
3280
  const {
3262
3281
  part: { text },
3263
3282
  status
3264
3283
  } = useSmooth(useContentPartText(), smooth);
3265
- return /* @__PURE__ */ jsx20(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
3284
+ return /* @__PURE__ */ jsx21(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
3266
3285
  });
3267
3286
  ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
3268
3287
 
3269
3288
  // src/primitives/contentPart/ContentPartImage.tsx
3270
3289
  import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
3271
3290
  import { forwardRef as forwardRef13 } from "react";
3272
- import { jsx as jsx21 } from "react/jsx-runtime";
3291
+ import { jsx as jsx22 } from "react/jsx-runtime";
3273
3292
  var ContentPartPrimitiveImage = forwardRef13((props, forwardedRef) => {
3274
3293
  const {
3275
3294
  part: { image }
3276
3295
  } = useContentPartImage();
3277
- return /* @__PURE__ */ jsx21(Primitive6.img, { src: image, ...props, ref: forwardedRef });
3296
+ return /* @__PURE__ */ jsx22(Primitive6.img, { src: image, ...props, ref: forwardedRef });
3278
3297
  });
3279
3298
  ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
3280
3299
 
@@ -3296,7 +3315,7 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
3296
3315
  ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
3297
3316
 
3298
3317
  // src/primitives/message/MessageContent.tsx
3299
- import { jsx as jsx22, jsxs as jsxs3 } from "react/jsx-runtime";
3318
+ import { jsx as jsx23, jsxs as jsxs3 } from "react/jsx-runtime";
3300
3319
  var ToolUIDisplay = ({
3301
3320
  UI,
3302
3321
  ...props
@@ -3304,15 +3323,15 @@ var ToolUIDisplay = ({
3304
3323
  const { useToolUIs } = useAssistantContext();
3305
3324
  const Render = useToolUIs((s) => s.getToolUI(props.part.toolName)) ?? UI;
3306
3325
  if (!Render) return null;
3307
- return /* @__PURE__ */ jsx22(Render, { ...props });
3326
+ return /* @__PURE__ */ jsx23(Render, { ...props });
3308
3327
  };
3309
3328
  var defaultComponents = {
3310
3329
  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" }) })
3330
+ /* @__PURE__ */ jsx23(ContentPartPrimitiveText, {}),
3331
+ /* @__PURE__ */ jsx23(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx23("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
3313
3332
  ] }),
3314
- Image: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveImage, {}),
3315
- UI: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveDisplay, {})
3333
+ Image: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveImage, {}),
3334
+ UI: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveDisplay, {})
3316
3335
  };
3317
3336
  var MessageContentPartComponent = ({
3318
3337
  components: {
@@ -3333,16 +3352,16 @@ var MessageContentPartComponent = ({
3333
3352
  case "text":
3334
3353
  if (status.type === "requires-action")
3335
3354
  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 });
3355
+ if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx23(Empty, { part, status });
3356
+ return /* @__PURE__ */ jsx23(Text2, { part, status });
3338
3357
  case "image":
3339
3358
  if (status.type === "requires-action")
3340
3359
  throw new Error("Encountered unexpected requires-action status");
3341
- return /* @__PURE__ */ jsx22(Image2, { part, status });
3360
+ return /* @__PURE__ */ jsx23(Image2, { part, status });
3342
3361
  case "ui":
3343
3362
  if (status.type === "requires-action")
3344
3363
  throw new Error("Encountered unexpected requires-action status");
3345
- return /* @__PURE__ */ jsx22(UI, { part, status });
3364
+ return /* @__PURE__ */ jsx23(UI, { part, status });
3346
3365
  case "tool-call": {
3347
3366
  const Tool = by_name[part.toolName] || Fallback2;
3348
3367
  const addResult = (result) => addToolResult({
@@ -3351,7 +3370,7 @@ var MessageContentPartComponent = ({
3351
3370
  toolCallId: part.toolCallId,
3352
3371
  result
3353
3372
  });
3354
- return /* @__PURE__ */ jsx22(
3373
+ return /* @__PURE__ */ jsx23(
3355
3374
  ToolUIDisplay,
3356
3375
  {
3357
3376
  UI: Tool,
@@ -3370,7 +3389,7 @@ var MessageContentPartImpl = ({
3370
3389
  partIndex,
3371
3390
  components
3372
3391
  }) => {
3373
- return /* @__PURE__ */ jsx22(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx22(MessageContentPartComponent, { components }) });
3392
+ return /* @__PURE__ */ jsx23(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx23(MessageContentPartComponent, { components }) });
3374
3393
  };
3375
3394
  var MessageContentPart = memo2(
3376
3395
  MessageContentPartImpl,
@@ -3381,7 +3400,7 @@ var MessagePrimitiveContent = ({
3381
3400
  }) => {
3382
3401
  const { useMessage } = useMessageContext();
3383
3402
  const contentLength = useMessage((s) => s.message.content.length) || 1;
3384
- return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx22(MessageContentPart, { partIndex: index, components }, index));
3403
+ return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx23(MessageContentPart, { partIndex: index, components }, index));
3385
3404
  };
3386
3405
  MessagePrimitiveContent.displayName = "MessagePrimitive.Content";
3387
3406
 
@@ -3417,9 +3436,9 @@ function useAttachmentContext(options) {
3417
3436
  }
3418
3437
 
3419
3438
  // 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";
3439
+ import { useEffect as useEffect10, useState as useState12 } from "react";
3440
+ import { create as create14 } from "zustand";
3441
+ import { jsx as jsx24 } from "react/jsx-runtime";
3423
3442
  var getAttachment = ({ message }, useAttachment, partIndex) => {
3424
3443
  if (message.role !== "user") return null;
3425
3444
  const attachments = message.attachments;
@@ -3431,9 +3450,9 @@ var getAttachment = ({ message }, useAttachment, partIndex) => {
3431
3450
  };
3432
3451
  var useMessageAttachmentContext = (partIndex) => {
3433
3452
  const { useMessage } = useMessageContext();
3434
- const [context] = useState11(
3453
+ const [context] = useState12(
3435
3454
  () => {
3436
- const useAttachment = create13(
3455
+ const useAttachment = create14(
3437
3456
  () => getAttachment(useMessage.getState(), void 0, partIndex)
3438
3457
  );
3439
3458
  return { type: "message", useAttachment };
@@ -3459,11 +3478,11 @@ var MessageAttachmentProvider = ({
3459
3478
  children
3460
3479
  }) => {
3461
3480
  const context = useMessageAttachmentContext(partIndex);
3462
- return /* @__PURE__ */ jsx23(AttachmentContext.Provider, { value: context, children });
3481
+ return /* @__PURE__ */ jsx24(AttachmentContext.Provider, { value: context, children });
3463
3482
  };
3464
3483
 
3465
3484
  // src/primitives/message/MessageAttachments.tsx
3466
- import { jsx as jsx24 } from "react/jsx-runtime";
3485
+ import { jsx as jsx25 } from "react/jsx-runtime";
3467
3486
  var getComponent = (components, attachment) => {
3468
3487
  const type = attachment.type;
3469
3488
  switch (type) {
@@ -3484,10 +3503,10 @@ var AttachmentComponent = ({ components }) => {
3484
3503
  (a) => getComponent(components, a.attachment)
3485
3504
  );
3486
3505
  if (!Component) return null;
3487
- return /* @__PURE__ */ jsx24(Component, {});
3506
+ return /* @__PURE__ */ jsx25(Component, {});
3488
3507
  };
3489
3508
  var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
3490
- return /* @__PURE__ */ jsx24(MessageAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx24(AttachmentComponent, { components }) });
3509
+ return /* @__PURE__ */ jsx25(MessageAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx25(AttachmentComponent, { components }) });
3491
3510
  };
3492
3511
  var MessageAttachment = memo3(
3493
3512
  MessageAttachmentImpl,
@@ -3499,7 +3518,7 @@ var MessagePrimitiveAttachments = ({ components }) => {
3499
3518
  if (message.role !== "user") return 0;
3500
3519
  return message.attachments.length;
3501
3520
  });
3502
- return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx24(
3521
+ return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx25(
3503
3522
  MessageAttachment,
3504
3523
  {
3505
3524
  attachmentIndex: index,
@@ -3511,9 +3530,9 @@ var MessagePrimitiveAttachments = ({ components }) => {
3511
3530
  MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
3512
3531
 
3513
3532
  // src/primitives/branchPicker/BranchPickerRoot.tsx
3514
- import { jsx as jsx25 } from "react/jsx-runtime";
3533
+ import { jsx as jsx26 } from "react/jsx-runtime";
3515
3534
  var BranchPickerPrimitiveRoot = forwardRef14(({ hideWhenSingleBranch, ...rest }, ref) => {
3516
- return /* @__PURE__ */ jsx25(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx25(Primitive7.div, { ...rest, ref }) });
3535
+ return /* @__PURE__ */ jsx26(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx26(Primitive7.div, { ...rest, ref }) });
3517
3536
  });
3518
3537
  BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
3519
3538
 
@@ -3535,7 +3554,7 @@ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
3535
3554
  import {
3536
3555
  forwardRef as forwardRef15
3537
3556
  } from "react";
3538
- import { jsx as jsx26 } from "react/jsx-runtime";
3557
+ import { jsx as jsx27 } from "react/jsx-runtime";
3539
3558
  var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) => {
3540
3559
  const send = useComposerSend();
3541
3560
  const handleSubmit = (e) => {
@@ -3543,7 +3562,7 @@ var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) =
3543
3562
  if (!send) return;
3544
3563
  send();
3545
3564
  };
3546
- return /* @__PURE__ */ jsx26(
3565
+ return /* @__PURE__ */ jsx27(
3547
3566
  Primitive8.form,
3548
3567
  {
3549
3568
  ...rest,
@@ -3566,7 +3585,7 @@ import {
3566
3585
  } from "react";
3567
3586
  import TextareaAutosize from "react-textarea-autosize";
3568
3587
  import { useEscapeKeydown as useEscapeKeydown2 } from "@radix-ui/react-use-escape-keydown";
3569
- import { jsx as jsx27 } from "react/jsx-runtime";
3588
+ import { jsx as jsx28 } from "react/jsx-runtime";
3570
3589
  var ComposerPrimitiveInput = forwardRef16(
3571
3590
  ({
3572
3591
  autoFocus = false,
@@ -3620,7 +3639,7 @@ var ComposerPrimitiveInput = forwardRef16(
3620
3639
  focus();
3621
3640
  }
3622
3641
  });
3623
- return /* @__PURE__ */ jsx27(
3642
+ return /* @__PURE__ */ jsx28(
3624
3643
  Component,
3625
3644
  {
3626
3645
  name: "input",
@@ -3662,9 +3681,9 @@ var ComposerPrimitiveAddAttachment = createActionButton(
3662
3681
  import { memo as memo4 } from "react";
3663
3682
 
3664
3683
  // 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";
3684
+ import { useEffect as useEffect12, useState as useState13 } from "react";
3685
+ import { create as create15 } from "zustand";
3686
+ import { jsx as jsx29 } from "react/jsx-runtime";
3668
3687
  var getAttachment2 = ({ attachments }, useAttachment, partIndex) => {
3669
3688
  let attachment = attachments[partIndex];
3670
3689
  if (!attachment) return null;
@@ -3674,9 +3693,9 @@ var getAttachment2 = ({ attachments }, useAttachment, partIndex) => {
3674
3693
  };
3675
3694
  var useComposerAttachmentContext = (partIndex) => {
3676
3695
  const { useComposer } = useThreadContext();
3677
- const [context] = useState12(
3696
+ const [context] = useState13(
3678
3697
  () => {
3679
- const useAttachment = create14(
3698
+ const useAttachment = create15(
3680
3699
  () => getAttachment2(useComposer.getState(), void 0, partIndex)
3681
3700
  );
3682
3701
  return { type: "composer", useAttachment };
@@ -3699,11 +3718,11 @@ var useComposerAttachmentContext = (partIndex) => {
3699
3718
  };
3700
3719
  var ComposerAttachmentProvider = ({ attachmentIndex: partIndex, children }) => {
3701
3720
  const context = useComposerAttachmentContext(partIndex);
3702
- return /* @__PURE__ */ jsx28(AttachmentContext.Provider, { value: context, children });
3721
+ return /* @__PURE__ */ jsx29(AttachmentContext.Provider, { value: context, children });
3703
3722
  };
3704
3723
 
3705
3724
  // src/primitives/composer/ComposerAttachments.tsx
3706
- import { jsx as jsx29 } from "react/jsx-runtime";
3725
+ import { jsx as jsx30 } from "react/jsx-runtime";
3707
3726
  var getComponent2 = (components, attachment) => {
3708
3727
  const type = attachment.type;
3709
3728
  switch (type) {
@@ -3724,10 +3743,10 @@ var AttachmentComponent2 = ({ components }) => {
3724
3743
  (a) => getComponent2(components, a.attachment)
3725
3744
  );
3726
3745
  if (!Component) return null;
3727
- return /* @__PURE__ */ jsx29(Component, {});
3746
+ return /* @__PURE__ */ jsx30(Component, {});
3728
3747
  };
3729
3748
  var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
3730
- return /* @__PURE__ */ jsx29(ComposerAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx29(AttachmentComponent2, { components }) });
3749
+ return /* @__PURE__ */ jsx30(ComposerAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx30(AttachmentComponent2, { components }) });
3731
3750
  };
3732
3751
  var ComposerAttachment = memo4(
3733
3752
  ComposerAttachmentImpl,
@@ -3736,7 +3755,7 @@ var ComposerAttachment = memo4(
3736
3755
  var ComposerPrimitiveAttachments = ({ components }) => {
3737
3756
  const { useComposer } = useThreadContext();
3738
3757
  const attachmentsCount = useComposer((s) => s.attachments.length);
3739
- return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx29(
3758
+ return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx30(
3740
3759
  ComposerAttachment,
3741
3760
  {
3742
3761
  attachmentIndex: index,
@@ -3781,9 +3800,9 @@ __export(thread_exports, {
3781
3800
  // src/primitives/thread/ThreadRoot.tsx
3782
3801
  import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
3783
3802
  import { forwardRef as forwardRef17 } from "react";
3784
- import { jsx as jsx30 } from "react/jsx-runtime";
3803
+ import { jsx as jsx31 } from "react/jsx-runtime";
3785
3804
  var ThreadPrimitiveRoot = forwardRef17((props, ref) => {
3786
- return /* @__PURE__ */ jsx30(Primitive9.div, { ...props, ref });
3805
+ return /* @__PURE__ */ jsx31(Primitive9.div, { ...props, ref });
3787
3806
  });
3788
3807
  ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
3789
3808
 
@@ -3918,13 +3937,13 @@ var useThreadViewportAutoScroll = ({
3918
3937
  };
3919
3938
 
3920
3939
  // src/primitives/thread/ThreadViewport.tsx
3921
- import { jsx as jsx31 } from "react/jsx-runtime";
3940
+ import { jsx as jsx32 } from "react/jsx-runtime";
3922
3941
  var ThreadPrimitiveViewport = forwardRef18(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
3923
3942
  const autoScrollRef = useThreadViewportAutoScroll({
3924
3943
  autoScroll
3925
3944
  });
3926
3945
  const ref = useComposedRefs4(forwardedRef, autoScrollRef);
3927
- return /* @__PURE__ */ jsx31(Primitive10.div, { ...rest, ref, children });
3946
+ return /* @__PURE__ */ jsx32(Primitive10.div, { ...rest, ref, children });
3928
3947
  });
3929
3948
  ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
3930
3949
 
@@ -3932,15 +3951,15 @@ ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
3932
3951
  import { memo as memo5 } from "react";
3933
3952
 
3934
3953
  // src/context/providers/MessageProvider.tsx
3935
- import { useEffect as useEffect14, useState as useState13 } from "react";
3936
- import { create as create17 } from "zustand";
3954
+ import { useEffect as useEffect14, useState as useState14 } from "react";
3955
+ import { create as create18 } from "zustand";
3937
3956
 
3938
3957
  // src/context/stores/EditComposer.ts
3939
- import { create as create15 } from "zustand";
3958
+ import { create as create16 } from "zustand";
3940
3959
  var makeEditComposerStore = ({
3941
3960
  onEdit,
3942
3961
  onSend
3943
- }) => create15()((set, get) => ({
3962
+ }) => create16()((set, get) => ({
3944
3963
  get value() {
3945
3964
  return get().text;
3946
3965
  },
@@ -3974,8 +3993,8 @@ var makeEditComposerStore = ({
3974
3993
  }));
3975
3994
 
3976
3995
  // src/context/stores/MessageUtils.ts
3977
- import { create as create16 } from "zustand";
3978
- var makeMessageUtilsStore = () => create16((set) => {
3996
+ import { create as create17 } from "zustand";
3997
+ var makeMessageUtilsStore = () => create17((set) => {
3979
3998
  let utterance = null;
3980
3999
  return {
3981
4000
  isCopied: false,
@@ -4001,7 +4020,7 @@ var makeMessageUtilsStore = () => create16((set) => {
4001
4020
  });
4002
4021
 
4003
4022
  // src/context/providers/MessageProvider.tsx
4004
- import { jsx as jsx32 } from "react/jsx-runtime";
4023
+ import { jsx as jsx33 } from "react/jsx-runtime";
4005
4024
  var getIsLast = (messages, message) => {
4006
4025
  return messages[messages.length - 1]?.id === message.id;
4007
4026
  };
@@ -4023,8 +4042,8 @@ var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
4023
4042
  };
4024
4043
  var useMessageContext2 = (messageIndex) => {
4025
4044
  const { useThreadMessages, useThreadActions } = useThreadContext();
4026
- const [context] = useState13(() => {
4027
- const useMessage = create17(
4045
+ const [context] = useState14(() => {
4046
+ const useMessage = create18(
4028
4047
  () => getMessageState(
4029
4048
  useThreadMessages.getState(),
4030
4049
  useThreadActions.getState().getBranches,
@@ -4049,6 +4068,8 @@ var useMessageContext2 = (messageIndex) => {
4049
4068
  throw new Error(
4050
4069
  "Tried to edit a non-user message. Editing is only supported for user messages. This is likely an internal bug in assistant-ui."
4051
4070
  );
4071
+ const previousText = getThreadMessageText(message);
4072
+ if (previousText === text) return;
4052
4073
  const nonTextParts = message.content.filter(
4053
4074
  (part) => part.type !== "text" && part.type !== "ui"
4054
4075
  );
@@ -4083,11 +4104,11 @@ var MessageProvider = ({
4083
4104
  children
4084
4105
  }) => {
4085
4106
  const context = useMessageContext2(messageIndex);
4086
- return /* @__PURE__ */ jsx32(MessageContext.Provider, { value: context, children });
4107
+ return /* @__PURE__ */ jsx33(MessageContext.Provider, { value: context, children });
4087
4108
  };
4088
4109
 
4089
4110
  // src/primitives/thread/ThreadMessages.tsx
4090
- import { jsx as jsx33, jsxs as jsxs4 } from "react/jsx-runtime";
4111
+ import { jsx as jsx34, jsxs as jsxs4 } from "react/jsx-runtime";
4091
4112
  var DEFAULT_SYSTEM_MESSAGE = () => null;
4092
4113
  var getComponents = (components) => {
4093
4114
  return {
@@ -4104,11 +4125,11 @@ var ThreadMessageImpl = ({
4104
4125
  const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
4105
4126
  return /* @__PURE__ */ jsxs4(MessageProvider, { messageIndex, children: [
4106
4127
  /* @__PURE__ */ jsxs4(MessagePrimitiveIf, { user: true, children: [
4107
- /* @__PURE__ */ jsx33(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx33(UserMessage2, {}) }),
4108
- /* @__PURE__ */ jsx33(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx33(EditComposer2, {}) })
4128
+ /* @__PURE__ */ jsx34(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx34(UserMessage2, {}) }),
4129
+ /* @__PURE__ */ jsx34(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx34(EditComposer2, {}) })
4109
4130
  ] }),
4110
- /* @__PURE__ */ jsx33(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx33(AssistantMessage2, {}) }),
4111
- /* @__PURE__ */ jsx33(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx33(SystemMessage2, {}) })
4131
+ /* @__PURE__ */ jsx34(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx34(AssistantMessage2, {}) }),
4132
+ /* @__PURE__ */ jsx34(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx34(SystemMessage2, {}) })
4112
4133
  ] });
4113
4134
  };
4114
4135
  var ThreadMessage = memo5(
@@ -4121,7 +4142,7 @@ var ThreadPrimitiveMessagesImpl = ({
4121
4142
  const { useThreadMessages } = useThreadContext();
4122
4143
  const messagesLength = useThreadMessages((t) => t.length);
4123
4144
  if (messagesLength === 0) return null;
4124
- return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */ jsx33(ThreadMessage, { messageIndex: index, components }, index));
4145
+ return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */ jsx34(ThreadMessage, { messageIndex: index, components }, index));
4125
4146
  };
4126
4147
  ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
4127
4148
  var ThreadPrimitiveMessages = memo5(
@@ -4147,7 +4168,7 @@ import {
4147
4168
  createContext as createContext7,
4148
4169
  useContext as useContext7
4149
4170
  } from "react";
4150
- import { Fragment as Fragment3, jsx as jsx34 } from "react/jsx-runtime";
4171
+ import { Fragment as Fragment3, jsx as jsx35 } from "react/jsx-runtime";
4151
4172
  var ThreadConfigContext = createContext7({});
4152
4173
  var useThreadConfig = () => {
4153
4174
  return useContext7(ThreadConfigContext);
@@ -4157,14 +4178,14 @@ var ThreadConfigProvider = ({
4157
4178
  config
4158
4179
  }) => {
4159
4180
  const assistant = useAssistantContext({ optional: true });
4160
- const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx34(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx34(Fragment3, { children });
4181
+ const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx35(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx35(Fragment3, { children });
4161
4182
  if (!config?.runtime) return configProvider;
4162
4183
  if (assistant) {
4163
4184
  throw new Error(
4164
4185
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
4165
4186
  );
4166
4187
  }
4167
- return /* @__PURE__ */ jsx34(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
4188
+ return /* @__PURE__ */ jsx35(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
4168
4189
  };
4169
4190
  ThreadConfigProvider.displayName = "ThreadConfigProvider";
4170
4191
 
@@ -4177,7 +4198,7 @@ import {
4177
4198
  RefreshCwIcon,
4178
4199
  StopCircleIcon
4179
4200
  } from "lucide-react";
4180
- import { Fragment as Fragment4, jsx as jsx35, jsxs as jsxs5 } from "react/jsx-runtime";
4201
+ import { Fragment as Fragment4, jsx as jsx36, jsxs as jsxs5 } from "react/jsx-runtime";
4181
4202
  var useAllowCopy = (ensureCapability = false) => {
4182
4203
  const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
4183
4204
  const { useThread } = useThreadContext();
@@ -4208,9 +4229,9 @@ var AssistantActionBar = () => {
4208
4229
  autohide: "not-last",
4209
4230
  autohideFloat: "single-branch",
4210
4231
  children: [
4211
- allowSpeak && /* @__PURE__ */ jsx35(AssistantActionBarSpeechControl, {}),
4212
- allowCopy && /* @__PURE__ */ jsx35(AssistantActionBarCopy, {}),
4213
- allowReload && /* @__PURE__ */ jsx35(AssistantActionBarReload, {})
4232
+ allowSpeak && /* @__PURE__ */ jsx36(AssistantActionBarSpeechControl, {}),
4233
+ allowCopy && /* @__PURE__ */ jsx36(AssistantActionBarCopy, {}),
4234
+ allowReload && /* @__PURE__ */ jsx36(AssistantActionBarReload, {})
4214
4235
  ]
4215
4236
  }
4216
4237
  );
@@ -4226,16 +4247,16 @@ var AssistantActionBarCopy = forwardRef19((props, ref) => {
4226
4247
  assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
4227
4248
  } = {}
4228
4249
  } = useThreadConfig();
4229
- return /* @__PURE__ */ jsx35(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx35(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
4230
- /* @__PURE__ */ jsx35(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx35(CheckIcon, {}) }),
4231
- /* @__PURE__ */ jsx35(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx35(CopyIcon, {}) })
4250
+ return /* @__PURE__ */ jsx36(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
4251
+ /* @__PURE__ */ jsx36(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx36(CheckIcon, {}) }),
4252
+ /* @__PURE__ */ jsx36(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx36(CopyIcon, {}) })
4232
4253
  ] }) }) });
4233
4254
  });
4234
4255
  AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
4235
4256
  var AssistantActionBarSpeechControl = () => {
4236
4257
  return /* @__PURE__ */ jsxs5(Fragment4, { children: [
4237
- /* @__PURE__ */ jsx35(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx35(AssistantActionBarSpeak, {}) }),
4238
- /* @__PURE__ */ jsx35(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx35(AssistantActionBarStopSpeaking, {}) })
4258
+ /* @__PURE__ */ jsx36(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx36(AssistantActionBarSpeak, {}) }),
4259
+ /* @__PURE__ */ jsx36(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx36(AssistantActionBarStopSpeaking, {}) })
4239
4260
  ] });
4240
4261
  };
4241
4262
  var AssistantActionBarSpeak = forwardRef19((props, ref) => {
@@ -4245,7 +4266,7 @@ var AssistantActionBarSpeak = forwardRef19((props, ref) => {
4245
4266
  } = {}
4246
4267
  } = useThreadConfig();
4247
4268
  const allowSpeak = useAllowSpeak();
4248
- return /* @__PURE__ */ jsx35(actionBar_exports.Speak, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx35(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx35(AudioLinesIcon, {}) }) });
4269
+ return /* @__PURE__ */ jsx36(actionBar_exports.Speak, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(AudioLinesIcon, {}) }) });
4249
4270
  });
4250
4271
  AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
4251
4272
  var AssistantActionBarStopSpeaking = forwardRef19((props, ref) => {
@@ -4257,7 +4278,7 @@ var AssistantActionBarStopSpeaking = forwardRef19((props, ref) => {
4257
4278
  } = {}
4258
4279
  } = useThreadConfig();
4259
4280
  const allowSpeak = useAllowSpeak();
4260
- return /* @__PURE__ */ jsx35(actionBar_exports.StopSpeaking, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx35(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx35(StopCircleIcon, {}) }) });
4281
+ return /* @__PURE__ */ jsx36(actionBar_exports.StopSpeaking, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(StopCircleIcon, {}) }) });
4261
4282
  });
4262
4283
  AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
4263
4284
  var AssistantActionBarReload = forwardRef19((props, ref) => {
@@ -4267,7 +4288,7 @@ var AssistantActionBarReload = forwardRef19((props, ref) => {
4267
4288
  } = {}
4268
4289
  } = useThreadConfig();
4269
4290
  const allowReload = useAllowReload();
4270
- return /* @__PURE__ */ jsx35(actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ jsx35(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx35(RefreshCwIcon, {}) }) });
4291
+ return /* @__PURE__ */ jsx36(actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx36(RefreshCwIcon, {}) }) });
4271
4292
  });
4272
4293
  AssistantActionBarReload.displayName = "AssistantActionBarReload";
4273
4294
  var exports = {
@@ -4289,7 +4310,7 @@ import { forwardRef as forwardRef21, useMemo as useMemo5 } from "react";
4289
4310
  // src/ui/branch-picker.tsx
4290
4311
  import { forwardRef as forwardRef20 } from "react";
4291
4312
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
4292
- import { jsx as jsx36, jsxs as jsxs6 } from "react/jsx-runtime";
4313
+ import { jsx as jsx37, jsxs as jsxs6 } from "react/jsx-runtime";
4293
4314
  var useAllowBranchPicker = (ensureCapability = false) => {
4294
4315
  const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
4295
4316
  const { useThread } = useThreadContext();
@@ -4300,9 +4321,9 @@ var BranchPicker = () => {
4300
4321
  const allowBranchPicker = useAllowBranchPicker();
4301
4322
  if (!allowBranchPicker) return null;
4302
4323
  return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
4303
- /* @__PURE__ */ jsx36(BranchPickerPrevious2, {}),
4304
- /* @__PURE__ */ jsx36(BranchPickerState, {}),
4305
- /* @__PURE__ */ jsx36(BranchPickerNext, {})
4324
+ /* @__PURE__ */ jsx37(BranchPickerPrevious2, {}),
4325
+ /* @__PURE__ */ jsx37(BranchPickerState, {}),
4326
+ /* @__PURE__ */ jsx37(BranchPickerNext, {})
4306
4327
  ] });
4307
4328
  };
4308
4329
  BranchPicker.displayName = "BranchPicker";
@@ -4317,7 +4338,7 @@ var BranchPickerPrevious2 = forwardRef20((props, ref) => {
4317
4338
  } = {}
4318
4339
  } = useThreadConfig();
4319
4340
  const allowBranchPicker = useAllowBranchPicker();
4320
- return /* @__PURE__ */ jsx36(branchPicker_exports.Previous, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(ChevronLeftIcon, {}) }) });
4341
+ return /* @__PURE__ */ jsx37(branchPicker_exports.Previous, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(ChevronLeftIcon, {}) }) });
4321
4342
  });
4322
4343
  BranchPickerPrevious2.displayName = "BranchPickerPrevious";
4323
4344
  var BranchPickerStateWrapper = withDefaults("span", {
@@ -4325,9 +4346,9 @@ var BranchPickerStateWrapper = withDefaults("span", {
4325
4346
  });
4326
4347
  var BranchPickerState = forwardRef20((props, ref) => {
4327
4348
  return /* @__PURE__ */ jsxs6(BranchPickerStateWrapper, { ...props, ref, children: [
4328
- /* @__PURE__ */ jsx36(branchPicker_exports.Number, {}),
4349
+ /* @__PURE__ */ jsx37(branchPicker_exports.Number, {}),
4329
4350
  " / ",
4330
- /* @__PURE__ */ jsx36(branchPicker_exports.Count, {})
4351
+ /* @__PURE__ */ jsx37(branchPicker_exports.Count, {})
4331
4352
  ] });
4332
4353
  });
4333
4354
  BranchPickerState.displayName = "BranchPickerState";
@@ -4336,7 +4357,7 @@ var BranchPickerNext = forwardRef20((props, ref) => {
4336
4357
  strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
4337
4358
  } = useThreadConfig();
4338
4359
  const allowBranchPicker = useAllowBranchPicker();
4339
- return /* @__PURE__ */ jsx36(branchPicker_exports.Next, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx36(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(ChevronRightIcon, {}) }) });
4360
+ return /* @__PURE__ */ jsx37(branchPicker_exports.Next, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(ChevronRightIcon, {}) }) });
4340
4361
  });
4341
4362
  BranchPickerNext.displayName = "BranchPickerNext";
4342
4363
  var exports2 = {
@@ -4348,12 +4369,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
4348
4369
 
4349
4370
  // src/ui/base/avatar.tsx
4350
4371
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
4351
- import { jsx as jsx37, jsxs as jsxs7 } from "react/jsx-runtime";
4372
+ import { jsx as jsx38, jsxs as jsxs7 } from "react/jsx-runtime";
4352
4373
  var Avatar = ({ src, alt, fallback }) => {
4353
4374
  if (src == null && fallback == null) return null;
4354
4375
  return /* @__PURE__ */ jsxs7(AvatarRoot, { children: [
4355
- src != null && /* @__PURE__ */ jsx37(AvatarImage, { src, alt }),
4356
- fallback != null && /* @__PURE__ */ jsx37(AvatarFallback, { children: fallback })
4376
+ src != null && /* @__PURE__ */ jsx38(AvatarImage, { src, alt }),
4377
+ fallback != null && /* @__PURE__ */ jsx38(AvatarFallback, { children: fallback })
4357
4378
  ] });
4358
4379
  };
4359
4380
  Avatar.displayName = "Avatar";
@@ -4372,10 +4393,10 @@ AvatarFallback.displayName = "AvatarFallback";
4372
4393
 
4373
4394
  // src/ui/content-part.tsx
4374
4395
  import classNames2 from "classnames";
4375
- import { jsx as jsx38 } from "react/jsx-runtime";
4396
+ import { jsx as jsx39 } from "react/jsx-runtime";
4376
4397
  var Text = () => {
4377
4398
  const status = useSmoothStatus();
4378
- return /* @__PURE__ */ jsx38(
4399
+ return /* @__PURE__ */ jsx39(
4379
4400
  contentPart_exports.Text,
4380
4401
  {
4381
4402
  className: classNames2(
@@ -4390,19 +4411,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) };
4390
4411
  var content_part_default = exports3;
4391
4412
 
4392
4413
  // src/ui/assistant-message.tsx
4393
- import { jsx as jsx39, jsxs as jsxs8 } from "react/jsx-runtime";
4414
+ import { jsx as jsx40, jsxs as jsxs8 } from "react/jsx-runtime";
4394
4415
  var AssistantMessage = () => {
4395
4416
  return /* @__PURE__ */ jsxs8(AssistantMessageRoot, { children: [
4396
- /* @__PURE__ */ jsx39(AssistantMessageAvatar, {}),
4397
- /* @__PURE__ */ jsx39(AssistantMessageContent, {}),
4398
- /* @__PURE__ */ jsx39(branch_picker_default, {}),
4399
- /* @__PURE__ */ jsx39(assistant_action_bar_default, {})
4417
+ /* @__PURE__ */ jsx40(AssistantMessageAvatar, {}),
4418
+ /* @__PURE__ */ jsx40(AssistantMessageContent, {}),
4419
+ /* @__PURE__ */ jsx40(branch_picker_default, {}),
4420
+ /* @__PURE__ */ jsx40(assistant_action_bar_default, {})
4400
4421
  ] });
4401
4422
  };
4402
4423
  AssistantMessage.displayName = "AssistantMessage";
4403
4424
  var AssistantMessageAvatar = () => {
4404
4425
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4405
- return /* @__PURE__ */ jsx39(Avatar, { ...avatar });
4426
+ return /* @__PURE__ */ jsx40(Avatar, { ...avatar });
4406
4427
  };
4407
4428
  var AssistantMessageRoot = withDefaults(message_exports.Root, {
4408
4429
  className: "aui-assistant-message-root"
@@ -4426,7 +4447,7 @@ var AssistantMessageContent = forwardRef21(({ components: componentsProp, ...res
4426
4447
  // eslint-disable-next-line react-hooks/exhaustive-deps
4427
4448
  [...tools ?? [], components.ToolFallback]
4428
4449
  );
4429
- return /* @__PURE__ */ jsx39(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx39(
4450
+ return /* @__PURE__ */ jsx40(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx40(
4430
4451
  message_exports.Content,
4431
4452
  {
4432
4453
  components: {
@@ -4461,9 +4482,9 @@ import { forwardRef as forwardRef23 } from "react";
4461
4482
  import { PaperclipIcon, SendHorizontalIcon } from "lucide-react";
4462
4483
 
4463
4484
  // src/ui/base/CircleStopIcon.tsx
4464
- import { jsx as jsx40 } from "react/jsx-runtime";
4485
+ import { jsx as jsx41 } from "react/jsx-runtime";
4465
4486
  var CircleStopIcon = () => {
4466
- return /* @__PURE__ */ jsx40(
4487
+ return /* @__PURE__ */ jsx41(
4467
4488
  "svg",
4468
4489
  {
4469
4490
  xmlns: "http://www.w3.org/2000/svg",
@@ -4471,7 +4492,7 @@ var CircleStopIcon = () => {
4471
4492
  fill: "currentColor",
4472
4493
  width: "16",
4473
4494
  height: "16",
4474
- children: /* @__PURE__ */ jsx40("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
4495
+ children: /* @__PURE__ */ jsx41("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
4475
4496
  }
4476
4497
  );
4477
4498
  };
@@ -4480,7 +4501,7 @@ CircleStopIcon.displayName = "CircleStopIcon";
4480
4501
  // src/ui/composer-attachment.tsx
4481
4502
  import { forwardRef as forwardRef22 } from "react";
4482
4503
  import { CircleXIcon } from "lucide-react";
4483
- import { jsx as jsx41, jsxs as jsxs9 } from "react/jsx-runtime";
4504
+ import { jsx as jsx42, jsxs as jsxs9 } from "react/jsx-runtime";
4484
4505
  var ComposerAttachmentRoot = withDefaults("div", {
4485
4506
  className: "aui-composer-attachment-root"
4486
4507
  });
@@ -4491,7 +4512,7 @@ var ComposerAttachment2 = () => {
4491
4512
  return /* @__PURE__ */ jsxs9(ComposerAttachmentRoot, { children: [
4492
4513
  ".",
4493
4514
  attachment.name.split(".").pop(),
4494
- /* @__PURE__ */ jsx41(ComposerAttachmentRemove, {})
4515
+ /* @__PURE__ */ jsx42(ComposerAttachmentRemove, {})
4495
4516
  ] });
4496
4517
  };
4497
4518
  ComposerAttachment2.displayName = "ComposerAttachment";
@@ -4506,7 +4527,7 @@ var ComposerAttachmentRemove = forwardRef22((props, ref) => {
4506
4527
  const handleRemoveAttachment = () => {
4507
4528
  useComposer.getState().removeAttachment(useAttachment.getState().attachment.id);
4508
4529
  };
4509
- return /* @__PURE__ */ jsx41(
4530
+ return /* @__PURE__ */ jsx42(
4510
4531
  TooltipIconButton,
4511
4532
  {
4512
4533
  tooltip,
@@ -4515,7 +4536,7 @@ var ComposerAttachmentRemove = forwardRef22((props, ref) => {
4515
4536
  ...props,
4516
4537
  onClick: handleRemoveAttachment,
4517
4538
  ref,
4518
- children: props.children ?? /* @__PURE__ */ jsx41(CircleXIcon, {})
4539
+ children: props.children ?? /* @__PURE__ */ jsx42(CircleXIcon, {})
4519
4540
  }
4520
4541
  );
4521
4542
  });
@@ -4530,7 +4551,7 @@ var composer_attachment_default = Object.assign(
4530
4551
  );
4531
4552
 
4532
4553
  // src/ui/composer.tsx
4533
- import { Fragment as Fragment5, jsx as jsx42, jsxs as jsxs10 } from "react/jsx-runtime";
4554
+ import { Fragment as Fragment5, jsx as jsx43, jsxs as jsxs10 } from "react/jsx-runtime";
4534
4555
  var useAllowAttachments = (ensureCapability = false) => {
4535
4556
  const { composer: { allowAttachments = true } = {} } = useThreadConfig();
4536
4557
  const { useThread } = useThreadContext();
@@ -4540,10 +4561,10 @@ var useAllowAttachments = (ensureCapability = false) => {
4540
4561
  var Composer = () => {
4541
4562
  const allowAttachments = useAllowAttachments(true);
4542
4563
  return /* @__PURE__ */ jsxs10(ComposerRoot, { children: [
4543
- allowAttachments && /* @__PURE__ */ jsx42(ComposerAttachments, {}),
4544
- allowAttachments && /* @__PURE__ */ jsx42(ComposerAddAttachment, {}),
4545
- /* @__PURE__ */ jsx42(ComposerInput, { autoFocus: true }),
4546
- /* @__PURE__ */ jsx42(ComposerAction, {})
4564
+ allowAttachments && /* @__PURE__ */ jsx43(ComposerAttachments, {}),
4565
+ allowAttachments && /* @__PURE__ */ jsx43(ComposerAddAttachment, {}),
4566
+ /* @__PURE__ */ jsx43(ComposerInput, { autoFocus: true }),
4567
+ /* @__PURE__ */ jsx43(ComposerAction, {})
4547
4568
  ] });
4548
4569
  };
4549
4570
  Composer.displayName = "Composer";
@@ -4563,7 +4584,7 @@ var ComposerInput = forwardRef23(
4563
4584
  composer: { input: { placeholder = "Write a message..." } = {} } = {}
4564
4585
  } = {}
4565
4586
  } = useThreadConfig();
4566
- return /* @__PURE__ */ jsx42(ComposerInputStyled, { placeholder, ...props, ref });
4587
+ return /* @__PURE__ */ jsx43(ComposerInputStyled, { placeholder, ...props, ref });
4567
4588
  }
4568
4589
  );
4569
4590
  ComposerInput.displayName = "ComposerInput";
@@ -4571,7 +4592,7 @@ var ComposerAttachmentsContainer = withDefaults("div", {
4571
4592
  className: "aui-composer-attachments"
4572
4593
  });
4573
4594
  var ComposerAttachments = ({ components }) => {
4574
- return /* @__PURE__ */ jsx42(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx42(
4595
+ return /* @__PURE__ */ jsx43(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx43(
4575
4596
  composer_exports.Attachments,
4576
4597
  {
4577
4598
  components: {
@@ -4592,14 +4613,14 @@ var ComposerAddAttachment = forwardRef23((props, ref) => {
4592
4613
  } = {}
4593
4614
  } = useThreadConfig();
4594
4615
  const allowAttachments = useAllowAttachments();
4595
- return /* @__PURE__ */ jsx42(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx42(
4616
+ return /* @__PURE__ */ jsx43(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx43(
4596
4617
  ComposerAttachButton,
4597
4618
  {
4598
4619
  tooltip,
4599
4620
  variant: "ghost",
4600
4621
  ...props,
4601
4622
  ref,
4602
- children: props.children ?? /* @__PURE__ */ jsx42(PaperclipIcon, {})
4623
+ children: props.children ?? /* @__PURE__ */ jsx43(PaperclipIcon, {})
4603
4624
  }
4604
4625
  ) });
4605
4626
  });
@@ -4611,10 +4632,10 @@ var useAllowCancel = () => {
4611
4632
  };
4612
4633
  var ComposerAction = () => {
4613
4634
  const allowCancel = useAllowCancel();
4614
- if (!allowCancel) return /* @__PURE__ */ jsx42(ComposerSend, {});
4635
+ if (!allowCancel) return /* @__PURE__ */ jsx43(ComposerSend, {});
4615
4636
  return /* @__PURE__ */ jsxs10(Fragment5, { children: [
4616
- /* @__PURE__ */ jsx42(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx42(ComposerSend, {}) }),
4617
- /* @__PURE__ */ jsx42(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx42(ComposerCancel, {}) })
4637
+ /* @__PURE__ */ jsx43(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx43(ComposerSend, {}) }),
4638
+ /* @__PURE__ */ jsx43(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx43(ComposerCancel, {}) })
4618
4639
  ] });
4619
4640
  };
4620
4641
  ComposerAction.displayName = "ComposerAction";
@@ -4626,7 +4647,7 @@ var ComposerSend = forwardRef23((props, ref) => {
4626
4647
  const {
4627
4648
  strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
4628
4649
  } = useThreadConfig();
4629
- return /* @__PURE__ */ jsx42(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx42(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx42(SendHorizontalIcon, {}) }) });
4650
+ return /* @__PURE__ */ jsx43(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx43(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx43(SendHorizontalIcon, {}) }) });
4630
4651
  });
4631
4652
  ComposerSend.displayName = "ComposerSend";
4632
4653
  var ComposerCancelButton = withDefaults(TooltipIconButton, {
@@ -4637,7 +4658,7 @@ var ComposerCancel = forwardRef23((props, ref) => {
4637
4658
  const {
4638
4659
  strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
4639
4660
  } = useThreadConfig();
4640
- return /* @__PURE__ */ jsx42(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx42(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx42(CircleStopIcon, {}) }) });
4661
+ return /* @__PURE__ */ jsx43(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx43(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx43(CircleStopIcon, {}) }) });
4641
4662
  });
4642
4663
  ComposerCancel.displayName = "ComposerCancel";
4643
4664
  var exports6 = {
@@ -4653,14 +4674,14 @@ var composer_default = Object.assign(Composer, exports6);
4653
4674
 
4654
4675
  // src/ui/thread-welcome.tsx
4655
4676
  import { forwardRef as forwardRef24 } from "react";
4656
- import { jsx as jsx43, jsxs as jsxs11 } from "react/jsx-runtime";
4677
+ import { jsx as jsx44, jsxs as jsxs11 } from "react/jsx-runtime";
4657
4678
  var ThreadWelcome = () => {
4658
4679
  return /* @__PURE__ */ jsxs11(ThreadWelcomeRoot, { children: [
4659
4680
  /* @__PURE__ */ jsxs11(ThreadWelcomeCenter, { children: [
4660
- /* @__PURE__ */ jsx43(ThreadWelcomeAvatar, {}),
4661
- /* @__PURE__ */ jsx43(ThreadWelcomeMessage, {})
4681
+ /* @__PURE__ */ jsx44(ThreadWelcomeAvatar, {}),
4682
+ /* @__PURE__ */ jsx44(ThreadWelcomeMessage, {})
4662
4683
  ] }),
4663
- /* @__PURE__ */ jsx43(ThreadWelcomeSuggestions, {})
4684
+ /* @__PURE__ */ jsx44(ThreadWelcomeSuggestions, {})
4664
4685
  ] });
4665
4686
  };
4666
4687
  ThreadWelcome.displayName = "ThreadWelcome";
@@ -4672,20 +4693,20 @@ var ThreadWelcomeCenter = withDefaults("div", {
4672
4693
  });
4673
4694
  var ThreadWelcomeRoot = forwardRef24(
4674
4695
  (props, ref) => {
4675
- return /* @__PURE__ */ jsx43(thread_exports.Empty, { children: /* @__PURE__ */ jsx43(ThreadWelcomeRootStyled, { ...props, ref }) });
4696
+ return /* @__PURE__ */ jsx44(thread_exports.Empty, { children: /* @__PURE__ */ jsx44(ThreadWelcomeRootStyled, { ...props, ref }) });
4676
4697
  }
4677
4698
  );
4678
4699
  ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
4679
4700
  var ThreadWelcomeAvatar = () => {
4680
4701
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4681
- return /* @__PURE__ */ jsx43(Avatar, { ...avatar });
4702
+ return /* @__PURE__ */ jsx44(Avatar, { ...avatar });
4682
4703
  };
4683
4704
  var ThreadWelcomeMessageStyled = withDefaults("p", {
4684
4705
  className: "aui-thread-welcome-message"
4685
4706
  });
4686
4707
  var ThreadWelcomeMessage = forwardRef24(({ message: messageProp, ...rest }, ref) => {
4687
4708
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
4688
- return /* @__PURE__ */ jsx43(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
4709
+ return /* @__PURE__ */ jsx44(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
4689
4710
  });
4690
4711
  ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
4691
4712
  var ThreadWelcomeSuggestionContainer = withDefaults("div", {
@@ -4697,21 +4718,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
4697
4718
  var ThreadWelcomeSuggestion = ({
4698
4719
  suggestion: { text, prompt }
4699
4720
  }) => {
4700
- return /* @__PURE__ */ jsx43(
4721
+ return /* @__PURE__ */ jsx44(
4701
4722
  ThreadWelcomeSuggestionStyled,
4702
4723
  {
4703
4724
  prompt,
4704
4725
  method: "replace",
4705
4726
  autoSend: true,
4706
- children: /* @__PURE__ */ jsx43("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
4727
+ children: /* @__PURE__ */ jsx44("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
4707
4728
  }
4708
4729
  );
4709
4730
  };
4710
4731
  var ThreadWelcomeSuggestions = () => {
4711
4732
  const { welcome: { suggestions } = {} } = useThreadConfig();
4712
- return /* @__PURE__ */ jsx43(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
4733
+ return /* @__PURE__ */ jsx44(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
4713
4734
  const key = `${suggestion.prompt}-${idx}`;
4714
- return /* @__PURE__ */ jsx43(ThreadWelcomeSuggestion, { suggestion }, key);
4735
+ return /* @__PURE__ */ jsx44(ThreadWelcomeSuggestion, { suggestion }, key);
4715
4736
  }) });
4716
4737
  };
4717
4738
  ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
@@ -4731,7 +4752,7 @@ import { forwardRef as forwardRef26 } from "react";
4731
4752
  // src/ui/user-action-bar.tsx
4732
4753
  import { forwardRef as forwardRef25 } from "react";
4733
4754
  import { PencilIcon } from "lucide-react";
4734
- import { jsx as jsx44 } from "react/jsx-runtime";
4755
+ import { jsx as jsx45 } from "react/jsx-runtime";
4735
4756
  var useAllowEdit = (ensureCapability = false) => {
4736
4757
  const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
4737
4758
  const { useThread } = useThreadContext();
@@ -4741,7 +4762,7 @@ var useAllowEdit = (ensureCapability = false) => {
4741
4762
  var UserActionBar = () => {
4742
4763
  const allowEdit = useAllowEdit(true);
4743
4764
  if (!allowEdit) return null;
4744
- return /* @__PURE__ */ jsx44(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx44(UserActionBarEdit, {}) });
4765
+ return /* @__PURE__ */ jsx45(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx45(UserActionBarEdit, {}) });
4745
4766
  };
4746
4767
  UserActionBar.displayName = "UserActionBar";
4747
4768
  var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
@@ -4753,7 +4774,7 @@ var UserActionBarEdit = forwardRef25((props, ref) => {
4753
4774
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
4754
4775
  } = useThreadConfig();
4755
4776
  const allowEdit = useAllowEdit();
4756
- return /* @__PURE__ */ jsx44(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx44(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx44(PencilIcon, {}) }) });
4777
+ return /* @__PURE__ */ jsx45(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx45(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx45(PencilIcon, {}) }) });
4757
4778
  });
4758
4779
  UserActionBarEdit.displayName = "UserActionBarEdit";
4759
4780
  var exports8 = {
@@ -4786,13 +4807,13 @@ var user_message_attachment_default = Object.assign(
4786
4807
  );
4787
4808
 
4788
4809
  // src/ui/user-message.tsx
4789
- import { jsx as jsx45, jsxs as jsxs13 } from "react/jsx-runtime";
4810
+ import { jsx as jsx46, jsxs as jsxs13 } from "react/jsx-runtime";
4790
4811
  var UserMessage = () => {
4791
4812
  return /* @__PURE__ */ jsxs13(UserMessageRoot, { children: [
4792
- /* @__PURE__ */ jsx45(UserMessageAttachments, {}),
4793
- /* @__PURE__ */ jsx45(user_action_bar_default, {}),
4794
- /* @__PURE__ */ jsx45(UserMessageContent, {}),
4795
- /* @__PURE__ */ jsx45(branch_picker_default, {})
4813
+ /* @__PURE__ */ jsx46(UserMessageAttachments, {}),
4814
+ /* @__PURE__ */ jsx46(user_action_bar_default, {}),
4815
+ /* @__PURE__ */ jsx46(UserMessageContent, {}),
4816
+ /* @__PURE__ */ jsx46(branch_picker_default, {})
4796
4817
  ] });
4797
4818
  };
4798
4819
  UserMessage.displayName = "UserMessage";
@@ -4805,7 +4826,7 @@ var UserMessageContentWrapper = withDefaults("div", {
4805
4826
  });
4806
4827
  var UserMessageContent = forwardRef26(
4807
4828
  ({ components, ...props }, ref) => {
4808
- return /* @__PURE__ */ jsx45(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx45(
4829
+ return /* @__PURE__ */ jsx46(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx46(
4809
4830
  message_exports.Content,
4810
4831
  {
4811
4832
  components: {
@@ -4823,7 +4844,7 @@ var UserMessageAttachmentsContainer = withDefaults("div", {
4823
4844
  var UserMessageAttachments = ({
4824
4845
  components
4825
4846
  }) => {
4826
- return /* @__PURE__ */ jsx45(message_exports.If, { hasAttachments: true, children: /* @__PURE__ */ jsx45(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx45(
4847
+ return /* @__PURE__ */ jsx46(message_exports.If, { hasAttachments: true, children: /* @__PURE__ */ jsx46(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx46(
4827
4848
  message_exports.Attachments,
4828
4849
  {
4829
4850
  components: {
@@ -4842,13 +4863,13 @@ var user_message_default = Object.assign(UserMessage, exports10);
4842
4863
 
4843
4864
  // src/ui/edit-composer.tsx
4844
4865
  import { forwardRef as forwardRef27 } from "react";
4845
- import { jsx as jsx46, jsxs as jsxs14 } from "react/jsx-runtime";
4866
+ import { jsx as jsx47, jsxs as jsxs14 } from "react/jsx-runtime";
4846
4867
  var EditComposer = () => {
4847
4868
  return /* @__PURE__ */ jsxs14(EditComposerRoot, { children: [
4848
- /* @__PURE__ */ jsx46(EditComposerInput, {}),
4869
+ /* @__PURE__ */ jsx47(EditComposerInput, {}),
4849
4870
  /* @__PURE__ */ jsxs14(EditComposerFooter, { children: [
4850
- /* @__PURE__ */ jsx46(EditComposerCancel, {}),
4851
- /* @__PURE__ */ jsx46(EditComposerSend, {})
4871
+ /* @__PURE__ */ jsx47(EditComposerCancel, {}),
4872
+ /* @__PURE__ */ jsx47(EditComposerSend, {})
4852
4873
  ] })
4853
4874
  ] });
4854
4875
  };
@@ -4872,7 +4893,7 @@ var EditComposerCancel = forwardRef27(
4872
4893
  editComposer: { cancel: { label = "Cancel" } = {} } = {}
4873
4894
  } = {}
4874
4895
  } = useThreadConfig();
4875
- return /* @__PURE__ */ jsx46(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx46(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4896
+ return /* @__PURE__ */ jsx47(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx47(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4876
4897
  }
4877
4898
  );
4878
4899
  EditComposerCancel.displayName = "EditComposerCancel";
@@ -4881,7 +4902,7 @@ var EditComposerSend = forwardRef27(
4881
4902
  const {
4882
4903
  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
4883
4904
  } = useThreadConfig();
4884
- return /* @__PURE__ */ jsx46(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx46(Button, { ...props, ref, children: props.children ?? label }) });
4905
+ return /* @__PURE__ */ jsx47(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx47(Button, { ...props, ref, children: props.children ?? label }) });
4885
4906
  }
4886
4907
  );
4887
4908
  EditComposerSend.displayName = "EditComposerSend";
@@ -4895,14 +4916,14 @@ var exports11 = {
4895
4916
  var edit_composer_default = Object.assign(EditComposer, exports11);
4896
4917
 
4897
4918
  // src/ui/thread.tsx
4898
- import { jsx as jsx47, jsxs as jsxs15 } from "react/jsx-runtime";
4919
+ import { jsx as jsx48, jsxs as jsxs15 } from "react/jsx-runtime";
4899
4920
  var Thread = (config) => {
4900
- return /* @__PURE__ */ jsx47(ThreadRoot, { config, children: /* @__PURE__ */ jsxs15(ThreadViewport, { children: [
4901
- /* @__PURE__ */ jsx47(thread_welcome_default, {}),
4902
- /* @__PURE__ */ jsx47(ThreadMessages, {}),
4921
+ return /* @__PURE__ */ jsx48(ThreadRoot, { config, children: /* @__PURE__ */ jsxs15(ThreadViewport, { children: [
4922
+ /* @__PURE__ */ jsx48(thread_welcome_default, {}),
4923
+ /* @__PURE__ */ jsx48(ThreadMessages, {}),
4903
4924
  /* @__PURE__ */ jsxs15(ThreadViewportFooter, { children: [
4904
- /* @__PURE__ */ jsx47(ThreadScrollToBottom, {}),
4905
- /* @__PURE__ */ jsx47(composer_default, {})
4925
+ /* @__PURE__ */ jsx48(ThreadScrollToBottom, {}),
4926
+ /* @__PURE__ */ jsx48(composer_default, {})
4906
4927
  ] })
4907
4928
  ] }) });
4908
4929
  };
@@ -4911,7 +4932,7 @@ var ThreadRootStyled = withDefaults(thread_exports.Root, {
4911
4932
  });
4912
4933
  var ThreadRoot = forwardRef28(
4913
4934
  ({ config, ...props }, ref) => {
4914
- return /* @__PURE__ */ jsx47(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx47(ThreadRootStyled, { ...props, ref }) });
4935
+ return /* @__PURE__ */ jsx48(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx48(ThreadRootStyled, { ...props, ref }) });
4915
4936
  }
4916
4937
  );
4917
4938
  ThreadRoot.displayName = "ThreadRoot";
@@ -4925,7 +4946,7 @@ var ThreadViewportFooter = withDefaults("div", {
4925
4946
  ThreadViewportFooter.displayName = "ThreadViewportFooter";
4926
4947
  var SystemMessage = () => null;
4927
4948
  var ThreadMessages = ({ components, ...rest }) => {
4928
- return /* @__PURE__ */ jsx47(
4949
+ return /* @__PURE__ */ jsx48(
4929
4950
  thread_exports.Messages,
4930
4951
  {
4931
4952
  components: {
@@ -4949,7 +4970,7 @@ var ThreadScrollToBottom = forwardRef28((props, ref) => {
4949
4970
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
4950
4971
  } = {}
4951
4972
  } = useThreadConfig();
4952
- return /* @__PURE__ */ jsx47(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx47(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx47(ArrowDownIcon, {}) }) });
4973
+ return /* @__PURE__ */ jsx48(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx48(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx48(ArrowDownIcon, {}) }) });
4953
4974
  });
4954
4975
  ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
4955
4976
  var exports12 = {
@@ -4962,20 +4983,20 @@ var exports12 = {
4962
4983
  var thread_default = Object.assign(Thread, exports12);
4963
4984
 
4964
4985
  // src/ui/assistant-modal.tsx
4965
- import { Fragment as Fragment6, jsx as jsx48, jsxs as jsxs16 } from "react/jsx-runtime";
4986
+ import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs16 } from "react/jsx-runtime";
4966
4987
  var AssistantModal = (config) => {
4967
4988
  return /* @__PURE__ */ jsxs16(AssistantModalRoot, { config, children: [
4968
- /* @__PURE__ */ jsx48(AssistantModalTrigger, {}),
4969
- /* @__PURE__ */ jsx48(AssistantModalContent, { children: /* @__PURE__ */ jsx48(thread_default, {}) })
4989
+ /* @__PURE__ */ jsx49(AssistantModalTrigger, {}),
4990
+ /* @__PURE__ */ jsx49(AssistantModalContent, { children: /* @__PURE__ */ jsx49(thread_default, {}) })
4970
4991
  ] });
4971
4992
  };
4972
4993
  AssistantModal.displayName = "AssistantModal";
4973
4994
  var AssistantModalRoot = ({ config, ...props }) => {
4974
- return /* @__PURE__ */ jsx48(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx48(assistantModal_exports.Root, { ...props }) });
4995
+ return /* @__PURE__ */ jsx49(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx49(assistantModal_exports.Root, { ...props }) });
4975
4996
  };
4976
4997
  AssistantModalRoot.displayName = "AssistantModalRoot";
4977
4998
  var AssistantModalTrigger = forwardRef29((props, ref) => {
4978
- return /* @__PURE__ */ jsx48(AssistantModalAnchor, { children: /* @__PURE__ */ jsx48(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx48(AssistantModalButton, { ...props, ref }) }) });
4999
+ return /* @__PURE__ */ jsx49(AssistantModalAnchor, { children: /* @__PURE__ */ jsx49(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx49(AssistantModalButton, { ...props, ref }) }) });
4979
5000
  });
4980
5001
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
4981
5002
  var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
@@ -5000,7 +5021,7 @@ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref)
5000
5021
  } = {}
5001
5022
  } = useThreadConfig();
5002
5023
  const tooltip = state === "open" ? openTooltip : closedTooltip;
5003
- return /* @__PURE__ */ jsx48(
5024
+ return /* @__PURE__ */ jsx49(
5004
5025
  ModalButtonStyled,
5005
5026
  {
5006
5027
  side: "left",
@@ -5009,14 +5030,14 @@ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref)
5009
5030
  ...rest,
5010
5031
  ref,
5011
5032
  children: rest.children ?? /* @__PURE__ */ jsxs16(Fragment6, { children: [
5012
- /* @__PURE__ */ jsx48(
5033
+ /* @__PURE__ */ jsx49(
5013
5034
  BotIcon,
5014
5035
  {
5015
5036
  "data-state": state,
5016
5037
  className: "aui-modal-button-closed-icon"
5017
5038
  }
5018
5039
  ),
5019
- /* @__PURE__ */ jsx48(
5040
+ /* @__PURE__ */ jsx49(
5020
5041
  ChevronDownIcon,
5021
5042
  {
5022
5043
  "data-state": state,
@@ -5063,6 +5084,7 @@ export {
5063
5084
  message_exports as MessagePrimitive,
5064
5085
  SimpleImageAttachmentAdapter,
5065
5086
  SimpleTextAttachmentAdapter,
5087
+ TextContentPartProvider,
5066
5088
  thread_default as Thread,
5067
5089
  ThreadConfigProvider,
5068
5090
  thread_exports as ThreadPrimitive,