@assistant-ui/react 0.5.40 → 0.5.42

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
  };
@@ -1057,31 +1058,29 @@ var EdgeChatAdapter = class {
1057
1058
  var useEdgeRuntime = ({
1058
1059
  initialMessages,
1059
1060
  maxToolRoundtrips,
1061
+ adapters,
1060
1062
  ...options
1061
1063
  }) => {
1062
1064
  const [adapter] = useState3(() => new EdgeChatAdapter(options));
1063
- return useLocalRuntime(adapter, { initialMessages, maxToolRoundtrips });
1065
+ return useLocalRuntime(adapter, {
1066
+ initialMessages,
1067
+ maxToolRoundtrips,
1068
+ adapters
1069
+ });
1064
1070
  };
1065
1071
 
1066
1072
  // src/runtimes/local/shouldContinue.tsx
1067
1073
  var shouldContinue = (result) => result.status?.type === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
1068
1074
 
1069
1075
  // src/runtimes/local/LocalThreadRuntime.tsx
1070
- var CAPABILITIES = Object.freeze({
1071
- switchToBranch: true,
1072
- edit: true,
1073
- reload: true,
1074
- cancel: true,
1075
- copy: true
1076
- });
1077
1076
  var LocalThreadRuntime = class {
1078
- constructor(configProvider, adapter, options) {
1077
+ constructor(configProvider, adapter, { initialMessages, ...options }) {
1079
1078
  this.configProvider = configProvider;
1080
1079
  this.adapter = adapter;
1081
1080
  this.options = options;
1082
- if (options.initialMessages) {
1081
+ if (initialMessages) {
1083
1082
  let parentId = null;
1084
- const messages = fromCoreMessages(options.initialMessages);
1083
+ const messages = fromCoreMessages(initialMessages);
1085
1084
  for (const message of messages) {
1086
1085
  this.repository.addOrUpdateMessage(parentId, message);
1087
1086
  parentId = message.id;
@@ -1091,7 +1090,14 @@ var LocalThreadRuntime = class {
1091
1090
  _subscriptions = /* @__PURE__ */ new Set();
1092
1091
  abortController = null;
1093
1092
  repository = new MessageRepository();
1094
- capabilities = CAPABILITIES;
1093
+ capabilities = {
1094
+ switchToBranch: true,
1095
+ edit: true,
1096
+ reload: true,
1097
+ cancel: true,
1098
+ unstable_copy: true,
1099
+ speak: false
1100
+ };
1095
1101
  isDisabled = false;
1096
1102
  get messages() {
1097
1103
  return this.repository.getMessages();
@@ -1103,6 +1109,18 @@ var LocalThreadRuntime = class {
1103
1109
  this.notifySubscribers();
1104
1110
  }
1105
1111
  };
1112
+ _options;
1113
+ get options() {
1114
+ return this._options;
1115
+ }
1116
+ set options({ initialMessages, ...options }) {
1117
+ this._options = options;
1118
+ const canSpeak = options.adapters?.speech !== void 0;
1119
+ if (this.capabilities.speak !== canSpeak) {
1120
+ this.capabilities.speak = canSpeak;
1121
+ this.notifySubscribers();
1122
+ }
1123
+ }
1106
1124
  getBranches(messageId) {
1107
1125
  return this.repository.getBranches(messageId);
1108
1126
  }
@@ -1240,7 +1258,11 @@ var LocalThreadRuntime = class {
1240
1258
  this._subscriptions.add(callback);
1241
1259
  return () => this._subscriptions.delete(callback);
1242
1260
  }
1243
- addToolResult({ messageId, toolCallId, result }) {
1261
+ addToolResult({
1262
+ messageId,
1263
+ toolCallId,
1264
+ result
1265
+ }) {
1244
1266
  let { parentId, message } = this.repository.getMessage(messageId);
1245
1267
  if (message.role !== "assistant")
1246
1268
  throw new Error("Tried to add tool result to non-assistant message");
@@ -1267,6 +1289,25 @@ var LocalThreadRuntime = class {
1267
1289
  this.performRoundtrip(parentId, message);
1268
1290
  }
1269
1291
  }
1292
+ // TODO lift utterance state to thread runtime
1293
+ _utterance;
1294
+ speak(messageId) {
1295
+ const adapter = this.options.adapters?.speech;
1296
+ if (!adapter) throw new Error("Speech adapter not configured");
1297
+ const { message } = this.repository.getMessage(messageId);
1298
+ if (this._utterance) {
1299
+ this._utterance.cancel();
1300
+ this._utterance = void 0;
1301
+ }
1302
+ const utterance = adapter.speak(message);
1303
+ utterance.onEnd(() => {
1304
+ if (this._utterance === utterance) {
1305
+ this._utterance = void 0;
1306
+ }
1307
+ });
1308
+ this._utterance = utterance;
1309
+ return this._utterance;
1310
+ }
1270
1311
  export() {
1271
1312
  return this.repository.export();
1272
1313
  }
@@ -1446,7 +1487,8 @@ var ExternalStoreThreadRuntime = class {
1446
1487
  edit: false,
1447
1488
  reload: false,
1448
1489
  cancel: false,
1449
- copy: false
1490
+ unstable_copy: false,
1491
+ speak: false
1450
1492
  };
1451
1493
  get capabilities() {
1452
1494
  return this._capabilities;
@@ -1476,7 +1518,8 @@ var ExternalStoreThreadRuntime = class {
1476
1518
  edit: this._store.onEdit !== void 0,
1477
1519
  reload: this._store.onReload !== void 0,
1478
1520
  cancel: this._store.onCancel !== void 0,
1479
- copy: this._store.onCopy !== null
1521
+ unstable_copy: this._store.unstable_capabilities?.copy !== null,
1522
+ speak: this._store.onSpeak !== void 0
1480
1523
  };
1481
1524
  if (oldStore) {
1482
1525
  if (oldStore.convertMessage !== store.convertMessage) {
@@ -1573,6 +1616,17 @@ var ExternalStoreThreadRuntime = class {
1573
1616
  this.updateMessages(messages);
1574
1617
  }, 0);
1575
1618
  }
1619
+ addToolResult(options) {
1620
+ if (!this._store.onAddToolResult)
1621
+ throw new Error("Runtime does not support tool results.");
1622
+ this._store.onAddToolResult(options);
1623
+ }
1624
+ speak(messageId) {
1625
+ if (!this._store.onSpeak)
1626
+ throw new Error("Runtime does not support speaking.");
1627
+ const { message } = this.repository.getMessage(messageId);
1628
+ return this._store.onSpeak(message);
1629
+ }
1576
1630
  subscribe(callback) {
1577
1631
  this._subscriptions.add(callback);
1578
1632
  return () => this._subscriptions.delete(callback);
@@ -1582,11 +1636,6 @@ var ExternalStoreThreadRuntime = class {
1582
1636
  messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
1583
1637
  );
1584
1638
  };
1585
- addToolResult(options) {
1586
- if (!this._store.onAddToolResult)
1587
- throw new Error("Runtime does not support tool results.");
1588
- this._store.onAddToolResult(options);
1589
- }
1590
1639
  };
1591
1640
 
1592
1641
  // src/runtimes/external-store/ExternalStoreRuntime.tsx
@@ -1671,6 +1720,47 @@ var useDangerousInBrowserRuntime = ({
1671
1720
  return useLocalRuntime(adapter, { initialMessages });
1672
1721
  };
1673
1722
 
1723
+ // src/runtimes/speech/WebSpeechSynthesisAdapter.ts
1724
+ var WebSpeechSynthesisAdapter = class {
1725
+ speak(message) {
1726
+ const text = getThreadMessageText(message);
1727
+ const utterance = new SpeechSynthesisUtterance(text);
1728
+ const endHandlers = /* @__PURE__ */ new Set();
1729
+ const handleEnd = (reason, error) => {
1730
+ if (res.status.type === "ended") return;
1731
+ res.status = { type: "ended", reason, error };
1732
+ endHandlers.forEach((handler) => handler());
1733
+ };
1734
+ utterance.addEventListener("end", () => handleEnd("finished"));
1735
+ utterance.addEventListener("error", (e) => handleEnd("error", e.error));
1736
+ window.speechSynthesis.speak(utterance);
1737
+ const res = {
1738
+ status: { type: "running" },
1739
+ cancel: () => {
1740
+ window.speechSynthesis.cancel();
1741
+ handleEnd("cancelled");
1742
+ },
1743
+ onEnd: (callback) => {
1744
+ if (res.status.type === "ended") {
1745
+ let cancelled = false;
1746
+ queueMicrotask(() => {
1747
+ if (!cancelled) callback();
1748
+ });
1749
+ return () => {
1750
+ cancelled = true;
1751
+ };
1752
+ } else {
1753
+ endHandlers.add(callback);
1754
+ return () => {
1755
+ endHandlers.delete(callback);
1756
+ };
1757
+ }
1758
+ }
1759
+ };
1760
+ return res;
1761
+ }
1762
+ };
1763
+
1674
1764
  // src/context/providers/ThreadProvider.tsx
1675
1765
  import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
1676
1766
  var ThreadProvider = ({
@@ -1977,8 +2067,8 @@ var useActionBarCopy = ({
1977
2067
  const { useMessage, useMessageUtils, useEditComposer } = useMessageContext();
1978
2068
  const hasCopyableContent = useCombinedStore(
1979
2069
  [useMessage, useEditComposer],
1980
- (m, c) => {
1981
- return !c.isEditing && m.message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
2070
+ ({ message }, c) => {
2071
+ return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
1982
2072
  }
1983
2073
  );
1984
2074
  const callback = useCallback3(() => {
@@ -2030,6 +2120,38 @@ var useActionBarReload = () => {
2030
2120
  return callback;
2031
2121
  };
2032
2122
 
2123
+ // src/primitive-hooks/actionBar/useActionBarSpeak.tsx
2124
+ import { useCallback as useCallback6 } from "react";
2125
+ var useActionBarSpeak = () => {
2126
+ const { useThreadActions } = useThreadContext();
2127
+ const { useMessage, useEditComposer, useMessageUtils } = useMessageContext();
2128
+ const hasSpeakableContent = useCombinedStore(
2129
+ [useMessage, useEditComposer],
2130
+ ({ message }, c) => {
2131
+ return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
2132
+ }
2133
+ );
2134
+ const callback = useCallback6(async () => {
2135
+ const { message } = useMessage.getState();
2136
+ const utt = useThreadActions.getState().speak(message.id);
2137
+ useMessageUtils.getState().addUtterance(utt);
2138
+ }, [useThreadActions, useMessage, useMessageUtils]);
2139
+ if (!hasSpeakableContent) return null;
2140
+ return callback;
2141
+ };
2142
+
2143
+ // src/primitive-hooks/actionBar/useActionBarStopSpeaking.tsx
2144
+ import { useCallback as useCallback7 } from "react";
2145
+ var useActionBarStopSpeaking = () => {
2146
+ const { useMessageUtils } = useMessageContext();
2147
+ const isSpeaking = useMessageUtils((u) => u.isSpeaking);
2148
+ const callback = useCallback7(async () => {
2149
+ useMessageUtils.getState().stopSpeaking();
2150
+ }, [useMessageUtils]);
2151
+ if (!isSpeaking) return null;
2152
+ return callback;
2153
+ };
2154
+
2033
2155
  // src/primitive-hooks/branchPicker/useBranchPickerCount.tsx
2034
2156
  var useBranchPickerCount = () => {
2035
2157
  const { useMessage } = useMessageContext();
@@ -2038,7 +2160,7 @@ var useBranchPickerCount = () => {
2038
2160
  };
2039
2161
 
2040
2162
  // src/primitive-hooks/branchPicker/useBranchPickerNext.tsx
2041
- import { useCallback as useCallback6 } from "react";
2163
+ import { useCallback as useCallback8 } from "react";
2042
2164
  var useBranchPickerNext = () => {
2043
2165
  const { useThreadActions } = useThreadContext();
2044
2166
  const { useMessage, useEditComposer } = useMessageContext();
@@ -2046,7 +2168,7 @@ var useBranchPickerNext = () => {
2046
2168
  [useMessage, useEditComposer],
2047
2169
  (m, c) => c.isEditing || m.branches.indexOf(m.message.id) + 1 >= m.branches.length
2048
2170
  );
2049
- const callback = useCallback6(() => {
2171
+ const callback = useCallback8(() => {
2050
2172
  const { message, branches } = useMessage.getState();
2051
2173
  useThreadActions.getState().switchToBranch(branches[branches.indexOf(message.id) + 1]);
2052
2174
  }, [useThreadActions, useMessage]);
@@ -2062,7 +2184,7 @@ var useBranchPickerNumber = () => {
2062
2184
  };
2063
2185
 
2064
2186
  // src/primitive-hooks/branchPicker/useBranchPickerPrevious.tsx
2065
- import { useCallback as useCallback7 } from "react";
2187
+ import { useCallback as useCallback9 } from "react";
2066
2188
  var useBranchPickerPrevious = () => {
2067
2189
  const { useThreadActions } = useThreadContext();
2068
2190
  const { useMessage, useEditComposer } = useMessageContext();
@@ -2070,7 +2192,7 @@ var useBranchPickerPrevious = () => {
2070
2192
  [useMessage, useEditComposer],
2071
2193
  (m, c) => c.isEditing || m.branches.indexOf(m.message.id) <= 0
2072
2194
  );
2073
- const callback = useCallback7(() => {
2195
+ const callback = useCallback9(() => {
2074
2196
  const { message, branches } = useMessage.getState();
2075
2197
  useThreadActions.getState().switchToBranch(branches[branches.indexOf(message.id) - 1]);
2076
2198
  }, [useThreadActions, useMessage]);
@@ -2079,11 +2201,11 @@ var useBranchPickerPrevious = () => {
2079
2201
  };
2080
2202
 
2081
2203
  // src/primitive-hooks/composer/useComposerCancel.tsx
2082
- import { useCallback as useCallback8 } from "react";
2204
+ import { useCallback as useCallback10 } from "react";
2083
2205
  var useComposerCancel = () => {
2084
2206
  const { useComposer } = useComposerContext();
2085
2207
  const disabled = useComposer((c) => !c.canCancel);
2086
- const callback = useCallback8(() => {
2208
+ const callback = useCallback10(() => {
2087
2209
  const { cancel } = useComposer.getState();
2088
2210
  cancel();
2089
2211
  }, [useComposer]);
@@ -2102,7 +2224,7 @@ var useComposerIf = (props) => {
2102
2224
  };
2103
2225
 
2104
2226
  // src/primitive-hooks/composer/useComposerSend.tsx
2105
- import { useCallback as useCallback9 } from "react";
2227
+ import { useCallback as useCallback11 } from "react";
2106
2228
  var useComposerSend = () => {
2107
2229
  const {
2108
2230
  useThread,
@@ -2114,7 +2236,7 @@ var useComposerSend = () => {
2114
2236
  [useThread, useComposer],
2115
2237
  (t, c) => t.isRunning || !c.isEditing || c.text.length === 0
2116
2238
  );
2117
- const callback = useCallback9(() => {
2239
+ const callback = useCallback11(() => {
2118
2240
  const composerState = useComposer.getState();
2119
2241
  if (!composerState.isEditing) return;
2120
2242
  composerState.send();
@@ -2169,7 +2291,7 @@ var useMessageIf = (props) => {
2169
2291
  const { useMessage, useMessageUtils } = useMessageContext();
2170
2292
  return useCombinedStore(
2171
2293
  [useMessage, useMessageUtils],
2172
- ({ message, branches, isLast }, { isCopied, isHovering }) => {
2294
+ ({ message, branches, isLast }, { isCopied, isHovering, isSpeaking }) => {
2173
2295
  if (props.hasBranches === true && branches.length < 2) return false;
2174
2296
  if (props.user && message.role !== "user") return false;
2175
2297
  if (props.assistant && message.role !== "assistant") return false;
@@ -2177,6 +2299,8 @@ var useMessageIf = (props) => {
2177
2299
  if (props.lastOrHover === true && !isHovering && !isLast) return false;
2178
2300
  if (props.copied === true && !isCopied) return false;
2179
2301
  if (props.copied === false && isCopied) return false;
2302
+ if (props.speaking === true && !isSpeaking) return false;
2303
+ if (props.speaking === false && isSpeaking) return false;
2180
2304
  return true;
2181
2305
  }
2182
2306
  );
@@ -2205,11 +2329,11 @@ var useThreadEmpty = () => {
2205
2329
  };
2206
2330
 
2207
2331
  // src/primitive-hooks/thread/useThreadScrollToBottom.tsx
2208
- import { useCallback as useCallback10 } from "react";
2332
+ import { useCallback as useCallback12 } from "react";
2209
2333
  var useThreadScrollToBottom = () => {
2210
2334
  const { useComposer, useViewport } = useThreadContext();
2211
2335
  const isAtBottom = useViewport((s) => s.isAtBottom);
2212
- const handleScrollToBottom = useCallback10(() => {
2336
+ const handleScrollToBottom = useCallback12(() => {
2213
2337
  useViewport.getState().scrollToBottom();
2214
2338
  useComposer.getState().focus();
2215
2339
  }, [useViewport, useComposer]);
@@ -2218,7 +2342,7 @@ var useThreadScrollToBottom = () => {
2218
2342
  };
2219
2343
 
2220
2344
  // src/primitive-hooks/thread/useThreadSuggestion.tsx
2221
- import { useCallback as useCallback11 } from "react";
2345
+ import { useCallback as useCallback13 } from "react";
2222
2346
  var useThreadSuggestion = ({
2223
2347
  prompt,
2224
2348
  autoSend
@@ -2226,7 +2350,7 @@ var useThreadSuggestion = ({
2226
2350
  const { useThread, useComposer } = useThreadContext();
2227
2351
  const append = useAppendMessage();
2228
2352
  const disabled = useThread((t) => t.isDisabled);
2229
- const callback = useCallback11(() => {
2353
+ const callback = useCallback13(() => {
2230
2354
  const thread = useThread.getState();
2231
2355
  const composer = useComposer.getState();
2232
2356
  if (autoSend && !thread.isRunning) {
@@ -2246,7 +2370,9 @@ __export(actionBar_exports, {
2246
2370
  Copy: () => ActionBarPrimitiveCopy,
2247
2371
  Edit: () => ActionBarPrimitiveEdit,
2248
2372
  Reload: () => ActionBarPrimitiveReload,
2249
- Root: () => ActionBarPrimitiveRoot
2373
+ Root: () => ActionBarPrimitiveRoot,
2374
+ Speak: () => ActionBarPrimitiveSpeak,
2375
+ StopSpeaking: () => ActionBarPrimitiveStopSpeaking
2250
2376
  });
2251
2377
 
2252
2378
  // src/primitives/actionBar/ActionBarRoot.tsx
@@ -2348,6 +2474,40 @@ var ActionBarPrimitiveEdit = createActionButton(
2348
2474
  useActionBarEdit
2349
2475
  );
2350
2476
 
2477
+ // src/primitives/actionBar/ActionBarSpeak.tsx
2478
+ var ActionBarPrimitiveSpeak = createActionButton(
2479
+ "ActionBarPrimitive.Speak",
2480
+ useActionBarSpeak
2481
+ );
2482
+
2483
+ // src/primitives/actionBar/ActionBarStopSpeaking.tsx
2484
+ import { forwardRef as forwardRef7 } from "react";
2485
+ import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
2486
+ import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
2487
+ import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
2488
+ import { jsx as jsx11 } from "react/jsx-runtime";
2489
+ var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
2490
+ const callback = useActionBarStopSpeaking();
2491
+ useEscapeKeydown((e) => {
2492
+ if (callback) {
2493
+ e.preventDefault();
2494
+ callback();
2495
+ }
2496
+ });
2497
+ return /* @__PURE__ */ jsx11(
2498
+ Primitive4.button,
2499
+ {
2500
+ type: "button",
2501
+ disabled: !callback,
2502
+ ...props,
2503
+ ref,
2504
+ onClick: composeEventHandlers2(props.onClick, () => {
2505
+ callback?.();
2506
+ })
2507
+ }
2508
+ );
2509
+ });
2510
+
2351
2511
  // src/primitives/assistantModal/index.ts
2352
2512
  var assistantModal_exports = {};
2353
2513
  __export(assistantModal_exports, {
@@ -2360,7 +2520,7 @@ __export(assistantModal_exports, {
2360
2520
  // src/primitives/assistantModal/AssistantModalRoot.tsx
2361
2521
  import { useState as useState9 } from "react";
2362
2522
  import * as PopoverPrimitive2 from "@radix-ui/react-popover";
2363
- import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
2523
+ import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
2364
2524
 
2365
2525
  // src/utils/hooks/useOnComposerFocus.tsx
2366
2526
  import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-ref";
@@ -2380,7 +2540,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
2380
2540
  var usePopoverScope = PopoverPrimitive.createPopoverScope();
2381
2541
 
2382
2542
  // src/primitives/assistantModal/AssistantModalRoot.tsx
2383
- import { jsx as jsx11 } from "react/jsx-runtime";
2543
+ import { jsx as jsx12 } from "react/jsx-runtime";
2384
2544
  var useAssistantModalOpenState = (defaultOpen = false) => {
2385
2545
  const state = useState9(defaultOpen);
2386
2546
  const [, setOpen] = state;
@@ -2398,12 +2558,12 @@ var AssistantModalPrimitiveRoot = ({
2398
2558
  }) => {
2399
2559
  const scope = usePopoverScope(__scopeAssistantModal);
2400
2560
  const [modalOpen, setOpen] = useAssistantModalOpenState(defaultOpen);
2401
- return /* @__PURE__ */ jsx11(
2561
+ return /* @__PURE__ */ jsx12(
2402
2562
  PopoverPrimitive2.Root,
2403
2563
  {
2404
2564
  ...scope,
2405
2565
  open: open === void 0 ? modalOpen : open,
2406
- onOpenChange: composeEventHandlers2(onOpenChange, setOpen),
2566
+ onOpenChange: composeEventHandlers3(onOpenChange, setOpen),
2407
2567
  ...rest
2408
2568
  }
2409
2569
  );
@@ -2411,26 +2571,26 @@ var AssistantModalPrimitiveRoot = ({
2411
2571
  AssistantModalPrimitiveRoot.displayName = "AssistantModalPrimitive.Root";
2412
2572
 
2413
2573
  // src/primitives/assistantModal/AssistantModalTrigger.tsx
2414
- import { forwardRef as forwardRef7 } from "react";
2574
+ import { forwardRef as forwardRef8 } from "react";
2415
2575
  import * as PopoverPrimitive3 from "@radix-ui/react-popover";
2416
- import { jsx as jsx12 } from "react/jsx-runtime";
2417
- var AssistantModalPrimitiveTrigger = forwardRef7(
2576
+ import { jsx as jsx13 } from "react/jsx-runtime";
2577
+ var AssistantModalPrimitiveTrigger = forwardRef8(
2418
2578
  ({
2419
2579
  __scopeAssistantModal,
2420
2580
  ...rest
2421
2581
  }, ref) => {
2422
2582
  const scope = usePopoverScope(__scopeAssistantModal);
2423
- return /* @__PURE__ */ jsx12(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
2583
+ return /* @__PURE__ */ jsx13(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
2424
2584
  }
2425
2585
  );
2426
2586
  AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
2427
2587
 
2428
2588
  // src/primitives/assistantModal/AssistantModalContent.tsx
2429
- import { forwardRef as forwardRef8 } from "react";
2589
+ import { forwardRef as forwardRef9 } from "react";
2430
2590
  import * as PopoverPrimitive4 from "@radix-ui/react-popover";
2431
- import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
2432
- import { jsx as jsx13 } from "react/jsx-runtime";
2433
- var AssistantModalPrimitiveContent = forwardRef8(
2591
+ import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
2592
+ import { jsx as jsx14 } from "react/jsx-runtime";
2593
+ var AssistantModalPrimitiveContent = forwardRef9(
2434
2594
  ({
2435
2595
  __scopeAssistantModal,
2436
2596
  side,
@@ -2440,7 +2600,7 @@ var AssistantModalPrimitiveContent = forwardRef8(
2440
2600
  ...props
2441
2601
  }, forwardedRef) => {
2442
2602
  const scope = usePopoverScope(__scopeAssistantModal);
2443
- return /* @__PURE__ */ jsx13(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx13(
2603
+ return /* @__PURE__ */ jsx14(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx14(
2444
2604
  PopoverPrimitive4.Content,
2445
2605
  {
2446
2606
  ...scope,
@@ -2448,7 +2608,7 @@ var AssistantModalPrimitiveContent = forwardRef8(
2448
2608
  ref: forwardedRef,
2449
2609
  side: side ?? "top",
2450
2610
  align: align ?? "end",
2451
- onInteractOutside: composeEventHandlers3(
2611
+ onInteractOutside: composeEventHandlers4(
2452
2612
  onInteractOutside,
2453
2613
  dissmissOnInteractOutside ? void 0 : (e) => e.preventDefault()
2454
2614
  )
@@ -2459,16 +2619,16 @@ var AssistantModalPrimitiveContent = forwardRef8(
2459
2619
  AssistantModalPrimitiveContent.displayName = "AssistantModalPrimitive.Content";
2460
2620
 
2461
2621
  // src/primitives/assistantModal/AssistantModalAnchor.tsx
2462
- import { forwardRef as forwardRef9 } from "react";
2622
+ import { forwardRef as forwardRef10 } from "react";
2463
2623
  import * as PopoverPrimitive5 from "@radix-ui/react-popover";
2464
- import { jsx as jsx14 } from "react/jsx-runtime";
2465
- var AssistantModalPrimitiveAnchor = forwardRef9(
2624
+ import { jsx as jsx15 } from "react/jsx-runtime";
2625
+ var AssistantModalPrimitiveAnchor = forwardRef10(
2466
2626
  ({
2467
2627
  __scopeAssistantModal,
2468
2628
  ...rest
2469
2629
  }, ref) => {
2470
2630
  const scope = usePopoverScope(__scopeAssistantModal);
2471
- return /* @__PURE__ */ jsx14(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
2631
+ return /* @__PURE__ */ jsx15(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
2472
2632
  }
2473
2633
  );
2474
2634
  AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
@@ -2496,24 +2656,24 @@ var BranchPickerPrevious = createActionButton(
2496
2656
  );
2497
2657
 
2498
2658
  // src/primitives/branchPicker/BranchPickerCount.tsx
2499
- import { Fragment, jsx as jsx15 } from "react/jsx-runtime";
2659
+ import { Fragment, jsx as jsx16 } from "react/jsx-runtime";
2500
2660
  var BranchPickerPrimitiveCount = () => {
2501
2661
  const branchCount = useBranchPickerCount();
2502
- return /* @__PURE__ */ jsx15(Fragment, { children: branchCount });
2662
+ return /* @__PURE__ */ jsx16(Fragment, { children: branchCount });
2503
2663
  };
2504
2664
  BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
2505
2665
 
2506
2666
  // src/primitives/branchPicker/BranchPickerNumber.tsx
2507
- import { Fragment as Fragment2, jsx as jsx16 } from "react/jsx-runtime";
2667
+ import { Fragment as Fragment2, jsx as jsx17 } from "react/jsx-runtime";
2508
2668
  var BranchPickerPrimitiveNumber = () => {
2509
2669
  const branchNumber = useBranchPickerNumber();
2510
- return /* @__PURE__ */ jsx16(Fragment2, { children: branchNumber });
2670
+ return /* @__PURE__ */ jsx17(Fragment2, { children: branchNumber });
2511
2671
  };
2512
2672
  BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
2513
2673
 
2514
2674
  // src/primitives/branchPicker/BranchPickerRoot.tsx
2515
- import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
2516
- import { forwardRef as forwardRef13 } from "react";
2675
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
2676
+ import { forwardRef as forwardRef14 } from "react";
2517
2677
 
2518
2678
  // src/primitives/message/index.ts
2519
2679
  var message_exports = {};
@@ -2525,17 +2685,17 @@ __export(message_exports, {
2525
2685
  });
2526
2686
 
2527
2687
  // src/primitives/message/MessageRoot.tsx
2528
- import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
2688
+ import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
2529
2689
  import {
2530
- forwardRef as forwardRef10,
2531
- useCallback as useCallback13
2690
+ forwardRef as forwardRef11,
2691
+ useCallback as useCallback15
2532
2692
  } from "react";
2533
2693
 
2534
2694
  // src/utils/hooks/useManagedRef.ts
2535
- import { useCallback as useCallback12, useRef as useRef3 } from "react";
2695
+ import { useCallback as useCallback14, useRef as useRef3 } from "react";
2536
2696
  var useManagedRef = (callback) => {
2537
2697
  const cleanupRef = useRef3();
2538
- const ref = useCallback12(
2698
+ const ref = useCallback14(
2539
2699
  (el) => {
2540
2700
  if (cleanupRef.current) {
2541
2701
  cleanupRef.current();
@@ -2551,10 +2711,10 @@ var useManagedRef = (callback) => {
2551
2711
 
2552
2712
  // src/primitives/message/MessageRoot.tsx
2553
2713
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
2554
- import { jsx as jsx17 } from "react/jsx-runtime";
2714
+ import { jsx as jsx18 } from "react/jsx-runtime";
2555
2715
  var useIsHoveringRef = () => {
2556
2716
  const { useMessageUtils } = useMessageContext();
2557
- const callbackRef = useCallback13(
2717
+ const callbackRef = useCallback15(
2558
2718
  (el) => {
2559
2719
  const setIsHovering = useMessageUtils.getState().setIsHovering;
2560
2720
  const handleMouseEnter = () => {
@@ -2575,10 +2735,10 @@ var useIsHoveringRef = () => {
2575
2735
  );
2576
2736
  return useManagedRef(callbackRef);
2577
2737
  };
2578
- var MessagePrimitiveRoot = forwardRef10(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef29) => {
2738
+ var MessagePrimitiveRoot = forwardRef11(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef30) => {
2579
2739
  const isHoveringRef = useIsHoveringRef();
2580
- const ref = useComposedRefs(forwardRef29, isHoveringRef);
2581
- return /* @__PURE__ */ jsx17(Primitive4.div, { ...rest, ref });
2740
+ const ref = useComposedRefs(forwardRef30, isHoveringRef);
2741
+ return /* @__PURE__ */ jsx18(Primitive5.div, { ...rest, ref });
2582
2742
  });
2583
2743
  MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
2584
2744
 
@@ -2598,7 +2758,7 @@ import { memo as memo2 } from "react";
2598
2758
  // src/context/providers/ContentPartProvider.tsx
2599
2759
  import { useEffect as useEffect9, useState as useState10 } from "react";
2600
2760
  import { create as create12 } from "zustand";
2601
- import { jsx as jsx18 } from "react/jsx-runtime";
2761
+ import { jsx as jsx19 } from "react/jsx-runtime";
2602
2762
  var COMPLETE_STATUS = {
2603
2763
  type: "complete"
2604
2764
  };
@@ -2661,32 +2821,32 @@ var ContentPartProvider = ({
2661
2821
  children
2662
2822
  }) => {
2663
2823
  const context = useContentPartContext2(partIndex);
2664
- return /* @__PURE__ */ jsx18(ContentPartContext.Provider, { value: context, children });
2824
+ return /* @__PURE__ */ jsx19(ContentPartContext.Provider, { value: context, children });
2665
2825
  };
2666
2826
 
2667
2827
  // src/primitives/contentPart/ContentPartText.tsx
2668
2828
  import {
2669
- forwardRef as forwardRef11
2829
+ forwardRef as forwardRef12
2670
2830
  } from "react";
2671
- import { jsx as jsx19 } from "react/jsx-runtime";
2672
- var ContentPartPrimitiveText = forwardRef11(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
2831
+ import { jsx as jsx20 } from "react/jsx-runtime";
2832
+ var ContentPartPrimitiveText = forwardRef12(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
2673
2833
  const {
2674
2834
  part: { text },
2675
2835
  status
2676
2836
  } = useSmooth(useContentPartText(), smooth);
2677
- return /* @__PURE__ */ jsx19(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
2837
+ return /* @__PURE__ */ jsx20(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
2678
2838
  });
2679
2839
  ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
2680
2840
 
2681
2841
  // src/primitives/contentPart/ContentPartImage.tsx
2682
- import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
2683
- import { forwardRef as forwardRef12 } from "react";
2684
- import { jsx as jsx20 } from "react/jsx-runtime";
2685
- var ContentPartPrimitiveImage = forwardRef12((props, forwardedRef) => {
2842
+ import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
2843
+ import { forwardRef as forwardRef13 } from "react";
2844
+ import { jsx as jsx21 } from "react/jsx-runtime";
2845
+ var ContentPartPrimitiveImage = forwardRef13((props, forwardedRef) => {
2686
2846
  const {
2687
2847
  part: { image }
2688
2848
  } = useContentPartImage();
2689
- return /* @__PURE__ */ jsx20(Primitive5.img, { src: image, ...props, ref: forwardedRef });
2849
+ return /* @__PURE__ */ jsx21(Primitive6.img, { src: image, ...props, ref: forwardedRef });
2690
2850
  });
2691
2851
  ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
2692
2852
 
@@ -2708,20 +2868,20 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
2708
2868
  ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
2709
2869
 
2710
2870
  // src/primitives/message/MessageContent.tsx
2711
- import { jsx as jsx21, jsxs as jsxs3 } from "react/jsx-runtime";
2871
+ import { jsx as jsx22, jsxs as jsxs3 } from "react/jsx-runtime";
2712
2872
  var defaultComponents = {
2713
2873
  Text: () => /* @__PURE__ */ jsxs3("p", { style: { whiteSpace: "pre-line" }, children: [
2714
- /* @__PURE__ */ jsx21(ContentPartPrimitiveText, {}),
2715
- /* @__PURE__ */ jsx21(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx21("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
2874
+ /* @__PURE__ */ jsx22(ContentPartPrimitiveText, {}),
2875
+ /* @__PURE__ */ jsx22(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx22("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
2716
2876
  ] }),
2717
- Image: () => /* @__PURE__ */ jsx21(ContentPartPrimitiveImage, {}),
2718
- UI: () => /* @__PURE__ */ jsx21(ContentPartPrimitiveDisplay, {}),
2877
+ Image: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveImage, {}),
2878
+ UI: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveDisplay, {}),
2719
2879
  tools: {
2720
2880
  Fallback: (props) => {
2721
2881
  const { useToolUIs } = useAssistantContext();
2722
2882
  const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
2723
2883
  if (!Render) return null;
2724
- return /* @__PURE__ */ jsx21(Render, { ...props });
2884
+ return /* @__PURE__ */ jsx22(Render, { ...props });
2725
2885
  }
2726
2886
  }
2727
2887
  };
@@ -2744,16 +2904,16 @@ var MessageContentPartComponent = ({
2744
2904
  case "text":
2745
2905
  if (status.type === "requires-action")
2746
2906
  throw new Error("Encountered unexpected requires-action status");
2747
- if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx21(Empty, { part, status });
2748
- return /* @__PURE__ */ jsx21(Text2, { part, status });
2907
+ if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx22(Empty, { part, status });
2908
+ return /* @__PURE__ */ jsx22(Text2, { part, status });
2749
2909
  case "image":
2750
2910
  if (status.type === "requires-action")
2751
2911
  throw new Error("Encountered unexpected requires-action status");
2752
- return /* @__PURE__ */ jsx21(Image2, { part, status });
2912
+ return /* @__PURE__ */ jsx22(Image2, { part, status });
2753
2913
  case "ui":
2754
2914
  if (status.type === "requires-action")
2755
2915
  throw new Error("Encountered unexpected requires-action status");
2756
- return /* @__PURE__ */ jsx21(UI, { part, status });
2916
+ return /* @__PURE__ */ jsx22(UI, { part, status });
2757
2917
  case "tool-call": {
2758
2918
  const Tool = by_name[part.toolName] || Fallback2;
2759
2919
  const addResult = (result) => addToolResult({
@@ -2761,7 +2921,7 @@ var MessageContentPartComponent = ({
2761
2921
  toolCallId: part.toolCallId,
2762
2922
  result
2763
2923
  });
2764
- return /* @__PURE__ */ jsx21(Tool, { part, status, addResult });
2924
+ return /* @__PURE__ */ jsx22(Tool, { part, status, addResult });
2765
2925
  }
2766
2926
  default:
2767
2927
  const unhandledType = type;
@@ -2772,7 +2932,7 @@ var MessageContentPartImpl = ({
2772
2932
  partIndex,
2773
2933
  components
2774
2934
  }) => {
2775
- return /* @__PURE__ */ jsx21(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx21(MessageContentPartComponent, { components }) });
2935
+ return /* @__PURE__ */ jsx22(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx22(MessageContentPartComponent, { components }) });
2776
2936
  };
2777
2937
  var MessageContentPart = memo2(
2778
2938
  MessageContentPartImpl,
@@ -2785,7 +2945,7 @@ var MessagePrimitiveContent = ({
2785
2945
  const contentLength = useMessage((s) => s.message.content.length) || 1;
2786
2946
  return new Array(contentLength).fill(null).map((_, idx) => {
2787
2947
  const partIndex = idx;
2788
- return /* @__PURE__ */ jsx21(
2948
+ return /* @__PURE__ */ jsx22(
2789
2949
  MessageContentPart,
2790
2950
  {
2791
2951
  partIndex,
@@ -2804,9 +2964,9 @@ var MessagePrimitiveInProgress = () => {
2804
2964
  MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
2805
2965
 
2806
2966
  // src/primitives/branchPicker/BranchPickerRoot.tsx
2807
- import { jsx as jsx22 } from "react/jsx-runtime";
2808
- var BranchPickerPrimitiveRoot = forwardRef13(({ hideWhenSingleBranch, ...rest }, ref) => {
2809
- return /* @__PURE__ */ jsx22(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx22(Primitive6.div, { ...rest, ref }) });
2967
+ import { jsx as jsx23 } from "react/jsx-runtime";
2968
+ var BranchPickerPrimitiveRoot = forwardRef14(({ hideWhenSingleBranch, ...rest }, ref) => {
2969
+ return /* @__PURE__ */ jsx23(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx23(Primitive7.div, { ...rest, ref }) });
2810
2970
  });
2811
2971
  BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
2812
2972
 
@@ -2821,44 +2981,44 @@ __export(composer_exports, {
2821
2981
  });
2822
2982
 
2823
2983
  // src/primitives/composer/ComposerRoot.tsx
2824
- import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
2825
- import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
2984
+ import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
2985
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
2826
2986
  import {
2827
- forwardRef as forwardRef14
2987
+ forwardRef as forwardRef15
2828
2988
  } from "react";
2829
- import { jsx as jsx23 } from "react/jsx-runtime";
2830
- var ComposerPrimitiveRoot = forwardRef14(({ onSubmit, ...rest }, forwardedRef) => {
2989
+ import { jsx as jsx24 } from "react/jsx-runtime";
2990
+ var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) => {
2831
2991
  const send = useComposerSend();
2832
2992
  const handleSubmit = (e) => {
2833
2993
  e.preventDefault();
2834
2994
  if (!send) return;
2835
2995
  send();
2836
2996
  };
2837
- return /* @__PURE__ */ jsx23(
2838
- Primitive7.form,
2997
+ return /* @__PURE__ */ jsx24(
2998
+ Primitive8.form,
2839
2999
  {
2840
3000
  ...rest,
2841
3001
  ref: forwardedRef,
2842
- onSubmit: composeEventHandlers4(onSubmit, handleSubmit)
3002
+ onSubmit: composeEventHandlers5(onSubmit, handleSubmit)
2843
3003
  }
2844
3004
  );
2845
3005
  });
2846
3006
  ComposerPrimitiveRoot.displayName = "ComposerPrimitive.Root";
2847
3007
 
2848
3008
  // src/primitives/composer/ComposerInput.tsx
2849
- import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
3009
+ import { composeEventHandlers as composeEventHandlers6 } from "@radix-ui/primitive";
2850
3010
  import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
2851
3011
  import { Slot } from "@radix-ui/react-slot";
2852
3012
  import {
2853
- forwardRef as forwardRef15,
2854
- useCallback as useCallback14,
3013
+ forwardRef as forwardRef16,
3014
+ useCallback as useCallback16,
2855
3015
  useEffect as useEffect10,
2856
3016
  useRef as useRef4
2857
3017
  } from "react";
2858
3018
  import TextareaAutosize from "react-textarea-autosize";
2859
- import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
2860
- import { jsx as jsx24 } from "react/jsx-runtime";
2861
- var ComposerPrimitiveInput = forwardRef15(
3019
+ import { useEscapeKeydown as useEscapeKeydown2 } from "@radix-ui/react-use-escape-keydown";
3020
+ import { jsx as jsx25 } from "react/jsx-runtime";
3021
+ var ComposerPrimitiveInput = forwardRef16(
2862
3022
  ({
2863
3023
  autoFocus = false,
2864
3024
  asChild,
@@ -2877,7 +3037,7 @@ var ComposerPrimitiveInput = forwardRef15(
2877
3037
  const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;
2878
3038
  const textareaRef = useRef4(null);
2879
3039
  const ref = useComposedRefs2(forwardedRef, textareaRef);
2880
- useEscapeKeydown((e) => {
3040
+ useEscapeKeydown2((e) => {
2881
3041
  const composer = useComposer.getState();
2882
3042
  if (composer.canCancel) {
2883
3043
  composer.cancel();
@@ -2896,7 +3056,7 @@ var ComposerPrimitiveInput = forwardRef15(
2896
3056
  }
2897
3057
  };
2898
3058
  const autoFocusEnabled = autoFocus && !isDisabled;
2899
- const focus = useCallback14(() => {
3059
+ const focus = useCallback16(() => {
2900
3060
  const textarea = textareaRef.current;
2901
3061
  if (!textarea || !autoFocusEnabled) return;
2902
3062
  textarea.focus({ preventScroll: true });
@@ -2911,7 +3071,7 @@ var ComposerPrimitiveInput = forwardRef15(
2911
3071
  focus();
2912
3072
  }
2913
3073
  });
2914
- return /* @__PURE__ */ jsx24(
3074
+ return /* @__PURE__ */ jsx25(
2915
3075
  Component,
2916
3076
  {
2917
3077
  name: "input",
@@ -2919,12 +3079,12 @@ var ComposerPrimitiveInput = forwardRef15(
2919
3079
  ...rest,
2920
3080
  ref,
2921
3081
  disabled: isDisabled,
2922
- onChange: composeEventHandlers5(onChange, (e) => {
3082
+ onChange: composeEventHandlers6(onChange, (e) => {
2923
3083
  const composerState = useComposer.getState();
2924
3084
  if (!composerState.isEditing) return;
2925
3085
  return composerState.setText(e.target.value);
2926
3086
  }),
2927
- onKeyDown: composeEventHandlers5(onKeyDown, handleKeyPress)
3087
+ onKeyDown: composeEventHandlers6(onKeyDown, handleKeyPress)
2928
3088
  }
2929
3089
  );
2930
3090
  }
@@ -2932,14 +3092,14 @@ var ComposerPrimitiveInput = forwardRef15(
2932
3092
  ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
2933
3093
 
2934
3094
  // src/primitives/composer/ComposerSend.tsx
2935
- import { forwardRef as forwardRef16 } from "react";
2936
- import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
2937
- import { jsx as jsx25 } from "react/jsx-runtime";
2938
- var ComposerPrimitiveSend = forwardRef16(({ disabled, ...rest }, ref) => {
3095
+ import { forwardRef as forwardRef17 } from "react";
3096
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
3097
+ import { jsx as jsx26 } from "react/jsx-runtime";
3098
+ var ComposerPrimitiveSend = forwardRef17(({ disabled, ...rest }, ref) => {
2939
3099
  const { useComposer } = useComposerContext();
2940
3100
  const hasValue = useComposer((c) => c.isEditing && c.text.length > 0);
2941
- return /* @__PURE__ */ jsx25(
2942
- Primitive8.button,
3101
+ return /* @__PURE__ */ jsx26(
3102
+ Primitive9.button,
2943
3103
  {
2944
3104
  type: "submit",
2945
3105
  ...rest,
@@ -2988,11 +3148,11 @@ __export(thread_exports, {
2988
3148
  });
2989
3149
 
2990
3150
  // src/primitives/thread/ThreadRoot.tsx
2991
- import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
2992
- import { forwardRef as forwardRef17 } from "react";
2993
- import { jsx as jsx26 } from "react/jsx-runtime";
2994
- var ThreadPrimitiveRoot = forwardRef17((props, ref) => {
2995
- return /* @__PURE__ */ jsx26(Primitive9.div, { ...props, ref });
3151
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
3152
+ import { forwardRef as forwardRef18 } from "react";
3153
+ import { jsx as jsx27 } from "react/jsx-runtime";
3154
+ var ThreadPrimitiveRoot = forwardRef18((props, ref) => {
3155
+ return /* @__PURE__ */ jsx27(Primitive10.div, { ...props, ref });
2996
3156
  });
2997
3157
  ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
2998
3158
 
@@ -3017,8 +3177,8 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
3017
3177
 
3018
3178
  // src/primitives/thread/ThreadViewport.tsx
3019
3179
  import { useComposedRefs as useComposedRefs4 } from "@radix-ui/react-compose-refs";
3020
- import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
3021
- import { forwardRef as forwardRef18 } from "react";
3180
+ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
3181
+ import { forwardRef as forwardRef19 } from "react";
3022
3182
 
3023
3183
  // src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
3024
3184
  import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
@@ -3026,10 +3186,10 @@ import { useRef as useRef5 } from "react";
3026
3186
 
3027
3187
  // src/utils/hooks/useOnResizeContent.tsx
3028
3188
  import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
3029
- import { useCallback as useCallback15 } from "react";
3189
+ import { useCallback as useCallback17 } from "react";
3030
3190
  var useOnResizeContent = (callback) => {
3031
3191
  const callbackRef = useCallbackRef3(callback);
3032
- const refCallback = useCallback15(
3192
+ const refCallback = useCallback17(
3033
3193
  (el) => {
3034
3194
  const resizeObserver = new ResizeObserver(() => {
3035
3195
  callbackRef();
@@ -3129,13 +3289,13 @@ var useThreadViewportAutoScroll = ({
3129
3289
  };
3130
3290
 
3131
3291
  // src/primitives/thread/ThreadViewport.tsx
3132
- import { jsx as jsx27 } from "react/jsx-runtime";
3133
- var ThreadPrimitiveViewport = forwardRef18(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
3292
+ import { jsx as jsx28 } from "react/jsx-runtime";
3293
+ var ThreadPrimitiveViewport = forwardRef19(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
3134
3294
  const autoScrollRef = useThreadViewportAutoScroll({
3135
3295
  autoScroll
3136
3296
  });
3137
3297
  const ref = useComposedRefs4(forwardedRef, autoScrollRef);
3138
- return /* @__PURE__ */ jsx27(Primitive10.div, { ...rest, ref, children });
3298
+ return /* @__PURE__ */ jsx28(Primitive11.div, { ...rest, ref, children });
3139
3299
  });
3140
3300
  ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
3141
3301
 
@@ -3180,19 +3340,33 @@ var makeEditComposerStore = ({
3180
3340
 
3181
3341
  // src/context/stores/MessageUtils.ts
3182
3342
  import { create as create14 } from "zustand";
3183
- var makeMessageUtilsStore = () => create14((set) => ({
3184
- isCopied: false,
3185
- setIsCopied: (value) => {
3186
- set({ isCopied: value });
3187
- },
3188
- isHovering: false,
3189
- setIsHovering: (value) => {
3190
- set({ isHovering: value });
3191
- }
3192
- }));
3343
+ var makeMessageUtilsStore = () => create14((set) => {
3344
+ let utterance = null;
3345
+ return {
3346
+ isCopied: false,
3347
+ setIsCopied: (value) => {
3348
+ set({ isCopied: value });
3349
+ },
3350
+ isHovering: false,
3351
+ setIsHovering: (value) => {
3352
+ set({ isHovering: value });
3353
+ },
3354
+ isSpeaking: false,
3355
+ stopSpeaking: () => {
3356
+ utterance?.cancel();
3357
+ },
3358
+ addUtterance: (utt) => {
3359
+ utterance = utt;
3360
+ set({ isSpeaking: true });
3361
+ utt.onEnd(() => {
3362
+ set({ isSpeaking: false });
3363
+ });
3364
+ }
3365
+ };
3366
+ });
3193
3367
 
3194
3368
  // src/context/providers/MessageProvider.tsx
3195
- import { jsx as jsx28 } from "react/jsx-runtime";
3369
+ import { jsx as jsx29 } from "react/jsx-runtime";
3196
3370
  var getIsLast = (messages, message) => {
3197
3371
  return messages[messages.length - 1]?.id === message.id;
3198
3372
  };
@@ -3276,11 +3450,11 @@ var MessageProvider = ({
3276
3450
  children
3277
3451
  }) => {
3278
3452
  const context = useMessageContext2(messageIndex);
3279
- return /* @__PURE__ */ jsx28(MessageContext.Provider, { value: context, children });
3453
+ return /* @__PURE__ */ jsx29(MessageContext.Provider, { value: context, children });
3280
3454
  };
3281
3455
 
3282
3456
  // src/primitives/thread/ThreadMessages.tsx
3283
- import { jsx as jsx29, jsxs as jsxs4 } from "react/jsx-runtime";
3457
+ import { jsx as jsx30, jsxs as jsxs4 } from "react/jsx-runtime";
3284
3458
  var DEFAULT_SYSTEM_MESSAGE = () => null;
3285
3459
  var getComponents = (components) => {
3286
3460
  return {
@@ -3297,11 +3471,11 @@ var ThreadMessageImpl = ({
3297
3471
  const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
3298
3472
  return /* @__PURE__ */ jsxs4(MessageProvider, { messageIndex, children: [
3299
3473
  /* @__PURE__ */ jsxs4(MessagePrimitiveIf, { user: true, children: [
3300
- /* @__PURE__ */ jsx29(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx29(UserMessage2, {}) }),
3301
- /* @__PURE__ */ jsx29(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx29(EditComposer2, {}) })
3474
+ /* @__PURE__ */ jsx30(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx30(UserMessage2, {}) }),
3475
+ /* @__PURE__ */ jsx30(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx30(EditComposer2, {}) })
3302
3476
  ] }),
3303
- /* @__PURE__ */ jsx29(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx29(AssistantMessage2, {}) }),
3304
- /* @__PURE__ */ jsx29(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx29(SystemMessage2, {}) })
3477
+ /* @__PURE__ */ jsx30(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx30(AssistantMessage2, {}) }),
3478
+ /* @__PURE__ */ jsx30(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx30(SystemMessage2, {}) })
3305
3479
  ] });
3306
3480
  };
3307
3481
  var ThreadMessage = memo3(
@@ -3316,7 +3490,7 @@ var ThreadPrimitiveMessagesImpl = ({
3316
3490
  if (messagesLength === 0) return null;
3317
3491
  return new Array(messagesLength).fill(null).map((_, idx) => {
3318
3492
  const messageIndex = idx;
3319
- return /* @__PURE__ */ jsx29(
3493
+ return /* @__PURE__ */ jsx30(
3320
3494
  ThreadMessage,
3321
3495
  {
3322
3496
  messageIndex,
@@ -3350,7 +3524,7 @@ import {
3350
3524
  createContext as createContext6,
3351
3525
  useContext as useContext6
3352
3526
  } from "react";
3353
- import { Fragment as Fragment3, jsx as jsx30 } from "react/jsx-runtime";
3527
+ import { Fragment as Fragment3, jsx as jsx31 } from "react/jsx-runtime";
3354
3528
  var ThreadConfigContext = createContext6({});
3355
3529
  var useThreadConfig = () => {
3356
3530
  return useContext6(ThreadConfigContext);
@@ -3360,37 +3534,50 @@ var ThreadConfigProvider = ({
3360
3534
  config
3361
3535
  }) => {
3362
3536
  const assistant = useAssistantContext({ optional: true });
3363
- const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx30(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx30(Fragment3, { children });
3537
+ const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx31(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx31(Fragment3, { children });
3364
3538
  if (!config?.runtime) return configProvider;
3365
3539
  if (assistant) {
3366
3540
  throw new Error(
3367
3541
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
3368
3542
  );
3369
3543
  }
3370
- return /* @__PURE__ */ jsx30(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
3544
+ return /* @__PURE__ */ jsx31(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
3371
3545
  };
3372
3546
  ThreadConfigProvider.displayName = "ThreadConfigProvider";
3373
3547
 
3374
3548
  // src/ui/assistant-action-bar.tsx
3375
- import { forwardRef as forwardRef19 } from "react";
3376
- import { CheckIcon, CopyIcon, RefreshCwIcon } from "lucide-react";
3377
- import { Fragment as Fragment4, jsx as jsx31, jsxs as jsxs5 } from "react/jsx-runtime";
3378
- var useAllowCopy = () => {
3549
+ import { forwardRef as forwardRef20 } from "react";
3550
+ import {
3551
+ AudioLinesIcon,
3552
+ CheckIcon,
3553
+ CopyIcon,
3554
+ RefreshCwIcon,
3555
+ StopCircleIcon
3556
+ } from "lucide-react";
3557
+ import { Fragment as Fragment4, jsx as jsx32, jsxs as jsxs5 } from "react/jsx-runtime";
3558
+ var useAllowCopy = (ensureCapability = false) => {
3379
3559
  const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
3380
3560
  const { useThread } = useThreadContext();
3381
- const copySupported = useThread((t) => t.capabilities.copy);
3382
- return copySupported && allowCopy;
3561
+ const copySupported = useThread((t) => t.capabilities.unstable_copy);
3562
+ return allowCopy && (!ensureCapability || copySupported);
3563
+ };
3564
+ var useAllowSpeak = (ensureCapability = false) => {
3565
+ const { assistantMessage: { allowSpeak = true } = {} } = useThreadConfig();
3566
+ const { useThread } = useThreadContext();
3567
+ const speakSupported = useThread((t) => t.capabilities.speak);
3568
+ return allowSpeak && (!ensureCapability || speakSupported);
3383
3569
  };
3384
- var useAllowReload = () => {
3570
+ var useAllowReload = (ensureCapability = false) => {
3385
3571
  const { assistantMessage: { allowReload = true } = {} } = useThreadConfig();
3386
3572
  const { useThread } = useThreadContext();
3387
3573
  const reloadSupported = useThread((t) => t.capabilities.reload);
3388
- return reloadSupported && allowReload;
3574
+ return allowReload && (!ensureCapability || reloadSupported);
3389
3575
  };
3390
3576
  var AssistantActionBar = () => {
3391
- const allowCopy = useAllowCopy();
3392
- const allowReload = useAllowReload();
3393
- if (!allowCopy && !allowReload) return null;
3577
+ const allowCopy = useAllowCopy(true);
3578
+ const allowReload = useAllowReload(true);
3579
+ const allowSpeak = useAllowSpeak(true);
3580
+ if (!allowCopy && !allowReload && !allowSpeak) return null;
3394
3581
  return /* @__PURE__ */ jsxs5(
3395
3582
  AssistantActionBarRoot,
3396
3583
  {
@@ -3398,8 +3585,9 @@ var AssistantActionBar = () => {
3398
3585
  autohide: "not-last",
3399
3586
  autohideFloat: "single-branch",
3400
3587
  children: [
3401
- /* @__PURE__ */ jsx31(AssistantActionBarCopy, {}),
3402
- /* @__PURE__ */ jsx31(AssistantActionBarReload, {})
3588
+ allowSpeak && /* @__PURE__ */ jsx32(AssistantActionBarSpeechControl, {}),
3589
+ allowCopy && /* @__PURE__ */ jsx32(AssistantActionBarCopy, {}),
3590
+ allowReload && /* @__PURE__ */ jsx32(AssistantActionBarReload, {})
3403
3591
  ]
3404
3592
  }
3405
3593
  );
@@ -3409,21 +3597,49 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
3409
3597
  className: "aui-assistant-action-bar-root"
3410
3598
  });
3411
3599
  AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
3412
- var AssistantActionBarCopy = forwardRef19((props, ref) => {
3600
+ var AssistantActionBarCopy = forwardRef20((props, ref) => {
3413
3601
  const {
3414
3602
  strings: {
3415
- assistantMessage: { reload: { tooltip = "Copy" } = {} } = {}
3603
+ assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
3416
3604
  } = {}
3417
3605
  } = useThreadConfig();
3418
- const allowCopy = useAllowCopy();
3419
- if (!allowCopy) return null;
3420
- return /* @__PURE__ */ jsx31(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
3421
- /* @__PURE__ */ jsx31(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx31(CheckIcon, {}) }),
3422
- /* @__PURE__ */ jsx31(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx31(CopyIcon, {}) })
3606
+ return /* @__PURE__ */ jsx32(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
3607
+ /* @__PURE__ */ jsx32(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx32(CheckIcon, {}) }),
3608
+ /* @__PURE__ */ jsx32(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx32(CopyIcon, {}) })
3423
3609
  ] }) }) });
3424
3610
  });
3425
3611
  AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
3426
- var AssistantActionBarReload = forwardRef19((props, ref) => {
3612
+ var AssistantActionBarSpeechControl = () => {
3613
+ return /* @__PURE__ */ jsxs5(Fragment4, { children: [
3614
+ /* @__PURE__ */ jsx32(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx32(AssistantActionBarSpeak, {}) }),
3615
+ /* @__PURE__ */ jsx32(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx32(AssistantActionBarStopSpeaking, {}) })
3616
+ ] });
3617
+ };
3618
+ var AssistantActionBarSpeak = forwardRef20((props, ref) => {
3619
+ const {
3620
+ strings: {
3621
+ assistantMessage: { speak: { tooltip = "Read aloud" } = {} } = {}
3622
+ } = {}
3623
+ } = useThreadConfig();
3624
+ const allowSpeak = useAllowSpeak();
3625
+ if (!allowSpeak) return null;
3626
+ return /* @__PURE__ */ jsx32(actionBar_exports.Speak, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(AudioLinesIcon, {}) }) });
3627
+ });
3628
+ AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
3629
+ var AssistantActionBarStopSpeaking = forwardRef20((props, ref) => {
3630
+ const {
3631
+ strings: {
3632
+ assistantMessage: {
3633
+ speak: { stop: { tooltip: stopTooltip = "Stop" } = {} } = {}
3634
+ } = {}
3635
+ } = {}
3636
+ } = useThreadConfig();
3637
+ const allowSpeak = useAllowSpeak();
3638
+ if (!allowSpeak) return null;
3639
+ return /* @__PURE__ */ jsx32(actionBar_exports.StopSpeaking, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(StopCircleIcon, {}) }) });
3640
+ });
3641
+ AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
3642
+ var AssistantActionBarReload = forwardRef20((props, ref) => {
3427
3643
  const {
3428
3644
  strings: {
3429
3645
  assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
@@ -3431,13 +3647,16 @@ var AssistantActionBarReload = forwardRef19((props, ref) => {
3431
3647
  } = useThreadConfig();
3432
3648
  const allowReload = useAllowReload();
3433
3649
  if (!allowReload) return null;
3434
- return /* @__PURE__ */ jsx31(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx31(RefreshCwIcon, {}) }) });
3650
+ return /* @__PURE__ */ jsx32(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx32(RefreshCwIcon, {}) }) });
3435
3651
  });
3436
3652
  AssistantActionBarReload.displayName = "AssistantActionBarReload";
3437
3653
  var exports = {
3438
3654
  Root: AssistantActionBarRoot,
3439
3655
  Reload: AssistantActionBarReload,
3440
- Copy: AssistantActionBarCopy
3656
+ Copy: AssistantActionBarCopy,
3657
+ Speak: AssistantActionBarSpeak,
3658
+ StopSpeaking: AssistantActionBarStopSpeaking,
3659
+ SpeechControl: AssistantActionBarSpeechControl
3441
3660
  };
3442
3661
  var assistant_action_bar_default = Object.assign(
3443
3662
  AssistantActionBar,
@@ -3445,12 +3664,12 @@ var assistant_action_bar_default = Object.assign(
3445
3664
  );
3446
3665
 
3447
3666
  // src/ui/assistant-message.tsx
3448
- import { forwardRef as forwardRef21 } from "react";
3667
+ import { forwardRef as forwardRef22 } from "react";
3449
3668
 
3450
3669
  // src/ui/branch-picker.tsx
3451
- import { forwardRef as forwardRef20 } from "react";
3670
+ import { forwardRef as forwardRef21 } from "react";
3452
3671
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
3453
- import { jsx as jsx32, jsxs as jsxs6 } from "react/jsx-runtime";
3672
+ import { jsx as jsx33, jsxs as jsxs6 } from "react/jsx-runtime";
3454
3673
  var useAllowBranchPicker = () => {
3455
3674
  const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
3456
3675
  const { useThread } = useThreadContext();
@@ -3461,9 +3680,9 @@ var BranchPicker = () => {
3461
3680
  const allowBranchPicker = useAllowBranchPicker();
3462
3681
  if (!allowBranchPicker) return null;
3463
3682
  return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
3464
- /* @__PURE__ */ jsx32(BranchPickerPrevious2, {}),
3465
- /* @__PURE__ */ jsx32(BranchPickerState, {}),
3466
- /* @__PURE__ */ jsx32(BranchPickerNext, {})
3683
+ /* @__PURE__ */ jsx33(BranchPickerPrevious2, {}),
3684
+ /* @__PURE__ */ jsx33(BranchPickerState, {}),
3685
+ /* @__PURE__ */ jsx33(BranchPickerNext, {})
3467
3686
  ] });
3468
3687
  };
3469
3688
  BranchPicker.displayName = "BranchPicker";
@@ -3471,31 +3690,31 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
3471
3690
  className: "aui-branch-picker-root"
3472
3691
  });
3473
3692
  BranchPickerRoot.displayName = "BranchPickerRoot";
3474
- var BranchPickerPrevious2 = forwardRef20((props, ref) => {
3693
+ var BranchPickerPrevious2 = forwardRef21((props, ref) => {
3475
3694
  const {
3476
3695
  strings: {
3477
3696
  branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
3478
3697
  } = {}
3479
3698
  } = useThreadConfig();
3480
- return /* @__PURE__ */ jsx32(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronLeftIcon, {}) }) });
3699
+ return /* @__PURE__ */ jsx33(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ jsx33(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx33(ChevronLeftIcon, {}) }) });
3481
3700
  });
3482
3701
  BranchPickerPrevious2.displayName = "BranchPickerPrevious";
3483
3702
  var BranchPickerStateWrapper = withDefaults("span", {
3484
3703
  className: "aui-branch-picker-state"
3485
3704
  });
3486
- var BranchPickerState = forwardRef20((props, ref) => {
3705
+ var BranchPickerState = forwardRef21((props, ref) => {
3487
3706
  return /* @__PURE__ */ jsxs6(BranchPickerStateWrapper, { ...props, ref, children: [
3488
- /* @__PURE__ */ jsx32(branchPicker_exports.Number, {}),
3707
+ /* @__PURE__ */ jsx33(branchPicker_exports.Number, {}),
3489
3708
  " / ",
3490
- /* @__PURE__ */ jsx32(branchPicker_exports.Count, {})
3709
+ /* @__PURE__ */ jsx33(branchPicker_exports.Count, {})
3491
3710
  ] });
3492
3711
  });
3493
3712
  BranchPickerState.displayName = "BranchPickerState";
3494
- var BranchPickerNext = forwardRef20((props, ref) => {
3713
+ var BranchPickerNext = forwardRef21((props, ref) => {
3495
3714
  const {
3496
3715
  strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
3497
3716
  } = useThreadConfig();
3498
- return /* @__PURE__ */ jsx32(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronRightIcon, {}) }) });
3717
+ return /* @__PURE__ */ jsx33(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ jsx33(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx33(ChevronRightIcon, {}) }) });
3499
3718
  });
3500
3719
  BranchPickerNext.displayName = "BranchPickerNext";
3501
3720
  var exports2 = {
@@ -3507,12 +3726,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
3507
3726
 
3508
3727
  // src/ui/base/avatar.tsx
3509
3728
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
3510
- import { jsx as jsx33, jsxs as jsxs7 } from "react/jsx-runtime";
3729
+ import { jsx as jsx34, jsxs as jsxs7 } from "react/jsx-runtime";
3511
3730
  var Avatar = ({ src, alt, fallback }) => {
3512
3731
  if (src == null && fallback == null) return null;
3513
3732
  return /* @__PURE__ */ jsxs7(AvatarRoot, { children: [
3514
- src != null && /* @__PURE__ */ jsx33(AvatarImage, { src, alt }),
3515
- fallback != null && /* @__PURE__ */ jsx33(AvatarFallback, { children: fallback })
3733
+ src != null && /* @__PURE__ */ jsx34(AvatarImage, { src, alt }),
3734
+ fallback != null && /* @__PURE__ */ jsx34(AvatarFallback, { children: fallback })
3516
3735
  ] });
3517
3736
  };
3518
3737
  Avatar.displayName = "Avatar";
@@ -3531,10 +3750,10 @@ AvatarFallback.displayName = "AvatarFallback";
3531
3750
 
3532
3751
  // src/ui/content-part.tsx
3533
3752
  import classNames2 from "classnames";
3534
- import { jsx as jsx34 } from "react/jsx-runtime";
3753
+ import { jsx as jsx35 } from "react/jsx-runtime";
3535
3754
  var Text = () => {
3536
3755
  const status = useSmoothStatus();
3537
- return /* @__PURE__ */ jsx34(
3756
+ return /* @__PURE__ */ jsx35(
3538
3757
  contentPart_exports.Text,
3539
3758
  {
3540
3759
  className: classNames2(
@@ -3549,19 +3768,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) };
3549
3768
  var content_part_default = exports3;
3550
3769
 
3551
3770
  // src/ui/assistant-message.tsx
3552
- import { jsx as jsx35, jsxs as jsxs8 } from "react/jsx-runtime";
3771
+ import { jsx as jsx36, jsxs as jsxs8 } from "react/jsx-runtime";
3553
3772
  var AssistantMessage = () => {
3554
3773
  return /* @__PURE__ */ jsxs8(AssistantMessageRoot, { children: [
3555
- /* @__PURE__ */ jsx35(AssistantMessageAvatar, {}),
3556
- /* @__PURE__ */ jsx35(AssistantMessageContent, {}),
3557
- /* @__PURE__ */ jsx35(branch_picker_default, {}),
3558
- /* @__PURE__ */ jsx35(assistant_action_bar_default, {})
3774
+ /* @__PURE__ */ jsx36(AssistantMessageAvatar, {}),
3775
+ /* @__PURE__ */ jsx36(AssistantMessageContent, {}),
3776
+ /* @__PURE__ */ jsx36(branch_picker_default, {}),
3777
+ /* @__PURE__ */ jsx36(assistant_action_bar_default, {})
3559
3778
  ] });
3560
3779
  };
3561
3780
  AssistantMessage.displayName = "AssistantMessage";
3562
3781
  var AssistantMessageAvatar = () => {
3563
3782
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
3564
- return /* @__PURE__ */ jsx35(Avatar, { ...avatar });
3783
+ return /* @__PURE__ */ jsx36(Avatar, { ...avatar });
3565
3784
  };
3566
3785
  var AssistantMessageRoot = withDefaults(message_exports.Root, {
3567
3786
  className: "aui-assistant-message-root"
@@ -3570,9 +3789,9 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
3570
3789
  var AssistantMessageContentWrapper = withDefaults("div", {
3571
3790
  className: "aui-assistant-message-content"
3572
3791
  });
3573
- var AssistantMessageContent = forwardRef21(({ components: componentsProp, ...rest }, ref) => {
3792
+ var AssistantMessageContent = forwardRef22(({ components: componentsProp, ...rest }, ref) => {
3574
3793
  const { assistantMessage: { components = {} } = {} } = useThreadConfig();
3575
- return /* @__PURE__ */ jsx35(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx35(
3794
+ return /* @__PURE__ */ jsx36(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx36(
3576
3795
  message_exports.Content,
3577
3796
  {
3578
3797
  components: {
@@ -3594,21 +3813,21 @@ var assistant_message_default = Object.assign(
3594
3813
  );
3595
3814
 
3596
3815
  // src/ui/assistant-modal.tsx
3597
- import { forwardRef as forwardRef28 } from "react";
3816
+ import { forwardRef as forwardRef29 } from "react";
3598
3817
  import { BotIcon, ChevronDownIcon } from "lucide-react";
3599
3818
 
3600
3819
  // src/ui/thread.tsx
3601
- import { forwardRef as forwardRef27 } from "react";
3820
+ import { forwardRef as forwardRef28 } from "react";
3602
3821
  import { ArrowDownIcon } from "lucide-react";
3603
3822
 
3604
3823
  // src/ui/composer.tsx
3605
- import { forwardRef as forwardRef22 } from "react";
3824
+ import { forwardRef as forwardRef23 } from "react";
3606
3825
  import { SendHorizontalIcon } from "lucide-react";
3607
3826
 
3608
3827
  // src/ui/base/CircleStopIcon.tsx
3609
- import { jsx as jsx36 } from "react/jsx-runtime";
3828
+ import { jsx as jsx37 } from "react/jsx-runtime";
3610
3829
  var CircleStopIcon = () => {
3611
- return /* @__PURE__ */ jsx36(
3830
+ return /* @__PURE__ */ jsx37(
3612
3831
  "svg",
3613
3832
  {
3614
3833
  xmlns: "http://www.w3.org/2000/svg",
@@ -3616,18 +3835,18 @@ var CircleStopIcon = () => {
3616
3835
  fill: "currentColor",
3617
3836
  width: "16",
3618
3837
  height: "16",
3619
- children: /* @__PURE__ */ jsx36("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
3838
+ children: /* @__PURE__ */ jsx37("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
3620
3839
  }
3621
3840
  );
3622
3841
  };
3623
3842
  CircleStopIcon.displayName = "CircleStopIcon";
3624
3843
 
3625
3844
  // src/ui/composer.tsx
3626
- import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs9 } from "react/jsx-runtime";
3845
+ import { Fragment as Fragment5, jsx as jsx38, jsxs as jsxs9 } from "react/jsx-runtime";
3627
3846
  var Composer = () => {
3628
3847
  return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
3629
- /* @__PURE__ */ jsx37(ComposerInput, { autoFocus: true }),
3630
- /* @__PURE__ */ jsx37(ComposerAction, {})
3848
+ /* @__PURE__ */ jsx38(ComposerInput, { autoFocus: true }),
3849
+ /* @__PURE__ */ jsx38(ComposerAction, {})
3631
3850
  ] });
3632
3851
  };
3633
3852
  Composer.displayName = "Composer";
@@ -3640,14 +3859,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
3640
3859
  autoFocus: true,
3641
3860
  className: "aui-composer-input"
3642
3861
  });
3643
- var ComposerInput = forwardRef22(
3862
+ var ComposerInput = forwardRef23(
3644
3863
  (props, ref) => {
3645
3864
  const {
3646
3865
  strings: {
3647
3866
  composer: { input: { placeholder = "Write a message..." } = {} } = {}
3648
3867
  } = {}
3649
3868
  } = useThreadConfig();
3650
- return /* @__PURE__ */ jsx37(ComposerInputStyled, { placeholder, ...props, ref });
3869
+ return /* @__PURE__ */ jsx38(ComposerInputStyled, { placeholder, ...props, ref });
3651
3870
  }
3652
3871
  );
3653
3872
  ComposerInput.displayName = "ComposerInput";
@@ -3658,10 +3877,10 @@ var useAllowCancel = () => {
3658
3877
  };
3659
3878
  var ComposerAction = () => {
3660
3879
  const allowCancel = useAllowCancel();
3661
- if (!allowCancel) return /* @__PURE__ */ jsx37(ComposerSend, {});
3880
+ if (!allowCancel) return /* @__PURE__ */ jsx38(ComposerSend, {});
3662
3881
  return /* @__PURE__ */ jsxs9(Fragment5, { children: [
3663
- /* @__PURE__ */ jsx37(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx37(ComposerSend, {}) }),
3664
- /* @__PURE__ */ jsx37(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx37(ComposerCancel, {}) })
3882
+ /* @__PURE__ */ jsx38(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx38(ComposerSend, {}) }),
3883
+ /* @__PURE__ */ jsx38(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx38(ComposerCancel, {}) })
3665
3884
  ] });
3666
3885
  };
3667
3886
  ComposerAction.displayName = "ComposerAction";
@@ -3669,22 +3888,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
3669
3888
  variant: "default",
3670
3889
  className: "aui-composer-send"
3671
3890
  });
3672
- var ComposerSend = forwardRef22((props, ref) => {
3891
+ var ComposerSend = forwardRef23((props, ref) => {
3673
3892
  const {
3674
3893
  strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
3675
3894
  } = useThreadConfig();
3676
- return /* @__PURE__ */ jsx37(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(SendHorizontalIcon, {}) }) });
3895
+ return /* @__PURE__ */ jsx38(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx38(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx38(SendHorizontalIcon, {}) }) });
3677
3896
  });
3678
3897
  ComposerSend.displayName = "ComposerSend";
3679
3898
  var ComposerCancelButton = withDefaults(TooltipIconButton, {
3680
3899
  variant: "default",
3681
3900
  className: "aui-composer-cancel"
3682
3901
  });
3683
- var ComposerCancel = forwardRef22((props, ref) => {
3902
+ var ComposerCancel = forwardRef23((props, ref) => {
3684
3903
  const {
3685
3904
  strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
3686
3905
  } = useThreadConfig();
3687
- return /* @__PURE__ */ jsx37(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(CircleStopIcon, {}) }) });
3906
+ return /* @__PURE__ */ jsx38(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx38(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx38(CircleStopIcon, {}) }) });
3688
3907
  });
3689
3908
  ComposerCancel.displayName = "ComposerCancel";
3690
3909
  var exports5 = {
@@ -3697,15 +3916,15 @@ var exports5 = {
3697
3916
  var composer_default = Object.assign(Composer, exports5);
3698
3917
 
3699
3918
  // src/ui/thread-welcome.tsx
3700
- import { forwardRef as forwardRef23 } from "react";
3701
- import { jsx as jsx38, jsxs as jsxs10 } from "react/jsx-runtime";
3919
+ import { forwardRef as forwardRef24 } from "react";
3920
+ import { jsx as jsx39, jsxs as jsxs10 } from "react/jsx-runtime";
3702
3921
  var ThreadWelcome = () => {
3703
3922
  return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
3704
3923
  /* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
3705
- /* @__PURE__ */ jsx38(ThreadWelcomeAvatar, {}),
3706
- /* @__PURE__ */ jsx38(ThreadWelcomeMessage, {})
3924
+ /* @__PURE__ */ jsx39(ThreadWelcomeAvatar, {}),
3925
+ /* @__PURE__ */ jsx39(ThreadWelcomeMessage, {})
3707
3926
  ] }),
3708
- /* @__PURE__ */ jsx38(ThreadWelcomeSuggestions, {})
3927
+ /* @__PURE__ */ jsx39(ThreadWelcomeSuggestions, {})
3709
3928
  ] });
3710
3929
  };
3711
3930
  ThreadWelcome.displayName = "ThreadWelcome";
@@ -3715,22 +3934,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
3715
3934
  var ThreadWelcomeCenter = withDefaults("div", {
3716
3935
  className: "aui-thread-welcome-center"
3717
3936
  });
3718
- var ThreadWelcomeRoot = forwardRef23(
3937
+ var ThreadWelcomeRoot = forwardRef24(
3719
3938
  (props, ref) => {
3720
- return /* @__PURE__ */ jsx38(thread_exports.Empty, { children: /* @__PURE__ */ jsx38(ThreadWelcomeRootStyled, { ...props, ref }) });
3939
+ return /* @__PURE__ */ jsx39(thread_exports.Empty, { children: /* @__PURE__ */ jsx39(ThreadWelcomeRootStyled, { ...props, ref }) });
3721
3940
  }
3722
3941
  );
3723
3942
  ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
3724
3943
  var ThreadWelcomeAvatar = () => {
3725
3944
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
3726
- return /* @__PURE__ */ jsx38(Avatar, { ...avatar });
3945
+ return /* @__PURE__ */ jsx39(Avatar, { ...avatar });
3727
3946
  };
3728
3947
  var ThreadWelcomeMessageStyled = withDefaults("p", {
3729
3948
  className: "aui-thread-welcome-message"
3730
3949
  });
3731
- var ThreadWelcomeMessage = forwardRef23(({ message: messageProp, ...rest }, ref) => {
3950
+ var ThreadWelcomeMessage = forwardRef24(({ message: messageProp, ...rest }, ref) => {
3732
3951
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
3733
- return /* @__PURE__ */ jsx38(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
3952
+ return /* @__PURE__ */ jsx39(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
3734
3953
  });
3735
3954
  ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
3736
3955
  var ThreadWelcomeSuggestionContainer = withDefaults("div", {
@@ -3742,21 +3961,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
3742
3961
  var ThreadWelcomeSuggestion = ({
3743
3962
  suggestion: { text, prompt }
3744
3963
  }) => {
3745
- return /* @__PURE__ */ jsx38(
3964
+ return /* @__PURE__ */ jsx39(
3746
3965
  ThreadWelcomeSuggestionStyled,
3747
3966
  {
3748
3967
  prompt,
3749
3968
  method: "replace",
3750
3969
  autoSend: true,
3751
- children: /* @__PURE__ */ jsx38("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
3970
+ children: /* @__PURE__ */ jsx39("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
3752
3971
  }
3753
3972
  );
3754
3973
  };
3755
3974
  var ThreadWelcomeSuggestions = () => {
3756
3975
  const { welcome: { suggestions } = {} } = useThreadConfig();
3757
- return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
3976
+ return /* @__PURE__ */ jsx39(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
3758
3977
  const key = `${suggestion.prompt}-${idx}`;
3759
- return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestion, { suggestion }, key);
3978
+ return /* @__PURE__ */ jsx39(ThreadWelcomeSuggestion, { suggestion }, key);
3760
3979
  }) });
3761
3980
  };
3762
3981
  ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
@@ -3771,35 +3990,35 @@ var exports6 = {
3771
3990
  var thread_welcome_default = Object.assign(ThreadWelcome, exports6);
3772
3991
 
3773
3992
  // src/ui/user-message.tsx
3774
- import { forwardRef as forwardRef25 } from "react";
3993
+ import { forwardRef as forwardRef26 } from "react";
3775
3994
 
3776
3995
  // src/ui/user-action-bar.tsx
3777
- import { forwardRef as forwardRef24 } from "react";
3996
+ import { forwardRef as forwardRef25 } from "react";
3778
3997
  import { PencilIcon } from "lucide-react";
3779
- import { jsx as jsx39 } from "react/jsx-runtime";
3780
- var useAllowEdit = () => {
3998
+ import { jsx as jsx40 } from "react/jsx-runtime";
3999
+ var useAllowEdit = (ensureCapability = false) => {
3781
4000
  const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
3782
4001
  const { useThread } = useThreadContext();
3783
4002
  const editSupported = useThread((t) => t.capabilities.edit);
3784
- return editSupported && allowEdit;
4003
+ return allowEdit && (!ensureCapability || editSupported);
3785
4004
  };
3786
4005
  var UserActionBar = () => {
3787
- const allowEdit = useAllowEdit();
4006
+ const allowEdit = useAllowEdit(true);
3788
4007
  if (!allowEdit) return null;
3789
- return /* @__PURE__ */ jsx39(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx39(UserActionBarEdit, {}) });
4008
+ return /* @__PURE__ */ jsx40(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx40(UserActionBarEdit, {}) });
3790
4009
  };
3791
4010
  UserActionBar.displayName = "UserActionBar";
3792
4011
  var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
3793
4012
  className: "aui-user-action-bar-root"
3794
4013
  });
3795
4014
  UserActionBarRoot.displayName = "UserActionBarRoot";
3796
- var UserActionBarEdit = forwardRef24((props, ref) => {
4015
+ var UserActionBarEdit = forwardRef25((props, ref) => {
3797
4016
  const {
3798
4017
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
3799
4018
  } = useThreadConfig();
3800
4019
  const allowEdit = useAllowEdit();
3801
4020
  if (!allowEdit) return null;
3802
- return /* @__PURE__ */ jsx39(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(PencilIcon, {}) }) });
4021
+ return /* @__PURE__ */ jsx40(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ jsx40(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx40(PencilIcon, {}) }) });
3803
4022
  });
3804
4023
  UserActionBarEdit.displayName = "UserActionBarEdit";
3805
4024
  var exports7 = {
@@ -3809,12 +4028,12 @@ var exports7 = {
3809
4028
  var user_action_bar_default = Object.assign(UserActionBar, exports7);
3810
4029
 
3811
4030
  // src/ui/user-message.tsx
3812
- import { jsx as jsx40, jsxs as jsxs11 } from "react/jsx-runtime";
4031
+ import { jsx as jsx41, jsxs as jsxs11 } from "react/jsx-runtime";
3813
4032
  var UserMessage = () => {
3814
4033
  return /* @__PURE__ */ jsxs11(UserMessageRoot, { children: [
3815
- /* @__PURE__ */ jsx40(user_action_bar_default, {}),
3816
- /* @__PURE__ */ jsx40(UserMessageContent, {}),
3817
- /* @__PURE__ */ jsx40(branch_picker_default, {})
4034
+ /* @__PURE__ */ jsx41(user_action_bar_default, {}),
4035
+ /* @__PURE__ */ jsx41(UserMessageContent, {}),
4036
+ /* @__PURE__ */ jsx41(branch_picker_default, {})
3818
4037
  ] });
3819
4038
  };
3820
4039
  UserMessage.displayName = "UserMessage";
@@ -3825,9 +4044,9 @@ UserMessageRoot.displayName = "UserMessageRoot";
3825
4044
  var UserMessageContentWrapper = withDefaults("div", {
3826
4045
  className: "aui-user-message-content"
3827
4046
  });
3828
- var UserMessageContent = forwardRef25(
4047
+ var UserMessageContent = forwardRef26(
3829
4048
  ({ components, ...props }, ref) => {
3830
- return /* @__PURE__ */ jsx40(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx40(
4049
+ return /* @__PURE__ */ jsx41(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx41(
3831
4050
  message_exports.Content,
3832
4051
  {
3833
4052
  components: {
@@ -3846,14 +4065,14 @@ var exports8 = {
3846
4065
  var user_message_default = Object.assign(UserMessage, exports8);
3847
4066
 
3848
4067
  // src/ui/edit-composer.tsx
3849
- import { forwardRef as forwardRef26 } from "react";
3850
- import { jsx as jsx41, jsxs as jsxs12 } from "react/jsx-runtime";
4068
+ import { forwardRef as forwardRef27 } from "react";
4069
+ import { jsx as jsx42, jsxs as jsxs12 } from "react/jsx-runtime";
3851
4070
  var EditComposer = () => {
3852
4071
  return /* @__PURE__ */ jsxs12(EditComposerRoot, { children: [
3853
- /* @__PURE__ */ jsx41(EditComposerInput, {}),
4072
+ /* @__PURE__ */ jsx42(EditComposerInput, {}),
3854
4073
  /* @__PURE__ */ jsxs12(EditComposerFooter, { children: [
3855
- /* @__PURE__ */ jsx41(EditComposerCancel, {}),
3856
- /* @__PURE__ */ jsx41(EditComposerSend, {})
4074
+ /* @__PURE__ */ jsx42(EditComposerCancel, {}),
4075
+ /* @__PURE__ */ jsx42(EditComposerSend, {})
3857
4076
  ] })
3858
4077
  ] });
3859
4078
  };
@@ -3870,23 +4089,23 @@ var EditComposerFooter = withDefaults("div", {
3870
4089
  className: "aui-edit-composer-footer"
3871
4090
  });
3872
4091
  EditComposerFooter.displayName = "EditComposerFooter";
3873
- var EditComposerCancel = forwardRef26(
4092
+ var EditComposerCancel = forwardRef27(
3874
4093
  (props, ref) => {
3875
4094
  const {
3876
4095
  strings: {
3877
4096
  editComposer: { cancel: { label = "Cancel" } = {} } = {}
3878
4097
  } = {}
3879
4098
  } = useThreadConfig();
3880
- return /* @__PURE__ */ jsx41(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
4099
+ return /* @__PURE__ */ jsx42(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx42(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
3881
4100
  }
3882
4101
  );
3883
4102
  EditComposerCancel.displayName = "EditComposerCancel";
3884
- var EditComposerSend = forwardRef26(
4103
+ var EditComposerSend = forwardRef27(
3885
4104
  (props, ref) => {
3886
4105
  const {
3887
4106
  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
3888
4107
  } = useThreadConfig();
3889
- return /* @__PURE__ */ jsx41(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { ...props, ref, children: props.children ?? label }) });
4108
+ return /* @__PURE__ */ jsx42(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx42(Button, { ...props, ref, children: props.children ?? label }) });
3890
4109
  }
3891
4110
  );
3892
4111
  EditComposerSend.displayName = "EditComposerSend";
@@ -3900,23 +4119,23 @@ var exports9 = {
3900
4119
  var edit_composer_default = Object.assign(EditComposer, exports9);
3901
4120
 
3902
4121
  // src/ui/thread.tsx
3903
- import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
4122
+ import { jsx as jsx43, jsxs as jsxs13 } from "react/jsx-runtime";
3904
4123
  var Thread = (config) => {
3905
- return /* @__PURE__ */ jsx42(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
3906
- /* @__PURE__ */ jsx42(thread_welcome_default, {}),
3907
- /* @__PURE__ */ jsx42(ThreadMessages, {}),
4124
+ return /* @__PURE__ */ jsx43(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
4125
+ /* @__PURE__ */ jsx43(thread_welcome_default, {}),
4126
+ /* @__PURE__ */ jsx43(ThreadMessages, {}),
3908
4127
  /* @__PURE__ */ jsxs13(ThreadViewportFooter, { children: [
3909
- /* @__PURE__ */ jsx42(ThreadScrollToBottom, {}),
3910
- /* @__PURE__ */ jsx42(composer_default, {})
4128
+ /* @__PURE__ */ jsx43(ThreadScrollToBottom, {}),
4129
+ /* @__PURE__ */ jsx43(composer_default, {})
3911
4130
  ] })
3912
4131
  ] }) });
3913
4132
  };
3914
4133
  var ThreadRootStyled = withDefaults(thread_exports.Root, {
3915
4134
  className: "aui-root aui-thread-root"
3916
4135
  });
3917
- var ThreadRoot = forwardRef27(
4136
+ var ThreadRoot = forwardRef28(
3918
4137
  ({ config, ...props }, ref) => {
3919
- return /* @__PURE__ */ jsx42(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx42(ThreadRootStyled, { ...props, ref }) });
4138
+ return /* @__PURE__ */ jsx43(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx43(ThreadRootStyled, { ...props, ref }) });
3920
4139
  }
3921
4140
  );
3922
4141
  ThreadRoot.displayName = "ThreadRoot";
@@ -3930,7 +4149,7 @@ var ThreadViewportFooter = withDefaults("div", {
3930
4149
  ThreadViewportFooter.displayName = "ThreadViewportFooter";
3931
4150
  var SystemMessage = () => null;
3932
4151
  var ThreadMessages = ({ components, ...rest }) => {
3933
- return /* @__PURE__ */ jsx42(
4152
+ return /* @__PURE__ */ jsx43(
3934
4153
  thread_exports.Messages,
3935
4154
  {
3936
4155
  components: {
@@ -3948,13 +4167,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
3948
4167
  variant: "outline",
3949
4168
  className: "aui-thread-scroll-to-bottom"
3950
4169
  });
3951
- var ThreadScrollToBottom = forwardRef27((props, ref) => {
4170
+ var ThreadScrollToBottom = forwardRef28((props, ref) => {
3952
4171
  const {
3953
4172
  strings: {
3954
4173
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
3955
4174
  } = {}
3956
4175
  } = useThreadConfig();
3957
- return /* @__PURE__ */ jsx42(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx42(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx42(ArrowDownIcon, {}) }) });
4176
+ return /* @__PURE__ */ jsx43(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx43(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx43(ArrowDownIcon, {}) }) });
3958
4177
  });
3959
4178
  ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
3960
4179
  var exports10 = {
@@ -3967,20 +4186,20 @@ var exports10 = {
3967
4186
  var thread_default = Object.assign(Thread, exports10);
3968
4187
 
3969
4188
  // src/ui/assistant-modal.tsx
3970
- import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs14 } from "react/jsx-runtime";
4189
+ import { Fragment as Fragment6, jsx as jsx44, jsxs as jsxs14 } from "react/jsx-runtime";
3971
4190
  var AssistantModal = (config) => {
3972
4191
  return /* @__PURE__ */ jsxs14(AssistantModalRoot, { config, children: [
3973
- /* @__PURE__ */ jsx43(AssistantModalTrigger, {}),
3974
- /* @__PURE__ */ jsx43(AssistantModalContent, { children: /* @__PURE__ */ jsx43(thread_default, {}) })
4192
+ /* @__PURE__ */ jsx44(AssistantModalTrigger, {}),
4193
+ /* @__PURE__ */ jsx44(AssistantModalContent, { children: /* @__PURE__ */ jsx44(thread_default, {}) })
3975
4194
  ] });
3976
4195
  };
3977
4196
  AssistantModal.displayName = "AssistantModal";
3978
4197
  var AssistantModalRoot = ({ config, ...props }) => {
3979
- return /* @__PURE__ */ jsx43(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx43(assistantModal_exports.Root, { ...props }) });
4198
+ return /* @__PURE__ */ jsx44(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx44(assistantModal_exports.Root, { ...props }) });
3980
4199
  };
3981
4200
  AssistantModalRoot.displayName = "AssistantModalRoot";
3982
- var AssistantModalTrigger = forwardRef28((props, ref) => {
3983
- return /* @__PURE__ */ jsx43(AssistantModalAnchor, { children: /* @__PURE__ */ jsx43(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx43(AssistantModalButton, { ...props, ref }) }) });
4201
+ var AssistantModalTrigger = forwardRef29((props, ref) => {
4202
+ return /* @__PURE__ */ jsx44(AssistantModalAnchor, { children: /* @__PURE__ */ jsx44(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx44(AssistantModalButton, { ...props, ref }) }) });
3984
4203
  });
3985
4204
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
3986
4205
  var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
@@ -3991,7 +4210,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
3991
4210
  variant: "default",
3992
4211
  className: "aui-modal-button"
3993
4212
  });
3994
- var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref) => {
4213
+ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref) => {
3995
4214
  const {
3996
4215
  strings: {
3997
4216
  assistantModal: {
@@ -4005,7 +4224,7 @@ var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref)
4005
4224
  } = {}
4006
4225
  } = useThreadConfig();
4007
4226
  const tooltip = state === "open" ? openTooltip : closedTooltip;
4008
- return /* @__PURE__ */ jsx43(
4227
+ return /* @__PURE__ */ jsx44(
4009
4228
  ModalButtonStyled,
4010
4229
  {
4011
4230
  side: "left",
@@ -4014,14 +4233,14 @@ var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref)
4014
4233
  ...rest,
4015
4234
  ref,
4016
4235
  children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment6, { children: [
4017
- /* @__PURE__ */ jsx43(
4236
+ /* @__PURE__ */ jsx44(
4018
4237
  BotIcon,
4019
4238
  {
4020
4239
  "data-state": state,
4021
4240
  className: "aui-modal-button-closed-icon"
4022
4241
  }
4023
4242
  ),
4024
- /* @__PURE__ */ jsx43(
4243
+ /* @__PURE__ */ jsx44(
4025
4244
  ChevronDownIcon,
4026
4245
  {
4027
4246
  "data-state": state,
@@ -4070,6 +4289,7 @@ export {
4070
4289
  thread_welcome_default as ThreadWelcome,
4071
4290
  user_action_bar_default as UserActionBar,
4072
4291
  user_message_default as UserMessage,
4292
+ WebSpeechSynthesisAdapter,
4073
4293
  fromCoreMessage,
4074
4294
  fromCoreMessages,
4075
4295
  fromLanguageModelMessages,
@@ -4086,6 +4306,8 @@ export {
4086
4306
  useActionBarCopy,
4087
4307
  useActionBarEdit,
4088
4308
  useActionBarReload,
4309
+ useActionBarSpeak,
4310
+ useActionBarStopSpeaking,
4089
4311
  useAppendMessage,
4090
4312
  useAssistantContext,
4091
4313
  useAssistantInstructions,