@assistant-ui/react 0.5.18 → 0.5.20

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1213,8 +1213,8 @@ var BranchPickerPrimitiveNumber = () => {
1213
1213
  BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
1214
1214
 
1215
1215
  // src/primitives/branchPicker/BranchPickerRoot.tsx
1216
- var import_react_primitive6 = require("@radix-ui/react-primitive");
1217
- var import_react39 = require("react");
1216
+ var import_react_primitive5 = require("@radix-ui/react-primitive");
1217
+ var import_react40 = require("react");
1218
1218
 
1219
1219
  // src/primitives/message/index.ts
1220
1220
  var message_exports = {};
@@ -1253,9 +1253,9 @@ var useIsHoveringRef = () => {
1253
1253
  );
1254
1254
  return useManagedRef(callbackRef);
1255
1255
  };
1256
- var MessagePrimitiveRoot = (0, import_react33.forwardRef)(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef28) => {
1256
+ var MessagePrimitiveRoot = (0, import_react33.forwardRef)(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef29) => {
1257
1257
  const isHoveringRef = useIsHoveringRef();
1258
- const ref = (0, import_react_compose_refs.useComposedRefs)(forwardRef28, isHoveringRef);
1258
+ const ref = (0, import_react_compose_refs.useComposedRefs)(forwardRef29, isHoveringRef);
1259
1259
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_primitive3.Primitive.div, { ...rest, ref });
1260
1260
  });
1261
1261
  MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
@@ -1271,7 +1271,7 @@ var MessagePrimitiveIf = ({
1271
1271
  MessagePrimitiveIf.displayName = "MessagePrimitive.If";
1272
1272
 
1273
1273
  // src/primitives/message/MessageContent.tsx
1274
- var import_react38 = require("react");
1274
+ var import_react39 = require("react");
1275
1275
 
1276
1276
  // src/context/providers/ContentPartProvider.tsx
1277
1277
  var import_react34 = require("react");
@@ -1317,7 +1317,6 @@ var useContentPartContext2 = (partIndex) => {
1317
1317
  const useContentPart = (0, import_zustand10.create)(
1318
1318
  () => getContentPartState(useMessage.getState(), void 0, partIndex)
1319
1319
  );
1320
- getContentPartState(useMessage.getState(), useContentPart, partIndex);
1321
1320
  return { useContentPart };
1322
1321
  });
1323
1322
  (0, import_react34.useEffect)(() => {
@@ -1344,11 +1343,51 @@ var ContentPartProvider = ({
1344
1343
  };
1345
1344
 
1346
1345
  // src/primitives/contentPart/ContentPartText.tsx
1347
- var import_react_primitive4 = require("@radix-ui/react-primitive");
1346
+ var import_react37 = require("react");
1347
+
1348
+ // src/utils/smooth/useSmooth.tsx
1348
1349
  var import_react36 = require("react");
1349
1350
 
1350
- // src/utils/hooks/useSmooth.tsx
1351
+ // src/utils/smooth/SmoothContext.tsx
1351
1352
  var import_react35 = require("react");
1353
+ var import_zustand11 = require("zustand");
1354
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1355
+ var SmoothContext = (0, import_react35.createContext)(null);
1356
+ var makeSmoothContext = (initialState) => {
1357
+ const useSmoothStatus2 = (0, import_zustand11.create)(() => initialState);
1358
+ return { useSmoothStatus: useSmoothStatus2 };
1359
+ };
1360
+ var SmoothContextProvider = ({ children }) => {
1361
+ const outer = useSmoothContext({ optional: true });
1362
+ const { useContentPart } = useContentPartContext();
1363
+ const [context] = (0, import_react35.useState)(
1364
+ () => makeSmoothContext(useContentPart.getState().status)
1365
+ );
1366
+ if (outer) return children;
1367
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SmoothContext.Provider, { value: context, children });
1368
+ };
1369
+ var withSmoothContextProvider = (Component) => {
1370
+ const Wrapped = (0, import_react35.forwardRef)((props, ref) => {
1371
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SmoothContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Component, { ...props, ref }) });
1372
+ });
1373
+ Wrapped.displayName = Component.displayName;
1374
+ return Wrapped;
1375
+ };
1376
+ function useSmoothContext(options) {
1377
+ const context = (0, import_react35.useContext)(SmoothContext);
1378
+ if (!options?.optional && !context)
1379
+ throw new Error(
1380
+ "This component must be used within a SmoothContextProvider."
1381
+ );
1382
+ return context;
1383
+ }
1384
+ var useSmoothStatus = () => {
1385
+ const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext();
1386
+ return useSmoothStatus2();
1387
+ };
1388
+
1389
+ // src/utils/smooth/useSmooth.tsx
1390
+ var import_react_use_callback_ref2 = require("@radix-ui/react-use-callback-ref");
1352
1391
  var TextStreamAnimator = class {
1353
1392
  constructor(currentText, setText) {
1354
1393
  this.currentText = currentText;
@@ -1393,22 +1432,33 @@ var TextStreamAnimator = class {
1393
1432
  this.setText(this.currentText);
1394
1433
  };
1395
1434
  };
1396
- var useSmooth = (text, smooth = false) => {
1435
+ var SMOOTH_STATUS = Object.freeze({
1436
+ type: "running"
1437
+ });
1438
+ var useSmooth = (state, smooth = false) => {
1439
+ const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext({ optional: true }) ?? {};
1440
+ const {
1441
+ part: { text }
1442
+ } = state;
1397
1443
  const { useMessage } = useMessageContext();
1398
1444
  const id = useMessage((m) => m.message.id);
1399
- const idRef = (0, import_react35.useRef)(id);
1400
- const [displayedText, setDisplayedText] = (0, import_react35.useState)(text);
1401
- const [animatorRef] = (0, import_react35.useState)(
1402
- new TextStreamAnimator(text, setDisplayedText)
1445
+ const idRef = (0, import_react36.useRef)(id);
1446
+ const [displayedText, setDisplayedText] = (0, import_react36.useState)(text);
1447
+ const setText = (0, import_react_use_callback_ref2.useCallbackRef)((text2) => {
1448
+ setDisplayedText(text2);
1449
+ useSmoothStatus2?.setState(text2 !== state.part.text ? SMOOTH_STATUS : state.status);
1450
+ });
1451
+ const [animatorRef] = (0, import_react36.useState)(
1452
+ new TextStreamAnimator(text, setText)
1403
1453
  );
1404
- (0, import_react35.useEffect)(() => {
1454
+ (0, import_react36.useEffect)(() => {
1405
1455
  if (!smooth) {
1406
1456
  animatorRef.stop();
1407
1457
  return;
1408
1458
  }
1409
1459
  if (idRef.current !== id || !text.startsWith(animatorRef.targetText)) {
1410
1460
  idRef.current = id;
1411
- setDisplayedText(text);
1461
+ setText(text);
1412
1462
  animatorRef.currentText = text;
1413
1463
  animatorRef.targetText = text;
1414
1464
  animatorRef.stop();
@@ -1416,36 +1466,41 @@ var useSmooth = (text, smooth = false) => {
1416
1466
  }
1417
1467
  animatorRef.targetText = text;
1418
1468
  animatorRef.start();
1419
- }, [animatorRef, id, smooth, text]);
1420
- (0, import_react35.useEffect)(() => {
1469
+ }, [setText, animatorRef, id, smooth, text]);
1470
+ (0, import_react36.useEffect)(() => {
1421
1471
  return () => {
1422
1472
  animatorRef.stop();
1423
1473
  };
1424
1474
  }, [animatorRef]);
1425
- return smooth ? displayedText : text;
1475
+ return (0, import_react36.useMemo)(
1476
+ () => smooth ? {
1477
+ part: { type: "text", text: displayedText },
1478
+ status: text === displayedText ? state.status : SMOOTH_STATUS
1479
+ } : state,
1480
+ [smooth, displayedText, state, text]
1481
+ );
1426
1482
  };
1427
1483
 
1428
1484
  // src/primitives/contentPart/ContentPartText.tsx
1429
- var import_jsx_runtime14 = require("react/jsx-runtime");
1430
- var ContentPartPrimitiveText = (0, import_react36.forwardRef)(({ smooth = true, ...rest }, forwardedRef) => {
1485
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1486
+ var ContentPartPrimitiveText = (0, import_react37.forwardRef)(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
1431
1487
  const {
1432
- status,
1433
- part: { text }
1434
- } = useContentPartText();
1435
- const smoothText = useSmooth(text, smooth);
1436
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_primitive4.Primitive.span, { "data-status": status.type, ...rest, ref: forwardedRef, children: smoothText });
1488
+ part: { text },
1489
+ status
1490
+ } = useSmooth(useContentPartText(), smooth);
1491
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
1437
1492
  });
1438
1493
  ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
1439
1494
 
1440
1495
  // src/primitives/contentPart/ContentPartImage.tsx
1441
- var import_react_primitive5 = require("@radix-ui/react-primitive");
1442
- var import_react37 = require("react");
1443
- var import_jsx_runtime15 = require("react/jsx-runtime");
1444
- var ContentPartPrimitiveImage = (0, import_react37.forwardRef)((props, forwardedRef) => {
1496
+ var import_react_primitive4 = require("@radix-ui/react-primitive");
1497
+ var import_react38 = require("react");
1498
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1499
+ var ContentPartPrimitiveImage = (0, import_react38.forwardRef)((props, forwardedRef) => {
1445
1500
  const {
1446
1501
  part: { image }
1447
1502
  } = useContentPartImage();
1448
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_primitive5.Primitive.img, { src: image, ...props, ref: forwardedRef });
1503
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_primitive4.Primitive.img, { src: image, ...props, ref: forwardedRef });
1449
1504
  });
1450
1505
  ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
1451
1506
 
@@ -1467,25 +1522,26 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
1467
1522
  ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
1468
1523
 
1469
1524
  // src/primitives/message/MessageContent.tsx
1470
- var import_jsx_runtime16 = require("react/jsx-runtime");
1525
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1471
1526
  var defaultComponents = {
1472
- Text: () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { style: { whiteSpace: "pre-line" }, children: [
1473
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ContentPartPrimitiveText, {}),
1474
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
1527
+ Text: () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { style: { whiteSpace: "pre-line" }, children: [
1528
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ContentPartPrimitiveText, {}),
1529
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
1475
1530
  ] }),
1476
- Image: () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ContentPartPrimitiveImage, {}),
1477
- UI: () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ContentPartPrimitiveDisplay, {}),
1531
+ Image: () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ContentPartPrimitiveImage, {}),
1532
+ UI: () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ContentPartPrimitiveDisplay, {}),
1478
1533
  tools: {
1479
1534
  Fallback: (props) => {
1480
1535
  const { useToolUIs } = useAssistantContext();
1481
1536
  const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
1482
1537
  if (!Render) return null;
1483
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Render, { ...props });
1538
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Render, { ...props });
1484
1539
  }
1485
1540
  }
1486
1541
  };
1487
1542
  var MessageContentPartComponent = ({
1488
1543
  components: {
1544
+ Empty = defaultComponents.Text,
1489
1545
  Text: Text2 = defaultComponents.Text,
1490
1546
  Image: Image2 = defaultComponents.Image,
1491
1547
  UI = defaultComponents.UI,
@@ -1502,15 +1558,16 @@ var MessageContentPartComponent = ({
1502
1558
  case "text":
1503
1559
  if (status.type === "requires-action")
1504
1560
  throw new Error("Encountered unexpected requires-action status");
1505
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text2, { part, status });
1561
+ if (part === EMPTY_CONTENT) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Empty, { part, status });
1562
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text2, { part, status });
1506
1563
  case "image":
1507
1564
  if (status.type === "requires-action")
1508
1565
  throw new Error("Encountered unexpected requires-action status");
1509
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Image2, { part, status });
1566
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Image2, { part, status });
1510
1567
  case "ui":
1511
1568
  if (status.type === "requires-action")
1512
1569
  throw new Error("Encountered unexpected requires-action status");
1513
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UI, { part, status });
1570
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UI, { part, status });
1514
1571
  case "tool-call": {
1515
1572
  const Tool = by_name[part.toolName] || Fallback2;
1516
1573
  const addResult = (result) => addToolResult({
@@ -1518,7 +1575,7 @@ var MessageContentPartComponent = ({
1518
1575
  toolCallId: part.toolCallId,
1519
1576
  result
1520
1577
  });
1521
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tool, { part, status, addResult });
1578
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tool, { part, status, addResult });
1522
1579
  }
1523
1580
  default:
1524
1581
  const unhandledType = type;
@@ -1529,9 +1586,9 @@ var MessageContentPartImpl = ({
1529
1586
  partIndex,
1530
1587
  components
1531
1588
  }) => {
1532
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ContentPartProvider, { partIndex, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MessageContentPartComponent, { components }) });
1589
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ContentPartProvider, { partIndex, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MessageContentPartComponent, { components }) });
1533
1590
  };
1534
- var MessageContentPart = (0, import_react38.memo)(
1591
+ var MessageContentPart = (0, import_react39.memo)(
1535
1592
  MessageContentPartImpl,
1536
1593
  (prev, next) => prev.partIndex === next.partIndex && prev.components?.Text === next.components?.Text && prev.components?.Image === next.components?.Image && prev.components?.UI === next.components?.UI && prev.components?.tools === next.components?.tools
1537
1594
  );
@@ -1542,7 +1599,7 @@ var MessagePrimitiveContent = ({
1542
1599
  const contentLength = useMessage((s) => s.message.content.length) || 1;
1543
1600
  return new Array(contentLength).fill(null).map((_, idx) => {
1544
1601
  const partIndex = idx;
1545
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1602
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1546
1603
  MessageContentPart,
1547
1604
  {
1548
1605
  partIndex,
@@ -1561,9 +1618,9 @@ var MessagePrimitiveInProgress = () => {
1561
1618
  MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
1562
1619
 
1563
1620
  // src/primitives/branchPicker/BranchPickerRoot.tsx
1564
- var import_jsx_runtime17 = require("react/jsx-runtime");
1565
- var BranchPickerPrimitiveRoot = (0, import_react39.forwardRef)(({ hideWhenSingleBranch, ...rest }, ref) => {
1566
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_primitive6.Primitive.div, { ...rest, ref }) });
1621
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1622
+ var BranchPickerPrimitiveRoot = (0, import_react40.forwardRef)(({ hideWhenSingleBranch, ...rest }, ref) => {
1623
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_primitive5.Primitive.div, { ...rest, ref }) });
1567
1624
  });
1568
1625
  BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
1569
1626
 
@@ -1579,18 +1636,18 @@ __export(composer_exports, {
1579
1636
 
1580
1637
  // src/primitives/composer/ComposerRoot.tsx
1581
1638
  var import_primitive4 = require("@radix-ui/primitive");
1582
- var import_react_primitive7 = require("@radix-ui/react-primitive");
1583
- var import_react40 = require("react");
1584
- var import_jsx_runtime18 = require("react/jsx-runtime");
1585
- var ComposerPrimitiveRoot = (0, import_react40.forwardRef)(({ onSubmit, ...rest }, forwardedRef) => {
1639
+ var import_react_primitive6 = require("@radix-ui/react-primitive");
1640
+ var import_react41 = require("react");
1641
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1642
+ var ComposerPrimitiveRoot = (0, import_react41.forwardRef)(({ onSubmit, ...rest }, forwardedRef) => {
1586
1643
  const send = useComposerSend();
1587
1644
  const handleSubmit = (e) => {
1588
1645
  e.preventDefault();
1589
1646
  if (!send) return;
1590
1647
  send();
1591
1648
  };
1592
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1593
- import_react_primitive7.Primitive.form,
1649
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1650
+ import_react_primitive6.Primitive.form,
1594
1651
  {
1595
1652
  ...rest,
1596
1653
  ref: forwardedRef,
@@ -1604,11 +1661,11 @@ ComposerPrimitiveRoot.displayName = "ComposerPrimitive.Root";
1604
1661
  var import_primitive5 = require("@radix-ui/primitive");
1605
1662
  var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
1606
1663
  var import_react_slot = require("@radix-ui/react-slot");
1607
- var import_react41 = require("react");
1664
+ var import_react42 = require("react");
1608
1665
  var import_react_textarea_autosize = __toESM(require("react-textarea-autosize"));
1609
1666
  var import_react_use_escape_keydown = require("@radix-ui/react-use-escape-keydown");
1610
- var import_jsx_runtime19 = require("react/jsx-runtime");
1611
- var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1667
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1668
+ var ComposerPrimitiveInput = (0, import_react42.forwardRef)(
1612
1669
  ({
1613
1670
  autoFocus = false,
1614
1671
  asChild,
@@ -1625,7 +1682,7 @@ var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1625
1682
  });
1626
1683
  const Component = asChild ? import_react_slot.Slot : import_react_textarea_autosize.default;
1627
1684
  const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;
1628
- const textareaRef = (0, import_react41.useRef)(null);
1685
+ const textareaRef = (0, import_react42.useRef)(null);
1629
1686
  const ref = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, textareaRef);
1630
1687
  (0, import_react_use_escape_keydown.useEscapeKeydown)((e) => {
1631
1688
  const composer = useComposer.getState();
@@ -1645,7 +1702,7 @@ var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1645
1702
  }
1646
1703
  };
1647
1704
  const autoFocusEnabled = autoFocus && !isDisabled;
1648
- const focus = (0, import_react41.useCallback)(() => {
1705
+ const focus = (0, import_react42.useCallback)(() => {
1649
1706
  const textarea = textareaRef.current;
1650
1707
  if (!textarea || !autoFocusEnabled) return;
1651
1708
  textarea.focus({ preventScroll: true });
@@ -1654,13 +1711,13 @@ var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1654
1711
  textareaRef.current.value.length
1655
1712
  );
1656
1713
  }, [autoFocusEnabled]);
1657
- (0, import_react41.useEffect)(() => focus(), [focus]);
1714
+ (0, import_react42.useEffect)(() => focus(), [focus]);
1658
1715
  useOnComposerFocus(() => {
1659
1716
  if (type === "new") {
1660
1717
  focus();
1661
1718
  }
1662
1719
  });
1663
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1720
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1664
1721
  Component,
1665
1722
  {
1666
1723
  name: "input",
@@ -1681,14 +1738,14 @@ var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1681
1738
  ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
1682
1739
 
1683
1740
  // src/primitives/composer/ComposerSend.tsx
1684
- var import_react42 = require("react");
1685
- var import_react_primitive8 = require("@radix-ui/react-primitive");
1686
- var import_jsx_runtime20 = require("react/jsx-runtime");
1687
- var ComposerPrimitiveSend = (0, import_react42.forwardRef)(({ disabled, ...rest }, ref) => {
1741
+ var import_react43 = require("react");
1742
+ var import_react_primitive7 = require("@radix-ui/react-primitive");
1743
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1744
+ var ComposerPrimitiveSend = (0, import_react43.forwardRef)(({ disabled, ...rest }, ref) => {
1688
1745
  const { useComposer } = useComposerContext();
1689
1746
  const hasValue = useComposer((c) => c.isEditing && c.value.length > 0);
1690
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1691
- import_react_primitive8.Primitive.button,
1747
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1748
+ import_react_primitive7.Primitive.button,
1692
1749
  {
1693
1750
  type: "submit",
1694
1751
  ...rest,
@@ -1737,11 +1794,11 @@ __export(thread_exports, {
1737
1794
  });
1738
1795
 
1739
1796
  // src/primitives/thread/ThreadRoot.tsx
1740
- var import_react_primitive9 = require("@radix-ui/react-primitive");
1741
- var import_react43 = require("react");
1742
- var import_jsx_runtime21 = require("react/jsx-runtime");
1743
- var ThreadPrimitiveRoot = (0, import_react43.forwardRef)((props, ref) => {
1744
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_primitive9.Primitive.div, { ...props, ref });
1797
+ var import_react_primitive8 = require("@radix-ui/react-primitive");
1798
+ var import_react44 = require("react");
1799
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1800
+ var ThreadPrimitiveRoot = (0, import_react44.forwardRef)((props, ref) => {
1801
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_primitive8.Primitive.div, { ...props, ref });
1745
1802
  });
1746
1803
  ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
1747
1804
 
@@ -1766,19 +1823,19 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
1766
1823
 
1767
1824
  // src/primitives/thread/ThreadViewport.tsx
1768
1825
  var import_react_compose_refs4 = require("@radix-ui/react-compose-refs");
1769
- var import_react_primitive10 = require("@radix-ui/react-primitive");
1770
- var import_react47 = require("react");
1826
+ var import_react_primitive9 = require("@radix-ui/react-primitive");
1827
+ var import_react48 = require("react");
1771
1828
 
1772
1829
  // src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
1773
1830
  var import_react_compose_refs3 = require("@radix-ui/react-compose-refs");
1774
- var import_react46 = require("react");
1831
+ var import_react47 = require("react");
1775
1832
 
1776
1833
  // src/utils/hooks/useOnResizeContent.tsx
1777
- var import_react_use_callback_ref2 = require("@radix-ui/react-use-callback-ref");
1778
- var import_react44 = require("react");
1834
+ var import_react_use_callback_ref3 = require("@radix-ui/react-use-callback-ref");
1835
+ var import_react45 = require("react");
1779
1836
  var useOnResizeContent = (callback) => {
1780
- const callbackRef = (0, import_react_use_callback_ref2.useCallbackRef)(callback);
1781
- const refCallback = (0, import_react44.useCallback)(
1837
+ const callbackRef = (0, import_react_use_callback_ref3.useCallbackRef)(callback);
1838
+ const refCallback = (0, import_react45.useCallback)(
1782
1839
  (el) => {
1783
1840
  const resizeObserver = new ResizeObserver(() => {
1784
1841
  callbackRef();
@@ -1814,12 +1871,12 @@ var useOnResizeContent = (callback) => {
1814
1871
  };
1815
1872
 
1816
1873
  // src/utils/hooks/useOnScrollToBottom.tsx
1817
- var import_react_use_callback_ref3 = require("@radix-ui/react-use-callback-ref");
1818
- var import_react45 = require("react");
1874
+ var import_react_use_callback_ref4 = require("@radix-ui/react-use-callback-ref");
1875
+ var import_react46 = require("react");
1819
1876
  var useOnScrollToBottom = (callback) => {
1820
- const callbackRef = (0, import_react_use_callback_ref3.useCallbackRef)(callback);
1877
+ const callbackRef = (0, import_react_use_callback_ref4.useCallbackRef)(callback);
1821
1878
  const { useViewport } = useThreadContext();
1822
- (0, import_react45.useEffect)(() => {
1879
+ (0, import_react46.useEffect)(() => {
1823
1880
  return useViewport.getState().onScrollToBottom(() => {
1824
1881
  callbackRef();
1825
1882
  });
@@ -1830,10 +1887,10 @@ var useOnScrollToBottom = (callback) => {
1830
1887
  var useThreadViewportAutoScroll = ({
1831
1888
  autoScroll = true
1832
1889
  }) => {
1833
- const divRef = (0, import_react46.useRef)(null);
1890
+ const divRef = (0, import_react47.useRef)(null);
1834
1891
  const { useViewport } = useThreadContext();
1835
- const lastScrollTop = (0, import_react46.useRef)(0);
1836
- const isScrollingToBottomRef = (0, import_react46.useRef)(false);
1892
+ const lastScrollTop = (0, import_react47.useRef)(0);
1893
+ const isScrollingToBottomRef = (0, import_react47.useRef)(false);
1837
1894
  const scrollToBottom = (behavior) => {
1838
1895
  const div = divRef.current;
1839
1896
  if (!div || !autoScroll) return;
@@ -1878,29 +1935,29 @@ var useThreadViewportAutoScroll = ({
1878
1935
  };
1879
1936
 
1880
1937
  // src/primitives/thread/ThreadViewport.tsx
1881
- var import_jsx_runtime22 = require("react/jsx-runtime");
1882
- var ThreadPrimitiveViewport = (0, import_react47.forwardRef)(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
1938
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1939
+ var ThreadPrimitiveViewport = (0, import_react48.forwardRef)(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
1883
1940
  const autoScrollRef = useThreadViewportAutoScroll({
1884
1941
  autoScroll
1885
1942
  });
1886
1943
  const ref = (0, import_react_compose_refs4.useComposedRefs)(forwardedRef, autoScrollRef);
1887
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_primitive10.Primitive.div, { ...rest, ref, children });
1944
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_primitive9.Primitive.div, { ...rest, ref, children });
1888
1945
  });
1889
1946
  ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
1890
1947
 
1891
1948
  // src/primitives/thread/ThreadMessages.tsx
1892
- var import_react49 = require("react");
1949
+ var import_react50 = require("react");
1893
1950
 
1894
1951
  // src/context/providers/MessageProvider.tsx
1895
- var import_react48 = require("react");
1896
- var import_zustand13 = require("zustand");
1952
+ var import_react49 = require("react");
1953
+ var import_zustand14 = require("zustand");
1897
1954
 
1898
1955
  // src/context/stores/EditComposer.ts
1899
- var import_zustand11 = require("zustand");
1956
+ var import_zustand12 = require("zustand");
1900
1957
  var makeEditComposerStore = ({
1901
1958
  onEdit,
1902
1959
  onSend
1903
- }) => (0, import_zustand11.create)()((set, get, store) => ({
1960
+ }) => (0, import_zustand12.create)()((set, get, store) => ({
1904
1961
  ...makeBaseComposer(set, get, store),
1905
1962
  canCancel: false,
1906
1963
  isEditing: false,
@@ -1919,8 +1976,8 @@ var makeEditComposerStore = ({
1919
1976
  }));
1920
1977
 
1921
1978
  // src/context/stores/MessageUtils.ts
1922
- var import_zustand12 = require("zustand");
1923
- var makeMessageUtilsStore = () => (0, import_zustand12.create)((set) => ({
1979
+ var import_zustand13 = require("zustand");
1980
+ var makeMessageUtilsStore = () => (0, import_zustand13.create)((set) => ({
1924
1981
  isCopied: false,
1925
1982
  setIsCopied: (value) => {
1926
1983
  set({ isCopied: value });
@@ -1932,7 +1989,7 @@ var makeMessageUtilsStore = () => (0, import_zustand12.create)((set) => ({
1932
1989
  }));
1933
1990
 
1934
1991
  // src/context/providers/MessageProvider.tsx
1935
- var import_jsx_runtime23 = require("react/jsx-runtime");
1992
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1936
1993
  var getIsLast = (messages, message) => {
1937
1994
  return messages[messages.length - 1]?.id === message.id;
1938
1995
  };
@@ -1954,8 +2011,8 @@ var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
1954
2011
  };
1955
2012
  var useMessageContext2 = (messageIndex) => {
1956
2013
  const { useThreadMessages, useThreadActions } = useThreadContext();
1957
- const [context] = (0, import_react48.useState)(() => {
1958
- const useMessage = (0, import_zustand13.create)(
2014
+ const [context] = (0, import_react49.useState)(() => {
2015
+ const useMessage = (0, import_zustand14.create)(
1959
2016
  () => getMessageState(
1960
2017
  useThreadMessages.getState(),
1961
2018
  useThreadActions.getState().getBranches,
@@ -1992,7 +2049,7 @@ var useMessageContext2 = (messageIndex) => {
1992
2049
  });
1993
2050
  return { useMessage, useMessageUtils, useEditComposer };
1994
2051
  });
1995
- (0, import_react48.useEffect)(() => {
2052
+ (0, import_react49.useEffect)(() => {
1996
2053
  const syncMessage = (thread) => {
1997
2054
  const newState = getMessageState(
1998
2055
  thread,
@@ -2016,11 +2073,11 @@ var MessageProvider = ({
2016
2073
  children
2017
2074
  }) => {
2018
2075
  const context = useMessageContext2(messageIndex);
2019
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MessageContext.Provider, { value: context, children });
2076
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MessageContext.Provider, { value: context, children });
2020
2077
  };
2021
2078
 
2022
2079
  // src/primitives/thread/ThreadMessages.tsx
2023
- var import_jsx_runtime24 = require("react/jsx-runtime");
2080
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2024
2081
  var DEFAULT_SYSTEM_MESSAGE = () => null;
2025
2082
  var getComponents = (components) => {
2026
2083
  return {
@@ -2035,16 +2092,16 @@ var ThreadMessageImpl = ({
2035
2092
  components
2036
2093
  }) => {
2037
2094
  const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
2038
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(MessageProvider, { messageIndex, children: [
2039
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(MessagePrimitiveIf, { user: true, children: [
2040
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UserMessage2, {}) }),
2041
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EditComposer2, {}) })
2095
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(MessageProvider, { messageIndex, children: [
2096
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(MessagePrimitiveIf, { user: true, children: [
2097
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(UserMessage2, {}) }),
2098
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditComposer2, {}) })
2042
2099
  ] }),
2043
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AssistantMessage2, {}) }),
2044
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SystemMessage2, {}) })
2100
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AssistantMessage2, {}) }),
2101
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SystemMessage2, {}) })
2045
2102
  ] });
2046
2103
  };
2047
- var ThreadMessage = (0, import_react49.memo)(
2104
+ var ThreadMessage = (0, import_react50.memo)(
2048
2105
  ThreadMessageImpl,
2049
2106
  (prev, next) => prev.messageIndex === next.messageIndex && prev.components.Message === next.components.Message && prev.components.UserMessage === next.components.UserMessage && prev.components.EditComposer === next.components.EditComposer && prev.components.AssistantMessage === next.components.AssistantMessage && prev.components.SystemMessage === next.components.SystemMessage
2050
2107
  );
@@ -2056,7 +2113,7 @@ var ThreadPrimitiveMessagesImpl = ({
2056
2113
  if (messagesLength === 0) return null;
2057
2114
  return new Array(messagesLength).fill(null).map((_, idx) => {
2058
2115
  const messageIndex = idx;
2059
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2116
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2060
2117
  ThreadMessage,
2061
2118
  {
2062
2119
  messageIndex,
@@ -2067,7 +2124,7 @@ var ThreadPrimitiveMessagesImpl = ({
2067
2124
  });
2068
2125
  };
2069
2126
  ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
2070
- var ThreadPrimitiveMessages = (0, import_react49.memo)(
2127
+ var ThreadPrimitiveMessages = (0, import_react50.memo)(
2071
2128
  ThreadPrimitiveMessagesImpl,
2072
2129
  (prev, next) => prev.components?.Message === next.components?.Message && prev.components?.UserMessage === next.components?.UserMessage && prev.components?.EditComposer === next.components?.EditComposer && prev.components?.AssistantMessage === next.components?.AssistantMessage && prev.components?.SystemMessage === next.components?.SystemMessage
2073
2130
  );
@@ -2086,7 +2143,7 @@ var ThreadPrimitiveSuggestion = createActionButton(
2086
2143
  );
2087
2144
 
2088
2145
  // src/runtimes/local/useLocalRuntime.tsx
2089
- var import_react54 = require("react");
2146
+ var import_react55 = require("react");
2090
2147
 
2091
2148
  // src/runtimes/core/BaseAssistantRuntime.tsx
2092
2149
  var BaseAssistantRuntime = class {
@@ -2119,7 +2176,9 @@ __export(internal_exports, {
2119
2176
  ProxyConfigProvider: () => ProxyConfigProvider,
2120
2177
  TooltipIconButton: () => TooltipIconButton,
2121
2178
  generateId: () => generateId,
2122
- useSmooth: () => useSmooth
2179
+ useSmooth: () => useSmooth,
2180
+ useSmoothStatus: () => useSmoothStatus,
2181
+ withSmoothContextProvider: () => withSmoothContextProvider
2123
2182
  });
2124
2183
 
2125
2184
  // src/utils/idUtils.tsx
@@ -2343,15 +2402,15 @@ var MessageRepository = class {
2343
2402
  };
2344
2403
 
2345
2404
  // src/ui/base/tooltip-icon-button.tsx
2346
- var import_react52 = require("react");
2405
+ var import_react53 = require("react");
2347
2406
 
2348
2407
  // src/ui/base/tooltip.tsx
2349
2408
  var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
2350
2409
 
2351
2410
  // src/ui/utils/withDefaults.tsx
2352
- var import_react50 = require("react");
2411
+ var import_react51 = require("react");
2353
2412
  var import_classnames = __toESM(require("classnames"));
2354
- var import_jsx_runtime25 = require("react/jsx-runtime");
2413
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2355
2414
  var withDefaultProps = ({
2356
2415
  className,
2357
2416
  ...defaultProps
@@ -2364,10 +2423,10 @@ var withDefaultProps = ({
2364
2423
  };
2365
2424
  var withDefaults = (Component, defaultProps) => {
2366
2425
  const getProps = withDefaultProps(defaultProps);
2367
- const WithDefaults = (0, import_react50.forwardRef)(
2426
+ const WithDefaults = (0, import_react51.forwardRef)(
2368
2427
  (props, ref) => {
2369
2428
  const ComponentAsAny = Component;
2370
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComponentAsAny, { ...getProps(props), ref });
2429
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ComponentAsAny, { ...getProps(props), ref });
2371
2430
  }
2372
2431
  );
2373
2432
  WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
@@ -2375,9 +2434,9 @@ var withDefaults = (Component, defaultProps) => {
2375
2434
  };
2376
2435
 
2377
2436
  // src/ui/base/tooltip.tsx
2378
- var import_jsx_runtime26 = require("react/jsx-runtime");
2437
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2379
2438
  var Tooltip = (props) => {
2380
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipPrimitive.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipPrimitive.Root, { ...props }) });
2439
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipPrimitive.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipPrimitive.Root, { ...props }) });
2381
2440
  };
2382
2441
  Tooltip.displayName = "Tooltip";
2383
2442
  var TooltipTrigger = TooltipPrimitive.Trigger;
@@ -2389,9 +2448,9 @@ TooltipContent.displayName = "TooltipContent";
2389
2448
 
2390
2449
  // src/ui/base/button.tsx
2391
2450
  var import_class_variance_authority = require("class-variance-authority");
2392
- var import_react_primitive11 = require("@radix-ui/react-primitive");
2393
- var import_react51 = require("react");
2394
- var import_jsx_runtime27 = require("react/jsx-runtime");
2451
+ var import_react_primitive10 = require("@radix-ui/react-primitive");
2452
+ var import_react52 = require("react");
2453
+ var import_jsx_runtime28 = require("react/jsx-runtime");
2395
2454
  var buttonVariants = (0, import_class_variance_authority.cva)("aui-button", {
2396
2455
  variants: {
2397
2456
  variant: {
@@ -2409,10 +2468,10 @@ var buttonVariants = (0, import_class_variance_authority.cva)("aui-button", {
2409
2468
  size: "default"
2410
2469
  }
2411
2470
  });
2412
- var Button = (0, import_react51.forwardRef)(
2471
+ var Button = (0, import_react52.forwardRef)(
2413
2472
  ({ className, variant, size, ...props }, ref) => {
2414
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2415
- import_react_primitive11.Primitive.button,
2473
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2474
+ import_react_primitive10.Primitive.button,
2416
2475
  {
2417
2476
  className: buttonVariants({ variant, size, className }),
2418
2477
  ...props,
@@ -2424,14 +2483,14 @@ var Button = (0, import_react51.forwardRef)(
2424
2483
  Button.displayName = "Button";
2425
2484
 
2426
2485
  // src/ui/base/tooltip-icon-button.tsx
2427
- var import_jsx_runtime28 = require("react/jsx-runtime");
2428
- var TooltipIconButton = (0, import_react52.forwardRef)(({ children, tooltip, side = "bottom", ...rest }, ref) => {
2429
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
2430
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
2486
+ var import_jsx_runtime29 = require("react/jsx-runtime");
2487
+ var TooltipIconButton = (0, import_react53.forwardRef)(({ children, tooltip, side = "bottom", ...rest }, ref) => {
2488
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
2489
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
2431
2490
  children,
2432
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "aui-sr-only", children: tooltip })
2491
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "aui-sr-only", children: tooltip })
2433
2492
  ] }) }),
2434
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipContent, { side, children: tooltip })
2493
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipContent, { side, children: tooltip })
2435
2494
  ] });
2436
2495
  });
2437
2496
  TooltipIconButton.displayName = "TooltipIconButton";
@@ -2721,7 +2780,7 @@ var toLanguageModelTools = (tools) => {
2721
2780
  };
2722
2781
 
2723
2782
  // src/runtimes/edge/useEdgeRuntime.ts
2724
- var import_react53 = require("react");
2783
+ var import_react54 = require("react");
2725
2784
 
2726
2785
  // src/runtimes/edge/streams/assistantDecoderStream.ts
2727
2786
  function assistantDecoderStream() {
@@ -3461,7 +3520,7 @@ var useEdgeRuntime = ({
3461
3520
  initialMessages,
3462
3521
  ...options
3463
3522
  }) => {
3464
- const [adapter] = (0, import_react53.useState)(() => new EdgeChatAdapter(options));
3523
+ const [adapter] = (0, import_react54.useState)(() => new EdgeChatAdapter(options));
3465
3524
  return useLocalRuntime(adapter, { initialMessages });
3466
3525
  };
3467
3526
 
@@ -3675,15 +3734,15 @@ var LocalRuntime = class extends BaseAssistantRuntime {
3675
3734
 
3676
3735
  // src/runtimes/local/useLocalRuntime.tsx
3677
3736
  var useLocalRuntime = (adapter, options) => {
3678
- const [runtime] = (0, import_react54.useState)(() => new LocalRuntime(adapter, options));
3679
- (0, import_react54.useInsertionEffect)(() => {
3737
+ const [runtime] = (0, import_react55.useState)(() => new LocalRuntime(adapter, options));
3738
+ (0, import_react55.useInsertionEffect)(() => {
3680
3739
  runtime.adapter = adapter;
3681
3740
  });
3682
3741
  return runtime;
3683
3742
  };
3684
3743
 
3685
3744
  // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
3686
- var import_zustand14 = require("zustand");
3745
+ var import_zustand15 = require("zustand");
3687
3746
 
3688
3747
  // src/runtimes/external-store/getExternalStoreMessage.tsx
3689
3748
  var symbolInnerMessage = Symbol("innerMessage");
@@ -3692,7 +3751,7 @@ var getExternalStoreMessage = (message) => {
3692
3751
  };
3693
3752
 
3694
3753
  // src/runtimes/external-store/useExternalStoreSync.tsx
3695
- var import_react55 = require("react");
3754
+ var import_react56 = require("react");
3696
3755
 
3697
3756
  // src/runtimes/external-store/ThreadMessageConverter.ts
3698
3757
  var ThreadMessageConverter = class {
@@ -3786,11 +3845,11 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
3786
3845
 
3787
3846
  // src/runtimes/external-store/useExternalStoreSync.tsx
3788
3847
  var useExternalStoreSync = (adapter, updateData) => {
3789
- const adapterRef = (0, import_react55.useRef)(adapter);
3790
- (0, import_react55.useInsertionEffect)(() => {
3848
+ const adapterRef = (0, import_react56.useRef)(adapter);
3849
+ (0, import_react56.useInsertionEffect)(() => {
3791
3850
  adapterRef.current = adapter;
3792
3851
  });
3793
- const [converter, convertCallback] = (0, import_react55.useMemo)(() => {
3852
+ const [converter, convertCallback] = (0, import_react56.useMemo)(() => {
3794
3853
  const converter2 = adapter.convertMessage ?? ((m) => m);
3795
3854
  const convertCallback2 = (cache, m, idx) => {
3796
3855
  const autoStatus = getAutoStatus(
@@ -3809,7 +3868,7 @@ var useExternalStoreSync = (adapter, updateData) => {
3809
3868
  };
3810
3869
  return [new ThreadMessageConverter(), convertCallback2];
3811
3870
  }, [adapter.convertMessage]);
3812
- (0, import_react55.useEffect)(() => {
3871
+ (0, import_react56.useEffect)(() => {
3813
3872
  updateData(
3814
3873
  adapter.isDisabled ?? false,
3815
3874
  adapter.isRunning ?? false,
@@ -3837,7 +3896,7 @@ var ExternalStoreThreadRuntime = class {
3837
3896
  store.isRunning ?? false,
3838
3897
  store.messages
3839
3898
  );
3840
- this.useStore = (0, import_zustand14.create)(() => ({
3899
+ this.useStore = (0, import_zustand15.create)(() => ({
3841
3900
  store
3842
3901
  }));
3843
3902
  }
@@ -3978,45 +4037,45 @@ var ExternalStoreRuntime = class extends BaseAssistantRuntime {
3978
4037
  };
3979
4038
 
3980
4039
  // src/runtimes/external-store/useExternalStoreRuntime.tsx
3981
- var import_react56 = require("react");
4040
+ var import_react57 = require("react");
3982
4041
  var useExternalStoreRuntime = (store) => {
3983
- const [runtime] = (0, import_react56.useState)(() => new ExternalStoreRuntime(store));
3984
- (0, import_react56.useInsertionEffect)(() => {
4042
+ const [runtime] = (0, import_react57.useState)(() => new ExternalStoreRuntime(store));
4043
+ (0, import_react57.useInsertionEffect)(() => {
3985
4044
  runtime.store = store;
3986
4045
  });
3987
- (0, import_react56.useEffect)(() => {
4046
+ (0, import_react57.useEffect)(() => {
3988
4047
  runtime.onStoreUpdated();
3989
4048
  });
3990
4049
  return runtime;
3991
4050
  };
3992
4051
 
3993
4052
  // src/ui/thread-config.tsx
3994
- var import_react57 = require("react");
3995
- var import_jsx_runtime29 = require("react/jsx-runtime");
3996
- var ThreadConfigContext = (0, import_react57.createContext)({});
4053
+ var import_react58 = require("react");
4054
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4055
+ var ThreadConfigContext = (0, import_react58.createContext)({});
3997
4056
  var useThreadConfig = () => {
3998
- return (0, import_react57.useContext)(ThreadConfigContext);
4057
+ return (0, import_react58.useContext)(ThreadConfigContext);
3999
4058
  };
4000
4059
  var ThreadConfigProvider = ({
4001
4060
  children,
4002
4061
  config
4003
4062
  }) => {
4004
4063
  const assistant = useAssistantContext({ optional: true });
4005
- const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
4064
+ const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
4006
4065
  if (!config?.runtime) return configProvider;
4007
4066
  if (assistant) {
4008
4067
  throw new Error(
4009
4068
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
4010
4069
  );
4011
4070
  }
4012
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
4071
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
4013
4072
  };
4014
4073
  ThreadConfigProvider.displayName = "ThreadConfigProvider";
4015
4074
 
4016
4075
  // src/ui/assistant-action-bar.tsx
4017
- var import_react58 = require("react");
4076
+ var import_react59 = require("react");
4018
4077
  var import_lucide_react = require("lucide-react");
4019
- var import_jsx_runtime30 = require("react/jsx-runtime");
4078
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4020
4079
  var useAllowCopy = () => {
4021
4080
  const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
4022
4081
  const { useThreadActions } = useThreadContext();
@@ -4033,15 +4092,15 @@ var AssistantActionBar = () => {
4033
4092
  const allowCopy = useAllowCopy();
4034
4093
  const allowReload = useAllowReload();
4035
4094
  if (!allowCopy && !allowReload) return null;
4036
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4095
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4037
4096
  AssistantActionBarRoot,
4038
4097
  {
4039
4098
  hideWhenRunning: true,
4040
4099
  autohide: "not-last",
4041
4100
  autohideFloat: "single-branch",
4042
4101
  children: [
4043
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AssistantActionBarCopy, {}),
4044
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AssistantActionBarReload, {})
4102
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AssistantActionBarCopy, {}),
4103
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AssistantActionBarReload, {})
4045
4104
  ]
4046
4105
  }
4047
4106
  );
@@ -4051,7 +4110,7 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
4051
4110
  className: "aui-assistant-action-bar-root"
4052
4111
  });
4053
4112
  AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
4054
- var AssistantActionBarCopy = (0, import_react58.forwardRef)((props, ref) => {
4113
+ var AssistantActionBarCopy = (0, import_react59.forwardRef)((props, ref) => {
4055
4114
  const {
4056
4115
  strings: {
4057
4116
  assistantMessage: { reload: { tooltip = "Copy" } = {} } = {}
@@ -4059,13 +4118,13 @@ var AssistantActionBarCopy = (0, import_react58.forwardRef)((props, ref) => {
4059
4118
  } = useThreadConfig();
4060
4119
  const allowCopy = useAllowCopy();
4061
4120
  if (!allowCopy) return null;
4062
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
4063
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(message_exports.If, { copied: true, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react.CheckIcon, {}) }),
4064
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(message_exports.If, { copied: false, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react.CopyIcon, {}) })
4121
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4122
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(message_exports.If, { copied: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react.CheckIcon, {}) }),
4123
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(message_exports.If, { copied: false, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react.CopyIcon, {}) })
4065
4124
  ] }) }) });
4066
4125
  });
4067
4126
  AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
4068
- var AssistantActionBarReload = (0, import_react58.forwardRef)((props, ref) => {
4127
+ var AssistantActionBarReload = (0, import_react59.forwardRef)((props, ref) => {
4069
4128
  const {
4070
4129
  strings: {
4071
4130
  assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
@@ -4073,7 +4132,7 @@ var AssistantActionBarReload = (0, import_react58.forwardRef)((props, ref) => {
4073
4132
  } = useThreadConfig();
4074
4133
  const allowReload = useAllowReload();
4075
4134
  if (!allowReload) return null;
4076
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react.RefreshCwIcon, {}) }) });
4135
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react.RefreshCwIcon, {}) }) });
4077
4136
  });
4078
4137
  AssistantActionBarReload.displayName = "AssistantActionBarReload";
4079
4138
  var exports2 = {
@@ -4087,12 +4146,12 @@ var assistant_action_bar_default = Object.assign(
4087
4146
  );
4088
4147
 
4089
4148
  // src/ui/assistant-message.tsx
4090
- var import_react60 = require("react");
4149
+ var import_react61 = require("react");
4091
4150
 
4092
4151
  // src/ui/branch-picker.tsx
4093
- var import_react59 = require("react");
4152
+ var import_react60 = require("react");
4094
4153
  var import_lucide_react2 = require("lucide-react");
4095
- var import_jsx_runtime31 = require("react/jsx-runtime");
4154
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4096
4155
  var useAllowBranchPicker = () => {
4097
4156
  const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
4098
4157
  const { useThreadActions } = useThreadContext();
@@ -4102,10 +4161,10 @@ var useAllowBranchPicker = () => {
4102
4161
  var BranchPicker = () => {
4103
4162
  const allowBranchPicker = useAllowBranchPicker();
4104
4163
  if (!allowBranchPicker) return null;
4105
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
4106
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BranchPickerPrevious2, {}),
4107
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BranchPickerState, {}),
4108
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BranchPickerNext, {})
4164
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
4165
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BranchPickerPrevious2, {}),
4166
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BranchPickerState, {}),
4167
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BranchPickerNext, {})
4109
4168
  ] });
4110
4169
  };
4111
4170
  BranchPicker.displayName = "BranchPicker";
@@ -4113,31 +4172,31 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
4113
4172
  className: "aui-branch-picker-root"
4114
4173
  });
4115
4174
  BranchPickerRoot.displayName = "BranchPickerRoot";
4116
- var BranchPickerPrevious2 = (0, import_react59.forwardRef)((props, ref) => {
4175
+ var BranchPickerPrevious2 = (0, import_react60.forwardRef)((props, ref) => {
4117
4176
  const {
4118
4177
  strings: {
4119
4178
  branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
4120
4179
  } = {}
4121
4180
  } = useThreadConfig();
4122
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react2.ChevronLeftIcon, {}) }) });
4181
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react2.ChevronLeftIcon, {}) }) });
4123
4182
  });
4124
4183
  BranchPickerPrevious2.displayName = "BranchPickerPrevious";
4125
4184
  var BranchPickerStateWrapper = withDefaults("span", {
4126
4185
  className: "aui-branch-picker-state"
4127
4186
  });
4128
- var BranchPickerState = (0, import_react59.forwardRef)((props, ref) => {
4129
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(BranchPickerStateWrapper, { ...props, ref, children: [
4130
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(branchPicker_exports.Number, {}),
4187
+ var BranchPickerState = (0, import_react60.forwardRef)((props, ref) => {
4188
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(BranchPickerStateWrapper, { ...props, ref, children: [
4189
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(branchPicker_exports.Number, {}),
4131
4190
  " / ",
4132
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(branchPicker_exports.Count, {})
4191
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(branchPicker_exports.Count, {})
4133
4192
  ] });
4134
4193
  });
4135
4194
  BranchPickerState.displayName = "BranchPickerState";
4136
- var BranchPickerNext = (0, import_react59.forwardRef)((props, ref) => {
4195
+ var BranchPickerNext = (0, import_react60.forwardRef)((props, ref) => {
4137
4196
  const {
4138
4197
  strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
4139
4198
  } = useThreadConfig();
4140
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react2.ChevronRightIcon, {}) }) });
4199
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react2.ChevronRightIcon, {}) }) });
4141
4200
  });
4142
4201
  BranchPickerNext.displayName = "BranchPickerNext";
4143
4202
  var exports3 = {
@@ -4149,12 +4208,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports3);
4149
4208
 
4150
4209
  // src/ui/base/avatar.tsx
4151
4210
  var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
4152
- var import_jsx_runtime32 = require("react/jsx-runtime");
4211
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4153
4212
  var Avatar = ({ src, alt, fallback }) => {
4154
4213
  if (src == null && fallback == null) return null;
4155
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(AvatarRoot, { children: [
4156
- src != null && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AvatarImage, { src, alt }),
4157
- fallback != null && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AvatarFallback, { children: fallback })
4214
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(AvatarRoot, { children: [
4215
+ src != null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AvatarImage, { src, alt }),
4216
+ fallback != null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AvatarFallback, { children: fallback })
4158
4217
  ] });
4159
4218
  };
4160
4219
  Avatar.displayName = "Avatar";
@@ -4173,36 +4232,37 @@ AvatarFallback.displayName = "AvatarFallback";
4173
4232
 
4174
4233
  // src/ui/content-part.tsx
4175
4234
  var import_classnames2 = __toESM(require("classnames"));
4176
- var import_jsx_runtime33 = require("react/jsx-runtime");
4177
- var Text = ({ status }) => {
4178
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4179
- "p",
4235
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4236
+ var Text = () => {
4237
+ const status = useSmoothStatus();
4238
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4239
+ contentPart_exports.Text,
4180
4240
  {
4181
4241
  className: (0, import_classnames2.default)(
4182
4242
  "aui-text",
4183
- status.type === "running" && "aui-text-in-progress"
4243
+ status.type === "running" && "aui-text-running"
4184
4244
  ),
4185
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(contentPart_exports.Text, {})
4245
+ component: "p"
4186
4246
  }
4187
4247
  );
4188
4248
  };
4189
- var exports4 = { Text };
4249
+ var exports4 = { Text: withSmoothContextProvider(Text) };
4190
4250
  var content_part_default = exports4;
4191
4251
 
4192
4252
  // src/ui/assistant-message.tsx
4193
- var import_jsx_runtime34 = require("react/jsx-runtime");
4253
+ var import_jsx_runtime35 = require("react/jsx-runtime");
4194
4254
  var AssistantMessage = () => {
4195
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(AssistantMessageRoot, { children: [
4196
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AssistantMessageAvatar, {}),
4197
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AssistantMessageContent, {}),
4198
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(branch_picker_default, {}),
4199
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(assistant_action_bar_default, {})
4255
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(AssistantMessageRoot, { children: [
4256
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AssistantMessageAvatar, {}),
4257
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AssistantMessageContent, {}),
4258
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(branch_picker_default, {}),
4259
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(assistant_action_bar_default, {})
4200
4260
  ] });
4201
4261
  };
4202
4262
  AssistantMessage.displayName = "AssistantMessage";
4203
4263
  var AssistantMessageAvatar = () => {
4204
4264
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4205
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Avatar, { ...avatar });
4265
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Avatar, { ...avatar });
4206
4266
  };
4207
4267
  var AssistantMessageRoot = withDefaults(message_exports.Root, {
4208
4268
  className: "aui-assistant-message-root"
@@ -4211,9 +4271,9 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
4211
4271
  var AssistantMessageContentWrapper = withDefaults("div", {
4212
4272
  className: "aui-assistant-message-content"
4213
4273
  });
4214
- var AssistantMessageContent = (0, import_react60.forwardRef)(({ components: componentsProp, ...rest }, ref) => {
4274
+ var AssistantMessageContent = (0, import_react61.forwardRef)(({ components: componentsProp, ...rest }, ref) => {
4215
4275
  const { assistantMessage: { components = {} } = {} } = useThreadConfig();
4216
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4276
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4217
4277
  message_exports.Content,
4218
4278
  {
4219
4279
  components: {
@@ -4235,38 +4295,38 @@ var assistant_message_default = Object.assign(
4235
4295
  );
4236
4296
 
4237
4297
  // src/ui/assistant-modal.tsx
4238
- var import_react67 = require("react");
4298
+ var import_react68 = require("react");
4239
4299
  var import_lucide_react6 = require("lucide-react");
4240
4300
 
4241
4301
  // src/ui/thread.tsx
4242
- var import_react66 = require("react");
4302
+ var import_react67 = require("react");
4243
4303
  var import_lucide_react5 = require("lucide-react");
4244
4304
 
4245
4305
  // src/ui/composer.tsx
4246
- var import_react61 = require("react");
4306
+ var import_react62 = require("react");
4247
4307
  var import_lucide_react3 = require("lucide-react");
4248
4308
 
4249
4309
  // src/ui/base/CircleStopIcon.tsx
4250
- var import_jsx_runtime35 = require("react/jsx-runtime");
4310
+ var import_jsx_runtime36 = require("react/jsx-runtime");
4251
4311
  var CircleStopIcon = () => {
4252
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4312
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4253
4313
  "svg",
4254
4314
  {
4255
4315
  xmlns: "http://www.w3.org/2000/svg",
4256
4316
  viewBox: "0 0 16 16",
4257
4317
  fill: "currentColor",
4258
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
4318
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
4259
4319
  }
4260
4320
  );
4261
4321
  };
4262
4322
  CircleStopIcon.displayName = "CircleStopIcon";
4263
4323
 
4264
4324
  // src/ui/composer.tsx
4265
- var import_jsx_runtime36 = require("react/jsx-runtime");
4325
+ var import_jsx_runtime37 = require("react/jsx-runtime");
4266
4326
  var Composer = () => {
4267
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(ComposerRoot, { children: [
4268
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerInput, { autoFocus: true }),
4269
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerAction, {})
4327
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(ComposerRoot, { children: [
4328
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComposerInput, { autoFocus: true }),
4329
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComposerAction, {})
4270
4330
  ] });
4271
4331
  };
4272
4332
  Composer.displayName = "Composer";
@@ -4279,14 +4339,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
4279
4339
  autoFocus: true,
4280
4340
  className: "aui-composer-input"
4281
4341
  });
4282
- var ComposerInput = (0, import_react61.forwardRef)(
4342
+ var ComposerInput = (0, import_react62.forwardRef)(
4283
4343
  (props, ref) => {
4284
4344
  const {
4285
4345
  strings: {
4286
4346
  composer: { input: { placeholder = "Write a message..." } = {} } = {}
4287
4347
  } = {}
4288
4348
  } = useThreadConfig();
4289
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerInputStyled, { placeholder, ...props, ref });
4349
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComposerInputStyled, { placeholder, ...props, ref });
4290
4350
  }
4291
4351
  );
4292
4352
  ComposerInput.displayName = "ComposerInput";
@@ -4297,10 +4357,10 @@ var useAllowCancel = () => {
4297
4357
  };
4298
4358
  var ComposerAction = () => {
4299
4359
  const allowCancel = useAllowCancel();
4300
- if (!allowCancel) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerSend, {});
4301
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
4302
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(thread_exports.If, { running: false, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerSend, {}) }),
4303
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(thread_exports.If, { running: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerCancel, {}) })
4360
+ if (!allowCancel) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComposerSend, {});
4361
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
4362
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(thread_exports.If, { running: false, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComposerSend, {}) }),
4363
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(thread_exports.If, { running: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComposerCancel, {}) })
4304
4364
  ] });
4305
4365
  };
4306
4366
  ComposerAction.displayName = "ComposerAction";
@@ -4308,22 +4368,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
4308
4368
  variant: "default",
4309
4369
  className: "aui-composer-send"
4310
4370
  });
4311
- var ComposerSend = (0, import_react61.forwardRef)((props, ref) => {
4371
+ var ComposerSend = (0, import_react62.forwardRef)((props, ref) => {
4312
4372
  const {
4313
4373
  strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
4314
4374
  } = useThreadConfig();
4315
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react3.SendHorizontalIcon, {}) }) });
4375
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react3.SendHorizontalIcon, {}) }) });
4316
4376
  });
4317
4377
  ComposerSend.displayName = "ComposerSend";
4318
4378
  var ComposerCancelButton = withDefaults(TooltipIconButton, {
4319
4379
  variant: "default",
4320
4380
  className: "aui-composer-cancel"
4321
4381
  });
4322
- var ComposerCancel = (0, import_react61.forwardRef)((props, ref) => {
4382
+ var ComposerCancel = (0, import_react62.forwardRef)((props, ref) => {
4323
4383
  const {
4324
4384
  strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
4325
4385
  } = useThreadConfig();
4326
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CircleStopIcon, {}) }) });
4386
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CircleStopIcon, {}) }) });
4327
4387
  });
4328
4388
  ComposerCancel.displayName = "ComposerCancel";
4329
4389
  var exports6 = {
@@ -4336,15 +4396,15 @@ var exports6 = {
4336
4396
  var composer_default = Object.assign(Composer, exports6);
4337
4397
 
4338
4398
  // src/ui/thread-welcome.tsx
4339
- var import_react62 = require("react");
4340
- var import_jsx_runtime37 = require("react/jsx-runtime");
4399
+ var import_react63 = require("react");
4400
+ var import_jsx_runtime38 = require("react/jsx-runtime");
4341
4401
  var ThreadWelcome = () => {
4342
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(ThreadWelcomeRoot, { children: [
4343
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(ThreadWelcomeCenter, { children: [
4344
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeAvatar, {}),
4345
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeMessage, {})
4402
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(ThreadWelcomeRoot, { children: [
4403
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(ThreadWelcomeCenter, { children: [
4404
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThreadWelcomeAvatar, {}),
4405
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThreadWelcomeMessage, {})
4346
4406
  ] }),
4347
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeSuggestions, {})
4407
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThreadWelcomeSuggestions, {})
4348
4408
  ] });
4349
4409
  };
4350
4410
  ThreadWelcome.displayName = "ThreadWelcome";
@@ -4354,22 +4414,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
4354
4414
  var ThreadWelcomeCenter = withDefaults("div", {
4355
4415
  className: "aui-thread-welcome-center"
4356
4416
  });
4357
- var ThreadWelcomeRoot = (0, import_react62.forwardRef)(
4417
+ var ThreadWelcomeRoot = (0, import_react63.forwardRef)(
4358
4418
  (props, ref) => {
4359
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(thread_exports.Empty, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeRootStyled, { ...props, ref }) });
4419
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(thread_exports.Empty, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThreadWelcomeRootStyled, { ...props, ref }) });
4360
4420
  }
4361
4421
  );
4362
4422
  ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
4363
4423
  var ThreadWelcomeAvatar = () => {
4364
4424
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4365
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Avatar, { ...avatar });
4425
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Avatar, { ...avatar });
4366
4426
  };
4367
4427
  var ThreadWelcomeMessageStyled = withDefaults("p", {
4368
4428
  className: "aui-thread-welcome-message"
4369
4429
  });
4370
- var ThreadWelcomeMessage = (0, import_react62.forwardRef)(({ message: messageProp, ...rest }, ref) => {
4430
+ var ThreadWelcomeMessage = (0, import_react63.forwardRef)(({ message: messageProp, ...rest }, ref) => {
4371
4431
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
4372
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
4432
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
4373
4433
  });
4374
4434
  ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
4375
4435
  var ThreadWelcomeSuggestionContainer = withDefaults("div", {
@@ -4381,21 +4441,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
4381
4441
  var ThreadWelcomeSuggestion = ({
4382
4442
  suggestion: { text, prompt }
4383
4443
  }) => {
4384
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4444
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4385
4445
  ThreadWelcomeSuggestionStyled,
4386
4446
  {
4387
4447
  prompt,
4388
4448
  method: "replace",
4389
4449
  autoSend: true,
4390
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
4450
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
4391
4451
  }
4392
4452
  );
4393
4453
  };
4394
4454
  var ThreadWelcomeSuggestions = () => {
4395
4455
  const { welcome: { suggestions } = {} } = useThreadConfig();
4396
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
4456
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
4397
4457
  const key = `${suggestion.prompt}-${idx}`;
4398
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeSuggestion, { suggestion }, key);
4458
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThreadWelcomeSuggestion, { suggestion }, key);
4399
4459
  }) });
4400
4460
  };
4401
4461
  ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
@@ -4410,12 +4470,12 @@ var exports7 = {
4410
4470
  var thread_welcome_default = Object.assign(ThreadWelcome, exports7);
4411
4471
 
4412
4472
  // src/ui/user-message.tsx
4413
- var import_react64 = require("react");
4473
+ var import_react65 = require("react");
4414
4474
 
4415
4475
  // src/ui/user-action-bar.tsx
4416
- var import_react63 = require("react");
4476
+ var import_react64 = require("react");
4417
4477
  var import_lucide_react4 = require("lucide-react");
4418
- var import_jsx_runtime38 = require("react/jsx-runtime");
4478
+ var import_jsx_runtime39 = require("react/jsx-runtime");
4419
4479
  var useAllowEdit = () => {
4420
4480
  const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
4421
4481
  const { useThreadActions } = useThreadContext();
@@ -4425,20 +4485,20 @@ var useAllowEdit = () => {
4425
4485
  var UserActionBar = () => {
4426
4486
  const allowEdit = useAllowEdit();
4427
4487
  if (!allowEdit) return null;
4428
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UserActionBarEdit, {}) });
4488
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UserActionBarEdit, {}) });
4429
4489
  };
4430
4490
  UserActionBar.displayName = "UserActionBar";
4431
4491
  var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
4432
4492
  className: "aui-user-action-bar-root"
4433
4493
  });
4434
4494
  UserActionBarRoot.displayName = "UserActionBarRoot";
4435
- var UserActionBarEdit = (0, import_react63.forwardRef)((props, ref) => {
4495
+ var UserActionBarEdit = (0, import_react64.forwardRef)((props, ref) => {
4436
4496
  const {
4437
4497
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
4438
4498
  } = useThreadConfig();
4439
4499
  const allowEdit = useAllowEdit();
4440
4500
  if (!allowEdit) return null;
4441
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react4.PencilIcon, {}) }) });
4501
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react4.PencilIcon, {}) }) });
4442
4502
  });
4443
4503
  UserActionBarEdit.displayName = "UserActionBarEdit";
4444
4504
  var exports8 = {
@@ -4448,12 +4508,12 @@ var exports8 = {
4448
4508
  var user_action_bar_default = Object.assign(UserActionBar, exports8);
4449
4509
 
4450
4510
  // src/ui/user-message.tsx
4451
- var import_jsx_runtime39 = require("react/jsx-runtime");
4511
+ var import_jsx_runtime40 = require("react/jsx-runtime");
4452
4512
  var UserMessage = () => {
4453
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(UserMessageRoot, { children: [
4454
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(user_action_bar_default, {}),
4455
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UserMessageContent, {}),
4456
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(branch_picker_default, {})
4513
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(UserMessageRoot, { children: [
4514
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(user_action_bar_default, {}),
4515
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(UserMessageContent, {}),
4516
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(branch_picker_default, {})
4457
4517
  ] });
4458
4518
  };
4459
4519
  UserMessage.displayName = "UserMessage";
@@ -4464,9 +4524,9 @@ UserMessageRoot.displayName = "UserMessageRoot";
4464
4524
  var UserMessageContentWrapper = withDefaults("div", {
4465
4525
  className: "aui-user-message-content"
4466
4526
  });
4467
- var UserMessageContent = (0, import_react64.forwardRef)(
4527
+ var UserMessageContent = (0, import_react65.forwardRef)(
4468
4528
  ({ components, ...props }, ref) => {
4469
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4529
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4470
4530
  message_exports.Content,
4471
4531
  {
4472
4532
  components: {
@@ -4485,14 +4545,14 @@ var exports9 = {
4485
4545
  var user_message_default = Object.assign(UserMessage, exports9);
4486
4546
 
4487
4547
  // src/ui/edit-composer.tsx
4488
- var import_react65 = require("react");
4489
- var import_jsx_runtime40 = require("react/jsx-runtime");
4548
+ var import_react66 = require("react");
4549
+ var import_jsx_runtime41 = require("react/jsx-runtime");
4490
4550
  var EditComposer = () => {
4491
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(EditComposerRoot, { children: [
4492
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditComposerInput, {}),
4493
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(EditComposerFooter, { children: [
4494
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditComposerCancel, {}),
4495
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditComposerSend, {})
4551
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(EditComposerRoot, { children: [
4552
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(EditComposerInput, {}),
4553
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(EditComposerFooter, { children: [
4554
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(EditComposerCancel, {}),
4555
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(EditComposerSend, {})
4496
4556
  ] })
4497
4557
  ] });
4498
4558
  };
@@ -4509,23 +4569,23 @@ var EditComposerFooter = withDefaults("div", {
4509
4569
  className: "aui-edit-composer-footer"
4510
4570
  });
4511
4571
  EditComposerFooter.displayName = "EditComposerFooter";
4512
- var EditComposerCancel = (0, import_react65.forwardRef)(
4572
+ var EditComposerCancel = (0, import_react66.forwardRef)(
4513
4573
  (props, ref) => {
4514
4574
  const {
4515
4575
  strings: {
4516
4576
  editComposer: { cancel: { label = "Cancel" } = {} } = {}
4517
4577
  } = {}
4518
4578
  } = useThreadConfig();
4519
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4579
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4520
4580
  }
4521
4581
  );
4522
4582
  EditComposerCancel.displayName = "EditComposerCancel";
4523
- var EditComposerSend = (0, import_react65.forwardRef)(
4583
+ var EditComposerSend = (0, import_react66.forwardRef)(
4524
4584
  (props, ref) => {
4525
4585
  const {
4526
4586
  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
4527
4587
  } = useThreadConfig();
4528
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { ...props, ref, children: props.children ?? label }) });
4588
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Button, { ...props, ref, children: props.children ?? label }) });
4529
4589
  }
4530
4590
  );
4531
4591
  EditComposerSend.displayName = "EditComposerSend";
@@ -4539,23 +4599,23 @@ var exports10 = {
4539
4599
  var edit_composer_default = Object.assign(EditComposer, exports10);
4540
4600
 
4541
4601
  // src/ui/thread.tsx
4542
- var import_jsx_runtime41 = require("react/jsx-runtime");
4602
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4543
4603
  var Thread = (config) => {
4544
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadRoot, { config, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(ThreadViewport, { children: [
4545
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(thread_welcome_default, {}),
4546
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadMessages, {}),
4547
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(ThreadViewportFooter, { children: [
4548
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadScrollToBottom, {}),
4549
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(composer_default, {})
4604
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ThreadRoot, { config, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(ThreadViewport, { children: [
4605
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(thread_welcome_default, {}),
4606
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ThreadMessages, {}),
4607
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(ThreadViewportFooter, { children: [
4608
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ThreadScrollToBottom, {}),
4609
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(composer_default, {})
4550
4610
  ] })
4551
4611
  ] }) });
4552
4612
  };
4553
4613
  var ThreadRootStyled = withDefaults(thread_exports.Root, {
4554
4614
  className: "aui-root aui-thread-root"
4555
4615
  });
4556
- var ThreadRoot = (0, import_react66.forwardRef)(
4616
+ var ThreadRoot = (0, import_react67.forwardRef)(
4557
4617
  ({ config, ...props }, ref) => {
4558
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadRootStyled, { ...props, ref }) });
4618
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ThreadConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ThreadRootStyled, { ...props, ref }) });
4559
4619
  }
4560
4620
  );
4561
4621
  ThreadRoot.displayName = "ThreadRoot";
@@ -4569,7 +4629,7 @@ var ThreadViewportFooter = withDefaults("div", {
4569
4629
  ThreadViewportFooter.displayName = "ThreadViewportFooter";
4570
4630
  var SystemMessage = () => null;
4571
4631
  var ThreadMessages = ({ components, ...rest }) => {
4572
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4632
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4573
4633
  thread_exports.Messages,
4574
4634
  {
4575
4635
  components: {
@@ -4587,13 +4647,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
4587
4647
  variant: "outline",
4588
4648
  className: "aui-thread-scroll-to-bottom"
4589
4649
  });
4590
- var ThreadScrollToBottom = (0, import_react66.forwardRef)((props, ref) => {
4650
+ var ThreadScrollToBottom = (0, import_react67.forwardRef)((props, ref) => {
4591
4651
  const {
4592
4652
  strings: {
4593
4653
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
4594
4654
  } = {}
4595
4655
  } = useThreadConfig();
4596
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react5.ArrowDownIcon, {}) }) });
4656
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react5.ArrowDownIcon, {}) }) });
4597
4657
  });
4598
4658
  ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
4599
4659
  var exports11 = {
@@ -4606,20 +4666,20 @@ var exports11 = {
4606
4666
  var thread_default = Object.assign(Thread, exports11);
4607
4667
 
4608
4668
  // src/ui/assistant-modal.tsx
4609
- var import_jsx_runtime42 = require("react/jsx-runtime");
4669
+ var import_jsx_runtime43 = require("react/jsx-runtime");
4610
4670
  var AssistantModal = (config) => {
4611
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(AssistantModalRoot, { config, children: [
4612
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantModalTrigger, {}),
4613
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantModalContent, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(thread_default, {}) })
4671
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(AssistantModalRoot, { config, children: [
4672
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AssistantModalTrigger, {}),
4673
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AssistantModalContent, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(thread_default, {}) })
4614
4674
  ] });
4615
4675
  };
4616
4676
  AssistantModal.displayName = "AssistantModal";
4617
4677
  var AssistantModalRoot = ({ config, ...props }) => {
4618
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ThreadConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(assistantModal_exports.Root, { ...props }) });
4678
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThreadConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(assistantModal_exports.Root, { ...props }) });
4619
4679
  };
4620
4680
  AssistantModalRoot.displayName = "AssistantModalRoot";
4621
- var AssistantModalTrigger = (0, import_react67.forwardRef)((props, ref) => {
4622
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantModalAnchor, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantModalButton, { ...props, ref }) }) });
4681
+ var AssistantModalTrigger = (0, import_react68.forwardRef)((props, ref) => {
4682
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AssistantModalAnchor, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AssistantModalButton, { ...props, ref }) }) });
4623
4683
  });
4624
4684
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
4625
4685
  var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
@@ -4630,7 +4690,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
4630
4690
  variant: "default",
4631
4691
  className: "aui-modal-button"
4632
4692
  });
4633
- var AssistantModalButton = (0, import_react67.forwardRef)(({ "data-state": state, ...rest }, ref) => {
4693
+ var AssistantModalButton = (0, import_react68.forwardRef)(({ "data-state": state, ...rest }, ref) => {
4634
4694
  const {
4635
4695
  strings: {
4636
4696
  assistantModal: {
@@ -4644,7 +4704,7 @@ var AssistantModalButton = (0, import_react67.forwardRef)(({ "data-state": state
4644
4704
  } = {}
4645
4705
  } = useThreadConfig();
4646
4706
  const tooltip = state === "open" ? openTooltip : closedTooltip;
4647
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4707
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4648
4708
  ModalButtonStyled,
4649
4709
  {
4650
4710
  side: "left",
@@ -4652,15 +4712,15 @@ var AssistantModalButton = (0, import_react67.forwardRef)(({ "data-state": state
4652
4712
  "data-state": state,
4653
4713
  ...rest,
4654
4714
  ref,
4655
- children: rest.children ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
4656
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4715
+ children: rest.children ?? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
4716
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4657
4717
  import_lucide_react6.BotIcon,
4658
4718
  {
4659
4719
  "data-state": state,
4660
4720
  className: "aui-modal-button-closed-icon"
4661
4721
  }
4662
4722
  ),
4663
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4723
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4664
4724
  import_lucide_react6.ChevronDownIcon,
4665
4725
  {
4666
4726
  "data-state": state,