@assistant-ui/react 0.5.19 → 0.5.20

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
@@ -1118,8 +1118,8 @@ var BranchPickerPrimitiveNumber = () => {
1118
1118
  BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
1119
1119
 
1120
1120
  // src/primitives/branchPicker/BranchPickerRoot.tsx
1121
- import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
1122
- import { forwardRef as forwardRef9 } from "react";
1121
+ import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
1122
+ import { forwardRef as forwardRef10 } from "react";
1123
1123
 
1124
1124
  // src/primitives/message/index.ts
1125
1125
  var message_exports = {};
@@ -1161,9 +1161,9 @@ var useIsHoveringRef = () => {
1161
1161
  );
1162
1162
  return useManagedRef(callbackRef);
1163
1163
  };
1164
- var MessagePrimitiveRoot = forwardRef6(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef28) => {
1164
+ var MessagePrimitiveRoot = forwardRef6(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef29) => {
1165
1165
  const isHoveringRef = useIsHoveringRef();
1166
- const ref = useComposedRefs(forwardRef28, isHoveringRef);
1166
+ const ref = useComposedRefs(forwardRef29, isHoveringRef);
1167
1167
  return /* @__PURE__ */ jsx12(Primitive3.div, { ...rest, ref });
1168
1168
  });
1169
1169
  MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
@@ -1225,7 +1225,6 @@ var useContentPartContext2 = (partIndex) => {
1225
1225
  const useContentPart = create10(
1226
1226
  () => getContentPartState(useMessage.getState(), void 0, partIndex)
1227
1227
  );
1228
- getContentPartState(useMessage.getState(), useContentPart, partIndex);
1229
1228
  return { useContentPart };
1230
1229
  });
1231
1230
  useEffect6(() => {
@@ -1252,11 +1251,58 @@ var ContentPartProvider = ({
1252
1251
  };
1253
1252
 
1254
1253
  // src/primitives/contentPart/ContentPartText.tsx
1255
- import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
1256
- import { forwardRef as forwardRef7 } from "react";
1254
+ import {
1255
+ forwardRef as forwardRef8
1256
+ } from "react";
1257
+
1258
+ // src/utils/smooth/useSmooth.tsx
1259
+ import { useEffect as useEffect7, useMemo as useMemo3, useRef as useRef3, useState as useState6 } from "react";
1260
+
1261
+ // src/utils/smooth/SmoothContext.tsx
1262
+ import {
1263
+ createContext as createContext5,
1264
+ forwardRef as forwardRef7,
1265
+ useContext as useContext5,
1266
+ useState as useState5
1267
+ } from "react";
1268
+ import { create as create11 } from "zustand";
1269
+ import { jsx as jsx14 } from "react/jsx-runtime";
1270
+ var SmoothContext = createContext5(null);
1271
+ var makeSmoothContext = (initialState) => {
1272
+ const useSmoothStatus2 = create11(() => initialState);
1273
+ return { useSmoothStatus: useSmoothStatus2 };
1274
+ };
1275
+ var SmoothContextProvider = ({ children }) => {
1276
+ const outer = useSmoothContext({ optional: true });
1277
+ const { useContentPart } = useContentPartContext();
1278
+ const [context] = useState5(
1279
+ () => makeSmoothContext(useContentPart.getState().status)
1280
+ );
1281
+ if (outer) return children;
1282
+ return /* @__PURE__ */ jsx14(SmoothContext.Provider, { value: context, children });
1283
+ };
1284
+ var withSmoothContextProvider = (Component) => {
1285
+ const Wrapped = forwardRef7((props, ref) => {
1286
+ return /* @__PURE__ */ jsx14(SmoothContextProvider, { children: /* @__PURE__ */ jsx14(Component, { ...props, ref }) });
1287
+ });
1288
+ Wrapped.displayName = Component.displayName;
1289
+ return Wrapped;
1290
+ };
1291
+ function useSmoothContext(options) {
1292
+ const context = useContext5(SmoothContext);
1293
+ if (!options?.optional && !context)
1294
+ throw new Error(
1295
+ "This component must be used within a SmoothContextProvider."
1296
+ );
1297
+ return context;
1298
+ }
1299
+ var useSmoothStatus = () => {
1300
+ const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext();
1301
+ return useSmoothStatus2();
1302
+ };
1257
1303
 
1258
- // src/utils/hooks/useSmooth.tsx
1259
- import { useEffect as useEffect7, useRef as useRef3, useState as useState5 } from "react";
1304
+ // src/utils/smooth/useSmooth.tsx
1305
+ import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-ref";
1260
1306
  var TextStreamAnimator = class {
1261
1307
  constructor(currentText, setText) {
1262
1308
  this.currentText = currentText;
@@ -1301,13 +1347,24 @@ var TextStreamAnimator = class {
1301
1347
  this.setText(this.currentText);
1302
1348
  };
1303
1349
  };
1304
- var useSmooth = (text, smooth = false) => {
1350
+ var SMOOTH_STATUS = Object.freeze({
1351
+ type: "running"
1352
+ });
1353
+ var useSmooth = (state, smooth = false) => {
1354
+ const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext({ optional: true }) ?? {};
1355
+ const {
1356
+ part: { text }
1357
+ } = state;
1305
1358
  const { useMessage } = useMessageContext();
1306
1359
  const id = useMessage((m) => m.message.id);
1307
1360
  const idRef = useRef3(id);
1308
- const [displayedText, setDisplayedText] = useState5(text);
1309
- const [animatorRef] = useState5(
1310
- new TextStreamAnimator(text, setDisplayedText)
1361
+ const [displayedText, setDisplayedText] = useState6(text);
1362
+ const setText = useCallbackRef2((text2) => {
1363
+ setDisplayedText(text2);
1364
+ useSmoothStatus2?.setState(text2 !== state.part.text ? SMOOTH_STATUS : state.status);
1365
+ });
1366
+ const [animatorRef] = useState6(
1367
+ new TextStreamAnimator(text, setText)
1311
1368
  );
1312
1369
  useEffect7(() => {
1313
1370
  if (!smooth) {
@@ -1316,7 +1373,7 @@ var useSmooth = (text, smooth = false) => {
1316
1373
  }
1317
1374
  if (idRef.current !== id || !text.startsWith(animatorRef.targetText)) {
1318
1375
  idRef.current = id;
1319
- setDisplayedText(text);
1376
+ setText(text);
1320
1377
  animatorRef.currentText = text;
1321
1378
  animatorRef.targetText = text;
1322
1379
  animatorRef.stop();
@@ -1324,36 +1381,41 @@ var useSmooth = (text, smooth = false) => {
1324
1381
  }
1325
1382
  animatorRef.targetText = text;
1326
1383
  animatorRef.start();
1327
- }, [animatorRef, id, smooth, text]);
1384
+ }, [setText, animatorRef, id, smooth, text]);
1328
1385
  useEffect7(() => {
1329
1386
  return () => {
1330
1387
  animatorRef.stop();
1331
1388
  };
1332
1389
  }, [animatorRef]);
1333
- return smooth ? displayedText : text;
1390
+ return useMemo3(
1391
+ () => smooth ? {
1392
+ part: { type: "text", text: displayedText },
1393
+ status: text === displayedText ? state.status : SMOOTH_STATUS
1394
+ } : state,
1395
+ [smooth, displayedText, state, text]
1396
+ );
1334
1397
  };
1335
1398
 
1336
1399
  // src/primitives/contentPart/ContentPartText.tsx
1337
- import { jsx as jsx14 } from "react/jsx-runtime";
1338
- var ContentPartPrimitiveText = forwardRef7(({ smooth = true, ...rest }, forwardedRef) => {
1400
+ import { jsx as jsx15 } from "react/jsx-runtime";
1401
+ var ContentPartPrimitiveText = forwardRef8(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
1339
1402
  const {
1340
- status,
1341
- part: { text }
1342
- } = useContentPartText();
1343
- const smoothText = useSmooth(text, smooth);
1344
- return /* @__PURE__ */ jsx14(Primitive4.span, { "data-status": status.type, ...rest, ref: forwardedRef, children: smoothText });
1403
+ part: { text },
1404
+ status
1405
+ } = useSmooth(useContentPartText(), smooth);
1406
+ return /* @__PURE__ */ jsx15(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
1345
1407
  });
1346
1408
  ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
1347
1409
 
1348
1410
  // src/primitives/contentPart/ContentPartImage.tsx
1349
- import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
1350
- import { forwardRef as forwardRef8 } from "react";
1351
- import { jsx as jsx15 } from "react/jsx-runtime";
1352
- var ContentPartPrimitiveImage = forwardRef8((props, forwardedRef) => {
1411
+ import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
1412
+ import { forwardRef as forwardRef9 } from "react";
1413
+ import { jsx as jsx16 } from "react/jsx-runtime";
1414
+ var ContentPartPrimitiveImage = forwardRef9((props, forwardedRef) => {
1353
1415
  const {
1354
1416
  part: { image }
1355
1417
  } = useContentPartImage();
1356
- return /* @__PURE__ */ jsx15(Primitive5.img, { src: image, ...props, ref: forwardedRef });
1418
+ return /* @__PURE__ */ jsx16(Primitive4.img, { src: image, ...props, ref: forwardedRef });
1357
1419
  });
1358
1420
  ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
1359
1421
 
@@ -1375,20 +1437,20 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
1375
1437
  ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
1376
1438
 
1377
1439
  // src/primitives/message/MessageContent.tsx
1378
- import { jsx as jsx16, jsxs as jsxs2 } from "react/jsx-runtime";
1440
+ import { jsx as jsx17, jsxs as jsxs2 } from "react/jsx-runtime";
1379
1441
  var defaultComponents = {
1380
1442
  Text: () => /* @__PURE__ */ jsxs2("p", { style: { whiteSpace: "pre-line" }, children: [
1381
- /* @__PURE__ */ jsx16(ContentPartPrimitiveText, {}),
1382
- /* @__PURE__ */ jsx16(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx16("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
1443
+ /* @__PURE__ */ jsx17(ContentPartPrimitiveText, {}),
1444
+ /* @__PURE__ */ jsx17(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx17("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
1383
1445
  ] }),
1384
- Image: () => /* @__PURE__ */ jsx16(ContentPartPrimitiveImage, {}),
1385
- UI: () => /* @__PURE__ */ jsx16(ContentPartPrimitiveDisplay, {}),
1446
+ Image: () => /* @__PURE__ */ jsx17(ContentPartPrimitiveImage, {}),
1447
+ UI: () => /* @__PURE__ */ jsx17(ContentPartPrimitiveDisplay, {}),
1386
1448
  tools: {
1387
1449
  Fallback: (props) => {
1388
1450
  const { useToolUIs } = useAssistantContext();
1389
1451
  const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
1390
1452
  if (!Render) return null;
1391
- return /* @__PURE__ */ jsx16(Render, { ...props });
1453
+ return /* @__PURE__ */ jsx17(Render, { ...props });
1392
1454
  }
1393
1455
  }
1394
1456
  };
@@ -1411,16 +1473,16 @@ var MessageContentPartComponent = ({
1411
1473
  case "text":
1412
1474
  if (status.type === "requires-action")
1413
1475
  throw new Error("Encountered unexpected requires-action status");
1414
- if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx16(Empty, { part, status });
1415
- return /* @__PURE__ */ jsx16(Text2, { part, status });
1476
+ if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx17(Empty, { part, status });
1477
+ return /* @__PURE__ */ jsx17(Text2, { part, status });
1416
1478
  case "image":
1417
1479
  if (status.type === "requires-action")
1418
1480
  throw new Error("Encountered unexpected requires-action status");
1419
- return /* @__PURE__ */ jsx16(Image2, { part, status });
1481
+ return /* @__PURE__ */ jsx17(Image2, { part, status });
1420
1482
  case "ui":
1421
1483
  if (status.type === "requires-action")
1422
1484
  throw new Error("Encountered unexpected requires-action status");
1423
- return /* @__PURE__ */ jsx16(UI, { part, status });
1485
+ return /* @__PURE__ */ jsx17(UI, { part, status });
1424
1486
  case "tool-call": {
1425
1487
  const Tool = by_name[part.toolName] || Fallback2;
1426
1488
  const addResult = (result) => addToolResult({
@@ -1428,7 +1490,7 @@ var MessageContentPartComponent = ({
1428
1490
  toolCallId: part.toolCallId,
1429
1491
  result
1430
1492
  });
1431
- return /* @__PURE__ */ jsx16(Tool, { part, status, addResult });
1493
+ return /* @__PURE__ */ jsx17(Tool, { part, status, addResult });
1432
1494
  }
1433
1495
  default:
1434
1496
  const unhandledType = type;
@@ -1439,7 +1501,7 @@ var MessageContentPartImpl = ({
1439
1501
  partIndex,
1440
1502
  components
1441
1503
  }) => {
1442
- return /* @__PURE__ */ jsx16(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx16(MessageContentPartComponent, { components }) });
1504
+ return /* @__PURE__ */ jsx17(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx17(MessageContentPartComponent, { components }) });
1443
1505
  };
1444
1506
  var MessageContentPart = memo2(
1445
1507
  MessageContentPartImpl,
@@ -1452,7 +1514,7 @@ var MessagePrimitiveContent = ({
1452
1514
  const contentLength = useMessage((s) => s.message.content.length) || 1;
1453
1515
  return new Array(contentLength).fill(null).map((_, idx) => {
1454
1516
  const partIndex = idx;
1455
- return /* @__PURE__ */ jsx16(
1517
+ return /* @__PURE__ */ jsx17(
1456
1518
  MessageContentPart,
1457
1519
  {
1458
1520
  partIndex,
@@ -1471,9 +1533,9 @@ var MessagePrimitiveInProgress = () => {
1471
1533
  MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
1472
1534
 
1473
1535
  // src/primitives/branchPicker/BranchPickerRoot.tsx
1474
- import { jsx as jsx17 } from "react/jsx-runtime";
1475
- var BranchPickerPrimitiveRoot = forwardRef9(({ hideWhenSingleBranch, ...rest }, ref) => {
1476
- return /* @__PURE__ */ jsx17(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx17(Primitive6.div, { ...rest, ref }) });
1536
+ import { jsx as jsx18 } from "react/jsx-runtime";
1537
+ var BranchPickerPrimitiveRoot = forwardRef10(({ hideWhenSingleBranch, ...rest }, ref) => {
1538
+ return /* @__PURE__ */ jsx18(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx18(Primitive5.div, { ...rest, ref }) });
1477
1539
  });
1478
1540
  BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
1479
1541
 
@@ -1489,20 +1551,20 @@ __export(composer_exports, {
1489
1551
 
1490
1552
  // src/primitives/composer/ComposerRoot.tsx
1491
1553
  import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
1492
- import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
1554
+ import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
1493
1555
  import {
1494
- forwardRef as forwardRef10
1556
+ forwardRef as forwardRef11
1495
1557
  } from "react";
1496
- import { jsx as jsx18 } from "react/jsx-runtime";
1497
- var ComposerPrimitiveRoot = forwardRef10(({ onSubmit, ...rest }, forwardedRef) => {
1558
+ import { jsx as jsx19 } from "react/jsx-runtime";
1559
+ var ComposerPrimitiveRoot = forwardRef11(({ onSubmit, ...rest }, forwardedRef) => {
1498
1560
  const send = useComposerSend();
1499
1561
  const handleSubmit = (e) => {
1500
1562
  e.preventDefault();
1501
1563
  if (!send) return;
1502
1564
  send();
1503
1565
  };
1504
- return /* @__PURE__ */ jsx18(
1505
- Primitive7.form,
1566
+ return /* @__PURE__ */ jsx19(
1567
+ Primitive6.form,
1506
1568
  {
1507
1569
  ...rest,
1508
1570
  ref: forwardedRef,
@@ -1517,15 +1579,15 @@ import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primiti
1517
1579
  import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
1518
1580
  import { Slot } from "@radix-ui/react-slot";
1519
1581
  import {
1520
- forwardRef as forwardRef11,
1582
+ forwardRef as forwardRef12,
1521
1583
  useCallback as useCallback15,
1522
1584
  useEffect as useEffect8,
1523
1585
  useRef as useRef4
1524
1586
  } from "react";
1525
1587
  import TextareaAutosize from "react-textarea-autosize";
1526
1588
  import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
1527
- import { jsx as jsx19 } from "react/jsx-runtime";
1528
- var ComposerPrimitiveInput = forwardRef11(
1589
+ import { jsx as jsx20 } from "react/jsx-runtime";
1590
+ var ComposerPrimitiveInput = forwardRef12(
1529
1591
  ({
1530
1592
  autoFocus = false,
1531
1593
  asChild,
@@ -1577,7 +1639,7 @@ var ComposerPrimitiveInput = forwardRef11(
1577
1639
  focus();
1578
1640
  }
1579
1641
  });
1580
- return /* @__PURE__ */ jsx19(
1642
+ return /* @__PURE__ */ jsx20(
1581
1643
  Component,
1582
1644
  {
1583
1645
  name: "input",
@@ -1598,14 +1660,14 @@ var ComposerPrimitiveInput = forwardRef11(
1598
1660
  ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
1599
1661
 
1600
1662
  // src/primitives/composer/ComposerSend.tsx
1601
- import { forwardRef as forwardRef12 } from "react";
1602
- import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
1603
- import { jsx as jsx20 } from "react/jsx-runtime";
1604
- var ComposerPrimitiveSend = forwardRef12(({ disabled, ...rest }, ref) => {
1663
+ import { forwardRef as forwardRef13 } from "react";
1664
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
1665
+ import { jsx as jsx21 } from "react/jsx-runtime";
1666
+ var ComposerPrimitiveSend = forwardRef13(({ disabled, ...rest }, ref) => {
1605
1667
  const { useComposer } = useComposerContext();
1606
1668
  const hasValue = useComposer((c) => c.isEditing && c.value.length > 0);
1607
- return /* @__PURE__ */ jsx20(
1608
- Primitive8.button,
1669
+ return /* @__PURE__ */ jsx21(
1670
+ Primitive7.button,
1609
1671
  {
1610
1672
  type: "submit",
1611
1673
  ...rest,
@@ -1654,11 +1716,11 @@ __export(thread_exports, {
1654
1716
  });
1655
1717
 
1656
1718
  // src/primitives/thread/ThreadRoot.tsx
1657
- import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1658
- import { forwardRef as forwardRef13 } from "react";
1659
- import { jsx as jsx21 } from "react/jsx-runtime";
1660
- var ThreadPrimitiveRoot = forwardRef13((props, ref) => {
1661
- return /* @__PURE__ */ jsx21(Primitive9.div, { ...props, ref });
1719
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
1720
+ import { forwardRef as forwardRef14 } from "react";
1721
+ import { jsx as jsx22 } from "react/jsx-runtime";
1722
+ var ThreadPrimitiveRoot = forwardRef14((props, ref) => {
1723
+ return /* @__PURE__ */ jsx22(Primitive8.div, { ...props, ref });
1662
1724
  });
1663
1725
  ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
1664
1726
 
@@ -1683,18 +1745,18 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
1683
1745
 
1684
1746
  // src/primitives/thread/ThreadViewport.tsx
1685
1747
  import { useComposedRefs as useComposedRefs4 } from "@radix-ui/react-compose-refs";
1686
- import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
1687
- import { forwardRef as forwardRef14 } from "react";
1748
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1749
+ import { forwardRef as forwardRef15 } from "react";
1688
1750
 
1689
1751
  // src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
1690
1752
  import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
1691
1753
  import { useRef as useRef5 } from "react";
1692
1754
 
1693
1755
  // src/utils/hooks/useOnResizeContent.tsx
1694
- import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-ref";
1756
+ import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
1695
1757
  import { useCallback as useCallback16 } from "react";
1696
1758
  var useOnResizeContent = (callback) => {
1697
- const callbackRef = useCallbackRef2(callback);
1759
+ const callbackRef = useCallbackRef3(callback);
1698
1760
  const refCallback = useCallback16(
1699
1761
  (el) => {
1700
1762
  const resizeObserver = new ResizeObserver(() => {
@@ -1731,10 +1793,10 @@ var useOnResizeContent = (callback) => {
1731
1793
  };
1732
1794
 
1733
1795
  // src/utils/hooks/useOnScrollToBottom.tsx
1734
- import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
1796
+ import { useCallbackRef as useCallbackRef4 } from "@radix-ui/react-use-callback-ref";
1735
1797
  import { useEffect as useEffect9 } from "react";
1736
1798
  var useOnScrollToBottom = (callback) => {
1737
- const callbackRef = useCallbackRef3(callback);
1799
+ const callbackRef = useCallbackRef4(callback);
1738
1800
  const { useViewport } = useThreadContext();
1739
1801
  useEffect9(() => {
1740
1802
  return useViewport.getState().onScrollToBottom(() => {
@@ -1795,13 +1857,13 @@ var useThreadViewportAutoScroll = ({
1795
1857
  };
1796
1858
 
1797
1859
  // src/primitives/thread/ThreadViewport.tsx
1798
- import { jsx as jsx22 } from "react/jsx-runtime";
1799
- var ThreadPrimitiveViewport = forwardRef14(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
1860
+ import { jsx as jsx23 } from "react/jsx-runtime";
1861
+ var ThreadPrimitiveViewport = forwardRef15(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
1800
1862
  const autoScrollRef = useThreadViewportAutoScroll({
1801
1863
  autoScroll
1802
1864
  });
1803
1865
  const ref = useComposedRefs4(forwardedRef, autoScrollRef);
1804
- return /* @__PURE__ */ jsx22(Primitive10.div, { ...rest, ref, children });
1866
+ return /* @__PURE__ */ jsx23(Primitive9.div, { ...rest, ref, children });
1805
1867
  });
1806
1868
  ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
1807
1869
 
@@ -1809,15 +1871,15 @@ ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
1809
1871
  import { memo as memo3 } from "react";
1810
1872
 
1811
1873
  // src/context/providers/MessageProvider.tsx
1812
- import { useEffect as useEffect10, useState as useState6 } from "react";
1813
- import { create as create13 } from "zustand";
1874
+ import { useEffect as useEffect10, useState as useState7 } from "react";
1875
+ import { create as create14 } from "zustand";
1814
1876
 
1815
1877
  // src/context/stores/EditComposer.ts
1816
- import { create as create11 } from "zustand";
1878
+ import { create as create12 } from "zustand";
1817
1879
  var makeEditComposerStore = ({
1818
1880
  onEdit,
1819
1881
  onSend
1820
- }) => create11()((set, get, store) => ({
1882
+ }) => create12()((set, get, store) => ({
1821
1883
  ...makeBaseComposer(set, get, store),
1822
1884
  canCancel: false,
1823
1885
  isEditing: false,
@@ -1836,8 +1898,8 @@ var makeEditComposerStore = ({
1836
1898
  }));
1837
1899
 
1838
1900
  // src/context/stores/MessageUtils.ts
1839
- import { create as create12 } from "zustand";
1840
- var makeMessageUtilsStore = () => create12((set) => ({
1901
+ import { create as create13 } from "zustand";
1902
+ var makeMessageUtilsStore = () => create13((set) => ({
1841
1903
  isCopied: false,
1842
1904
  setIsCopied: (value) => {
1843
1905
  set({ isCopied: value });
@@ -1849,7 +1911,7 @@ var makeMessageUtilsStore = () => create12((set) => ({
1849
1911
  }));
1850
1912
 
1851
1913
  // src/context/providers/MessageProvider.tsx
1852
- import { jsx as jsx23 } from "react/jsx-runtime";
1914
+ import { jsx as jsx24 } from "react/jsx-runtime";
1853
1915
  var getIsLast = (messages, message) => {
1854
1916
  return messages[messages.length - 1]?.id === message.id;
1855
1917
  };
@@ -1871,8 +1933,8 @@ var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
1871
1933
  };
1872
1934
  var useMessageContext2 = (messageIndex) => {
1873
1935
  const { useThreadMessages, useThreadActions } = useThreadContext();
1874
- const [context] = useState6(() => {
1875
- const useMessage = create13(
1936
+ const [context] = useState7(() => {
1937
+ const useMessage = create14(
1876
1938
  () => getMessageState(
1877
1939
  useThreadMessages.getState(),
1878
1940
  useThreadActions.getState().getBranches,
@@ -1933,11 +1995,11 @@ var MessageProvider = ({
1933
1995
  children
1934
1996
  }) => {
1935
1997
  const context = useMessageContext2(messageIndex);
1936
- return /* @__PURE__ */ jsx23(MessageContext.Provider, { value: context, children });
1998
+ return /* @__PURE__ */ jsx24(MessageContext.Provider, { value: context, children });
1937
1999
  };
1938
2000
 
1939
2001
  // src/primitives/thread/ThreadMessages.tsx
1940
- import { jsx as jsx24, jsxs as jsxs3 } from "react/jsx-runtime";
2002
+ import { jsx as jsx25, jsxs as jsxs3 } from "react/jsx-runtime";
1941
2003
  var DEFAULT_SYSTEM_MESSAGE = () => null;
1942
2004
  var getComponents = (components) => {
1943
2005
  return {
@@ -1954,11 +2016,11 @@ var ThreadMessageImpl = ({
1954
2016
  const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
1955
2017
  return /* @__PURE__ */ jsxs3(MessageProvider, { messageIndex, children: [
1956
2018
  /* @__PURE__ */ jsxs3(MessagePrimitiveIf, { user: true, children: [
1957
- /* @__PURE__ */ jsx24(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx24(UserMessage2, {}) }),
1958
- /* @__PURE__ */ jsx24(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx24(EditComposer2, {}) })
2019
+ /* @__PURE__ */ jsx25(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx25(UserMessage2, {}) }),
2020
+ /* @__PURE__ */ jsx25(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx25(EditComposer2, {}) })
1959
2021
  ] }),
1960
- /* @__PURE__ */ jsx24(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx24(AssistantMessage2, {}) }),
1961
- /* @__PURE__ */ jsx24(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx24(SystemMessage2, {}) })
2022
+ /* @__PURE__ */ jsx25(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx25(AssistantMessage2, {}) }),
2023
+ /* @__PURE__ */ jsx25(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx25(SystemMessage2, {}) })
1962
2024
  ] });
1963
2025
  };
1964
2026
  var ThreadMessage = memo3(
@@ -1973,7 +2035,7 @@ var ThreadPrimitiveMessagesImpl = ({
1973
2035
  if (messagesLength === 0) return null;
1974
2036
  return new Array(messagesLength).fill(null).map((_, idx) => {
1975
2037
  const messageIndex = idx;
1976
- return /* @__PURE__ */ jsx24(
2038
+ return /* @__PURE__ */ jsx25(
1977
2039
  ThreadMessage,
1978
2040
  {
1979
2041
  messageIndex,
@@ -2003,7 +2065,7 @@ var ThreadPrimitiveSuggestion = createActionButton(
2003
2065
  );
2004
2066
 
2005
2067
  // src/runtimes/local/useLocalRuntime.tsx
2006
- import { useInsertionEffect as useInsertionEffect3, useState as useState8 } from "react";
2068
+ import { useInsertionEffect as useInsertionEffect3, useState as useState9 } from "react";
2007
2069
 
2008
2070
  // src/runtimes/core/BaseAssistantRuntime.tsx
2009
2071
  var BaseAssistantRuntime = class {
@@ -2036,7 +2098,9 @@ __export(internal_exports, {
2036
2098
  ProxyConfigProvider: () => ProxyConfigProvider,
2037
2099
  TooltipIconButton: () => TooltipIconButton,
2038
2100
  generateId: () => generateId,
2039
- useSmooth: () => useSmooth
2101
+ useSmooth: () => useSmooth,
2102
+ useSmoothStatus: () => useSmoothStatus,
2103
+ withSmoothContextProvider: () => withSmoothContextProvider
2040
2104
  });
2041
2105
 
2042
2106
  // src/utils/idUtils.tsx
@@ -2260,17 +2324,17 @@ var MessageRepository = class {
2260
2324
  };
2261
2325
 
2262
2326
  // src/ui/base/tooltip-icon-button.tsx
2263
- import { forwardRef as forwardRef17 } from "react";
2327
+ import { forwardRef as forwardRef18 } from "react";
2264
2328
 
2265
2329
  // src/ui/base/tooltip.tsx
2266
2330
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
2267
2331
 
2268
2332
  // src/ui/utils/withDefaults.tsx
2269
2333
  import {
2270
- forwardRef as forwardRef15
2334
+ forwardRef as forwardRef16
2271
2335
  } from "react";
2272
2336
  import classNames from "classnames";
2273
- import { jsx as jsx25 } from "react/jsx-runtime";
2337
+ import { jsx as jsx26 } from "react/jsx-runtime";
2274
2338
  var withDefaultProps = ({
2275
2339
  className,
2276
2340
  ...defaultProps
@@ -2283,10 +2347,10 @@ var withDefaultProps = ({
2283
2347
  };
2284
2348
  var withDefaults = (Component, defaultProps) => {
2285
2349
  const getProps = withDefaultProps(defaultProps);
2286
- const WithDefaults = forwardRef15(
2350
+ const WithDefaults = forwardRef16(
2287
2351
  (props, ref) => {
2288
2352
  const ComponentAsAny = Component;
2289
- return /* @__PURE__ */ jsx25(ComponentAsAny, { ...getProps(props), ref });
2353
+ return /* @__PURE__ */ jsx26(ComponentAsAny, { ...getProps(props), ref });
2290
2354
  }
2291
2355
  );
2292
2356
  WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
@@ -2294,9 +2358,9 @@ var withDefaults = (Component, defaultProps) => {
2294
2358
  };
2295
2359
 
2296
2360
  // src/ui/base/tooltip.tsx
2297
- import { jsx as jsx26 } from "react/jsx-runtime";
2361
+ import { jsx as jsx27 } from "react/jsx-runtime";
2298
2362
  var Tooltip = (props) => {
2299
- return /* @__PURE__ */ jsx26(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx26(TooltipPrimitive.Root, { ...props }) });
2363
+ return /* @__PURE__ */ jsx27(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx27(TooltipPrimitive.Root, { ...props }) });
2300
2364
  };
2301
2365
  Tooltip.displayName = "Tooltip";
2302
2366
  var TooltipTrigger = TooltipPrimitive.Trigger;
@@ -2308,9 +2372,9 @@ TooltipContent.displayName = "TooltipContent";
2308
2372
 
2309
2373
  // src/ui/base/button.tsx
2310
2374
  import { cva } from "class-variance-authority";
2311
- import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
2312
- import { forwardRef as forwardRef16 } from "react";
2313
- import { jsx as jsx27 } from "react/jsx-runtime";
2375
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
2376
+ import { forwardRef as forwardRef17 } from "react";
2377
+ import { jsx as jsx28 } from "react/jsx-runtime";
2314
2378
  var buttonVariants = cva("aui-button", {
2315
2379
  variants: {
2316
2380
  variant: {
@@ -2328,10 +2392,10 @@ var buttonVariants = cva("aui-button", {
2328
2392
  size: "default"
2329
2393
  }
2330
2394
  });
2331
- var Button = forwardRef16(
2395
+ var Button = forwardRef17(
2332
2396
  ({ className, variant, size, ...props }, ref) => {
2333
- return /* @__PURE__ */ jsx27(
2334
- Primitive11.button,
2397
+ return /* @__PURE__ */ jsx28(
2398
+ Primitive10.button,
2335
2399
  {
2336
2400
  className: buttonVariants({ variant, size, className }),
2337
2401
  ...props,
@@ -2343,14 +2407,14 @@ var Button = forwardRef16(
2343
2407
  Button.displayName = "Button";
2344
2408
 
2345
2409
  // src/ui/base/tooltip-icon-button.tsx
2346
- import { jsx as jsx28, jsxs as jsxs4 } from "react/jsx-runtime";
2347
- var TooltipIconButton = forwardRef17(({ children, tooltip, side = "bottom", ...rest }, ref) => {
2410
+ import { jsx as jsx29, jsxs as jsxs4 } from "react/jsx-runtime";
2411
+ var TooltipIconButton = forwardRef18(({ children, tooltip, side = "bottom", ...rest }, ref) => {
2348
2412
  return /* @__PURE__ */ jsxs4(Tooltip, { children: [
2349
- /* @__PURE__ */ jsx28(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
2413
+ /* @__PURE__ */ jsx29(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
2350
2414
  children,
2351
- /* @__PURE__ */ jsx28("span", { className: "aui-sr-only", children: tooltip })
2415
+ /* @__PURE__ */ jsx29("span", { className: "aui-sr-only", children: tooltip })
2352
2416
  ] }) }),
2353
- /* @__PURE__ */ jsx28(TooltipContent, { side, children: tooltip })
2417
+ /* @__PURE__ */ jsx29(TooltipContent, { side, children: tooltip })
2354
2418
  ] });
2355
2419
  });
2356
2420
  TooltipIconButton.displayName = "TooltipIconButton";
@@ -2640,7 +2704,7 @@ var toLanguageModelTools = (tools) => {
2640
2704
  };
2641
2705
 
2642
2706
  // src/runtimes/edge/useEdgeRuntime.ts
2643
- import { useState as useState7 } from "react";
2707
+ import { useState as useState8 } from "react";
2644
2708
 
2645
2709
  // src/runtimes/edge/streams/assistantDecoderStream.ts
2646
2710
  function assistantDecoderStream() {
@@ -3380,7 +3444,7 @@ var useEdgeRuntime = ({
3380
3444
  initialMessages,
3381
3445
  ...options
3382
3446
  }) => {
3383
- const [adapter] = useState7(() => new EdgeChatAdapter(options));
3447
+ const [adapter] = useState8(() => new EdgeChatAdapter(options));
3384
3448
  return useLocalRuntime(adapter, { initialMessages });
3385
3449
  };
3386
3450
 
@@ -3594,7 +3658,7 @@ var LocalRuntime = class extends BaseAssistantRuntime {
3594
3658
 
3595
3659
  // src/runtimes/local/useLocalRuntime.tsx
3596
3660
  var useLocalRuntime = (adapter, options) => {
3597
- const [runtime] = useState8(() => new LocalRuntime(adapter, options));
3661
+ const [runtime] = useState9(() => new LocalRuntime(adapter, options));
3598
3662
  useInsertionEffect3(() => {
3599
3663
  runtime.adapter = adapter;
3600
3664
  });
@@ -3602,7 +3666,7 @@ var useLocalRuntime = (adapter, options) => {
3602
3666
  };
3603
3667
 
3604
3668
  // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
3605
- import { create as create14 } from "zustand";
3669
+ import { create as create15 } from "zustand";
3606
3670
 
3607
3671
  // src/runtimes/external-store/getExternalStoreMessage.tsx
3608
3672
  var symbolInnerMessage = Symbol("innerMessage");
@@ -3611,7 +3675,7 @@ var getExternalStoreMessage = (message) => {
3611
3675
  };
3612
3676
 
3613
3677
  // src/runtimes/external-store/useExternalStoreSync.tsx
3614
- import { useEffect as useEffect11, useInsertionEffect as useInsertionEffect4, useMemo as useMemo3, useRef as useRef6 } from "react";
3678
+ import { useEffect as useEffect11, useInsertionEffect as useInsertionEffect4, useMemo as useMemo4, useRef as useRef6 } from "react";
3615
3679
 
3616
3680
  // src/runtimes/external-store/ThreadMessageConverter.ts
3617
3681
  var ThreadMessageConverter = class {
@@ -3709,7 +3773,7 @@ var useExternalStoreSync = (adapter, updateData) => {
3709
3773
  useInsertionEffect4(() => {
3710
3774
  adapterRef.current = adapter;
3711
3775
  });
3712
- const [converter, convertCallback] = useMemo3(() => {
3776
+ const [converter, convertCallback] = useMemo4(() => {
3713
3777
  const converter2 = adapter.convertMessage ?? ((m) => m);
3714
3778
  const convertCallback2 = (cache, m, idx) => {
3715
3779
  const autoStatus = getAutoStatus(
@@ -3756,7 +3820,7 @@ var ExternalStoreThreadRuntime = class {
3756
3820
  store.isRunning ?? false,
3757
3821
  store.messages
3758
3822
  );
3759
- this.useStore = create14(() => ({
3823
+ this.useStore = create15(() => ({
3760
3824
  store
3761
3825
  }));
3762
3826
  }
@@ -3897,9 +3961,9 @@ var ExternalStoreRuntime = class extends BaseAssistantRuntime {
3897
3961
  };
3898
3962
 
3899
3963
  // src/runtimes/external-store/useExternalStoreRuntime.tsx
3900
- import { useEffect as useEffect12, useInsertionEffect as useInsertionEffect5, useState as useState9 } from "react";
3964
+ import { useEffect as useEffect12, useInsertionEffect as useInsertionEffect5, useState as useState10 } from "react";
3901
3965
  var useExternalStoreRuntime = (store) => {
3902
- const [runtime] = useState9(() => new ExternalStoreRuntime(store));
3966
+ const [runtime] = useState10(() => new ExternalStoreRuntime(store));
3903
3967
  useInsertionEffect5(() => {
3904
3968
  runtime.store = store;
3905
3969
  });
@@ -3911,34 +3975,34 @@ var useExternalStoreRuntime = (store) => {
3911
3975
 
3912
3976
  // src/ui/thread-config.tsx
3913
3977
  import {
3914
- createContext as createContext5,
3915
- useContext as useContext5
3978
+ createContext as createContext6,
3979
+ useContext as useContext6
3916
3980
  } from "react";
3917
- import { Fragment as Fragment3, jsx as jsx29 } from "react/jsx-runtime";
3918
- var ThreadConfigContext = createContext5({});
3981
+ import { Fragment as Fragment3, jsx as jsx30 } from "react/jsx-runtime";
3982
+ var ThreadConfigContext = createContext6({});
3919
3983
  var useThreadConfig = () => {
3920
- return useContext5(ThreadConfigContext);
3984
+ return useContext6(ThreadConfigContext);
3921
3985
  };
3922
3986
  var ThreadConfigProvider = ({
3923
3987
  children,
3924
3988
  config
3925
3989
  }) => {
3926
3990
  const assistant = useAssistantContext({ optional: true });
3927
- const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx29(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx29(Fragment3, { children });
3991
+ const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx30(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx30(Fragment3, { children });
3928
3992
  if (!config?.runtime) return configProvider;
3929
3993
  if (assistant) {
3930
3994
  throw new Error(
3931
3995
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
3932
3996
  );
3933
3997
  }
3934
- return /* @__PURE__ */ jsx29(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
3998
+ return /* @__PURE__ */ jsx30(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
3935
3999
  };
3936
4000
  ThreadConfigProvider.displayName = "ThreadConfigProvider";
3937
4001
 
3938
4002
  // src/ui/assistant-action-bar.tsx
3939
- import { forwardRef as forwardRef18 } from "react";
4003
+ import { forwardRef as forwardRef19 } from "react";
3940
4004
  import { CheckIcon, CopyIcon, RefreshCwIcon } from "lucide-react";
3941
- import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs5 } from "react/jsx-runtime";
4005
+ import { Fragment as Fragment4, jsx as jsx31, jsxs as jsxs5 } from "react/jsx-runtime";
3942
4006
  var useAllowCopy = () => {
3943
4007
  const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
3944
4008
  const { useThreadActions } = useThreadContext();
@@ -3962,8 +4026,8 @@ var AssistantActionBar = () => {
3962
4026
  autohide: "not-last",
3963
4027
  autohideFloat: "single-branch",
3964
4028
  children: [
3965
- /* @__PURE__ */ jsx30(AssistantActionBarCopy, {}),
3966
- /* @__PURE__ */ jsx30(AssistantActionBarReload, {})
4029
+ /* @__PURE__ */ jsx31(AssistantActionBarCopy, {}),
4030
+ /* @__PURE__ */ jsx31(AssistantActionBarReload, {})
3967
4031
  ]
3968
4032
  }
3969
4033
  );
@@ -3973,7 +4037,7 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
3973
4037
  className: "aui-assistant-action-bar-root"
3974
4038
  });
3975
4039
  AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
3976
- var AssistantActionBarCopy = forwardRef18((props, ref) => {
4040
+ var AssistantActionBarCopy = forwardRef19((props, ref) => {
3977
4041
  const {
3978
4042
  strings: {
3979
4043
  assistantMessage: { reload: { tooltip = "Copy" } = {} } = {}
@@ -3981,13 +4045,13 @@ var AssistantActionBarCopy = forwardRef18((props, ref) => {
3981
4045
  } = useThreadConfig();
3982
4046
  const allowCopy = useAllowCopy();
3983
4047
  if (!allowCopy) return null;
3984
- return /* @__PURE__ */ jsx30(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx30(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
3985
- /* @__PURE__ */ jsx30(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx30(CheckIcon, {}) }),
3986
- /* @__PURE__ */ jsx30(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx30(CopyIcon, {}) })
4048
+ return /* @__PURE__ */ jsx31(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
4049
+ /* @__PURE__ */ jsx31(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx31(CheckIcon, {}) }),
4050
+ /* @__PURE__ */ jsx31(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx31(CopyIcon, {}) })
3987
4051
  ] }) }) });
3988
4052
  });
3989
4053
  AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
3990
- var AssistantActionBarReload = forwardRef18((props, ref) => {
4054
+ var AssistantActionBarReload = forwardRef19((props, ref) => {
3991
4055
  const {
3992
4056
  strings: {
3993
4057
  assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
@@ -3995,7 +4059,7 @@ var AssistantActionBarReload = forwardRef18((props, ref) => {
3995
4059
  } = useThreadConfig();
3996
4060
  const allowReload = useAllowReload();
3997
4061
  if (!allowReload) return null;
3998
- return /* @__PURE__ */ jsx30(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ jsx30(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx30(RefreshCwIcon, {}) }) });
4062
+ return /* @__PURE__ */ jsx31(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx31(RefreshCwIcon, {}) }) });
3999
4063
  });
4000
4064
  AssistantActionBarReload.displayName = "AssistantActionBarReload";
4001
4065
  var exports = {
@@ -4009,12 +4073,12 @@ var assistant_action_bar_default = Object.assign(
4009
4073
  );
4010
4074
 
4011
4075
  // src/ui/assistant-message.tsx
4012
- import { forwardRef as forwardRef20 } from "react";
4076
+ import { forwardRef as forwardRef21 } from "react";
4013
4077
 
4014
4078
  // src/ui/branch-picker.tsx
4015
- import { forwardRef as forwardRef19 } from "react";
4079
+ import { forwardRef as forwardRef20 } from "react";
4016
4080
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
4017
- import { jsx as jsx31, jsxs as jsxs6 } from "react/jsx-runtime";
4081
+ import { jsx as jsx32, jsxs as jsxs6 } from "react/jsx-runtime";
4018
4082
  var useAllowBranchPicker = () => {
4019
4083
  const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
4020
4084
  const { useThreadActions } = useThreadContext();
@@ -4025,9 +4089,9 @@ var BranchPicker = () => {
4025
4089
  const allowBranchPicker = useAllowBranchPicker();
4026
4090
  if (!allowBranchPicker) return null;
4027
4091
  return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
4028
- /* @__PURE__ */ jsx31(BranchPickerPrevious2, {}),
4029
- /* @__PURE__ */ jsx31(BranchPickerState, {}),
4030
- /* @__PURE__ */ jsx31(BranchPickerNext, {})
4092
+ /* @__PURE__ */ jsx32(BranchPickerPrevious2, {}),
4093
+ /* @__PURE__ */ jsx32(BranchPickerState, {}),
4094
+ /* @__PURE__ */ jsx32(BranchPickerNext, {})
4031
4095
  ] });
4032
4096
  };
4033
4097
  BranchPicker.displayName = "BranchPicker";
@@ -4035,31 +4099,31 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
4035
4099
  className: "aui-branch-picker-root"
4036
4100
  });
4037
4101
  BranchPickerRoot.displayName = "BranchPickerRoot";
4038
- var BranchPickerPrevious2 = forwardRef19((props, ref) => {
4102
+ var BranchPickerPrevious2 = forwardRef20((props, ref) => {
4039
4103
  const {
4040
4104
  strings: {
4041
4105
  branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
4042
4106
  } = {}
4043
4107
  } = useThreadConfig();
4044
- return /* @__PURE__ */ jsx31(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx31(ChevronLeftIcon, {}) }) });
4108
+ return /* @__PURE__ */ jsx32(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronLeftIcon, {}) }) });
4045
4109
  });
4046
4110
  BranchPickerPrevious2.displayName = "BranchPickerPrevious";
4047
4111
  var BranchPickerStateWrapper = withDefaults("span", {
4048
4112
  className: "aui-branch-picker-state"
4049
4113
  });
4050
- var BranchPickerState = forwardRef19((props, ref) => {
4114
+ var BranchPickerState = forwardRef20((props, ref) => {
4051
4115
  return /* @__PURE__ */ jsxs6(BranchPickerStateWrapper, { ...props, ref, children: [
4052
- /* @__PURE__ */ jsx31(branchPicker_exports.Number, {}),
4116
+ /* @__PURE__ */ jsx32(branchPicker_exports.Number, {}),
4053
4117
  " / ",
4054
- /* @__PURE__ */ jsx31(branchPicker_exports.Count, {})
4118
+ /* @__PURE__ */ jsx32(branchPicker_exports.Count, {})
4055
4119
  ] });
4056
4120
  });
4057
4121
  BranchPickerState.displayName = "BranchPickerState";
4058
- var BranchPickerNext = forwardRef19((props, ref) => {
4122
+ var BranchPickerNext = forwardRef20((props, ref) => {
4059
4123
  const {
4060
4124
  strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
4061
4125
  } = useThreadConfig();
4062
- return /* @__PURE__ */ jsx31(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx31(ChevronRightIcon, {}) }) });
4126
+ return /* @__PURE__ */ jsx32(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronRightIcon, {}) }) });
4063
4127
  });
4064
4128
  BranchPickerNext.displayName = "BranchPickerNext";
4065
4129
  var exports2 = {
@@ -4071,12 +4135,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
4071
4135
 
4072
4136
  // src/ui/base/avatar.tsx
4073
4137
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
4074
- import { jsx as jsx32, jsxs as jsxs7 } from "react/jsx-runtime";
4138
+ import { jsx as jsx33, jsxs as jsxs7 } from "react/jsx-runtime";
4075
4139
  var Avatar = ({ src, alt, fallback }) => {
4076
4140
  if (src == null && fallback == null) return null;
4077
4141
  return /* @__PURE__ */ jsxs7(AvatarRoot, { children: [
4078
- src != null && /* @__PURE__ */ jsx32(AvatarImage, { src, alt }),
4079
- fallback != null && /* @__PURE__ */ jsx32(AvatarFallback, { children: fallback })
4142
+ src != null && /* @__PURE__ */ jsx33(AvatarImage, { src, alt }),
4143
+ fallback != null && /* @__PURE__ */ jsx33(AvatarFallback, { children: fallback })
4080
4144
  ] });
4081
4145
  };
4082
4146
  Avatar.displayName = "Avatar";
@@ -4095,36 +4159,37 @@ AvatarFallback.displayName = "AvatarFallback";
4095
4159
 
4096
4160
  // src/ui/content-part.tsx
4097
4161
  import classNames2 from "classnames";
4098
- import { jsx as jsx33 } from "react/jsx-runtime";
4099
- var Text = ({ status }) => {
4100
- return /* @__PURE__ */ jsx33(
4101
- "p",
4162
+ import { jsx as jsx34 } from "react/jsx-runtime";
4163
+ var Text = () => {
4164
+ const status = useSmoothStatus();
4165
+ return /* @__PURE__ */ jsx34(
4166
+ contentPart_exports.Text,
4102
4167
  {
4103
4168
  className: classNames2(
4104
4169
  "aui-text",
4105
- status.type === "running" && "aui-text-in-progress"
4170
+ status.type === "running" && "aui-text-running"
4106
4171
  ),
4107
- children: /* @__PURE__ */ jsx33(contentPart_exports.Text, {})
4172
+ component: "p"
4108
4173
  }
4109
4174
  );
4110
4175
  };
4111
- var exports3 = { Text };
4176
+ var exports3 = { Text: withSmoothContextProvider(Text) };
4112
4177
  var content_part_default = exports3;
4113
4178
 
4114
4179
  // src/ui/assistant-message.tsx
4115
- import { jsx as jsx34, jsxs as jsxs8 } from "react/jsx-runtime";
4180
+ import { jsx as jsx35, jsxs as jsxs8 } from "react/jsx-runtime";
4116
4181
  var AssistantMessage = () => {
4117
4182
  return /* @__PURE__ */ jsxs8(AssistantMessageRoot, { children: [
4118
- /* @__PURE__ */ jsx34(AssistantMessageAvatar, {}),
4119
- /* @__PURE__ */ jsx34(AssistantMessageContent, {}),
4120
- /* @__PURE__ */ jsx34(branch_picker_default, {}),
4121
- /* @__PURE__ */ jsx34(assistant_action_bar_default, {})
4183
+ /* @__PURE__ */ jsx35(AssistantMessageAvatar, {}),
4184
+ /* @__PURE__ */ jsx35(AssistantMessageContent, {}),
4185
+ /* @__PURE__ */ jsx35(branch_picker_default, {}),
4186
+ /* @__PURE__ */ jsx35(assistant_action_bar_default, {})
4122
4187
  ] });
4123
4188
  };
4124
4189
  AssistantMessage.displayName = "AssistantMessage";
4125
4190
  var AssistantMessageAvatar = () => {
4126
4191
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4127
- return /* @__PURE__ */ jsx34(Avatar, { ...avatar });
4192
+ return /* @__PURE__ */ jsx35(Avatar, { ...avatar });
4128
4193
  };
4129
4194
  var AssistantMessageRoot = withDefaults(message_exports.Root, {
4130
4195
  className: "aui-assistant-message-root"
@@ -4133,9 +4198,9 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
4133
4198
  var AssistantMessageContentWrapper = withDefaults("div", {
4134
4199
  className: "aui-assistant-message-content"
4135
4200
  });
4136
- var AssistantMessageContent = forwardRef20(({ components: componentsProp, ...rest }, ref) => {
4201
+ var AssistantMessageContent = forwardRef21(({ components: componentsProp, ...rest }, ref) => {
4137
4202
  const { assistantMessage: { components = {} } = {} } = useThreadConfig();
4138
- return /* @__PURE__ */ jsx34(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx34(
4203
+ return /* @__PURE__ */ jsx35(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx35(
4139
4204
  message_exports.Content,
4140
4205
  {
4141
4206
  components: {
@@ -4157,38 +4222,38 @@ var assistant_message_default = Object.assign(
4157
4222
  );
4158
4223
 
4159
4224
  // src/ui/assistant-modal.tsx
4160
- import { forwardRef as forwardRef27 } from "react";
4225
+ import { forwardRef as forwardRef28 } from "react";
4161
4226
  import { BotIcon, ChevronDownIcon } from "lucide-react";
4162
4227
 
4163
4228
  // src/ui/thread.tsx
4164
- import { forwardRef as forwardRef26 } from "react";
4229
+ import { forwardRef as forwardRef27 } from "react";
4165
4230
  import { ArrowDownIcon } from "lucide-react";
4166
4231
 
4167
4232
  // src/ui/composer.tsx
4168
- import { forwardRef as forwardRef21 } from "react";
4233
+ import { forwardRef as forwardRef22 } from "react";
4169
4234
  import { SendHorizontalIcon } from "lucide-react";
4170
4235
 
4171
4236
  // src/ui/base/CircleStopIcon.tsx
4172
- import { jsx as jsx35 } from "react/jsx-runtime";
4237
+ import { jsx as jsx36 } from "react/jsx-runtime";
4173
4238
  var CircleStopIcon = () => {
4174
- return /* @__PURE__ */ jsx35(
4239
+ return /* @__PURE__ */ jsx36(
4175
4240
  "svg",
4176
4241
  {
4177
4242
  xmlns: "http://www.w3.org/2000/svg",
4178
4243
  viewBox: "0 0 16 16",
4179
4244
  fill: "currentColor",
4180
- children: /* @__PURE__ */ jsx35("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
4245
+ children: /* @__PURE__ */ jsx36("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
4181
4246
  }
4182
4247
  );
4183
4248
  };
4184
4249
  CircleStopIcon.displayName = "CircleStopIcon";
4185
4250
 
4186
4251
  // src/ui/composer.tsx
4187
- import { Fragment as Fragment5, jsx as jsx36, jsxs as jsxs9 } from "react/jsx-runtime";
4252
+ import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs9 } from "react/jsx-runtime";
4188
4253
  var Composer = () => {
4189
4254
  return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
4190
- /* @__PURE__ */ jsx36(ComposerInput, { autoFocus: true }),
4191
- /* @__PURE__ */ jsx36(ComposerAction, {})
4255
+ /* @__PURE__ */ jsx37(ComposerInput, { autoFocus: true }),
4256
+ /* @__PURE__ */ jsx37(ComposerAction, {})
4192
4257
  ] });
4193
4258
  };
4194
4259
  Composer.displayName = "Composer";
@@ -4201,14 +4266,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
4201
4266
  autoFocus: true,
4202
4267
  className: "aui-composer-input"
4203
4268
  });
4204
- var ComposerInput = forwardRef21(
4269
+ var ComposerInput = forwardRef22(
4205
4270
  (props, ref) => {
4206
4271
  const {
4207
4272
  strings: {
4208
4273
  composer: { input: { placeholder = "Write a message..." } = {} } = {}
4209
4274
  } = {}
4210
4275
  } = useThreadConfig();
4211
- return /* @__PURE__ */ jsx36(ComposerInputStyled, { placeholder, ...props, ref });
4276
+ return /* @__PURE__ */ jsx37(ComposerInputStyled, { placeholder, ...props, ref });
4212
4277
  }
4213
4278
  );
4214
4279
  ComposerInput.displayName = "ComposerInput";
@@ -4219,10 +4284,10 @@ var useAllowCancel = () => {
4219
4284
  };
4220
4285
  var ComposerAction = () => {
4221
4286
  const allowCancel = useAllowCancel();
4222
- if (!allowCancel) return /* @__PURE__ */ jsx36(ComposerSend, {});
4287
+ if (!allowCancel) return /* @__PURE__ */ jsx37(ComposerSend, {});
4223
4288
  return /* @__PURE__ */ jsxs9(Fragment5, { children: [
4224
- /* @__PURE__ */ jsx36(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx36(ComposerSend, {}) }),
4225
- /* @__PURE__ */ jsx36(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx36(ComposerCancel, {}) })
4289
+ /* @__PURE__ */ jsx37(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx37(ComposerSend, {}) }),
4290
+ /* @__PURE__ */ jsx37(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx37(ComposerCancel, {}) })
4226
4291
  ] });
4227
4292
  };
4228
4293
  ComposerAction.displayName = "ComposerAction";
@@ -4230,22 +4295,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
4230
4295
  variant: "default",
4231
4296
  className: "aui-composer-send"
4232
4297
  });
4233
- var ComposerSend = forwardRef21((props, ref) => {
4298
+ var ComposerSend = forwardRef22((props, ref) => {
4234
4299
  const {
4235
4300
  strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
4236
4301
  } = useThreadConfig();
4237
- return /* @__PURE__ */ jsx36(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx36(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(SendHorizontalIcon, {}) }) });
4302
+ return /* @__PURE__ */ jsx37(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(SendHorizontalIcon, {}) }) });
4238
4303
  });
4239
4304
  ComposerSend.displayName = "ComposerSend";
4240
4305
  var ComposerCancelButton = withDefaults(TooltipIconButton, {
4241
4306
  variant: "default",
4242
4307
  className: "aui-composer-cancel"
4243
4308
  });
4244
- var ComposerCancel = forwardRef21((props, ref) => {
4309
+ var ComposerCancel = forwardRef22((props, ref) => {
4245
4310
  const {
4246
4311
  strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
4247
4312
  } = useThreadConfig();
4248
- return /* @__PURE__ */ jsx36(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx36(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx36(CircleStopIcon, {}) }) });
4313
+ return /* @__PURE__ */ jsx37(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(CircleStopIcon, {}) }) });
4249
4314
  });
4250
4315
  ComposerCancel.displayName = "ComposerCancel";
4251
4316
  var exports5 = {
@@ -4258,15 +4323,15 @@ var exports5 = {
4258
4323
  var composer_default = Object.assign(Composer, exports5);
4259
4324
 
4260
4325
  // src/ui/thread-welcome.tsx
4261
- import { forwardRef as forwardRef22 } from "react";
4262
- import { jsx as jsx37, jsxs as jsxs10 } from "react/jsx-runtime";
4326
+ import { forwardRef as forwardRef23 } from "react";
4327
+ import { jsx as jsx38, jsxs as jsxs10 } from "react/jsx-runtime";
4263
4328
  var ThreadWelcome = () => {
4264
4329
  return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
4265
4330
  /* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
4266
- /* @__PURE__ */ jsx37(ThreadWelcomeAvatar, {}),
4267
- /* @__PURE__ */ jsx37(ThreadWelcomeMessage, {})
4331
+ /* @__PURE__ */ jsx38(ThreadWelcomeAvatar, {}),
4332
+ /* @__PURE__ */ jsx38(ThreadWelcomeMessage, {})
4268
4333
  ] }),
4269
- /* @__PURE__ */ jsx37(ThreadWelcomeSuggestions, {})
4334
+ /* @__PURE__ */ jsx38(ThreadWelcomeSuggestions, {})
4270
4335
  ] });
4271
4336
  };
4272
4337
  ThreadWelcome.displayName = "ThreadWelcome";
@@ -4276,22 +4341,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
4276
4341
  var ThreadWelcomeCenter = withDefaults("div", {
4277
4342
  className: "aui-thread-welcome-center"
4278
4343
  });
4279
- var ThreadWelcomeRoot = forwardRef22(
4344
+ var ThreadWelcomeRoot = forwardRef23(
4280
4345
  (props, ref) => {
4281
- return /* @__PURE__ */ jsx37(thread_exports.Empty, { children: /* @__PURE__ */ jsx37(ThreadWelcomeRootStyled, { ...props, ref }) });
4346
+ return /* @__PURE__ */ jsx38(thread_exports.Empty, { children: /* @__PURE__ */ jsx38(ThreadWelcomeRootStyled, { ...props, ref }) });
4282
4347
  }
4283
4348
  );
4284
4349
  ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
4285
4350
  var ThreadWelcomeAvatar = () => {
4286
4351
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4287
- return /* @__PURE__ */ jsx37(Avatar, { ...avatar });
4352
+ return /* @__PURE__ */ jsx38(Avatar, { ...avatar });
4288
4353
  };
4289
4354
  var ThreadWelcomeMessageStyled = withDefaults("p", {
4290
4355
  className: "aui-thread-welcome-message"
4291
4356
  });
4292
- var ThreadWelcomeMessage = forwardRef22(({ message: messageProp, ...rest }, ref) => {
4357
+ var ThreadWelcomeMessage = forwardRef23(({ message: messageProp, ...rest }, ref) => {
4293
4358
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
4294
- return /* @__PURE__ */ jsx37(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
4359
+ return /* @__PURE__ */ jsx38(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
4295
4360
  });
4296
4361
  ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
4297
4362
  var ThreadWelcomeSuggestionContainer = withDefaults("div", {
@@ -4303,21 +4368,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
4303
4368
  var ThreadWelcomeSuggestion = ({
4304
4369
  suggestion: { text, prompt }
4305
4370
  }) => {
4306
- return /* @__PURE__ */ jsx37(
4371
+ return /* @__PURE__ */ jsx38(
4307
4372
  ThreadWelcomeSuggestionStyled,
4308
4373
  {
4309
4374
  prompt,
4310
4375
  method: "replace",
4311
4376
  autoSend: true,
4312
- children: /* @__PURE__ */ jsx37("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
4377
+ children: /* @__PURE__ */ jsx38("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
4313
4378
  }
4314
4379
  );
4315
4380
  };
4316
4381
  var ThreadWelcomeSuggestions = () => {
4317
4382
  const { welcome: { suggestions } = {} } = useThreadConfig();
4318
- return /* @__PURE__ */ jsx37(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
4383
+ return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
4319
4384
  const key = `${suggestion.prompt}-${idx}`;
4320
- return /* @__PURE__ */ jsx37(ThreadWelcomeSuggestion, { suggestion }, key);
4385
+ return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestion, { suggestion }, key);
4321
4386
  }) });
4322
4387
  };
4323
4388
  ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
@@ -4332,12 +4397,12 @@ var exports6 = {
4332
4397
  var thread_welcome_default = Object.assign(ThreadWelcome, exports6);
4333
4398
 
4334
4399
  // src/ui/user-message.tsx
4335
- import { forwardRef as forwardRef24 } from "react";
4400
+ import { forwardRef as forwardRef25 } from "react";
4336
4401
 
4337
4402
  // src/ui/user-action-bar.tsx
4338
- import { forwardRef as forwardRef23 } from "react";
4403
+ import { forwardRef as forwardRef24 } from "react";
4339
4404
  import { PencilIcon } from "lucide-react";
4340
- import { jsx as jsx38 } from "react/jsx-runtime";
4405
+ import { jsx as jsx39 } from "react/jsx-runtime";
4341
4406
  var useAllowEdit = () => {
4342
4407
  const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
4343
4408
  const { useThreadActions } = useThreadContext();
@@ -4347,20 +4412,20 @@ var useAllowEdit = () => {
4347
4412
  var UserActionBar = () => {
4348
4413
  const allowEdit = useAllowEdit();
4349
4414
  if (!allowEdit) return null;
4350
- return /* @__PURE__ */ jsx38(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx38(UserActionBarEdit, {}) });
4415
+ return /* @__PURE__ */ jsx39(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx39(UserActionBarEdit, {}) });
4351
4416
  };
4352
4417
  UserActionBar.displayName = "UserActionBar";
4353
4418
  var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
4354
4419
  className: "aui-user-action-bar-root"
4355
4420
  });
4356
4421
  UserActionBarRoot.displayName = "UserActionBarRoot";
4357
- var UserActionBarEdit = forwardRef23((props, ref) => {
4422
+ var UserActionBarEdit = forwardRef24((props, ref) => {
4358
4423
  const {
4359
4424
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
4360
4425
  } = useThreadConfig();
4361
4426
  const allowEdit = useAllowEdit();
4362
4427
  if (!allowEdit) return null;
4363
- return /* @__PURE__ */ jsx38(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ jsx38(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx38(PencilIcon, {}) }) });
4428
+ return /* @__PURE__ */ jsx39(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(PencilIcon, {}) }) });
4364
4429
  });
4365
4430
  UserActionBarEdit.displayName = "UserActionBarEdit";
4366
4431
  var exports7 = {
@@ -4370,12 +4435,12 @@ var exports7 = {
4370
4435
  var user_action_bar_default = Object.assign(UserActionBar, exports7);
4371
4436
 
4372
4437
  // src/ui/user-message.tsx
4373
- import { jsx as jsx39, jsxs as jsxs11 } from "react/jsx-runtime";
4438
+ import { jsx as jsx40, jsxs as jsxs11 } from "react/jsx-runtime";
4374
4439
  var UserMessage = () => {
4375
4440
  return /* @__PURE__ */ jsxs11(UserMessageRoot, { children: [
4376
- /* @__PURE__ */ jsx39(user_action_bar_default, {}),
4377
- /* @__PURE__ */ jsx39(UserMessageContent, {}),
4378
- /* @__PURE__ */ jsx39(branch_picker_default, {})
4441
+ /* @__PURE__ */ jsx40(user_action_bar_default, {}),
4442
+ /* @__PURE__ */ jsx40(UserMessageContent, {}),
4443
+ /* @__PURE__ */ jsx40(branch_picker_default, {})
4379
4444
  ] });
4380
4445
  };
4381
4446
  UserMessage.displayName = "UserMessage";
@@ -4386,9 +4451,9 @@ UserMessageRoot.displayName = "UserMessageRoot";
4386
4451
  var UserMessageContentWrapper = withDefaults("div", {
4387
4452
  className: "aui-user-message-content"
4388
4453
  });
4389
- var UserMessageContent = forwardRef24(
4454
+ var UserMessageContent = forwardRef25(
4390
4455
  ({ components, ...props }, ref) => {
4391
- return /* @__PURE__ */ jsx39(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx39(
4456
+ return /* @__PURE__ */ jsx40(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx40(
4392
4457
  message_exports.Content,
4393
4458
  {
4394
4459
  components: {
@@ -4407,14 +4472,14 @@ var exports8 = {
4407
4472
  var user_message_default = Object.assign(UserMessage, exports8);
4408
4473
 
4409
4474
  // src/ui/edit-composer.tsx
4410
- import { forwardRef as forwardRef25 } from "react";
4411
- import { jsx as jsx40, jsxs as jsxs12 } from "react/jsx-runtime";
4475
+ import { forwardRef as forwardRef26 } from "react";
4476
+ import { jsx as jsx41, jsxs as jsxs12 } from "react/jsx-runtime";
4412
4477
  var EditComposer = () => {
4413
4478
  return /* @__PURE__ */ jsxs12(EditComposerRoot, { children: [
4414
- /* @__PURE__ */ jsx40(EditComposerInput, {}),
4479
+ /* @__PURE__ */ jsx41(EditComposerInput, {}),
4415
4480
  /* @__PURE__ */ jsxs12(EditComposerFooter, { children: [
4416
- /* @__PURE__ */ jsx40(EditComposerCancel, {}),
4417
- /* @__PURE__ */ jsx40(EditComposerSend, {})
4481
+ /* @__PURE__ */ jsx41(EditComposerCancel, {}),
4482
+ /* @__PURE__ */ jsx41(EditComposerSend, {})
4418
4483
  ] })
4419
4484
  ] });
4420
4485
  };
@@ -4431,23 +4496,23 @@ var EditComposerFooter = withDefaults("div", {
4431
4496
  className: "aui-edit-composer-footer"
4432
4497
  });
4433
4498
  EditComposerFooter.displayName = "EditComposerFooter";
4434
- var EditComposerCancel = forwardRef25(
4499
+ var EditComposerCancel = forwardRef26(
4435
4500
  (props, ref) => {
4436
4501
  const {
4437
4502
  strings: {
4438
4503
  editComposer: { cancel: { label = "Cancel" } = {} } = {}
4439
4504
  } = {}
4440
4505
  } = useThreadConfig();
4441
- return /* @__PURE__ */ jsx40(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx40(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4506
+ return /* @__PURE__ */ jsx41(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4442
4507
  }
4443
4508
  );
4444
4509
  EditComposerCancel.displayName = "EditComposerCancel";
4445
- var EditComposerSend = forwardRef25(
4510
+ var EditComposerSend = forwardRef26(
4446
4511
  (props, ref) => {
4447
4512
  const {
4448
4513
  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
4449
4514
  } = useThreadConfig();
4450
- return /* @__PURE__ */ jsx40(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx40(Button, { ...props, ref, children: props.children ?? label }) });
4515
+ return /* @__PURE__ */ jsx41(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { ...props, ref, children: props.children ?? label }) });
4451
4516
  }
4452
4517
  );
4453
4518
  EditComposerSend.displayName = "EditComposerSend";
@@ -4461,23 +4526,23 @@ var exports9 = {
4461
4526
  var edit_composer_default = Object.assign(EditComposer, exports9);
4462
4527
 
4463
4528
  // src/ui/thread.tsx
4464
- import { jsx as jsx41, jsxs as jsxs13 } from "react/jsx-runtime";
4529
+ import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
4465
4530
  var Thread = (config) => {
4466
- return /* @__PURE__ */ jsx41(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
4467
- /* @__PURE__ */ jsx41(thread_welcome_default, {}),
4468
- /* @__PURE__ */ jsx41(ThreadMessages, {}),
4531
+ return /* @__PURE__ */ jsx42(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
4532
+ /* @__PURE__ */ jsx42(thread_welcome_default, {}),
4533
+ /* @__PURE__ */ jsx42(ThreadMessages, {}),
4469
4534
  /* @__PURE__ */ jsxs13(ThreadViewportFooter, { children: [
4470
- /* @__PURE__ */ jsx41(ThreadScrollToBottom, {}),
4471
- /* @__PURE__ */ jsx41(composer_default, {})
4535
+ /* @__PURE__ */ jsx42(ThreadScrollToBottom, {}),
4536
+ /* @__PURE__ */ jsx42(composer_default, {})
4472
4537
  ] })
4473
4538
  ] }) });
4474
4539
  };
4475
4540
  var ThreadRootStyled = withDefaults(thread_exports.Root, {
4476
4541
  className: "aui-root aui-thread-root"
4477
4542
  });
4478
- var ThreadRoot = forwardRef26(
4543
+ var ThreadRoot = forwardRef27(
4479
4544
  ({ config, ...props }, ref) => {
4480
- return /* @__PURE__ */ jsx41(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx41(ThreadRootStyled, { ...props, ref }) });
4545
+ return /* @__PURE__ */ jsx42(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx42(ThreadRootStyled, { ...props, ref }) });
4481
4546
  }
4482
4547
  );
4483
4548
  ThreadRoot.displayName = "ThreadRoot";
@@ -4491,7 +4556,7 @@ var ThreadViewportFooter = withDefaults("div", {
4491
4556
  ThreadViewportFooter.displayName = "ThreadViewportFooter";
4492
4557
  var SystemMessage = () => null;
4493
4558
  var ThreadMessages = ({ components, ...rest }) => {
4494
- return /* @__PURE__ */ jsx41(
4559
+ return /* @__PURE__ */ jsx42(
4495
4560
  thread_exports.Messages,
4496
4561
  {
4497
4562
  components: {
@@ -4509,13 +4574,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
4509
4574
  variant: "outline",
4510
4575
  className: "aui-thread-scroll-to-bottom"
4511
4576
  });
4512
- var ThreadScrollToBottom = forwardRef26((props, ref) => {
4577
+ var ThreadScrollToBottom = forwardRef27((props, ref) => {
4513
4578
  const {
4514
4579
  strings: {
4515
4580
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
4516
4581
  } = {}
4517
4582
  } = useThreadConfig();
4518
- return /* @__PURE__ */ jsx41(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx41(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx41(ArrowDownIcon, {}) }) });
4583
+ return /* @__PURE__ */ jsx42(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx42(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx42(ArrowDownIcon, {}) }) });
4519
4584
  });
4520
4585
  ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
4521
4586
  var exports10 = {
@@ -4528,20 +4593,20 @@ var exports10 = {
4528
4593
  var thread_default = Object.assign(Thread, exports10);
4529
4594
 
4530
4595
  // src/ui/assistant-modal.tsx
4531
- import { Fragment as Fragment6, jsx as jsx42, jsxs as jsxs14 } from "react/jsx-runtime";
4596
+ import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs14 } from "react/jsx-runtime";
4532
4597
  var AssistantModal = (config) => {
4533
4598
  return /* @__PURE__ */ jsxs14(AssistantModalRoot, { config, children: [
4534
- /* @__PURE__ */ jsx42(AssistantModalTrigger, {}),
4535
- /* @__PURE__ */ jsx42(AssistantModalContent, { children: /* @__PURE__ */ jsx42(thread_default, {}) })
4599
+ /* @__PURE__ */ jsx43(AssistantModalTrigger, {}),
4600
+ /* @__PURE__ */ jsx43(AssistantModalContent, { children: /* @__PURE__ */ jsx43(thread_default, {}) })
4536
4601
  ] });
4537
4602
  };
4538
4603
  AssistantModal.displayName = "AssistantModal";
4539
4604
  var AssistantModalRoot = ({ config, ...props }) => {
4540
- return /* @__PURE__ */ jsx42(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx42(assistantModal_exports.Root, { ...props }) });
4605
+ return /* @__PURE__ */ jsx43(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx43(assistantModal_exports.Root, { ...props }) });
4541
4606
  };
4542
4607
  AssistantModalRoot.displayName = "AssistantModalRoot";
4543
- var AssistantModalTrigger = forwardRef27((props, ref) => {
4544
- return /* @__PURE__ */ jsx42(AssistantModalAnchor, { children: /* @__PURE__ */ jsx42(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx42(AssistantModalButton, { ...props, ref }) }) });
4608
+ var AssistantModalTrigger = forwardRef28((props, ref) => {
4609
+ return /* @__PURE__ */ jsx43(AssistantModalAnchor, { children: /* @__PURE__ */ jsx43(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx43(AssistantModalButton, { ...props, ref }) }) });
4545
4610
  });
4546
4611
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
4547
4612
  var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
@@ -4552,7 +4617,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
4552
4617
  variant: "default",
4553
4618
  className: "aui-modal-button"
4554
4619
  });
4555
- var AssistantModalButton = forwardRef27(({ "data-state": state, ...rest }, ref) => {
4620
+ var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref) => {
4556
4621
  const {
4557
4622
  strings: {
4558
4623
  assistantModal: {
@@ -4566,7 +4631,7 @@ var AssistantModalButton = forwardRef27(({ "data-state": state, ...rest }, ref)
4566
4631
  } = {}
4567
4632
  } = useThreadConfig();
4568
4633
  const tooltip = state === "open" ? openTooltip : closedTooltip;
4569
- return /* @__PURE__ */ jsx42(
4634
+ return /* @__PURE__ */ jsx43(
4570
4635
  ModalButtonStyled,
4571
4636
  {
4572
4637
  side: "left",
@@ -4575,14 +4640,14 @@ var AssistantModalButton = forwardRef27(({ "data-state": state, ...rest }, ref)
4575
4640
  ...rest,
4576
4641
  ref,
4577
4642
  children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment6, { children: [
4578
- /* @__PURE__ */ jsx42(
4643
+ /* @__PURE__ */ jsx43(
4579
4644
  BotIcon,
4580
4645
  {
4581
4646
  "data-state": state,
4582
4647
  className: "aui-modal-button-closed-icon"
4583
4648
  }
4584
4649
  ),
4585
- /* @__PURE__ */ jsx42(
4650
+ /* @__PURE__ */ jsx43(
4586
4651
  ChevronDownIcon,
4587
4652
  {
4588
4653
  "data-state": state,