@assistant-ui/react 0.5.32 → 0.5.34

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkCTVBRM6Cjs = require('./chunk-CTVBRM6C.js');
12
+ var _chunkAAOYJ7TEjs = require('./chunk-AAOYJ7TE.js');
13
13
 
14
14
 
15
15
  var _chunkDCHYNTHIjs = require('./chunk-DCHYNTHI.js');
@@ -41,7 +41,7 @@ var _zustand = require('zustand');
41
41
  var ProxyConfigProvider = (_class = class {constructor() { _class.prototype.__init.call(this); }
42
42
  __init() {this._providers = /* @__PURE__ */ new Set()}
43
43
  getModelConfig() {
44
- return _chunkCTVBRM6Cjs.mergeModelConfigs.call(void 0, this._providers);
44
+ return _chunkAAOYJ7TEjs.mergeModelConfigs.call(void 0, this._providers);
45
45
  }
46
46
  registerModelConfigProvider(provider) {
47
47
  this._providers.add(provider);
@@ -915,14 +915,14 @@ function streamPartDecoderStream() {
915
915
  controller.enqueue(decodeStreamPart(chunk));
916
916
  }
917
917
  });
918
- return new (0, _chunkCTVBRM6Cjs.PipeableTransformStream)((readable) => {
918
+ return new (0, _chunkAAOYJ7TEjs.PipeableTransformStream)((readable) => {
919
919
  return readable.pipeThrough(new TextDecoderStream()).pipeThrough(chunkByLineStream()).pipeThrough(decodeStream);
920
920
  });
921
921
  }
922
922
 
923
923
  // src/runtimes/edge/streams/utils/index.ts
924
924
  var streamUtils = {
925
- streamPartEncoderStream: _chunkCTVBRM6Cjs.streamPartEncoderStream,
925
+ streamPartEncoderStream: _chunkAAOYJ7TEjs.streamPartEncoderStream,
926
926
  streamPartDecoderStream
927
927
  };
928
928
 
@@ -1023,24 +1023,26 @@ var EdgeChatAdapter = class {
1023
1023
  this.options = options;
1024
1024
  }
1025
1025
  async *run({ messages, abortSignal, config }) {
1026
+ const headers = new Headers(this.options.headers);
1027
+ headers.set("Content-Type", "application/json");
1026
1028
  const result = await fetch(this.options.api, {
1027
1029
  method: "POST",
1028
- headers: {
1029
- "Content-Type": "application/json"
1030
- },
1030
+ headers,
1031
+ credentials: _nullishCoalesce(this.options.credentials, () => ( "same-origin")),
1031
1032
  body: JSON.stringify({
1032
1033
  system: config.system,
1033
- messages: _chunkCTVBRM6Cjs.toCoreMessages.call(void 0, messages),
1034
- tools: config.tools ? _chunkCTVBRM6Cjs.toLanguageModelTools.call(void 0, config.tools) : [],
1034
+ messages: _chunkAAOYJ7TEjs.toCoreMessages.call(void 0, messages),
1035
+ tools: config.tools ? _chunkAAOYJ7TEjs.toLanguageModelTools.call(void 0, config.tools) : [],
1035
1036
  ...config.callSettings,
1036
- ...config.config
1037
+ ...config.config,
1038
+ ...this.options.body
1037
1039
  }),
1038
1040
  signal: abortSignal
1039
1041
  });
1040
1042
  if (result.status !== 200) {
1041
1043
  throw new Error(`Status ${result.status}: ${await result.text()}`);
1042
1044
  }
1043
- const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(_chunkCTVBRM6Cjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkCTVBRM6Cjs.runResultStream.call(void 0, ));
1045
+ const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(_chunkAAOYJ7TEjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkAAOYJ7TEjs.runResultStream.call(void 0, ));
1044
1046
  let update;
1045
1047
  for await (update of asAsyncIterable(stream)) {
1046
1048
  yield update;
@@ -1140,19 +1142,40 @@ var LocalThreadRuntime = (_class5 = class {
1140
1142
  _optionalChain([this, 'access', _36 => _36.abortController, 'optionalAccess', _37 => _37.abort, 'call', _38 => _38()]);
1141
1143
  this.abortController = new AbortController();
1142
1144
  const initialContent = message.content;
1143
- const initialRoundtrips = message.roundtrips;
1145
+ const initialRoundtrips = _optionalChain([message, 'access', _39 => _39.metadata, 'optionalAccess', _40 => _40.roundtrips]);
1146
+ const initalCustom = _optionalChain([message, 'access', _41 => _41.metadata, 'optionalAccess', _42 => _42.custom]);
1144
1147
  const updateMessage = (m) => {
1145
1148
  message = {
1146
1149
  ...message,
1147
1150
  ...m.content ? { content: [...initialContent, ..._nullishCoalesce(m.content, () => ( []))] } : void 0,
1148
1151
  status: _nullishCoalesce(m.status, () => ( message.status)),
1149
- ..._optionalChain([m, 'access', _39 => _39.roundtrips, 'optionalAccess', _40 => _40.length]) ? { roundtrips: [..._nullishCoalesce(initialRoundtrips, () => ( [])), ...m.roundtrips] } : void 0
1152
+ // TODO deprecated, remove in v0.6
1153
+ ..._optionalChain([m, 'access', _43 => _43.metadata, 'optionalAccess', _44 => _44.roundtrips]) ? {
1154
+ roundtrips: [
1155
+ ..._nullishCoalesce(initialRoundtrips, () => ( [])),
1156
+ ...m.metadata.roundtrips
1157
+ ]
1158
+ } : void 0,
1159
+ ...m.metadata ? {
1160
+ metadata: {
1161
+ ...message.metadata,
1162
+ ...m.metadata.roundtrips ? {
1163
+ roundtrips: [
1164
+ ..._nullishCoalesce(initialRoundtrips, () => ( [])),
1165
+ ...m.metadata.roundtrips
1166
+ ]
1167
+ } : void 0,
1168
+ ..._optionalChain([m, 'access', _45 => _45.metadata, 'optionalAccess', _46 => _46.custom]) ? {
1169
+ custom: { ..._nullishCoalesce(initalCustom, () => ( {})), ...m.metadata.custom }
1170
+ } : void 0
1171
+ }
1172
+ } : void 0
1150
1173
  };
1151
1174
  this.repository.addOrUpdateMessage(parentId, message);
1152
1175
  this.notifySubscribers();
1153
1176
  };
1154
- const maxToolRoundtrips = _nullishCoalesce(_optionalChain([this, 'access', _41 => _41.options, 'optionalAccess', _42 => _42.maxToolRoundtrips]), () => ( 1));
1155
- const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access', _43 => _43.roundtrips, 'optionalAccess', _44 => _44.length]), () => ( 0));
1177
+ const maxToolRoundtrips = _nullishCoalesce(_optionalChain([this, 'access', _47 => _47.options, 'optionalAccess', _48 => _48.maxToolRoundtrips]), () => ( 1));
1178
+ const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access', _49 => _49.metadata, 'optionalAccess', _50 => _50.roundtrips, 'optionalAccess', _51 => _51.length]), () => ( 0));
1156
1179
  if (toolRoundtrips > maxToolRoundtrips) {
1157
1180
  updateMessage({
1158
1181
  status: {
@@ -1391,7 +1414,7 @@ var getThreadMessageText = (message) => {
1391
1414
 
1392
1415
  // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
1393
1416
  var hasUpcomingMessage = (isRunning, messages) => {
1394
- return isRunning && _optionalChain([messages, 'access', _45 => _45[messages.length - 1], 'optionalAccess', _46 => _46.role]) !== "assistant";
1417
+ return isRunning && _optionalChain([messages, 'access', _52 => _52[messages.length - 1], 'optionalAccess', _53 => _53.role]) !== "assistant";
1395
1418
  };
1396
1419
  var ExternalStoreThreadRuntime = (_class7 = class {
1397
1420
  __init18() {this._subscriptions = /* @__PURE__ */ new Set()}
@@ -1459,7 +1482,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1459
1482
  for (let i = 0; i < messages.length; i++) {
1460
1483
  const message = messages[i];
1461
1484
  const parent = messages[i - 1];
1462
- this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _50 => _50.id]), () => ( null)), message);
1485
+ this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _57 => _57.id]), () => ( null)), message);
1463
1486
  }
1464
1487
  if (this.assistantOptimisticId) {
1465
1488
  this.repository.deleteMessage(this.assistantOptimisticId);
@@ -1467,7 +1490,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1467
1490
  }
1468
1491
  if (hasUpcomingMessage(isRunning, messages)) {
1469
1492
  this.assistantOptimisticId = this.repository.appendOptimisticMessage(
1470
- _nullishCoalesce(_optionalChain([messages, 'access', _51 => _51.at, 'call', _52 => _52(-1), 'optionalAccess', _53 => _53.id]), () => ( null)),
1493
+ _nullishCoalesce(_optionalChain([messages, 'access', _58 => _58.at, 'call', _59 => _59(-1), 'optionalAccess', _60 => _60.id]), () => ( null)),
1471
1494
  {
1472
1495
  role: "assistant",
1473
1496
  content: []
@@ -1475,7 +1498,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1475
1498
  );
1476
1499
  }
1477
1500
  this.repository.resetHead(
1478
- _nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access', _54 => _54.at, 'call', _55 => _55(-1), 'optionalAccess', _56 => _56.id]))), () => ( null))
1501
+ _nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access', _61 => _61.at, 'call', _62 => _62(-1), 'optionalAccess', _63 => _63.id]))), () => ( null))
1479
1502
  );
1480
1503
  this.messages = this.repository.getMessages();
1481
1504
  this.notifySubscribers();
@@ -1493,7 +1516,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1493
1516
  this.updateMessages(this.repository.getMessages());
1494
1517
  }
1495
1518
  async append(message) {
1496
- if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _57 => _57.messages, 'access', _58 => _58.at, 'call', _59 => _59(-1), 'optionalAccess', _60 => _60.id]), () => ( null)))) {
1519
+ if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _64 => _64.messages, 'access', _65 => _65.at, 'call', _66 => _66(-1), 'optionalAccess', _67 => _67.id]), () => ( null)))) {
1497
1520
  if (!this._store.onEdit)
1498
1521
  throw new Error("Runtime does not support editing messages.");
1499
1522
  await this._store.onEdit(message);
@@ -1516,7 +1539,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1516
1539
  }
1517
1540
  let messages = this.repository.getMessages();
1518
1541
  const previousMessage = messages[messages.length - 1];
1519
- if (_optionalChain([previousMessage, 'optionalAccess', _61 => _61.role]) === "user" && previousMessage.id === _optionalChain([messages, 'access', _62 => _62.at, 'call', _63 => _63(-1), 'optionalAccess', _64 => _64.id])) {
1542
+ if (_optionalChain([previousMessage, 'optionalAccess', _68 => _68.role]) === "user" && previousMessage.id === _optionalChain([messages, 'access', _69 => _69.at, 'call', _70 => _70(-1), 'optionalAccess', _71 => _71.id])) {
1520
1543
  this.repository.deleteMessage(previousMessage.id);
1521
1544
  if (!this.composer.text.trim()) {
1522
1545
  this.composer.setText(getThreadMessageText(previousMessage));
@@ -1534,7 +1557,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1534
1557
  return () => this._subscriptions.delete(callback);
1535
1558
  }
1536
1559
  __init26() {this.updateMessages = (messages) => {
1537
- _optionalChain([this, 'access', _65 => _65._store, 'access', _66 => _66.setMessages, 'optionalCall', _67 => _67(
1560
+ _optionalChain([this, 'access', _72 => _72._store, 'access', _73 => _73.setMessages, 'optionalCall', _74 => _74(
1538
1561
  messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
1539
1562
  )]);
1540
1563
  }}
@@ -1698,7 +1721,7 @@ var AssistantRuntimeProvider = _react.memo.call(void 0, AssistantRuntimeProvider
1698
1721
  var MessageContext = _react.createContext.call(void 0, null);
1699
1722
  function useMessageContext(options) {
1700
1723
  const context = _react.useContext.call(void 0, MessageContext);
1701
- if (!_optionalChain([options, 'optionalAccess', _68 => _68.optional]) && !context)
1724
+ if (!_optionalChain([options, 'optionalAccess', _75 => _75.optional]) && !context)
1702
1725
  throw new Error(
1703
1726
  "This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
1704
1727
  );
@@ -1725,7 +1748,7 @@ var ContentPartContext = _react.createContext.call(void 0,
1725
1748
  );
1726
1749
  function useContentPartContext(options) {
1727
1750
  const context = _react.useContext.call(void 0, ContentPartContext);
1728
- if (!_optionalChain([options, 'optionalAccess', _69 => _69.optional]) && !context)
1751
+ if (!_optionalChain([options, 'optionalAccess', _76 => _76.optional]) && !context)
1729
1752
  throw new Error(
1730
1753
  "This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
1731
1754
  );
@@ -1737,13 +1760,13 @@ function useContentPartContext(options) {
1737
1760
  var toAppendMessage = (useThreadMessages, message) => {
1738
1761
  if (typeof message === "string") {
1739
1762
  return {
1740
- parentId: _nullishCoalesce(_optionalChain([useThreadMessages, 'access', _70 => _70.getState, 'call', _71 => _71(), 'access', _72 => _72.at, 'call', _73 => _73(-1), 'optionalAccess', _74 => _74.id]), () => ( null)),
1763
+ parentId: _nullishCoalesce(_optionalChain([useThreadMessages, 'access', _77 => _77.getState, 'call', _78 => _78(), 'access', _79 => _79.at, 'call', _80 => _80(-1), 'optionalAccess', _81 => _81.id]), () => ( null)),
1741
1764
  role: "user",
1742
1765
  content: [{ type: "text", text: message }]
1743
1766
  };
1744
1767
  }
1745
1768
  return {
1746
- parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages, 'access', _75 => _75.getState, 'call', _76 => _76(), 'access', _77 => _77.at, 'call', _78 => _78(-1), 'optionalAccess', _79 => _79.id]))), () => ( null)),
1769
+ parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages, 'access', _82 => _82.getState, 'call', _83 => _83(), 'access', _84 => _84.at, 'call', _85 => _85(-1), 'optionalAccess', _86 => _86.id]))), () => ( null)),
1747
1770
  role: _nullishCoalesce(message.role, () => ( "user")),
1748
1771
  content: message.content
1749
1772
  };
@@ -1795,7 +1818,7 @@ var useAssistantTool = (tool) => {
1795
1818
  const unsub2 = render ? setToolUI(toolName, render) : void 0;
1796
1819
  return () => {
1797
1820
  unsub1();
1798
- _optionalChain([unsub2, 'optionalCall', _80 => _80()]);
1821
+ _optionalChain([unsub2, 'optionalCall', _87 => _87()]);
1799
1822
  };
1800
1823
  }, [registerModelConfigProvider, setToolUI, tool]);
1801
1824
  };
@@ -2224,7 +2247,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
2224
2247
  ...primitiveProps,
2225
2248
  ref: forwardedRef,
2226
2249
  onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
2227
- _optionalChain([callback, 'optionalCall', _81 => _81()]);
2250
+ _optionalChain([callback, 'optionalCall', _88 => _88()]);
2228
2251
  })
2229
2252
  }
2230
2253
  );
@@ -2532,7 +2555,7 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
2532
2555
  }
2533
2556
  }
2534
2557
  const status = toContentPartStatus(message, partIndex, part);
2535
- const currentState = _optionalChain([useContentPart, 'optionalAccess', _82 => _82.getState, 'call', _83 => _83()]);
2558
+ const currentState = _optionalChain([useContentPart, 'optionalAccess', _89 => _89.getState, 'call', _90 => _90()]);
2536
2559
  if (currentState && currentState.part === part && currentState.status === status)
2537
2560
  return null;
2538
2561
  return Object.freeze({ part, status });
@@ -2680,7 +2703,7 @@ var MessageContentPartImpl = ({
2680
2703
  };
2681
2704
  var MessageContentPart = _react.memo.call(void 0,
2682
2705
  MessageContentPartImpl,
2683
- (prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _84 => _84.components, 'optionalAccess', _85 => _85.Text]) === _optionalChain([next, 'access', _86 => _86.components, 'optionalAccess', _87 => _87.Text]) && _optionalChain([prev, 'access', _88 => _88.components, 'optionalAccess', _89 => _89.Image]) === _optionalChain([next, 'access', _90 => _90.components, 'optionalAccess', _91 => _91.Image]) && _optionalChain([prev, 'access', _92 => _92.components, 'optionalAccess', _93 => _93.UI]) === _optionalChain([next, 'access', _94 => _94.components, 'optionalAccess', _95 => _95.UI]) && _optionalChain([prev, 'access', _96 => _96.components, 'optionalAccess', _97 => _97.tools]) === _optionalChain([next, 'access', _98 => _98.components, 'optionalAccess', _99 => _99.tools])
2706
+ (prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _91 => _91.components, 'optionalAccess', _92 => _92.Text]) === _optionalChain([next, 'access', _93 => _93.components, 'optionalAccess', _94 => _94.Text]) && _optionalChain([prev, 'access', _95 => _95.components, 'optionalAccess', _96 => _96.Image]) === _optionalChain([next, 'access', _97 => _97.components, 'optionalAccess', _98 => _98.Image]) && _optionalChain([prev, 'access', _99 => _99.components, 'optionalAccess', _100 => _100.UI]) === _optionalChain([next, 'access', _101 => _101.components, 'optionalAccess', _102 => _102.UI]) && _optionalChain([prev, 'access', _103 => _103.components, 'optionalAccess', _104 => _104.tools]) === _optionalChain([next, 'access', _105 => _105.components, 'optionalAccess', _106 => _106.tools])
2684
2707
  );
2685
2708
  var MessagePrimitiveContent = ({
2686
2709
  components
@@ -2795,7 +2818,7 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
2795
2818
  const { isRunning } = useThread.getState();
2796
2819
  if (!isRunning) {
2797
2820
  e.preventDefault();
2798
- _optionalChain([textareaRef, 'access', _100 => _100.current, 'optionalAccess', _101 => _101.closest, 'call', _102 => _102("form"), 'optionalAccess', _103 => _103.requestSubmit, 'call', _104 => _104()]);
2821
+ _optionalChain([textareaRef, 'access', _107 => _107.current, 'optionalAccess', _108 => _108.closest, 'call', _109 => _109("form"), 'optionalAccess', _110 => _110.requestSubmit, 'call', _111 => _111()]);
2799
2822
  }
2800
2823
  }
2801
2824
  };
@@ -3098,15 +3121,15 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => ({
3098
3121
  // src/context/providers/MessageProvider.tsx
3099
3122
 
3100
3123
  var getIsLast = (messages, message) => {
3101
- return _optionalChain([messages, 'access', _105 => _105[messages.length - 1], 'optionalAccess', _106 => _106.id]) === message.id;
3124
+ return _optionalChain([messages, 'access', _112 => _112[messages.length - 1], 'optionalAccess', _113 => _113.id]) === message.id;
3102
3125
  };
3103
3126
  var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
3104
- const parentId = _nullishCoalesce(_optionalChain([messages, 'access', _107 => _107[messageIndex - 1], 'optionalAccess', _108 => _108.id]), () => ( null));
3127
+ const parentId = _nullishCoalesce(_optionalChain([messages, 'access', _114 => _114[messageIndex - 1], 'optionalAccess', _115 => _115.id]), () => ( null));
3105
3128
  const message = messages[messageIndex];
3106
3129
  if (!message) return null;
3107
3130
  const isLast = getIsLast(messages, message);
3108
3131
  const branches = getBranches(message.id);
3109
- const currentState = _optionalChain([useMessage, 'optionalAccess', _109 => _109.getState, 'call', _110 => _110()]);
3132
+ const currentState = _optionalChain([useMessage, 'optionalAccess', _116 => _116.getState, 'call', _117 => _117()]);
3110
3133
  if (currentState && currentState.message === message && currentState.parentId === parentId && currentState.branches === branches && currentState.isLast === isLast)
3111
3134
  return null;
3112
3135
  return Object.freeze({
@@ -3233,7 +3256,7 @@ var ThreadPrimitiveMessagesImpl = ({
3233
3256
  ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
3234
3257
  var ThreadPrimitiveMessages = _react.memo.call(void 0,
3235
3258
  ThreadPrimitiveMessagesImpl,
3236
- (prev, next) => _optionalChain([prev, 'access', _111 => _111.components, 'optionalAccess', _112 => _112.Message]) === _optionalChain([next, 'access', _113 => _113.components, 'optionalAccess', _114 => _114.Message]) && _optionalChain([prev, 'access', _115 => _115.components, 'optionalAccess', _116 => _116.UserMessage]) === _optionalChain([next, 'access', _117 => _117.components, 'optionalAccess', _118 => _118.UserMessage]) && _optionalChain([prev, 'access', _119 => _119.components, 'optionalAccess', _120 => _120.EditComposer]) === _optionalChain([next, 'access', _121 => _121.components, 'optionalAccess', _122 => _122.EditComposer]) && _optionalChain([prev, 'access', _123 => _123.components, 'optionalAccess', _124 => _124.AssistantMessage]) === _optionalChain([next, 'access', _125 => _125.components, 'optionalAccess', _126 => _126.AssistantMessage]) && _optionalChain([prev, 'access', _127 => _127.components, 'optionalAccess', _128 => _128.SystemMessage]) === _optionalChain([next, 'access', _129 => _129.components, 'optionalAccess', _130 => _130.SystemMessage])
3259
+ (prev, next) => _optionalChain([prev, 'access', _118 => _118.components, 'optionalAccess', _119 => _119.Message]) === _optionalChain([next, 'access', _120 => _120.components, 'optionalAccess', _121 => _121.Message]) && _optionalChain([prev, 'access', _122 => _122.components, 'optionalAccess', _123 => _123.UserMessage]) === _optionalChain([next, 'access', _124 => _124.components, 'optionalAccess', _125 => _125.UserMessage]) && _optionalChain([prev, 'access', _126 => _126.components, 'optionalAccess', _127 => _127.EditComposer]) === _optionalChain([next, 'access', _128 => _128.components, 'optionalAccess', _129 => _129.EditComposer]) && _optionalChain([prev, 'access', _130 => _130.components, 'optionalAccess', _131 => _131.AssistantMessage]) === _optionalChain([next, 'access', _132 => _132.components, 'optionalAccess', _133 => _133.AssistantMessage]) && _optionalChain([prev, 'access', _134 => _134.components, 'optionalAccess', _135 => _135.SystemMessage]) === _optionalChain([next, 'access', _136 => _136.components, 'optionalAccess', _137 => _137.SystemMessage])
3237
3260
  );
3238
3261
 
3239
3262
  // src/primitives/thread/ThreadScrollToBottom.tsx
@@ -3265,7 +3288,7 @@ var ThreadConfigProvider = ({
3265
3288
  }) => {
3266
3289
  const assistant = useAssistantContext({ optional: true });
3267
3290
  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 });
3268
- if (!_optionalChain([config, 'optionalAccess', _131 => _131.runtime])) return configProvider;
3291
+ if (!_optionalChain([config, 'optionalAccess', _138 => _138.runtime])) return configProvider;
3269
3292
  if (assistant) {
3270
3293
  throw new Error(
3271
3294
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
@@ -3481,7 +3504,7 @@ var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: comp
3481
3504
  {
3482
3505
  components: {
3483
3506
  ...componentsProp,
3484
- Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _132 => _132.Text]), () => ( components.Text)), () => ( content_part_default.Text))
3507
+ Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _139 => _139.Text]), () => ( components.Text)), () => ( content_part_default.Text))
3485
3508
  }
3486
3509
  }
3487
3510
  ) });
@@ -3658,7 +3681,7 @@ var ThreadWelcomeSuggestion = ({
3658
3681
  };
3659
3682
  var ThreadWelcomeSuggestions = () => {
3660
3683
  const { welcome: { suggestions } = {} } = useThreadConfig();
3661
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess', _133 => _133.map, 'call', _134 => _134((suggestion, idx) => {
3684
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess', _140 => _140.map, 'call', _141 => _141((suggestion, idx) => {
3662
3685
  const key = `${suggestion.prompt}-${idx}`;
3663
3686
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
3664
3687
  })]) });
@@ -3736,7 +3759,7 @@ var UserMessageContent = _react.forwardRef.call(void 0,
3736
3759
  {
3737
3760
  components: {
3738
3761
  ...components,
3739
- Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _135 => _135.Text]), () => ( content_part_default.Text))
3762
+ Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _142 => _142.Text]), () => ( content_part_default.Text))
3740
3763
  }
3741
3764
  }
3742
3765
  ) });
@@ -3838,10 +3861,10 @@ var ThreadMessages = ({ components, ...rest }) => {
3838
3861
  thread_exports.Messages,
3839
3862
  {
3840
3863
  components: {
3841
- UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _136 => _136.UserMessage]), () => ( user_message_default)),
3842
- EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _137 => _137.EditComposer]), () => ( edit_composer_default)),
3843
- AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _138 => _138.AssistantMessage]), () => ( assistant_message_default)),
3844
- SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _139 => _139.SystemMessage]), () => ( SystemMessage))
3864
+ UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _143 => _143.UserMessage]), () => ( user_message_default)),
3865
+ EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _144 => _144.EditComposer]), () => ( edit_composer_default)),
3866
+ AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _145 => _145.AssistantMessage]), () => ( assistant_message_default)),
3867
+ SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _146 => _146.SystemMessage]), () => ( SystemMessage))
3845
3868
  },
3846
3869
  ...rest
3847
3870
  }
@@ -4019,5 +4042,5 @@ var assistant_modal_default = Object.assign(AssistantModal, exports11);
4019
4042
 
4020
4043
 
4021
4044
 
4022
- 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.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 = _chunkCTVBRM6Cjs.toCoreMessage; exports.toCoreMessages = _chunkCTVBRM6Cjs.toCoreMessages; exports.toLanguageModelMessages = _chunkCTVBRM6Cjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkCTVBRM6Cjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarReload = useActionBarReload; 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.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;
4045
+ 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.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 = _chunkAAOYJ7TEjs.toCoreMessage; exports.toCoreMessages = _chunkAAOYJ7TEjs.toCoreMessages; exports.toLanguageModelMessages = _chunkAAOYJ7TEjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkAAOYJ7TEjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarReload = useActionBarReload; 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.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;
4023
4046
  //# sourceMappingURL=index.js.map