@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.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,20 +1522,20 @@ 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
  };
@@ -1503,16 +1558,16 @@ var MessageContentPartComponent = ({
1503
1558
  case "text":
1504
1559
  if (status.type === "requires-action")
1505
1560
  throw new Error("Encountered unexpected requires-action status");
1506
- if (part === EMPTY_CONTENT) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Empty, { part, status });
1507
- 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 });
1508
1563
  case "image":
1509
1564
  if (status.type === "requires-action")
1510
1565
  throw new Error("Encountered unexpected requires-action status");
1511
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Image2, { part, status });
1566
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Image2, { part, status });
1512
1567
  case "ui":
1513
1568
  if (status.type === "requires-action")
1514
1569
  throw new Error("Encountered unexpected requires-action status");
1515
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UI, { part, status });
1570
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UI, { part, status });
1516
1571
  case "tool-call": {
1517
1572
  const Tool = by_name[part.toolName] || Fallback2;
1518
1573
  const addResult = (result) => addToolResult({
@@ -1520,7 +1575,7 @@ var MessageContentPartComponent = ({
1520
1575
  toolCallId: part.toolCallId,
1521
1576
  result
1522
1577
  });
1523
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tool, { part, status, addResult });
1578
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tool, { part, status, addResult });
1524
1579
  }
1525
1580
  default:
1526
1581
  const unhandledType = type;
@@ -1531,9 +1586,9 @@ var MessageContentPartImpl = ({
1531
1586
  partIndex,
1532
1587
  components
1533
1588
  }) => {
1534
- 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 }) });
1535
1590
  };
1536
- var MessageContentPart = (0, import_react38.memo)(
1591
+ var MessageContentPart = (0, import_react39.memo)(
1537
1592
  MessageContentPartImpl,
1538
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
1539
1594
  );
@@ -1544,7 +1599,7 @@ var MessagePrimitiveContent = ({
1544
1599
  const contentLength = useMessage((s) => s.message.content.length) || 1;
1545
1600
  return new Array(contentLength).fill(null).map((_, idx) => {
1546
1601
  const partIndex = idx;
1547
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1602
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1548
1603
  MessageContentPart,
1549
1604
  {
1550
1605
  partIndex,
@@ -1563,9 +1618,9 @@ var MessagePrimitiveInProgress = () => {
1563
1618
  MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
1564
1619
 
1565
1620
  // src/primitives/branchPicker/BranchPickerRoot.tsx
1566
- var import_jsx_runtime17 = require("react/jsx-runtime");
1567
- var BranchPickerPrimitiveRoot = (0, import_react39.forwardRef)(({ hideWhenSingleBranch, ...rest }, ref) => {
1568
- 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 }) });
1569
1624
  });
1570
1625
  BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
1571
1626
 
@@ -1581,18 +1636,18 @@ __export(composer_exports, {
1581
1636
 
1582
1637
  // src/primitives/composer/ComposerRoot.tsx
1583
1638
  var import_primitive4 = require("@radix-ui/primitive");
1584
- var import_react_primitive7 = require("@radix-ui/react-primitive");
1585
- var import_react40 = require("react");
1586
- var import_jsx_runtime18 = require("react/jsx-runtime");
1587
- 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) => {
1588
1643
  const send = useComposerSend();
1589
1644
  const handleSubmit = (e) => {
1590
1645
  e.preventDefault();
1591
1646
  if (!send) return;
1592
1647
  send();
1593
1648
  };
1594
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1595
- import_react_primitive7.Primitive.form,
1649
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1650
+ import_react_primitive6.Primitive.form,
1596
1651
  {
1597
1652
  ...rest,
1598
1653
  ref: forwardedRef,
@@ -1606,11 +1661,11 @@ ComposerPrimitiveRoot.displayName = "ComposerPrimitive.Root";
1606
1661
  var import_primitive5 = require("@radix-ui/primitive");
1607
1662
  var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
1608
1663
  var import_react_slot = require("@radix-ui/react-slot");
1609
- var import_react41 = require("react");
1664
+ var import_react42 = require("react");
1610
1665
  var import_react_textarea_autosize = __toESM(require("react-textarea-autosize"));
1611
1666
  var import_react_use_escape_keydown = require("@radix-ui/react-use-escape-keydown");
1612
- var import_jsx_runtime19 = require("react/jsx-runtime");
1613
- var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1667
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1668
+ var ComposerPrimitiveInput = (0, import_react42.forwardRef)(
1614
1669
  ({
1615
1670
  autoFocus = false,
1616
1671
  asChild,
@@ -1627,7 +1682,7 @@ var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1627
1682
  });
1628
1683
  const Component = asChild ? import_react_slot.Slot : import_react_textarea_autosize.default;
1629
1684
  const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;
1630
- const textareaRef = (0, import_react41.useRef)(null);
1685
+ const textareaRef = (0, import_react42.useRef)(null);
1631
1686
  const ref = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, textareaRef);
1632
1687
  (0, import_react_use_escape_keydown.useEscapeKeydown)((e) => {
1633
1688
  const composer = useComposer.getState();
@@ -1647,7 +1702,7 @@ var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1647
1702
  }
1648
1703
  };
1649
1704
  const autoFocusEnabled = autoFocus && !isDisabled;
1650
- const focus = (0, import_react41.useCallback)(() => {
1705
+ const focus = (0, import_react42.useCallback)(() => {
1651
1706
  const textarea = textareaRef.current;
1652
1707
  if (!textarea || !autoFocusEnabled) return;
1653
1708
  textarea.focus({ preventScroll: true });
@@ -1656,13 +1711,13 @@ var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1656
1711
  textareaRef.current.value.length
1657
1712
  );
1658
1713
  }, [autoFocusEnabled]);
1659
- (0, import_react41.useEffect)(() => focus(), [focus]);
1714
+ (0, import_react42.useEffect)(() => focus(), [focus]);
1660
1715
  useOnComposerFocus(() => {
1661
1716
  if (type === "new") {
1662
1717
  focus();
1663
1718
  }
1664
1719
  });
1665
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1720
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1666
1721
  Component,
1667
1722
  {
1668
1723
  name: "input",
@@ -1683,14 +1738,14 @@ var ComposerPrimitiveInput = (0, import_react41.forwardRef)(
1683
1738
  ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
1684
1739
 
1685
1740
  // src/primitives/composer/ComposerSend.tsx
1686
- var import_react42 = require("react");
1687
- var import_react_primitive8 = require("@radix-ui/react-primitive");
1688
- var import_jsx_runtime20 = require("react/jsx-runtime");
1689
- 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) => {
1690
1745
  const { useComposer } = useComposerContext();
1691
1746
  const hasValue = useComposer((c) => c.isEditing && c.value.length > 0);
1692
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1693
- import_react_primitive8.Primitive.button,
1747
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1748
+ import_react_primitive7.Primitive.button,
1694
1749
  {
1695
1750
  type: "submit",
1696
1751
  ...rest,
@@ -1739,11 +1794,11 @@ __export(thread_exports, {
1739
1794
  });
1740
1795
 
1741
1796
  // src/primitives/thread/ThreadRoot.tsx
1742
- var import_react_primitive9 = require("@radix-ui/react-primitive");
1743
- var import_react43 = require("react");
1744
- var import_jsx_runtime21 = require("react/jsx-runtime");
1745
- var ThreadPrimitiveRoot = (0, import_react43.forwardRef)((props, ref) => {
1746
- 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 });
1747
1802
  });
1748
1803
  ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
1749
1804
 
@@ -1768,19 +1823,19 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
1768
1823
 
1769
1824
  // src/primitives/thread/ThreadViewport.tsx
1770
1825
  var import_react_compose_refs4 = require("@radix-ui/react-compose-refs");
1771
- var import_react_primitive10 = require("@radix-ui/react-primitive");
1772
- var import_react47 = require("react");
1826
+ var import_react_primitive9 = require("@radix-ui/react-primitive");
1827
+ var import_react48 = require("react");
1773
1828
 
1774
1829
  // src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
1775
1830
  var import_react_compose_refs3 = require("@radix-ui/react-compose-refs");
1776
- var import_react46 = require("react");
1831
+ var import_react47 = require("react");
1777
1832
 
1778
1833
  // src/utils/hooks/useOnResizeContent.tsx
1779
- var import_react_use_callback_ref2 = require("@radix-ui/react-use-callback-ref");
1780
- 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");
1781
1836
  var useOnResizeContent = (callback) => {
1782
- const callbackRef = (0, import_react_use_callback_ref2.useCallbackRef)(callback);
1783
- const refCallback = (0, import_react44.useCallback)(
1837
+ const callbackRef = (0, import_react_use_callback_ref3.useCallbackRef)(callback);
1838
+ const refCallback = (0, import_react45.useCallback)(
1784
1839
  (el) => {
1785
1840
  const resizeObserver = new ResizeObserver(() => {
1786
1841
  callbackRef();
@@ -1816,12 +1871,12 @@ var useOnResizeContent = (callback) => {
1816
1871
  };
1817
1872
 
1818
1873
  // src/utils/hooks/useOnScrollToBottom.tsx
1819
- var import_react_use_callback_ref3 = require("@radix-ui/react-use-callback-ref");
1820
- 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");
1821
1876
  var useOnScrollToBottom = (callback) => {
1822
- const callbackRef = (0, import_react_use_callback_ref3.useCallbackRef)(callback);
1877
+ const callbackRef = (0, import_react_use_callback_ref4.useCallbackRef)(callback);
1823
1878
  const { useViewport } = useThreadContext();
1824
- (0, import_react45.useEffect)(() => {
1879
+ (0, import_react46.useEffect)(() => {
1825
1880
  return useViewport.getState().onScrollToBottom(() => {
1826
1881
  callbackRef();
1827
1882
  });
@@ -1832,10 +1887,10 @@ var useOnScrollToBottom = (callback) => {
1832
1887
  var useThreadViewportAutoScroll = ({
1833
1888
  autoScroll = true
1834
1889
  }) => {
1835
- const divRef = (0, import_react46.useRef)(null);
1890
+ const divRef = (0, import_react47.useRef)(null);
1836
1891
  const { useViewport } = useThreadContext();
1837
- const lastScrollTop = (0, import_react46.useRef)(0);
1838
- const isScrollingToBottomRef = (0, import_react46.useRef)(false);
1892
+ const lastScrollTop = (0, import_react47.useRef)(0);
1893
+ const isScrollingToBottomRef = (0, import_react47.useRef)(false);
1839
1894
  const scrollToBottom = (behavior) => {
1840
1895
  const div = divRef.current;
1841
1896
  if (!div || !autoScroll) return;
@@ -1880,29 +1935,29 @@ var useThreadViewportAutoScroll = ({
1880
1935
  };
1881
1936
 
1882
1937
  // src/primitives/thread/ThreadViewport.tsx
1883
- var import_jsx_runtime22 = require("react/jsx-runtime");
1884
- 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) => {
1885
1940
  const autoScrollRef = useThreadViewportAutoScroll({
1886
1941
  autoScroll
1887
1942
  });
1888
1943
  const ref = (0, import_react_compose_refs4.useComposedRefs)(forwardedRef, autoScrollRef);
1889
- 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 });
1890
1945
  });
1891
1946
  ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
1892
1947
 
1893
1948
  // src/primitives/thread/ThreadMessages.tsx
1894
- var import_react49 = require("react");
1949
+ var import_react50 = require("react");
1895
1950
 
1896
1951
  // src/context/providers/MessageProvider.tsx
1897
- var import_react48 = require("react");
1898
- var import_zustand13 = require("zustand");
1952
+ var import_react49 = require("react");
1953
+ var import_zustand14 = require("zustand");
1899
1954
 
1900
1955
  // src/context/stores/EditComposer.ts
1901
- var import_zustand11 = require("zustand");
1956
+ var import_zustand12 = require("zustand");
1902
1957
  var makeEditComposerStore = ({
1903
1958
  onEdit,
1904
1959
  onSend
1905
- }) => (0, import_zustand11.create)()((set, get, store) => ({
1960
+ }) => (0, import_zustand12.create)()((set, get, store) => ({
1906
1961
  ...makeBaseComposer(set, get, store),
1907
1962
  canCancel: false,
1908
1963
  isEditing: false,
@@ -1921,8 +1976,8 @@ var makeEditComposerStore = ({
1921
1976
  }));
1922
1977
 
1923
1978
  // src/context/stores/MessageUtils.ts
1924
- var import_zustand12 = require("zustand");
1925
- var makeMessageUtilsStore = () => (0, import_zustand12.create)((set) => ({
1979
+ var import_zustand13 = require("zustand");
1980
+ var makeMessageUtilsStore = () => (0, import_zustand13.create)((set) => ({
1926
1981
  isCopied: false,
1927
1982
  setIsCopied: (value) => {
1928
1983
  set({ isCopied: value });
@@ -1934,7 +1989,7 @@ var makeMessageUtilsStore = () => (0, import_zustand12.create)((set) => ({
1934
1989
  }));
1935
1990
 
1936
1991
  // src/context/providers/MessageProvider.tsx
1937
- var import_jsx_runtime23 = require("react/jsx-runtime");
1992
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1938
1993
  var getIsLast = (messages, message) => {
1939
1994
  return messages[messages.length - 1]?.id === message.id;
1940
1995
  };
@@ -1956,8 +2011,8 @@ var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
1956
2011
  };
1957
2012
  var useMessageContext2 = (messageIndex) => {
1958
2013
  const { useThreadMessages, useThreadActions } = useThreadContext();
1959
- const [context] = (0, import_react48.useState)(() => {
1960
- const useMessage = (0, import_zustand13.create)(
2014
+ const [context] = (0, import_react49.useState)(() => {
2015
+ const useMessage = (0, import_zustand14.create)(
1961
2016
  () => getMessageState(
1962
2017
  useThreadMessages.getState(),
1963
2018
  useThreadActions.getState().getBranches,
@@ -1994,7 +2049,7 @@ var useMessageContext2 = (messageIndex) => {
1994
2049
  });
1995
2050
  return { useMessage, useMessageUtils, useEditComposer };
1996
2051
  });
1997
- (0, import_react48.useEffect)(() => {
2052
+ (0, import_react49.useEffect)(() => {
1998
2053
  const syncMessage = (thread) => {
1999
2054
  const newState = getMessageState(
2000
2055
  thread,
@@ -2018,11 +2073,11 @@ var MessageProvider = ({
2018
2073
  children
2019
2074
  }) => {
2020
2075
  const context = useMessageContext2(messageIndex);
2021
- 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 });
2022
2077
  };
2023
2078
 
2024
2079
  // src/primitives/thread/ThreadMessages.tsx
2025
- var import_jsx_runtime24 = require("react/jsx-runtime");
2080
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2026
2081
  var DEFAULT_SYSTEM_MESSAGE = () => null;
2027
2082
  var getComponents = (components) => {
2028
2083
  return {
@@ -2037,16 +2092,16 @@ var ThreadMessageImpl = ({
2037
2092
  components
2038
2093
  }) => {
2039
2094
  const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
2040
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(MessageProvider, { messageIndex, children: [
2041
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(MessagePrimitiveIf, { user: true, children: [
2042
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UserMessage2, {}) }),
2043
- /* @__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, {}) })
2044
2099
  ] }),
2045
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AssistantMessage2, {}) }),
2046
- /* @__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, {}) })
2047
2102
  ] });
2048
2103
  };
2049
- var ThreadMessage = (0, import_react49.memo)(
2104
+ var ThreadMessage = (0, import_react50.memo)(
2050
2105
  ThreadMessageImpl,
2051
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
2052
2107
  );
@@ -2058,7 +2113,7 @@ var ThreadPrimitiveMessagesImpl = ({
2058
2113
  if (messagesLength === 0) return null;
2059
2114
  return new Array(messagesLength).fill(null).map((_, idx) => {
2060
2115
  const messageIndex = idx;
2061
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2116
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2062
2117
  ThreadMessage,
2063
2118
  {
2064
2119
  messageIndex,
@@ -2069,7 +2124,7 @@ var ThreadPrimitiveMessagesImpl = ({
2069
2124
  });
2070
2125
  };
2071
2126
  ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
2072
- var ThreadPrimitiveMessages = (0, import_react49.memo)(
2127
+ var ThreadPrimitiveMessages = (0, import_react50.memo)(
2073
2128
  ThreadPrimitiveMessagesImpl,
2074
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
2075
2130
  );
@@ -2088,7 +2143,7 @@ var ThreadPrimitiveSuggestion = createActionButton(
2088
2143
  );
2089
2144
 
2090
2145
  // src/runtimes/local/useLocalRuntime.tsx
2091
- var import_react54 = require("react");
2146
+ var import_react55 = require("react");
2092
2147
 
2093
2148
  // src/runtimes/core/BaseAssistantRuntime.tsx
2094
2149
  var BaseAssistantRuntime = class {
@@ -2121,7 +2176,9 @@ __export(internal_exports, {
2121
2176
  ProxyConfigProvider: () => ProxyConfigProvider,
2122
2177
  TooltipIconButton: () => TooltipIconButton,
2123
2178
  generateId: () => generateId,
2124
- useSmooth: () => useSmooth
2179
+ useSmooth: () => useSmooth,
2180
+ useSmoothStatus: () => useSmoothStatus,
2181
+ withSmoothContextProvider: () => withSmoothContextProvider
2125
2182
  });
2126
2183
 
2127
2184
  // src/utils/idUtils.tsx
@@ -2345,15 +2402,15 @@ var MessageRepository = class {
2345
2402
  };
2346
2403
 
2347
2404
  // src/ui/base/tooltip-icon-button.tsx
2348
- var import_react52 = require("react");
2405
+ var import_react53 = require("react");
2349
2406
 
2350
2407
  // src/ui/base/tooltip.tsx
2351
2408
  var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
2352
2409
 
2353
2410
  // src/ui/utils/withDefaults.tsx
2354
- var import_react50 = require("react");
2411
+ var import_react51 = require("react");
2355
2412
  var import_classnames = __toESM(require("classnames"));
2356
- var import_jsx_runtime25 = require("react/jsx-runtime");
2413
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2357
2414
  var withDefaultProps = ({
2358
2415
  className,
2359
2416
  ...defaultProps
@@ -2366,10 +2423,10 @@ var withDefaultProps = ({
2366
2423
  };
2367
2424
  var withDefaults = (Component, defaultProps) => {
2368
2425
  const getProps = withDefaultProps(defaultProps);
2369
- const WithDefaults = (0, import_react50.forwardRef)(
2426
+ const WithDefaults = (0, import_react51.forwardRef)(
2370
2427
  (props, ref) => {
2371
2428
  const ComponentAsAny = Component;
2372
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComponentAsAny, { ...getProps(props), ref });
2429
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ComponentAsAny, { ...getProps(props), ref });
2373
2430
  }
2374
2431
  );
2375
2432
  WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
@@ -2377,9 +2434,9 @@ var withDefaults = (Component, defaultProps) => {
2377
2434
  };
2378
2435
 
2379
2436
  // src/ui/base/tooltip.tsx
2380
- var import_jsx_runtime26 = require("react/jsx-runtime");
2437
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2381
2438
  var Tooltip = (props) => {
2382
- 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 }) });
2383
2440
  };
2384
2441
  Tooltip.displayName = "Tooltip";
2385
2442
  var TooltipTrigger = TooltipPrimitive.Trigger;
@@ -2391,9 +2448,9 @@ TooltipContent.displayName = "TooltipContent";
2391
2448
 
2392
2449
  // src/ui/base/button.tsx
2393
2450
  var import_class_variance_authority = require("class-variance-authority");
2394
- var import_react_primitive11 = require("@radix-ui/react-primitive");
2395
- var import_react51 = require("react");
2396
- 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");
2397
2454
  var buttonVariants = (0, import_class_variance_authority.cva)("aui-button", {
2398
2455
  variants: {
2399
2456
  variant: {
@@ -2411,10 +2468,10 @@ var buttonVariants = (0, import_class_variance_authority.cva)("aui-button", {
2411
2468
  size: "default"
2412
2469
  }
2413
2470
  });
2414
- var Button = (0, import_react51.forwardRef)(
2471
+ var Button = (0, import_react52.forwardRef)(
2415
2472
  ({ className, variant, size, ...props }, ref) => {
2416
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2417
- import_react_primitive11.Primitive.button,
2473
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2474
+ import_react_primitive10.Primitive.button,
2418
2475
  {
2419
2476
  className: buttonVariants({ variant, size, className }),
2420
2477
  ...props,
@@ -2426,14 +2483,14 @@ var Button = (0, import_react51.forwardRef)(
2426
2483
  Button.displayName = "Button";
2427
2484
 
2428
2485
  // src/ui/base/tooltip-icon-button.tsx
2429
- var import_jsx_runtime28 = require("react/jsx-runtime");
2430
- var TooltipIconButton = (0, import_react52.forwardRef)(({ children, tooltip, side = "bottom", ...rest }, ref) => {
2431
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
2432
- /* @__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: [
2433
2490
  children,
2434
- /* @__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 })
2435
2492
  ] }) }),
2436
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipContent, { side, children: tooltip })
2493
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipContent, { side, children: tooltip })
2437
2494
  ] });
2438
2495
  });
2439
2496
  TooltipIconButton.displayName = "TooltipIconButton";
@@ -2723,7 +2780,7 @@ var toLanguageModelTools = (tools) => {
2723
2780
  };
2724
2781
 
2725
2782
  // src/runtimes/edge/useEdgeRuntime.ts
2726
- var import_react53 = require("react");
2783
+ var import_react54 = require("react");
2727
2784
 
2728
2785
  // src/runtimes/edge/streams/assistantDecoderStream.ts
2729
2786
  function assistantDecoderStream() {
@@ -3463,7 +3520,7 @@ var useEdgeRuntime = ({
3463
3520
  initialMessages,
3464
3521
  ...options
3465
3522
  }) => {
3466
- const [adapter] = (0, import_react53.useState)(() => new EdgeChatAdapter(options));
3523
+ const [adapter] = (0, import_react54.useState)(() => new EdgeChatAdapter(options));
3467
3524
  return useLocalRuntime(adapter, { initialMessages });
3468
3525
  };
3469
3526
 
@@ -3677,15 +3734,15 @@ var LocalRuntime = class extends BaseAssistantRuntime {
3677
3734
 
3678
3735
  // src/runtimes/local/useLocalRuntime.tsx
3679
3736
  var useLocalRuntime = (adapter, options) => {
3680
- const [runtime] = (0, import_react54.useState)(() => new LocalRuntime(adapter, options));
3681
- (0, import_react54.useInsertionEffect)(() => {
3737
+ const [runtime] = (0, import_react55.useState)(() => new LocalRuntime(adapter, options));
3738
+ (0, import_react55.useInsertionEffect)(() => {
3682
3739
  runtime.adapter = adapter;
3683
3740
  });
3684
3741
  return runtime;
3685
3742
  };
3686
3743
 
3687
3744
  // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
3688
- var import_zustand14 = require("zustand");
3745
+ var import_zustand15 = require("zustand");
3689
3746
 
3690
3747
  // src/runtimes/external-store/getExternalStoreMessage.tsx
3691
3748
  var symbolInnerMessage = Symbol("innerMessage");
@@ -3694,7 +3751,7 @@ var getExternalStoreMessage = (message) => {
3694
3751
  };
3695
3752
 
3696
3753
  // src/runtimes/external-store/useExternalStoreSync.tsx
3697
- var import_react55 = require("react");
3754
+ var import_react56 = require("react");
3698
3755
 
3699
3756
  // src/runtimes/external-store/ThreadMessageConverter.ts
3700
3757
  var ThreadMessageConverter = class {
@@ -3788,11 +3845,11 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
3788
3845
 
3789
3846
  // src/runtimes/external-store/useExternalStoreSync.tsx
3790
3847
  var useExternalStoreSync = (adapter, updateData) => {
3791
- const adapterRef = (0, import_react55.useRef)(adapter);
3792
- (0, import_react55.useInsertionEffect)(() => {
3848
+ const adapterRef = (0, import_react56.useRef)(adapter);
3849
+ (0, import_react56.useInsertionEffect)(() => {
3793
3850
  adapterRef.current = adapter;
3794
3851
  });
3795
- const [converter, convertCallback] = (0, import_react55.useMemo)(() => {
3852
+ const [converter, convertCallback] = (0, import_react56.useMemo)(() => {
3796
3853
  const converter2 = adapter.convertMessage ?? ((m) => m);
3797
3854
  const convertCallback2 = (cache, m, idx) => {
3798
3855
  const autoStatus = getAutoStatus(
@@ -3811,7 +3868,7 @@ var useExternalStoreSync = (adapter, updateData) => {
3811
3868
  };
3812
3869
  return [new ThreadMessageConverter(), convertCallback2];
3813
3870
  }, [adapter.convertMessage]);
3814
- (0, import_react55.useEffect)(() => {
3871
+ (0, import_react56.useEffect)(() => {
3815
3872
  updateData(
3816
3873
  adapter.isDisabled ?? false,
3817
3874
  adapter.isRunning ?? false,
@@ -3839,7 +3896,7 @@ var ExternalStoreThreadRuntime = class {
3839
3896
  store.isRunning ?? false,
3840
3897
  store.messages
3841
3898
  );
3842
- this.useStore = (0, import_zustand14.create)(() => ({
3899
+ this.useStore = (0, import_zustand15.create)(() => ({
3843
3900
  store
3844
3901
  }));
3845
3902
  }
@@ -3980,45 +4037,45 @@ var ExternalStoreRuntime = class extends BaseAssistantRuntime {
3980
4037
  };
3981
4038
 
3982
4039
  // src/runtimes/external-store/useExternalStoreRuntime.tsx
3983
- var import_react56 = require("react");
4040
+ var import_react57 = require("react");
3984
4041
  var useExternalStoreRuntime = (store) => {
3985
- const [runtime] = (0, import_react56.useState)(() => new ExternalStoreRuntime(store));
3986
- (0, import_react56.useInsertionEffect)(() => {
4042
+ const [runtime] = (0, import_react57.useState)(() => new ExternalStoreRuntime(store));
4043
+ (0, import_react57.useInsertionEffect)(() => {
3987
4044
  runtime.store = store;
3988
4045
  });
3989
- (0, import_react56.useEffect)(() => {
4046
+ (0, import_react57.useEffect)(() => {
3990
4047
  runtime.onStoreUpdated();
3991
4048
  });
3992
4049
  return runtime;
3993
4050
  };
3994
4051
 
3995
4052
  // src/ui/thread-config.tsx
3996
- var import_react57 = require("react");
3997
- var import_jsx_runtime29 = require("react/jsx-runtime");
3998
- 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)({});
3999
4056
  var useThreadConfig = () => {
4000
- return (0, import_react57.useContext)(ThreadConfigContext);
4057
+ return (0, import_react58.useContext)(ThreadConfigContext);
4001
4058
  };
4002
4059
  var ThreadConfigProvider = ({
4003
4060
  children,
4004
4061
  config
4005
4062
  }) => {
4006
4063
  const assistant = useAssistantContext({ optional: true });
4007
- 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 });
4008
4065
  if (!config?.runtime) return configProvider;
4009
4066
  if (assistant) {
4010
4067
  throw new Error(
4011
4068
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
4012
4069
  );
4013
4070
  }
4014
- 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 });
4015
4072
  };
4016
4073
  ThreadConfigProvider.displayName = "ThreadConfigProvider";
4017
4074
 
4018
4075
  // src/ui/assistant-action-bar.tsx
4019
- var import_react58 = require("react");
4076
+ var import_react59 = require("react");
4020
4077
  var import_lucide_react = require("lucide-react");
4021
- var import_jsx_runtime30 = require("react/jsx-runtime");
4078
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4022
4079
  var useAllowCopy = () => {
4023
4080
  const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
4024
4081
  const { useThreadActions } = useThreadContext();
@@ -4035,15 +4092,15 @@ var AssistantActionBar = () => {
4035
4092
  const allowCopy = useAllowCopy();
4036
4093
  const allowReload = useAllowReload();
4037
4094
  if (!allowCopy && !allowReload) return null;
4038
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4095
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4039
4096
  AssistantActionBarRoot,
4040
4097
  {
4041
4098
  hideWhenRunning: true,
4042
4099
  autohide: "not-last",
4043
4100
  autohideFloat: "single-branch",
4044
4101
  children: [
4045
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AssistantActionBarCopy, {}),
4046
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AssistantActionBarReload, {})
4102
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AssistantActionBarCopy, {}),
4103
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AssistantActionBarReload, {})
4047
4104
  ]
4048
4105
  }
4049
4106
  );
@@ -4053,7 +4110,7 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
4053
4110
  className: "aui-assistant-action-bar-root"
4054
4111
  });
4055
4112
  AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
4056
- var AssistantActionBarCopy = (0, import_react58.forwardRef)((props, ref) => {
4113
+ var AssistantActionBarCopy = (0, import_react59.forwardRef)((props, ref) => {
4057
4114
  const {
4058
4115
  strings: {
4059
4116
  assistantMessage: { reload: { tooltip = "Copy" } = {} } = {}
@@ -4061,13 +4118,13 @@ var AssistantActionBarCopy = (0, import_react58.forwardRef)((props, ref) => {
4061
4118
  } = useThreadConfig();
4062
4119
  const allowCopy = useAllowCopy();
4063
4120
  if (!allowCopy) return null;
4064
- 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: [
4065
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(message_exports.If, { copied: true, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react.CheckIcon, {}) }),
4066
- /* @__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, {}) })
4067
4124
  ] }) }) });
4068
4125
  });
4069
4126
  AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
4070
- var AssistantActionBarReload = (0, import_react58.forwardRef)((props, ref) => {
4127
+ var AssistantActionBarReload = (0, import_react59.forwardRef)((props, ref) => {
4071
4128
  const {
4072
4129
  strings: {
4073
4130
  assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
@@ -4075,7 +4132,7 @@ var AssistantActionBarReload = (0, import_react58.forwardRef)((props, ref) => {
4075
4132
  } = useThreadConfig();
4076
4133
  const allowReload = useAllowReload();
4077
4134
  if (!allowReload) return null;
4078
- 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, {}) }) });
4079
4136
  });
4080
4137
  AssistantActionBarReload.displayName = "AssistantActionBarReload";
4081
4138
  var exports2 = {
@@ -4089,12 +4146,12 @@ var assistant_action_bar_default = Object.assign(
4089
4146
  );
4090
4147
 
4091
4148
  // src/ui/assistant-message.tsx
4092
- var import_react60 = require("react");
4149
+ var import_react61 = require("react");
4093
4150
 
4094
4151
  // src/ui/branch-picker.tsx
4095
- var import_react59 = require("react");
4152
+ var import_react60 = require("react");
4096
4153
  var import_lucide_react2 = require("lucide-react");
4097
- var import_jsx_runtime31 = require("react/jsx-runtime");
4154
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4098
4155
  var useAllowBranchPicker = () => {
4099
4156
  const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
4100
4157
  const { useThreadActions } = useThreadContext();
@@ -4104,10 +4161,10 @@ var useAllowBranchPicker = () => {
4104
4161
  var BranchPicker = () => {
4105
4162
  const allowBranchPicker = useAllowBranchPicker();
4106
4163
  if (!allowBranchPicker) return null;
4107
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
4108
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BranchPickerPrevious2, {}),
4109
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BranchPickerState, {}),
4110
- /* @__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, {})
4111
4168
  ] });
4112
4169
  };
4113
4170
  BranchPicker.displayName = "BranchPicker";
@@ -4115,31 +4172,31 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
4115
4172
  className: "aui-branch-picker-root"
4116
4173
  });
4117
4174
  BranchPickerRoot.displayName = "BranchPickerRoot";
4118
- var BranchPickerPrevious2 = (0, import_react59.forwardRef)((props, ref) => {
4175
+ var BranchPickerPrevious2 = (0, import_react60.forwardRef)((props, ref) => {
4119
4176
  const {
4120
4177
  strings: {
4121
4178
  branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
4122
4179
  } = {}
4123
4180
  } = useThreadConfig();
4124
- 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, {}) }) });
4125
4182
  });
4126
4183
  BranchPickerPrevious2.displayName = "BranchPickerPrevious";
4127
4184
  var BranchPickerStateWrapper = withDefaults("span", {
4128
4185
  className: "aui-branch-picker-state"
4129
4186
  });
4130
- var BranchPickerState = (0, import_react59.forwardRef)((props, ref) => {
4131
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(BranchPickerStateWrapper, { ...props, ref, children: [
4132
- /* @__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, {}),
4133
4190
  " / ",
4134
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(branchPicker_exports.Count, {})
4191
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(branchPicker_exports.Count, {})
4135
4192
  ] });
4136
4193
  });
4137
4194
  BranchPickerState.displayName = "BranchPickerState";
4138
- var BranchPickerNext = (0, import_react59.forwardRef)((props, ref) => {
4195
+ var BranchPickerNext = (0, import_react60.forwardRef)((props, ref) => {
4139
4196
  const {
4140
4197
  strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
4141
4198
  } = useThreadConfig();
4142
- 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, {}) }) });
4143
4200
  });
4144
4201
  BranchPickerNext.displayName = "BranchPickerNext";
4145
4202
  var exports3 = {
@@ -4151,12 +4208,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports3);
4151
4208
 
4152
4209
  // src/ui/base/avatar.tsx
4153
4210
  var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
4154
- var import_jsx_runtime32 = require("react/jsx-runtime");
4211
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4155
4212
  var Avatar = ({ src, alt, fallback }) => {
4156
4213
  if (src == null && fallback == null) return null;
4157
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(AvatarRoot, { children: [
4158
- src != null && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AvatarImage, { src, alt }),
4159
- 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 })
4160
4217
  ] });
4161
4218
  };
4162
4219
  Avatar.displayName = "Avatar";
@@ -4175,36 +4232,37 @@ AvatarFallback.displayName = "AvatarFallback";
4175
4232
 
4176
4233
  // src/ui/content-part.tsx
4177
4234
  var import_classnames2 = __toESM(require("classnames"));
4178
- var import_jsx_runtime33 = require("react/jsx-runtime");
4179
- var Text = ({ status }) => {
4180
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4181
- "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,
4182
4240
  {
4183
4241
  className: (0, import_classnames2.default)(
4184
4242
  "aui-text",
4185
- status.type === "running" && "aui-text-in-progress"
4243
+ status.type === "running" && "aui-text-running"
4186
4244
  ),
4187
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(contentPart_exports.Text, {})
4245
+ component: "p"
4188
4246
  }
4189
4247
  );
4190
4248
  };
4191
- var exports4 = { Text };
4249
+ var exports4 = { Text: withSmoothContextProvider(Text) };
4192
4250
  var content_part_default = exports4;
4193
4251
 
4194
4252
  // src/ui/assistant-message.tsx
4195
- var import_jsx_runtime34 = require("react/jsx-runtime");
4253
+ var import_jsx_runtime35 = require("react/jsx-runtime");
4196
4254
  var AssistantMessage = () => {
4197
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(AssistantMessageRoot, { children: [
4198
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AssistantMessageAvatar, {}),
4199
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AssistantMessageContent, {}),
4200
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(branch_picker_default, {}),
4201
- /* @__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, {})
4202
4260
  ] });
4203
4261
  };
4204
4262
  AssistantMessage.displayName = "AssistantMessage";
4205
4263
  var AssistantMessageAvatar = () => {
4206
4264
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4207
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Avatar, { ...avatar });
4265
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Avatar, { ...avatar });
4208
4266
  };
4209
4267
  var AssistantMessageRoot = withDefaults(message_exports.Root, {
4210
4268
  className: "aui-assistant-message-root"
@@ -4213,9 +4271,9 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
4213
4271
  var AssistantMessageContentWrapper = withDefaults("div", {
4214
4272
  className: "aui-assistant-message-content"
4215
4273
  });
4216
- var AssistantMessageContent = (0, import_react60.forwardRef)(({ components: componentsProp, ...rest }, ref) => {
4274
+ var AssistantMessageContent = (0, import_react61.forwardRef)(({ components: componentsProp, ...rest }, ref) => {
4217
4275
  const { assistantMessage: { components = {} } = {} } = useThreadConfig();
4218
- 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)(
4219
4277
  message_exports.Content,
4220
4278
  {
4221
4279
  components: {
@@ -4237,38 +4295,38 @@ var assistant_message_default = Object.assign(
4237
4295
  );
4238
4296
 
4239
4297
  // src/ui/assistant-modal.tsx
4240
- var import_react67 = require("react");
4298
+ var import_react68 = require("react");
4241
4299
  var import_lucide_react6 = require("lucide-react");
4242
4300
 
4243
4301
  // src/ui/thread.tsx
4244
- var import_react66 = require("react");
4302
+ var import_react67 = require("react");
4245
4303
  var import_lucide_react5 = require("lucide-react");
4246
4304
 
4247
4305
  // src/ui/composer.tsx
4248
- var import_react61 = require("react");
4306
+ var import_react62 = require("react");
4249
4307
  var import_lucide_react3 = require("lucide-react");
4250
4308
 
4251
4309
  // src/ui/base/CircleStopIcon.tsx
4252
- var import_jsx_runtime35 = require("react/jsx-runtime");
4310
+ var import_jsx_runtime36 = require("react/jsx-runtime");
4253
4311
  var CircleStopIcon = () => {
4254
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4312
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4255
4313
  "svg",
4256
4314
  {
4257
4315
  xmlns: "http://www.w3.org/2000/svg",
4258
4316
  viewBox: "0 0 16 16",
4259
4317
  fill: "currentColor",
4260
- 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" })
4261
4319
  }
4262
4320
  );
4263
4321
  };
4264
4322
  CircleStopIcon.displayName = "CircleStopIcon";
4265
4323
 
4266
4324
  // src/ui/composer.tsx
4267
- var import_jsx_runtime36 = require("react/jsx-runtime");
4325
+ var import_jsx_runtime37 = require("react/jsx-runtime");
4268
4326
  var Composer = () => {
4269
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(ComposerRoot, { children: [
4270
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerInput, { autoFocus: true }),
4271
- /* @__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, {})
4272
4330
  ] });
4273
4331
  };
4274
4332
  Composer.displayName = "Composer";
@@ -4281,14 +4339,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
4281
4339
  autoFocus: true,
4282
4340
  className: "aui-composer-input"
4283
4341
  });
4284
- var ComposerInput = (0, import_react61.forwardRef)(
4342
+ var ComposerInput = (0, import_react62.forwardRef)(
4285
4343
  (props, ref) => {
4286
4344
  const {
4287
4345
  strings: {
4288
4346
  composer: { input: { placeholder = "Write a message..." } = {} } = {}
4289
4347
  } = {}
4290
4348
  } = useThreadConfig();
4291
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerInputStyled, { placeholder, ...props, ref });
4349
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ComposerInputStyled, { placeholder, ...props, ref });
4292
4350
  }
4293
4351
  );
4294
4352
  ComposerInput.displayName = "ComposerInput";
@@ -4299,10 +4357,10 @@ var useAllowCancel = () => {
4299
4357
  };
4300
4358
  var ComposerAction = () => {
4301
4359
  const allowCancel = useAllowCancel();
4302
- if (!allowCancel) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerSend, {});
4303
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
4304
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(thread_exports.If, { running: false, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerSend, {}) }),
4305
- /* @__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, {}) })
4306
4364
  ] });
4307
4365
  };
4308
4366
  ComposerAction.displayName = "ComposerAction";
@@ -4310,22 +4368,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
4310
4368
  variant: "default",
4311
4369
  className: "aui-composer-send"
4312
4370
  });
4313
- var ComposerSend = (0, import_react61.forwardRef)((props, ref) => {
4371
+ var ComposerSend = (0, import_react62.forwardRef)((props, ref) => {
4314
4372
  const {
4315
4373
  strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
4316
4374
  } = useThreadConfig();
4317
- 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, {}) }) });
4318
4376
  });
4319
4377
  ComposerSend.displayName = "ComposerSend";
4320
4378
  var ComposerCancelButton = withDefaults(TooltipIconButton, {
4321
4379
  variant: "default",
4322
4380
  className: "aui-composer-cancel"
4323
4381
  });
4324
- var ComposerCancel = (0, import_react61.forwardRef)((props, ref) => {
4382
+ var ComposerCancel = (0, import_react62.forwardRef)((props, ref) => {
4325
4383
  const {
4326
4384
  strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
4327
4385
  } = useThreadConfig();
4328
- 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, {}) }) });
4329
4387
  });
4330
4388
  ComposerCancel.displayName = "ComposerCancel";
4331
4389
  var exports6 = {
@@ -4338,15 +4396,15 @@ var exports6 = {
4338
4396
  var composer_default = Object.assign(Composer, exports6);
4339
4397
 
4340
4398
  // src/ui/thread-welcome.tsx
4341
- var import_react62 = require("react");
4342
- var import_jsx_runtime37 = require("react/jsx-runtime");
4399
+ var import_react63 = require("react");
4400
+ var import_jsx_runtime38 = require("react/jsx-runtime");
4343
4401
  var ThreadWelcome = () => {
4344
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(ThreadWelcomeRoot, { children: [
4345
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(ThreadWelcomeCenter, { children: [
4346
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeAvatar, {}),
4347
- /* @__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, {})
4348
4406
  ] }),
4349
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeSuggestions, {})
4407
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThreadWelcomeSuggestions, {})
4350
4408
  ] });
4351
4409
  };
4352
4410
  ThreadWelcome.displayName = "ThreadWelcome";
@@ -4356,22 +4414,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
4356
4414
  var ThreadWelcomeCenter = withDefaults("div", {
4357
4415
  className: "aui-thread-welcome-center"
4358
4416
  });
4359
- var ThreadWelcomeRoot = (0, import_react62.forwardRef)(
4417
+ var ThreadWelcomeRoot = (0, import_react63.forwardRef)(
4360
4418
  (props, ref) => {
4361
- 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 }) });
4362
4420
  }
4363
4421
  );
4364
4422
  ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
4365
4423
  var ThreadWelcomeAvatar = () => {
4366
4424
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
4367
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Avatar, { ...avatar });
4425
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Avatar, { ...avatar });
4368
4426
  };
4369
4427
  var ThreadWelcomeMessageStyled = withDefaults("p", {
4370
4428
  className: "aui-thread-welcome-message"
4371
4429
  });
4372
- var ThreadWelcomeMessage = (0, import_react62.forwardRef)(({ message: messageProp, ...rest }, ref) => {
4430
+ var ThreadWelcomeMessage = (0, import_react63.forwardRef)(({ message: messageProp, ...rest }, ref) => {
4373
4431
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
4374
- 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 });
4375
4433
  });
4376
4434
  ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
4377
4435
  var ThreadWelcomeSuggestionContainer = withDefaults("div", {
@@ -4383,21 +4441,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
4383
4441
  var ThreadWelcomeSuggestion = ({
4384
4442
  suggestion: { text, prompt }
4385
4443
  }) => {
4386
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4444
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4387
4445
  ThreadWelcomeSuggestionStyled,
4388
4446
  {
4389
4447
  prompt,
4390
4448
  method: "replace",
4391
4449
  autoSend: true,
4392
- 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 })
4393
4451
  }
4394
4452
  );
4395
4453
  };
4396
4454
  var ThreadWelcomeSuggestions = () => {
4397
4455
  const { welcome: { suggestions } = {} } = useThreadConfig();
4398
- 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) => {
4399
4457
  const key = `${suggestion.prompt}-${idx}`;
4400
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeSuggestion, { suggestion }, key);
4458
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThreadWelcomeSuggestion, { suggestion }, key);
4401
4459
  }) });
4402
4460
  };
4403
4461
  ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
@@ -4412,12 +4470,12 @@ var exports7 = {
4412
4470
  var thread_welcome_default = Object.assign(ThreadWelcome, exports7);
4413
4471
 
4414
4472
  // src/ui/user-message.tsx
4415
- var import_react64 = require("react");
4473
+ var import_react65 = require("react");
4416
4474
 
4417
4475
  // src/ui/user-action-bar.tsx
4418
- var import_react63 = require("react");
4476
+ var import_react64 = require("react");
4419
4477
  var import_lucide_react4 = require("lucide-react");
4420
- var import_jsx_runtime38 = require("react/jsx-runtime");
4478
+ var import_jsx_runtime39 = require("react/jsx-runtime");
4421
4479
  var useAllowEdit = () => {
4422
4480
  const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
4423
4481
  const { useThreadActions } = useThreadContext();
@@ -4427,20 +4485,20 @@ var useAllowEdit = () => {
4427
4485
  var UserActionBar = () => {
4428
4486
  const allowEdit = useAllowEdit();
4429
4487
  if (!allowEdit) return null;
4430
- 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, {}) });
4431
4489
  };
4432
4490
  UserActionBar.displayName = "UserActionBar";
4433
4491
  var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
4434
4492
  className: "aui-user-action-bar-root"
4435
4493
  });
4436
4494
  UserActionBarRoot.displayName = "UserActionBarRoot";
4437
- var UserActionBarEdit = (0, import_react63.forwardRef)((props, ref) => {
4495
+ var UserActionBarEdit = (0, import_react64.forwardRef)((props, ref) => {
4438
4496
  const {
4439
4497
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
4440
4498
  } = useThreadConfig();
4441
4499
  const allowEdit = useAllowEdit();
4442
4500
  if (!allowEdit) return null;
4443
- 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, {}) }) });
4444
4502
  });
4445
4503
  UserActionBarEdit.displayName = "UserActionBarEdit";
4446
4504
  var exports8 = {
@@ -4450,12 +4508,12 @@ var exports8 = {
4450
4508
  var user_action_bar_default = Object.assign(UserActionBar, exports8);
4451
4509
 
4452
4510
  // src/ui/user-message.tsx
4453
- var import_jsx_runtime39 = require("react/jsx-runtime");
4511
+ var import_jsx_runtime40 = require("react/jsx-runtime");
4454
4512
  var UserMessage = () => {
4455
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(UserMessageRoot, { children: [
4456
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(user_action_bar_default, {}),
4457
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UserMessageContent, {}),
4458
- /* @__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, {})
4459
4517
  ] });
4460
4518
  };
4461
4519
  UserMessage.displayName = "UserMessage";
@@ -4466,9 +4524,9 @@ UserMessageRoot.displayName = "UserMessageRoot";
4466
4524
  var UserMessageContentWrapper = withDefaults("div", {
4467
4525
  className: "aui-user-message-content"
4468
4526
  });
4469
- var UserMessageContent = (0, import_react64.forwardRef)(
4527
+ var UserMessageContent = (0, import_react65.forwardRef)(
4470
4528
  ({ components, ...props }, ref) => {
4471
- 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)(
4472
4530
  message_exports.Content,
4473
4531
  {
4474
4532
  components: {
@@ -4487,14 +4545,14 @@ var exports9 = {
4487
4545
  var user_message_default = Object.assign(UserMessage, exports9);
4488
4546
 
4489
4547
  // src/ui/edit-composer.tsx
4490
- var import_react65 = require("react");
4491
- var import_jsx_runtime40 = require("react/jsx-runtime");
4548
+ var import_react66 = require("react");
4549
+ var import_jsx_runtime41 = require("react/jsx-runtime");
4492
4550
  var EditComposer = () => {
4493
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(EditComposerRoot, { children: [
4494
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditComposerInput, {}),
4495
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(EditComposerFooter, { children: [
4496
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditComposerCancel, {}),
4497
- /* @__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, {})
4498
4556
  ] })
4499
4557
  ] });
4500
4558
  };
@@ -4511,23 +4569,23 @@ var EditComposerFooter = withDefaults("div", {
4511
4569
  className: "aui-edit-composer-footer"
4512
4570
  });
4513
4571
  EditComposerFooter.displayName = "EditComposerFooter";
4514
- var EditComposerCancel = (0, import_react65.forwardRef)(
4572
+ var EditComposerCancel = (0, import_react66.forwardRef)(
4515
4573
  (props, ref) => {
4516
4574
  const {
4517
4575
  strings: {
4518
4576
  editComposer: { cancel: { label = "Cancel" } = {} } = {}
4519
4577
  } = {}
4520
4578
  } = useThreadConfig();
4521
- 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 }) });
4522
4580
  }
4523
4581
  );
4524
4582
  EditComposerCancel.displayName = "EditComposerCancel";
4525
- var EditComposerSend = (0, import_react65.forwardRef)(
4583
+ var EditComposerSend = (0, import_react66.forwardRef)(
4526
4584
  (props, ref) => {
4527
4585
  const {
4528
4586
  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
4529
4587
  } = useThreadConfig();
4530
- 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 }) });
4531
4589
  }
4532
4590
  );
4533
4591
  EditComposerSend.displayName = "EditComposerSend";
@@ -4541,23 +4599,23 @@ var exports10 = {
4541
4599
  var edit_composer_default = Object.assign(EditComposer, exports10);
4542
4600
 
4543
4601
  // src/ui/thread.tsx
4544
- var import_jsx_runtime41 = require("react/jsx-runtime");
4602
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4545
4603
  var Thread = (config) => {
4546
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadRoot, { config, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(ThreadViewport, { children: [
4547
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(thread_welcome_default, {}),
4548
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadMessages, {}),
4549
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(ThreadViewportFooter, { children: [
4550
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadScrollToBottom, {}),
4551
- /* @__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, {})
4552
4610
  ] })
4553
4611
  ] }) });
4554
4612
  };
4555
4613
  var ThreadRootStyled = withDefaults(thread_exports.Root, {
4556
4614
  className: "aui-root aui-thread-root"
4557
4615
  });
4558
- var ThreadRoot = (0, import_react66.forwardRef)(
4616
+ var ThreadRoot = (0, import_react67.forwardRef)(
4559
4617
  ({ config, ...props }, ref) => {
4560
- 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 }) });
4561
4619
  }
4562
4620
  );
4563
4621
  ThreadRoot.displayName = "ThreadRoot";
@@ -4571,7 +4629,7 @@ var ThreadViewportFooter = withDefaults("div", {
4571
4629
  ThreadViewportFooter.displayName = "ThreadViewportFooter";
4572
4630
  var SystemMessage = () => null;
4573
4631
  var ThreadMessages = ({ components, ...rest }) => {
4574
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4632
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4575
4633
  thread_exports.Messages,
4576
4634
  {
4577
4635
  components: {
@@ -4589,13 +4647,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
4589
4647
  variant: "outline",
4590
4648
  className: "aui-thread-scroll-to-bottom"
4591
4649
  });
4592
- var ThreadScrollToBottom = (0, import_react66.forwardRef)((props, ref) => {
4650
+ var ThreadScrollToBottom = (0, import_react67.forwardRef)((props, ref) => {
4593
4651
  const {
4594
4652
  strings: {
4595
4653
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
4596
4654
  } = {}
4597
4655
  } = useThreadConfig();
4598
- 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, {}) }) });
4599
4657
  });
4600
4658
  ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
4601
4659
  var exports11 = {
@@ -4608,20 +4666,20 @@ var exports11 = {
4608
4666
  var thread_default = Object.assign(Thread, exports11);
4609
4667
 
4610
4668
  // src/ui/assistant-modal.tsx
4611
- var import_jsx_runtime42 = require("react/jsx-runtime");
4669
+ var import_jsx_runtime43 = require("react/jsx-runtime");
4612
4670
  var AssistantModal = (config) => {
4613
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(AssistantModalRoot, { config, children: [
4614
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantModalTrigger, {}),
4615
- /* @__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, {}) })
4616
4674
  ] });
4617
4675
  };
4618
4676
  AssistantModal.displayName = "AssistantModal";
4619
4677
  var AssistantModalRoot = ({ config, ...props }) => {
4620
- 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 }) });
4621
4679
  };
4622
4680
  AssistantModalRoot.displayName = "AssistantModalRoot";
4623
- var AssistantModalTrigger = (0, import_react67.forwardRef)((props, ref) => {
4624
- 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 }) }) });
4625
4683
  });
4626
4684
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
4627
4685
  var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
@@ -4632,7 +4690,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
4632
4690
  variant: "default",
4633
4691
  className: "aui-modal-button"
4634
4692
  });
4635
- var AssistantModalButton = (0, import_react67.forwardRef)(({ "data-state": state, ...rest }, ref) => {
4693
+ var AssistantModalButton = (0, import_react68.forwardRef)(({ "data-state": state, ...rest }, ref) => {
4636
4694
  const {
4637
4695
  strings: {
4638
4696
  assistantModal: {
@@ -4646,7 +4704,7 @@ var AssistantModalButton = (0, import_react67.forwardRef)(({ "data-state": state
4646
4704
  } = {}
4647
4705
  } = useThreadConfig();
4648
4706
  const tooltip = state === "open" ? openTooltip : closedTooltip;
4649
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4707
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4650
4708
  ModalButtonStyled,
4651
4709
  {
4652
4710
  side: "left",
@@ -4654,15 +4712,15 @@ var AssistantModalButton = (0, import_react67.forwardRef)(({ "data-state": state
4654
4712
  "data-state": state,
4655
4713
  ...rest,
4656
4714
  ref,
4657
- children: rest.children ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
4658
- /* @__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)(
4659
4717
  import_lucide_react6.BotIcon,
4660
4718
  {
4661
4719
  "data-state": state,
4662
4720
  className: "aui-modal-button-closed-icon"
4663
4721
  }
4664
4722
  ),
4665
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4723
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4666
4724
  import_lucide_react6.ChevronDownIcon,
4667
4725
  {
4668
4726
  "data-state": state,