@assistant-ui/react 0.5.39 → 0.5.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -204,7 +204,8 @@ var makeThreadActionStore = (runtimeStore) => {
204
204
  startRun: (parentId) => runtimeStore.getState().startRun(parentId),
205
205
  append: (message) => runtimeStore.getState().append(message),
206
206
  cancelRun: () => runtimeStore.getState().cancelRun(),
207
- addToolResult: (options) => runtimeStore.getState().addToolResult(options)
207
+ addToolResult: (options) => runtimeStore.getState().addToolResult(options),
208
+ speak: (messageId) => runtimeStore.getState().speak(messageId)
208
209
  })
209
210
  );
210
211
  };
@@ -1056,31 +1057,78 @@ var EdgeChatAdapter = class {
1056
1057
  // src/runtimes/edge/useEdgeRuntime.ts
1057
1058
  var useEdgeRuntime = ({
1058
1059
  initialMessages,
1060
+ maxToolRoundtrips,
1061
+ adapters,
1059
1062
  ...options
1060
1063
  }) => {
1061
1064
  const [adapter] = useState3(() => new EdgeChatAdapter(options));
1062
- return useLocalRuntime(adapter, { initialMessages });
1065
+ return useLocalRuntime(adapter, {
1066
+ initialMessages,
1067
+ maxToolRoundtrips,
1068
+ adapters
1069
+ });
1063
1070
  };
1064
1071
 
1065
1072
  // src/runtimes/local/shouldContinue.tsx
1066
1073
  var shouldContinue = (result) => result.status?.type === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
1067
1074
 
1075
+ // src/utils/getThreadMessageText.tsx
1076
+ var getThreadMessageText = (message) => {
1077
+ const textParts = message.content.filter(
1078
+ (part) => part.type === "text"
1079
+ );
1080
+ return textParts.map((part) => part.text).join("\n\n");
1081
+ };
1082
+
1083
+ // src/runtimes/speech/WebSpeechSynthesisAdapter.ts
1084
+ var WebSpeechSynthesisAdapter = class {
1085
+ speak(message) {
1086
+ const text = getThreadMessageText(message);
1087
+ const utterance = new SpeechSynthesisUtterance(text);
1088
+ let ended = false;
1089
+ const endHandlers = /* @__PURE__ */ new Set();
1090
+ const handleEnd = () => {
1091
+ if (ended) return;
1092
+ ended = true;
1093
+ endHandlers.forEach((handler) => handler());
1094
+ };
1095
+ utterance.addEventListener("end", handleEnd);
1096
+ utterance.addEventListener("error", handleEnd);
1097
+ window.speechSynthesis.speak(utterance);
1098
+ return {
1099
+ stop: () => {
1100
+ window.speechSynthesis.cancel();
1101
+ handleEnd();
1102
+ },
1103
+ onEnd: (callback) => {
1104
+ if (ended) {
1105
+ let cancelled = false;
1106
+ queueMicrotask(() => {
1107
+ if (!cancelled) callback();
1108
+ });
1109
+ return () => {
1110
+ cancelled = true;
1111
+ };
1112
+ } else {
1113
+ endHandlers.add(callback);
1114
+ return () => {
1115
+ endHandlers.delete(callback);
1116
+ };
1117
+ }
1118
+ }
1119
+ };
1120
+ }
1121
+ };
1122
+
1068
1123
  // src/runtimes/local/LocalThreadRuntime.tsx
1069
- var CAPABILITIES = Object.freeze({
1070
- switchToBranch: true,
1071
- edit: true,
1072
- reload: true,
1073
- cancel: true,
1074
- copy: true
1075
- });
1076
1124
  var LocalThreadRuntime = class {
1077
- constructor(configProvider, adapter, options) {
1125
+ constructor(configProvider, adapter, { initialMessages, ...options }) {
1078
1126
  this.configProvider = configProvider;
1079
1127
  this.adapter = adapter;
1080
1128
  this.options = options;
1081
- if (options.initialMessages) {
1129
+ if (initialMessages) {
1082
1130
  let parentId = null;
1083
- const messages = fromCoreMessages(options.initialMessages);
1131
+ const messages = fromCoreMessages(initialMessages);
1084
1132
  for (const message of messages) {
1085
1133
  this.repository.addOrUpdateMessage(parentId, message);
1086
1134
  parentId = message.id;
@@ -1090,7 +1138,14 @@ var LocalThreadRuntime = class {
1090
1138
  _subscriptions = /* @__PURE__ */ new Set();
1091
1139
  abortController = null;
1092
1140
  repository = new MessageRepository();
1093
- capabilities = CAPABILITIES;
1141
+ capabilities = {
1142
+ switchToBranch: true,
1143
+ edit: true,
1144
+ reload: true,
1145
+ cancel: true,
1146
+ unstable_copy: true,
1147
+ speak: false
1148
+ };
1094
1149
  isDisabled = false;
1095
1150
  get messages() {
1096
1151
  return this.repository.getMessages();
@@ -1102,6 +1157,15 @@ var LocalThreadRuntime = class {
1102
1157
  this.notifySubscribers();
1103
1158
  }
1104
1159
  };
1160
+ _options;
1161
+ set options({ initialMessages, ...options }) {
1162
+ this._options = options;
1163
+ const canSpeak = options.adapters?.speech !== void 0;
1164
+ if (this.capabilities.speak !== canSpeak) {
1165
+ this.capabilities.speak = canSpeak;
1166
+ this.notifySubscribers();
1167
+ }
1168
+ }
1105
1169
  getBranches(messageId) {
1106
1170
  return this.repository.getBranches(messageId);
1107
1171
  }
@@ -1175,7 +1239,7 @@ var LocalThreadRuntime = class {
1175
1239
  this.repository.addOrUpdateMessage(parentId, message);
1176
1240
  this.notifySubscribers();
1177
1241
  };
1178
- const maxToolRoundtrips = this.options.maxToolRoundtrips ?? 1;
1242
+ const maxToolRoundtrips = this._options.maxToolRoundtrips ?? 1;
1179
1243
  const toolRoundtrips = message.metadata?.roundtrips?.length ?? 0;
1180
1244
  if (toolRoundtrips > maxToolRoundtrips) {
1181
1245
  updateMessage({
@@ -1239,7 +1303,11 @@ var LocalThreadRuntime = class {
1239
1303
  this._subscriptions.add(callback);
1240
1304
  return () => this._subscriptions.delete(callback);
1241
1305
  }
1242
- addToolResult({ messageId, toolCallId, result }) {
1306
+ addToolResult({
1307
+ messageId,
1308
+ toolCallId,
1309
+ result
1310
+ }) {
1243
1311
  let { parentId, message } = this.repository.getMessage(messageId);
1244
1312
  if (message.role !== "assistant")
1245
1313
  throw new Error("Tried to add tool result to non-assistant message");
@@ -1266,6 +1334,11 @@ var LocalThreadRuntime = class {
1266
1334
  this.performRoundtrip(parentId, message);
1267
1335
  }
1268
1336
  }
1337
+ speak(messageId) {
1338
+ const { message } = this.repository.getMessage(messageId);
1339
+ const adapter = new WebSpeechSynthesisAdapter();
1340
+ return adapter.speak(message);
1341
+ }
1269
1342
  export() {
1270
1343
  return this.repository.export();
1271
1344
  }
@@ -1424,14 +1497,6 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
1424
1497
  }
1425
1498
  };
1426
1499
 
1427
- // src/utils/getThreadMessageText.tsx
1428
- var getThreadMessageText = (message) => {
1429
- const textParts = message.content.filter(
1430
- (part) => part.type === "text"
1431
- );
1432
- return textParts.map((part) => part.text).join("\n\n");
1433
- };
1434
-
1435
1500
  // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
1436
1501
  var hasUpcomingMessage = (isRunning, messages) => {
1437
1502
  return isRunning && messages[messages.length - 1]?.role !== "assistant";
@@ -1445,7 +1510,8 @@ var ExternalStoreThreadRuntime = class {
1445
1510
  edit: false,
1446
1511
  reload: false,
1447
1512
  cancel: false,
1448
- copy: false
1513
+ unstable_copy: false,
1514
+ speak: false
1449
1515
  };
1450
1516
  get capabilities() {
1451
1517
  return this._capabilities;
@@ -1475,7 +1541,8 @@ var ExternalStoreThreadRuntime = class {
1475
1541
  edit: this._store.onEdit !== void 0,
1476
1542
  reload: this._store.onReload !== void 0,
1477
1543
  cancel: this._store.onCancel !== void 0,
1478
- copy: this._store.onCopy !== null
1544
+ unstable_copy: this._store.unstable_capabilities?.copy !== null,
1545
+ speak: this._store.onSpeak !== void 0
1479
1546
  };
1480
1547
  if (oldStore) {
1481
1548
  if (oldStore.convertMessage !== store.convertMessage) {
@@ -1572,6 +1639,17 @@ var ExternalStoreThreadRuntime = class {
1572
1639
  this.updateMessages(messages);
1573
1640
  }, 0);
1574
1641
  }
1642
+ addToolResult(options) {
1643
+ if (!this._store.onAddToolResult)
1644
+ throw new Error("Runtime does not support tool results.");
1645
+ this._store.onAddToolResult(options);
1646
+ }
1647
+ speak(messageId) {
1648
+ if (!this._store.onSpeak)
1649
+ throw new Error("Runtime does not support speaking.");
1650
+ const { message } = this.repository.getMessage(messageId);
1651
+ return this._store.onSpeak(message);
1652
+ }
1575
1653
  subscribe(callback) {
1576
1654
  this._subscriptions.add(callback);
1577
1655
  return () => this._subscriptions.delete(callback);
@@ -1581,11 +1659,6 @@ var ExternalStoreThreadRuntime = class {
1581
1659
  messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
1582
1660
  );
1583
1661
  };
1584
- addToolResult(options) {
1585
- if (!this._store.onAddToolResult)
1586
- throw new Error("Runtime does not support tool results.");
1587
- this._store.onAddToolResult(options);
1588
- }
1589
1662
  };
1590
1663
 
1591
1664
  // src/runtimes/external-store/ExternalStoreRuntime.tsx
@@ -1976,8 +2049,8 @@ var useActionBarCopy = ({
1976
2049
  const { useMessage, useMessageUtils, useEditComposer } = useMessageContext();
1977
2050
  const hasCopyableContent = useCombinedStore(
1978
2051
  [useMessage, useEditComposer],
1979
- (m, c) => {
1980
- return !c.isEditing && m.message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
2052
+ ({ message }, c) => {
2053
+ return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
1981
2054
  }
1982
2055
  );
1983
2056
  const callback = useCallback3(() => {
@@ -2029,6 +2102,38 @@ var useActionBarReload = () => {
2029
2102
  return callback;
2030
2103
  };
2031
2104
 
2105
+ // src/primitive-hooks/actionBar/useActionBarSpeak.tsx
2106
+ import { useCallback as useCallback6 } from "react";
2107
+ var useActionBarSpeak = () => {
2108
+ const { useThreadActions } = useThreadContext();
2109
+ const { useMessage, useEditComposer, useMessageUtils } = useMessageContext();
2110
+ const hasSpeakableContent = useCombinedStore(
2111
+ [useMessage, useEditComposer],
2112
+ ({ message }, c) => {
2113
+ return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
2114
+ }
2115
+ );
2116
+ const callback = useCallback6(async () => {
2117
+ const { message } = useMessage.getState();
2118
+ const utt = useThreadActions.getState().speak(message.id);
2119
+ useMessageUtils.getState().addUtterance(utt);
2120
+ }, [useThreadActions, useMessage, useMessageUtils]);
2121
+ if (!hasSpeakableContent) return null;
2122
+ return callback;
2123
+ };
2124
+
2125
+ // src/primitive-hooks/actionBar/useActionBarStopSpeaking.tsx
2126
+ import { useCallback as useCallback7 } from "react";
2127
+ var useActionBarStopSpeaking = () => {
2128
+ const { useMessageUtils } = useMessageContext();
2129
+ const isSpeaking = useMessageUtils((u) => u.isSpeaking);
2130
+ const callback = useCallback7(async () => {
2131
+ useMessageUtils.getState().stopSpeaking();
2132
+ }, [useMessageUtils]);
2133
+ if (!isSpeaking) return null;
2134
+ return callback;
2135
+ };
2136
+
2032
2137
  // src/primitive-hooks/branchPicker/useBranchPickerCount.tsx
2033
2138
  var useBranchPickerCount = () => {
2034
2139
  const { useMessage } = useMessageContext();
@@ -2037,7 +2142,7 @@ var useBranchPickerCount = () => {
2037
2142
  };
2038
2143
 
2039
2144
  // src/primitive-hooks/branchPicker/useBranchPickerNext.tsx
2040
- import { useCallback as useCallback6 } from "react";
2145
+ import { useCallback as useCallback8 } from "react";
2041
2146
  var useBranchPickerNext = () => {
2042
2147
  const { useThreadActions } = useThreadContext();
2043
2148
  const { useMessage, useEditComposer } = useMessageContext();
@@ -2045,7 +2150,7 @@ var useBranchPickerNext = () => {
2045
2150
  [useMessage, useEditComposer],
2046
2151
  (m, c) => c.isEditing || m.branches.indexOf(m.message.id) + 1 >= m.branches.length
2047
2152
  );
2048
- const callback = useCallback6(() => {
2153
+ const callback = useCallback8(() => {
2049
2154
  const { message, branches } = useMessage.getState();
2050
2155
  useThreadActions.getState().switchToBranch(branches[branches.indexOf(message.id) + 1]);
2051
2156
  }, [useThreadActions, useMessage]);
@@ -2061,7 +2166,7 @@ var useBranchPickerNumber = () => {
2061
2166
  };
2062
2167
 
2063
2168
  // src/primitive-hooks/branchPicker/useBranchPickerPrevious.tsx
2064
- import { useCallback as useCallback7 } from "react";
2169
+ import { useCallback as useCallback9 } from "react";
2065
2170
  var useBranchPickerPrevious = () => {
2066
2171
  const { useThreadActions } = useThreadContext();
2067
2172
  const { useMessage, useEditComposer } = useMessageContext();
@@ -2069,7 +2174,7 @@ var useBranchPickerPrevious = () => {
2069
2174
  [useMessage, useEditComposer],
2070
2175
  (m, c) => c.isEditing || m.branches.indexOf(m.message.id) <= 0
2071
2176
  );
2072
- const callback = useCallback7(() => {
2177
+ const callback = useCallback9(() => {
2073
2178
  const { message, branches } = useMessage.getState();
2074
2179
  useThreadActions.getState().switchToBranch(branches[branches.indexOf(message.id) - 1]);
2075
2180
  }, [useThreadActions, useMessage]);
@@ -2078,11 +2183,11 @@ var useBranchPickerPrevious = () => {
2078
2183
  };
2079
2184
 
2080
2185
  // src/primitive-hooks/composer/useComposerCancel.tsx
2081
- import { useCallback as useCallback8 } from "react";
2186
+ import { useCallback as useCallback10 } from "react";
2082
2187
  var useComposerCancel = () => {
2083
2188
  const { useComposer } = useComposerContext();
2084
2189
  const disabled = useComposer((c) => !c.canCancel);
2085
- const callback = useCallback8(() => {
2190
+ const callback = useCallback10(() => {
2086
2191
  const { cancel } = useComposer.getState();
2087
2192
  cancel();
2088
2193
  }, [useComposer]);
@@ -2101,7 +2206,7 @@ var useComposerIf = (props) => {
2101
2206
  };
2102
2207
 
2103
2208
  // src/primitive-hooks/composer/useComposerSend.tsx
2104
- import { useCallback as useCallback9 } from "react";
2209
+ import { useCallback as useCallback11 } from "react";
2105
2210
  var useComposerSend = () => {
2106
2211
  const {
2107
2212
  useThread,
@@ -2113,7 +2218,7 @@ var useComposerSend = () => {
2113
2218
  [useThread, useComposer],
2114
2219
  (t, c) => t.isRunning || !c.isEditing || c.text.length === 0
2115
2220
  );
2116
- const callback = useCallback9(() => {
2221
+ const callback = useCallback11(() => {
2117
2222
  const composerState = useComposer.getState();
2118
2223
  if (!composerState.isEditing) return;
2119
2224
  composerState.send();
@@ -2168,7 +2273,7 @@ var useMessageIf = (props) => {
2168
2273
  const { useMessage, useMessageUtils } = useMessageContext();
2169
2274
  return useCombinedStore(
2170
2275
  [useMessage, useMessageUtils],
2171
- ({ message, branches, isLast }, { isCopied, isHovering }) => {
2276
+ ({ message, branches, isLast }, { isCopied, isHovering, isSpeaking }) => {
2172
2277
  if (props.hasBranches === true && branches.length < 2) return false;
2173
2278
  if (props.user && message.role !== "user") return false;
2174
2279
  if (props.assistant && message.role !== "assistant") return false;
@@ -2176,6 +2281,8 @@ var useMessageIf = (props) => {
2176
2281
  if (props.lastOrHover === true && !isHovering && !isLast) return false;
2177
2282
  if (props.copied === true && !isCopied) return false;
2178
2283
  if (props.copied === false && isCopied) return false;
2284
+ if (props.speaking === true && !isSpeaking) return false;
2285
+ if (props.speaking === false && isSpeaking) return false;
2179
2286
  return true;
2180
2287
  }
2181
2288
  );
@@ -2204,11 +2311,11 @@ var useThreadEmpty = () => {
2204
2311
  };
2205
2312
 
2206
2313
  // src/primitive-hooks/thread/useThreadScrollToBottom.tsx
2207
- import { useCallback as useCallback10 } from "react";
2314
+ import { useCallback as useCallback12 } from "react";
2208
2315
  var useThreadScrollToBottom = () => {
2209
2316
  const { useComposer, useViewport } = useThreadContext();
2210
2317
  const isAtBottom = useViewport((s) => s.isAtBottom);
2211
- const handleScrollToBottom = useCallback10(() => {
2318
+ const handleScrollToBottom = useCallback12(() => {
2212
2319
  useViewport.getState().scrollToBottom();
2213
2320
  useComposer.getState().focus();
2214
2321
  }, [useViewport, useComposer]);
@@ -2217,7 +2324,7 @@ var useThreadScrollToBottom = () => {
2217
2324
  };
2218
2325
 
2219
2326
  // src/primitive-hooks/thread/useThreadSuggestion.tsx
2220
- import { useCallback as useCallback11 } from "react";
2327
+ import { useCallback as useCallback13 } from "react";
2221
2328
  var useThreadSuggestion = ({
2222
2329
  prompt,
2223
2330
  autoSend
@@ -2225,7 +2332,7 @@ var useThreadSuggestion = ({
2225
2332
  const { useThread, useComposer } = useThreadContext();
2226
2333
  const append = useAppendMessage();
2227
2334
  const disabled = useThread((t) => t.isDisabled);
2228
- const callback = useCallback11(() => {
2335
+ const callback = useCallback13(() => {
2229
2336
  const thread = useThread.getState();
2230
2337
  const composer = useComposer.getState();
2231
2338
  if (autoSend && !thread.isRunning) {
@@ -2245,7 +2352,9 @@ __export(actionBar_exports, {
2245
2352
  Copy: () => ActionBarPrimitiveCopy,
2246
2353
  Edit: () => ActionBarPrimitiveEdit,
2247
2354
  Reload: () => ActionBarPrimitiveReload,
2248
- Root: () => ActionBarPrimitiveRoot
2355
+ Root: () => ActionBarPrimitiveRoot,
2356
+ Speak: () => ActionBarPrimitiveSpeak,
2357
+ StopSpeaking: () => ActionBarPrimitiveStopSpeaking
2249
2358
  });
2250
2359
 
2251
2360
  // src/primitives/actionBar/ActionBarRoot.tsx
@@ -2347,6 +2456,40 @@ var ActionBarPrimitiveEdit = createActionButton(
2347
2456
  useActionBarEdit
2348
2457
  );
2349
2458
 
2459
+ // src/primitives/actionBar/ActionBarSpeak.tsx
2460
+ var ActionBarPrimitiveSpeak = createActionButton(
2461
+ "ActionBarPrimitive.Speak",
2462
+ useActionBarSpeak
2463
+ );
2464
+
2465
+ // src/primitives/actionBar/ActionBarStopSpeaking.tsx
2466
+ import { forwardRef as forwardRef7 } from "react";
2467
+ import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
2468
+ import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
2469
+ import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
2470
+ import { jsx as jsx11 } from "react/jsx-runtime";
2471
+ var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
2472
+ const callback = useActionBarStopSpeaking();
2473
+ useEscapeKeydown((e) => {
2474
+ if (callback) {
2475
+ e.preventDefault();
2476
+ callback();
2477
+ }
2478
+ });
2479
+ return /* @__PURE__ */ jsx11(
2480
+ Primitive4.button,
2481
+ {
2482
+ type: "button",
2483
+ disabled: !callback,
2484
+ ...props,
2485
+ ref,
2486
+ onClick: composeEventHandlers2(props.onClick, () => {
2487
+ callback?.();
2488
+ })
2489
+ }
2490
+ );
2491
+ });
2492
+
2350
2493
  // src/primitives/assistantModal/index.ts
2351
2494
  var assistantModal_exports = {};
2352
2495
  __export(assistantModal_exports, {
@@ -2359,7 +2502,7 @@ __export(assistantModal_exports, {
2359
2502
  // src/primitives/assistantModal/AssistantModalRoot.tsx
2360
2503
  import { useState as useState9 } from "react";
2361
2504
  import * as PopoverPrimitive2 from "@radix-ui/react-popover";
2362
- import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
2505
+ import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
2363
2506
 
2364
2507
  // src/utils/hooks/useOnComposerFocus.tsx
2365
2508
  import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-ref";
@@ -2379,7 +2522,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
2379
2522
  var usePopoverScope = PopoverPrimitive.createPopoverScope();
2380
2523
 
2381
2524
  // src/primitives/assistantModal/AssistantModalRoot.tsx
2382
- import { jsx as jsx11 } from "react/jsx-runtime";
2525
+ import { jsx as jsx12 } from "react/jsx-runtime";
2383
2526
  var useAssistantModalOpenState = (defaultOpen = false) => {
2384
2527
  const state = useState9(defaultOpen);
2385
2528
  const [, setOpen] = state;
@@ -2397,12 +2540,12 @@ var AssistantModalPrimitiveRoot = ({
2397
2540
  }) => {
2398
2541
  const scope = usePopoverScope(__scopeAssistantModal);
2399
2542
  const [modalOpen, setOpen] = useAssistantModalOpenState(defaultOpen);
2400
- return /* @__PURE__ */ jsx11(
2543
+ return /* @__PURE__ */ jsx12(
2401
2544
  PopoverPrimitive2.Root,
2402
2545
  {
2403
2546
  ...scope,
2404
2547
  open: open === void 0 ? modalOpen : open,
2405
- onOpenChange: composeEventHandlers2(onOpenChange, setOpen),
2548
+ onOpenChange: composeEventHandlers3(onOpenChange, setOpen),
2406
2549
  ...rest
2407
2550
  }
2408
2551
  );
@@ -2410,26 +2553,26 @@ var AssistantModalPrimitiveRoot = ({
2410
2553
  AssistantModalPrimitiveRoot.displayName = "AssistantModalPrimitive.Root";
2411
2554
 
2412
2555
  // src/primitives/assistantModal/AssistantModalTrigger.tsx
2413
- import { forwardRef as forwardRef7 } from "react";
2556
+ import { forwardRef as forwardRef8 } from "react";
2414
2557
  import * as PopoverPrimitive3 from "@radix-ui/react-popover";
2415
- import { jsx as jsx12 } from "react/jsx-runtime";
2416
- var AssistantModalPrimitiveTrigger = forwardRef7(
2558
+ import { jsx as jsx13 } from "react/jsx-runtime";
2559
+ var AssistantModalPrimitiveTrigger = forwardRef8(
2417
2560
  ({
2418
2561
  __scopeAssistantModal,
2419
2562
  ...rest
2420
2563
  }, ref) => {
2421
2564
  const scope = usePopoverScope(__scopeAssistantModal);
2422
- return /* @__PURE__ */ jsx12(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
2565
+ return /* @__PURE__ */ jsx13(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
2423
2566
  }
2424
2567
  );
2425
2568
  AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
2426
2569
 
2427
2570
  // src/primitives/assistantModal/AssistantModalContent.tsx
2428
- import { forwardRef as forwardRef8 } from "react";
2571
+ import { forwardRef as forwardRef9 } from "react";
2429
2572
  import * as PopoverPrimitive4 from "@radix-ui/react-popover";
2430
- import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
2431
- import { jsx as jsx13 } from "react/jsx-runtime";
2432
- var AssistantModalPrimitiveContent = forwardRef8(
2573
+ import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
2574
+ import { jsx as jsx14 } from "react/jsx-runtime";
2575
+ var AssistantModalPrimitiveContent = forwardRef9(
2433
2576
  ({
2434
2577
  __scopeAssistantModal,
2435
2578
  side,
@@ -2439,7 +2582,7 @@ var AssistantModalPrimitiveContent = forwardRef8(
2439
2582
  ...props
2440
2583
  }, forwardedRef) => {
2441
2584
  const scope = usePopoverScope(__scopeAssistantModal);
2442
- return /* @__PURE__ */ jsx13(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx13(
2585
+ return /* @__PURE__ */ jsx14(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx14(
2443
2586
  PopoverPrimitive4.Content,
2444
2587
  {
2445
2588
  ...scope,
@@ -2447,7 +2590,7 @@ var AssistantModalPrimitiveContent = forwardRef8(
2447
2590
  ref: forwardedRef,
2448
2591
  side: side ?? "top",
2449
2592
  align: align ?? "end",
2450
- onInteractOutside: composeEventHandlers3(
2593
+ onInteractOutside: composeEventHandlers4(
2451
2594
  onInteractOutside,
2452
2595
  dissmissOnInteractOutside ? void 0 : (e) => e.preventDefault()
2453
2596
  )
@@ -2458,16 +2601,16 @@ var AssistantModalPrimitiveContent = forwardRef8(
2458
2601
  AssistantModalPrimitiveContent.displayName = "AssistantModalPrimitive.Content";
2459
2602
 
2460
2603
  // src/primitives/assistantModal/AssistantModalAnchor.tsx
2461
- import { forwardRef as forwardRef9 } from "react";
2604
+ import { forwardRef as forwardRef10 } from "react";
2462
2605
  import * as PopoverPrimitive5 from "@radix-ui/react-popover";
2463
- import { jsx as jsx14 } from "react/jsx-runtime";
2464
- var AssistantModalPrimitiveAnchor = forwardRef9(
2606
+ import { jsx as jsx15 } from "react/jsx-runtime";
2607
+ var AssistantModalPrimitiveAnchor = forwardRef10(
2465
2608
  ({
2466
2609
  __scopeAssistantModal,
2467
2610
  ...rest
2468
2611
  }, ref) => {
2469
2612
  const scope = usePopoverScope(__scopeAssistantModal);
2470
- return /* @__PURE__ */ jsx14(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
2613
+ return /* @__PURE__ */ jsx15(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
2471
2614
  }
2472
2615
  );
2473
2616
  AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
@@ -2495,24 +2638,24 @@ var BranchPickerPrevious = createActionButton(
2495
2638
  );
2496
2639
 
2497
2640
  // src/primitives/branchPicker/BranchPickerCount.tsx
2498
- import { Fragment, jsx as jsx15 } from "react/jsx-runtime";
2641
+ import { Fragment, jsx as jsx16 } from "react/jsx-runtime";
2499
2642
  var BranchPickerPrimitiveCount = () => {
2500
2643
  const branchCount = useBranchPickerCount();
2501
- return /* @__PURE__ */ jsx15(Fragment, { children: branchCount });
2644
+ return /* @__PURE__ */ jsx16(Fragment, { children: branchCount });
2502
2645
  };
2503
2646
  BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
2504
2647
 
2505
2648
  // src/primitives/branchPicker/BranchPickerNumber.tsx
2506
- import { Fragment as Fragment2, jsx as jsx16 } from "react/jsx-runtime";
2649
+ import { Fragment as Fragment2, jsx as jsx17 } from "react/jsx-runtime";
2507
2650
  var BranchPickerPrimitiveNumber = () => {
2508
2651
  const branchNumber = useBranchPickerNumber();
2509
- return /* @__PURE__ */ jsx16(Fragment2, { children: branchNumber });
2652
+ return /* @__PURE__ */ jsx17(Fragment2, { children: branchNumber });
2510
2653
  };
2511
2654
  BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
2512
2655
 
2513
2656
  // src/primitives/branchPicker/BranchPickerRoot.tsx
2514
- import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
2515
- import { forwardRef as forwardRef13 } from "react";
2657
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
2658
+ import { forwardRef as forwardRef14 } from "react";
2516
2659
 
2517
2660
  // src/primitives/message/index.ts
2518
2661
  var message_exports = {};
@@ -2524,17 +2667,17 @@ __export(message_exports, {
2524
2667
  });
2525
2668
 
2526
2669
  // src/primitives/message/MessageRoot.tsx
2527
- import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
2670
+ import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
2528
2671
  import {
2529
- forwardRef as forwardRef10,
2530
- useCallback as useCallback13
2672
+ forwardRef as forwardRef11,
2673
+ useCallback as useCallback15
2531
2674
  } from "react";
2532
2675
 
2533
2676
  // src/utils/hooks/useManagedRef.ts
2534
- import { useCallback as useCallback12, useRef as useRef3 } from "react";
2677
+ import { useCallback as useCallback14, useRef as useRef3 } from "react";
2535
2678
  var useManagedRef = (callback) => {
2536
2679
  const cleanupRef = useRef3();
2537
- const ref = useCallback12(
2680
+ const ref = useCallback14(
2538
2681
  (el) => {
2539
2682
  if (cleanupRef.current) {
2540
2683
  cleanupRef.current();
@@ -2550,10 +2693,10 @@ var useManagedRef = (callback) => {
2550
2693
 
2551
2694
  // src/primitives/message/MessageRoot.tsx
2552
2695
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
2553
- import { jsx as jsx17 } from "react/jsx-runtime";
2696
+ import { jsx as jsx18 } from "react/jsx-runtime";
2554
2697
  var useIsHoveringRef = () => {
2555
2698
  const { useMessageUtils } = useMessageContext();
2556
- const callbackRef = useCallback13(
2699
+ const callbackRef = useCallback15(
2557
2700
  (el) => {
2558
2701
  const setIsHovering = useMessageUtils.getState().setIsHovering;
2559
2702
  const handleMouseEnter = () => {
@@ -2574,10 +2717,10 @@ var useIsHoveringRef = () => {
2574
2717
  );
2575
2718
  return useManagedRef(callbackRef);
2576
2719
  };
2577
- var MessagePrimitiveRoot = forwardRef10(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef29) => {
2720
+ var MessagePrimitiveRoot = forwardRef11(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef30) => {
2578
2721
  const isHoveringRef = useIsHoveringRef();
2579
- const ref = useComposedRefs(forwardRef29, isHoveringRef);
2580
- return /* @__PURE__ */ jsx17(Primitive4.div, { ...rest, ref });
2722
+ const ref = useComposedRefs(forwardRef30, isHoveringRef);
2723
+ return /* @__PURE__ */ jsx18(Primitive5.div, { ...rest, ref });
2581
2724
  });
2582
2725
  MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
2583
2726
 
@@ -2597,7 +2740,7 @@ import { memo as memo2 } from "react";
2597
2740
  // src/context/providers/ContentPartProvider.tsx
2598
2741
  import { useEffect as useEffect9, useState as useState10 } from "react";
2599
2742
  import { create as create12 } from "zustand";
2600
- import { jsx as jsx18 } from "react/jsx-runtime";
2743
+ import { jsx as jsx19 } from "react/jsx-runtime";
2601
2744
  var COMPLETE_STATUS = {
2602
2745
  type: "complete"
2603
2746
  };
@@ -2660,32 +2803,32 @@ var ContentPartProvider = ({
2660
2803
  children
2661
2804
  }) => {
2662
2805
  const context = useContentPartContext2(partIndex);
2663
- return /* @__PURE__ */ jsx18(ContentPartContext.Provider, { value: context, children });
2806
+ return /* @__PURE__ */ jsx19(ContentPartContext.Provider, { value: context, children });
2664
2807
  };
2665
2808
 
2666
2809
  // src/primitives/contentPart/ContentPartText.tsx
2667
2810
  import {
2668
- forwardRef as forwardRef11
2811
+ forwardRef as forwardRef12
2669
2812
  } from "react";
2670
- import { jsx as jsx19 } from "react/jsx-runtime";
2671
- var ContentPartPrimitiveText = forwardRef11(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
2813
+ import { jsx as jsx20 } from "react/jsx-runtime";
2814
+ var ContentPartPrimitiveText = forwardRef12(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
2672
2815
  const {
2673
2816
  part: { text },
2674
2817
  status
2675
2818
  } = useSmooth(useContentPartText(), smooth);
2676
- return /* @__PURE__ */ jsx19(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
2819
+ return /* @__PURE__ */ jsx20(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
2677
2820
  });
2678
2821
  ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
2679
2822
 
2680
2823
  // src/primitives/contentPart/ContentPartImage.tsx
2681
- import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
2682
- import { forwardRef as forwardRef12 } from "react";
2683
- import { jsx as jsx20 } from "react/jsx-runtime";
2684
- var ContentPartPrimitiveImage = forwardRef12((props, forwardedRef) => {
2824
+ import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
2825
+ import { forwardRef as forwardRef13 } from "react";
2826
+ import { jsx as jsx21 } from "react/jsx-runtime";
2827
+ var ContentPartPrimitiveImage = forwardRef13((props, forwardedRef) => {
2685
2828
  const {
2686
2829
  part: { image }
2687
2830
  } = useContentPartImage();
2688
- return /* @__PURE__ */ jsx20(Primitive5.img, { src: image, ...props, ref: forwardedRef });
2831
+ return /* @__PURE__ */ jsx21(Primitive6.img, { src: image, ...props, ref: forwardedRef });
2689
2832
  });
2690
2833
  ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
2691
2834
 
@@ -2707,20 +2850,20 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
2707
2850
  ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
2708
2851
 
2709
2852
  // src/primitives/message/MessageContent.tsx
2710
- import { jsx as jsx21, jsxs as jsxs3 } from "react/jsx-runtime";
2853
+ import { jsx as jsx22, jsxs as jsxs3 } from "react/jsx-runtime";
2711
2854
  var defaultComponents = {
2712
2855
  Text: () => /* @__PURE__ */ jsxs3("p", { style: { whiteSpace: "pre-line" }, children: [
2713
- /* @__PURE__ */ jsx21(ContentPartPrimitiveText, {}),
2714
- /* @__PURE__ */ jsx21(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx21("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
2856
+ /* @__PURE__ */ jsx22(ContentPartPrimitiveText, {}),
2857
+ /* @__PURE__ */ jsx22(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx22("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
2715
2858
  ] }),
2716
- Image: () => /* @__PURE__ */ jsx21(ContentPartPrimitiveImage, {}),
2717
- UI: () => /* @__PURE__ */ jsx21(ContentPartPrimitiveDisplay, {}),
2859
+ Image: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveImage, {}),
2860
+ UI: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveDisplay, {}),
2718
2861
  tools: {
2719
2862
  Fallback: (props) => {
2720
2863
  const { useToolUIs } = useAssistantContext();
2721
2864
  const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
2722
2865
  if (!Render) return null;
2723
- return /* @__PURE__ */ jsx21(Render, { ...props });
2866
+ return /* @__PURE__ */ jsx22(Render, { ...props });
2724
2867
  }
2725
2868
  }
2726
2869
  };
@@ -2743,16 +2886,16 @@ var MessageContentPartComponent = ({
2743
2886
  case "text":
2744
2887
  if (status.type === "requires-action")
2745
2888
  throw new Error("Encountered unexpected requires-action status");
2746
- if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx21(Empty, { part, status });
2747
- return /* @__PURE__ */ jsx21(Text2, { part, status });
2889
+ if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx22(Empty, { part, status });
2890
+ return /* @__PURE__ */ jsx22(Text2, { part, status });
2748
2891
  case "image":
2749
2892
  if (status.type === "requires-action")
2750
2893
  throw new Error("Encountered unexpected requires-action status");
2751
- return /* @__PURE__ */ jsx21(Image2, { part, status });
2894
+ return /* @__PURE__ */ jsx22(Image2, { part, status });
2752
2895
  case "ui":
2753
2896
  if (status.type === "requires-action")
2754
2897
  throw new Error("Encountered unexpected requires-action status");
2755
- return /* @__PURE__ */ jsx21(UI, { part, status });
2898
+ return /* @__PURE__ */ jsx22(UI, { part, status });
2756
2899
  case "tool-call": {
2757
2900
  const Tool = by_name[part.toolName] || Fallback2;
2758
2901
  const addResult = (result) => addToolResult({
@@ -2760,7 +2903,7 @@ var MessageContentPartComponent = ({
2760
2903
  toolCallId: part.toolCallId,
2761
2904
  result
2762
2905
  });
2763
- return /* @__PURE__ */ jsx21(Tool, { part, status, addResult });
2906
+ return /* @__PURE__ */ jsx22(Tool, { part, status, addResult });
2764
2907
  }
2765
2908
  default:
2766
2909
  const unhandledType = type;
@@ -2771,7 +2914,7 @@ var MessageContentPartImpl = ({
2771
2914
  partIndex,
2772
2915
  components
2773
2916
  }) => {
2774
- return /* @__PURE__ */ jsx21(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx21(MessageContentPartComponent, { components }) });
2917
+ return /* @__PURE__ */ jsx22(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx22(MessageContentPartComponent, { components }) });
2775
2918
  };
2776
2919
  var MessageContentPart = memo2(
2777
2920
  MessageContentPartImpl,
@@ -2784,7 +2927,7 @@ var MessagePrimitiveContent = ({
2784
2927
  const contentLength = useMessage((s) => s.message.content.length) || 1;
2785
2928
  return new Array(contentLength).fill(null).map((_, idx) => {
2786
2929
  const partIndex = idx;
2787
- return /* @__PURE__ */ jsx21(
2930
+ return /* @__PURE__ */ jsx22(
2788
2931
  MessageContentPart,
2789
2932
  {
2790
2933
  partIndex,
@@ -2803,9 +2946,9 @@ var MessagePrimitiveInProgress = () => {
2803
2946
  MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
2804
2947
 
2805
2948
  // src/primitives/branchPicker/BranchPickerRoot.tsx
2806
- import { jsx as jsx22 } from "react/jsx-runtime";
2807
- var BranchPickerPrimitiveRoot = forwardRef13(({ hideWhenSingleBranch, ...rest }, ref) => {
2808
- return /* @__PURE__ */ jsx22(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx22(Primitive6.div, { ...rest, ref }) });
2949
+ import { jsx as jsx23 } from "react/jsx-runtime";
2950
+ var BranchPickerPrimitiveRoot = forwardRef14(({ hideWhenSingleBranch, ...rest }, ref) => {
2951
+ return /* @__PURE__ */ jsx23(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx23(Primitive7.div, { ...rest, ref }) });
2809
2952
  });
2810
2953
  BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
2811
2954
 
@@ -2820,44 +2963,44 @@ __export(composer_exports, {
2820
2963
  });
2821
2964
 
2822
2965
  // src/primitives/composer/ComposerRoot.tsx
2823
- import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
2824
- import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
2966
+ import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
2967
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
2825
2968
  import {
2826
- forwardRef as forwardRef14
2969
+ forwardRef as forwardRef15
2827
2970
  } from "react";
2828
- import { jsx as jsx23 } from "react/jsx-runtime";
2829
- var ComposerPrimitiveRoot = forwardRef14(({ onSubmit, ...rest }, forwardedRef) => {
2971
+ import { jsx as jsx24 } from "react/jsx-runtime";
2972
+ var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) => {
2830
2973
  const send = useComposerSend();
2831
2974
  const handleSubmit = (e) => {
2832
2975
  e.preventDefault();
2833
2976
  if (!send) return;
2834
2977
  send();
2835
2978
  };
2836
- return /* @__PURE__ */ jsx23(
2837
- Primitive7.form,
2979
+ return /* @__PURE__ */ jsx24(
2980
+ Primitive8.form,
2838
2981
  {
2839
2982
  ...rest,
2840
2983
  ref: forwardedRef,
2841
- onSubmit: composeEventHandlers4(onSubmit, handleSubmit)
2984
+ onSubmit: composeEventHandlers5(onSubmit, handleSubmit)
2842
2985
  }
2843
2986
  );
2844
2987
  });
2845
2988
  ComposerPrimitiveRoot.displayName = "ComposerPrimitive.Root";
2846
2989
 
2847
2990
  // src/primitives/composer/ComposerInput.tsx
2848
- import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
2991
+ import { composeEventHandlers as composeEventHandlers6 } from "@radix-ui/primitive";
2849
2992
  import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
2850
2993
  import { Slot } from "@radix-ui/react-slot";
2851
2994
  import {
2852
- forwardRef as forwardRef15,
2853
- useCallback as useCallback14,
2995
+ forwardRef as forwardRef16,
2996
+ useCallback as useCallback16,
2854
2997
  useEffect as useEffect10,
2855
2998
  useRef as useRef4
2856
2999
  } from "react";
2857
3000
  import TextareaAutosize from "react-textarea-autosize";
2858
- import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
2859
- import { jsx as jsx24 } from "react/jsx-runtime";
2860
- var ComposerPrimitiveInput = forwardRef15(
3001
+ import { useEscapeKeydown as useEscapeKeydown2 } from "@radix-ui/react-use-escape-keydown";
3002
+ import { jsx as jsx25 } from "react/jsx-runtime";
3003
+ var ComposerPrimitiveInput = forwardRef16(
2861
3004
  ({
2862
3005
  autoFocus = false,
2863
3006
  asChild,
@@ -2876,7 +3019,7 @@ var ComposerPrimitiveInput = forwardRef15(
2876
3019
  const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;
2877
3020
  const textareaRef = useRef4(null);
2878
3021
  const ref = useComposedRefs2(forwardedRef, textareaRef);
2879
- useEscapeKeydown((e) => {
3022
+ useEscapeKeydown2((e) => {
2880
3023
  const composer = useComposer.getState();
2881
3024
  if (composer.canCancel) {
2882
3025
  composer.cancel();
@@ -2895,7 +3038,7 @@ var ComposerPrimitiveInput = forwardRef15(
2895
3038
  }
2896
3039
  };
2897
3040
  const autoFocusEnabled = autoFocus && !isDisabled;
2898
- const focus = useCallback14(() => {
3041
+ const focus = useCallback16(() => {
2899
3042
  const textarea = textareaRef.current;
2900
3043
  if (!textarea || !autoFocusEnabled) return;
2901
3044
  textarea.focus({ preventScroll: true });
@@ -2910,7 +3053,7 @@ var ComposerPrimitiveInput = forwardRef15(
2910
3053
  focus();
2911
3054
  }
2912
3055
  });
2913
- return /* @__PURE__ */ jsx24(
3056
+ return /* @__PURE__ */ jsx25(
2914
3057
  Component,
2915
3058
  {
2916
3059
  name: "input",
@@ -2918,12 +3061,12 @@ var ComposerPrimitiveInput = forwardRef15(
2918
3061
  ...rest,
2919
3062
  ref,
2920
3063
  disabled: isDisabled,
2921
- onChange: composeEventHandlers5(onChange, (e) => {
3064
+ onChange: composeEventHandlers6(onChange, (e) => {
2922
3065
  const composerState = useComposer.getState();
2923
3066
  if (!composerState.isEditing) return;
2924
3067
  return composerState.setText(e.target.value);
2925
3068
  }),
2926
- onKeyDown: composeEventHandlers5(onKeyDown, handleKeyPress)
3069
+ onKeyDown: composeEventHandlers6(onKeyDown, handleKeyPress)
2927
3070
  }
2928
3071
  );
2929
3072
  }
@@ -2931,14 +3074,14 @@ var ComposerPrimitiveInput = forwardRef15(
2931
3074
  ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
2932
3075
 
2933
3076
  // src/primitives/composer/ComposerSend.tsx
2934
- import { forwardRef as forwardRef16 } from "react";
2935
- import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
2936
- import { jsx as jsx25 } from "react/jsx-runtime";
2937
- var ComposerPrimitiveSend = forwardRef16(({ disabled, ...rest }, ref) => {
3077
+ import { forwardRef as forwardRef17 } from "react";
3078
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
3079
+ import { jsx as jsx26 } from "react/jsx-runtime";
3080
+ var ComposerPrimitiveSend = forwardRef17(({ disabled, ...rest }, ref) => {
2938
3081
  const { useComposer } = useComposerContext();
2939
3082
  const hasValue = useComposer((c) => c.isEditing && c.text.length > 0);
2940
- return /* @__PURE__ */ jsx25(
2941
- Primitive8.button,
3083
+ return /* @__PURE__ */ jsx26(
3084
+ Primitive9.button,
2942
3085
  {
2943
3086
  type: "submit",
2944
3087
  ...rest,
@@ -2987,11 +3130,11 @@ __export(thread_exports, {
2987
3130
  });
2988
3131
 
2989
3132
  // src/primitives/thread/ThreadRoot.tsx
2990
- import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
2991
- import { forwardRef as forwardRef17 } from "react";
2992
- import { jsx as jsx26 } from "react/jsx-runtime";
2993
- var ThreadPrimitiveRoot = forwardRef17((props, ref) => {
2994
- return /* @__PURE__ */ jsx26(Primitive9.div, { ...props, ref });
3133
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
3134
+ import { forwardRef as forwardRef18 } from "react";
3135
+ import { jsx as jsx27 } from "react/jsx-runtime";
3136
+ var ThreadPrimitiveRoot = forwardRef18((props, ref) => {
3137
+ return /* @__PURE__ */ jsx27(Primitive10.div, { ...props, ref });
2995
3138
  });
2996
3139
  ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
2997
3140
 
@@ -3016,8 +3159,8 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
3016
3159
 
3017
3160
  // src/primitives/thread/ThreadViewport.tsx
3018
3161
  import { useComposedRefs as useComposedRefs4 } from "@radix-ui/react-compose-refs";
3019
- import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
3020
- import { forwardRef as forwardRef18 } from "react";
3162
+ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
3163
+ import { forwardRef as forwardRef19 } from "react";
3021
3164
 
3022
3165
  // src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
3023
3166
  import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
@@ -3025,10 +3168,10 @@ import { useRef as useRef5 } from "react";
3025
3168
 
3026
3169
  // src/utils/hooks/useOnResizeContent.tsx
3027
3170
  import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
3028
- import { useCallback as useCallback15 } from "react";
3171
+ import { useCallback as useCallback17 } from "react";
3029
3172
  var useOnResizeContent = (callback) => {
3030
3173
  const callbackRef = useCallbackRef3(callback);
3031
- const refCallback = useCallback15(
3174
+ const refCallback = useCallback17(
3032
3175
  (el) => {
3033
3176
  const resizeObserver = new ResizeObserver(() => {
3034
3177
  callbackRef();
@@ -3128,13 +3271,13 @@ var useThreadViewportAutoScroll = ({
3128
3271
  };
3129
3272
 
3130
3273
  // src/primitives/thread/ThreadViewport.tsx
3131
- import { jsx as jsx27 } from "react/jsx-runtime";
3132
- var ThreadPrimitiveViewport = forwardRef18(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
3274
+ import { jsx as jsx28 } from "react/jsx-runtime";
3275
+ var ThreadPrimitiveViewport = forwardRef19(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
3133
3276
  const autoScrollRef = useThreadViewportAutoScroll({
3134
3277
  autoScroll
3135
3278
  });
3136
3279
  const ref = useComposedRefs4(forwardedRef, autoScrollRef);
3137
- return /* @__PURE__ */ jsx27(Primitive10.div, { ...rest, ref, children });
3280
+ return /* @__PURE__ */ jsx28(Primitive11.div, { ...rest, ref, children });
3138
3281
  });
3139
3282
  ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
3140
3283
 
@@ -3179,19 +3322,33 @@ var makeEditComposerStore = ({
3179
3322
 
3180
3323
  // src/context/stores/MessageUtils.ts
3181
3324
  import { create as create14 } from "zustand";
3182
- var makeMessageUtilsStore = () => create14((set) => ({
3183
- isCopied: false,
3184
- setIsCopied: (value) => {
3185
- set({ isCopied: value });
3186
- },
3187
- isHovering: false,
3188
- setIsHovering: (value) => {
3189
- set({ isHovering: value });
3190
- }
3191
- }));
3325
+ var makeMessageUtilsStore = () => create14((set) => {
3326
+ let utterance = null;
3327
+ return {
3328
+ isCopied: false,
3329
+ setIsCopied: (value) => {
3330
+ set({ isCopied: value });
3331
+ },
3332
+ isHovering: false,
3333
+ setIsHovering: (value) => {
3334
+ set({ isHovering: value });
3335
+ },
3336
+ isSpeaking: false,
3337
+ stopSpeaking: () => {
3338
+ utterance?.stop();
3339
+ },
3340
+ addUtterance: (utt) => {
3341
+ utterance = utt;
3342
+ set({ isSpeaking: true });
3343
+ utt.onEnd(() => {
3344
+ set({ isSpeaking: false });
3345
+ });
3346
+ }
3347
+ };
3348
+ });
3192
3349
 
3193
3350
  // src/context/providers/MessageProvider.tsx
3194
- import { jsx as jsx28 } from "react/jsx-runtime";
3351
+ import { jsx as jsx29 } from "react/jsx-runtime";
3195
3352
  var getIsLast = (messages, message) => {
3196
3353
  return messages[messages.length - 1]?.id === message.id;
3197
3354
  };
@@ -3275,11 +3432,11 @@ var MessageProvider = ({
3275
3432
  children
3276
3433
  }) => {
3277
3434
  const context = useMessageContext2(messageIndex);
3278
- return /* @__PURE__ */ jsx28(MessageContext.Provider, { value: context, children });
3435
+ return /* @__PURE__ */ jsx29(MessageContext.Provider, { value: context, children });
3279
3436
  };
3280
3437
 
3281
3438
  // src/primitives/thread/ThreadMessages.tsx
3282
- import { jsx as jsx29, jsxs as jsxs4 } from "react/jsx-runtime";
3439
+ import { jsx as jsx30, jsxs as jsxs4 } from "react/jsx-runtime";
3283
3440
  var DEFAULT_SYSTEM_MESSAGE = () => null;
3284
3441
  var getComponents = (components) => {
3285
3442
  return {
@@ -3296,11 +3453,11 @@ var ThreadMessageImpl = ({
3296
3453
  const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
3297
3454
  return /* @__PURE__ */ jsxs4(MessageProvider, { messageIndex, children: [
3298
3455
  /* @__PURE__ */ jsxs4(MessagePrimitiveIf, { user: true, children: [
3299
- /* @__PURE__ */ jsx29(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx29(UserMessage2, {}) }),
3300
- /* @__PURE__ */ jsx29(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx29(EditComposer2, {}) })
3456
+ /* @__PURE__ */ jsx30(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx30(UserMessage2, {}) }),
3457
+ /* @__PURE__ */ jsx30(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx30(EditComposer2, {}) })
3301
3458
  ] }),
3302
- /* @__PURE__ */ jsx29(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx29(AssistantMessage2, {}) }),
3303
- /* @__PURE__ */ jsx29(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx29(SystemMessage2, {}) })
3459
+ /* @__PURE__ */ jsx30(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx30(AssistantMessage2, {}) }),
3460
+ /* @__PURE__ */ jsx30(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx30(SystemMessage2, {}) })
3304
3461
  ] });
3305
3462
  };
3306
3463
  var ThreadMessage = memo3(
@@ -3315,7 +3472,7 @@ var ThreadPrimitiveMessagesImpl = ({
3315
3472
  if (messagesLength === 0) return null;
3316
3473
  return new Array(messagesLength).fill(null).map((_, idx) => {
3317
3474
  const messageIndex = idx;
3318
- return /* @__PURE__ */ jsx29(
3475
+ return /* @__PURE__ */ jsx30(
3319
3476
  ThreadMessage,
3320
3477
  {
3321
3478
  messageIndex,
@@ -3349,7 +3506,7 @@ import {
3349
3506
  createContext as createContext6,
3350
3507
  useContext as useContext6
3351
3508
  } from "react";
3352
- import { Fragment as Fragment3, jsx as jsx30 } from "react/jsx-runtime";
3509
+ import { Fragment as Fragment3, jsx as jsx31 } from "react/jsx-runtime";
3353
3510
  var ThreadConfigContext = createContext6({});
3354
3511
  var useThreadConfig = () => {
3355
3512
  return useContext6(ThreadConfigContext);
@@ -3359,27 +3516,39 @@ var ThreadConfigProvider = ({
3359
3516
  config
3360
3517
  }) => {
3361
3518
  const assistant = useAssistantContext({ optional: true });
3362
- const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx30(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx30(Fragment3, { children });
3519
+ const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx31(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx31(Fragment3, { children });
3363
3520
  if (!config?.runtime) return configProvider;
3364
3521
  if (assistant) {
3365
3522
  throw new Error(
3366
3523
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
3367
3524
  );
3368
3525
  }
3369
- return /* @__PURE__ */ jsx30(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
3526
+ return /* @__PURE__ */ jsx31(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
3370
3527
  };
3371
3528
  ThreadConfigProvider.displayName = "ThreadConfigProvider";
3372
3529
 
3373
3530
  // src/ui/assistant-action-bar.tsx
3374
- import { forwardRef as forwardRef19 } from "react";
3375
- import { CheckIcon, CopyIcon, RefreshCwIcon } from "lucide-react";
3376
- import { Fragment as Fragment4, jsx as jsx31, jsxs as jsxs5 } from "react/jsx-runtime";
3531
+ import { forwardRef as forwardRef20 } from "react";
3532
+ import {
3533
+ AudioLinesIcon,
3534
+ CheckIcon,
3535
+ CopyIcon,
3536
+ RefreshCwIcon,
3537
+ StopCircleIcon
3538
+ } from "lucide-react";
3539
+ import { Fragment as Fragment4, jsx as jsx32, jsxs as jsxs5 } from "react/jsx-runtime";
3377
3540
  var useAllowCopy = () => {
3378
3541
  const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
3379
3542
  const { useThread } = useThreadContext();
3380
- const copySupported = useThread((t) => t.capabilities.copy);
3543
+ const copySupported = useThread((t) => t.capabilities.unstable_copy);
3381
3544
  return copySupported && allowCopy;
3382
3545
  };
3546
+ var useAllowSpeak = () => {
3547
+ const { assistantMessage: { allowSpeak = true } = {} } = useThreadConfig();
3548
+ const { useThread } = useThreadContext();
3549
+ const speakSupported = useThread((t) => t.capabilities.speak);
3550
+ return speakSupported && allowSpeak;
3551
+ };
3383
3552
  var useAllowReload = () => {
3384
3553
  const { assistantMessage: { allowReload = true } = {} } = useThreadConfig();
3385
3554
  const { useThread } = useThreadContext();
@@ -3397,8 +3566,9 @@ var AssistantActionBar = () => {
3397
3566
  autohide: "not-last",
3398
3567
  autohideFloat: "single-branch",
3399
3568
  children: [
3400
- /* @__PURE__ */ jsx31(AssistantActionBarCopy, {}),
3401
- /* @__PURE__ */ jsx31(AssistantActionBarReload, {})
3569
+ /* @__PURE__ */ jsx32(AssistantActionBarSpeechControl, {}),
3570
+ /* @__PURE__ */ jsx32(AssistantActionBarCopy, {}),
3571
+ /* @__PURE__ */ jsx32(AssistantActionBarReload, {})
3402
3572
  ]
3403
3573
  }
3404
3574
  );
@@ -3408,21 +3578,51 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
3408
3578
  className: "aui-assistant-action-bar-root"
3409
3579
  });
3410
3580
  AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
3411
- var AssistantActionBarCopy = forwardRef19((props, ref) => {
3581
+ var AssistantActionBarCopy = forwardRef20((props, ref) => {
3412
3582
  const {
3413
3583
  strings: {
3414
- assistantMessage: { reload: { tooltip = "Copy" } = {} } = {}
3584
+ assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
3415
3585
  } = {}
3416
3586
  } = useThreadConfig();
3417
3587
  const allowCopy = useAllowCopy();
3418
3588
  if (!allowCopy) return null;
3419
- return /* @__PURE__ */ jsx31(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
3420
- /* @__PURE__ */ jsx31(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx31(CheckIcon, {}) }),
3421
- /* @__PURE__ */ jsx31(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx31(CopyIcon, {}) })
3589
+ return /* @__PURE__ */ jsx32(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
3590
+ /* @__PURE__ */ jsx32(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx32(CheckIcon, {}) }),
3591
+ /* @__PURE__ */ jsx32(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx32(CopyIcon, {}) })
3422
3592
  ] }) }) });
3423
3593
  });
3424
3594
  AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
3425
- var AssistantActionBarReload = forwardRef19((props, ref) => {
3595
+ var AssistantActionBarSpeechControl = () => {
3596
+ return /* @__PURE__ */ jsxs5(Fragment4, { children: [
3597
+ /* @__PURE__ */ jsx32(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx32(AssistantActionBarSpeak, {}) }),
3598
+ /* @__PURE__ */ jsx32(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx32(AssistantActionBarStopSpeaking, {}) })
3599
+ ] });
3600
+ };
3601
+ var AssistantActionBarSpeak = forwardRef20((props, ref) => {
3602
+ const {
3603
+ strings: {
3604
+ assistantMessage: { speak: { tooltip = "Read aloud" } = {} } = {}
3605
+ } = {}
3606
+ } = useThreadConfig();
3607
+ const allowSpeak = useAllowSpeak();
3608
+ if (!allowSpeak) return null;
3609
+ return /* @__PURE__ */ jsx32(actionBar_exports.Speak, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(AudioLinesIcon, {}) }) });
3610
+ });
3611
+ AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
3612
+ var AssistantActionBarStopSpeaking = forwardRef20((props, ref) => {
3613
+ const {
3614
+ strings: {
3615
+ assistantMessage: {
3616
+ speak: { stop: { tooltip: stopTooltip = "Stop" } = {} } = {}
3617
+ } = {}
3618
+ } = {}
3619
+ } = useThreadConfig();
3620
+ const allowSpeak = useAllowSpeak();
3621
+ if (!allowSpeak) return null;
3622
+ return /* @__PURE__ */ jsx32(actionBar_exports.StopSpeaking, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(StopCircleIcon, {}) }) });
3623
+ });
3624
+ AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
3625
+ var AssistantActionBarReload = forwardRef20((props, ref) => {
3426
3626
  const {
3427
3627
  strings: {
3428
3628
  assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
@@ -3430,13 +3630,16 @@ var AssistantActionBarReload = forwardRef19((props, ref) => {
3430
3630
  } = useThreadConfig();
3431
3631
  const allowReload = useAllowReload();
3432
3632
  if (!allowReload) return null;
3433
- return /* @__PURE__ */ jsx31(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx31(RefreshCwIcon, {}) }) });
3633
+ return /* @__PURE__ */ jsx32(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx32(RefreshCwIcon, {}) }) });
3434
3634
  });
3435
3635
  AssistantActionBarReload.displayName = "AssistantActionBarReload";
3436
3636
  var exports = {
3437
3637
  Root: AssistantActionBarRoot,
3438
3638
  Reload: AssistantActionBarReload,
3439
- Copy: AssistantActionBarCopy
3639
+ Copy: AssistantActionBarCopy,
3640
+ Speak: AssistantActionBarSpeak,
3641
+ StopSpeaking: AssistantActionBarStopSpeaking,
3642
+ SpeechControl: AssistantActionBarSpeechControl
3440
3643
  };
3441
3644
  var assistant_action_bar_default = Object.assign(
3442
3645
  AssistantActionBar,
@@ -3444,12 +3647,12 @@ var assistant_action_bar_default = Object.assign(
3444
3647
  );
3445
3648
 
3446
3649
  // src/ui/assistant-message.tsx
3447
- import { forwardRef as forwardRef21 } from "react";
3650
+ import { forwardRef as forwardRef22 } from "react";
3448
3651
 
3449
3652
  // src/ui/branch-picker.tsx
3450
- import { forwardRef as forwardRef20 } from "react";
3653
+ import { forwardRef as forwardRef21 } from "react";
3451
3654
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
3452
- import { jsx as jsx32, jsxs as jsxs6 } from "react/jsx-runtime";
3655
+ import { jsx as jsx33, jsxs as jsxs6 } from "react/jsx-runtime";
3453
3656
  var useAllowBranchPicker = () => {
3454
3657
  const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
3455
3658
  const { useThread } = useThreadContext();
@@ -3460,9 +3663,9 @@ var BranchPicker = () => {
3460
3663
  const allowBranchPicker = useAllowBranchPicker();
3461
3664
  if (!allowBranchPicker) return null;
3462
3665
  return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
3463
- /* @__PURE__ */ jsx32(BranchPickerPrevious2, {}),
3464
- /* @__PURE__ */ jsx32(BranchPickerState, {}),
3465
- /* @__PURE__ */ jsx32(BranchPickerNext, {})
3666
+ /* @__PURE__ */ jsx33(BranchPickerPrevious2, {}),
3667
+ /* @__PURE__ */ jsx33(BranchPickerState, {}),
3668
+ /* @__PURE__ */ jsx33(BranchPickerNext, {})
3466
3669
  ] });
3467
3670
  };
3468
3671
  BranchPicker.displayName = "BranchPicker";
@@ -3470,31 +3673,31 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
3470
3673
  className: "aui-branch-picker-root"
3471
3674
  });
3472
3675
  BranchPickerRoot.displayName = "BranchPickerRoot";
3473
- var BranchPickerPrevious2 = forwardRef20((props, ref) => {
3676
+ var BranchPickerPrevious2 = forwardRef21((props, ref) => {
3474
3677
  const {
3475
3678
  strings: {
3476
3679
  branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
3477
3680
  } = {}
3478
3681
  } = useThreadConfig();
3479
- return /* @__PURE__ */ jsx32(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronLeftIcon, {}) }) });
3682
+ return /* @__PURE__ */ jsx33(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ jsx33(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx33(ChevronLeftIcon, {}) }) });
3480
3683
  });
3481
3684
  BranchPickerPrevious2.displayName = "BranchPickerPrevious";
3482
3685
  var BranchPickerStateWrapper = withDefaults("span", {
3483
3686
  className: "aui-branch-picker-state"
3484
3687
  });
3485
- var BranchPickerState = forwardRef20((props, ref) => {
3688
+ var BranchPickerState = forwardRef21((props, ref) => {
3486
3689
  return /* @__PURE__ */ jsxs6(BranchPickerStateWrapper, { ...props, ref, children: [
3487
- /* @__PURE__ */ jsx32(branchPicker_exports.Number, {}),
3690
+ /* @__PURE__ */ jsx33(branchPicker_exports.Number, {}),
3488
3691
  " / ",
3489
- /* @__PURE__ */ jsx32(branchPicker_exports.Count, {})
3692
+ /* @__PURE__ */ jsx33(branchPicker_exports.Count, {})
3490
3693
  ] });
3491
3694
  });
3492
3695
  BranchPickerState.displayName = "BranchPickerState";
3493
- var BranchPickerNext = forwardRef20((props, ref) => {
3696
+ var BranchPickerNext = forwardRef21((props, ref) => {
3494
3697
  const {
3495
3698
  strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
3496
3699
  } = useThreadConfig();
3497
- return /* @__PURE__ */ jsx32(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronRightIcon, {}) }) });
3700
+ return /* @__PURE__ */ jsx33(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ jsx33(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx33(ChevronRightIcon, {}) }) });
3498
3701
  });
3499
3702
  BranchPickerNext.displayName = "BranchPickerNext";
3500
3703
  var exports2 = {
@@ -3506,12 +3709,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
3506
3709
 
3507
3710
  // src/ui/base/avatar.tsx
3508
3711
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
3509
- import { jsx as jsx33, jsxs as jsxs7 } from "react/jsx-runtime";
3712
+ import { jsx as jsx34, jsxs as jsxs7 } from "react/jsx-runtime";
3510
3713
  var Avatar = ({ src, alt, fallback }) => {
3511
3714
  if (src == null && fallback == null) return null;
3512
3715
  return /* @__PURE__ */ jsxs7(AvatarRoot, { children: [
3513
- src != null && /* @__PURE__ */ jsx33(AvatarImage, { src, alt }),
3514
- fallback != null && /* @__PURE__ */ jsx33(AvatarFallback, { children: fallback })
3716
+ src != null && /* @__PURE__ */ jsx34(AvatarImage, { src, alt }),
3717
+ fallback != null && /* @__PURE__ */ jsx34(AvatarFallback, { children: fallback })
3515
3718
  ] });
3516
3719
  };
3517
3720
  Avatar.displayName = "Avatar";
@@ -3530,10 +3733,10 @@ AvatarFallback.displayName = "AvatarFallback";
3530
3733
 
3531
3734
  // src/ui/content-part.tsx
3532
3735
  import classNames2 from "classnames";
3533
- import { jsx as jsx34 } from "react/jsx-runtime";
3736
+ import { jsx as jsx35 } from "react/jsx-runtime";
3534
3737
  var Text = () => {
3535
3738
  const status = useSmoothStatus();
3536
- return /* @__PURE__ */ jsx34(
3739
+ return /* @__PURE__ */ jsx35(
3537
3740
  contentPart_exports.Text,
3538
3741
  {
3539
3742
  className: classNames2(
@@ -3548,19 +3751,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) };
3548
3751
  var content_part_default = exports3;
3549
3752
 
3550
3753
  // src/ui/assistant-message.tsx
3551
- import { jsx as jsx35, jsxs as jsxs8 } from "react/jsx-runtime";
3754
+ import { jsx as jsx36, jsxs as jsxs8 } from "react/jsx-runtime";
3552
3755
  var AssistantMessage = () => {
3553
3756
  return /* @__PURE__ */ jsxs8(AssistantMessageRoot, { children: [
3554
- /* @__PURE__ */ jsx35(AssistantMessageAvatar, {}),
3555
- /* @__PURE__ */ jsx35(AssistantMessageContent, {}),
3556
- /* @__PURE__ */ jsx35(branch_picker_default, {}),
3557
- /* @__PURE__ */ jsx35(assistant_action_bar_default, {})
3757
+ /* @__PURE__ */ jsx36(AssistantMessageAvatar, {}),
3758
+ /* @__PURE__ */ jsx36(AssistantMessageContent, {}),
3759
+ /* @__PURE__ */ jsx36(branch_picker_default, {}),
3760
+ /* @__PURE__ */ jsx36(assistant_action_bar_default, {})
3558
3761
  ] });
3559
3762
  };
3560
3763
  AssistantMessage.displayName = "AssistantMessage";
3561
3764
  var AssistantMessageAvatar = () => {
3562
3765
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
3563
- return /* @__PURE__ */ jsx35(Avatar, { ...avatar });
3766
+ return /* @__PURE__ */ jsx36(Avatar, { ...avatar });
3564
3767
  };
3565
3768
  var AssistantMessageRoot = withDefaults(message_exports.Root, {
3566
3769
  className: "aui-assistant-message-root"
@@ -3569,9 +3772,9 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
3569
3772
  var AssistantMessageContentWrapper = withDefaults("div", {
3570
3773
  className: "aui-assistant-message-content"
3571
3774
  });
3572
- var AssistantMessageContent = forwardRef21(({ components: componentsProp, ...rest }, ref) => {
3775
+ var AssistantMessageContent = forwardRef22(({ components: componentsProp, ...rest }, ref) => {
3573
3776
  const { assistantMessage: { components = {} } = {} } = useThreadConfig();
3574
- return /* @__PURE__ */ jsx35(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx35(
3777
+ return /* @__PURE__ */ jsx36(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx36(
3575
3778
  message_exports.Content,
3576
3779
  {
3577
3780
  components: {
@@ -3593,21 +3796,21 @@ var assistant_message_default = Object.assign(
3593
3796
  );
3594
3797
 
3595
3798
  // src/ui/assistant-modal.tsx
3596
- import { forwardRef as forwardRef28 } from "react";
3799
+ import { forwardRef as forwardRef29 } from "react";
3597
3800
  import { BotIcon, ChevronDownIcon } from "lucide-react";
3598
3801
 
3599
3802
  // src/ui/thread.tsx
3600
- import { forwardRef as forwardRef27 } from "react";
3803
+ import { forwardRef as forwardRef28 } from "react";
3601
3804
  import { ArrowDownIcon } from "lucide-react";
3602
3805
 
3603
3806
  // src/ui/composer.tsx
3604
- import { forwardRef as forwardRef22 } from "react";
3807
+ import { forwardRef as forwardRef23 } from "react";
3605
3808
  import { SendHorizontalIcon } from "lucide-react";
3606
3809
 
3607
3810
  // src/ui/base/CircleStopIcon.tsx
3608
- import { jsx as jsx36 } from "react/jsx-runtime";
3811
+ import { jsx as jsx37 } from "react/jsx-runtime";
3609
3812
  var CircleStopIcon = () => {
3610
- return /* @__PURE__ */ jsx36(
3813
+ return /* @__PURE__ */ jsx37(
3611
3814
  "svg",
3612
3815
  {
3613
3816
  xmlns: "http://www.w3.org/2000/svg",
@@ -3615,18 +3818,18 @@ var CircleStopIcon = () => {
3615
3818
  fill: "currentColor",
3616
3819
  width: "16",
3617
3820
  height: "16",
3618
- children: /* @__PURE__ */ jsx36("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
3821
+ children: /* @__PURE__ */ jsx37("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
3619
3822
  }
3620
3823
  );
3621
3824
  };
3622
3825
  CircleStopIcon.displayName = "CircleStopIcon";
3623
3826
 
3624
3827
  // src/ui/composer.tsx
3625
- import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs9 } from "react/jsx-runtime";
3828
+ import { Fragment as Fragment5, jsx as jsx38, jsxs as jsxs9 } from "react/jsx-runtime";
3626
3829
  var Composer = () => {
3627
3830
  return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
3628
- /* @__PURE__ */ jsx37(ComposerInput, { autoFocus: true }),
3629
- /* @__PURE__ */ jsx37(ComposerAction, {})
3831
+ /* @__PURE__ */ jsx38(ComposerInput, { autoFocus: true }),
3832
+ /* @__PURE__ */ jsx38(ComposerAction, {})
3630
3833
  ] });
3631
3834
  };
3632
3835
  Composer.displayName = "Composer";
@@ -3639,14 +3842,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
3639
3842
  autoFocus: true,
3640
3843
  className: "aui-composer-input"
3641
3844
  });
3642
- var ComposerInput = forwardRef22(
3845
+ var ComposerInput = forwardRef23(
3643
3846
  (props, ref) => {
3644
3847
  const {
3645
3848
  strings: {
3646
3849
  composer: { input: { placeholder = "Write a message..." } = {} } = {}
3647
3850
  } = {}
3648
3851
  } = useThreadConfig();
3649
- return /* @__PURE__ */ jsx37(ComposerInputStyled, { placeholder, ...props, ref });
3852
+ return /* @__PURE__ */ jsx38(ComposerInputStyled, { placeholder, ...props, ref });
3650
3853
  }
3651
3854
  );
3652
3855
  ComposerInput.displayName = "ComposerInput";
@@ -3657,10 +3860,10 @@ var useAllowCancel = () => {
3657
3860
  };
3658
3861
  var ComposerAction = () => {
3659
3862
  const allowCancel = useAllowCancel();
3660
- if (!allowCancel) return /* @__PURE__ */ jsx37(ComposerSend, {});
3863
+ if (!allowCancel) return /* @__PURE__ */ jsx38(ComposerSend, {});
3661
3864
  return /* @__PURE__ */ jsxs9(Fragment5, { children: [
3662
- /* @__PURE__ */ jsx37(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx37(ComposerSend, {}) }),
3663
- /* @__PURE__ */ jsx37(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx37(ComposerCancel, {}) })
3865
+ /* @__PURE__ */ jsx38(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx38(ComposerSend, {}) }),
3866
+ /* @__PURE__ */ jsx38(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx38(ComposerCancel, {}) })
3664
3867
  ] });
3665
3868
  };
3666
3869
  ComposerAction.displayName = "ComposerAction";
@@ -3668,22 +3871,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
3668
3871
  variant: "default",
3669
3872
  className: "aui-composer-send"
3670
3873
  });
3671
- var ComposerSend = forwardRef22((props, ref) => {
3874
+ var ComposerSend = forwardRef23((props, ref) => {
3672
3875
  const {
3673
3876
  strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
3674
3877
  } = useThreadConfig();
3675
- return /* @__PURE__ */ jsx37(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(SendHorizontalIcon, {}) }) });
3878
+ return /* @__PURE__ */ jsx38(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx38(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx38(SendHorizontalIcon, {}) }) });
3676
3879
  });
3677
3880
  ComposerSend.displayName = "ComposerSend";
3678
3881
  var ComposerCancelButton = withDefaults(TooltipIconButton, {
3679
3882
  variant: "default",
3680
3883
  className: "aui-composer-cancel"
3681
3884
  });
3682
- var ComposerCancel = forwardRef22((props, ref) => {
3885
+ var ComposerCancel = forwardRef23((props, ref) => {
3683
3886
  const {
3684
3887
  strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
3685
3888
  } = useThreadConfig();
3686
- return /* @__PURE__ */ jsx37(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(CircleStopIcon, {}) }) });
3889
+ return /* @__PURE__ */ jsx38(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx38(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx38(CircleStopIcon, {}) }) });
3687
3890
  });
3688
3891
  ComposerCancel.displayName = "ComposerCancel";
3689
3892
  var exports5 = {
@@ -3696,15 +3899,15 @@ var exports5 = {
3696
3899
  var composer_default = Object.assign(Composer, exports5);
3697
3900
 
3698
3901
  // src/ui/thread-welcome.tsx
3699
- import { forwardRef as forwardRef23 } from "react";
3700
- import { jsx as jsx38, jsxs as jsxs10 } from "react/jsx-runtime";
3902
+ import { forwardRef as forwardRef24 } from "react";
3903
+ import { jsx as jsx39, jsxs as jsxs10 } from "react/jsx-runtime";
3701
3904
  var ThreadWelcome = () => {
3702
3905
  return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
3703
3906
  /* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
3704
- /* @__PURE__ */ jsx38(ThreadWelcomeAvatar, {}),
3705
- /* @__PURE__ */ jsx38(ThreadWelcomeMessage, {})
3907
+ /* @__PURE__ */ jsx39(ThreadWelcomeAvatar, {}),
3908
+ /* @__PURE__ */ jsx39(ThreadWelcomeMessage, {})
3706
3909
  ] }),
3707
- /* @__PURE__ */ jsx38(ThreadWelcomeSuggestions, {})
3910
+ /* @__PURE__ */ jsx39(ThreadWelcomeSuggestions, {})
3708
3911
  ] });
3709
3912
  };
3710
3913
  ThreadWelcome.displayName = "ThreadWelcome";
@@ -3714,22 +3917,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
3714
3917
  var ThreadWelcomeCenter = withDefaults("div", {
3715
3918
  className: "aui-thread-welcome-center"
3716
3919
  });
3717
- var ThreadWelcomeRoot = forwardRef23(
3920
+ var ThreadWelcomeRoot = forwardRef24(
3718
3921
  (props, ref) => {
3719
- return /* @__PURE__ */ jsx38(thread_exports.Empty, { children: /* @__PURE__ */ jsx38(ThreadWelcomeRootStyled, { ...props, ref }) });
3922
+ return /* @__PURE__ */ jsx39(thread_exports.Empty, { children: /* @__PURE__ */ jsx39(ThreadWelcomeRootStyled, { ...props, ref }) });
3720
3923
  }
3721
3924
  );
3722
3925
  ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
3723
3926
  var ThreadWelcomeAvatar = () => {
3724
3927
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
3725
- return /* @__PURE__ */ jsx38(Avatar, { ...avatar });
3928
+ return /* @__PURE__ */ jsx39(Avatar, { ...avatar });
3726
3929
  };
3727
3930
  var ThreadWelcomeMessageStyled = withDefaults("p", {
3728
3931
  className: "aui-thread-welcome-message"
3729
3932
  });
3730
- var ThreadWelcomeMessage = forwardRef23(({ message: messageProp, ...rest }, ref) => {
3933
+ var ThreadWelcomeMessage = forwardRef24(({ message: messageProp, ...rest }, ref) => {
3731
3934
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
3732
- return /* @__PURE__ */ jsx38(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
3935
+ return /* @__PURE__ */ jsx39(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
3733
3936
  });
3734
3937
  ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
3735
3938
  var ThreadWelcomeSuggestionContainer = withDefaults("div", {
@@ -3741,21 +3944,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
3741
3944
  var ThreadWelcomeSuggestion = ({
3742
3945
  suggestion: { text, prompt }
3743
3946
  }) => {
3744
- return /* @__PURE__ */ jsx38(
3947
+ return /* @__PURE__ */ jsx39(
3745
3948
  ThreadWelcomeSuggestionStyled,
3746
3949
  {
3747
3950
  prompt,
3748
3951
  method: "replace",
3749
3952
  autoSend: true,
3750
- children: /* @__PURE__ */ jsx38("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
3953
+ children: /* @__PURE__ */ jsx39("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
3751
3954
  }
3752
3955
  );
3753
3956
  };
3754
3957
  var ThreadWelcomeSuggestions = () => {
3755
3958
  const { welcome: { suggestions } = {} } = useThreadConfig();
3756
- return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
3959
+ return /* @__PURE__ */ jsx39(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
3757
3960
  const key = `${suggestion.prompt}-${idx}`;
3758
- return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestion, { suggestion }, key);
3961
+ return /* @__PURE__ */ jsx39(ThreadWelcomeSuggestion, { suggestion }, key);
3759
3962
  }) });
3760
3963
  };
3761
3964
  ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
@@ -3770,12 +3973,12 @@ var exports6 = {
3770
3973
  var thread_welcome_default = Object.assign(ThreadWelcome, exports6);
3771
3974
 
3772
3975
  // src/ui/user-message.tsx
3773
- import { forwardRef as forwardRef25 } from "react";
3976
+ import { forwardRef as forwardRef26 } from "react";
3774
3977
 
3775
3978
  // src/ui/user-action-bar.tsx
3776
- import { forwardRef as forwardRef24 } from "react";
3979
+ import { forwardRef as forwardRef25 } from "react";
3777
3980
  import { PencilIcon } from "lucide-react";
3778
- import { jsx as jsx39 } from "react/jsx-runtime";
3981
+ import { jsx as jsx40 } from "react/jsx-runtime";
3779
3982
  var useAllowEdit = () => {
3780
3983
  const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
3781
3984
  const { useThread } = useThreadContext();
@@ -3785,20 +3988,20 @@ var useAllowEdit = () => {
3785
3988
  var UserActionBar = () => {
3786
3989
  const allowEdit = useAllowEdit();
3787
3990
  if (!allowEdit) return null;
3788
- return /* @__PURE__ */ jsx39(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx39(UserActionBarEdit, {}) });
3991
+ return /* @__PURE__ */ jsx40(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx40(UserActionBarEdit, {}) });
3789
3992
  };
3790
3993
  UserActionBar.displayName = "UserActionBar";
3791
3994
  var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
3792
3995
  className: "aui-user-action-bar-root"
3793
3996
  });
3794
3997
  UserActionBarRoot.displayName = "UserActionBarRoot";
3795
- var UserActionBarEdit = forwardRef24((props, ref) => {
3998
+ var UserActionBarEdit = forwardRef25((props, ref) => {
3796
3999
  const {
3797
4000
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
3798
4001
  } = useThreadConfig();
3799
4002
  const allowEdit = useAllowEdit();
3800
4003
  if (!allowEdit) return null;
3801
- return /* @__PURE__ */ jsx39(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(PencilIcon, {}) }) });
4004
+ return /* @__PURE__ */ jsx40(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ jsx40(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx40(PencilIcon, {}) }) });
3802
4005
  });
3803
4006
  UserActionBarEdit.displayName = "UserActionBarEdit";
3804
4007
  var exports7 = {
@@ -3808,12 +4011,12 @@ var exports7 = {
3808
4011
  var user_action_bar_default = Object.assign(UserActionBar, exports7);
3809
4012
 
3810
4013
  // src/ui/user-message.tsx
3811
- import { jsx as jsx40, jsxs as jsxs11 } from "react/jsx-runtime";
4014
+ import { jsx as jsx41, jsxs as jsxs11 } from "react/jsx-runtime";
3812
4015
  var UserMessage = () => {
3813
4016
  return /* @__PURE__ */ jsxs11(UserMessageRoot, { children: [
3814
- /* @__PURE__ */ jsx40(user_action_bar_default, {}),
3815
- /* @__PURE__ */ jsx40(UserMessageContent, {}),
3816
- /* @__PURE__ */ jsx40(branch_picker_default, {})
4017
+ /* @__PURE__ */ jsx41(user_action_bar_default, {}),
4018
+ /* @__PURE__ */ jsx41(UserMessageContent, {}),
4019
+ /* @__PURE__ */ jsx41(branch_picker_default, {})
3817
4020
  ] });
3818
4021
  };
3819
4022
  UserMessage.displayName = "UserMessage";
@@ -3824,9 +4027,9 @@ UserMessageRoot.displayName = "UserMessageRoot";
3824
4027
  var UserMessageContentWrapper = withDefaults("div", {
3825
4028
  className: "aui-user-message-content"
3826
4029
  });
3827
- var UserMessageContent = forwardRef25(
4030
+ var UserMessageContent = forwardRef26(
3828
4031
  ({ components, ...props }, ref) => {
3829
- return /* @__PURE__ */ jsx40(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx40(
4032
+ return /* @__PURE__ */ jsx41(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx41(
3830
4033
  message_exports.Content,
3831
4034
  {
3832
4035
  components: {
@@ -3845,14 +4048,14 @@ var exports8 = {
3845
4048
  var user_message_default = Object.assign(UserMessage, exports8);
3846
4049
 
3847
4050
  // src/ui/edit-composer.tsx
3848
- import { forwardRef as forwardRef26 } from "react";
3849
- import { jsx as jsx41, jsxs as jsxs12 } from "react/jsx-runtime";
4051
+ import { forwardRef as forwardRef27 } from "react";
4052
+ import { jsx as jsx42, jsxs as jsxs12 } from "react/jsx-runtime";
3850
4053
  var EditComposer = () => {
3851
4054
  return /* @__PURE__ */ jsxs12(EditComposerRoot, { children: [
3852
- /* @__PURE__ */ jsx41(EditComposerInput, {}),
4055
+ /* @__PURE__ */ jsx42(EditComposerInput, {}),
3853
4056
  /* @__PURE__ */ jsxs12(EditComposerFooter, { children: [
3854
- /* @__PURE__ */ jsx41(EditComposerCancel, {}),
3855
- /* @__PURE__ */ jsx41(EditComposerSend, {})
4057
+ /* @__PURE__ */ jsx42(EditComposerCancel, {}),
4058
+ /* @__PURE__ */ jsx42(EditComposerSend, {})
3856
4059
  ] })
3857
4060
  ] });
3858
4061
  };
@@ -3869,23 +4072,23 @@ var EditComposerFooter = withDefaults("div", {
3869
4072
  className: "aui-edit-composer-footer"
3870
4073
  });
3871
4074
  EditComposerFooter.displayName = "EditComposerFooter";
3872
- var EditComposerCancel = forwardRef26(
4075
+ var EditComposerCancel = forwardRef27(
3873
4076
  (props, ref) => {
3874
4077
  const {
3875
4078
  strings: {
3876
4079
  editComposer: { cancel: { label = "Cancel" } = {} } = {}
3877
4080
  } = {}
3878
4081
  } = useThreadConfig();
3879
- return /* @__PURE__ */ jsx41(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4082
+ return /* @__PURE__ */ jsx42(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx42(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
3880
4083
  }
3881
4084
  );
3882
4085
  EditComposerCancel.displayName = "EditComposerCancel";
3883
- var EditComposerSend = forwardRef26(
4086
+ var EditComposerSend = forwardRef27(
3884
4087
  (props, ref) => {
3885
4088
  const {
3886
4089
  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
3887
4090
  } = useThreadConfig();
3888
- return /* @__PURE__ */ jsx41(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { ...props, ref, children: props.children ?? label }) });
4091
+ return /* @__PURE__ */ jsx42(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx42(Button, { ...props, ref, children: props.children ?? label }) });
3889
4092
  }
3890
4093
  );
3891
4094
  EditComposerSend.displayName = "EditComposerSend";
@@ -3899,23 +4102,23 @@ var exports9 = {
3899
4102
  var edit_composer_default = Object.assign(EditComposer, exports9);
3900
4103
 
3901
4104
  // src/ui/thread.tsx
3902
- import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
4105
+ import { jsx as jsx43, jsxs as jsxs13 } from "react/jsx-runtime";
3903
4106
  var Thread = (config) => {
3904
- return /* @__PURE__ */ jsx42(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
3905
- /* @__PURE__ */ jsx42(thread_welcome_default, {}),
3906
- /* @__PURE__ */ jsx42(ThreadMessages, {}),
4107
+ return /* @__PURE__ */ jsx43(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
4108
+ /* @__PURE__ */ jsx43(thread_welcome_default, {}),
4109
+ /* @__PURE__ */ jsx43(ThreadMessages, {}),
3907
4110
  /* @__PURE__ */ jsxs13(ThreadViewportFooter, { children: [
3908
- /* @__PURE__ */ jsx42(ThreadScrollToBottom, {}),
3909
- /* @__PURE__ */ jsx42(composer_default, {})
4111
+ /* @__PURE__ */ jsx43(ThreadScrollToBottom, {}),
4112
+ /* @__PURE__ */ jsx43(composer_default, {})
3910
4113
  ] })
3911
4114
  ] }) });
3912
4115
  };
3913
4116
  var ThreadRootStyled = withDefaults(thread_exports.Root, {
3914
4117
  className: "aui-root aui-thread-root"
3915
4118
  });
3916
- var ThreadRoot = forwardRef27(
4119
+ var ThreadRoot = forwardRef28(
3917
4120
  ({ config, ...props }, ref) => {
3918
- return /* @__PURE__ */ jsx42(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx42(ThreadRootStyled, { ...props, ref }) });
4121
+ return /* @__PURE__ */ jsx43(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx43(ThreadRootStyled, { ...props, ref }) });
3919
4122
  }
3920
4123
  );
3921
4124
  ThreadRoot.displayName = "ThreadRoot";
@@ -3929,7 +4132,7 @@ var ThreadViewportFooter = withDefaults("div", {
3929
4132
  ThreadViewportFooter.displayName = "ThreadViewportFooter";
3930
4133
  var SystemMessage = () => null;
3931
4134
  var ThreadMessages = ({ components, ...rest }) => {
3932
- return /* @__PURE__ */ jsx42(
4135
+ return /* @__PURE__ */ jsx43(
3933
4136
  thread_exports.Messages,
3934
4137
  {
3935
4138
  components: {
@@ -3947,13 +4150,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
3947
4150
  variant: "outline",
3948
4151
  className: "aui-thread-scroll-to-bottom"
3949
4152
  });
3950
- var ThreadScrollToBottom = forwardRef27((props, ref) => {
4153
+ var ThreadScrollToBottom = forwardRef28((props, ref) => {
3951
4154
  const {
3952
4155
  strings: {
3953
4156
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
3954
4157
  } = {}
3955
4158
  } = useThreadConfig();
3956
- return /* @__PURE__ */ jsx42(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx42(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx42(ArrowDownIcon, {}) }) });
4159
+ return /* @__PURE__ */ jsx43(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx43(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx43(ArrowDownIcon, {}) }) });
3957
4160
  });
3958
4161
  ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
3959
4162
  var exports10 = {
@@ -3966,20 +4169,20 @@ var exports10 = {
3966
4169
  var thread_default = Object.assign(Thread, exports10);
3967
4170
 
3968
4171
  // src/ui/assistant-modal.tsx
3969
- import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs14 } from "react/jsx-runtime";
4172
+ import { Fragment as Fragment6, jsx as jsx44, jsxs as jsxs14 } from "react/jsx-runtime";
3970
4173
  var AssistantModal = (config) => {
3971
4174
  return /* @__PURE__ */ jsxs14(AssistantModalRoot, { config, children: [
3972
- /* @__PURE__ */ jsx43(AssistantModalTrigger, {}),
3973
- /* @__PURE__ */ jsx43(AssistantModalContent, { children: /* @__PURE__ */ jsx43(thread_default, {}) })
4175
+ /* @__PURE__ */ jsx44(AssistantModalTrigger, {}),
4176
+ /* @__PURE__ */ jsx44(AssistantModalContent, { children: /* @__PURE__ */ jsx44(thread_default, {}) })
3974
4177
  ] });
3975
4178
  };
3976
4179
  AssistantModal.displayName = "AssistantModal";
3977
4180
  var AssistantModalRoot = ({ config, ...props }) => {
3978
- return /* @__PURE__ */ jsx43(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx43(assistantModal_exports.Root, { ...props }) });
4181
+ return /* @__PURE__ */ jsx44(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx44(assistantModal_exports.Root, { ...props }) });
3979
4182
  };
3980
4183
  AssistantModalRoot.displayName = "AssistantModalRoot";
3981
- var AssistantModalTrigger = forwardRef28((props, ref) => {
3982
- return /* @__PURE__ */ jsx43(AssistantModalAnchor, { children: /* @__PURE__ */ jsx43(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx43(AssistantModalButton, { ...props, ref }) }) });
4184
+ var AssistantModalTrigger = forwardRef29((props, ref) => {
4185
+ return /* @__PURE__ */ jsx44(AssistantModalAnchor, { children: /* @__PURE__ */ jsx44(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx44(AssistantModalButton, { ...props, ref }) }) });
3983
4186
  });
3984
4187
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
3985
4188
  var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
@@ -3990,7 +4193,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
3990
4193
  variant: "default",
3991
4194
  className: "aui-modal-button"
3992
4195
  });
3993
- var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref) => {
4196
+ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref) => {
3994
4197
  const {
3995
4198
  strings: {
3996
4199
  assistantModal: {
@@ -4004,7 +4207,7 @@ var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref)
4004
4207
  } = {}
4005
4208
  } = useThreadConfig();
4006
4209
  const tooltip = state === "open" ? openTooltip : closedTooltip;
4007
- return /* @__PURE__ */ jsx43(
4210
+ return /* @__PURE__ */ jsx44(
4008
4211
  ModalButtonStyled,
4009
4212
  {
4010
4213
  side: "left",
@@ -4013,14 +4216,14 @@ var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref)
4013
4216
  ...rest,
4014
4217
  ref,
4015
4218
  children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment6, { children: [
4016
- /* @__PURE__ */ jsx43(
4219
+ /* @__PURE__ */ jsx44(
4017
4220
  BotIcon,
4018
4221
  {
4019
4222
  "data-state": state,
4020
4223
  className: "aui-modal-button-closed-icon"
4021
4224
  }
4022
4225
  ),
4023
- /* @__PURE__ */ jsx43(
4226
+ /* @__PURE__ */ jsx44(
4024
4227
  ChevronDownIcon,
4025
4228
  {
4026
4229
  "data-state": state,
@@ -4069,6 +4272,7 @@ export {
4069
4272
  thread_welcome_default as ThreadWelcome,
4070
4273
  user_action_bar_default as UserActionBar,
4071
4274
  user_message_default as UserMessage,
4275
+ WebSpeechSynthesisAdapter,
4072
4276
  fromCoreMessage,
4073
4277
  fromCoreMessages,
4074
4278
  fromLanguageModelMessages,
@@ -4085,6 +4289,8 @@ export {
4085
4289
  useActionBarCopy,
4086
4290
  useActionBarEdit,
4087
4291
  useActionBarReload,
4292
+ useActionBarSpeak,
4293
+ useActionBarStopSpeaking,
4088
4294
  useAppendMessage,
4089
4295
  useAssistantContext,
4090
4296
  useAssistantInstructions,