@assistant-ui/react 0.5.79 → 0.5.81

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 _chunkKVXP3Q6Kjs = require('./chunk-KVXP3Q6K.js');
12
+ var _chunkCYIFAX4Ujs = require('./chunk-CYIFAX4U.js');
13
13
 
14
14
 
15
15
  var _chunkPZ5AY32Cjs = require('./chunk-PZ5AY32C.js');
@@ -3105,7 +3105,7 @@ var DefaultThreadComposerRuntimeCore = (_class8 = class extends BaseComposerRunt
3105
3105
  var ProxyConfigProvider = (_class9 = class {constructor() { _class9.prototype.__init17.call(this); }
3106
3106
  __init17() {this._providers = /* @__PURE__ */ new Set()}
3107
3107
  getModelConfig() {
3108
- return _chunkKVXP3Q6Kjs.mergeModelConfigs.call(void 0, this._providers);
3108
+ return _chunkCYIFAX4Ujs.mergeModelConfigs.call(void 0, this._providers);
3109
3109
  }
3110
3110
  registerModelConfigProvider(provider) {
3111
3111
  this._providers.add(provider);
@@ -3880,14 +3880,14 @@ function streamPartDecoderStream() {
3880
3880
  controller.enqueue(decodeStreamPart(chunk));
3881
3881
  }
3882
3882
  });
3883
- return new (0, _chunkKVXP3Q6Kjs.PipeableTransformStream)((readable) => {
3883
+ return new (0, _chunkCYIFAX4Ujs.PipeableTransformStream)((readable) => {
3884
3884
  return readable.pipeThrough(new TextDecoderStream()).pipeThrough(chunkByLineStream()).pipeThrough(decodeStream);
3885
3885
  });
3886
3886
  }
3887
3887
 
3888
3888
  // src/runtimes/edge/streams/utils/index.ts
3889
3889
  var streamUtils = {
3890
- streamPartEncoderStream: _chunkKVXP3Q6Kjs.streamPartEncoderStream,
3890
+ streamPartEncoderStream: _chunkCYIFAX4Ujs.streamPartEncoderStream,
3891
3891
  streamPartDecoderStream
3892
3892
  };
3893
3893
 
@@ -3922,12 +3922,21 @@ function assistantDecoderStream() {
3922
3922
  const { toolCallId: id, toolName: name } = value;
3923
3923
  toolCallNames.set(id, name);
3924
3924
  currentToolCall = { id, name, argsText: "" };
3925
+ controller.enqueue({
3926
+ type: "tool-call-delta",
3927
+ toolCallType: "function",
3928
+ toolCallId: id,
3929
+ toolName: name,
3930
+ argsTextDelta: ""
3931
+ });
3925
3932
  break;
3926
3933
  }
3927
3934
  case "c" /* ToolCallDelta */: {
3928
3935
  const { toolCallId, argsTextDelta } = value;
3929
3936
  const toolName = toolCallNames.get(toolCallId);
3930
- currentToolCall.argsText += argsTextDelta;
3937
+ if (_optionalChain([currentToolCall, 'optionalAccess', _192 => _192.id]) === toolCallId) {
3938
+ currentToolCall.argsText += argsTextDelta;
3939
+ }
3931
3940
  controller.enqueue({
3932
3941
  type: "tool-call-delta",
3933
3942
  toolCallType: "function",
@@ -4026,8 +4035,8 @@ var EdgeChatAdapter = class {
4026
4035
  credentials: _nullishCoalesce(this.options.credentials, () => ( "same-origin")),
4027
4036
  body: JSON.stringify({
4028
4037
  system: config.system,
4029
- messages: _chunkKVXP3Q6Kjs.toCoreMessages.call(void 0, messages2),
4030
- tools: config.tools ? _chunkKVXP3Q6Kjs.toLanguageModelTools.call(void 0, config.tools) : [],
4038
+ messages: _chunkCYIFAX4Ujs.toCoreMessages.call(void 0, messages2),
4039
+ tools: config.tools ? _chunkCYIFAX4Ujs.toLanguageModelTools.call(void 0, config.tools) : [],
4031
4040
  ...config.callSettings,
4032
4041
  ...config.config,
4033
4042
  ...this.options.body
@@ -4037,7 +4046,7 @@ var EdgeChatAdapter = class {
4037
4046
  if (!result.ok) {
4038
4047
  throw new Error(`Status ${result.status}: ${await result.text()}`);
4039
4048
  }
4040
- const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(_chunkKVXP3Q6Kjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkKVXP3Q6Kjs.runResultStream.call(void 0, ));
4049
+ const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(_chunkCYIFAX4Ujs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkCYIFAX4Ujs.runResultStream.call(void 0, ));
4041
4050
  let update;
4042
4051
  for await (update of asAsyncIterable(stream)) {
4043
4052
  yield update;
@@ -4069,7 +4078,7 @@ var useEdgeRuntime = (options) => {
4069
4078
  };
4070
4079
 
4071
4080
  // src/runtimes/local/shouldContinue.tsx
4072
- var shouldContinue = (result) => _optionalChain([result, 'access', _192 => _192.status, 'optionalAccess', _193 => _193.type]) === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
4081
+ var shouldContinue = (result) => _optionalChain([result, 'access', _193 => _193.status, 'optionalAccess', _194 => _194.type]) === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
4073
4082
 
4074
4083
  // src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx
4075
4084
  var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
@@ -4089,7 +4098,7 @@ var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
4089
4098
  return true;
4090
4099
  }
4091
4100
  getAttachmentAdapter() {
4092
- return _optionalChain([this, 'access', _194 => _194.runtime, 'access', _195 => _195.adapters, 'optionalAccess', _196 => _196.attachments]);
4101
+ return _optionalChain([this, 'access', _195 => _195.runtime, 'access', _196 => _196.adapters, 'optionalAccess', _197 => _197.attachments]);
4093
4102
  }
4094
4103
 
4095
4104
 
@@ -4167,7 +4176,7 @@ var BaseThreadRuntimeCore = (_class12 = class {
4167
4176
  return this._submittedFeedback[messageId];
4168
4177
  }
4169
4178
  submitFeedback({ messageId, type }) {
4170
- const adapter = _optionalChain([this, 'access', _197 => _197.adapters, 'optionalAccess', _198 => _198.feedback]);
4179
+ const adapter = _optionalChain([this, 'access', _198 => _198.adapters, 'optionalAccess', _199 => _199.feedback]);
4171
4180
  if (!adapter) throw new Error("Feedback adapter not configured");
4172
4181
  const { message } = this.repository.getMessage(messageId);
4173
4182
  adapter.submit({ message, type });
@@ -4177,10 +4186,10 @@ var BaseThreadRuntimeCore = (_class12 = class {
4177
4186
 
4178
4187
 
4179
4188
  speak(messageId) {
4180
- const adapter = _optionalChain([this, 'access', _199 => _199.adapters, 'optionalAccess', _200 => _200.speech]);
4189
+ const adapter = _optionalChain([this, 'access', _200 => _200.adapters, 'optionalAccess', _201 => _201.speech]);
4181
4190
  if (!adapter) throw new Error("Speech adapter not configured");
4182
4191
  const { message } = this.repository.getMessage(messageId);
4183
- _optionalChain([this, 'access', _201 => _201._stopSpeaking, 'optionalCall', _202 => _202()]);
4192
+ _optionalChain([this, 'access', _202 => _202._stopSpeaking, 'optionalCall', _203 => _203()]);
4184
4193
  const utterance = adapter.speak(message);
4185
4194
  const unsub = utterance.subscribe(() => {
4186
4195
  if (utterance.status.type === "ended") {
@@ -4270,17 +4279,17 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4270
4279
  set options({ initialMessages, ...options }) {
4271
4280
  this._options = options;
4272
4281
  let hasUpdates = false;
4273
- const canSpeak = _optionalChain([options, 'access', _203 => _203.adapters, 'optionalAccess', _204 => _204.speech]) !== void 0;
4282
+ const canSpeak = _optionalChain([options, 'access', _204 => _204.adapters, 'optionalAccess', _205 => _205.speech]) !== void 0;
4274
4283
  if (this.capabilities.speech !== canSpeak) {
4275
4284
  this.capabilities.speech = canSpeak;
4276
4285
  hasUpdates = true;
4277
4286
  }
4278
- const canAttach = _optionalChain([options, 'access', _205 => _205.adapters, 'optionalAccess', _206 => _206.attachments]) !== void 0;
4287
+ const canAttach = _optionalChain([options, 'access', _206 => _206.adapters, 'optionalAccess', _207 => _207.attachments]) !== void 0;
4279
4288
  if (this.capabilities.attachments !== canAttach) {
4280
4289
  this.capabilities.attachments = canAttach;
4281
4290
  hasUpdates = true;
4282
4291
  }
4283
- const canFeedback = _optionalChain([options, 'access', _207 => _207.adapters, 'optionalAccess', _208 => _208.feedback]) !== void 0;
4292
+ const canFeedback = _optionalChain([options, 'access', _208 => _208.adapters, 'optionalAccess', _209 => _209.feedback]) !== void 0;
4284
4293
  if (this.capabilities.feedback !== canFeedback) {
4285
4294
  this.capabilities.feedback = canFeedback;
4286
4295
  hasUpdates = true;
@@ -4316,13 +4325,13 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4316
4325
  }
4317
4326
  async performRoundtrip(parentId, message) {
4318
4327
  const messages2 = this.repository.getMessages();
4319
- _optionalChain([this, 'access', _209 => _209.abortController, 'optionalAccess', _210 => _210.abort, 'call', _211 => _211()]);
4328
+ _optionalChain([this, 'access', _210 => _210.abortController, 'optionalAccess', _211 => _211.abort, 'call', _212 => _212()]);
4320
4329
  this.abortController = new AbortController();
4321
4330
  const initialContent = message.content;
4322
- const initialSteps = _optionalChain([message, 'access', _212 => _212.metadata, 'optionalAccess', _213 => _213.steps]);
4323
- const initalCustom = _optionalChain([message, 'access', _214 => _214.metadata, 'optionalAccess', _215 => _215.custom]);
4331
+ const initialSteps = _optionalChain([message, 'access', _213 => _213.metadata, 'optionalAccess', _214 => _214.steps]);
4332
+ const initalCustom = _optionalChain([message, 'access', _215 => _215.metadata, 'optionalAccess', _216 => _216.custom]);
4324
4333
  const updateMessage = (m) => {
4325
- const newSteps = _optionalChain([m, 'access', _216 => _216.metadata, 'optionalAccess', _217 => _217.steps]) || _optionalChain([m, 'access', _218 => _218.metadata, 'optionalAccess', _219 => _219.roundtrips]);
4334
+ const newSteps = _optionalChain([m, 'access', _217 => _217.metadata, 'optionalAccess', _218 => _218.steps]) || _optionalChain([m, 'access', _219 => _219.metadata, 'optionalAccess', _220 => _220.roundtrips]);
4326
4335
  const steps2 = newSteps ? [..._nullishCoalesce(initialSteps, () => ( [])), ...newSteps] : void 0;
4327
4336
  message = {
4328
4337
  ...message,
@@ -4334,7 +4343,7 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4334
4343
  metadata: {
4335
4344
  ...message.metadata,
4336
4345
  ...steps2 ? { roundtrips: steps2, steps: steps2 } : void 0,
4337
- ..._optionalChain([m, 'access', _220 => _220.metadata, 'optionalAccess', _221 => _221.custom]) ? {
4346
+ ..._optionalChain([m, 'access', _221 => _221.metadata, 'optionalAccess', _222 => _222.custom]) ? {
4338
4347
  custom: { ..._nullishCoalesce(initalCustom, () => ( {})), ...m.metadata.custom }
4339
4348
  } : void 0
4340
4349
  }
@@ -4344,7 +4353,7 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4344
4353
  this._notifySubscribers();
4345
4354
  };
4346
4355
  const maxSteps = this.options.maxSteps ? this.options.maxSteps : (_nullishCoalesce(this.options.maxToolRoundtrips, () => ( 1))) + 1;
4347
- const steps = _nullishCoalesce(_optionalChain([message, 'access', _222 => _222.metadata, 'optionalAccess', _223 => _223.steps, 'optionalAccess', _224 => _224.length]), () => ( 0));
4356
+ const steps = _nullishCoalesce(_optionalChain([message, 'access', _223 => _223.metadata, 'optionalAccess', _224 => _224.steps, 'optionalAccess', _225 => _225.length]), () => ( 0));
4348
4357
  if (steps >= maxSteps) {
4349
4358
  updateMessage({
4350
4359
  status: {
@@ -4396,7 +4405,7 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4396
4405
  return message;
4397
4406
  }
4398
4407
  cancelRun() {
4399
- _optionalChain([this, 'access', _225 => _225.abortController, 'optionalAccess', _226 => _226.abort, 'call', _227 => _227()]);
4408
+ _optionalChain([this, 'access', _226 => _226.abortController, 'optionalAccess', _227 => _227.abort, 'call', _228 => _228()]);
4400
4409
  this.abortController = null;
4401
4410
  }
4402
4411
  addToolResult({
@@ -4468,7 +4477,7 @@ var LocalRuntimeCore = class extends BaseAssistantRuntimeCore {
4468
4477
  const messages2 = fromCoreMessages(initialMessages);
4469
4478
  this.thread.import({
4470
4479
  messages: messages2.map((m, idx) => ({
4471
- parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _228 => _228[idx - 1], 'optionalAccess', _229 => _229.id]), () => ( null)),
4480
+ parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _229 => _229[idx - 1], 'optionalAccess', _230 => _230.id]), () => ( null)),
4472
4481
  message: m
4473
4482
  }))
4474
4483
  });
@@ -4608,7 +4617,7 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
4608
4617
  // src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx
4609
4618
  var EMPTY_ARRAY2 = Object.freeze([]);
4610
4619
  var hasUpcomingMessage = (isRunning, messages2) => {
4611
- return isRunning && _optionalChain([messages2, 'access', _230 => _230[messages2.length - 1], 'optionalAccess', _231 => _231.role]) !== "assistant";
4620
+ return isRunning && _optionalChain([messages2, 'access', _231 => _231[messages2.length - 1], 'optionalAccess', _232 => _232.role]) !== "assistant";
4612
4621
  };
4613
4622
  var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntimeCore {
4614
4623
  __init34() {this.assistantOptimisticId = null}
@@ -4664,11 +4673,11 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4664
4673
  edit: this._store.onEdit !== void 0,
4665
4674
  reload: this._store.onReload !== void 0,
4666
4675
  cancel: this._store.onCancel !== void 0,
4667
- speech: _optionalChain([this, 'access', _235 => _235._store, 'access', _236 => _236.adapters, 'optionalAccess', _237 => _237.speech]) !== void 0,
4668
- unstable_copy: _optionalChain([this, 'access', _238 => _238._store, 'access', _239 => _239.unstable_capabilities, 'optionalAccess', _240 => _240.copy]) !== false,
4676
+ speech: _optionalChain([this, 'access', _236 => _236._store, 'access', _237 => _237.adapters, 'optionalAccess', _238 => _238.speech]) !== void 0,
4677
+ unstable_copy: _optionalChain([this, 'access', _239 => _239._store, 'access', _240 => _240.unstable_capabilities, 'optionalAccess', _241 => _241.copy]) !== false,
4669
4678
  // default true
4670
- attachments: !!_optionalChain([this, 'access', _241 => _241.store, 'access', _242 => _242.adapters, 'optionalAccess', _243 => _243.attachments]),
4671
- feedback: !!_optionalChain([this, 'access', _244 => _244.store, 'access', _245 => _245.adapters, 'optionalAccess', _246 => _246.feedback])
4679
+ attachments: !!_optionalChain([this, 'access', _242 => _242.store, 'access', _243 => _243.adapters, 'optionalAccess', _244 => _244.attachments]),
4680
+ feedback: !!_optionalChain([this, 'access', _245 => _245.store, 'access', _246 => _246.adapters, 'optionalAccess', _247 => _247.feedback])
4672
4681
  };
4673
4682
  if (oldStore) {
4674
4683
  if (oldStore.convertMessage !== store.convertMessage) {
@@ -4695,7 +4704,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4695
4704
  for (let i = 0; i < messages2.length; i++) {
4696
4705
  const message = messages2[i];
4697
4706
  const parent = messages2[i - 1];
4698
- this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _247 => _247.id]), () => ( null)), message);
4707
+ this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _248 => _248.id]), () => ( null)), message);
4699
4708
  }
4700
4709
  if (this.assistantOptimisticId) {
4701
4710
  this.repository.deleteMessage(this.assistantOptimisticId);
@@ -4703,7 +4712,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4703
4712
  }
4704
4713
  if (hasUpcomingMessage(isRunning, messages2)) {
4705
4714
  this.assistantOptimisticId = this.repository.appendOptimisticMessage(
4706
- _nullishCoalesce(_optionalChain([messages2, 'access', _248 => _248.at, 'call', _249 => _249(-1), 'optionalAccess', _250 => _250.id]), () => ( null)),
4715
+ _nullishCoalesce(_optionalChain([messages2, 'access', _249 => _249.at, 'call', _250 => _250(-1), 'optionalAccess', _251 => _251.id]), () => ( null)),
4707
4716
  {
4708
4717
  role: "assistant",
4709
4718
  content: []
@@ -4711,7 +4720,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4711
4720
  );
4712
4721
  }
4713
4722
  this.repository.resetHead(
4714
- _nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages2, 'access', _251 => _251.at, 'call', _252 => _252(-1), 'optionalAccess', _253 => _253.id]))), () => ( null))
4723
+ _nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages2, 'access', _252 => _252.at, 'call', _253 => _253(-1), 'optionalAccess', _254 => _254.id]))), () => ( null))
4715
4724
  );
4716
4725
  this._messages = this.repository.getMessages();
4717
4726
  this._notifySubscribers();
@@ -4723,7 +4732,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4723
4732
  this.updateMessages(this.repository.getMessages());
4724
4733
  }
4725
4734
  async append(message) {
4726
- if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _254 => _254.messages, 'access', _255 => _255.at, 'call', _256 => _256(-1), 'optionalAccess', _257 => _257.id]), () => ( null)))) {
4735
+ if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _255 => _255.messages, 'access', _256 => _256.at, 'call', _257 => _257(-1), 'optionalAccess', _258 => _258.id]), () => ( null)))) {
4727
4736
  if (!this._store.onEdit)
4728
4737
  throw new Error("Runtime does not support editing messages.");
4729
4738
  await this._store.onEdit(message);
@@ -4746,7 +4755,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4746
4755
  }
4747
4756
  let messages2 = this.repository.getMessages();
4748
4757
  const previousMessage = messages2[messages2.length - 1];
4749
- if (_optionalChain([previousMessage, 'optionalAccess', _258 => _258.role]) === "user" && previousMessage.id === _optionalChain([messages2, 'access', _259 => _259.at, 'call', _260 => _260(-1), 'optionalAccess', _261 => _261.id])) {
4758
+ if (_optionalChain([previousMessage, 'optionalAccess', _259 => _259.role]) === "user" && previousMessage.id === _optionalChain([messages2, 'access', _260 => _260.at, 'call', _261 => _261(-1), 'optionalAccess', _262 => _262.id])) {
4750
4759
  this.repository.deleteMessage(previousMessage.id);
4751
4760
  if (!this.composer.text.trim()) {
4752
4761
  this.composer.setText(getThreadMessageText(previousMessage));
@@ -4765,7 +4774,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4765
4774
  this._store.onAddToolResult(options);
4766
4775
  }
4767
4776
  __init39() {this.updateMessages = (messages2) => {
4768
- _optionalChain([this, 'access', _262 => _262._store, 'access', _263 => _263.setMessages, 'optionalCall', _264 => _264(
4777
+ _optionalChain([this, 'access', _263 => _263._store, 'access', _264 => _264.setMessages, 'optionalCall', _265 => _265(
4769
4778
  messages2.flatMap(getExternalStoreMessage).filter((m) => m != null)
4770
4779
  )]);
4771
4780
  }}
@@ -4985,18 +4994,18 @@ var DangerousInBrowserAdapter = class {
4985
4994
  this.options = options;
4986
4995
  }
4987
4996
  async *run({ messages: messages2, abortSignal, config }) {
4988
- const res = await _chunkKVXP3Q6Kjs.getEdgeRuntimeStream.call(void 0, {
4997
+ const res = await _chunkCYIFAX4Ujs.getEdgeRuntimeStream.call(void 0, {
4989
4998
  options: this.options,
4990
4999
  abortSignal,
4991
5000
  requestData: {
4992
5001
  system: config.system,
4993
- messages: _chunkKVXP3Q6Kjs.toCoreMessages.call(void 0, messages2),
4994
- tools: config.tools ? _chunkKVXP3Q6Kjs.toLanguageModelTools.call(void 0, config.tools) : [],
5002
+ messages: _chunkCYIFAX4Ujs.toCoreMessages.call(void 0, messages2),
5003
+ tools: config.tools ? _chunkCYIFAX4Ujs.toLanguageModelTools.call(void 0, config.tools) : [],
4995
5004
  ...config.callSettings,
4996
5005
  ...config.config
4997
5006
  }
4998
5007
  });
4999
- const stream = res.pipeThrough(_chunkKVXP3Q6Kjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkKVXP3Q6Kjs.runResultStream.call(void 0, ));
5008
+ const stream = res.pipeThrough(_chunkCYIFAX4Ujs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkCYIFAX4Ujs.runResultStream.call(void 0, ));
5000
5009
  for await (const update of asAsyncIterable(stream)) {
5001
5010
  yield update;
5002
5011
  }
@@ -5216,7 +5225,7 @@ var ThreadConfigProvider = ({
5216
5225
  }) => {
5217
5226
  const hasAssistant = !!useAssistantRuntime({ optional: true });
5218
5227
  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 });
5219
- if (!_optionalChain([config, 'optionalAccess', _265 => _265.runtime])) return configProvider;
5228
+ if (!_optionalChain([config, 'optionalAccess', _266 => _266.runtime])) return configProvider;
5220
5229
  if (hasAssistant) {
5221
5230
  throw new Error(
5222
5231
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
@@ -5544,7 +5553,7 @@ var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: comp
5544
5553
  {
5545
5554
  components: {
5546
5555
  ...componentsProp,
5547
- Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _266 => _266.Text]), () => ( components.Text)), () => ( content_part_default.Text)),
5556
+ Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _267 => _267.Text]), () => ( components.Text)), () => ( content_part_default.Text)),
5548
5557
  tools: toolsComponents
5549
5558
  }
5550
5559
  }
@@ -5655,7 +5664,7 @@ var useAttachmentSrc = () => {
5655
5664
  const { file, src } = useAttachment((a) => {
5656
5665
  if (a.type !== "image") return {};
5657
5666
  if (a.file) return { file: a.file };
5658
- const src2 = _optionalChain([a, 'access', _267 => _267.content, 'optionalAccess', _268 => _268.filter, 'call', _269 => _269((c) => c.type === "image"), 'access', _270 => _270[0], 'optionalAccess', _271 => _271.image]);
5667
+ const src2 = _optionalChain([a, 'access', _268 => _268.content, 'optionalAccess', _269 => _269.filter, 'call', _270 => _270((c) => c.type === "image"), 'access', _271 => _271[0], 'optionalAccess', _272 => _272.image]);
5659
5668
  if (!src2) return {};
5660
5669
  return { src: src2 };
5661
5670
  });
@@ -5799,7 +5808,7 @@ var ComposerAttachments = ({ components }) => {
5799
5808
  {
5800
5809
  components: {
5801
5810
  ...components,
5802
- Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _272 => _272.Attachment]), () => ( attachment_default))
5811
+ Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _273 => _273.Attachment]), () => ( attachment_default))
5803
5812
  }
5804
5813
  }
5805
5814
  ) });
@@ -5927,7 +5936,7 @@ var ThreadWelcomeSuggestions = () => {
5927
5936
  const suggestions2 = useThread((t) => t.suggestions);
5928
5937
  const { welcome: { suggestions } = {} } = useThreadConfig();
5929
5938
  const finalSuggestions = suggestions2.length ? suggestions2 : suggestions;
5930
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([finalSuggestions, 'optionalAccess', _273 => _273.map, 'call', _274 => _274((suggestion, idx) => {
5939
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([finalSuggestions, 'optionalAccess', _274 => _274.map, 'call', _275 => _275((suggestion, idx) => {
5931
5940
  const key = `${suggestion.prompt}-${idx}`;
5932
5941
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
5933
5942
  })]) });
@@ -6005,7 +6014,7 @@ var UserMessageContent = _react.forwardRef.call(void 0, ({ components, ...props
6005
6014
  {
6006
6015
  components: {
6007
6016
  ...components,
6008
- Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _275 => _275.Text]), () => ( content_part_default.Text))
6017
+ Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _276 => _276.Text]), () => ( content_part_default.Text))
6009
6018
  }
6010
6019
  }
6011
6020
  ) });
@@ -6022,7 +6031,7 @@ var UserMessageAttachments = ({
6022
6031
  {
6023
6032
  components: {
6024
6033
  ...components,
6025
- Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _276 => _276.Attachment]), () => ( attachment_default))
6034
+ Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _277 => _277.Attachment]), () => ( attachment_default))
6026
6035
  }
6027
6036
  }
6028
6037
  ) }) });
@@ -6125,10 +6134,10 @@ var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ..
6125
6134
  thread_exports.Messages,
6126
6135
  {
6127
6136
  components: {
6128
- UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _277 => _277.UserMessage]), () => ( user_message_default)),
6129
- EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _278 => _278.EditComposer]), () => ( edit_composer_default)),
6130
- AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _279 => _279.AssistantMessage]), () => ( assistant_message_default)),
6131
- SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _280 => _280.SystemMessage]), () => ( SystemMessage))
6137
+ UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _278 => _278.UserMessage]), () => ( user_message_default)),
6138
+ EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _279 => _279.EditComposer]), () => ( edit_composer_default)),
6139
+ AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _280 => _280.AssistantMessage]), () => ( assistant_message_default)),
6140
+ SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _281 => _281.SystemMessage]), () => ( SystemMessage))
6132
6141
  },
6133
6142
  ...rest
6134
6143
  }
@@ -6139,7 +6148,7 @@ var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ..
6139
6148
  ThreadMessages.displayName = "ThreadMessages";
6140
6149
  var ThreadFollowupSuggestions = () => {
6141
6150
  const suggestions = useThread((t) => t.suggestions);
6142
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, thread_exports.If, { empty: false, running: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "aui-thread-followup-suggestions", children: _optionalChain([suggestions, 'optionalAccess', _281 => _281.map, 'call', _282 => _282((suggestion, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6151
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, thread_exports.If, { empty: false, running: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "aui-thread-followup-suggestions", children: _optionalChain([suggestions, 'optionalAccess', _282 => _282.map, 'call', _283 => _283((suggestion, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6143
6152
  thread_exports.Suggestion,
6144
6153
  {
6145
6154
  className: "aui-thread-followup-suggestion",
@@ -6372,5 +6381,5 @@ var assistant_modal_default = Object.assign(AssistantModal, exports12);
6372
6381
 
6373
6382
 
6374
6383
 
6375
- 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.AttachmentPrimitive = attachment_exports; exports.AttachmentUI = attachment_default; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerAttachment = attachment_default; exports.ComposerPrimitive = composer_exports; exports.CompositeAttachmentAdapter = CompositeAttachmentAdapter; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.SimpleImageAttachmentAdapter = SimpleImageAttachmentAdapter; exports.SimpleTextAttachmentAdapter = SimpleTextAttachmentAdapter; exports.TextContentPartProvider = TextContentPartProvider; 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.UserMessageAttachment = attachment_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 = _chunkKVXP3Q6Kjs.toCoreMessage; exports.toCoreMessages = _chunkKVXP3Q6Kjs.toCoreMessages; exports.toLanguageModelMessages = _chunkKVXP3Q6Kjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkKVXP3Q6Kjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarFeedbackNegative = useActionBarFeedbackNegative; exports.useActionBarFeedbackPositive = useActionBarFeedbackPositive; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantActions = useAssistantActions; exports.useAssistantActionsStore = useAssistantActionsStore; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantRuntime = useAssistantRuntime; exports.useAssistantRuntimeStore = useAssistantRuntimeStore; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposer = useComposer; exports.useComposerAddAttachment = useComposerAddAttachment; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerRuntime = useComposerRuntime; exports.useComposerSend = useComposerSend; exports.useComposerStore = useComposerStore; exports.useContentPart = useContentPart; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartRuntime = useContentPartRuntime; exports.useContentPartStore = useContentPartStore; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useEditComposer = useEditComposer; exports.useEditComposerStore = useEditComposerStore; exports.useExternalMessageConverter = useExternalMessageConverter; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessage = useMessage; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useMessageRuntime = useMessageRuntime; exports.useMessageStore = useMessageStore; exports.useMessageUtils = useMessageUtils; exports.useMessageUtilsStore = useMessageUtilsStore; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThread = useThread; exports.useThreadActions = useThreadActions; exports.useThreadActionsStore = useThreadActionsStore; exports.useThreadComposer = useThreadComposer; exports.useThreadComposerStore = useThreadComposerStore; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadMessages = useThreadMessages; exports.useThreadMessagesStore = useThreadMessagesStore; exports.useThreadRuntime = useThreadRuntime; exports.useThreadRuntimeStore = useThreadRuntimeStore; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadStore = useThreadStore; exports.useThreadSuggestion = useThreadSuggestion; exports.useThreadViewport = useThreadViewport; exports.useThreadViewportStore = useThreadViewportStore; exports.useToolUIs = useToolUIs; exports.useToolUIsStore = useToolUIsStore;
6384
+ 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.AttachmentPrimitive = attachment_exports; exports.AttachmentUI = attachment_default; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerAttachment = attachment_default; exports.ComposerPrimitive = composer_exports; exports.CompositeAttachmentAdapter = CompositeAttachmentAdapter; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.SimpleImageAttachmentAdapter = SimpleImageAttachmentAdapter; exports.SimpleTextAttachmentAdapter = SimpleTextAttachmentAdapter; exports.TextContentPartProvider = TextContentPartProvider; 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.UserMessageAttachment = attachment_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 = _chunkCYIFAX4Ujs.toCoreMessage; exports.toCoreMessages = _chunkCYIFAX4Ujs.toCoreMessages; exports.toLanguageModelMessages = _chunkCYIFAX4Ujs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkCYIFAX4Ujs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarFeedbackNegative = useActionBarFeedbackNegative; exports.useActionBarFeedbackPositive = useActionBarFeedbackPositive; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantActions = useAssistantActions; exports.useAssistantActionsStore = useAssistantActionsStore; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantRuntime = useAssistantRuntime; exports.useAssistantRuntimeStore = useAssistantRuntimeStore; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposer = useComposer; exports.useComposerAddAttachment = useComposerAddAttachment; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerRuntime = useComposerRuntime; exports.useComposerSend = useComposerSend; exports.useComposerStore = useComposerStore; exports.useContentPart = useContentPart; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartRuntime = useContentPartRuntime; exports.useContentPartStore = useContentPartStore; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useEditComposer = useEditComposer; exports.useEditComposerStore = useEditComposerStore; exports.useExternalMessageConverter = useExternalMessageConverter; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessage = useMessage; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useMessageRuntime = useMessageRuntime; exports.useMessageStore = useMessageStore; exports.useMessageUtils = useMessageUtils; exports.useMessageUtilsStore = useMessageUtilsStore; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThread = useThread; exports.useThreadActions = useThreadActions; exports.useThreadActionsStore = useThreadActionsStore; exports.useThreadComposer = useThreadComposer; exports.useThreadComposerStore = useThreadComposerStore; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadMessages = useThreadMessages; exports.useThreadMessagesStore = useThreadMessagesStore; exports.useThreadRuntime = useThreadRuntime; exports.useThreadRuntimeStore = useThreadRuntimeStore; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadStore = useThreadStore; exports.useThreadSuggestion = useThreadSuggestion; exports.useThreadViewport = useThreadViewport; exports.useThreadViewportStore = useThreadViewportStore; exports.useToolUIs = useToolUIs; exports.useToolUIsStore = useToolUIsStore;
6376
6385
  //# sourceMappingURL=index.js.map