@assistant-ui/react 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -45,6 +45,7 @@ __export(src_exports, {
45
45
  ContentPartPrimitive: () => contentPart_exports,
46
46
  EdgeChatAdapter: () => EdgeChatAdapter,
47
47
  EditComposer: () => edit_composer_default,
48
+ ExternalStoreRuntime: () => ExternalStoreRuntime,
48
49
  INTERNAL: () => internal_exports,
49
50
  MessagePrimitive: () => message_exports,
50
51
  Thread: () => thread_default,
@@ -57,6 +58,7 @@ __export(src_exports, {
57
58
  fromCoreMessages: () => fromCoreMessages,
58
59
  fromLanguageModelMessages: () => fromLanguageModelMessages,
59
60
  fromLanguageModelTools: () => fromLanguageModelTools,
61
+ getExternalStoreMessage: () => getExternalStoreMessage,
60
62
  makeAssistantTool: () => makeAssistantTool,
61
63
  makeAssistantToolUI: () => makeAssistantToolUI,
62
64
  toCoreMessage: () => toCoreMessage,
@@ -84,6 +86,7 @@ __export(src_exports, {
84
86
  useContentPartImage: () => useContentPartImage,
85
87
  useContentPartText: () => useContentPartText,
86
88
  useEdgeRuntime: () => useEdgeRuntime,
89
+ useExternalStoreRuntime: () => useExternalStoreRuntime,
87
90
  useLocalRuntime: () => useLocalRuntime,
88
91
  useMessageContext: () => useMessageContext,
89
92
  useMessageIf: () => useMessageIf,
@@ -3410,9 +3413,7 @@ var EdgeChatAdapter = class {
3410
3413
  signal: abortSignal
3411
3414
  });
3412
3415
  if (result.status !== 200) {
3413
- throw new Error(
3414
- `Edge runtime returned status ${result.status}: ${await result.text()}`
3415
- );
3416
+ throw new Error(`Status ${result.status}: ${await result.text()}`);
3416
3417
  }
3417
3418
  const stream = result.body.pipeThrough(new TextDecoderStream()).pipeThrough(chunkByLineStream()).pipeThrough(assistantDecoderStream()).pipeThrough(toolResultStream(config.tools)).pipeThrough(runResultStream());
3418
3419
  let update;
@@ -3643,12 +3644,219 @@ var useLocalRuntime = (adapter, options) => {
3643
3644
  return runtime;
3644
3645
  };
3645
3646
 
3646
- // src/ui/thread-config.tsx
3647
+ // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
3648
+ var import_zustand14 = require("zustand");
3649
+
3650
+ // src/runtimes/external-store/getExternalStoreMessage.tsx
3651
+ var symbolInnerMessage = Symbol("innerMessage");
3652
+ var getExternalStoreMessage = (message) => {
3653
+ return message[symbolInnerMessage];
3654
+ };
3655
+
3656
+ // src/runtimes/external-store/useExternalStoreSync.tsx
3647
3657
  var import_react55 = require("react");
3658
+
3659
+ // src/runtimes/external-store/ThreadMessageConverter.ts
3660
+ var ThreadMessageConverter = class {
3661
+ cache = /* @__PURE__ */ new WeakMap();
3662
+ convertMessages(messages, converter, keyMapper = (key) => key) {
3663
+ return messages.map((m, idx) => {
3664
+ const key = keyMapper(m);
3665
+ const cached = this.cache.get(key);
3666
+ const newMessage = converter(cached, m, idx);
3667
+ this.cache.set(key, newMessage);
3668
+ return newMessage;
3669
+ });
3670
+ }
3671
+ };
3672
+
3673
+ // src/runtimes/external-store/useExternalStoreSync.tsx
3674
+ var useExternalStoreSync = (adapter, updateData) => {
3675
+ const [converter, convertCallback] = (0, import_react55.useMemo)(() => {
3676
+ const converter2 = adapter.convertMessage ?? ((m) => m);
3677
+ const convertCallback2 = (cache, m, idx) => {
3678
+ if (cache) return cache;
3679
+ const newMessage = converter2(m, idx);
3680
+ newMessage[symbolInnerMessage] = m;
3681
+ return newMessage;
3682
+ };
3683
+ return [new ThreadMessageConverter(), convertCallback2];
3684
+ }, [adapter.convertMessage]);
3685
+ (0, import_react55.useEffect)(() => {
3686
+ updateData(
3687
+ adapter.isRunning ?? false,
3688
+ converter.convertMessages(adapter.messages, convertCallback)
3689
+ );
3690
+ }, [
3691
+ updateData,
3692
+ converter,
3693
+ convertCallback,
3694
+ adapter.messages,
3695
+ adapter.isRunning
3696
+ ]);
3697
+ };
3698
+
3699
+ // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
3700
+ var hasUpcomingMessage = (isRunning, messages) => {
3701
+ return isRunning && messages[messages.length - 1]?.role !== "assistant";
3702
+ };
3703
+ var ExternalStoreThreadRuntime = class {
3704
+ constructor(store) {
3705
+ this.store = store;
3706
+ this.useStore = (0, import_zustand14.create)(() => ({
3707
+ store
3708
+ }));
3709
+ }
3710
+ _subscriptions = /* @__PURE__ */ new Set();
3711
+ repository = new MessageRepository();
3712
+ assistantOptimisticId = null;
3713
+ useStore;
3714
+ get capabilities() {
3715
+ return {
3716
+ edit: this.store.onEdit !== void 0,
3717
+ reload: this.store.onReload !== void 0,
3718
+ cancel: this.store.onCancel !== void 0,
3719
+ copy: true
3720
+ };
3721
+ }
3722
+ messages = [];
3723
+ isRunning = false;
3724
+ getBranches(messageId) {
3725
+ return this.repository.getBranches(messageId);
3726
+ }
3727
+ switchToBranch(branchId) {
3728
+ this.repository.switchToBranch(branchId);
3729
+ this.updateMessages(this.repository.getMessages());
3730
+ }
3731
+ async append(message) {
3732
+ if (message.parentId !== (this.messages.at(-1)?.id ?? null)) {
3733
+ if (!this.store.onEdit)
3734
+ throw new Error("Runtime does not support editing messages.");
3735
+ await this.store.onEdit(message);
3736
+ } else {
3737
+ await this.store.onNew(message);
3738
+ }
3739
+ }
3740
+ async startRun(parentId) {
3741
+ if (!this.store.onReload)
3742
+ throw new Error("Runtime does not support reloading messages.");
3743
+ await this.store.onReload(parentId);
3744
+ }
3745
+ cancelRun() {
3746
+ if (!this.store.onCancel)
3747
+ throw new Error("Runtime does not support cancelling runs.");
3748
+ this.store.onCancel();
3749
+ if (this.assistantOptimisticId) {
3750
+ this.repository.deleteMessage(this.assistantOptimisticId);
3751
+ this.assistantOptimisticId = null;
3752
+ }
3753
+ let messages = this.repository.getMessages();
3754
+ setTimeout(() => {
3755
+ this.updateMessages(messages);
3756
+ }, 0);
3757
+ }
3758
+ subscribe(callback) {
3759
+ this._subscriptions.add(callback);
3760
+ return () => this._subscriptions.delete(callback);
3761
+ }
3762
+ updateMessages = (messages) => {
3763
+ this.store.setMessages?.(
3764
+ messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
3765
+ );
3766
+ };
3767
+ onStoreUpdated() {
3768
+ if (this.useStore.getState().store !== this.store) {
3769
+ this.useStore.setState({ store: this.store });
3770
+ }
3771
+ }
3772
+ updateData = (isRunning, vm) => {
3773
+ for (let i = 0; i < vm.length; i++) {
3774
+ const message = vm[i];
3775
+ const parent = vm[i - 1];
3776
+ this.repository.addOrUpdateMessage(parent?.id ?? null, message);
3777
+ }
3778
+ if (this.assistantOptimisticId) {
3779
+ this.repository.deleteMessage(this.assistantOptimisticId);
3780
+ this.assistantOptimisticId = null;
3781
+ }
3782
+ if (hasUpcomingMessage(isRunning, vm)) {
3783
+ this.assistantOptimisticId = this.repository.appendOptimisticMessage(
3784
+ vm.at(-1)?.id ?? null,
3785
+ {
3786
+ role: "assistant",
3787
+ content: []
3788
+ }
3789
+ );
3790
+ }
3791
+ this.repository.resetHead(
3792
+ this.assistantOptimisticId ?? vm.at(-1)?.id ?? null
3793
+ );
3794
+ this.messages = this.repository.getMessages();
3795
+ this.isRunning = isRunning;
3796
+ for (const callback of this._subscriptions) callback();
3797
+ };
3798
+ unstable_synchronizer = () => {
3799
+ const { store } = this.useStore();
3800
+ useExternalStoreSync(store, this.updateData);
3801
+ return null;
3802
+ };
3803
+ addToolResult(options) {
3804
+ if (!this.store.onAddToolResult)
3805
+ throw new Error("Runtime does not support tool results.");
3806
+ this.store.onAddToolResult(options);
3807
+ }
3808
+ };
3809
+
3810
+ // src/runtimes/external-store/ExternalStoreRuntime.tsx
3811
+ var ExternalStoreRuntime = class extends BaseAssistantRuntime {
3812
+ _proxyConfigProvider = new ProxyConfigProvider();
3813
+ constructor(store) {
3814
+ super(new ExternalStoreThreadRuntime(store));
3815
+ }
3816
+ set store(store) {
3817
+ this.thread.store = store;
3818
+ }
3819
+ onStoreUpdated() {
3820
+ return this.thread.onStoreUpdated();
3821
+ }
3822
+ getModelConfig() {
3823
+ return this._proxyConfigProvider.getModelConfig();
3824
+ }
3825
+ registerModelConfigProvider(provider) {
3826
+ return this._proxyConfigProvider.registerModelConfigProvider(provider);
3827
+ }
3828
+ switchToThread(threadId) {
3829
+ if (threadId) {
3830
+ if (!this.store.onSwitchThread)
3831
+ throw new Error("Runtime does not support switching threads.");
3832
+ return this.store.onSwitchThread(threadId);
3833
+ } else {
3834
+ if (!this.store.onNewThread)
3835
+ throw new Error("Runtime does not support switching to new threads.");
3836
+ return this.store.onNewThread();
3837
+ }
3838
+ }
3839
+ };
3840
+
3841
+ // src/runtimes/external-store/useExternalStoreRuntime.tsx
3842
+ var import_react56 = require("react");
3843
+ var useExternalStoreRuntime = (store) => {
3844
+ const [runtime] = (0, import_react56.useState)(() => new ExternalStoreRuntime(store));
3845
+ (0, import_react56.useInsertionEffect)(() => {
3846
+ runtime.store = store;
3847
+ });
3848
+ (0, import_react56.useEffect)(() => {
3849
+ runtime.onStoreUpdated();
3850
+ });
3851
+ return runtime;
3852
+ };
3853
+
3854
+ // src/ui/thread-config.tsx
3855
+ var import_react57 = require("react");
3648
3856
  var import_jsx_runtime29 = require("react/jsx-runtime");
3649
- var ThreadConfigContext = (0, import_react55.createContext)({});
3857
+ var ThreadConfigContext = (0, import_react57.createContext)({});
3650
3858
  var useThreadConfig = () => {
3651
- return (0, import_react55.useContext)(ThreadConfigContext);
3859
+ return (0, import_react57.useContext)(ThreadConfigContext);
3652
3860
  };
3653
3861
  var ThreadConfigProvider = ({
3654
3862
  children,
@@ -3667,7 +3875,7 @@ var ThreadConfigProvider = ({
3667
3875
  ThreadConfigProvider.displayName = "ThreadConfigProvider";
3668
3876
 
3669
3877
  // src/ui/assistant-action-bar.tsx
3670
- var import_react56 = require("react");
3878
+ var import_react58 = require("react");
3671
3879
  var import_lucide_react = require("lucide-react");
3672
3880
  var import_jsx_runtime30 = require("react/jsx-runtime");
3673
3881
  var useAllowCopy = () => {
@@ -3704,7 +3912,7 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
3704
3912
  className: "aui-assistant-action-bar-root"
3705
3913
  });
3706
3914
  AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
3707
- var AssistantActionBarCopy = (0, import_react56.forwardRef)((props, ref) => {
3915
+ var AssistantActionBarCopy = (0, import_react58.forwardRef)((props, ref) => {
3708
3916
  const {
3709
3917
  strings: {
3710
3918
  assistantMessage: { reload: { tooltip = "Copy" } = {} } = {}
@@ -3718,7 +3926,7 @@ var AssistantActionBarCopy = (0, import_react56.forwardRef)((props, ref) => {
3718
3926
  ] }) }) });
3719
3927
  });
3720
3928
  AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
3721
- var AssistantActionBarReload = (0, import_react56.forwardRef)((props, ref) => {
3929
+ var AssistantActionBarReload = (0, import_react58.forwardRef)((props, ref) => {
3722
3930
  const {
3723
3931
  strings: {
3724
3932
  assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
@@ -3740,10 +3948,10 @@ var assistant_action_bar_default = Object.assign(
3740
3948
  );
3741
3949
 
3742
3950
  // src/ui/assistant-message.tsx
3743
- var import_react58 = require("react");
3951
+ var import_react60 = require("react");
3744
3952
 
3745
3953
  // src/ui/branch-picker.tsx
3746
- var import_react57 = require("react");
3954
+ var import_react59 = require("react");
3747
3955
  var import_lucide_react2 = require("lucide-react");
3748
3956
  var import_jsx_runtime31 = require("react/jsx-runtime");
3749
3957
  var BranchPicker = () => {
@@ -3758,7 +3966,7 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
3758
3966
  className: "aui-branch-picker-root"
3759
3967
  });
3760
3968
  BranchPickerRoot.displayName = "BranchPickerRoot";
3761
- var BranchPickerPrevious2 = (0, import_react57.forwardRef)((props, ref) => {
3969
+ var BranchPickerPrevious2 = (0, import_react59.forwardRef)((props, ref) => {
3762
3970
  const {
3763
3971
  strings: {
3764
3972
  branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
@@ -3770,7 +3978,7 @@ BranchPickerPrevious2.displayName = "BranchPickerPrevious";
3770
3978
  var BranchPickerStateWrapper = withDefaults("span", {
3771
3979
  className: "aui-branch-picker-state"
3772
3980
  });
3773
- var BranchPickerState = (0, import_react57.forwardRef)((props, ref) => {
3981
+ var BranchPickerState = (0, import_react59.forwardRef)((props, ref) => {
3774
3982
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(BranchPickerStateWrapper, { ...props, ref, children: [
3775
3983
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(branchPicker_exports.Number, {}),
3776
3984
  " / ",
@@ -3778,7 +3986,7 @@ var BranchPickerState = (0, import_react57.forwardRef)((props, ref) => {
3778
3986
  ] });
3779
3987
  });
3780
3988
  BranchPickerState.displayName = "BranchPickerState";
3781
- var BranchPickerNext = (0, import_react57.forwardRef)((props, ref) => {
3989
+ var BranchPickerNext = (0, import_react59.forwardRef)((props, ref) => {
3782
3990
  const {
3783
3991
  strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
3784
3992
  } = useThreadConfig();
@@ -3856,7 +4064,7 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
3856
4064
  var AssistantMessageContentWrapper = withDefaults("div", {
3857
4065
  className: "aui-assistant-message-content"
3858
4066
  });
3859
- var AssistantMessageContent = (0, import_react58.forwardRef)(({ components: componentsProp, ...rest }, ref) => {
4067
+ var AssistantMessageContent = (0, import_react60.forwardRef)(({ components: componentsProp, ...rest }, ref) => {
3860
4068
  const { assistantMessage: { components = {} } = {} } = useThreadConfig();
3861
4069
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3862
4070
  message_exports.Content,
@@ -3880,15 +4088,15 @@ var assistant_message_default = Object.assign(
3880
4088
  );
3881
4089
 
3882
4090
  // src/ui/assistant-modal.tsx
3883
- var import_react65 = require("react");
4091
+ var import_react67 = require("react");
3884
4092
  var import_lucide_react6 = require("lucide-react");
3885
4093
 
3886
4094
  // src/ui/thread.tsx
3887
- var import_react64 = require("react");
4095
+ var import_react66 = require("react");
3888
4096
  var import_lucide_react5 = require("lucide-react");
3889
4097
 
3890
4098
  // src/ui/composer.tsx
3891
- var import_react59 = require("react");
4099
+ var import_react61 = require("react");
3892
4100
  var import_lucide_react3 = require("lucide-react");
3893
4101
 
3894
4102
  // src/ui/base/CircleStopIcon.tsx
@@ -3924,7 +4132,7 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
3924
4132
  autoFocus: true,
3925
4133
  className: "aui-composer-input"
3926
4134
  });
3927
- var ComposerInput = (0, import_react59.forwardRef)(
4135
+ var ComposerInput = (0, import_react61.forwardRef)(
3928
4136
  (props, ref) => {
3929
4137
  const {
3930
4138
  strings: {
@@ -3953,7 +4161,7 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
3953
4161
  variant: "default",
3954
4162
  className: "aui-composer-send"
3955
4163
  });
3956
- var ComposerSend = (0, import_react59.forwardRef)((props, ref) => {
4164
+ var ComposerSend = (0, import_react61.forwardRef)((props, ref) => {
3957
4165
  const {
3958
4166
  strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
3959
4167
  } = useThreadConfig();
@@ -3964,7 +4172,7 @@ var ComposerCancelButton = withDefaults(TooltipIconButton, {
3964
4172
  variant: "default",
3965
4173
  className: "aui-composer-cancel"
3966
4174
  });
3967
- var ComposerCancel = (0, import_react59.forwardRef)((props, ref) => {
4175
+ var ComposerCancel = (0, import_react61.forwardRef)((props, ref) => {
3968
4176
  const {
3969
4177
  strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
3970
4178
  } = useThreadConfig();
@@ -3981,7 +4189,7 @@ var exports6 = {
3981
4189
  var composer_default = Object.assign(Composer, exports6);
3982
4190
 
3983
4191
  // src/ui/thread-welcome.tsx
3984
- var import_react60 = require("react");
4192
+ var import_react62 = require("react");
3985
4193
  var import_jsx_runtime37 = require("react/jsx-runtime");
3986
4194
  var ThreadWelcome = () => {
3987
4195
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(ThreadWelcomeRoot, { children: [
@@ -3999,7 +4207,7 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
3999
4207
  var ThreadWelcomeCenter = withDefaults("div", {
4000
4208
  className: "aui-thread-welcome-center"
4001
4209
  });
4002
- var ThreadWelcomeRoot = (0, import_react60.forwardRef)(
4210
+ var ThreadWelcomeRoot = (0, import_react62.forwardRef)(
4003
4211
  (props, ref) => {
4004
4212
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(thread_exports.Empty, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeRootStyled, { ...props, ref }) });
4005
4213
  }
@@ -4012,7 +4220,7 @@ var ThreadWelcomeAvatar = () => {
4012
4220
  var ThreadWelcomeMessageStyled = withDefaults("p", {
4013
4221
  className: "aui-thread-welcome-message"
4014
4222
  });
4015
- var ThreadWelcomeMessage = (0, import_react60.forwardRef)(({ message: messageProp, ...rest }, ref) => {
4223
+ var ThreadWelcomeMessage = (0, import_react62.forwardRef)(({ message: messageProp, ...rest }, ref) => {
4016
4224
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
4017
4225
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
4018
4226
  });
@@ -4055,10 +4263,10 @@ var exports7 = {
4055
4263
  var thread_welcome_default = Object.assign(ThreadWelcome, exports7);
4056
4264
 
4057
4265
  // src/ui/user-message.tsx
4058
- var import_react62 = require("react");
4266
+ var import_react64 = require("react");
4059
4267
 
4060
4268
  // src/ui/user-action-bar.tsx
4061
- var import_react61 = require("react");
4269
+ var import_react63 = require("react");
4062
4270
  var import_lucide_react4 = require("lucide-react");
4063
4271
  var import_jsx_runtime38 = require("react/jsx-runtime");
4064
4272
  var useAllowEdit = () => {
@@ -4077,7 +4285,7 @@ var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
4077
4285
  className: "aui-user-action-bar-root"
4078
4286
  });
4079
4287
  UserActionBarRoot.displayName = "UserActionBarRoot";
4080
- var UserActionBarEdit = (0, import_react61.forwardRef)((props, ref) => {
4288
+ var UserActionBarEdit = (0, import_react63.forwardRef)((props, ref) => {
4081
4289
  const {
4082
4290
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
4083
4291
  } = useThreadConfig();
@@ -4109,7 +4317,7 @@ UserMessageRoot.displayName = "UserMessageRoot";
4109
4317
  var UserMessageContentWrapper = withDefaults("div", {
4110
4318
  className: "aui-user-message-content"
4111
4319
  });
4112
- var UserMessageContent = (0, import_react62.forwardRef)(
4320
+ var UserMessageContent = (0, import_react64.forwardRef)(
4113
4321
  ({ components, ...props }, ref) => {
4114
4322
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4115
4323
  message_exports.Content,
@@ -4130,7 +4338,7 @@ var exports9 = {
4130
4338
  var user_message_default = Object.assign(UserMessage, exports9);
4131
4339
 
4132
4340
  // src/ui/edit-composer.tsx
4133
- var import_react63 = require("react");
4341
+ var import_react65 = require("react");
4134
4342
  var import_jsx_runtime40 = require("react/jsx-runtime");
4135
4343
  var EditComposer = () => {
4136
4344
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(EditComposerRoot, { children: [
@@ -4154,7 +4362,7 @@ var EditComposerFooter = withDefaults("div", {
4154
4362
  className: "aui-edit-composer-footer"
4155
4363
  });
4156
4364
  EditComposerFooter.displayName = "EditComposerFooter";
4157
- var EditComposerCancel = (0, import_react63.forwardRef)(
4365
+ var EditComposerCancel = (0, import_react65.forwardRef)(
4158
4366
  (props, ref) => {
4159
4367
  const {
4160
4368
  strings: {
@@ -4165,7 +4373,7 @@ var EditComposerCancel = (0, import_react63.forwardRef)(
4165
4373
  }
4166
4374
  );
4167
4375
  EditComposerCancel.displayName = "EditComposerCancel";
4168
- var EditComposerSend = (0, import_react63.forwardRef)(
4376
+ var EditComposerSend = (0, import_react65.forwardRef)(
4169
4377
  (props, ref) => {
4170
4378
  const {
4171
4379
  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
@@ -4198,7 +4406,7 @@ var Thread = (config) => {
4198
4406
  var ThreadRootStyled = withDefaults(thread_exports.Root, {
4199
4407
  className: "aui-root aui-thread-root"
4200
4408
  });
4201
- var ThreadRoot = (0, import_react64.forwardRef)(
4409
+ var ThreadRoot = (0, import_react66.forwardRef)(
4202
4410
  ({ config, ...props }, ref) => {
4203
4411
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThreadRootStyled, { ...props, ref }) });
4204
4412
  }
@@ -4232,7 +4440,7 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
4232
4440
  variant: "outline",
4233
4441
  className: "aui-thread-scroll-to-bottom"
4234
4442
  });
4235
- var ThreadScrollToBottom = (0, import_react64.forwardRef)((props, ref) => {
4443
+ var ThreadScrollToBottom = (0, import_react66.forwardRef)((props, ref) => {
4236
4444
  const {
4237
4445
  strings: {
4238
4446
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
@@ -4263,7 +4471,7 @@ var AssistantModalRoot = ({ config, ...props }) => {
4263
4471
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ThreadConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(assistantModal_exports.Root, { ...props }) });
4264
4472
  };
4265
4473
  AssistantModalRoot.displayName = "AssistantModalRoot";
4266
- var AssistantModalTrigger = (0, import_react65.forwardRef)((props, ref) => {
4474
+ var AssistantModalTrigger = (0, import_react67.forwardRef)((props, ref) => {
4267
4475
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantModalAnchor, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantModalButton, { ...props, ref }) }) });
4268
4476
  });
4269
4477
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
@@ -4275,7 +4483,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
4275
4483
  variant: "default",
4276
4484
  className: "aui-modal-button"
4277
4485
  });
4278
- var AssistantModalButton = (0, import_react65.forwardRef)(({ "data-state": state, ...rest }, ref) => {
4486
+ var AssistantModalButton = (0, import_react67.forwardRef)(({ "data-state": state, ...rest }, ref) => {
4279
4487
  const {
4280
4488
  strings: {
4281
4489
  assistantModal: {
@@ -4344,6 +4552,7 @@ var assistant_modal_default = Object.assign(AssistantModal, exports12);
4344
4552
  ContentPartPrimitive,
4345
4553
  EdgeChatAdapter,
4346
4554
  EditComposer,
4555
+ ExternalStoreRuntime,
4347
4556
  INTERNAL,
4348
4557
  MessagePrimitive,
4349
4558
  Thread,
@@ -4356,6 +4565,7 @@ var assistant_modal_default = Object.assign(AssistantModal, exports12);
4356
4565
  fromCoreMessages,
4357
4566
  fromLanguageModelMessages,
4358
4567
  fromLanguageModelTools,
4568
+ getExternalStoreMessage,
4359
4569
  makeAssistantTool,
4360
4570
  makeAssistantToolUI,
4361
4571
  toCoreMessage,
@@ -4383,6 +4593,7 @@ var assistant_modal_default = Object.assign(AssistantModal, exports12);
4383
4593
  useContentPartImage,
4384
4594
  useContentPartText,
4385
4595
  useEdgeRuntime,
4596
+ useExternalStoreRuntime,
4386
4597
  useLocalRuntime,
4387
4598
  useMessageContext,
4388
4599
  useMessageIf,