@assistant-ui/react 0.5.73 → 0.5.75

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
@@ -605,20 +605,13 @@ var useActionBarReload = () => {
605
605
  // src/primitive-hooks/actionBar/useActionBarSpeak.tsx
606
606
  import { useCallback as useCallback6 } from "react";
607
607
  var useActionBarSpeak = () => {
608
- const messageStore = useMessageStore();
609
- const editComposerStore = useEditComposerStore();
610
608
  const messageRunime = useMessageRuntime();
611
- const messageUtilsStore = useMessageUtilsStore();
612
- const hasSpeakableContent = useCombinedStore(
613
- [messageStore, editComposerStore],
614
- (message, c) => {
615
- return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
616
- }
617
- );
618
609
  const callback = useCallback6(async () => {
619
- const utt = messageRunime.speak();
620
- messageUtilsStore.getState().addUtterance(utt);
621
- }, [messageRunime, messageUtilsStore]);
610
+ messageRunime.speak();
611
+ }, [messageRunime]);
612
+ const hasSpeakableContent = useMessage((m) => {
613
+ return (m.role !== "assistant" || m.status.type !== "running") && m.content.some((c) => c.type === "text" && c.text.length > 0);
614
+ });
622
615
  if (!hasSpeakableContent) return null;
623
616
  return callback;
624
617
  };
@@ -626,11 +619,11 @@ var useActionBarSpeak = () => {
626
619
  // src/primitive-hooks/actionBar/useActionBarStopSpeaking.tsx
627
620
  import { useCallback as useCallback7 } from "react";
628
621
  var useActionBarStopSpeaking = () => {
629
- const messageUtilsStore = useMessageUtilsStore();
630
- const isSpeaking = useMessageUtils((u) => u.isSpeaking);
622
+ const messageRuntime = useMessageRuntime();
623
+ const isSpeaking = useMessage((u) => u.speech != null);
631
624
  const callback = useCallback7(async () => {
632
- messageUtilsStore.getState().stopSpeaking();
633
- }, [messageUtilsStore]);
625
+ messageRuntime.stopSpeaking();
626
+ }, [messageRuntime]);
634
627
  if (!isSpeaking) return null;
635
628
  return callback;
636
629
  };
@@ -673,12 +666,7 @@ var useBranchPickerCount = () => {
673
666
  import { useCallback as useCallback10 } from "react";
674
667
  var useBranchPickerNext = () => {
675
668
  const messageRuntime = useMessageRuntime();
676
- const messageStore = useMessageStore();
677
- const editComposerStore = useEditComposerStore();
678
- const disabled = useCombinedStore(
679
- [messageStore, editComposerStore],
680
- (m, c) => c.isEditing || m.branchNumber >= m.branchCount
681
- );
669
+ const disabled = useMessage((m) => m.branchNumber >= m.branchCount);
682
670
  const callback = useCallback10(() => {
683
671
  messageRuntime.switchToBranch({ position: "next" });
684
672
  }, [messageRuntime]);
@@ -696,12 +684,7 @@ var useBranchPickerNumber = () => {
696
684
  import { useCallback as useCallback11 } from "react";
697
685
  var useBranchPickerPrevious = () => {
698
686
  const messageRuntime = useMessageRuntime();
699
- const messageStore = useMessageStore();
700
- const editComposerStore = useEditComposerStore();
701
- const disabled = useCombinedStore(
702
- [messageStore, editComposerStore],
703
- (m, c) => c.isEditing || m.branchNumber <= 1
704
- );
687
+ const disabled = useMessage((m) => m.branchNumber <= 1);
705
688
  const callback = useCallback11(() => {
706
689
  messageRuntime.switchToBranch({ position: "previous" });
707
690
  }, [messageRuntime]);
@@ -820,7 +803,7 @@ var useMessageIf = (props) => {
820
803
  const messageUtilsStore = useMessageUtilsStore();
821
804
  return useCombinedStore(
822
805
  [messageStore, messageUtilsStore],
823
- ({ role, attachments, branchCount, isLast }, { isCopied, isHovering, isSpeaking, submittedFeedback }) => {
806
+ ({ role, attachments, branchCount, isLast, speech }, { isCopied, isHovering, submittedFeedback }) => {
824
807
  if (props.hasBranches === true && branchCount < 2) return false;
825
808
  if (props.user && role !== "user") return false;
826
809
  if (props.assistant && role !== "assistant") return false;
@@ -828,8 +811,8 @@ var useMessageIf = (props) => {
828
811
  if (props.lastOrHover === true && !isHovering && !isLast) return false;
829
812
  if (props.copied === true && !isCopied) return false;
830
813
  if (props.copied === false && isCopied) return false;
831
- if (props.speaking === true && !isSpeaking) return false;
832
- if (props.speaking === false && isSpeaking) return false;
814
+ if (props.speaking === true && speech == null) return false;
815
+ if (props.speaking === false && speech != null) return false;
833
816
  if (props.hasAttachments === true && (role !== "user" || !attachments.length))
834
817
  return false;
835
818
  if (props.hasAttachments === false && role === "user" && !!attachments.length)
@@ -1239,13 +1222,126 @@ var AssistantModalPrimitiveAnchor = forwardRef9(
1239
1222
  );
1240
1223
  AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
1241
1224
 
1225
+ // src/primitives/attachment/index.ts
1226
+ var attachment_exports = {};
1227
+ __export(attachment_exports, {
1228
+ Name: () => AttachmentPrimitiveName,
1229
+ Remove: () => AttachmentPrimitiveRemove,
1230
+ Root: () => AttachmentPrimitiveRoot,
1231
+ unstable_Thumb: () => AttachmentPrimitiveThumb
1232
+ });
1233
+
1234
+ // src/primitives/attachment/AttachmentRoot.tsx
1235
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
1236
+ import { forwardRef as forwardRef10 } from "react";
1237
+ import { jsx as jsx14 } from "react/jsx-runtime";
1238
+ var AttachmentPrimitiveRoot = forwardRef10((props, ref) => {
1239
+ return /* @__PURE__ */ jsx14(Primitive7.div, { ...props, ref });
1240
+ });
1241
+ AttachmentPrimitiveRoot.displayName = "AttachmentPrimitive.Root";
1242
+
1243
+ // src/primitives/attachment/AttachmentThumb.tsx
1244
+ import { forwardRef as forwardRef11 } from "react";
1245
+
1246
+ // src/context/react/AttachmentContext.ts
1247
+ import { createContext as createContext5, useContext as useContext2 } from "react";
1248
+ var AttachmentContext = createContext5(
1249
+ null
1250
+ );
1251
+ function useAttachmentContext(options) {
1252
+ const context = useContext2(AttachmentContext);
1253
+ if (!options?.optional && !context)
1254
+ throw new Error(
1255
+ "This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
1256
+ );
1257
+ return context;
1258
+ }
1259
+ function useThreadComposerAttachmentContext(options) {
1260
+ const context = useAttachmentContext(options);
1261
+ if (!context) return null;
1262
+ if (context.source !== "thread-composer")
1263
+ throw new Error(
1264
+ "This component must be used within a thread's ComposerPrimitive.Attachments component."
1265
+ );
1266
+ return context;
1267
+ }
1268
+ function useEditComposerAttachmentContext(options) {
1269
+ const context = useAttachmentContext(options);
1270
+ if (!context) return null;
1271
+ if (context.source !== "edit-composer")
1272
+ throw new Error(
1273
+ "This component must be used within a messages's ComposerPrimitive.Attachments component."
1274
+ );
1275
+ return context;
1276
+ }
1277
+ function useMessageAttachmentContext(options) {
1278
+ const context = useAttachmentContext(options);
1279
+ if (!context) return null;
1280
+ if (context.source !== "message")
1281
+ throw new Error(
1282
+ "This component must be used within a MessagePrimitive.Attachments component."
1283
+ );
1284
+ return context;
1285
+ }
1286
+ function useAttachmentRuntime(options) {
1287
+ const attachmentRuntime = useAttachmentContext(options);
1288
+ if (!attachmentRuntime) return null;
1289
+ return attachmentRuntime.useAttachmentRuntime();
1290
+ }
1291
+ var { useAttachment } = createContextStoreHook(
1292
+ useAttachmentContext,
1293
+ "useAttachment"
1294
+ );
1295
+ var { useAttachment: useThreadComposerAttachment } = createContextStoreHook(useThreadComposerAttachmentContext, "useAttachment");
1296
+ var { useAttachment: useEditComposerAttachment } = createContextStoreHook(useEditComposerAttachmentContext, "useAttachment");
1297
+ var { useAttachment: useMessageAttachment } = createContextStoreHook(
1298
+ useMessageAttachmentContext,
1299
+ "useAttachment"
1300
+ );
1301
+
1302
+ // src/primitives/attachment/AttachmentThumb.tsx
1303
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
1304
+ import { jsxs } from "react/jsx-runtime";
1305
+ var AttachmentPrimitiveThumb = forwardRef11(() => {
1306
+ const ext = useAttachment((a) => a.name.split(".").pop());
1307
+ return /* @__PURE__ */ jsxs(Primitive8.div, { children: [
1308
+ ".",
1309
+ ext
1310
+ ] });
1311
+ });
1312
+ AttachmentPrimitiveThumb.displayName = "AttachmentPrimitive.Thumb";
1313
+
1314
+ // src/primitives/attachment/AttachmentName.tsx
1315
+ import { Fragment, jsx as jsx15 } from "react/jsx-runtime";
1316
+ var AttachmentPrimitiveName = () => {
1317
+ const name = useAttachment((a) => a.name);
1318
+ return /* @__PURE__ */ jsx15(Fragment, { children: name });
1319
+ };
1320
+ AttachmentPrimitiveName.displayName = "AttachmentPrimitive.Name";
1321
+
1322
+ // src/primitive-hooks/attachment/useAttachmentRemove.ts
1323
+ import { useCallback as useCallback17 } from "react";
1324
+ var useAttachmentRemove = () => {
1325
+ const attachmentRuntime = useAttachmentRuntime();
1326
+ const handleRemoveAttachment = useCallback17(() => {
1327
+ attachmentRuntime.remove();
1328
+ }, [attachmentRuntime]);
1329
+ return handleRemoveAttachment;
1330
+ };
1331
+
1332
+ // src/primitives/attachment/AttachmentRemove.tsx
1333
+ var AttachmentPrimitiveRemove = createActionButton(
1334
+ "AttachmentPrimitive.Remove",
1335
+ useAttachmentRemove
1336
+ );
1337
+
1242
1338
  // src/primitives/branchPicker/index.ts
1243
1339
  var branchPicker_exports = {};
1244
1340
  __export(branchPicker_exports, {
1245
1341
  Count: () => BranchPickerPrimitiveCount,
1246
1342
  Next: () => BranchPickerPrimitiveNext,
1247
1343
  Number: () => BranchPickerPrimitiveNumber,
1248
- Previous: () => BranchPickerPrevious,
1344
+ Previous: () => BranchPickerPrimitivePrevious,
1249
1345
  Root: () => BranchPickerPrimitiveRoot
1250
1346
  });
1251
1347
 
@@ -1256,30 +1352,30 @@ var BranchPickerPrimitiveNext = createActionButton(
1256
1352
  );
1257
1353
 
1258
1354
  // src/primitives/branchPicker/BranchPickerPrevious.tsx
1259
- var BranchPickerPrevious = createActionButton(
1355
+ var BranchPickerPrimitivePrevious = createActionButton(
1260
1356
  "BranchPickerPrimitive.Previous",
1261
1357
  useBranchPickerPrevious
1262
1358
  );
1263
1359
 
1264
1360
  // src/primitives/branchPicker/BranchPickerCount.tsx
1265
- import { Fragment, jsx as jsx14 } from "react/jsx-runtime";
1361
+ import { Fragment as Fragment2, jsx as jsx16 } from "react/jsx-runtime";
1266
1362
  var BranchPickerPrimitiveCount = () => {
1267
1363
  const branchCount = useBranchPickerCount();
1268
- return /* @__PURE__ */ jsx14(Fragment, { children: branchCount });
1364
+ return /* @__PURE__ */ jsx16(Fragment2, { children: branchCount });
1269
1365
  };
1270
1366
  BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
1271
1367
 
1272
1368
  // src/primitives/branchPicker/BranchPickerNumber.tsx
1273
- import { Fragment as Fragment2, jsx as jsx15 } from "react/jsx-runtime";
1369
+ import { Fragment as Fragment3, jsx as jsx17 } from "react/jsx-runtime";
1274
1370
  var BranchPickerPrimitiveNumber = () => {
1275
1371
  const branchNumber = useBranchPickerNumber();
1276
- return /* @__PURE__ */ jsx15(Fragment2, { children: branchNumber });
1372
+ return /* @__PURE__ */ jsx17(Fragment3, { children: branchNumber });
1277
1373
  };
1278
1374
  BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
1279
1375
 
1280
1376
  // src/primitives/branchPicker/BranchPickerRoot.tsx
1281
- import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1282
- import { forwardRef as forwardRef14 } from "react";
1377
+ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
1378
+ import { forwardRef as forwardRef16 } from "react";
1283
1379
 
1284
1380
  // src/primitives/message/index.ts
1285
1381
  var message_exports = {};
@@ -1292,17 +1388,17 @@ __export(message_exports, {
1292
1388
  });
1293
1389
 
1294
1390
  // src/primitives/message/MessageRoot.tsx
1295
- import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
1391
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1296
1392
  import {
1297
- forwardRef as forwardRef10,
1298
- useCallback as useCallback18
1393
+ forwardRef as forwardRef12,
1394
+ useCallback as useCallback19
1299
1395
  } from "react";
1300
1396
 
1301
1397
  // src/utils/hooks/useManagedRef.ts
1302
- import { useCallback as useCallback17, useRef } from "react";
1398
+ import { useCallback as useCallback18, useRef } from "react";
1303
1399
  var useManagedRef = (callback) => {
1304
1400
  const cleanupRef = useRef();
1305
- const ref = useCallback17(
1401
+ const ref = useCallback18(
1306
1402
  (el) => {
1307
1403
  if (cleanupRef.current) {
1308
1404
  cleanupRef.current();
@@ -1318,10 +1414,10 @@ var useManagedRef = (callback) => {
1318
1414
 
1319
1415
  // src/primitives/message/MessageRoot.tsx
1320
1416
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
1321
- import { jsx as jsx16 } from "react/jsx-runtime";
1417
+ import { jsx as jsx18 } from "react/jsx-runtime";
1322
1418
  var useIsHoveringRef = () => {
1323
1419
  const messageUtilsStore = useMessageUtilsStore();
1324
- const callbackRef = useCallback18(
1420
+ const callbackRef = useCallback19(
1325
1421
  (el) => {
1326
1422
  const setIsHovering = messageUtilsStore.getState().setIsHovering;
1327
1423
  const handleMouseEnter = () => {
@@ -1342,10 +1438,10 @@ var useIsHoveringRef = () => {
1342
1438
  );
1343
1439
  return useManagedRef(callbackRef);
1344
1440
  };
1345
- var MessagePrimitiveRoot = forwardRef10((props, forwardRef33) => {
1441
+ var MessagePrimitiveRoot = forwardRef12((props, forwardRef35) => {
1346
1442
  const isHoveringRef = useIsHoveringRef();
1347
- const ref = useComposedRefs(forwardRef33, isHoveringRef);
1348
- return /* @__PURE__ */ jsx16(Primitive7.div, { ...props, ref });
1443
+ const ref = useComposedRefs(forwardRef35, isHoveringRef);
1444
+ return /* @__PURE__ */ jsx18(Primitive9.div, { ...props, ref });
1349
1445
  });
1350
1446
  MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
1351
1447
 
@@ -1365,7 +1461,7 @@ import { memo as memo2, useMemo as useMemo6 } from "react";
1365
1461
  // src/context/providers/ContentPartRuntimeProvider.tsx
1366
1462
  import { useEffect as useEffect8, useState as useState5 } from "react";
1367
1463
  import { create as create6 } from "zustand";
1368
- import { jsx as jsx17 } from "react/jsx-runtime";
1464
+ import { jsx as jsx19 } from "react/jsx-runtime";
1369
1465
  var useContentPartRuntimeStore = (runtime) => {
1370
1466
  const [store] = useState5(() => create6(() => runtime));
1371
1467
  useEffect8(() => {
@@ -1391,12 +1487,12 @@ var ContentPartRuntimeProvider = ({
1391
1487
  const [context] = useState5(() => {
1392
1488
  return { useContentPartRuntime: useContentPartRuntime2, useContentPart: useContentPart2 };
1393
1489
  });
1394
- return /* @__PURE__ */ jsx17(ContentPartContext.Provider, { value: context, children });
1490
+ return /* @__PURE__ */ jsx19(ContentPartContext.Provider, { value: context, children });
1395
1491
  };
1396
1492
 
1397
1493
  // src/primitives/contentPart/ContentPartText.tsx
1398
1494
  import {
1399
- forwardRef as forwardRef12
1495
+ forwardRef as forwardRef14
1400
1496
  } from "react";
1401
1497
 
1402
1498
  // src/utils/smooth/useSmooth.tsx
@@ -1405,14 +1501,14 @@ import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-
1405
1501
 
1406
1502
  // src/utils/smooth/SmoothContext.tsx
1407
1503
  import {
1408
- createContext as createContext5,
1409
- forwardRef as forwardRef11,
1410
- useContext as useContext2,
1504
+ createContext as createContext6,
1505
+ forwardRef as forwardRef13,
1506
+ useContext as useContext3,
1411
1507
  useState as useState6
1412
1508
  } from "react";
1413
1509
  import { create as create7 } from "zustand";
1414
- import { jsx as jsx18 } from "react/jsx-runtime";
1415
- var SmoothContext = createContext5(null);
1510
+ import { jsx as jsx20 } from "react/jsx-runtime";
1511
+ var SmoothContext = createContext6(null);
1416
1512
  var makeSmoothContext = (initialState) => {
1417
1513
  const useSmoothStatus2 = create7(() => initialState);
1418
1514
  return { useSmoothStatus: useSmoothStatus2 };
@@ -1424,17 +1520,17 @@ var SmoothContextProvider = ({ children }) => {
1424
1520
  () => makeSmoothContext(contentPartStore.getState().status)
1425
1521
  );
1426
1522
  if (outer) return children;
1427
- return /* @__PURE__ */ jsx18(SmoothContext.Provider, { value: context, children });
1523
+ return /* @__PURE__ */ jsx20(SmoothContext.Provider, { value: context, children });
1428
1524
  };
1429
1525
  var withSmoothContextProvider = (Component) => {
1430
- const Wrapped = forwardRef11((props, ref) => {
1431
- return /* @__PURE__ */ jsx18(SmoothContextProvider, { children: /* @__PURE__ */ jsx18(Component, { ...props, ref }) });
1526
+ const Wrapped = forwardRef13((props, ref) => {
1527
+ return /* @__PURE__ */ jsx20(SmoothContextProvider, { children: /* @__PURE__ */ jsx20(Component, { ...props, ref }) });
1432
1528
  });
1433
1529
  Wrapped.displayName = Component.displayName;
1434
1530
  return Wrapped;
1435
1531
  };
1436
1532
  function useSmoothContext(options) {
1437
- const context = useContext2(SmoothContext);
1533
+ const context = useContext3(SmoothContext);
1438
1534
  if (!options?.optional && !context)
1439
1535
  throw new Error(
1440
1536
  "This component must be used within a SmoothContextProvider."
@@ -1554,20 +1650,20 @@ var useSmooth = (state, smooth = false) => {
1554
1650
  };
1555
1651
 
1556
1652
  // src/primitives/contentPart/ContentPartText.tsx
1557
- import { jsx as jsx19 } from "react/jsx-runtime";
1558
- var ContentPartPrimitiveText = forwardRef12(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
1653
+ import { jsx as jsx21 } from "react/jsx-runtime";
1654
+ var ContentPartPrimitiveText = forwardRef14(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
1559
1655
  const { text, status } = useSmooth(useContentPartText(), smooth);
1560
- return /* @__PURE__ */ jsx19(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
1656
+ return /* @__PURE__ */ jsx21(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
1561
1657
  });
1562
1658
  ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
1563
1659
 
1564
1660
  // src/primitives/contentPart/ContentPartImage.tsx
1565
- import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
1566
- import { forwardRef as forwardRef13 } from "react";
1567
- import { jsx as jsx20 } from "react/jsx-runtime";
1568
- var ContentPartPrimitiveImage = forwardRef13((props, forwardedRef) => {
1661
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
1662
+ import { forwardRef as forwardRef15 } from "react";
1663
+ import { jsx as jsx22 } from "react/jsx-runtime";
1664
+ var ContentPartPrimitiveImage = forwardRef15((props, forwardedRef) => {
1569
1665
  const { image } = useContentPartImage();
1570
- return /* @__PURE__ */ jsx20(Primitive8.img, { src: image, ...props, ref: forwardedRef });
1666
+ return /* @__PURE__ */ jsx22(Primitive10.img, { src: image, ...props, ref: forwardedRef });
1571
1667
  });
1572
1668
  ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
1573
1669
 
@@ -2070,6 +2166,16 @@ var MessageRuntimeImpl = class {
2070
2166
  if (!state) throw new Error("Message is not available");
2071
2167
  return this._threadBinding.getState().speak(state.id);
2072
2168
  }
2169
+ stopSpeaking() {
2170
+ const state = this._core.getState();
2171
+ if (!state) throw new Error("Message is not available");
2172
+ const thread = this._threadBinding.getState();
2173
+ if (thread.speech?.messageId === state.id) {
2174
+ this._threadBinding.getState().stopSpeaking();
2175
+ } else {
2176
+ throw new Error("Message is not being spoken");
2177
+ }
2178
+ }
2073
2179
  submitFeedback({ type }) {
2074
2180
  const state = this._core.getState();
2075
2181
  if (!state) throw new Error("Message is not available");
@@ -2136,22 +2242,22 @@ var MessageRuntimeImpl = class {
2136
2242
  };
2137
2243
 
2138
2244
  // src/primitives/message/MessageContent.tsx
2139
- import { jsx as jsx21, jsxs } from "react/jsx-runtime";
2245
+ import { jsx as jsx23, jsxs as jsxs2 } from "react/jsx-runtime";
2140
2246
  var ToolUIDisplay = ({
2141
2247
  UI,
2142
2248
  ...props
2143
2249
  }) => {
2144
2250
  const Render = useToolUIs((s) => s.getToolUI(props.toolName)) ?? UI;
2145
2251
  if (!Render) return null;
2146
- return /* @__PURE__ */ jsx21(Render, { ...props });
2252
+ return /* @__PURE__ */ jsx23(Render, { ...props });
2147
2253
  };
2148
2254
  var defaultComponents = {
2149
- Text: () => /* @__PURE__ */ jsxs("p", { style: { whiteSpace: "pre-line" }, children: [
2150
- /* @__PURE__ */ jsx21(ContentPartPrimitiveText, {}),
2151
- /* @__PURE__ */ jsx21(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx21("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
2255
+ Text: () => /* @__PURE__ */ jsxs2("p", { style: { whiteSpace: "pre-line" }, children: [
2256
+ /* @__PURE__ */ jsx23(ContentPartPrimitiveText, {}),
2257
+ /* @__PURE__ */ jsx23(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx23("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
2152
2258
  ] }),
2153
- Image: () => /* @__PURE__ */ jsx21(ContentPartPrimitiveImage, {}),
2154
- UI: () => /* @__PURE__ */ jsx21(ContentPartPrimitiveDisplay, {})
2259
+ Image: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveImage, {}),
2260
+ UI: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveDisplay, {})
2155
2261
  };
2156
2262
  var MessageContentPartComponent = ({
2157
2263
  components: {
@@ -2171,17 +2277,17 @@ var MessageContentPartComponent = ({
2171
2277
  if (part.status.type === "requires-action")
2172
2278
  throw new Error("Encountered unexpected requires-action status");
2173
2279
  if (part.part === EMPTY_CONTENT && !!Empty) {
2174
- return /* @__PURE__ */ jsx21(Empty, { status: part.status });
2280
+ return /* @__PURE__ */ jsx23(Empty, { status: part.status });
2175
2281
  }
2176
- return /* @__PURE__ */ jsx21(Text2, { ...part, part });
2282
+ return /* @__PURE__ */ jsx23(Text2, { ...part, part });
2177
2283
  case "image":
2178
2284
  if (part.status.type === "requires-action")
2179
2285
  throw new Error("Encountered unexpected requires-action status");
2180
- return /* @__PURE__ */ jsx21(Image2, { ...part, part });
2286
+ return /* @__PURE__ */ jsx23(Image2, { ...part, part });
2181
2287
  case "ui":
2182
2288
  if (part.status.type === "requires-action")
2183
2289
  throw new Error("Encountered unexpected requires-action status");
2184
- return /* @__PURE__ */ jsx21(UI, { ...part, part });
2290
+ return /* @__PURE__ */ jsx23(UI, { ...part, part });
2185
2291
  case "tool-call": {
2186
2292
  const Tool = by_name[part.toolName] || Fallback2;
2187
2293
  const addResult = (result) => threadRuntime.addToolResult({
@@ -2190,7 +2296,7 @@ var MessageContentPartComponent = ({
2190
2296
  toolCallId: part.toolCallId,
2191
2297
  result
2192
2298
  });
2193
- return /* @__PURE__ */ jsx21(ToolUIDisplay, { ...part, part, UI: Tool, addResult });
2299
+ return /* @__PURE__ */ jsx23(ToolUIDisplay, { ...part, part, UI: Tool, addResult });
2194
2300
  }
2195
2301
  default:
2196
2302
  const unhandledType = type;
@@ -2206,7 +2312,7 @@ var MessageContentPartImpl = ({
2206
2312
  () => messageRuntime.getContentPartByIndex(partIndex),
2207
2313
  [messageRuntime, partIndex]
2208
2314
  );
2209
- return /* @__PURE__ */ jsx21(ContentPartRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx21(MessageContentPartComponent, { components }) });
2315
+ return /* @__PURE__ */ jsx23(ContentPartRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx23(MessageContentPartComponent, { components }) });
2210
2316
  };
2211
2317
  var MessageContentPart = memo2(
2212
2318
  MessageContentPartImpl,
@@ -2216,7 +2322,7 @@ var MessagePrimitiveContent = ({
2216
2322
  components
2217
2323
  }) => {
2218
2324
  const contentLength = useMessage((s) => s.content.length) || 1;
2219
- return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx21(MessageContentPart, { partIndex: index, components }, index));
2325
+ return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx23(MessageContentPart, { partIndex: index, components }, index));
2220
2326
  };
2221
2327
  MessagePrimitiveContent.displayName = "MessagePrimitive.Content";
2222
2328
 
@@ -2229,62 +2335,6 @@ MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
2229
2335
  // src/primitives/message/MessageAttachments.tsx
2230
2336
  import { memo as memo3, useMemo as useMemo8 } from "react";
2231
2337
 
2232
- // src/context/react/AttachmentContext.ts
2233
- import { createContext as createContext6, useContext as useContext3 } from "react";
2234
- var AttachmentContext = createContext6(
2235
- null
2236
- );
2237
- function useAttachmentContext(options) {
2238
- const context = useContext3(AttachmentContext);
2239
- if (!options?.optional && !context)
2240
- throw new Error(
2241
- "This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
2242
- );
2243
- return context;
2244
- }
2245
- function useThreadComposerAttachmentContext(options) {
2246
- const context = useAttachmentContext(options);
2247
- if (!context) return null;
2248
- if (context.source !== "thread-composer")
2249
- throw new Error(
2250
- "This component must be used within a thread's ComposerPrimitive.Attachments component."
2251
- );
2252
- return context;
2253
- }
2254
- function useEditComposerAttachmentContext(options) {
2255
- const context = useAttachmentContext(options);
2256
- if (!context) return null;
2257
- if (context.source !== "edit-composer")
2258
- throw new Error(
2259
- "This component must be used within a messages's ComposerPrimitive.Attachments component."
2260
- );
2261
- return context;
2262
- }
2263
- function useMessageAttachmentContext(options) {
2264
- const context = useAttachmentContext(options);
2265
- if (!context) return null;
2266
- if (context.source !== "message")
2267
- throw new Error(
2268
- "This component must be used within a MessagePrimitive.Attachments component."
2269
- );
2270
- return context;
2271
- }
2272
- function useAttachmentRuntime(options) {
2273
- const attachmentRuntime = useAttachmentContext(options);
2274
- if (!attachmentRuntime) return null;
2275
- return attachmentRuntime.useAttachmentRuntime();
2276
- }
2277
- var { useAttachment } = createContextStoreHook(
2278
- useAttachmentContext,
2279
- "useAttachment"
2280
- );
2281
- var { useAttachment: useThreadComposerAttachment } = createContextStoreHook(useThreadComposerAttachmentContext, "useAttachment");
2282
- var { useAttachment: useEditComposerAttachment } = createContextStoreHook(useEditComposerAttachmentContext, "useAttachment");
2283
- var { useAttachment: useMessageAttachment } = createContextStoreHook(
2284
- useMessageAttachmentContext,
2285
- "useAttachment"
2286
- );
2287
-
2288
2338
  // src/context/providers/AttachmentRuntimeProvider.tsx
2289
2339
  import {
2290
2340
  useEffect as useEffect10,
@@ -2292,7 +2342,7 @@ import {
2292
2342
  useState as useState8
2293
2343
  } from "react";
2294
2344
  import { create as create8 } from "zustand";
2295
- import { jsx as jsx22 } from "react/jsx-runtime";
2345
+ import { jsx as jsx24 } from "react/jsx-runtime";
2296
2346
  var useAttachmentRuntimeStore = (runtime) => {
2297
2347
  const [store] = useState8(() => create8(() => runtime));
2298
2348
  useEffect10(() => {
@@ -2323,11 +2373,11 @@ var AttachmentRuntimeProvider = ({
2323
2373
  useAttachment: useAttachment2
2324
2374
  };
2325
2375
  }, [useAttachmentRuntime2, useAttachment2]);
2326
- return /* @__PURE__ */ jsx22(AttachmentContext.Provider, { value: context, children });
2376
+ return /* @__PURE__ */ jsx24(AttachmentContext.Provider, { value: context, children });
2327
2377
  };
2328
2378
 
2329
2379
  // src/primitives/message/MessageAttachments.tsx
2330
- import { jsx as jsx23 } from "react/jsx-runtime";
2380
+ import { jsx as jsx25 } from "react/jsx-runtime";
2331
2381
  var getComponent = (components, attachment) => {
2332
2382
  const type = attachment.type;
2333
2383
  switch (type) {
@@ -2347,7 +2397,7 @@ var AttachmentComponent = ({ components }) => {
2347
2397
  (a) => getComponent(components, a.attachment)
2348
2398
  );
2349
2399
  if (!Component) return null;
2350
- return /* @__PURE__ */ jsx23(Component, {});
2400
+ return /* @__PURE__ */ jsx25(Component, {});
2351
2401
  };
2352
2402
  var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
2353
2403
  const messageRuntime = useMessageRuntime();
@@ -2355,7 +2405,7 @@ var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
2355
2405
  () => messageRuntime.getAttachmentByIndex(attachmentIndex),
2356
2406
  [messageRuntime, attachmentIndex]
2357
2407
  );
2358
- return /* @__PURE__ */ jsx23(AttachmentRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx23(AttachmentComponent, { components }) });
2408
+ return /* @__PURE__ */ jsx25(AttachmentRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx25(AttachmentComponent, { components }) });
2359
2409
  };
2360
2410
  var MessageAttachment = memo3(
2361
2411
  MessageAttachmentImpl,
@@ -2366,7 +2416,7 @@ var MessagePrimitiveAttachments = ({ components }) => {
2366
2416
  if (message.role !== "user") return 0;
2367
2417
  return message.attachments.length;
2368
2418
  });
2369
- return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx23(
2419
+ return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx25(
2370
2420
  MessageAttachment,
2371
2421
  {
2372
2422
  attachmentIndex: index,
@@ -2378,9 +2428,9 @@ var MessagePrimitiveAttachments = ({ components }) => {
2378
2428
  MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
2379
2429
 
2380
2430
  // src/primitives/branchPicker/BranchPickerRoot.tsx
2381
- import { jsx as jsx24 } from "react/jsx-runtime";
2382
- var BranchPickerPrimitiveRoot = forwardRef14(({ hideWhenSingleBranch, ...rest }, ref) => {
2383
- return /* @__PURE__ */ jsx24(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx24(Primitive9.div, { ...rest, ref }) });
2431
+ import { jsx as jsx26 } from "react/jsx-runtime";
2432
+ var BranchPickerPrimitiveRoot = forwardRef16(({ hideWhenSingleBranch, ...rest }, ref) => {
2433
+ return /* @__PURE__ */ jsx26(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx26(Primitive11.div, { ...rest, ref }) });
2384
2434
  });
2385
2435
  BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
2386
2436
 
@@ -2398,20 +2448,20 @@ __export(composer_exports, {
2398
2448
 
2399
2449
  // src/primitives/composer/ComposerRoot.tsx
2400
2450
  import { composeEventHandlers as composeEventHandlers8 } from "@radix-ui/primitive";
2401
- import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
2451
+ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
2402
2452
  import {
2403
- forwardRef as forwardRef15
2453
+ forwardRef as forwardRef17
2404
2454
  } from "react";
2405
- import { jsx as jsx25 } from "react/jsx-runtime";
2406
- var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) => {
2455
+ import { jsx as jsx27 } from "react/jsx-runtime";
2456
+ var ComposerPrimitiveRoot = forwardRef17(({ onSubmit, ...rest }, forwardedRef) => {
2407
2457
  const send = useComposerSend();
2408
2458
  const handleSubmit = (e) => {
2409
2459
  e.preventDefault();
2410
2460
  if (!send) return;
2411
2461
  send();
2412
2462
  };
2413
- return /* @__PURE__ */ jsx25(
2414
- Primitive10.form,
2463
+ return /* @__PURE__ */ jsx27(
2464
+ Primitive12.form,
2415
2465
  {
2416
2466
  ...rest,
2417
2467
  ref: forwardedRef,
@@ -2426,15 +2476,15 @@ import { composeEventHandlers as composeEventHandlers9 } from "@radix-ui/primiti
2426
2476
  import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
2427
2477
  import { Slot } from "@radix-ui/react-slot";
2428
2478
  import {
2429
- forwardRef as forwardRef16,
2430
- useCallback as useCallback19,
2479
+ forwardRef as forwardRef18,
2480
+ useCallback as useCallback20,
2431
2481
  useEffect as useEffect11,
2432
2482
  useRef as useRef3
2433
2483
  } from "react";
2434
2484
  import TextareaAutosize from "react-textarea-autosize";
2435
2485
  import { useEscapeKeydown as useEscapeKeydown2 } from "@radix-ui/react-use-escape-keydown";
2436
- import { jsx as jsx26 } from "react/jsx-runtime";
2437
- var ComposerPrimitiveInput = forwardRef16(
2486
+ import { jsx as jsx28 } from "react/jsx-runtime";
2487
+ var ComposerPrimitiveInput = forwardRef18(
2438
2488
  ({
2439
2489
  autoFocus = false,
2440
2490
  asChild,
@@ -2475,7 +2525,7 @@ var ComposerPrimitiveInput = forwardRef16(
2475
2525
  }
2476
2526
  };
2477
2527
  const autoFocusEnabled = autoFocus && !isDisabled;
2478
- const focus = useCallback19(() => {
2528
+ const focus = useCallback20(() => {
2479
2529
  const textarea = textareaRef.current;
2480
2530
  if (!textarea || !autoFocusEnabled) return;
2481
2531
  textarea.focus({ preventScroll: true });
@@ -2490,7 +2540,7 @@ var ComposerPrimitiveInput = forwardRef16(
2490
2540
  focus();
2491
2541
  }
2492
2542
  });
2493
- return /* @__PURE__ */ jsx26(
2543
+ return /* @__PURE__ */ jsx28(
2494
2544
  Component,
2495
2545
  {
2496
2546
  name: "input",
@@ -2530,7 +2580,7 @@ var ComposerPrimitiveAddAttachment = createActionButton(
2530
2580
 
2531
2581
  // src/primitives/composer/ComposerAttachments.tsx
2532
2582
  import { memo as memo4, useMemo as useMemo9 } from "react";
2533
- import { jsx as jsx27 } from "react/jsx-runtime";
2583
+ import { jsx as jsx29 } from "react/jsx-runtime";
2534
2584
  var getComponent2 = (components, attachment) => {
2535
2585
  const type = attachment.type;
2536
2586
  switch (type) {
@@ -2550,7 +2600,7 @@ var AttachmentComponent2 = ({ components }) => {
2550
2600
  (a) => getComponent2(components, a)
2551
2601
  );
2552
2602
  if (!Component) return null;
2553
- return /* @__PURE__ */ jsx27(Component, {});
2603
+ return /* @__PURE__ */ jsx29(Component, {});
2554
2604
  };
2555
2605
  var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
2556
2606
  const composerRuntime = useComposerRuntime();
@@ -2558,7 +2608,7 @@ var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
2558
2608
  () => composerRuntime.getAttachmentByIndex(attachmentIndex),
2559
2609
  [composerRuntime, attachmentIndex]
2560
2610
  );
2561
- return /* @__PURE__ */ jsx27(AttachmentRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx27(AttachmentComponent2, { components }) });
2611
+ return /* @__PURE__ */ jsx29(AttachmentRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx29(AttachmentComponent2, { components }) });
2562
2612
  };
2563
2613
  var ComposerAttachment = memo4(
2564
2614
  ComposerAttachmentImpl,
@@ -2566,7 +2616,7 @@ var ComposerAttachment = memo4(
2566
2616
  );
2567
2617
  var ComposerPrimitiveAttachments = ({ components }) => {
2568
2618
  const attachmentsCount = useComposer((s) => s.attachments.length);
2569
- return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx27(
2619
+ return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx29(
2570
2620
  ComposerAttachment,
2571
2621
  {
2572
2622
  attachmentIndex: index,
@@ -2609,11 +2659,11 @@ __export(thread_exports, {
2609
2659
  });
2610
2660
 
2611
2661
  // src/primitives/thread/ThreadRoot.tsx
2612
- import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
2613
- import { forwardRef as forwardRef17 } from "react";
2614
- import { jsx as jsx28 } from "react/jsx-runtime";
2615
- var ThreadPrimitiveRoot = forwardRef17((props, ref) => {
2616
- return /* @__PURE__ */ jsx28(Primitive11.div, { ...props, ref });
2662
+ import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
2663
+ import { forwardRef as forwardRef19 } from "react";
2664
+ import { jsx as jsx30 } from "react/jsx-runtime";
2665
+ var ThreadPrimitiveRoot = forwardRef19((props, ref) => {
2666
+ return /* @__PURE__ */ jsx30(Primitive13.div, { ...props, ref });
2617
2667
  });
2618
2668
  ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
2619
2669
 
@@ -2638,8 +2688,8 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
2638
2688
 
2639
2689
  // src/primitives/thread/ThreadViewport.tsx
2640
2690
  import { useComposedRefs as useComposedRefs4 } from "@radix-ui/react-compose-refs";
2641
- import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
2642
- import { forwardRef as forwardRef18 } from "react";
2691
+ import { Primitive as Primitive14 } from "@radix-ui/react-primitive";
2692
+ import { forwardRef as forwardRef20 } from "react";
2643
2693
 
2644
2694
  // src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
2645
2695
  import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
@@ -2647,10 +2697,10 @@ import { useRef as useRef4 } from "react";
2647
2697
 
2648
2698
  // src/utils/hooks/useOnResizeContent.tsx
2649
2699
  import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
2650
- import { useCallback as useCallback20 } from "react";
2700
+ import { useCallback as useCallback21 } from "react";
2651
2701
  var useOnResizeContent = (callback) => {
2652
2702
  const callbackRef = useCallbackRef3(callback);
2653
- const refCallback = useCallback20(
2703
+ const refCallback = useCallback21(
2654
2704
  (el) => {
2655
2705
  const resizeObserver = new ResizeObserver(() => {
2656
2706
  callbackRef();
@@ -2750,13 +2800,13 @@ var useThreadViewportAutoScroll = ({
2750
2800
  };
2751
2801
 
2752
2802
  // src/primitives/thread/ThreadViewport.tsx
2753
- import { jsx as jsx29 } from "react/jsx-runtime";
2754
- var ThreadPrimitiveViewport = forwardRef18(({ autoScroll, children, ...rest }, forwardedRef) => {
2803
+ import { jsx as jsx31 } from "react/jsx-runtime";
2804
+ var ThreadPrimitiveViewport = forwardRef20(({ autoScroll, children, ...rest }, forwardedRef) => {
2755
2805
  const autoScrollRef = useThreadViewportAutoScroll({
2756
2806
  autoScroll
2757
2807
  });
2758
2808
  const ref = useComposedRefs4(forwardedRef, autoScrollRef);
2759
- return /* @__PURE__ */ jsx29(Primitive12.div, { ...rest, ref, children });
2809
+ return /* @__PURE__ */ jsx31(Primitive14.div, { ...rest, ref, children });
2760
2810
  });
2761
2811
  ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
2762
2812
 
@@ -2770,7 +2820,6 @@ import { create as create10 } from "zustand";
2770
2820
  // src/context/stores/MessageUtils.ts
2771
2821
  import { create as create9 } from "zustand";
2772
2822
  var makeMessageUtilsStore = () => create9((set) => {
2773
- let utterance = null;
2774
2823
  return {
2775
2824
  isCopied: false,
2776
2825
  setIsCopied: (value) => {
@@ -2780,17 +2829,6 @@ var makeMessageUtilsStore = () => create9((set) => {
2780
2829
  setIsHovering: (value) => {
2781
2830
  set({ isHovering: value });
2782
2831
  },
2783
- isSpeaking: false,
2784
- stopSpeaking: () => {
2785
- utterance?.cancel();
2786
- },
2787
- addUtterance: (utt) => {
2788
- utterance = utt;
2789
- set({ isSpeaking: true });
2790
- utt.onEnd(() => {
2791
- set({ isSpeaking: false });
2792
- });
2793
- },
2794
2832
  submittedFeedback: null,
2795
2833
  setSubmittedFeedback: (feedback) => {
2796
2834
  set({ submittedFeedback: feedback });
@@ -2799,7 +2837,7 @@ var makeMessageUtilsStore = () => create9((set) => {
2799
2837
  });
2800
2838
 
2801
2839
  // src/context/providers/MessageRuntimeProvider.tsx
2802
- import { jsx as jsx30 } from "react/jsx-runtime";
2840
+ import { jsx as jsx32 } from "react/jsx-runtime";
2803
2841
  var useMessageRuntimeStore = (runtime) => {
2804
2842
  const [store] = useState9(() => create10(() => runtime));
2805
2843
  useEffect13(() => {
@@ -2841,11 +2879,11 @@ var MessageRuntimeProvider = ({
2841
2879
  const [context] = useState9(() => {
2842
2880
  return { useMessageRuntime: useMessageRuntime2, useMessage: useMessage2, useMessageUtils: useMessageUtils2, useEditComposer: useEditComposer2 };
2843
2881
  });
2844
- return /* @__PURE__ */ jsx30(MessageContext.Provider, { value: context, children });
2882
+ return /* @__PURE__ */ jsx32(MessageContext.Provider, { value: context, children });
2845
2883
  };
2846
2884
 
2847
2885
  // src/primitives/thread/ThreadMessages.tsx
2848
- import { jsx as jsx31 } from "react/jsx-runtime";
2886
+ import { jsx as jsx33 } from "react/jsx-runtime";
2849
2887
  var isComponentsSame = (prev, next) => {
2850
2888
  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;
2851
2889
  };
@@ -2881,7 +2919,7 @@ var ThreadMessageComponent = ({
2881
2919
  const role = useMessage((m) => m.role);
2882
2920
  const isEditing = useEditComposer((c) => c.isEditing);
2883
2921
  const Component = getComponent3(components, role, isEditing);
2884
- return /* @__PURE__ */ jsx31(Component, {});
2922
+ return /* @__PURE__ */ jsx33(Component, {});
2885
2923
  };
2886
2924
  var ThreadMessageImpl = ({
2887
2925
  messageIndex,
@@ -2892,7 +2930,7 @@ var ThreadMessageImpl = ({
2892
2930
  () => threadRuntime.getMesssageByIndex(messageIndex),
2893
2931
  [threadRuntime, messageIndex]
2894
2932
  );
2895
- return /* @__PURE__ */ jsx31(MessageRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx31(ThreadMessageComponent, { components }) });
2933
+ return /* @__PURE__ */ jsx33(MessageRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx33(ThreadMessageComponent, { components }) });
2896
2934
  };
2897
2935
  var ThreadMessage = memo5(
2898
2936
  ThreadMessageImpl,
@@ -2903,7 +2941,7 @@ var ThreadPrimitiveMessagesImpl = ({
2903
2941
  }) => {
2904
2942
  const messagesLength = useThread((t) => t.messages.length);
2905
2943
  if (messagesLength === 0) return null;
2906
- return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */ jsx31(ThreadMessage, { messageIndex: index, components }, index));
2944
+ return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */ jsx33(ThreadMessage, { messageIndex: index, components }, index));
2907
2945
  };
2908
2946
  ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
2909
2947
  var ThreadPrimitiveMessages = memo5(
@@ -3370,17 +3408,17 @@ var MessageRepository = class {
3370
3408
  };
3371
3409
 
3372
3410
  // src/ui/base/tooltip-icon-button.tsx
3373
- import { forwardRef as forwardRef21 } from "react";
3411
+ import { forwardRef as forwardRef23 } from "react";
3374
3412
 
3375
3413
  // src/ui/base/tooltip.tsx
3376
3414
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3377
3415
 
3378
3416
  // src/ui/utils/withDefaults.tsx
3379
3417
  import {
3380
- forwardRef as forwardRef19
3418
+ forwardRef as forwardRef21
3381
3419
  } from "react";
3382
3420
  import classNames from "classnames";
3383
- import { jsx as jsx32 } from "react/jsx-runtime";
3421
+ import { jsx as jsx34 } from "react/jsx-runtime";
3384
3422
  var withDefaultProps = ({
3385
3423
  className,
3386
3424
  ...defaultProps
@@ -3393,10 +3431,10 @@ var withDefaultProps = ({
3393
3431
  };
3394
3432
  var withDefaults = (Component, defaultProps) => {
3395
3433
  const getProps = withDefaultProps(defaultProps);
3396
- const WithDefaults = forwardRef19(
3434
+ const WithDefaults = forwardRef21(
3397
3435
  (props, ref) => {
3398
3436
  const ComponentAsAny = Component;
3399
- return /* @__PURE__ */ jsx32(ComponentAsAny, { ...getProps(props), ref });
3437
+ return /* @__PURE__ */ jsx34(ComponentAsAny, { ...getProps(props), ref });
3400
3438
  }
3401
3439
  );
3402
3440
  WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
@@ -3404,9 +3442,9 @@ var withDefaults = (Component, defaultProps) => {
3404
3442
  };
3405
3443
 
3406
3444
  // src/ui/base/tooltip.tsx
3407
- import { jsx as jsx33 } from "react/jsx-runtime";
3445
+ import { jsx as jsx35 } from "react/jsx-runtime";
3408
3446
  var Tooltip = (props) => {
3409
- return /* @__PURE__ */ jsx33(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx33(TooltipPrimitive.Root, { ...props }) });
3447
+ return /* @__PURE__ */ jsx35(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx35(TooltipPrimitive.Root, { ...props }) });
3410
3448
  };
3411
3449
  Tooltip.displayName = "Tooltip";
3412
3450
  var TooltipTrigger = TooltipPrimitive.Trigger;
@@ -3418,9 +3456,9 @@ TooltipContent.displayName = "TooltipContent";
3418
3456
 
3419
3457
  // src/ui/base/button.tsx
3420
3458
  import { cva } from "class-variance-authority";
3421
- import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
3422
- import { forwardRef as forwardRef20 } from "react";
3423
- import { jsx as jsx34 } from "react/jsx-runtime";
3459
+ import { Primitive as Primitive15 } from "@radix-ui/react-primitive";
3460
+ import { forwardRef as forwardRef22 } from "react";
3461
+ import { jsx as jsx36 } from "react/jsx-runtime";
3424
3462
  var buttonVariants = cva("aui-button", {
3425
3463
  variants: {
3426
3464
  variant: {
@@ -3438,10 +3476,10 @@ var buttonVariants = cva("aui-button", {
3438
3476
  size: "default"
3439
3477
  }
3440
3478
  });
3441
- var Button = forwardRef20(
3479
+ var Button = forwardRef22(
3442
3480
  ({ className, variant, size, ...props }, ref) => {
3443
- return /* @__PURE__ */ jsx34(
3444
- Primitive13.button,
3481
+ return /* @__PURE__ */ jsx36(
3482
+ Primitive15.button,
3445
3483
  {
3446
3484
  className: buttonVariants({ variant, size, className }),
3447
3485
  ...props,
@@ -3453,14 +3491,14 @@ var Button = forwardRef20(
3453
3491
  Button.displayName = "Button";
3454
3492
 
3455
3493
  // src/ui/base/tooltip-icon-button.tsx
3456
- import { jsx as jsx35, jsxs as jsxs2 } from "react/jsx-runtime";
3457
- var TooltipIconButton = forwardRef21(({ children, tooltip, side = "bottom", ...rest }, ref) => {
3458
- return /* @__PURE__ */ jsxs2(Tooltip, { children: [
3459
- /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs2(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
3494
+ import { jsx as jsx37, jsxs as jsxs3 } from "react/jsx-runtime";
3495
+ var TooltipIconButton = forwardRef23(({ children, tooltip, side = "bottom", ...rest }, ref) => {
3496
+ return /* @__PURE__ */ jsxs3(Tooltip, { children: [
3497
+ /* @__PURE__ */ jsx37(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
3460
3498
  children,
3461
- /* @__PURE__ */ jsx35("span", { className: "aui-sr-only", children: tooltip })
3499
+ /* @__PURE__ */ jsx37("span", { className: "aui-sr-only", children: tooltip })
3462
3500
  ] }) }),
3463
- /* @__PURE__ */ jsx35(TooltipContent, { side, children: tooltip })
3501
+ /* @__PURE__ */ jsx37(TooltipContent, { side, children: tooltip })
3464
3502
  ] });
3465
3503
  });
3466
3504
  TooltipIconButton.displayName = "TooltipIconButton";
@@ -3524,7 +3562,8 @@ var getThreadState = (runtime) => {
3524
3562
  isRunning: lastMessage?.role !== "assistant" ? false : lastMessage.status.type === "running",
3525
3563
  messages: runtime.messages,
3526
3564
  suggestions: runtime.suggestions,
3527
- extras: runtime.extras
3565
+ extras: runtime.extras,
3566
+ speech: runtime.speech
3528
3567
  });
3529
3568
  };
3530
3569
  var ThreadRuntimeImpl = class {
@@ -3571,6 +3610,12 @@ var ThreadRuntimeImpl = class {
3571
3610
  get messages() {
3572
3611
  return this._threadBinding.getState().messages;
3573
3612
  }
3613
+ /**
3614
+ * @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.
3615
+ */
3616
+ get speech() {
3617
+ return this._threadBinding.getState().speech;
3618
+ }
3574
3619
  unstable_getCore() {
3575
3620
  return this._threadBinding.getState();
3576
3621
  }
@@ -3631,15 +3676,18 @@ var ThreadRuntimeImpl = class {
3631
3676
  switchToBranch(branchId) {
3632
3677
  return this._threadBinding.getState().switchToBranch(branchId);
3633
3678
  }
3634
- // /**
3635
- // * @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
3636
- // */
3679
+ /**
3680
+ * @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
3681
+ */
3637
3682
  speak(messageId) {
3638
3683
  return this._threadBinding.getState().speak(messageId);
3639
3684
  }
3640
- // /**
3641
- // * @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
3642
- // */
3685
+ stopSpeaking() {
3686
+ return this._threadBinding.getState().stopSpeaking();
3687
+ }
3688
+ /**
3689
+ * @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
3690
+ */
3643
3691
  submitFeedback(options) {
3644
3692
  return this._threadBinding.getState().submitFeedback(options);
3645
3693
  }
@@ -3666,7 +3714,7 @@ var ThreadRuntimeImpl = class {
3666
3714
  return new MessageRuntimeImpl(
3667
3715
  new ShallowMemoizeSubject({
3668
3716
  getState: () => {
3669
- const messages2 = this.getState().messages;
3717
+ const { messages: messages2, speech: speechState } = this.getState();
3670
3718
  const message = messages2[idx];
3671
3719
  if (!message) return SKIP_UPDATE;
3672
3720
  const branches = this._threadBinding.getState().getBranches(message.id);
@@ -3677,7 +3725,8 @@ var ThreadRuntimeImpl = class {
3677
3725
  parentId: messages2[idx - 1]?.id ?? null,
3678
3726
  branches,
3679
3727
  branchNumber: branches.indexOf(message.id) + 1,
3680
- branchCount: branches.length
3728
+ branchCount: branches.length,
3729
+ speech: speechState?.messageId === message.id ? speechState : null
3681
3730
  };
3682
3731
  },
3683
3732
  subscribe: (callback) => this._threadBinding.subscribe(callback)
@@ -4317,24 +4366,35 @@ var LocalThreadRuntimeCore = class {
4317
4366
  this.performRoundtrip(parentId, message);
4318
4367
  }
4319
4368
  }
4320
- // TODO lift utterance state to thread runtime
4321
- _utterance;
4369
+ // TODO speech runtime?
4370
+ _stopSpeaking;
4371
+ speech = null;
4322
4372
  speak(messageId) {
4323
4373
  const adapter = this.options.adapters?.speech;
4324
4374
  if (!adapter) throw new Error("Speech adapter not configured");
4325
4375
  const { message } = this.repository.getMessage(messageId);
4326
- if (this._utterance) {
4327
- this._utterance.cancel();
4328
- this._utterance = void 0;
4329
- }
4376
+ this._stopSpeaking?.();
4330
4377
  const utterance = adapter.speak(message);
4331
- utterance.onEnd(() => {
4332
- if (this._utterance === utterance) {
4333
- this._utterance = void 0;
4378
+ const unsub = utterance.subscribe(() => {
4379
+ if (utterance.status.type === "ended") {
4380
+ this._stopSpeaking = void 0;
4381
+ this.speech = null;
4382
+ } else {
4383
+ this.speech = { messageId, status: utterance.status };
4334
4384
  }
4385
+ this.notifySubscribers();
4335
4386
  });
4336
- this._utterance = utterance;
4337
- return this._utterance;
4387
+ this.speech = { messageId, status: utterance.status };
4388
+ this._stopSpeaking = () => {
4389
+ utterance.cancel();
4390
+ unsub();
4391
+ this.speech = null;
4392
+ this._stopSpeaking = void 0;
4393
+ };
4394
+ }
4395
+ stopSpeaking() {
4396
+ if (!this._stopSpeaking) throw new Error("No message is being spoken");
4397
+ this._stopSpeaking();
4338
4398
  }
4339
4399
  submitFeedback({ messageId, type }) {
4340
4400
  const adapter = this.options.adapters?.feedback;
@@ -4693,11 +4753,38 @@ var ExternalStoreThreadRuntimeCore = class {
4693
4753
  throw new Error("Runtime does not support tool results.");
4694
4754
  this._store.onAddToolResult(options);
4695
4755
  }
4756
+ // TODO speech runtime?
4757
+ _stopSpeaking;
4758
+ speech = null;
4696
4759
  speak(messageId) {
4697
- if (!this._store.onSpeak)
4698
- throw new Error("Runtime does not support speaking.");
4760
+ let adapter = this.store.adapters?.speech;
4761
+ if (!adapter && this.store.onSpeak) {
4762
+ adapter = { speak: this.store.onSpeak };
4763
+ }
4764
+ if (!adapter) throw new Error("Speech adapter not configured");
4699
4765
  const { message } = this.repository.getMessage(messageId);
4700
- return this._store.onSpeak(message);
4766
+ this._stopSpeaking?.();
4767
+ const utterance = adapter.speak(message);
4768
+ const unsub = utterance.subscribe(() => {
4769
+ if (utterance.status.type === "ended") {
4770
+ this._stopSpeaking = void 0;
4771
+ this.speech = null;
4772
+ } else {
4773
+ this.speech = { messageId, status: utterance.status };
4774
+ }
4775
+ this.notifySubscribers();
4776
+ });
4777
+ this.speech = { messageId, status: utterance.status };
4778
+ this._stopSpeaking = () => {
4779
+ utterance.cancel();
4780
+ unsub();
4781
+ this.speech = null;
4782
+ this._stopSpeaking = void 0;
4783
+ };
4784
+ }
4785
+ stopSpeaking() {
4786
+ if (!this._stopSpeaking) throw new Error("No message is being spoken");
4787
+ this._stopSpeaking();
4701
4788
  }
4702
4789
  submitFeedback({ messageId, type }) {
4703
4790
  const adapter = this._store.adapters?.feedback;
@@ -4964,11 +5051,11 @@ var WebSpeechSynthesisAdapter = class {
4964
5051
  speak(message) {
4965
5052
  const text = getThreadMessageText(message);
4966
5053
  const utterance = new SpeechSynthesisUtterance(text);
4967
- const endHandlers = /* @__PURE__ */ new Set();
5054
+ const subscribers = /* @__PURE__ */ new Set();
4968
5055
  const handleEnd = (reason, error) => {
4969
5056
  if (res.status.type === "ended") return;
4970
5057
  res.status = { type: "ended", reason, error };
4971
- endHandlers.forEach((handler) => handler());
5058
+ subscribers.forEach((handler) => handler());
4972
5059
  };
4973
5060
  utterance.addEventListener("end", () => handleEnd("finished"));
4974
5061
  utterance.addEventListener("error", (e) => handleEnd("error", e.error));
@@ -4979,7 +5066,7 @@ var WebSpeechSynthesisAdapter = class {
4979
5066
  window.speechSynthesis.cancel();
4980
5067
  handleEnd("cancelled");
4981
5068
  },
4982
- onEnd: (callback) => {
5069
+ subscribe: (callback) => {
4983
5070
  if (res.status.type === "ended") {
4984
5071
  let cancelled = false;
4985
5072
  queueMicrotask(() => {
@@ -4989,9 +5076,9 @@ var WebSpeechSynthesisAdapter = class {
4989
5076
  cancelled = true;
4990
5077
  };
4991
5078
  } else {
4992
- endHandlers.add(callback);
5079
+ subscribers.add(callback);
4993
5080
  return () => {
4994
- endHandlers.delete(callback);
5081
+ subscribers.delete(callback);
4995
5082
  };
4996
5083
  }
4997
5084
  }
@@ -5154,7 +5241,7 @@ import {
5154
5241
  createContext as createContext7,
5155
5242
  useContext as useContext4
5156
5243
  } from "react";
5157
- import { Fragment as Fragment3, jsx as jsx36 } from "react/jsx-runtime";
5244
+ import { Fragment as Fragment4, jsx as jsx38 } from "react/jsx-runtime";
5158
5245
  var ThreadConfigContext = createContext7({});
5159
5246
  var useThreadConfig = () => {
5160
5247
  return useContext4(ThreadConfigContext);
@@ -5164,19 +5251,19 @@ var ThreadConfigProvider = ({
5164
5251
  config
5165
5252
  }) => {
5166
5253
  const hasAssistant = !!useAssistantRuntime({ optional: true });
5167
- const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx36(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx36(Fragment3, { children });
5254
+ const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx38(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx38(Fragment4, { children });
5168
5255
  if (!config?.runtime) return configProvider;
5169
5256
  if (hasAssistant) {
5170
5257
  throw new Error(
5171
5258
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
5172
5259
  );
5173
5260
  }
5174
- return /* @__PURE__ */ jsx36(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
5261
+ return /* @__PURE__ */ jsx38(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
5175
5262
  };
5176
5263
  ThreadConfigProvider.displayName = "ThreadConfigProvider";
5177
5264
 
5178
5265
  // src/ui/assistant-action-bar.tsx
5179
- import { forwardRef as forwardRef22 } from "react";
5266
+ import { forwardRef as forwardRef24 } from "react";
5180
5267
  import {
5181
5268
  AudioLinesIcon,
5182
5269
  CheckIcon,
@@ -5186,7 +5273,7 @@ import {
5186
5273
  ThumbsDownIcon,
5187
5274
  ThumbsUpIcon
5188
5275
  } from "lucide-react";
5189
- import { Fragment as Fragment4, jsx as jsx37, jsxs as jsxs3 } from "react/jsx-runtime";
5276
+ import { Fragment as Fragment5, jsx as jsx39, jsxs as jsxs4 } from "react/jsx-runtime";
5190
5277
  var useAllowCopy = (ensureCapability = false) => {
5191
5278
  const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
5192
5279
  const copySupported = useThread((t) => t.capabilities.unstable_copy);
@@ -5220,18 +5307,18 @@ var AssistantActionBar = () => {
5220
5307
  const allowFeedbackNegative = useAllowFeedbackNegative(true);
5221
5308
  if (!allowCopy && !allowReload && !allowSpeak && !allowFeedbackPositive && !allowFeedbackNegative)
5222
5309
  return null;
5223
- return /* @__PURE__ */ jsxs3(
5310
+ return /* @__PURE__ */ jsxs4(
5224
5311
  AssistantActionBarRoot,
5225
5312
  {
5226
5313
  hideWhenRunning: true,
5227
5314
  autohide: "not-last",
5228
5315
  autohideFloat: "single-branch",
5229
5316
  children: [
5230
- allowSpeak && /* @__PURE__ */ jsx37(AssistantActionBarSpeechControl, {}),
5231
- allowCopy && /* @__PURE__ */ jsx37(AssistantActionBarCopy, {}),
5232
- allowReload && /* @__PURE__ */ jsx37(AssistantActionBarReload, {}),
5233
- allowFeedbackPositive && /* @__PURE__ */ jsx37(AssistantActionBarFeedbackPositive, {}),
5234
- allowFeedbackNegative && /* @__PURE__ */ jsx37(AssistantActionBarFeedbackNegative, {})
5317
+ allowSpeak && /* @__PURE__ */ jsx39(AssistantActionBarSpeechControl, {}),
5318
+ allowCopy && /* @__PURE__ */ jsx39(AssistantActionBarCopy, {}),
5319
+ allowReload && /* @__PURE__ */ jsx39(AssistantActionBarReload, {}),
5320
+ allowFeedbackPositive && /* @__PURE__ */ jsx39(AssistantActionBarFeedbackPositive, {}),
5321
+ allowFeedbackNegative && /* @__PURE__ */ jsx39(AssistantActionBarFeedbackNegative, {})
5235
5322
  ]
5236
5323
  }
5237
5324
  );
@@ -5241,35 +5328,35 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
5241
5328
  className: "aui-assistant-action-bar-root"
5242
5329
  });
5243
5330
  AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
5244
- var AssistantActionBarCopy = forwardRef22((props, ref) => {
5331
+ var AssistantActionBarCopy = forwardRef24(({ copiedDuration, ...props }, ref) => {
5245
5332
  const {
5246
5333
  strings: {
5247
5334
  assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
5248
5335
  } = {}
5249
5336
  } = useThreadConfig();
5250
- return /* @__PURE__ */ jsx37(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs3(Fragment4, { children: [
5251
- /* @__PURE__ */ jsx37(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx37(CheckIcon, {}) }),
5252
- /* @__PURE__ */ jsx37(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx37(CopyIcon, {}) })
5337
+ return /* @__PURE__ */ jsx39(actionBar_exports.Copy, { copiedDuration, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs4(Fragment5, { children: [
5338
+ /* @__PURE__ */ jsx39(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx39(CheckIcon, {}) }),
5339
+ /* @__PURE__ */ jsx39(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx39(CopyIcon, {}) })
5253
5340
  ] }) }) });
5254
5341
  });
5255
5342
  AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
5256
5343
  var AssistantActionBarSpeechControl = () => {
5257
- return /* @__PURE__ */ jsxs3(Fragment4, { children: [
5258
- /* @__PURE__ */ jsx37(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx37(AssistantActionBarSpeak, {}) }),
5259
- /* @__PURE__ */ jsx37(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx37(AssistantActionBarStopSpeaking, {}) })
5344
+ return /* @__PURE__ */ jsxs4(Fragment5, { children: [
5345
+ /* @__PURE__ */ jsx39(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx39(AssistantActionBarSpeak, {}) }),
5346
+ /* @__PURE__ */ jsx39(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx39(AssistantActionBarStopSpeaking, {}) })
5260
5347
  ] });
5261
5348
  };
5262
- var AssistantActionBarSpeak = forwardRef22((props, ref) => {
5349
+ var AssistantActionBarSpeak = forwardRef24((props, ref) => {
5263
5350
  const {
5264
5351
  strings: {
5265
5352
  assistantMessage: { speak: { tooltip = "Read aloud" } = {} } = {}
5266
5353
  } = {}
5267
5354
  } = useThreadConfig();
5268
5355
  const allowSpeak = useAllowSpeak();
5269
- return /* @__PURE__ */ jsx37(actionBar_exports.Speak, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(AudioLinesIcon, {}) }) });
5356
+ return /* @__PURE__ */ jsx39(actionBar_exports.Speak, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(AudioLinesIcon, {}) }) });
5270
5357
  });
5271
5358
  AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
5272
- var AssistantActionBarStopSpeaking = forwardRef22((props, ref) => {
5359
+ var AssistantActionBarStopSpeaking = forwardRef24((props, ref) => {
5273
5360
  const {
5274
5361
  strings: {
5275
5362
  assistantMessage: {
@@ -5278,20 +5365,20 @@ var AssistantActionBarStopSpeaking = forwardRef22((props, ref) => {
5278
5365
  } = {}
5279
5366
  } = useThreadConfig();
5280
5367
  const allowSpeak = useAllowSpeak();
5281
- return /* @__PURE__ */ jsx37(actionBar_exports.StopSpeaking, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(StopCircleIcon, {}) }) });
5368
+ return /* @__PURE__ */ jsx39(actionBar_exports.StopSpeaking, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(StopCircleIcon, {}) }) });
5282
5369
  });
5283
5370
  AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
5284
- var AssistantActionBarReload = forwardRef22((props, ref) => {
5371
+ var AssistantActionBarReload = forwardRef24((props, ref) => {
5285
5372
  const {
5286
5373
  strings: {
5287
5374
  assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
5288
5375
  } = {}
5289
5376
  } = useThreadConfig();
5290
5377
  const allowReload = useAllowReload();
5291
- return /* @__PURE__ */ jsx37(actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(RefreshCwIcon, {}) }) });
5378
+ return /* @__PURE__ */ jsx39(actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(RefreshCwIcon, {}) }) });
5292
5379
  });
5293
5380
  AssistantActionBarReload.displayName = "AssistantActionBarReload";
5294
- var AssistantActionBarFeedbackPositive = forwardRef22((props, ref) => {
5381
+ var AssistantActionBarFeedbackPositive = forwardRef24((props, ref) => {
5295
5382
  const {
5296
5383
  strings: {
5297
5384
  assistantMessage: {
@@ -5300,18 +5387,18 @@ var AssistantActionBarFeedbackPositive = forwardRef22((props, ref) => {
5300
5387
  } = {}
5301
5388
  } = useThreadConfig();
5302
5389
  const allowFeedbackPositive = useAllowFeedbackPositive();
5303
- return /* @__PURE__ */ jsx37(
5390
+ return /* @__PURE__ */ jsx39(
5304
5391
  actionBar_exports.FeedbackPositive,
5305
5392
  {
5306
5393
  disabled: !allowFeedbackPositive,
5307
5394
  className: "aui-assistant-action-bar-feedback-positive",
5308
5395
  asChild: true,
5309
- children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(ThumbsUpIcon, {}) })
5396
+ children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(ThumbsUpIcon, {}) })
5310
5397
  }
5311
5398
  );
5312
5399
  });
5313
5400
  AssistantActionBarFeedbackPositive.displayName = "AssistantActionBarFeedbackPositive";
5314
- var AssistantActionBarFeedbackNegative = forwardRef22((props, ref) => {
5401
+ var AssistantActionBarFeedbackNegative = forwardRef24((props, ref) => {
5315
5402
  const {
5316
5403
  strings: {
5317
5404
  assistantMessage: {
@@ -5320,13 +5407,13 @@ var AssistantActionBarFeedbackNegative = forwardRef22((props, ref) => {
5320
5407
  } = {}
5321
5408
  } = useThreadConfig();
5322
5409
  const allowFeedbackNegative = useAllowFeedbackNegative();
5323
- return /* @__PURE__ */ jsx37(
5410
+ return /* @__PURE__ */ jsx39(
5324
5411
  actionBar_exports.FeedbackNegative,
5325
5412
  {
5326
5413
  disabled: !allowFeedbackNegative,
5327
5414
  className: "aui-assistant-action-bar-feedback-negative",
5328
5415
  asChild: true,
5329
- children: /* @__PURE__ */ jsx37(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(ThumbsDownIcon, {}) })
5416
+ children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(ThumbsDownIcon, {}) })
5330
5417
  }
5331
5418
  );
5332
5419
  });
@@ -5347,12 +5434,12 @@ var assistant_action_bar_default = Object.assign(
5347
5434
  );
5348
5435
 
5349
5436
  // src/ui/assistant-message.tsx
5350
- import { forwardRef as forwardRef24, useMemo as useMemo14 } from "react";
5437
+ import { forwardRef as forwardRef26, useMemo as useMemo14 } from "react";
5351
5438
 
5352
5439
  // src/ui/branch-picker.tsx
5353
- import { forwardRef as forwardRef23 } from "react";
5440
+ import { forwardRef as forwardRef25 } from "react";
5354
5441
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
5355
- import { jsx as jsx38, jsxs as jsxs4 } from "react/jsx-runtime";
5442
+ import { jsx as jsx40, jsxs as jsxs5 } from "react/jsx-runtime";
5356
5443
  var useAllowBranchPicker = (ensureCapability = false) => {
5357
5444
  const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
5358
5445
  const branchPickerSupported = useThread((t) => t.capabilities.edit);
@@ -5361,10 +5448,10 @@ var useAllowBranchPicker = (ensureCapability = false) => {
5361
5448
  var BranchPicker = () => {
5362
5449
  const allowBranchPicker = useAllowBranchPicker(true);
5363
5450
  if (!allowBranchPicker) return null;
5364
- return /* @__PURE__ */ jsxs4(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
5365
- /* @__PURE__ */ jsx38(BranchPickerPrevious2, {}),
5366
- /* @__PURE__ */ jsx38(BranchPickerState, {}),
5367
- /* @__PURE__ */ jsx38(BranchPickerNext, {})
5451
+ return /* @__PURE__ */ jsxs5(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
5452
+ /* @__PURE__ */ jsx40(BranchPickerPrevious, {}),
5453
+ /* @__PURE__ */ jsx40(BranchPickerState, {}),
5454
+ /* @__PURE__ */ jsx40(BranchPickerNext, {})
5368
5455
  ] });
5369
5456
  };
5370
5457
  BranchPicker.displayName = "BranchPicker";
@@ -5372,50 +5459,50 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
5372
5459
  className: "aui-branch-picker-root"
5373
5460
  });
5374
5461
  BranchPickerRoot.displayName = "BranchPickerRoot";
5375
- var BranchPickerPrevious2 = forwardRef23((props, ref) => {
5462
+ var BranchPickerPrevious = forwardRef25((props, ref) => {
5376
5463
  const {
5377
5464
  strings: {
5378
5465
  branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
5379
5466
  } = {}
5380
5467
  } = useThreadConfig();
5381
5468
  const allowBranchPicker = useAllowBranchPicker();
5382
- return /* @__PURE__ */ jsx38(branchPicker_exports.Previous, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx38(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx38(ChevronLeftIcon, {}) }) });
5469
+ return /* @__PURE__ */ jsx40(branchPicker_exports.Previous, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx40(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx40(ChevronLeftIcon, {}) }) });
5383
5470
  });
5384
- BranchPickerPrevious2.displayName = "BranchPickerPrevious";
5471
+ BranchPickerPrevious.displayName = "BranchPickerPrevious";
5385
5472
  var BranchPickerStateWrapper = withDefaults("span", {
5386
5473
  className: "aui-branch-picker-state"
5387
5474
  });
5388
- var BranchPickerState = forwardRef23((props, ref) => {
5389
- return /* @__PURE__ */ jsxs4(BranchPickerStateWrapper, { ...props, ref, children: [
5390
- /* @__PURE__ */ jsx38(branchPicker_exports.Number, {}),
5475
+ var BranchPickerState = forwardRef25((props, ref) => {
5476
+ return /* @__PURE__ */ jsxs5(BranchPickerStateWrapper, { ...props, ref, children: [
5477
+ /* @__PURE__ */ jsx40(branchPicker_exports.Number, {}),
5391
5478
  " / ",
5392
- /* @__PURE__ */ jsx38(branchPicker_exports.Count, {})
5479
+ /* @__PURE__ */ jsx40(branchPicker_exports.Count, {})
5393
5480
  ] });
5394
5481
  });
5395
5482
  BranchPickerState.displayName = "BranchPickerState";
5396
- var BranchPickerNext = forwardRef23((props, ref) => {
5483
+ var BranchPickerNext = forwardRef25((props, ref) => {
5397
5484
  const {
5398
5485
  strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
5399
5486
  } = useThreadConfig();
5400
5487
  const allowBranchPicker = useAllowBranchPicker();
5401
- return /* @__PURE__ */ jsx38(branchPicker_exports.Next, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx38(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx38(ChevronRightIcon, {}) }) });
5488
+ return /* @__PURE__ */ jsx40(branchPicker_exports.Next, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx40(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx40(ChevronRightIcon, {}) }) });
5402
5489
  });
5403
5490
  BranchPickerNext.displayName = "BranchPickerNext";
5404
5491
  var exports2 = {
5405
5492
  Root: BranchPickerRoot,
5406
- Previous: BranchPickerPrevious2,
5493
+ Previous: BranchPickerPrevious,
5407
5494
  Next: BranchPickerNext
5408
5495
  };
5409
5496
  var branch_picker_default = Object.assign(BranchPicker, exports2);
5410
5497
 
5411
5498
  // src/ui/base/avatar.tsx
5412
5499
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
5413
- import { jsx as jsx39, jsxs as jsxs5 } from "react/jsx-runtime";
5500
+ import { jsx as jsx41, jsxs as jsxs6 } from "react/jsx-runtime";
5414
5501
  var Avatar = ({ src, alt, fallback }) => {
5415
5502
  if (src == null && fallback == null) return null;
5416
- return /* @__PURE__ */ jsxs5(AvatarRoot, { children: [
5417
- src != null && /* @__PURE__ */ jsx39(AvatarImage, { src, alt }),
5418
- fallback != null && /* @__PURE__ */ jsx39(AvatarFallback, { children: fallback })
5503
+ return /* @__PURE__ */ jsxs6(AvatarRoot, { children: [
5504
+ src != null && /* @__PURE__ */ jsx41(AvatarImage, { src, alt }),
5505
+ fallback != null && /* @__PURE__ */ jsx41(AvatarFallback, { children: fallback })
5419
5506
  ] });
5420
5507
  };
5421
5508
  Avatar.displayName = "Avatar";
@@ -5434,10 +5521,10 @@ AvatarFallback.displayName = "AvatarFallback";
5434
5521
 
5435
5522
  // src/ui/content-part.tsx
5436
5523
  import classNames2 from "classnames";
5437
- import { jsx as jsx40 } from "react/jsx-runtime";
5524
+ import { jsx as jsx42 } from "react/jsx-runtime";
5438
5525
  var Text = () => {
5439
5526
  const status = useSmoothStatus();
5440
- return /* @__PURE__ */ jsx40(
5527
+ return /* @__PURE__ */ jsx42(
5441
5528
  contentPart_exports.Text,
5442
5529
  {
5443
5530
  className: classNames2(
@@ -5452,19 +5539,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) };
5452
5539
  var content_part_default = exports3;
5453
5540
 
5454
5541
  // src/ui/assistant-message.tsx
5455
- import { jsx as jsx41, jsxs as jsxs6 } from "react/jsx-runtime";
5542
+ import { jsx as jsx43, jsxs as jsxs7 } from "react/jsx-runtime";
5456
5543
  var AssistantMessage = () => {
5457
- return /* @__PURE__ */ jsxs6(AssistantMessageRoot, { children: [
5458
- /* @__PURE__ */ jsx41(AssistantMessageAvatar, {}),
5459
- /* @__PURE__ */ jsx41(AssistantMessageContent, {}),
5460
- /* @__PURE__ */ jsx41(branch_picker_default, {}),
5461
- /* @__PURE__ */ jsx41(assistant_action_bar_default, {})
5544
+ return /* @__PURE__ */ jsxs7(AssistantMessageRoot, { children: [
5545
+ /* @__PURE__ */ jsx43(AssistantMessageAvatar, {}),
5546
+ /* @__PURE__ */ jsx43(AssistantMessageContent, {}),
5547
+ /* @__PURE__ */ jsx43(branch_picker_default, {}),
5548
+ /* @__PURE__ */ jsx43(assistant_action_bar_default, {})
5462
5549
  ] });
5463
5550
  };
5464
5551
  AssistantMessage.displayName = "AssistantMessage";
5465
5552
  var AssistantMessageAvatar = () => {
5466
5553
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
5467
- return /* @__PURE__ */ jsx41(Avatar, { ...avatar });
5554
+ return /* @__PURE__ */ jsx43(Avatar, { ...avatar });
5468
5555
  };
5469
5556
  var AssistantMessageRoot = withDefaults(message_exports.Root, {
5470
5557
  className: "aui-assistant-message-root"
@@ -5473,7 +5560,7 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
5473
5560
  var AssistantMessageContentWrapper = withDefaults("div", {
5474
5561
  className: "aui-assistant-message-content"
5475
5562
  });
5476
- var AssistantMessageContent = forwardRef24(({ components: componentsProp, ...rest }, ref) => {
5563
+ var AssistantMessageContent = forwardRef26(({ components: componentsProp, ...rest }, ref) => {
5477
5564
  const { tools, assistantMessage: { components = {} } = {} } = useThreadConfig();
5478
5565
  const toolsComponents = useMemo14(
5479
5566
  () => ({
@@ -5488,7 +5575,7 @@ var AssistantMessageContent = forwardRef24(({ components: componentsProp, ...res
5488
5575
  // eslint-disable-next-line react-hooks/exhaustive-deps
5489
5576
  [...tools ?? [], components.ToolFallback]
5490
5577
  );
5491
- return /* @__PURE__ */ jsx41(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx41(
5578
+ return /* @__PURE__ */ jsx43(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx43(
5492
5579
  message_exports.Content,
5493
5580
  {
5494
5581
  components: {
@@ -5511,21 +5598,21 @@ var assistant_message_default = Object.assign(
5511
5598
  );
5512
5599
 
5513
5600
  // src/ui/assistant-modal.tsx
5514
- import { forwardRef as forwardRef32 } from "react";
5601
+ import { forwardRef as forwardRef34 } from "react";
5515
5602
  import { BotIcon, ChevronDownIcon } from "lucide-react";
5516
5603
 
5517
5604
  // src/ui/thread.tsx
5518
- import { forwardRef as forwardRef31 } from "react";
5605
+ import { forwardRef as forwardRef33 } from "react";
5519
5606
  import { ArrowDownIcon } from "lucide-react";
5520
5607
 
5521
5608
  // src/ui/composer.tsx
5522
- import { forwardRef as forwardRef26 } from "react";
5609
+ import { forwardRef as forwardRef28 } from "react";
5523
5610
  import { PaperclipIcon, SendHorizontalIcon } from "lucide-react";
5524
5611
 
5525
5612
  // src/ui/base/CircleStopIcon.tsx
5526
- import { jsx as jsx42 } from "react/jsx-runtime";
5613
+ import { jsx as jsx44 } from "react/jsx-runtime";
5527
5614
  var CircleStopIcon = () => {
5528
- return /* @__PURE__ */ jsx42(
5615
+ return /* @__PURE__ */ jsx44(
5529
5616
  "svg",
5530
5617
  {
5531
5618
  xmlns: "http://www.w3.org/2000/svg",
@@ -5533,51 +5620,44 @@ var CircleStopIcon = () => {
5533
5620
  fill: "currentColor",
5534
5621
  width: "16",
5535
5622
  height: "16",
5536
- children: /* @__PURE__ */ jsx42("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
5623
+ children: /* @__PURE__ */ jsx44("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
5537
5624
  }
5538
5625
  );
5539
5626
  };
5540
5627
  CircleStopIcon.displayName = "CircleStopIcon";
5541
5628
 
5542
5629
  // src/ui/composer-attachment.tsx
5543
- import { forwardRef as forwardRef25 } from "react";
5630
+ import { forwardRef as forwardRef27 } from "react";
5544
5631
  import { CircleXIcon } from "lucide-react";
5545
- import { jsx as jsx43, jsxs as jsxs7 } from "react/jsx-runtime";
5546
- var ComposerAttachmentRoot = withDefaults("div", {
5632
+ import { jsx as jsx45, jsxs as jsxs8 } from "react/jsx-runtime";
5633
+ var ComposerAttachmentRoot = withDefaults(attachment_exports.Root, {
5547
5634
  className: "aui-composer-attachment-root"
5548
5635
  });
5549
5636
  ComposerAttachmentRoot.displayName = "ComposerAttachmentRoot";
5550
5637
  var ComposerAttachment2 = () => {
5551
- const attachment = useThreadComposerAttachment((a) => a.attachment);
5552
- return /* @__PURE__ */ jsxs7(ComposerAttachmentRoot, { children: [
5553
- ".",
5554
- attachment.name.split(".").pop(),
5555
- /* @__PURE__ */ jsx43(ComposerAttachmentRemove, {})
5638
+ return /* @__PURE__ */ jsxs8(ComposerAttachmentRoot, { children: [
5639
+ /* @__PURE__ */ jsx45(attachment_exports.unstable_Thumb, {}),
5640
+ /* @__PURE__ */ jsx45(ComposerAttachmentRemove, {})
5556
5641
  ] });
5557
5642
  };
5558
5643
  ComposerAttachment2.displayName = "ComposerAttachment";
5559
- var ComposerAttachmentRemove = forwardRef25((props, ref) => {
5644
+ var ComposerAttachmentRemove = forwardRef27((props, ref) => {
5560
5645
  const {
5561
5646
  strings: {
5562
5647
  composer: { removeAttachment: { tooltip = "Remove file" } = {} } = {}
5563
5648
  } = {}
5564
5649
  } = useThreadConfig();
5565
- const attachmentRuntime = useAttachmentRuntime();
5566
- const handleRemoveAttachment = () => {
5567
- attachmentRuntime.remove();
5568
- };
5569
- return /* @__PURE__ */ jsx43(
5650
+ return /* @__PURE__ */ jsx45(attachment_exports.Remove, { asChild: true, children: /* @__PURE__ */ jsx45(
5570
5651
  TooltipIconButton,
5571
5652
  {
5572
5653
  tooltip,
5573
5654
  className: "aui-composer-attachment-remove",
5574
5655
  side: "top",
5575
5656
  ...props,
5576
- onClick: handleRemoveAttachment,
5577
5657
  ref,
5578
- children: props.children ?? /* @__PURE__ */ jsx43(CircleXIcon, {})
5658
+ children: props.children ?? /* @__PURE__ */ jsx45(CircleXIcon, {})
5579
5659
  }
5580
- );
5660
+ ) });
5581
5661
  });
5582
5662
  ComposerAttachmentRemove.displayName = "ComposerAttachmentRemove";
5583
5663
  var exports5 = {
@@ -5590,7 +5670,7 @@ var composer_attachment_default = Object.assign(
5590
5670
  );
5591
5671
 
5592
5672
  // src/ui/composer.tsx
5593
- import { Fragment as Fragment5, jsx as jsx44, jsxs as jsxs8 } from "react/jsx-runtime";
5673
+ import { Fragment as Fragment6, jsx as jsx46, jsxs as jsxs9 } from "react/jsx-runtime";
5594
5674
  var useAllowAttachments = (ensureCapability = false) => {
5595
5675
  const { composer: { allowAttachments = true } = {} } = useThreadConfig();
5596
5676
  const attachmentsSupported = useThread((t) => t.capabilities.attachments);
@@ -5598,11 +5678,11 @@ var useAllowAttachments = (ensureCapability = false) => {
5598
5678
  };
5599
5679
  var Composer = () => {
5600
5680
  const allowAttachments = useAllowAttachments(true);
5601
- return /* @__PURE__ */ jsxs8(ComposerRoot, { children: [
5602
- allowAttachments && /* @__PURE__ */ jsx44(ComposerAttachments, {}),
5603
- allowAttachments && /* @__PURE__ */ jsx44(ComposerAddAttachment, {}),
5604
- /* @__PURE__ */ jsx44(ComposerInput, { autoFocus: true }),
5605
- /* @__PURE__ */ jsx44(ComposerAction, {})
5681
+ return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
5682
+ allowAttachments && /* @__PURE__ */ jsx46(ComposerAttachments, {}),
5683
+ allowAttachments && /* @__PURE__ */ jsx46(ComposerAddAttachment, {}),
5684
+ /* @__PURE__ */ jsx46(ComposerInput, { autoFocus: true }),
5685
+ /* @__PURE__ */ jsx46(ComposerAction, {})
5606
5686
  ] });
5607
5687
  };
5608
5688
  Composer.displayName = "Composer";
@@ -5615,14 +5695,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
5615
5695
  autoFocus: true,
5616
5696
  className: "aui-composer-input"
5617
5697
  });
5618
- var ComposerInput = forwardRef26(
5698
+ var ComposerInput = forwardRef28(
5619
5699
  (props, ref) => {
5620
5700
  const {
5621
5701
  strings: {
5622
5702
  composer: { input: { placeholder = "Write a message..." } = {} } = {}
5623
5703
  } = {}
5624
5704
  } = useThreadConfig();
5625
- return /* @__PURE__ */ jsx44(ComposerInputStyled, { placeholder, ...props, ref });
5705
+ return /* @__PURE__ */ jsx46(ComposerInputStyled, { placeholder, ...props, ref });
5626
5706
  }
5627
5707
  );
5628
5708
  ComposerInput.displayName = "ComposerInput";
@@ -5630,7 +5710,7 @@ var ComposerAttachmentsContainer = withDefaults("div", {
5630
5710
  className: "aui-composer-attachments"
5631
5711
  });
5632
5712
  var ComposerAttachments = ({ components }) => {
5633
- return /* @__PURE__ */ jsx44(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx44(
5713
+ return /* @__PURE__ */ jsx46(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx46(
5634
5714
  composer_exports.Attachments,
5635
5715
  {
5636
5716
  components: {
@@ -5644,21 +5724,21 @@ var ComposerAttachButton = withDefaults(TooltipIconButton, {
5644
5724
  variant: "default",
5645
5725
  className: "aui-composer-attach"
5646
5726
  });
5647
- var ComposerAddAttachment = forwardRef26((props, ref) => {
5727
+ var ComposerAddAttachment = forwardRef28((props, ref) => {
5648
5728
  const {
5649
5729
  strings: {
5650
5730
  composer: { addAttachment: { tooltip = "Attach file" } = {} } = {}
5651
5731
  } = {}
5652
5732
  } = useThreadConfig();
5653
5733
  const allowAttachments = useAllowAttachments();
5654
- return /* @__PURE__ */ jsx44(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx44(
5734
+ return /* @__PURE__ */ jsx46(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx46(
5655
5735
  ComposerAttachButton,
5656
5736
  {
5657
5737
  tooltip,
5658
5738
  variant: "ghost",
5659
5739
  ...props,
5660
5740
  ref,
5661
- children: props.children ?? /* @__PURE__ */ jsx44(PaperclipIcon, {})
5741
+ children: props.children ?? /* @__PURE__ */ jsx46(PaperclipIcon, {})
5662
5742
  }
5663
5743
  ) });
5664
5744
  });
@@ -5669,10 +5749,10 @@ var useAllowCancel = () => {
5669
5749
  };
5670
5750
  var ComposerAction = () => {
5671
5751
  const allowCancel = useAllowCancel();
5672
- if (!allowCancel) return /* @__PURE__ */ jsx44(ComposerSend, {});
5673
- return /* @__PURE__ */ jsxs8(Fragment5, { children: [
5674
- /* @__PURE__ */ jsx44(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx44(ComposerSend, {}) }),
5675
- /* @__PURE__ */ jsx44(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx44(ComposerCancel, {}) })
5752
+ if (!allowCancel) return /* @__PURE__ */ jsx46(ComposerSend, {});
5753
+ return /* @__PURE__ */ jsxs9(Fragment6, { children: [
5754
+ /* @__PURE__ */ jsx46(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx46(ComposerSend, {}) }),
5755
+ /* @__PURE__ */ jsx46(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx46(ComposerCancel, {}) })
5676
5756
  ] });
5677
5757
  };
5678
5758
  ComposerAction.displayName = "ComposerAction";
@@ -5680,23 +5760,27 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
5680
5760
  variant: "default",
5681
5761
  className: "aui-composer-send"
5682
5762
  });
5683
- var ComposerSend = forwardRef26((props, ref) => {
5684
- const {
5685
- strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
5686
- } = useThreadConfig();
5687
- return /* @__PURE__ */ jsx44(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx44(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx44(SendHorizontalIcon, {}) }) });
5688
- });
5763
+ var ComposerSend = forwardRef28(
5764
+ (props, ref) => {
5765
+ const {
5766
+ strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
5767
+ } = useThreadConfig();
5768
+ return /* @__PURE__ */ jsx46(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx46(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx46(SendHorizontalIcon, {}) }) });
5769
+ }
5770
+ );
5689
5771
  ComposerSend.displayName = "ComposerSend";
5690
5772
  var ComposerCancelButton = withDefaults(TooltipIconButton, {
5691
5773
  variant: "default",
5692
5774
  className: "aui-composer-cancel"
5693
5775
  });
5694
- var ComposerCancel = forwardRef26((props, ref) => {
5695
- const {
5696
- strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
5697
- } = useThreadConfig();
5698
- return /* @__PURE__ */ jsx44(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx44(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx44(CircleStopIcon, {}) }) });
5699
- });
5776
+ var ComposerCancel = forwardRef28(
5777
+ (props, ref) => {
5778
+ const {
5779
+ strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
5780
+ } = useThreadConfig();
5781
+ return /* @__PURE__ */ jsx46(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx46(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx46(CircleStopIcon, {}) }) });
5782
+ }
5783
+ );
5700
5784
  ComposerCancel.displayName = "ComposerCancel";
5701
5785
  var exports6 = {
5702
5786
  Root: ComposerRoot,
@@ -5710,15 +5794,15 @@ var exports6 = {
5710
5794
  var composer_default = Object.assign(Composer, exports6);
5711
5795
 
5712
5796
  // src/ui/thread-welcome.tsx
5713
- import { forwardRef as forwardRef27 } from "react";
5714
- import { jsx as jsx45, jsxs as jsxs9 } from "react/jsx-runtime";
5797
+ import { forwardRef as forwardRef29 } from "react";
5798
+ import { jsx as jsx47, jsxs as jsxs10 } from "react/jsx-runtime";
5715
5799
  var ThreadWelcome = () => {
5716
- return /* @__PURE__ */ jsxs9(ThreadWelcomeRoot, { children: [
5717
- /* @__PURE__ */ jsxs9(ThreadWelcomeCenter, { children: [
5718
- /* @__PURE__ */ jsx45(ThreadWelcomeAvatar, {}),
5719
- /* @__PURE__ */ jsx45(ThreadWelcomeMessage, {})
5800
+ return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
5801
+ /* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
5802
+ /* @__PURE__ */ jsx47(ThreadWelcomeAvatar, {}),
5803
+ /* @__PURE__ */ jsx47(ThreadWelcomeMessage, {})
5720
5804
  ] }),
5721
- /* @__PURE__ */ jsx45(ThreadWelcomeSuggestions, {})
5805
+ /* @__PURE__ */ jsx47(ThreadWelcomeSuggestions, {})
5722
5806
  ] });
5723
5807
  };
5724
5808
  ThreadWelcome.displayName = "ThreadWelcome";
@@ -5728,22 +5812,20 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
5728
5812
  var ThreadWelcomeCenter = withDefaults("div", {
5729
5813
  className: "aui-thread-welcome-center"
5730
5814
  });
5731
- var ThreadWelcomeRoot = forwardRef27(
5732
- (props, ref) => {
5733
- return /* @__PURE__ */ jsx45(thread_exports.Empty, { children: /* @__PURE__ */ jsx45(ThreadWelcomeRootStyled, { ...props, ref }) });
5734
- }
5735
- );
5815
+ var ThreadWelcomeRoot = forwardRef29((props, ref) => {
5816
+ return /* @__PURE__ */ jsx47(thread_exports.Empty, { children: /* @__PURE__ */ jsx47(ThreadWelcomeRootStyled, { ...props, ref }) });
5817
+ });
5736
5818
  ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
5737
5819
  var ThreadWelcomeAvatar = () => {
5738
5820
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
5739
- return /* @__PURE__ */ jsx45(Avatar, { ...avatar });
5821
+ return /* @__PURE__ */ jsx47(Avatar, { ...avatar });
5740
5822
  };
5741
5823
  var ThreadWelcomeMessageStyled = withDefaults("p", {
5742
5824
  className: "aui-thread-welcome-message"
5743
5825
  });
5744
- var ThreadWelcomeMessage = forwardRef27(({ message: messageProp, ...rest }, ref) => {
5826
+ var ThreadWelcomeMessage = forwardRef29(({ message: messageProp, ...rest }, ref) => {
5745
5827
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
5746
- return /* @__PURE__ */ jsx45(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
5828
+ return /* @__PURE__ */ jsx47(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
5747
5829
  });
5748
5830
  ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
5749
5831
  var ThreadWelcomeSuggestionContainer = withDefaults("div", {
@@ -5755,15 +5837,15 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
5755
5837
  var ThreadWelcomeSuggestion = ({
5756
5838
  suggestion: { text, prompt }
5757
5839
  }) => {
5758
- return /* @__PURE__ */ jsx45(ThreadWelcomeSuggestionStyled, { prompt, method: "replace", autoSend: true, children: /* @__PURE__ */ jsx45("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt }) });
5840
+ return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestionStyled, { prompt, method: "replace", autoSend: true, children: /* @__PURE__ */ jsx47("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt }) });
5759
5841
  };
5760
5842
  var ThreadWelcomeSuggestions = () => {
5761
5843
  const suggestions2 = useThread((t) => t.suggestions);
5762
5844
  const { welcome: { suggestions } = {} } = useThreadConfig();
5763
5845
  const finalSuggestions = suggestions2.length ? suggestions2 : suggestions;
5764
- return /* @__PURE__ */ jsx45(ThreadWelcomeSuggestionContainer, { children: finalSuggestions?.map((suggestion, idx) => {
5846
+ return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestionContainer, { children: finalSuggestions?.map((suggestion, idx) => {
5765
5847
  const key = `${suggestion.prompt}-${idx}`;
5766
- return /* @__PURE__ */ jsx45(ThreadWelcomeSuggestion, { suggestion }, key);
5848
+ return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestion, { suggestion }, key);
5767
5849
  }) });
5768
5850
  };
5769
5851
  ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
@@ -5778,12 +5860,12 @@ var exports7 = {
5778
5860
  var thread_welcome_default = Object.assign(ThreadWelcome, exports7);
5779
5861
 
5780
5862
  // src/ui/user-message.tsx
5781
- import { forwardRef as forwardRef29 } from "react";
5863
+ import { forwardRef as forwardRef31 } from "react";
5782
5864
 
5783
5865
  // src/ui/user-action-bar.tsx
5784
- import { forwardRef as forwardRef28 } from "react";
5866
+ import { forwardRef as forwardRef30 } from "react";
5785
5867
  import { PencilIcon } from "lucide-react";
5786
- import { jsx as jsx46 } from "react/jsx-runtime";
5868
+ import { jsx as jsx48 } from "react/jsx-runtime";
5787
5869
  var useAllowEdit = (ensureCapability = false) => {
5788
5870
  const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
5789
5871
  const editSupported = useThread((t) => t.capabilities.edit);
@@ -5792,19 +5874,19 @@ var useAllowEdit = (ensureCapability = false) => {
5792
5874
  var UserActionBar = () => {
5793
5875
  const allowEdit = useAllowEdit(true);
5794
5876
  if (!allowEdit) return null;
5795
- return /* @__PURE__ */ jsx46(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx46(UserActionBarEdit, {}) });
5877
+ return /* @__PURE__ */ jsx48(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx48(UserActionBarEdit, {}) });
5796
5878
  };
5797
5879
  UserActionBar.displayName = "UserActionBar";
5798
5880
  var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
5799
5881
  className: "aui-user-action-bar-root"
5800
5882
  });
5801
5883
  UserActionBarRoot.displayName = "UserActionBarRoot";
5802
- var UserActionBarEdit = forwardRef28((props, ref) => {
5884
+ var UserActionBarEdit = forwardRef30((props, ref) => {
5803
5885
  const {
5804
5886
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
5805
5887
  } = useThreadConfig();
5806
5888
  const allowEdit = useAllowEdit();
5807
- return /* @__PURE__ */ jsx46(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx46(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx46(PencilIcon, {}) }) });
5889
+ return /* @__PURE__ */ jsx48(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx48(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx48(PencilIcon, {}) }) });
5808
5890
  });
5809
5891
  UserActionBarEdit.displayName = "UserActionBarEdit";
5810
5892
  var exports8 = {
@@ -5814,17 +5896,13 @@ var exports8 = {
5814
5896
  var user_action_bar_default = Object.assign(UserActionBar, exports8);
5815
5897
 
5816
5898
  // src/ui/user-message-attachment.tsx
5817
- import { jsxs as jsxs10 } from "react/jsx-runtime";
5818
- var UserMessageAttachmentRoot = withDefaults("div", {
5899
+ import { jsx as jsx49 } from "react/jsx-runtime";
5900
+ var UserMessageAttachmentRoot = withDefaults(attachment_exports.Root, {
5819
5901
  className: "aui-user-message-attachment-root"
5820
5902
  });
5821
5903
  UserMessageAttachmentRoot.displayName = "UserMessageAttachmentRoot";
5822
5904
  var UserMessageAttachment = () => {
5823
- const attachment = useAttachment((a) => a.attachment);
5824
- return /* @__PURE__ */ jsxs10(UserMessageAttachmentRoot, { children: [
5825
- ".",
5826
- attachment.name.split(".").pop()
5827
- ] });
5905
+ return /* @__PURE__ */ jsx49(UserMessageAttachmentRoot, { children: /* @__PURE__ */ jsx49(attachment_exports.unstable_Thumb, {}) });
5828
5906
  };
5829
5907
  UserMessageAttachment.displayName = "UserMessageAttachment";
5830
5908
  var exports9 = {
@@ -5836,13 +5914,13 @@ var user_message_attachment_default = Object.assign(
5836
5914
  );
5837
5915
 
5838
5916
  // src/ui/user-message.tsx
5839
- import { jsx as jsx47, jsxs as jsxs11 } from "react/jsx-runtime";
5917
+ import { jsx as jsx50, jsxs as jsxs11 } from "react/jsx-runtime";
5840
5918
  var UserMessage = () => {
5841
5919
  return /* @__PURE__ */ jsxs11(UserMessageRoot, { children: [
5842
- /* @__PURE__ */ jsx47(UserMessageAttachments, {}),
5843
- /* @__PURE__ */ jsx47(user_action_bar_default, {}),
5844
- /* @__PURE__ */ jsx47(UserMessageContent, {}),
5845
- /* @__PURE__ */ jsx47(branch_picker_default, {})
5920
+ /* @__PURE__ */ jsx50(UserMessageAttachments, {}),
5921
+ /* @__PURE__ */ jsx50(user_action_bar_default, {}),
5922
+ /* @__PURE__ */ jsx50(UserMessageContent, {}),
5923
+ /* @__PURE__ */ jsx50(branch_picker_default, {})
5846
5924
  ] });
5847
5925
  };
5848
5926
  UserMessage.displayName = "UserMessage";
@@ -5853,19 +5931,17 @@ UserMessageRoot.displayName = "UserMessageRoot";
5853
5931
  var UserMessageContentWrapper = withDefaults("div", {
5854
5932
  className: "aui-user-message-content"
5855
5933
  });
5856
- var UserMessageContent = forwardRef29(
5857
- ({ components, ...props }, ref) => {
5858
- return /* @__PURE__ */ jsx47(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx47(
5859
- message_exports.Content,
5860
- {
5861
- components: {
5862
- ...components,
5863
- Text: components?.Text ?? content_part_default.Text
5864
- }
5934
+ var UserMessageContent = forwardRef31(({ components, ...props }, ref) => {
5935
+ return /* @__PURE__ */ jsx50(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx50(
5936
+ message_exports.Content,
5937
+ {
5938
+ components: {
5939
+ ...components,
5940
+ Text: components?.Text ?? content_part_default.Text
5865
5941
  }
5866
- ) });
5867
- }
5868
- );
5942
+ }
5943
+ ) });
5944
+ });
5869
5945
  UserMessageContent.displayName = "UserMessageContent";
5870
5946
  var UserMessageAttachmentsContainer = withDefaults("div", {
5871
5947
  className: "aui-user-message-attachments"
@@ -5873,7 +5949,7 @@ var UserMessageAttachmentsContainer = withDefaults("div", {
5873
5949
  var UserMessageAttachments = ({
5874
5950
  components
5875
5951
  }) => {
5876
- return /* @__PURE__ */ jsx47(message_exports.If, { hasAttachments: true, children: /* @__PURE__ */ jsx47(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx47(
5952
+ return /* @__PURE__ */ jsx50(message_exports.If, { hasAttachments: true, children: /* @__PURE__ */ jsx50(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx50(
5877
5953
  message_exports.Attachments,
5878
5954
  {
5879
5955
  components: {
@@ -5891,14 +5967,14 @@ var exports10 = {
5891
5967
  var user_message_default = Object.assign(UserMessage, exports10);
5892
5968
 
5893
5969
  // src/ui/edit-composer.tsx
5894
- import { forwardRef as forwardRef30 } from "react";
5895
- import { jsx as jsx48, jsxs as jsxs12 } from "react/jsx-runtime";
5970
+ import { forwardRef as forwardRef32 } from "react";
5971
+ import { jsx as jsx51, jsxs as jsxs12 } from "react/jsx-runtime";
5896
5972
  var EditComposer = () => {
5897
5973
  return /* @__PURE__ */ jsxs12(EditComposerRoot, { children: [
5898
- /* @__PURE__ */ jsx48(EditComposerInput, {}),
5974
+ /* @__PURE__ */ jsx51(EditComposerInput, {}),
5899
5975
  /* @__PURE__ */ jsxs12(EditComposerFooter, { children: [
5900
- /* @__PURE__ */ jsx48(EditComposerCancel, {}),
5901
- /* @__PURE__ */ jsx48(EditComposerSend, {})
5976
+ /* @__PURE__ */ jsx51(EditComposerCancel, {}),
5977
+ /* @__PURE__ */ jsx51(EditComposerSend, {})
5902
5978
  ] })
5903
5979
  ] });
5904
5980
  };
@@ -5915,25 +5991,19 @@ var EditComposerFooter = withDefaults("div", {
5915
5991
  className: "aui-edit-composer-footer"
5916
5992
  });
5917
5993
  EditComposerFooter.displayName = "EditComposerFooter";
5918
- var EditComposerCancel = forwardRef30(
5919
- (props, ref) => {
5920
- const {
5921
- strings: {
5922
- editComposer: { cancel: { label = "Cancel" } = {} } = {}
5923
- } = {}
5924
- } = useThreadConfig();
5925
- return /* @__PURE__ */ jsx48(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx48(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
5926
- }
5927
- );
5994
+ var EditComposerCancel = forwardRef32((props, ref) => {
5995
+ const {
5996
+ strings: { editComposer: { cancel: { label = "Cancel" } = {} } = {} } = {}
5997
+ } = useThreadConfig();
5998
+ return /* @__PURE__ */ jsx51(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx51(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
5999
+ });
5928
6000
  EditComposerCancel.displayName = "EditComposerCancel";
5929
- var EditComposerSend = forwardRef30(
5930
- (props, ref) => {
5931
- const {
5932
- strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
5933
- } = useThreadConfig();
5934
- return /* @__PURE__ */ jsx48(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx48(Button, { ...props, ref, children: props.children ?? label }) });
5935
- }
5936
- );
6001
+ var EditComposerSend = forwardRef32((props, ref) => {
6002
+ const {
6003
+ strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
6004
+ } = useThreadConfig();
6005
+ return /* @__PURE__ */ jsx51(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx51(Button, { ...props, ref, children: props.children ?? label }) });
6006
+ });
5937
6007
  EditComposerSend.displayName = "EditComposerSend";
5938
6008
  var exports11 = {
5939
6009
  Root: EditComposerRoot,
@@ -5945,7 +6015,7 @@ var exports11 = {
5945
6015
  var edit_composer_default = Object.assign(EditComposer, exports11);
5946
6016
 
5947
6017
  // src/ui/thread.tsx
5948
- import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs13 } from "react/jsx-runtime";
6018
+ import { Fragment as Fragment7, jsx as jsx52, jsxs as jsxs13 } from "react/jsx-runtime";
5949
6019
  var Thread = (config) => {
5950
6020
  const {
5951
6021
  components: {
@@ -5953,22 +6023,22 @@ var Thread = (config) => {
5953
6023
  ThreadWelcome: ThreadWelcomeComponent = thread_welcome_default
5954
6024
  } = {}
5955
6025
  } = config;
5956
- return /* @__PURE__ */ jsx49(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
5957
- /* @__PURE__ */ jsx49(ThreadWelcomeComponent, {}),
5958
- /* @__PURE__ */ jsx49(ThreadMessages, {}),
5959
- /* @__PURE__ */ jsx49(ThreadFollowupSuggestions, {}),
6026
+ return /* @__PURE__ */ jsx52(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
6027
+ /* @__PURE__ */ jsx52(ThreadWelcomeComponent, {}),
6028
+ /* @__PURE__ */ jsx52(ThreadMessages, {}),
6029
+ /* @__PURE__ */ jsx52(ThreadFollowupSuggestions, {}),
5960
6030
  /* @__PURE__ */ jsxs13(ThreadViewportFooter, { children: [
5961
- /* @__PURE__ */ jsx49(ThreadScrollToBottom, {}),
5962
- /* @__PURE__ */ jsx49(ComposerComponent, {})
6031
+ /* @__PURE__ */ jsx52(ThreadScrollToBottom, {}),
6032
+ /* @__PURE__ */ jsx52(ComposerComponent, {})
5963
6033
  ] })
5964
6034
  ] }) });
5965
6035
  };
5966
6036
  var ThreadRootStyled = withDefaults(thread_exports.Root, {
5967
6037
  className: "aui-root aui-thread-root"
5968
6038
  });
5969
- var ThreadRoot = forwardRef31(
6039
+ var ThreadRoot = forwardRef33(
5970
6040
  ({ config, ...props }, ref) => {
5971
- return /* @__PURE__ */ jsx49(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx49(ThreadRootStyled, { ...props, ref }) });
6041
+ return /* @__PURE__ */ jsx52(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx52(ThreadRootStyled, { ...props, ref }) });
5972
6042
  }
5973
6043
  );
5974
6044
  ThreadRoot.displayName = "ThreadRoot";
@@ -5982,8 +6052,8 @@ var ThreadViewportFooter = withDefaults("div", {
5982
6052
  ThreadViewportFooter.displayName = "ThreadViewportFooter";
5983
6053
  var SystemMessage = () => null;
5984
6054
  var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ...rest }) => {
5985
- return /* @__PURE__ */ jsxs13(Fragment6, { children: [
5986
- /* @__PURE__ */ jsx49(
6055
+ return /* @__PURE__ */ jsxs13(Fragment7, { children: [
6056
+ /* @__PURE__ */ jsx52(
5987
6057
  thread_exports.Messages,
5988
6058
  {
5989
6059
  components: {
@@ -5995,13 +6065,13 @@ var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ..
5995
6065
  ...rest
5996
6066
  }
5997
6067
  ),
5998
- flexGrowDiv && /* @__PURE__ */ jsx49(thread_exports.If, { empty: false, children: /* @__PURE__ */ jsx49("div", { style: { flexGrow: 1 } }) })
6068
+ flexGrowDiv && /* @__PURE__ */ jsx52(thread_exports.If, { empty: false, children: /* @__PURE__ */ jsx52("div", { style: { flexGrow: 1 } }) })
5999
6069
  ] });
6000
6070
  };
6001
6071
  ThreadMessages.displayName = "ThreadMessages";
6002
6072
  var ThreadFollowupSuggestions = () => {
6003
6073
  const suggestions = useThread((t) => t.suggestions);
6004
- return /* @__PURE__ */ jsx49(thread_exports.If, { empty: false, running: false, children: /* @__PURE__ */ jsx49("div", { className: "aui-thread-followup-suggestions", children: suggestions?.map((suggestion, idx) => /* @__PURE__ */ jsx49(
6074
+ return /* @__PURE__ */ jsx52(thread_exports.If, { empty: false, running: false, children: /* @__PURE__ */ jsx52("div", { className: "aui-thread-followup-suggestions", children: suggestions?.map((suggestion, idx) => /* @__PURE__ */ jsx52(
6005
6075
  thread_exports.Suggestion,
6006
6076
  {
6007
6077
  className: "aui-thread-followup-suggestion",
@@ -6017,13 +6087,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
6017
6087
  variant: "outline",
6018
6088
  className: "aui-thread-scroll-to-bottom"
6019
6089
  });
6020
- var ThreadScrollToBottom = forwardRef31((props, ref) => {
6090
+ var ThreadScrollToBottom = forwardRef33((props, ref) => {
6021
6091
  const {
6022
6092
  strings: {
6023
6093
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
6024
6094
  } = {}
6025
6095
  } = useThreadConfig();
6026
- return /* @__PURE__ */ jsx49(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx49(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx49(ArrowDownIcon, {}) }) });
6096
+ return /* @__PURE__ */ jsx52(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx52(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx52(ArrowDownIcon, {}) }) });
6027
6097
  });
6028
6098
  ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
6029
6099
  var exports12 = {
@@ -6037,20 +6107,23 @@ var exports12 = {
6037
6107
  var thread_default = Object.assign(Thread, exports12);
6038
6108
 
6039
6109
  // src/ui/assistant-modal.tsx
6040
- import { Fragment as Fragment7, jsx as jsx50, jsxs as jsxs14 } from "react/jsx-runtime";
6110
+ import { Fragment as Fragment8, jsx as jsx53, jsxs as jsxs14 } from "react/jsx-runtime";
6041
6111
  var AssistantModal = (config) => {
6042
6112
  return /* @__PURE__ */ jsxs14(AssistantModalRoot, { config, children: [
6043
- /* @__PURE__ */ jsx50(AssistantModalTrigger, {}),
6044
- /* @__PURE__ */ jsx50(AssistantModalContent, { children: /* @__PURE__ */ jsx50(thread_default, {}) })
6113
+ /* @__PURE__ */ jsx53(AssistantModalTrigger, {}),
6114
+ /* @__PURE__ */ jsx53(AssistantModalContent, { children: /* @__PURE__ */ jsx53(thread_default, {}) })
6045
6115
  ] });
6046
6116
  };
6047
6117
  AssistantModal.displayName = "AssistantModal";
6048
- var AssistantModalRoot = ({ config, ...props }) => {
6049
- return /* @__PURE__ */ jsx50(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx50(assistantModal_exports.Root, { ...props }) });
6118
+ var AssistantModalRoot = ({
6119
+ config,
6120
+ ...props
6121
+ }) => {
6122
+ return /* @__PURE__ */ jsx53(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx53(assistantModal_exports.Root, { ...props }) });
6050
6123
  };
6051
6124
  AssistantModalRoot.displayName = "AssistantModalRoot";
6052
- var AssistantModalTrigger = forwardRef32((props, ref) => {
6053
- return /* @__PURE__ */ jsx50(AssistantModalAnchor, { children: /* @__PURE__ */ jsx50(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx50(AssistantModalButton, { ...props, ref }) }) });
6125
+ var AssistantModalTrigger = forwardRef34((props, ref) => {
6126
+ return /* @__PURE__ */ jsx53(AssistantModalAnchor, { children: /* @__PURE__ */ jsx53(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx53(AssistantModalButton, { ...props, ref }) }) });
6054
6127
  });
6055
6128
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
6056
6129
  var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
@@ -6061,7 +6134,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
6061
6134
  variant: "default",
6062
6135
  className: "aui-modal-button"
6063
6136
  });
6064
- var AssistantModalButton = forwardRef32(({ "data-state": state, ...rest }, ref) => {
6137
+ var AssistantModalButton = forwardRef34(({ "data-state": state, ...rest }, ref) => {
6065
6138
  const {
6066
6139
  strings: {
6067
6140
  assistantModal: {
@@ -6075,7 +6148,7 @@ var AssistantModalButton = forwardRef32(({ "data-state": state, ...rest }, ref)
6075
6148
  } = {}
6076
6149
  } = useThreadConfig();
6077
6150
  const tooltip = state === "open" ? openTooltip : closedTooltip;
6078
- return /* @__PURE__ */ jsx50(
6151
+ return /* @__PURE__ */ jsx53(
6079
6152
  ModalButtonStyled,
6080
6153
  {
6081
6154
  side: "left",
@@ -6083,15 +6156,15 @@ var AssistantModalButton = forwardRef32(({ "data-state": state, ...rest }, ref)
6083
6156
  "data-state": state,
6084
6157
  ...rest,
6085
6158
  ref,
6086
- children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment7, { children: [
6087
- /* @__PURE__ */ jsx50(
6159
+ children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment8, { children: [
6160
+ /* @__PURE__ */ jsx53(
6088
6161
  BotIcon,
6089
6162
  {
6090
6163
  "data-state": state,
6091
6164
  className: "aui-modal-button-closed-icon"
6092
6165
  }
6093
6166
  ),
6094
- /* @__PURE__ */ jsx50(
6167
+ /* @__PURE__ */ jsx53(
6095
6168
  ChevronDownIcon,
6096
6169
  {
6097
6170
  "data-state": state,
@@ -6123,6 +6196,7 @@ export {
6123
6196
  assistant_modal_default as AssistantModal,
6124
6197
  assistantModal_exports as AssistantModalPrimitive,
6125
6198
  AssistantRuntimeProvider,
6199
+ attachment_exports as AttachmentPrimitive,
6126
6200
  branch_picker_default as BranchPicker,
6127
6201
  branchPicker_exports as BranchPickerPrimitive,
6128
6202
  composer_default as Composer,