@assistant-ui/react 0.5.42 → 0.5.45

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -164,6 +164,7 @@ var makeComposerStore = (useThreadRuntime) => {
164
164
  var getThreadStateFromRuntime = (runtime) => {
165
165
  const lastMessage = runtime.messages.at(-1);
166
166
  return Object.freeze({
167
+ threadId: runtime.threadId,
167
168
  capabilities: runtime.capabilities,
168
169
  isDisabled: runtime.isDisabled,
169
170
  isRunning: _optionalChain([lastMessage, 'optionalAccess', _10 => _10.role]) !== "assistant" ? false : lastMessage.status.type === "running"
@@ -636,6 +637,9 @@ var useSmooth = (state, smooth = false) => {
636
637
  setDisplayedText(text2);
637
638
  _optionalChain([useSmoothStatus2, 'optionalAccess', _29 => _29.setState, 'call', _30 => _30(text2 !== state.part.text ? SMOOTH_STATUS : state.status)]);
638
639
  });
640
+ _react.useEffect.call(void 0, () => {
641
+ _optionalChain([useSmoothStatus2, 'optionalAccess', _31 => _31.setState, 'call', _32 => _32(text !== displayedText ? SMOOTH_STATUS : state.status)]);
642
+ }, [useSmoothStatus2, text, displayedText, state.status]);
639
643
  const [animatorRef] = _react.useState.call(void 0,
640
644
  new TextStreamAnimator(text, setText)
641
645
  );
@@ -828,7 +832,7 @@ var fromLanguageModelMessages = (lm, { mergeRoundtrips }) => {
828
832
  });
829
833
  if (mergeRoundtrips) {
830
834
  const previousMessage = messages[messages.length - 1];
831
- if (_optionalChain([previousMessage, 'optionalAccess', _31 => _31.role]) === "assistant") {
835
+ if (_optionalChain([previousMessage, 'optionalAccess', _33 => _33.role]) === "assistant") {
832
836
  previousMessage.content.push(...newContent);
833
837
  break;
834
838
  }
@@ -841,7 +845,7 @@ var fromLanguageModelMessages = (lm, { mergeRoundtrips }) => {
841
845
  }
842
846
  case "tool": {
843
847
  const previousMessage = messages[messages.length - 1];
844
- if (_optionalChain([previousMessage, 'optionalAccess', _32 => _32.role]) !== "assistant")
848
+ if (_optionalChain([previousMessage, 'optionalAccess', _34 => _34.role]) !== "assistant")
845
849
  throw new Error(
846
850
  "A tool message must be preceded by an assistant message."
847
851
  );
@@ -1070,13 +1074,14 @@ var useEdgeRuntime = ({
1070
1074
  };
1071
1075
 
1072
1076
  // src/runtimes/local/shouldContinue.tsx
1073
- var shouldContinue = (result) => _optionalChain([result, 'access', _33 => _33.status, 'optionalAccess', _34 => _34.type]) === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
1077
+ var shouldContinue = (result) => _optionalChain([result, 'access', _35 => _35.status, 'optionalAccess', _36 => _36.type]) === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
1074
1078
 
1075
1079
  // src/runtimes/local/LocalThreadRuntime.tsx
1076
1080
  var LocalThreadRuntime = (_class5 = class {
1077
1081
  constructor(configProvider, adapter, { initialMessages, ...options }) {;_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);_class5.prototype.__init16.call(this);
1078
1082
  this.configProvider = configProvider;
1079
1083
  this.adapter = adapter;
1084
+ this.threadId = generateId();
1080
1085
  this.options = options;
1081
1086
  if (initialMessages) {
1082
1087
  let parentId = null;
@@ -1098,6 +1103,7 @@ var LocalThreadRuntime = (_class5 = class {
1098
1103
  unstable_copy: true,
1099
1104
  speak: false
1100
1105
  }}
1106
+
1101
1107
  __init15() {this.isDisabled = false}
1102
1108
  get messages() {
1103
1109
  return this.repository.getMessages();
@@ -1115,7 +1121,7 @@ var LocalThreadRuntime = (_class5 = class {
1115
1121
  }
1116
1122
  set options({ initialMessages, ...options }) {
1117
1123
  this._options = options;
1118
- const canSpeak = _optionalChain([options, 'access', _35 => _35.adapters, 'optionalAccess', _36 => _36.speech]) !== void 0;
1124
+ const canSpeak = _optionalChain([options, 'access', _37 => _37.adapters, 'optionalAccess', _38 => _38.speech]) !== void 0;
1119
1125
  if (this.capabilities.speak !== canSpeak) {
1120
1126
  this.capabilities.speak = canSpeak;
1121
1127
  this.notifySubscribers();
@@ -1159,18 +1165,18 @@ var LocalThreadRuntime = (_class5 = class {
1159
1165
  }
1160
1166
  async performRoundtrip(parentId, message) {
1161
1167
  const messages = this.repository.getMessages();
1162
- _optionalChain([this, 'access', _37 => _37.abortController, 'optionalAccess', _38 => _38.abort, 'call', _39 => _39()]);
1168
+ _optionalChain([this, 'access', _39 => _39.abortController, 'optionalAccess', _40 => _40.abort, 'call', _41 => _41()]);
1163
1169
  this.abortController = new AbortController();
1164
1170
  const initialContent = message.content;
1165
- const initialRoundtrips = _optionalChain([message, 'access', _40 => _40.metadata, 'optionalAccess', _41 => _41.roundtrips]);
1166
- const initalCustom = _optionalChain([message, 'access', _42 => _42.metadata, 'optionalAccess', _43 => _43.custom]);
1171
+ const initialRoundtrips = _optionalChain([message, 'access', _42 => _42.metadata, 'optionalAccess', _43 => _43.roundtrips]);
1172
+ const initalCustom = _optionalChain([message, 'access', _44 => _44.metadata, 'optionalAccess', _45 => _45.custom]);
1167
1173
  const updateMessage = (m) => {
1168
1174
  message = {
1169
1175
  ...message,
1170
1176
  ...m.content ? { content: [...initialContent, ..._nullishCoalesce(m.content, () => ( []))] } : void 0,
1171
1177
  status: _nullishCoalesce(m.status, () => ( message.status)),
1172
1178
  // TODO deprecated, remove in v0.6
1173
- ..._optionalChain([m, 'access', _44 => _44.metadata, 'optionalAccess', _45 => _45.roundtrips]) ? {
1179
+ ..._optionalChain([m, 'access', _46 => _46.metadata, 'optionalAccess', _47 => _47.roundtrips]) ? {
1174
1180
  roundtrips: [
1175
1181
  ..._nullishCoalesce(initialRoundtrips, () => ( [])),
1176
1182
  ...m.metadata.roundtrips
@@ -1185,7 +1191,7 @@ var LocalThreadRuntime = (_class5 = class {
1185
1191
  ...m.metadata.roundtrips
1186
1192
  ]
1187
1193
  } : void 0,
1188
- ..._optionalChain([m, 'access', _46 => _46.metadata, 'optionalAccess', _47 => _47.custom]) ? {
1194
+ ..._optionalChain([m, 'access', _48 => _48.metadata, 'optionalAccess', _49 => _49.custom]) ? {
1189
1195
  custom: { ..._nullishCoalesce(initalCustom, () => ( {})), ...m.metadata.custom }
1190
1196
  } : void 0
1191
1197
  }
@@ -1195,7 +1201,7 @@ var LocalThreadRuntime = (_class5 = class {
1195
1201
  this.notifySubscribers();
1196
1202
  };
1197
1203
  const maxToolRoundtrips = _nullishCoalesce(this.options.maxToolRoundtrips, () => ( 1));
1198
- const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access', _48 => _48.metadata, 'optionalAccess', _49 => _49.roundtrips, 'optionalAccess', _50 => _50.length]), () => ( 0));
1204
+ const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access', _50 => _50.metadata, 'optionalAccess', _51 => _51.roundtrips, 'optionalAccess', _52 => _52.length]), () => ( 0));
1199
1205
  if (toolRoundtrips > maxToolRoundtrips) {
1200
1206
  updateMessage({
1201
1207
  status: {
@@ -1292,7 +1298,7 @@ var LocalThreadRuntime = (_class5 = class {
1292
1298
  // TODO lift utterance state to thread runtime
1293
1299
 
1294
1300
  speak(messageId) {
1295
- const adapter = _optionalChain([this, 'access', _51 => _51.options, 'access', _52 => _52.adapters, 'optionalAccess', _53 => _53.speech]);
1301
+ const adapter = _optionalChain([this, 'access', _53 => _53.options, 'access', _54 => _54.adapters, 'optionalAccess', _55 => _55.speech]);
1296
1302
  if (!adapter) throw new Error("Speech adapter not configured");
1297
1303
  const { message } = this.repository.getMessage(messageId);
1298
1304
  if (this._utterance) {
@@ -1353,7 +1359,7 @@ var LocalRuntime = class extends BaseAssistantRuntime {
1353
1359
  const messages = fromCoreMessages(initialMessages);
1354
1360
  this.thread.import({
1355
1361
  messages: messages.map((m, idx) => ({
1356
- parentId: _nullishCoalesce(_optionalChain([messages, 'access', _54 => _54[idx - 1], 'optionalAccess', _55 => _55.id]), () => ( null)),
1362
+ parentId: _nullishCoalesce(_optionalChain([messages, 'access', _56 => _56[idx - 1], 'optionalAccess', _57 => _57.id]), () => ( null)),
1357
1363
  message: m
1358
1364
  }))
1359
1365
  });
@@ -1400,11 +1406,12 @@ var getAutoStatus = (isLast, isRunning) => isLast && isRunning ? AUTO_STATUS_RUN
1400
1406
 
1401
1407
  // src/runtimes/external-store/ThreadMessageLike.tsx
1402
1408
  var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
1403
- const { role, content, id, createdAt, status } = like;
1409
+ const { role, id, createdAt, status } = like;
1404
1410
  const common = {
1405
1411
  id: _nullishCoalesce(id, () => ( fallbackId)),
1406
1412
  createdAt: _nullishCoalesce(createdAt, () => ( /* @__PURE__ */ new Date()))
1407
1413
  };
1414
+ const content = typeof like.content === "string" ? [{ type: "text", text: like.content }] : like.content;
1408
1415
  switch (role) {
1409
1416
  case "assistant":
1410
1417
  return {
@@ -1414,6 +1421,8 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
1414
1421
  const type = part.type;
1415
1422
  switch (type) {
1416
1423
  case "text":
1424
+ if (part.text.trim().length === 0) return null;
1425
+ return part;
1417
1426
  case "ui":
1418
1427
  return part;
1419
1428
  case "tool-call": {
@@ -1428,7 +1437,7 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
1428
1437
  throw new Error(`Unknown content part type: ${unhandledType}`);
1429
1438
  }
1430
1439
  }
1431
- }),
1440
+ }).filter((c) => !!c),
1432
1441
  status: _nullishCoalesce(status, () => ( fallbackStatus))
1433
1442
  };
1434
1443
  case "user":
@@ -1476,7 +1485,7 @@ var getThreadMessageText = (message) => {
1476
1485
 
1477
1486
  // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
1478
1487
  var hasUpcomingMessage = (isRunning, messages) => {
1479
- return isRunning && _optionalChain([messages, 'access', _56 => _56[messages.length - 1], 'optionalAccess', _57 => _57.role]) !== "assistant";
1488
+ return isRunning && _optionalChain([messages, 'access', _58 => _58[messages.length - 1], 'optionalAccess', _59 => _59.role]) !== "assistant";
1480
1489
  };
1481
1490
  var ExternalStoreThreadRuntime = (_class7 = class {
1482
1491
  __init18() {this._subscriptions = /* @__PURE__ */ new Set()}
@@ -1493,22 +1502,27 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1493
1502
  get capabilities() {
1494
1503
  return this._capabilities;
1495
1504
  }
1496
- __init22() {this.messages = []}
1497
- __init23() {this.isDisabled = false}
1498
- __init24() {this.converter = new ThreadMessageConverter()}
1499
1505
 
1500
- __init25() {this.composer = {
1506
+
1507
+
1508
+ __init22() {this.converter = new ThreadMessageConverter()}
1509
+
1510
+ __init23() {this.composer = {
1501
1511
  text: "",
1502
1512
  setText: (value) => {
1503
1513
  this.composer.text = value;
1504
1514
  this.notifySubscribers();
1505
1515
  }
1506
1516
  }}
1507
- constructor(store) {;_class7.prototype.__init18.call(this);_class7.prototype.__init19.call(this);_class7.prototype.__init20.call(this);_class7.prototype.__init21.call(this);_class7.prototype.__init22.call(this);_class7.prototype.__init23.call(this);_class7.prototype.__init24.call(this);_class7.prototype.__init25.call(this);_class7.prototype.__init26.call(this);
1517
+ constructor(store) {;_class7.prototype.__init18.call(this);_class7.prototype.__init19.call(this);_class7.prototype.__init20.call(this);_class7.prototype.__init21.call(this);_class7.prototype.__init22.call(this);_class7.prototype.__init23.call(this);_class7.prototype.__init24.call(this);
1508
1518
  this.store = store;
1509
1519
  }
1520
+ get store() {
1521
+ return this._store;
1522
+ }
1510
1523
  set store(store) {
1511
1524
  if (this._store === store) return;
1525
+ this.threadId = _nullishCoalesce(_nullishCoalesce(store.threadId, () => ( this.threadId)), () => ( generateId()));
1512
1526
  const isRunning = _nullishCoalesce(store.isRunning, () => ( false));
1513
1527
  this.isDisabled = _nullishCoalesce(store.isDisabled, () => ( false));
1514
1528
  const oldStore = this._store;
@@ -1518,7 +1532,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1518
1532
  edit: this._store.onEdit !== void 0,
1519
1533
  reload: this._store.onReload !== void 0,
1520
1534
  cancel: this._store.onCancel !== void 0,
1521
- unstable_copy: _optionalChain([this, 'access', _61 => _61._store, 'access', _62 => _62.unstable_capabilities, 'optionalAccess', _63 => _63.copy]) !== null,
1535
+ unstable_copy: _optionalChain([this, 'access', _63 => _63._store, 'access', _64 => _64.unstable_capabilities, 'optionalAccess', _65 => _65.copy]) !== null,
1522
1536
  speak: this._store.onSpeak !== void 0
1523
1537
  };
1524
1538
  if (oldStore) {
@@ -1546,7 +1560,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1546
1560
  for (let i = 0; i < messages.length; i++) {
1547
1561
  const message = messages[i];
1548
1562
  const parent = messages[i - 1];
1549
- this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _64 => _64.id]), () => ( null)), message);
1563
+ this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _66 => _66.id]), () => ( null)), message);
1550
1564
  }
1551
1565
  if (this.assistantOptimisticId) {
1552
1566
  this.repository.deleteMessage(this.assistantOptimisticId);
@@ -1554,7 +1568,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1554
1568
  }
1555
1569
  if (hasUpcomingMessage(isRunning, messages)) {
1556
1570
  this.assistantOptimisticId = this.repository.appendOptimisticMessage(
1557
- _nullishCoalesce(_optionalChain([messages, 'access', _65 => _65.at, 'call', _66 => _66(-1), 'optionalAccess', _67 => _67.id]), () => ( null)),
1571
+ _nullishCoalesce(_optionalChain([messages, 'access', _67 => _67.at, 'call', _68 => _68(-1), 'optionalAccess', _69 => _69.id]), () => ( null)),
1558
1572
  {
1559
1573
  role: "assistant",
1560
1574
  content: []
@@ -1562,7 +1576,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1562
1576
  );
1563
1577
  }
1564
1578
  this.repository.resetHead(
1565
- _nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access', _68 => _68.at, 'call', _69 => _69(-1), 'optionalAccess', _70 => _70.id]))), () => ( null))
1579
+ _nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access', _70 => _70.at, 'call', _71 => _71(-1), 'optionalAccess', _72 => _72.id]))), () => ( null))
1566
1580
  );
1567
1581
  this.messages = this.repository.getMessages();
1568
1582
  this.notifySubscribers();
@@ -1580,7 +1594,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1580
1594
  this.updateMessages(this.repository.getMessages());
1581
1595
  }
1582
1596
  async append(message) {
1583
- if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _71 => _71.messages, 'access', _72 => _72.at, 'call', _73 => _73(-1), 'optionalAccess', _74 => _74.id]), () => ( null)))) {
1597
+ if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _73 => _73.messages, 'access', _74 => _74.at, 'call', _75 => _75(-1), 'optionalAccess', _76 => _76.id]), () => ( null)))) {
1584
1598
  if (!this._store.onEdit)
1585
1599
  throw new Error("Runtime does not support editing messages.");
1586
1600
  await this._store.onEdit(message);
@@ -1603,7 +1617,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1603
1617
  }
1604
1618
  let messages = this.repository.getMessages();
1605
1619
  const previousMessage = messages[messages.length - 1];
1606
- if (_optionalChain([previousMessage, 'optionalAccess', _75 => _75.role]) === "user" && previousMessage.id === _optionalChain([messages, 'access', _76 => _76.at, 'call', _77 => _77(-1), 'optionalAccess', _78 => _78.id])) {
1620
+ if (_optionalChain([previousMessage, 'optionalAccess', _77 => _77.role]) === "user" && previousMessage.id === _optionalChain([messages, 'access', _78 => _78.at, 'call', _79 => _79(-1), 'optionalAccess', _80 => _80.id])) {
1607
1621
  this.repository.deleteMessage(previousMessage.id);
1608
1622
  if (!this.composer.text.trim()) {
1609
1623
  this.composer.setText(getThreadMessageText(previousMessage));
@@ -1631,8 +1645,8 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1631
1645
  this._subscriptions.add(callback);
1632
1646
  return () => this._subscriptions.delete(callback);
1633
1647
  }
1634
- __init26() {this.updateMessages = (messages) => {
1635
- _optionalChain([this, 'access', _79 => _79._store, 'access', _80 => _80.setMessages, 'optionalCall', _81 => _81(
1648
+ __init24() {this.updateMessages = (messages) => {
1649
+ _optionalChain([this, 'access', _81 => _81._store, 'access', _82 => _82.setMessages, 'optionalCall', _83 => _83(
1636
1650
  messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
1637
1651
  )]);
1638
1652
  }}
@@ -1640,9 +1654,12 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1640
1654
 
1641
1655
  // src/runtimes/external-store/ExternalStoreRuntime.tsx
1642
1656
  var ExternalStoreRuntime = (_class8 = class extends BaseAssistantRuntime {
1643
- __init27() {this._proxyConfigProvider = new ProxyConfigProvider()}
1657
+ __init25() {this._proxyConfigProvider = new ProxyConfigProvider()}
1644
1658
  constructor(store) {
1645
- super(new ExternalStoreThreadRuntime(store));_class8.prototype.__init27.call(this);;
1659
+ super(new ExternalStoreThreadRuntime(store));_class8.prototype.__init25.call(this);;
1660
+ }
1661
+ get store() {
1662
+ return this.thread.store;
1646
1663
  }
1647
1664
  set store(store) {
1648
1665
  this.thread.store = store;
@@ -1684,6 +1701,153 @@ var useExternalStoreRuntime = (store) => {
1684
1701
  return runtime;
1685
1702
  };
1686
1703
 
1704
+ // src/runtimes/external-store/external-message-converter.tsx
1705
+
1706
+ var joinExternalMessages = (messages) => {
1707
+ const assistantMessage = {
1708
+ role: "assistant",
1709
+ content: []
1710
+ };
1711
+ for (const output of messages) {
1712
+ if (output.role === "tool") {
1713
+ const toolCallIdx = assistantMessage.content.findIndex(
1714
+ (c) => c.type === "tool-call" && c.toolCallId === output.toolCallId
1715
+ );
1716
+ if (toolCallIdx !== -1) {
1717
+ const toolCall = assistantMessage.content[toolCallIdx];
1718
+ if (output.toolName) {
1719
+ if (toolCall.toolName !== output.toolName)
1720
+ throw new Error(
1721
+ `Tool call name ${output.toolCallId} ${output.toolName} does not match existing tool call ${toolCall.toolName}`
1722
+ );
1723
+ }
1724
+ assistantMessage.content[toolCallIdx] = {
1725
+ ...toolCall,
1726
+ result: output.result
1727
+ };
1728
+ } else {
1729
+ throw new Error(
1730
+ `Tool call ${output.toolCallId} ${output.toolName} not found in assistant message`
1731
+ );
1732
+ }
1733
+ } else {
1734
+ const content = output.content;
1735
+ const role = output.role;
1736
+ switch (role) {
1737
+ case "system":
1738
+ case "user":
1739
+ return { role, content };
1740
+ case "assistant":
1741
+ if (assistantMessage.content.length === 0) {
1742
+ assistantMessage.id = output.id;
1743
+ assistantMessage.createdAt ??= output.createdAt;
1744
+ assistantMessage.status ??= output.status;
1745
+ }
1746
+ assistantMessage.content.push(...content);
1747
+ break;
1748
+ default: {
1749
+ const unsupportedRole = role;
1750
+ throw new Error(`Unknown message role: ${unsupportedRole}`);
1751
+ }
1752
+ }
1753
+ }
1754
+ }
1755
+ return assistantMessage;
1756
+ };
1757
+ var chunkExternalMessages = (callbackResults) => {
1758
+ const results = [];
1759
+ let isAssistant = false;
1760
+ let inputs = [];
1761
+ let outputs = [];
1762
+ const flush = () => {
1763
+ if (outputs.length) {
1764
+ results.push({
1765
+ inputs,
1766
+ outputs
1767
+ });
1768
+ }
1769
+ inputs = [];
1770
+ outputs = [];
1771
+ };
1772
+ for (const callbackResult of callbackResults) {
1773
+ for (const output of callbackResult.outputs) {
1774
+ if (!isAssistant || output.role === "user" || output.role === "system") {
1775
+ flush();
1776
+ }
1777
+ isAssistant = output.role === "assistant" || output.role === "tool";
1778
+ if (inputs.at(-1) !== callbackResult.input) {
1779
+ inputs.push(callbackResult.input);
1780
+ }
1781
+ outputs.push(output);
1782
+ }
1783
+ }
1784
+ flush();
1785
+ return results;
1786
+ };
1787
+ var useExternalMessageConverter = ({
1788
+ callback,
1789
+ messages,
1790
+ isRunning
1791
+ }) => {
1792
+ const state = _react.useMemo.call(void 0,
1793
+ () => ({
1794
+ callback,
1795
+ callbackCache: /* @__PURE__ */ new WeakMap(),
1796
+ chunkCache: /* @__PURE__ */ new WeakMap(),
1797
+ converterCache: new ThreadMessageConverter()
1798
+ }),
1799
+ [callback]
1800
+ );
1801
+ return _react.useMemo.call(void 0, () => {
1802
+ const callbackResults = [];
1803
+ for (const message of messages) {
1804
+ let result = state.callbackCache.get(message);
1805
+ if (!result) {
1806
+ const output = state.callback(message);
1807
+ const outputs = Array.isArray(output) ? output : [output];
1808
+ result = { input: message, outputs };
1809
+ state.callbackCache.set(message, result);
1810
+ }
1811
+ callbackResults.push(result);
1812
+ }
1813
+ const chunks = chunkExternalMessages(callbackResults).map((m) => {
1814
+ const key = m.outputs[0];
1815
+ if (!key) return m;
1816
+ const cached = state.chunkCache.get(key);
1817
+ if (cached && shallowArrayEqual(cached.outputs, m.outputs)) return cached;
1818
+ state.chunkCache.set(key, m);
1819
+ return m;
1820
+ });
1821
+ return state.converterCache.convertMessages(
1822
+ chunks,
1823
+ (cache, message, idx) => {
1824
+ const isLast = idx === chunks.length - 1;
1825
+ const autoStatus = getAutoStatus(isLast, isRunning);
1826
+ if (cache && (cache.role !== "assistant" || !isAutoStatus(cache.status) || cache.status === autoStatus)) {
1827
+ const inputs = getExternalStoreMessage(cache);
1828
+ if (shallowArrayEqual(inputs, message.inputs)) {
1829
+ return cache;
1830
+ }
1831
+ }
1832
+ const newMessage = fromThreadMessageLike(
1833
+ joinExternalMessages(message.outputs),
1834
+ idx.toString(),
1835
+ autoStatus
1836
+ );
1837
+ newMessage[symbolInnerMessage] = message.inputs;
1838
+ return newMessage;
1839
+ }
1840
+ );
1841
+ }, [state, messages, isRunning]);
1842
+ };
1843
+ var shallowArrayEqual = (a, b) => {
1844
+ if (a.length !== b.length) return false;
1845
+ for (let i = 0; i < a.length; i++) {
1846
+ if (a[i] !== b[i]) return false;
1847
+ }
1848
+ return true;
1849
+ };
1850
+
1687
1851
  // src/runtimes/dangerous-in-browser/useDangerousInBrowserRuntime.ts
1688
1852
 
1689
1853
 
@@ -1788,7 +1952,7 @@ var ThreadProvider = ({
1788
1952
  const thread = provider.thread;
1789
1953
  const oldState = context.useThread.getState();
1790
1954
  const state = getThreadStateFromRuntime(thread);
1791
- if (oldState.isDisabled !== state.isDisabled || oldState.isRunning !== state.isRunning || // TODO ensure capabilities is memoized
1955
+ if (oldState.threadId !== state.threadId || oldState.isDisabled !== state.isDisabled || oldState.isRunning !== state.isRunning || // TODO ensure capabilities is memoized
1792
1956
  oldState.capabilities !== state.capabilities) {
1793
1957
  context.useThread.setState(
1794
1958
  state,
@@ -1884,7 +2048,7 @@ var AssistantRuntimeProvider = _react.memo.call(void 0, AssistantRuntimeProvider
1884
2048
  var MessageContext = _react.createContext.call(void 0, null);
1885
2049
  function useMessageContext(options) {
1886
2050
  const context = _react.useContext.call(void 0, MessageContext);
1887
- if (!_optionalChain([options, 'optionalAccess', _82 => _82.optional]) && !context)
2051
+ if (!_optionalChain([options, 'optionalAccess', _84 => _84.optional]) && !context)
1888
2052
  throw new Error(
1889
2053
  "This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
1890
2054
  );
@@ -1911,7 +2075,7 @@ var ContentPartContext = _react.createContext.call(void 0,
1911
2075
  );
1912
2076
  function useContentPartContext(options) {
1913
2077
  const context = _react.useContext.call(void 0, ContentPartContext);
1914
- if (!_optionalChain([options, 'optionalAccess', _83 => _83.optional]) && !context)
2078
+ if (!_optionalChain([options, 'optionalAccess', _85 => _85.optional]) && !context)
1915
2079
  throw new Error(
1916
2080
  "This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
1917
2081
  );
@@ -1923,13 +2087,13 @@ function useContentPartContext(options) {
1923
2087
  var toAppendMessage = (useThreadMessages, message) => {
1924
2088
  if (typeof message === "string") {
1925
2089
  return {
1926
- parentId: _nullishCoalesce(_optionalChain([useThreadMessages, 'access', _84 => _84.getState, 'call', _85 => _85(), 'access', _86 => _86.at, 'call', _87 => _87(-1), 'optionalAccess', _88 => _88.id]), () => ( null)),
2090
+ parentId: _nullishCoalesce(_optionalChain([useThreadMessages, 'access', _86 => _86.getState, 'call', _87 => _87(), 'access', _88 => _88.at, 'call', _89 => _89(-1), 'optionalAccess', _90 => _90.id]), () => ( null)),
1927
2091
  role: "user",
1928
2092
  content: [{ type: "text", text: message }]
1929
2093
  };
1930
2094
  }
1931
2095
  return {
1932
- parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages, 'access', _89 => _89.getState, 'call', _90 => _90(), 'access', _91 => _91.at, 'call', _92 => _92(-1), 'optionalAccess', _93 => _93.id]))), () => ( null)),
2096
+ parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages, 'access', _91 => _91.getState, 'call', _92 => _92(), 'access', _93 => _93.at, 'call', _94 => _94(-1), 'optionalAccess', _95 => _95.id]))), () => ( null)),
1933
2097
  role: _nullishCoalesce(message.role, () => ( "user")),
1934
2098
  content: message.content
1935
2099
  };
@@ -1981,7 +2145,7 @@ var useAssistantTool = (tool) => {
1981
2145
  const unsub2 = render ? setToolUI(toolName, render) : void 0;
1982
2146
  return () => {
1983
2147
  unsub1();
1984
- _optionalChain([unsub2, 'optionalCall', _94 => _94()]);
2148
+ _optionalChain([unsub2, 'optionalCall', _96 => _96()]);
1985
2149
  };
1986
2150
  }, [registerModelConfigProvider, setToolUI, tool]);
1987
2151
  };
@@ -2446,7 +2610,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
2446
2610
  ...primitiveProps,
2447
2611
  ref: forwardedRef,
2448
2612
  onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
2449
- _optionalChain([callback, 'optionalCall', _95 => _95()]);
2613
+ _optionalChain([callback, 'optionalCall', _97 => _97()]);
2450
2614
  })
2451
2615
  }
2452
2616
  );
@@ -2502,7 +2666,7 @@ var ActionBarPrimitiveStopSpeaking = _react.forwardRef.call(void 0, (props, ref)
2502
2666
  ...props,
2503
2667
  ref,
2504
2668
  onClick: _primitive.composeEventHandlers.call(void 0, props.onClick, () => {
2505
- _optionalChain([callback, 'optionalCall', _96 => _96()]);
2669
+ _optionalChain([callback, 'optionalCall', _98 => _98()]);
2506
2670
  })
2507
2671
  }
2508
2672
  );
@@ -2788,7 +2952,7 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
2788
2952
  }
2789
2953
  }
2790
2954
  const status = toContentPartStatus(message, partIndex, part);
2791
- const currentState = _optionalChain([useContentPart, 'optionalAccess', _97 => _97.getState, 'call', _98 => _98()]);
2955
+ const currentState = _optionalChain([useContentPart, 'optionalAccess', _99 => _99.getState, 'call', _100 => _100()]);
2792
2956
  if (currentState && currentState.part === part && currentState.status === status)
2793
2957
  return null;
2794
2958
  return Object.freeze({ part, status });
@@ -2918,6 +3082,7 @@ var MessageContentPartComponent = ({
2918
3082
  const Tool = by_name[part.toolName] || Fallback2;
2919
3083
  const addResult = (result) => addToolResult({
2920
3084
  messageId: useMessage.getState().message.id,
3085
+ toolName: part.toolName,
2921
3086
  toolCallId: part.toolCallId,
2922
3087
  result
2923
3088
  });
@@ -2936,7 +3101,7 @@ var MessageContentPartImpl = ({
2936
3101
  };
2937
3102
  var MessageContentPart = _react.memo.call(void 0,
2938
3103
  MessageContentPartImpl,
2939
- (prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _99 => _99.components, 'optionalAccess', _100 => _100.Text]) === _optionalChain([next, 'access', _101 => _101.components, 'optionalAccess', _102 => _102.Text]) && _optionalChain([prev, 'access', _103 => _103.components, 'optionalAccess', _104 => _104.Image]) === _optionalChain([next, 'access', _105 => _105.components, 'optionalAccess', _106 => _106.Image]) && _optionalChain([prev, 'access', _107 => _107.components, 'optionalAccess', _108 => _108.UI]) === _optionalChain([next, 'access', _109 => _109.components, 'optionalAccess', _110 => _110.UI]) && _optionalChain([prev, 'access', _111 => _111.components, 'optionalAccess', _112 => _112.tools]) === _optionalChain([next, 'access', _113 => _113.components, 'optionalAccess', _114 => _114.tools])
3104
+ (prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _101 => _101.components, 'optionalAccess', _102 => _102.Text]) === _optionalChain([next, 'access', _103 => _103.components, 'optionalAccess', _104 => _104.Text]) && _optionalChain([prev, 'access', _105 => _105.components, 'optionalAccess', _106 => _106.Image]) === _optionalChain([next, 'access', _107 => _107.components, 'optionalAccess', _108 => _108.Image]) && _optionalChain([prev, 'access', _109 => _109.components, 'optionalAccess', _110 => _110.UI]) === _optionalChain([next, 'access', _111 => _111.components, 'optionalAccess', _112 => _112.UI]) && _optionalChain([prev, 'access', _113 => _113.components, 'optionalAccess', _114 => _114.tools]) === _optionalChain([next, 'access', _115 => _115.components, 'optionalAccess', _116 => _116.tools])
2940
3105
  );
2941
3106
  var MessagePrimitiveContent = ({
2942
3107
  components
@@ -3051,7 +3216,7 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
3051
3216
  const { isRunning } = useThread.getState();
3052
3217
  if (!isRunning) {
3053
3218
  e.preventDefault();
3054
- _optionalChain([textareaRef, 'access', _115 => _115.current, 'optionalAccess', _116 => _116.closest, 'call', _117 => _117("form"), 'optionalAccess', _118 => _118.requestSubmit, 'call', _119 => _119()]);
3219
+ _optionalChain([textareaRef, 'access', _117 => _117.current, 'optionalAccess', _118 => _118.closest, 'call', _119 => _119("form"), 'optionalAccess', _120 => _120.requestSubmit, 'call', _121 => _121()]);
3055
3220
  }
3056
3221
  }
3057
3222
  };
@@ -3353,7 +3518,7 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
3353
3518
  },
3354
3519
  isSpeaking: false,
3355
3520
  stopSpeaking: () => {
3356
- _optionalChain([utterance, 'optionalAccess', _120 => _120.cancel, 'call', _121 => _121()]);
3521
+ _optionalChain([utterance, 'optionalAccess', _122 => _122.cancel, 'call', _123 => _123()]);
3357
3522
  },
3358
3523
  addUtterance: (utt) => {
3359
3524
  utterance = utt;
@@ -3368,15 +3533,15 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
3368
3533
  // src/context/providers/MessageProvider.tsx
3369
3534
 
3370
3535
  var getIsLast = (messages, message) => {
3371
- return _optionalChain([messages, 'access', _122 => _122[messages.length - 1], 'optionalAccess', _123 => _123.id]) === message.id;
3536
+ return _optionalChain([messages, 'access', _124 => _124[messages.length - 1], 'optionalAccess', _125 => _125.id]) === message.id;
3372
3537
  };
3373
3538
  var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
3374
- const parentId = _nullishCoalesce(_optionalChain([messages, 'access', _124 => _124[messageIndex - 1], 'optionalAccess', _125 => _125.id]), () => ( null));
3539
+ const parentId = _nullishCoalesce(_optionalChain([messages, 'access', _126 => _126[messageIndex - 1], 'optionalAccess', _127 => _127.id]), () => ( null));
3375
3540
  const message = messages[messageIndex];
3376
3541
  if (!message) return null;
3377
3542
  const isLast = getIsLast(messages, message);
3378
3543
  const branches = getBranches(message.id);
3379
- const currentState = _optionalChain([useMessage, 'optionalAccess', _126 => _126.getState, 'call', _127 => _127()]);
3544
+ const currentState = _optionalChain([useMessage, 'optionalAccess', _128 => _128.getState, 'call', _129 => _129()]);
3380
3545
  if (currentState && currentState.message === message && currentState.parentId === parentId && currentState.branches === branches && currentState.isLast === isLast)
3381
3546
  return null;
3382
3547
  return Object.freeze({
@@ -3503,7 +3668,7 @@ var ThreadPrimitiveMessagesImpl = ({
3503
3668
  ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
3504
3669
  var ThreadPrimitiveMessages = _react.memo.call(void 0,
3505
3670
  ThreadPrimitiveMessagesImpl,
3506
- (prev, next) => _optionalChain([prev, 'access', _128 => _128.components, 'optionalAccess', _129 => _129.Message]) === _optionalChain([next, 'access', _130 => _130.components, 'optionalAccess', _131 => _131.Message]) && _optionalChain([prev, 'access', _132 => _132.components, 'optionalAccess', _133 => _133.UserMessage]) === _optionalChain([next, 'access', _134 => _134.components, 'optionalAccess', _135 => _135.UserMessage]) && _optionalChain([prev, 'access', _136 => _136.components, 'optionalAccess', _137 => _137.EditComposer]) === _optionalChain([next, 'access', _138 => _138.components, 'optionalAccess', _139 => _139.EditComposer]) && _optionalChain([prev, 'access', _140 => _140.components, 'optionalAccess', _141 => _141.AssistantMessage]) === _optionalChain([next, 'access', _142 => _142.components, 'optionalAccess', _143 => _143.AssistantMessage]) && _optionalChain([prev, 'access', _144 => _144.components, 'optionalAccess', _145 => _145.SystemMessage]) === _optionalChain([next, 'access', _146 => _146.components, 'optionalAccess', _147 => _147.SystemMessage])
3671
+ (prev, next) => _optionalChain([prev, 'access', _130 => _130.components, 'optionalAccess', _131 => _131.Message]) === _optionalChain([next, 'access', _132 => _132.components, 'optionalAccess', _133 => _133.Message]) && _optionalChain([prev, 'access', _134 => _134.components, 'optionalAccess', _135 => _135.UserMessage]) === _optionalChain([next, 'access', _136 => _136.components, 'optionalAccess', _137 => _137.UserMessage]) && _optionalChain([prev, 'access', _138 => _138.components, 'optionalAccess', _139 => _139.EditComposer]) === _optionalChain([next, 'access', _140 => _140.components, 'optionalAccess', _141 => _141.EditComposer]) && _optionalChain([prev, 'access', _142 => _142.components, 'optionalAccess', _143 => _143.AssistantMessage]) === _optionalChain([next, 'access', _144 => _144.components, 'optionalAccess', _145 => _145.AssistantMessage]) && _optionalChain([prev, 'access', _146 => _146.components, 'optionalAccess', _147 => _147.SystemMessage]) === _optionalChain([next, 'access', _148 => _148.components, 'optionalAccess', _149 => _149.SystemMessage])
3507
3672
  );
3508
3673
 
3509
3674
  // src/primitives/thread/ThreadScrollToBottom.tsx
@@ -3535,7 +3700,7 @@ var ThreadConfigProvider = ({
3535
3700
  }) => {
3536
3701
  const assistant = useAssistantContext({ optional: true });
3537
3702
  const configProvider = config && Object.keys(_nullishCoalesce(config, () => ( {}))).length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children });
3538
- if (!_optionalChain([config, 'optionalAccess', _148 => _148.runtime])) return configProvider;
3703
+ if (!_optionalChain([config, 'optionalAccess', _150 => _150.runtime])) return configProvider;
3539
3704
  if (assistant) {
3540
3705
  throw new Error(
3541
3706
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
@@ -3796,7 +3961,7 @@ var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: comp
3796
3961
  {
3797
3962
  components: {
3798
3963
  ...componentsProp,
3799
- Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _149 => _149.Text]), () => ( components.Text)), () => ( content_part_default.Text))
3964
+ Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _151 => _151.Text]), () => ( components.Text)), () => ( content_part_default.Text))
3800
3965
  }
3801
3966
  }
3802
3967
  ) });
@@ -3973,7 +4138,7 @@ var ThreadWelcomeSuggestion = ({
3973
4138
  };
3974
4139
  var ThreadWelcomeSuggestions = () => {
3975
4140
  const { welcome: { suggestions } = {} } = useThreadConfig();
3976
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess', _150 => _150.map, 'call', _151 => _151((suggestion, idx) => {
4141
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess', _152 => _152.map, 'call', _153 => _153((suggestion, idx) => {
3977
4142
  const key = `${suggestion.prompt}-${idx}`;
3978
4143
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
3979
4144
  })]) });
@@ -4051,7 +4216,7 @@ var UserMessageContent = _react.forwardRef.call(void 0,
4051
4216
  {
4052
4217
  components: {
4053
4218
  ...components,
4054
- Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _152 => _152.Text]), () => ( content_part_default.Text))
4219
+ Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _154 => _154.Text]), () => ( content_part_default.Text))
4055
4220
  }
4056
4221
  }
4057
4222
  ) });
@@ -4153,10 +4318,10 @@ var ThreadMessages = ({ components, ...rest }) => {
4153
4318
  thread_exports.Messages,
4154
4319
  {
4155
4320
  components: {
4156
- UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _153 => _153.UserMessage]), () => ( user_message_default)),
4157
- EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _154 => _154.EditComposer]), () => ( edit_composer_default)),
4158
- AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _155 => _155.AssistantMessage]), () => ( assistant_message_default)),
4159
- SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _156 => _156.SystemMessage]), () => ( SystemMessage))
4321
+ UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _155 => _155.UserMessage]), () => ( user_message_default)),
4322
+ EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _156 => _156.EditComposer]), () => ( edit_composer_default)),
4323
+ AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _157 => _157.AssistantMessage]), () => ( assistant_message_default)),
4324
+ SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _158 => _158.SystemMessage]), () => ( SystemMessage))
4160
4325
  },
4161
4326
  ...rest
4162
4327
  }
@@ -4338,5 +4503,6 @@ var assistant_modal_default = Object.assign(AssistantModal, exports11);
4338
4503
 
4339
4504
 
4340
4505
 
4341
- exports.ActionBarPrimitive = actionBar_exports; exports.AssistantActionBar = assistant_action_bar_default; exports.AssistantMessage = assistant_message_default; exports.AssistantModal = assistant_modal_default; exports.AssistantModalPrimitive = assistantModal_exports; exports.AssistantRuntimeProvider = AssistantRuntimeProvider; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerPrimitive = composer_exports; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.ExternalStoreRuntime = ExternalStoreRuntime; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.Thread = thread_default; exports.ThreadConfigProvider = ThreadConfigProvider; exports.ThreadPrimitive = thread_exports; exports.ThreadWelcome = thread_welcome_default; exports.UserActionBar = user_action_bar_default; exports.UserMessage = user_message_default; exports.WebSpeechSynthesisAdapter = WebSpeechSynthesisAdapter; exports.fromCoreMessage = fromCoreMessage; exports.fromCoreMessages = fromCoreMessages; exports.fromLanguageModelMessages = fromLanguageModelMessages; exports.fromLanguageModelTools = fromLanguageModelTools; exports.getExternalStoreMessage = getExternalStoreMessage; exports.makeAssistantTool = makeAssistantTool; exports.makeAssistantToolUI = makeAssistantToolUI; exports.streamUtils = streamUtils; exports.subscribeToMainThread = subscribeToMainThread; exports.toCoreMessage = _chunkBQ3MRWUVjs.toCoreMessage; exports.toCoreMessages = _chunkBQ3MRWUVjs.toCoreMessages; exports.toLanguageModelMessages = _chunkBQ3MRWUVjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkBQ3MRWUVjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerSend = useComposerSend; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadSuggestion = useThreadSuggestion;
4506
+
4507
+ exports.ActionBarPrimitive = actionBar_exports; exports.AssistantActionBar = assistant_action_bar_default; exports.AssistantMessage = assistant_message_default; exports.AssistantModal = assistant_modal_default; exports.AssistantModalPrimitive = assistantModal_exports; exports.AssistantRuntimeProvider = AssistantRuntimeProvider; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerPrimitive = composer_exports; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.ExternalStoreRuntime = ExternalStoreRuntime; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.Thread = thread_default; exports.ThreadConfigProvider = ThreadConfigProvider; exports.ThreadPrimitive = thread_exports; exports.ThreadWelcome = thread_welcome_default; exports.UserActionBar = user_action_bar_default; exports.UserMessage = user_message_default; exports.WebSpeechSynthesisAdapter = WebSpeechSynthesisAdapter; exports.fromCoreMessage = fromCoreMessage; exports.fromCoreMessages = fromCoreMessages; exports.fromLanguageModelMessages = fromLanguageModelMessages; exports.fromLanguageModelTools = fromLanguageModelTools; exports.getExternalStoreMessage = getExternalStoreMessage; exports.makeAssistantTool = makeAssistantTool; exports.makeAssistantToolUI = makeAssistantToolUI; exports.streamUtils = streamUtils; exports.subscribeToMainThread = subscribeToMainThread; exports.toCoreMessage = _chunkBQ3MRWUVjs.toCoreMessage; exports.toCoreMessages = _chunkBQ3MRWUVjs.toCoreMessages; exports.toLanguageModelMessages = _chunkBQ3MRWUVjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkBQ3MRWUVjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerSend = useComposerSend; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useExternalMessageConverter = useExternalMessageConverter; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadSuggestion = useThreadSuggestion;
4342
4508
  //# sourceMappingURL=index.js.map