@assistant-ui/react 0.5.33 → 0.5.35

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 _chunkJKRONBQKjs = require('./chunk-JKRONBQK.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 _chunkJKRONBQKjs.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, _chunkJKRONBQKjs.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: _chunkJKRONBQKjs.streamPartEncoderStream,
926
926
  streamPartDecoderStream
927
927
  };
928
928
 
@@ -1031,8 +1031,8 @@ var EdgeChatAdapter = class {
1031
1031
  credentials: _nullishCoalesce(this.options.credentials, () => ( "same-origin")),
1032
1032
  body: JSON.stringify({
1033
1033
  system: config.system,
1034
- messages: _chunkCTVBRM6Cjs.toCoreMessages.call(void 0, messages),
1035
- tools: config.tools ? _chunkCTVBRM6Cjs.toLanguageModelTools.call(void 0, config.tools) : [],
1034
+ messages: _chunkJKRONBQKjs.toCoreMessages.call(void 0, messages),
1035
+ tools: config.tools ? _chunkJKRONBQKjs.toLanguageModelTools.call(void 0, config.tools) : [],
1036
1036
  ...config.callSettings,
1037
1037
  ...config.config,
1038
1038
  ...this.options.body
@@ -1042,7 +1042,7 @@ var EdgeChatAdapter = class {
1042
1042
  if (result.status !== 200) {
1043
1043
  throw new Error(`Status ${result.status}: ${await result.text()}`);
1044
1044
  }
1045
- 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(_chunkJKRONBQKjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkJKRONBQKjs.runResultStream.call(void 0, ));
1046
1046
  let update;
1047
1047
  for await (update of asAsyncIterable(stream)) {
1048
1048
  yield update;
@@ -1142,19 +1142,40 @@ var LocalThreadRuntime = (_class5 = class {
1142
1142
  _optionalChain([this, 'access', _36 => _36.abortController, 'optionalAccess', _37 => _37.abort, 'call', _38 => _38()]);
1143
1143
  this.abortController = new AbortController();
1144
1144
  const initialContent = message.content;
1145
- 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]);
1146
1147
  const updateMessage = (m) => {
1147
1148
  message = {
1148
1149
  ...message,
1149
1150
  ...m.content ? { content: [...initialContent, ..._nullishCoalesce(m.content, () => ( []))] } : void 0,
1150
1151
  status: _nullishCoalesce(m.status, () => ( message.status)),
1151
- ..._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
1152
1173
  };
1153
1174
  this.repository.addOrUpdateMessage(parentId, message);
1154
1175
  this.notifySubscribers();
1155
1176
  };
1156
- const maxToolRoundtrips = _nullishCoalesce(_optionalChain([this, 'access', _41 => _41.options, 'optionalAccess', _42 => _42.maxToolRoundtrips]), () => ( 1));
1157
- 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));
1158
1179
  if (toolRoundtrips > maxToolRoundtrips) {
1159
1180
  updateMessage({
1160
1181
  status: {
@@ -1393,7 +1414,7 @@ var getThreadMessageText = (message) => {
1393
1414
 
1394
1415
  // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
1395
1416
  var hasUpcomingMessage = (isRunning, messages) => {
1396
- 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";
1397
1418
  };
1398
1419
  var ExternalStoreThreadRuntime = (_class7 = class {
1399
1420
  __init18() {this._subscriptions = /* @__PURE__ */ new Set()}
@@ -1461,7 +1482,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1461
1482
  for (let i = 0; i < messages.length; i++) {
1462
1483
  const message = messages[i];
1463
1484
  const parent = messages[i - 1];
1464
- 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);
1465
1486
  }
1466
1487
  if (this.assistantOptimisticId) {
1467
1488
  this.repository.deleteMessage(this.assistantOptimisticId);
@@ -1469,7 +1490,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1469
1490
  }
1470
1491
  if (hasUpcomingMessage(isRunning, messages)) {
1471
1492
  this.assistantOptimisticId = this.repository.appendOptimisticMessage(
1472
- _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)),
1473
1494
  {
1474
1495
  role: "assistant",
1475
1496
  content: []
@@ -1477,7 +1498,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1477
1498
  );
1478
1499
  }
1479
1500
  this.repository.resetHead(
1480
- _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))
1481
1502
  );
1482
1503
  this.messages = this.repository.getMessages();
1483
1504
  this.notifySubscribers();
@@ -1495,7 +1516,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1495
1516
  this.updateMessages(this.repository.getMessages());
1496
1517
  }
1497
1518
  async append(message) {
1498
- 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)))) {
1499
1520
  if (!this._store.onEdit)
1500
1521
  throw new Error("Runtime does not support editing messages.");
1501
1522
  await this._store.onEdit(message);
@@ -1518,7 +1539,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1518
1539
  }
1519
1540
  let messages = this.repository.getMessages();
1520
1541
  const previousMessage = messages[messages.length - 1];
1521
- 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])) {
1522
1543
  this.repository.deleteMessage(previousMessage.id);
1523
1544
  if (!this.composer.text.trim()) {
1524
1545
  this.composer.setText(getThreadMessageText(previousMessage));
@@ -1536,7 +1557,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
1536
1557
  return () => this._subscriptions.delete(callback);
1537
1558
  }
1538
1559
  __init26() {this.updateMessages = (messages) => {
1539
- _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(
1540
1561
  messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
1541
1562
  )]);
1542
1563
  }}
@@ -1700,7 +1721,7 @@ var AssistantRuntimeProvider = _react.memo.call(void 0, AssistantRuntimeProvider
1700
1721
  var MessageContext = _react.createContext.call(void 0, null);
1701
1722
  function useMessageContext(options) {
1702
1723
  const context = _react.useContext.call(void 0, MessageContext);
1703
- if (!_optionalChain([options, 'optionalAccess', _68 => _68.optional]) && !context)
1724
+ if (!_optionalChain([options, 'optionalAccess', _75 => _75.optional]) && !context)
1704
1725
  throw new Error(
1705
1726
  "This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
1706
1727
  );
@@ -1727,7 +1748,7 @@ var ContentPartContext = _react.createContext.call(void 0,
1727
1748
  );
1728
1749
  function useContentPartContext(options) {
1729
1750
  const context = _react.useContext.call(void 0, ContentPartContext);
1730
- if (!_optionalChain([options, 'optionalAccess', _69 => _69.optional]) && !context)
1751
+ if (!_optionalChain([options, 'optionalAccess', _76 => _76.optional]) && !context)
1731
1752
  throw new Error(
1732
1753
  "This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
1733
1754
  );
@@ -1739,13 +1760,13 @@ function useContentPartContext(options) {
1739
1760
  var toAppendMessage = (useThreadMessages, message) => {
1740
1761
  if (typeof message === "string") {
1741
1762
  return {
1742
- 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)),
1743
1764
  role: "user",
1744
1765
  content: [{ type: "text", text: message }]
1745
1766
  };
1746
1767
  }
1747
1768
  return {
1748
- 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)),
1749
1770
  role: _nullishCoalesce(message.role, () => ( "user")),
1750
1771
  content: message.content
1751
1772
  };
@@ -1797,7 +1818,7 @@ var useAssistantTool = (tool) => {
1797
1818
  const unsub2 = render ? setToolUI(toolName, render) : void 0;
1798
1819
  return () => {
1799
1820
  unsub1();
1800
- _optionalChain([unsub2, 'optionalCall', _80 => _80()]);
1821
+ _optionalChain([unsub2, 'optionalCall', _87 => _87()]);
1801
1822
  };
1802
1823
  }, [registerModelConfigProvider, setToolUI, tool]);
1803
1824
  };
@@ -2226,7 +2247,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
2226
2247
  ...primitiveProps,
2227
2248
  ref: forwardedRef,
2228
2249
  onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
2229
- _optionalChain([callback, 'optionalCall', _81 => _81()]);
2250
+ _optionalChain([callback, 'optionalCall', _88 => _88()]);
2230
2251
  })
2231
2252
  }
2232
2253
  );
@@ -2534,7 +2555,7 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
2534
2555
  }
2535
2556
  }
2536
2557
  const status = toContentPartStatus(message, partIndex, part);
2537
- const currentState = _optionalChain([useContentPart, 'optionalAccess', _82 => _82.getState, 'call', _83 => _83()]);
2558
+ const currentState = _optionalChain([useContentPart, 'optionalAccess', _89 => _89.getState, 'call', _90 => _90()]);
2538
2559
  if (currentState && currentState.part === part && currentState.status === status)
2539
2560
  return null;
2540
2561
  return Object.freeze({ part, status });
@@ -2682,7 +2703,7 @@ var MessageContentPartImpl = ({
2682
2703
  };
2683
2704
  var MessageContentPart = _react.memo.call(void 0,
2684
2705
  MessageContentPartImpl,
2685
- (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])
2686
2707
  );
2687
2708
  var MessagePrimitiveContent = ({
2688
2709
  components
@@ -2797,7 +2818,7 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
2797
2818
  const { isRunning } = useThread.getState();
2798
2819
  if (!isRunning) {
2799
2820
  e.preventDefault();
2800
- _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()]);
2801
2822
  }
2802
2823
  }
2803
2824
  };
@@ -3100,15 +3121,15 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => ({
3100
3121
  // src/context/providers/MessageProvider.tsx
3101
3122
 
3102
3123
  var getIsLast = (messages, message) => {
3103
- 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;
3104
3125
  };
3105
3126
  var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
3106
- 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));
3107
3128
  const message = messages[messageIndex];
3108
3129
  if (!message) return null;
3109
3130
  const isLast = getIsLast(messages, message);
3110
3131
  const branches = getBranches(message.id);
3111
- const currentState = _optionalChain([useMessage, 'optionalAccess', _109 => _109.getState, 'call', _110 => _110()]);
3132
+ const currentState = _optionalChain([useMessage, 'optionalAccess', _116 => _116.getState, 'call', _117 => _117()]);
3112
3133
  if (currentState && currentState.message === message && currentState.parentId === parentId && currentState.branches === branches && currentState.isLast === isLast)
3113
3134
  return null;
3114
3135
  return Object.freeze({
@@ -3235,7 +3256,7 @@ var ThreadPrimitiveMessagesImpl = ({
3235
3256
  ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
3236
3257
  var ThreadPrimitiveMessages = _react.memo.call(void 0,
3237
3258
  ThreadPrimitiveMessagesImpl,
3238
- (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])
3239
3260
  );
3240
3261
 
3241
3262
  // src/primitives/thread/ThreadScrollToBottom.tsx
@@ -3267,7 +3288,7 @@ var ThreadConfigProvider = ({
3267
3288
  }) => {
3268
3289
  const assistant = useAssistantContext({ optional: true });
3269
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 });
3270
- if (!_optionalChain([config, 'optionalAccess', _131 => _131.runtime])) return configProvider;
3291
+ if (!_optionalChain([config, 'optionalAccess', _138 => _138.runtime])) return configProvider;
3271
3292
  if (assistant) {
3272
3293
  throw new Error(
3273
3294
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
@@ -3483,7 +3504,7 @@ var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: comp
3483
3504
  {
3484
3505
  components: {
3485
3506
  ...componentsProp,
3486
- 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))
3487
3508
  }
3488
3509
  }
3489
3510
  ) });
@@ -3660,7 +3681,7 @@ var ThreadWelcomeSuggestion = ({
3660
3681
  };
3661
3682
  var ThreadWelcomeSuggestions = () => {
3662
3683
  const { welcome: { suggestions } = {} } = useThreadConfig();
3663
- 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) => {
3664
3685
  const key = `${suggestion.prompt}-${idx}`;
3665
3686
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
3666
3687
  })]) });
@@ -3738,7 +3759,7 @@ var UserMessageContent = _react.forwardRef.call(void 0,
3738
3759
  {
3739
3760
  components: {
3740
3761
  ...components,
3741
- 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))
3742
3763
  }
3743
3764
  }
3744
3765
  ) });
@@ -3840,10 +3861,10 @@ var ThreadMessages = ({ components, ...rest }) => {
3840
3861
  thread_exports.Messages,
3841
3862
  {
3842
3863
  components: {
3843
- UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _136 => _136.UserMessage]), () => ( user_message_default)),
3844
- EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _137 => _137.EditComposer]), () => ( edit_composer_default)),
3845
- AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _138 => _138.AssistantMessage]), () => ( assistant_message_default)),
3846
- 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))
3847
3868
  },
3848
3869
  ...rest
3849
3870
  }
@@ -4021,5 +4042,5 @@ var assistant_modal_default = Object.assign(AssistantModal, exports11);
4021
4042
 
4022
4043
 
4023
4044
 
4024
- 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 = _chunkJKRONBQKjs.toCoreMessage; exports.toCoreMessages = _chunkJKRONBQKjs.toCoreMessages; exports.toLanguageModelMessages = _chunkJKRONBQKjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkJKRONBQKjs.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;
4025
4046
  //# sourceMappingURL=index.js.map