@assistant-ui/react 0.5.70 → 0.5.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -289,7 +289,7 @@ var { useContentPart, useContentPartStore } = createContextStoreHook(
289
289
  );
290
290
 
291
291
  // src/api/ContentPartRuntime.ts
292
- var ContentPartRuntime = class {
292
+ var ContentPartRuntimeImpl = class {
293
293
  constructor(contentBinding, messageApi, threadApi) {
294
294
  this.contentBinding = contentBinding;
295
295
  this.messageApi = messageApi;
@@ -331,7 +331,7 @@ var TextContentPartProvider = ({ children, text, isRunning }) => {
331
331
  const [context] = useState3(() => {
332
332
  const useContentPartRuntime2 = create5(
333
333
  // TODO
334
- () => new ContentPartRuntime(null, null, null)
334
+ () => new ContentPartRuntimeImpl(null, null, null)
335
335
  );
336
336
  const useContentPart2 = create5(() => ({
337
337
  status: isRunning ? RUNNING_STATUS : COMPLETE_STATUS,
@@ -1586,7 +1586,7 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
1586
1586
  ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
1587
1587
 
1588
1588
  // src/api/AttachmentRuntime.ts
1589
- var AttachmentRuntime = class {
1589
+ var AttachmentRuntimeImpl = class {
1590
1590
  constructor(_core) {
1591
1591
  this._core = _core;
1592
1592
  }
@@ -1597,7 +1597,7 @@ var AttachmentRuntime = class {
1597
1597
  return this._core.subscribe(callback);
1598
1598
  }
1599
1599
  };
1600
- var ComposerAttachmentRuntime = class extends AttachmentRuntime {
1600
+ var ComposerAttachmentRuntime = class extends AttachmentRuntimeImpl {
1601
1601
  constructor(core, _composerApi) {
1602
1602
  super(core);
1603
1603
  this._composerApi = _composerApi;
@@ -1608,17 +1608,17 @@ var ComposerAttachmentRuntime = class extends AttachmentRuntime {
1608
1608
  return core.removeAttachment(this.getState().id);
1609
1609
  }
1610
1610
  };
1611
- var ThreadComposerAttachmentRuntime = class extends ComposerAttachmentRuntime {
1611
+ var ThreadComposerAttachmentRuntimeImpl = class extends ComposerAttachmentRuntime {
1612
1612
  get source() {
1613
1613
  return "thread-composer";
1614
1614
  }
1615
1615
  };
1616
- var EditComposerAttachmentRuntime = class extends ComposerAttachmentRuntime {
1616
+ var EditComposerAttachmentRuntimeImpl = class extends ComposerAttachmentRuntime {
1617
1617
  get source() {
1618
1618
  return "edit-composer";
1619
1619
  }
1620
1620
  };
1621
- var MessageAttachmentRuntime = class extends AttachmentRuntime {
1621
+ var MessageAttachmentRuntimeImpl = class extends AttachmentRuntimeImpl {
1622
1622
  get source() {
1623
1623
  return "message";
1624
1624
  }
@@ -1780,7 +1780,7 @@ var getEditComposerState = (runtime, beginEdit) => {
1780
1780
  cancel: runtime?.cancel.bind(runtime) ?? METHOD_NOT_SUPPORTED
1781
1781
  });
1782
1782
  };
1783
- var ComposerRuntime = class {
1783
+ var ComposerRuntimeImpl = class {
1784
1784
  constructor(_core) {
1785
1785
  this._core = _core;
1786
1786
  }
@@ -1839,9 +1839,9 @@ var ComposerRuntime = class {
1839
1839
  if (!core) throw new Error("Composer is not available");
1840
1840
  return core.addAttachment(file);
1841
1841
  }
1842
- // /**
1843
- // * @deprecated Use `getAttachmentById(id).removeAttachment` instead. This will be removed in 0.6.0.
1844
- // */
1842
+ /**
1843
+ * @deprecated Use `getAttachmentById(id).removeAttachment()` instead. This will be removed in 0.6.0.
1844
+ */
1845
1845
  removeAttachment(attachmentId) {
1846
1846
  const core = this._core.getState();
1847
1847
  if (!core) throw new Error("Composer is not available");
@@ -1869,7 +1869,7 @@ var ComposerRuntime = class {
1869
1869
  return this._core.subscribe(callback);
1870
1870
  }
1871
1871
  };
1872
- var ThreadComposerRuntime = class extends ComposerRuntime {
1872
+ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
1873
1873
  get type() {
1874
1874
  return "thread";
1875
1875
  }
@@ -1897,15 +1897,21 @@ var ThreadComposerRuntime = class extends ComposerRuntime {
1897
1897
  }
1898
1898
  // TODO replace with events
1899
1899
  _focusListeners = /* @__PURE__ */ new Set();
1900
+ /**
1901
+ * @deprecated This feature is being removed in 0.6.0. Submit feedback if you need it.
1902
+ */
1900
1903
  focus() {
1901
1904
  this._focusListeners.forEach((callback) => callback());
1902
1905
  }
1906
+ /**
1907
+ * @deprecated This feature is being removed in 0.6.0. Submit feedback if you need it.
1908
+ */
1903
1909
  onFocus(callback) {
1904
1910
  this._focusListeners.add(callback);
1905
1911
  return () => this._focusListeners.delete(callback);
1906
1912
  }
1907
- unstable_getAttachmentByIndex(idx) {
1908
- return new ThreadComposerAttachmentRuntime(
1913
+ getAttachmentByIndex(idx) {
1914
+ return new ThreadComposerAttachmentRuntimeImpl(
1909
1915
  new ShallowMemoizeSubject({
1910
1916
  getState: () => {
1911
1917
  const attachments = this.getState().attachments;
@@ -1923,7 +1929,7 @@ var ThreadComposerRuntime = class extends ComposerRuntime {
1923
1929
  );
1924
1930
  }
1925
1931
  };
1926
- var EditComposerRuntime = class extends ComposerRuntime {
1932
+ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
1927
1933
  constructor(core, _beginEdit) {
1928
1934
  const stateBinding = new LazyMemoizeSubject({
1929
1935
  getState: () => getEditComposerState(core.getState(), this._beginEdit),
@@ -1952,8 +1958,8 @@ var EditComposerRuntime = class extends ComposerRuntime {
1952
1958
  edit() {
1953
1959
  this.beginEdit();
1954
1960
  }
1955
- unstable_getAttachmentByIndex(idx) {
1956
- return new EditComposerAttachmentRuntime(
1961
+ getAttachmentByIndex(idx) {
1962
+ return new EditComposerAttachmentRuntimeImpl(
1957
1963
  new ShallowMemoizeSubject({
1958
1964
  getState: () => {
1959
1965
  const attachments = this.getState().attachments;
@@ -2037,12 +2043,12 @@ var getContentPartState = (message, partIndex) => {
2037
2043
  const status = toContentPartStatus(message, partIndex, part);
2038
2044
  return Object.freeze({ ...part, part, status });
2039
2045
  };
2040
- var MessageRuntime = class {
2046
+ var MessageRuntimeImpl = class {
2041
2047
  constructor(_core, _threadBinding) {
2042
2048
  this._core = _core;
2043
2049
  this._threadBinding = _threadBinding;
2044
2050
  }
2045
- composer = new EditComposerRuntime(
2051
+ composer = new EditComposerRuntimeImpl(
2046
2052
  new NestedSubscriptionSubject({
2047
2053
  getState: () => this._threadBinding.getState().getEditComposer(this._core.getState().id),
2048
2054
  subscribe: (callback) => this._threadBinding.subscribe(callback)
@@ -2052,15 +2058,6 @@ var MessageRuntime = class {
2052
2058
  getState() {
2053
2059
  return this._core.getState();
2054
2060
  }
2055
- // TODO improve type
2056
- unstable_edit(message) {
2057
- const state = this._core.getState();
2058
- if (!state) throw new Error("Message is not available");
2059
- this._threadBinding.getState().append({
2060
- ...message,
2061
- parentId: state.parentId
2062
- });
2063
- }
2064
2061
  reload() {
2065
2062
  const state = this._core.getState();
2066
2063
  if (!state) throw new Error("Message is not available");
@@ -2106,9 +2103,9 @@ var MessageRuntime = class {
2106
2103
  subscribe(callback) {
2107
2104
  return this._core.subscribe(callback);
2108
2105
  }
2109
- unstable_getContentPartByIndex(idx) {
2106
+ getContentPartByIndex(idx) {
2110
2107
  if (idx < 0) throw new Error("Message index must be >= 0");
2111
- return new ContentPartRuntime(
2108
+ return new ContentPartRuntimeImpl(
2112
2109
  new ShallowMemoizeSubject({
2113
2110
  getState: () => {
2114
2111
  return getContentPartState(this.getState(), idx);
@@ -2119,8 +2116,8 @@ var MessageRuntime = class {
2119
2116
  this._threadBinding
2120
2117
  );
2121
2118
  }
2122
- unstable_getAttachmentByIndex(idx) {
2123
- return new MessageAttachmentRuntime(
2119
+ getAttachmentByIndex(idx) {
2120
+ return new MessageAttachmentRuntimeImpl(
2124
2121
  new ShallowMemoizeSubject({
2125
2122
  getState: () => {
2126
2123
  const attachments = this.getState().attachments;
@@ -2206,7 +2203,7 @@ var MessageContentPartImpl = ({
2206
2203
  }) => {
2207
2204
  const messageRuntime = useMessageRuntime();
2208
2205
  const runtime = useMemo6(
2209
- () => messageRuntime.unstable_getContentPartByIndex(partIndex),
2206
+ () => messageRuntime.getContentPartByIndex(partIndex),
2210
2207
  [messageRuntime, partIndex]
2211
2208
  );
2212
2209
  return /* @__PURE__ */ jsx21(ContentPartRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx21(MessageContentPartComponent, { components }) });
@@ -2355,7 +2352,7 @@ var AttachmentComponent = ({ components }) => {
2355
2352
  var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
2356
2353
  const messageRuntime = useMessageRuntime();
2357
2354
  const runtime = useMemo8(
2358
- () => messageRuntime.unstable_getAttachmentByIndex(attachmentIndex),
2355
+ () => messageRuntime.getAttachmentByIndex(attachmentIndex),
2359
2356
  [messageRuntime, attachmentIndex]
2360
2357
  );
2361
2358
  return /* @__PURE__ */ jsx23(AttachmentRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx23(AttachmentComponent, { components }) });
@@ -2558,7 +2555,7 @@ var AttachmentComponent2 = ({ components }) => {
2558
2555
  var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
2559
2556
  const composerRuntime = useComposerRuntime();
2560
2557
  const runtime = useMemo9(
2561
- () => composerRuntime.unstable_getAttachmentByIndex(attachmentIndex),
2558
+ () => composerRuntime.getAttachmentByIndex(attachmentIndex),
2562
2559
  [composerRuntime, attachmentIndex]
2563
2560
  );
2564
2561
  return /* @__PURE__ */ jsx27(AttachmentRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx27(AttachmentComponent2, { components }) });
@@ -2892,7 +2889,7 @@ var ThreadMessageImpl = ({
2892
2889
  }) => {
2893
2890
  const threadRuntime = useThreadRuntime();
2894
2891
  const runtime = useMemo10(
2895
- () => threadRuntime.unstable_getMesssageByIndex(messageIndex),
2892
+ () => threadRuntime.getMesssageByIndex(messageIndex),
2896
2893
  [threadRuntime, messageIndex]
2897
2894
  );
2898
2895
  return /* @__PURE__ */ jsx31(MessageRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx31(ThreadMessageComponent, { components }) });
@@ -2976,12 +2973,12 @@ var BaseAssistantRuntimeCore = class {
2976
2973
  // src/internal.ts
2977
2974
  var internal_exports = {};
2978
2975
  __export(internal_exports, {
2979
- AssistantRuntime: () => AssistantRuntime,
2976
+ AssistantRuntimeImpl: () => AssistantRuntimeImpl,
2980
2977
  BaseAssistantRuntimeCore: () => BaseAssistantRuntimeCore,
2981
2978
  DefaultThreadComposerRuntimeCore: () => DefaultThreadComposerRuntimeCore,
2982
2979
  MessageRepository: () => MessageRepository,
2983
2980
  ProxyConfigProvider: () => ProxyConfigProvider,
2984
- ThreadRuntime: () => ThreadRuntime,
2981
+ ThreadRuntimeImpl: () => ThreadRuntimeImpl,
2985
2982
  TooltipIconButton: () => TooltipIconButton,
2986
2983
  generateId: () => generateId,
2987
2984
  useSmooth: () => useSmooth,
@@ -3469,7 +3466,7 @@ var TooltipIconButton = forwardRef21(({ children, tooltip, side = "bottom", ...r
3469
3466
  TooltipIconButton.displayName = "TooltipIconButton";
3470
3467
 
3471
3468
  // src/api/AssistantRuntime.ts
3472
- var AssistantRuntime = class {
3469
+ var AssistantRuntimeImpl = class {
3473
3470
  constructor(_core, CustomThreadRuntime) {
3474
3471
  this._core = _core;
3475
3472
  this.thread = new CustomThreadRuntime(
@@ -3525,10 +3522,12 @@ var getThreadState = (runtime) => {
3525
3522
  capabilities: runtime.capabilities,
3526
3523
  isDisabled: runtime.isDisabled,
3527
3524
  isRunning: lastMessage?.role !== "assistant" ? false : lastMessage.status.type === "running",
3528
- messages: runtime.messages
3525
+ messages: runtime.messages,
3526
+ suggestions: runtime.suggestions,
3527
+ extras: runtime.extras
3529
3528
  });
3530
3529
  };
3531
- var ThreadRuntime = class {
3530
+ var ThreadRuntimeImpl = class {
3532
3531
  // public path = "assistant.threads[main]"; // TODO
3533
3532
  /**
3534
3533
  * @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
@@ -3554,6 +3553,18 @@ var ThreadRuntime = class {
3554
3553
  get capabilities() {
3555
3554
  return this.getState().capabilities;
3556
3555
  }
3556
+ /**
3557
+ * @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.
3558
+ */
3559
+ get extras() {
3560
+ return this._threadBinding.getState().extras;
3561
+ }
3562
+ /**
3563
+ * @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.
3564
+ */
3565
+ get suggestions() {
3566
+ return this._threadBinding.getState().suggestions;
3567
+ }
3557
3568
  /**
3558
3569
  * @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
3559
3570
  */
@@ -3575,7 +3586,7 @@ var ThreadRuntime = class {
3575
3586
  subscribe: (callback) => threadBinding.subscribe(callback)
3576
3587
  };
3577
3588
  }
3578
- composer = new ThreadComposerRuntime(
3589
+ composer = new ThreadComposerRuntimeImpl(
3579
3590
  new NestedSubscriptionSubject({
3580
3591
  getState: () => this._threadBinding.getState().composer,
3581
3592
  subscribe: (callback) => this._threadBinding.subscribe(callback)
@@ -3592,9 +3603,9 @@ var ThreadRuntime = class {
3592
3603
  subscribe(callback) {
3593
3604
  return this._threadBinding.subscribe(callback);
3594
3605
  }
3595
- // /**
3596
- // * @derprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
3597
- // */
3606
+ /**
3607
+ * @derprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
3608
+ */
3598
3609
  getBranches(messageId) {
3599
3610
  return this._threadBinding.getState().getBranches(messageId);
3600
3611
  }
@@ -3605,17 +3616,18 @@ var ThreadRuntime = class {
3605
3616
  startRun(parentId) {
3606
3617
  return this._threadBinding.getState().startRun(parentId);
3607
3618
  }
3608
- // TODO
3609
3619
  cancelRun() {
3610
3620
  this._threadBinding.getState().cancelRun();
3611
3621
  }
3612
- // /**
3613
- // * @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
3614
- // */
3622
+ /**
3623
+ * @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
3624
+ */
3615
3625
  addToolResult(options) {
3616
3626
  this._threadBinding.getState().addToolResult(options);
3617
3627
  }
3618
- // TODO
3628
+ /**
3629
+ * @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.
3630
+ */
3619
3631
  switchToBranch(branchId) {
3620
3632
  return this._threadBinding.getState().switchToBranch(branchId);
3621
3633
  }
@@ -3632,13 +3644,13 @@ var ThreadRuntime = class {
3632
3644
  return this._threadBinding.getState().submitFeedback(options);
3633
3645
  }
3634
3646
  /**
3635
- * @deprecated Use `getMesssageById(id).unstable_getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.
3647
+ * @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.
3636
3648
  */
3637
3649
  getEditComposer(messageId) {
3638
3650
  return this._threadBinding.getState().getEditComposer(messageId);
3639
3651
  }
3640
3652
  /**
3641
- * @deprecated Use `getMesssageById(id).unstable_getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.
3653
+ * @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.
3642
3654
  */
3643
3655
  beginEdit(messageId) {
3644
3656
  return this._threadBinding.getState().beginEdit(messageId);
@@ -3649,9 +3661,9 @@ var ThreadRuntime = class {
3649
3661
  import(data) {
3650
3662
  this._threadBinding.getState().import(data);
3651
3663
  }
3652
- unstable_getMesssageByIndex(idx) {
3664
+ getMesssageByIndex(idx) {
3653
3665
  if (idx < 0) throw new Error("Message index must be >= 0");
3654
- return new MessageRuntime(
3666
+ return new MessageRuntimeImpl(
3655
3667
  new ShallowMemoizeSubject({
3656
3668
  getState: () => {
3657
3669
  const messages2 = this.getState().messages;
@@ -3954,7 +3966,7 @@ var EdgeChatAdapter = class {
3954
3966
  }),
3955
3967
  signal: abortSignal
3956
3968
  });
3957
- if (result.status !== 200) {
3969
+ if (!result.ok) {
3958
3970
  throw new Error(`Status ${result.status}: ${await result.text()}`);
3959
3971
  }
3960
3972
  const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(toolResultStream(config.tools, abortSignal)).pipeThrough(runResultStream());
@@ -4053,6 +4065,7 @@ var LocalThreadRuntimeCore = class {
4053
4065
  };
4054
4066
  threadId;
4055
4067
  isDisabled = false;
4068
+ suggestions = [];
4056
4069
  get messages() {
4057
4070
  return this.repository.getMessages();
4058
4071
  }
@@ -4064,6 +4077,9 @@ var LocalThreadRuntimeCore = class {
4064
4077
  get options() {
4065
4078
  return this._options;
4066
4079
  }
4080
+ get extras() {
4081
+ return void 0;
4082
+ }
4067
4083
  set options({ initialMessages, ...options }) {
4068
4084
  this._options = options;
4069
4085
  let hasUpdates = false;
@@ -4344,9 +4360,9 @@ var LocalRuntimeCore = class extends BaseAssistantRuntimeCore {
4344
4360
  };
4345
4361
 
4346
4362
  // src/runtimes/local/useLocalRuntime.tsx
4347
- var LocalRuntime = class extends AssistantRuntime {
4363
+ var LocalRuntime = class extends AssistantRuntimeImpl {
4348
4364
  constructor(core) {
4349
- super(core, ThreadRuntime);
4365
+ super(core, ThreadRuntimeImpl);
4350
4366
  this.core = core;
4351
4367
  }
4352
4368
  reset(options) {
@@ -4468,6 +4484,7 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
4468
4484
  };
4469
4485
 
4470
4486
  // src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx
4487
+ var EMPTY_ARRAY2 = Object.freeze([]);
4471
4488
  var hasUpcomingMessage = (isRunning, messages2) => {
4472
4489
  return isRunning && messages2[messages2.length - 1]?.role !== "assistant";
4473
4490
  };
@@ -4495,7 +4512,9 @@ var ExternalStoreThreadRuntimeCore = class {
4495
4512
  threadId;
4496
4513
  messages;
4497
4514
  isDisabled;
4498
- converter = new ThreadMessageConverter();
4515
+ suggestions = [];
4516
+ extras = void 0;
4517
+ _converter = new ThreadMessageConverter();
4499
4518
  _store;
4500
4519
  composer = new DefaultThreadComposerRuntimeCore(this);
4501
4520
  _editComposers = /* @__PURE__ */ new Map();
@@ -4525,6 +4544,8 @@ var ExternalStoreThreadRuntimeCore = class {
4525
4544
  this.isDisabled = store.isDisabled ?? false;
4526
4545
  const oldStore = this._store;
4527
4546
  this._store = store;
4547
+ this.extras = store.extras;
4548
+ this.suggestions = store.suggestions ?? EMPTY_ARRAY2;
4528
4549
  this._capabilities = {
4529
4550
  switchToBranch: this._store.setMessages !== void 0,
4530
4551
  edit: this._store.onEdit !== void 0,
@@ -4539,13 +4560,13 @@ var ExternalStoreThreadRuntimeCore = class {
4539
4560
  this.composer.setAttachmentAdapter(this._store.adapters?.attachments);
4540
4561
  if (oldStore) {
4541
4562
  if (oldStore.convertMessage !== store.convertMessage) {
4542
- this.converter = new ThreadMessageConverter();
4563
+ this._converter = new ThreadMessageConverter();
4543
4564
  } else if (oldStore.isRunning === store.isRunning && oldStore.messages === store.messages) {
4544
4565
  this.notifySubscribers();
4545
4566
  return;
4546
4567
  }
4547
4568
  }
4548
- const messages2 = !store.convertMessage ? store.messages : this.converter.convertMessages(store.messages, (cache, m, idx) => {
4569
+ const messages2 = !store.convertMessage ? store.messages : this._converter.convertMessages(store.messages, (cache, m, idx) => {
4549
4570
  if (!store.convertMessage) return m;
4550
4571
  const isLast = idx === store.messages.length - 1;
4551
4572
  const autoStatus = getAutoStatus(isLast, isRunning);
@@ -4720,7 +4741,10 @@ var useExternalStoreRuntime = (store) => {
4720
4741
  useEffect14(() => {
4721
4742
  runtime.thread.store = store;
4722
4743
  });
4723
- return useMemo12(() => new AssistantRuntime(runtime, ThreadRuntime), [runtime]);
4744
+ return useMemo12(
4745
+ () => new AssistantRuntimeImpl(runtime, ThreadRuntimeImpl),
4746
+ [runtime]
4747
+ );
4724
4748
  };
4725
4749
 
4726
4750
  // src/runtimes/external-store/external-message-converter.tsx
@@ -5701,19 +5725,13 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
5701
5725
  var ThreadWelcomeSuggestion = ({
5702
5726
  suggestion: { text, prompt }
5703
5727
  }) => {
5704
- return /* @__PURE__ */ jsx45(
5705
- ThreadWelcomeSuggestionStyled,
5706
- {
5707
- prompt,
5708
- method: "replace",
5709
- autoSend: true,
5710
- children: /* @__PURE__ */ jsx45("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
5711
- }
5712
- );
5728
+ return /* @__PURE__ */ jsx45(ThreadWelcomeSuggestionStyled, { prompt, method: "replace", autoSend: true, children: /* @__PURE__ */ jsx45("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt }) });
5713
5729
  };
5714
5730
  var ThreadWelcomeSuggestions = () => {
5731
+ const suggestions2 = useThread((t) => t.suggestions);
5715
5732
  const { welcome: { suggestions } = {} } = useThreadConfig();
5716
- return /* @__PURE__ */ jsx45(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
5733
+ const finalSuggestions = suggestions2.length ? suggestions2 : suggestions;
5734
+ return /* @__PURE__ */ jsx45(ThreadWelcomeSuggestionContainer, { children: finalSuggestions?.map((suggestion, idx) => {
5717
5735
  const key = `${suggestion.prompt}-${idx}`;
5718
5736
  return /* @__PURE__ */ jsx45(ThreadWelcomeSuggestion, { suggestion }, key);
5719
5737
  }) });
@@ -5897,14 +5915,16 @@ var exports11 = {
5897
5915
  var edit_composer_default = Object.assign(EditComposer, exports11);
5898
5916
 
5899
5917
  // src/ui/thread.tsx
5900
- import { jsx as jsx49, jsxs as jsxs13 } from "react/jsx-runtime";
5918
+ import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs13 } from "react/jsx-runtime";
5901
5919
  var Thread = (config) => {
5920
+ const { components: { Composer: ComposerComponent = composer_default } = {} } = config;
5902
5921
  return /* @__PURE__ */ jsx49(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
5903
5922
  /* @__PURE__ */ jsx49(thread_welcome_default, {}),
5904
5923
  /* @__PURE__ */ jsx49(ThreadMessages, {}),
5924
+ /* @__PURE__ */ jsx49(ThreadFollowupSuggestions, {}),
5905
5925
  /* @__PURE__ */ jsxs13(ThreadViewportFooter, { children: [
5906
5926
  /* @__PURE__ */ jsx49(ThreadScrollToBottom, {}),
5907
- /* @__PURE__ */ jsx49(composer_default, {})
5927
+ /* @__PURE__ */ jsx49(ComposerComponent, {})
5908
5928
  ] })
5909
5929
  ] }) });
5910
5930
  };
@@ -5926,21 +5946,38 @@ var ThreadViewportFooter = withDefaults("div", {
5926
5946
  });
5927
5947
  ThreadViewportFooter.displayName = "ThreadViewportFooter";
5928
5948
  var SystemMessage = () => null;
5929
- var ThreadMessages = ({ components, ...rest }) => {
5930
- return /* @__PURE__ */ jsx49(
5931
- thread_exports.Messages,
5932
- {
5933
- components: {
5934
- UserMessage: components?.UserMessage ?? user_message_default,
5935
- EditComposer: components?.EditComposer ?? edit_composer_default,
5936
- AssistantMessage: components?.AssistantMessage ?? assistant_message_default,
5937
- SystemMessage: components?.SystemMessage ?? SystemMessage
5938
- },
5939
- ...rest
5940
- }
5941
- );
5949
+ var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ...rest }) => {
5950
+ return /* @__PURE__ */ jsxs13(Fragment6, { children: [
5951
+ /* @__PURE__ */ jsx49(
5952
+ thread_exports.Messages,
5953
+ {
5954
+ components: {
5955
+ UserMessage: components?.UserMessage ?? user_message_default,
5956
+ EditComposer: components?.EditComposer ?? edit_composer_default,
5957
+ AssistantMessage: components?.AssistantMessage ?? assistant_message_default,
5958
+ SystemMessage: components?.SystemMessage ?? SystemMessage
5959
+ },
5960
+ ...rest
5961
+ }
5962
+ ),
5963
+ flexGrowDiv && /* @__PURE__ */ jsx49(thread_exports.If, { empty: false, children: /* @__PURE__ */ jsx49("div", { style: { flexGrow: 1 } }) })
5964
+ ] });
5942
5965
  };
5943
5966
  ThreadMessages.displayName = "ThreadMessages";
5967
+ var ThreadFollowupSuggestions = () => {
5968
+ const suggestions = useThread((t) => t.suggestions);
5969
+ return /* @__PURE__ */ jsx49(thread_exports.If, { empty: false, running: false, children: /* @__PURE__ */ jsx49("div", { className: "aui-thread-followup-suggestions", children: suggestions?.map((suggestion, idx) => /* @__PURE__ */ jsx49(
5970
+ thread_exports.Suggestion,
5971
+ {
5972
+ className: "aui-thread-followup-suggestion",
5973
+ prompt: suggestion.prompt,
5974
+ method: "replace",
5975
+ autoSend: true,
5976
+ children: suggestion.prompt
5977
+ },
5978
+ idx
5979
+ )) }) });
5980
+ };
5944
5981
  var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
5945
5982
  variant: "outline",
5946
5983
  className: "aui-thread-scroll-to-bottom"
@@ -5958,13 +5995,14 @@ var exports12 = {
5958
5995
  Root: ThreadRoot,
5959
5996
  Viewport: ThreadViewport,
5960
5997
  Messages: ThreadMessages,
5998
+ FollowupSuggestions: ThreadFollowupSuggestions,
5961
5999
  ScrollToBottom: ThreadScrollToBottom,
5962
6000
  ViewportFooter: ThreadViewportFooter
5963
6001
  };
5964
6002
  var thread_default = Object.assign(Thread, exports12);
5965
6003
 
5966
6004
  // src/ui/assistant-modal.tsx
5967
- import { Fragment as Fragment6, jsx as jsx50, jsxs as jsxs14 } from "react/jsx-runtime";
6005
+ import { Fragment as Fragment7, jsx as jsx50, jsxs as jsxs14 } from "react/jsx-runtime";
5968
6006
  var AssistantModal = (config) => {
5969
6007
  return /* @__PURE__ */ jsxs14(AssistantModalRoot, { config, children: [
5970
6008
  /* @__PURE__ */ jsx50(AssistantModalTrigger, {}),
@@ -6010,7 +6048,7 @@ var AssistantModalButton = forwardRef32(({ "data-state": state, ...rest }, ref)
6010
6048
  "data-state": state,
6011
6049
  ...rest,
6012
6050
  ref,
6013
- children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment6, { children: [
6051
+ children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment7, { children: [
6014
6052
  /* @__PURE__ */ jsx50(
6015
6053
  BotIcon,
6016
6054
  {