@assistant-ui/react 0.5.80 → 0.5.82

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16;
2
2
 
3
3
 
4
4
 
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkBDPD5HCKjs = require('./chunk-BDPD5HCK.js');
12
+ var _chunkC6UZOY5Ajs = require('./chunk-C6UZOY5A.js');
13
13
 
14
14
 
15
15
  var _chunkPZ5AY32Cjs = require('./chunk-PZ5AY32C.js');
@@ -155,6 +155,15 @@ var {
155
155
  useViewport: useThreadViewport,
156
156
  useViewportStore: useThreadViewportStore
157
157
  } = createContextStoreHook(useThreadContext, "useViewport");
158
+ function useThreadModelConfig(options) {
159
+ const [, rerender] = _react.useState.call(void 0, {});
160
+ const runtime = useThreadRuntime(options);
161
+ _react.useEffect.call(void 0, () => {
162
+ return _optionalChain([runtime, 'optionalAccess', _5 => _5.unstable_on, 'call', _6 => _6("model-config-update", () => rerender({}))]);
163
+ }, [runtime]);
164
+ if (!runtime) return null;
165
+ return _optionalChain([runtime, 'optionalAccess', _7 => _7.getModelConfig, 'call', _8 => _8()]);
166
+ }
158
167
 
159
168
  // src/context/stores/ThreadViewport.tsx
160
169
 
@@ -294,6 +303,9 @@ var ContentPartRuntimeImpl = class {
294
303
  this.messageApi = messageApi;
295
304
  this.threadApi = threadApi;
296
305
  }
306
+ get path() {
307
+ return this.contentBinding.path;
308
+ }
297
309
  getState() {
298
310
  return this.contentBinding.getState();
299
311
  }
@@ -404,7 +416,7 @@ var { useComposer, useComposerStore } = createContextStoreHook(
404
416
  function useComposerRuntime(options) {
405
417
  const messageRuntime = useMessageRuntime({ optional: true });
406
418
  const threadRuntime = useThreadRuntime(options);
407
- return messageRuntime ? messageRuntime.composer : _nullishCoalesce(_optionalChain([threadRuntime, 'optionalAccess', _5 => _5.composer]), () => ( null));
419
+ return messageRuntime ? messageRuntime.composer : _nullishCoalesce(_optionalChain([threadRuntime, 'optionalAccess', _9 => _9.composer]), () => ( null));
408
420
  }
409
421
 
410
422
  // src/hooks/useAppendMessage.tsx
@@ -448,7 +460,7 @@ var useAssistantTool = (tool) => {
448
460
  const unsub2 = render ? toolUIsStore.getState().setToolUI(toolName, render) : void 0;
449
461
  return () => {
450
462
  unsub1();
451
- _optionalChain([unsub2, 'optionalCall', _6 => _6()]);
463
+ _optionalChain([unsub2, 'optionalCall', _10 => _10()]);
452
464
  };
453
465
  }, [assistantRuntime, toolUIsStore, tool]);
454
466
  };
@@ -500,64 +512,23 @@ var useAssistantInstructions = (instruction) => {
500
512
 
501
513
  // src/primitive-hooks/actionBar/useActionBarCopy.tsx
502
514
 
503
-
504
- // src/utils/combined/useCombinedStore.ts
505
-
506
-
507
- // src/utils/combined/createCombinedStore.ts
508
-
509
- var createCombinedStore = (stores) => {
510
- const subscribe = (callback) => {
511
- const unsubscribes = stores.map((store) => store.subscribe(callback));
512
- return () => {
513
- for (const unsub of unsubscribes) {
514
- unsub();
515
- }
516
- };
517
- };
518
- return (selector) => {
519
- const getSnapshot = () => selector(...stores.map((store) => store.getState()));
520
- return _react.useSyncExternalStore.call(void 0, subscribe, getSnapshot, getSnapshot);
521
- };
522
- };
523
-
524
- // src/utils/combined/useCombinedStore.ts
525
- var useCombinedStore = (stores, selector) => {
526
- const useCombined = _react.useMemo.call(void 0, () => createCombinedStore(stores), stores);
527
- return useCombined(selector);
528
- };
529
-
530
- // src/utils/getThreadMessageText.tsx
531
- var getThreadMessageText = (message) => {
532
- const textParts = message.content.filter(
533
- (part) => part.type === "text"
534
- );
535
- return textParts.map((part) => part.text).join("\n\n");
536
- };
537
-
538
- // src/primitive-hooks/actionBar/useActionBarCopy.tsx
539
515
  var useActionBarCopy = ({
540
516
  copiedDuration = 3e3
541
517
  } = {}) => {
542
518
  const messageRuntime = useMessageRuntime();
543
519
  const composerRuntime = useComposerRuntime();
544
- const messageUtilsStore = useMessageUtilsStore();
545
- const hasCopyableContent = useCombinedStore(
546
- [messageRuntime, composerRuntime],
547
- (message, c) => {
548
- return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
549
- }
550
- );
520
+ const setIsCopied = useMessageUtils((s) => s.setIsCopied);
521
+ const hasCopyableContent = useMessage((message) => {
522
+ return (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c) => c.type === "text" && c.text.length > 0);
523
+ });
551
524
  const callback = _react.useCallback.call(void 0, () => {
552
- const message = messageRuntime.getState();
553
- const { setIsCopied } = messageUtilsStore.getState();
554
525
  const { isEditing, text: composerValue } = composerRuntime.getState();
555
- const valueToCopy = isEditing ? composerValue : getThreadMessageText(message);
526
+ const valueToCopy = isEditing ? composerValue : messageRuntime.unstable_getCopyText();
556
527
  navigator.clipboard.writeText(valueToCopy).then(() => {
557
528
  setIsCopied(true);
558
529
  setTimeout(() => setIsCopied(false), copiedDuration);
559
530
  });
560
- }, [messageRuntime, messageUtilsStore, composerRuntime, copiedDuration]);
531
+ }, [messageRuntime, setIsCopied, composerRuntime, copiedDuration]);
561
532
  if (!hasCopyableContent) return null;
562
533
  return callback;
563
534
  };
@@ -576,6 +547,34 @@ var useActionBarEdit = () => {
576
547
 
577
548
  // src/primitive-hooks/actionBar/useActionBarReload.tsx
578
549
 
550
+
551
+ // src/utils/combined/useCombinedStore.ts
552
+
553
+
554
+ // src/utils/combined/createCombinedStore.ts
555
+
556
+ var createCombinedStore = (stores) => {
557
+ const subscribe = (callback) => {
558
+ const unsubscribes = stores.map((store) => store.subscribe(callback));
559
+ return () => {
560
+ for (const unsub of unsubscribes) {
561
+ unsub();
562
+ }
563
+ };
564
+ };
565
+ return (selector) => {
566
+ const getSnapshot = () => selector(...stores.map((store) => store.getState()));
567
+ return _react.useSyncExternalStore.call(void 0, subscribe, getSnapshot, getSnapshot);
568
+ };
569
+ };
570
+
571
+ // src/utils/combined/useCombinedStore.ts
572
+ var useCombinedStore = (stores, selector) => {
573
+ const useCombined = _react.useMemo.call(void 0, () => createCombinedStore(stores), stores);
574
+ return useCombined(selector);
575
+ };
576
+
577
+ // src/primitive-hooks/actionBar/useActionBarReload.tsx
579
578
  var useActionBarReload = () => {
580
579
  const messageRuntime = useMessageRuntime();
581
580
  const threadRuntime = useThreadRuntime();
@@ -723,7 +722,7 @@ var useComposerAddAttachment = () => {
723
722
  input.accept = attachmentAccept;
724
723
  }
725
724
  input.onchange = (e) => {
726
- const file = _optionalChain([e, 'access', _7 => _7.target, 'access', _8 => _8.files, 'optionalAccess', _9 => _9[0]]);
725
+ const file = _optionalChain([e, 'access', _11 => _11.target, 'access', _12 => _12.files, 'optionalAccess', _13 => _13[0]]);
727
726
  if (!file) return;
728
727
  composerRuntime.addAttachment(file);
729
728
  };
@@ -799,7 +798,7 @@ var useMessageIf = (props) => {
799
798
  return false;
800
799
  if (props.hasContent === true && content.length === 0) return false;
801
800
  if (props.hasContent === false && content.length > 0) return false;
802
- if (props.submittedFeedback !== void 0 && (_nullishCoalesce(_optionalChain([submittedFeedback, 'optionalAccess', _10 => _10.type]), () => ( null))) !== props.submittedFeedback)
801
+ if (props.submittedFeedback !== void 0 && (_nullishCoalesce(_optionalChain([submittedFeedback, 'optionalAccess', _14 => _14.type]), () => ( null))) !== props.submittedFeedback)
803
802
  return false;
804
803
  return true;
805
804
  }
@@ -933,7 +932,7 @@ var ActionBarPrimitiveCopy = _react.forwardRef.call(void 0, ({ copiedDuration, o
933
932
  ref: forwardedRef,
934
933
  disabled: disabled || !callback,
935
934
  onClick: _primitive.composeEventHandlers.call(void 0, onClick, () => {
936
- _optionalChain([callback, 'optionalCall', _11 => _11()]);
935
+ _optionalChain([callback, 'optionalCall', _15 => _15()]);
937
936
  })
938
937
  }
939
938
  );
@@ -965,7 +964,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
965
964
  ref: forwardedRef,
966
965
  disabled: primitiveProps.disabled || !callback,
967
966
  onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
968
- _optionalChain([callback, 'optionalCall', _12 => _12()]);
967
+ _optionalChain([callback, 'optionalCall', _16 => _16()]);
969
968
  })
970
969
  }
971
970
  );
@@ -1014,7 +1013,7 @@ var ActionBarPrimitiveStopSpeaking = _react.forwardRef.call(void 0, (props, ref)
1014
1013
  ...props,
1015
1014
  ref,
1016
1015
  onClick: _primitive.composeEventHandlers.call(void 0, props.onClick, () => {
1017
- _optionalChain([callback, 'optionalCall', _13 => _13()]);
1016
+ _optionalChain([callback, 'optionalCall', _17 => _17()]);
1018
1017
  })
1019
1018
  }
1020
1019
  );
@@ -1028,7 +1027,7 @@ ActionBarPrimitiveStopSpeaking.displayName = "ActionBarPrimitive.StopSpeaking";
1028
1027
 
1029
1028
  var ActionBarPrimitiveFeedbackPositive = _react.forwardRef.call(void 0, ({ onClick, disabled, ...props }, forwardedRef) => {
1030
1029
  const isSubmitted = useMessage(
1031
- (u) => _optionalChain([u, 'access', _14 => _14.submittedFeedback, 'optionalAccess', _15 => _15.type]) === "positive"
1030
+ (u) => _optionalChain([u, 'access', _18 => _18.submittedFeedback, 'optionalAccess', _19 => _19.type]) === "positive"
1032
1031
  );
1033
1032
  const callback = useActionBarFeedbackPositive();
1034
1033
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1040,7 +1039,7 @@ var ActionBarPrimitiveFeedbackPositive = _react.forwardRef.call(void 0, ({ onCli
1040
1039
  ref: forwardedRef,
1041
1040
  disabled: disabled || !callback,
1042
1041
  onClick: _primitive.composeEventHandlers.call(void 0, onClick, () => {
1043
- _optionalChain([callback, 'optionalCall', _16 => _16()]);
1042
+ _optionalChain([callback, 'optionalCall', _20 => _20()]);
1044
1043
  })
1045
1044
  }
1046
1045
  );
@@ -1054,7 +1053,7 @@ ActionBarPrimitiveFeedbackPositive.displayName = "ActionBarPrimitive.FeedbackPos
1054
1053
 
1055
1054
  var ActionBarPrimitiveFeedbackNegative = _react.forwardRef.call(void 0, ({ onClick, disabled, ...props }, forwardedRef) => {
1056
1055
  const isSubmitted = useMessage(
1057
- (u) => _optionalChain([u, 'access', _17 => _17.submittedFeedback, 'optionalAccess', _18 => _18.type]) === "negative"
1056
+ (u) => _optionalChain([u, 'access', _21 => _21.submittedFeedback, 'optionalAccess', _22 => _22.type]) === "negative"
1058
1057
  );
1059
1058
  const callback = useActionBarFeedbackNegative();
1060
1059
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1066,7 +1065,7 @@ var ActionBarPrimitiveFeedbackNegative = _react.forwardRef.call(void 0, ({ onCli
1066
1065
  ref: forwardedRef,
1067
1066
  disabled: disabled || !callback,
1068
1067
  onClick: _primitive.composeEventHandlers.call(void 0, onClick, () => {
1069
- _optionalChain([callback, 'optionalCall', _19 => _19()]);
1068
+ _optionalChain([callback, 'optionalCall', _23 => _23()]);
1070
1069
  })
1071
1070
  }
1072
1071
  );
@@ -1224,7 +1223,7 @@ var AttachmentContext = _react.createContext.call(void 0,
1224
1223
  );
1225
1224
  function useAttachmentContext(options) {
1226
1225
  const context = _react.useContext.call(void 0, AttachmentContext);
1227
- if (!_optionalChain([options, 'optionalAccess', _20 => _20.optional]) && !context)
1226
+ if (!_optionalChain([options, 'optionalAccess', _24 => _24.optional]) && !context)
1228
1227
  throw new Error(
1229
1228
  "This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
1230
1229
  );
@@ -1505,7 +1504,7 @@ var withSmoothContextProvider = (Component) => {
1505
1504
  };
1506
1505
  function useSmoothContext(options) {
1507
1506
  const context = _react.useContext.call(void 0, SmoothContext);
1508
- if (!_optionalChain([options, 'optionalAccess', _21 => _21.optional]) && !context)
1507
+ if (!_optionalChain([options, 'optionalAccess', _25 => _25.optional]) && !context)
1509
1508
  throw new Error(
1510
1509
  "This component must be used within a SmoothContextProvider."
1511
1510
  );
@@ -1655,11 +1654,22 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
1655
1654
  };
1656
1655
  ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
1657
1656
 
1657
+ // src/utils/getThreadMessageText.tsx
1658
+ var getThreadMessageText = (message) => {
1659
+ const textParts = message.content.filter(
1660
+ (part) => part.type === "text"
1661
+ );
1662
+ return textParts.map((part) => part.text).join("\n\n");
1663
+ };
1664
+
1658
1665
  // src/api/AttachmentRuntime.ts
1659
1666
  var AttachmentRuntimeImpl = class {
1660
1667
  constructor(_core) {
1661
1668
  this._core = _core;
1662
1669
  }
1670
+ get path() {
1671
+ return this._core.path;
1672
+ }
1663
1673
  getState() {
1664
1674
  return this._core.getState();
1665
1675
  }
@@ -1715,7 +1725,7 @@ var BaseSubject = (_class2 = class {constructor() { _class2.prototype.__init5.ca
1715
1725
  if (this._connection) return;
1716
1726
  this._connection = this._connect();
1717
1727
  } else {
1718
- _optionalChain([this, 'access', _22 => _22._connection, 'optionalCall', _23 => _23()]);
1728
+ _optionalChain([this, 'access', _26 => _26._connection, 'optionalCall', _27 => _27()]);
1719
1729
  this._connection = void 0;
1720
1730
  }
1721
1731
  }
@@ -1738,6 +1748,9 @@ var LazyMemoizeSubject = (_class3 = class extends BaseSubject {
1738
1748
  super();_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);;
1739
1749
  this.binding = binding;
1740
1750
  }
1751
+ get path() {
1752
+ return this.binding.path;
1753
+ }
1741
1754
  __init6() {this._previousStateDirty = true}
1742
1755
 
1743
1756
  __init7() {this.getState = () => {
@@ -1784,6 +1797,9 @@ var ShallowMemoizeSubject = (_class4 = class extends BaseSubject {
1784
1797
  throw new Error("Entry not available in the store");
1785
1798
  this._previousState = state;
1786
1799
  }
1800
+ get path() {
1801
+ return this.binding.path;
1802
+ }
1787
1803
 
1788
1804
  __init8() {this.getState = () => {
1789
1805
  if (!this.isConnected) this._syncState();
@@ -1814,42 +1830,45 @@ var EMPTY_ARRAY = Object.freeze([]);
1814
1830
  var getThreadComposerState = (runtime) => {
1815
1831
  return Object.freeze({
1816
1832
  type: "thread",
1817
- isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _24 => _24.isEditing]), () => ( false)),
1818
- canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _25 => _25.canCancel]), () => ( false)),
1819
- isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _26 => _26.isEmpty]), () => ( true)),
1820
- text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _27 => _27.text]), () => ( "")),
1821
- attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _28 => _28.attachments]), () => ( EMPTY_ARRAY)),
1822
- value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _29 => _29.text]), () => ( "")),
1823
- setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _30 => _30.setText, 'access', _31 => _31.bind, 'call', _32 => _32(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1824
- setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _33 => _33.setText, 'access', _34 => _34.bind, 'call', _35 => _35(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1833
+ isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _28 => _28.isEditing]), () => ( false)),
1834
+ canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _29 => _29.canCancel]), () => ( false)),
1835
+ isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _30 => _30.isEmpty]), () => ( true)),
1836
+ text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _31 => _31.text]), () => ( "")),
1837
+ attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _32 => _32.attachments]), () => ( EMPTY_ARRAY)),
1838
+ value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _33 => _33.text]), () => ( "")),
1839
+ setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _34 => _34.setText, 'access', _35 => _35.bind, 'call', _36 => _36(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1840
+ setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _37 => _37.setText, 'access', _38 => _38.bind, 'call', _39 => _39(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1825
1841
  // edit: beginEdit,
1826
- send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _36 => _36.send, 'access', _37 => _37.bind, 'call', _38 => _38(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1827
- cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _39 => _39.cancel, 'access', _40 => _40.bind, 'call', _41 => _41(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1828
- reset: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _42 => _42.reset, 'access', _43 => _43.bind, 'call', _44 => _44(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1829
- addAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _45 => _45.addAttachment, 'access', _46 => _46.bind, 'call', _47 => _47(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1830
- removeAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _48 => _48.removeAttachment, 'access', _49 => _49.bind, 'call', _50 => _50(runtime)]), () => ( METHOD_NOT_SUPPORTED))
1842
+ send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _40 => _40.send, 'access', _41 => _41.bind, 'call', _42 => _42(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1843
+ cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _43 => _43.cancel, 'access', _44 => _44.bind, 'call', _45 => _45(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1844
+ reset: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _46 => _46.reset, 'access', _47 => _47.bind, 'call', _48 => _48(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1845
+ addAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _49 => _49.addAttachment, 'access', _50 => _50.bind, 'call', _51 => _51(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1846
+ removeAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _52 => _52.removeAttachment, 'access', _53 => _53.bind, 'call', _54 => _54(runtime)]), () => ( METHOD_NOT_SUPPORTED))
1831
1847
  });
1832
1848
  };
1833
1849
  var getEditComposerState = (runtime, beginEdit) => {
1834
1850
  return Object.freeze({
1835
1851
  type: "edit",
1836
- isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _51 => _51.isEditing]), () => ( false)),
1837
- canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _52 => _52.canCancel]), () => ( false)),
1838
- isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _53 => _53.isEmpty]), () => ( true)),
1839
- text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _54 => _54.text]), () => ( "")),
1840
- attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _55 => _55.attachments]), () => ( EMPTY_ARRAY)),
1841
- value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _56 => _56.text]), () => ( "")),
1842
- setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _57 => _57.setText, 'access', _58 => _58.bind, 'call', _59 => _59(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1843
- setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _60 => _60.setText, 'access', _61 => _61.bind, 'call', _62 => _62(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1852
+ isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _55 => _55.isEditing]), () => ( false)),
1853
+ canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _56 => _56.canCancel]), () => ( false)),
1854
+ isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _57 => _57.isEmpty]), () => ( true)),
1855
+ text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _58 => _58.text]), () => ( "")),
1856
+ attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _59 => _59.attachments]), () => ( EMPTY_ARRAY)),
1857
+ value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _60 => _60.text]), () => ( "")),
1858
+ setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _61 => _61.setText, 'access', _62 => _62.bind, 'call', _63 => _63(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1859
+ setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _64 => _64.setText, 'access', _65 => _65.bind, 'call', _66 => _66(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1844
1860
  edit: beginEdit,
1845
- send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _63 => _63.send, 'access', _64 => _64.bind, 'call', _65 => _65(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1846
- cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _66 => _66.cancel, 'access', _67 => _67.bind, 'call', _68 => _68(runtime)]), () => ( METHOD_NOT_SUPPORTED))
1861
+ send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _67 => _67.send, 'access', _68 => _68.bind, 'call', _69 => _69(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1862
+ cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _70 => _70.cancel, 'access', _71 => _71.bind, 'call', _72 => _72(runtime)]), () => ( METHOD_NOT_SUPPORTED))
1847
1863
  });
1848
1864
  };
1849
1865
  var ComposerRuntimeImpl = class {
1850
1866
  constructor(_core) {
1851
1867
  this._core = _core;
1852
1868
  }
1869
+ get path() {
1870
+ return this._core.path;
1871
+ }
1853
1872
  /**
1854
1873
  * @deprecated Use `getState().isEditing` instead. This will be removed in 0.6.0.
1855
1874
  */
@@ -1935,23 +1954,28 @@ var ComposerRuntimeImpl = class {
1935
1954
  }
1936
1955
  };
1937
1956
  var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
1957
+ get path() {
1958
+ return this._core.path;
1959
+ }
1938
1960
  get type() {
1939
1961
  return "thread";
1940
1962
  }
1941
1963
 
1942
1964
  constructor(core) {
1943
1965
  const stateBinding = new LazyMemoizeSubject({
1966
+ path: core.path,
1944
1967
  getState: () => getThreadComposerState(core.getState()),
1945
1968
  subscribe: (callback) => core.subscribe(callback)
1946
1969
  });
1947
1970
  super({
1971
+ path: core.path,
1948
1972
  getState: () => core.getState(),
1949
1973
  subscribe: (callback) => stateBinding.subscribe(callback)
1950
1974
  });
1951
1975
  this._getState = stateBinding.getState.bind(stateBinding);
1952
1976
  }
1953
1977
  get attachments() {
1954
- return _nullishCoalesce(_optionalChain([this, 'access', _69 => _69.getState, 'call', _70 => _70(), 'optionalAccess', _71 => _71.attachments]), () => ( EMPTY_ARRAY));
1978
+ return _nullishCoalesce(_optionalChain([this, 'access', _73 => _73.getState, 'call', _74 => _74(), 'optionalAccess', _75 => _75.attachments]), () => ( EMPTY_ARRAY));
1955
1979
  }
1956
1980
  getState() {
1957
1981
  return this._getState();
@@ -1959,6 +1983,12 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
1959
1983
  getAttachmentByIndex(idx) {
1960
1984
  return new ThreadComposerAttachmentRuntimeImpl(
1961
1985
  new ShallowMemoizeSubject({
1986
+ path: {
1987
+ ...this.path,
1988
+ attachmentSource: "thread-composer",
1989
+ attachmentSelector: { type: "index", index: idx },
1990
+ ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`
1991
+ },
1962
1992
  getState: () => {
1963
1993
  const attachments = this.getState().attachments;
1964
1994
  const attachment = attachments[idx];
@@ -1978,16 +2008,21 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
1978
2008
  var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
1979
2009
  constructor(core, _beginEdit) {
1980
2010
  const stateBinding = new LazyMemoizeSubject({
2011
+ path: core.path,
1981
2012
  getState: () => getEditComposerState(core.getState(), this._beginEdit),
1982
2013
  subscribe: (callback) => core.subscribe(callback)
1983
2014
  });
1984
2015
  super({
2016
+ path: core.path,
1985
2017
  getState: () => core.getState(),
1986
2018
  subscribe: (callback) => stateBinding.subscribe(callback)
1987
2019
  });
1988
2020
  this._beginEdit = _beginEdit;
1989
2021
  this._getState = stateBinding.getState.bind(stateBinding);
1990
2022
  }
2023
+ get path() {
2024
+ return this._core.path;
2025
+ }
1991
2026
  get type() {
1992
2027
  return "edit";
1993
2028
  }
@@ -2007,6 +2042,12 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
2007
2042
  getAttachmentByIndex(idx) {
2008
2043
  return new EditComposerAttachmentRuntimeImpl(
2009
2044
  new ShallowMemoizeSubject({
2045
+ path: {
2046
+ ...this.path,
2047
+ attachmentSource: "edit-composer",
2048
+ attachmentSelector: { type: "index", index: idx },
2049
+ ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`
2050
+ },
2010
2051
  getState: () => {
2011
2052
  const attachments = this.getState().attachments;
2012
2053
  const attachment = attachments[idx];
@@ -2030,6 +2071,9 @@ var NestedSubscriptionSubject = class extends BaseSubject {
2030
2071
  super();
2031
2072
  this.binding = binding;
2032
2073
  }
2074
+ get path() {
2075
+ return this.binding.path;
2076
+ }
2033
2077
  getState() {
2034
2078
  return this.binding.getState();
2035
2079
  }
@@ -2041,19 +2085,19 @@ var NestedSubscriptionSubject = class extends BaseSubject {
2041
2085
  this.notifySubscribers();
2042
2086
  };
2043
2087
  let lastState = this.binding.getState();
2044
- let innerUnsubscribe = _optionalChain([lastState, 'optionalAccess', _72 => _72.subscribe, 'call', _73 => _73(callback)]);
2088
+ let innerUnsubscribe = _optionalChain([lastState, 'optionalAccess', _76 => _76.subscribe, 'call', _77 => _77(callback)]);
2045
2089
  const onRuntimeUpdate = () => {
2046
2090
  const newState = this.binding.getState();
2047
2091
  if (newState === lastState) return;
2048
2092
  lastState = newState;
2049
- _optionalChain([innerUnsubscribe, 'optionalCall', _74 => _74()]);
2050
- innerUnsubscribe = _optionalChain([this, 'access', _75 => _75.binding, 'access', _76 => _76.getState, 'call', _77 => _77(), 'optionalAccess', _78 => _78.subscribe, 'call', _79 => _79(callback)]);
2093
+ _optionalChain([innerUnsubscribe, 'optionalCall', _78 => _78()]);
2094
+ innerUnsubscribe = _optionalChain([this, 'access', _79 => _79.binding, 'access', _80 => _80.getState, 'call', _81 => _81(), 'optionalAccess', _82 => _82.subscribe, 'call', _83 => _83(callback)]);
2051
2095
  callback();
2052
2096
  };
2053
2097
  const outerUnsubscribe = this.outerSubscribe(onRuntimeUpdate);
2054
2098
  return () => {
2055
- _optionalChain([outerUnsubscribe, 'optionalCall', _80 => _80()]);
2056
- _optionalChain([innerUnsubscribe, 'optionalCall', _81 => _81()]);
2099
+ _optionalChain([outerUnsubscribe, 'optionalCall', _84 => _84()]);
2100
+ _optionalChain([innerUnsubscribe, 'optionalCall', _85 => _85()]);
2057
2101
  };
2058
2102
  }
2059
2103
  };
@@ -2092,18 +2136,27 @@ var getContentPartState = (message, partIndex) => {
2092
2136
  const status = toContentPartStatus(message, partIndex, part);
2093
2137
  return Object.freeze({ ...part, part, status });
2094
2138
  };
2095
- var MessageRuntimeImpl = (_class5 = class {
2096
- constructor(_core, _threadBinding) {;_class5.prototype.__init9.call(this);
2139
+ var MessageRuntimeImpl = class {
2140
+ constructor(_core, _threadBinding) {
2097
2141
  this._core = _core;
2098
2142
  this._threadBinding = _threadBinding;
2143
+ this.composer = new EditComposerRuntimeImpl(
2144
+ new NestedSubscriptionSubject({
2145
+ path: {
2146
+ ...this.path,
2147
+ ref: this.path.ref + `${this.path.ref}.composer`,
2148
+ composerSource: "edit"
2149
+ },
2150
+ getState: () => this._threadBinding.getState().getEditComposer(this._core.getState().id),
2151
+ subscribe: (callback) => this._threadBinding.subscribe(callback)
2152
+ }),
2153
+ () => this._threadBinding.getState().beginEdit(this._core.getState().id)
2154
+ );
2099
2155
  }
2100
- __init9() {this.composer = new EditComposerRuntimeImpl(
2101
- new NestedSubscriptionSubject({
2102
- getState: () => this._threadBinding.getState().getEditComposer(this._core.getState().id),
2103
- subscribe: (callback) => this._threadBinding.subscribe(callback)
2104
- }),
2105
- () => this._threadBinding.getState().beginEdit(this._core.getState().id)
2106
- )}
2156
+ get path() {
2157
+ return this._core.path;
2158
+ }
2159
+
2107
2160
  getState() {
2108
2161
  return this._core.getState();
2109
2162
  }
@@ -2123,7 +2176,7 @@ var MessageRuntimeImpl = (_class5 = class {
2123
2176
  const state = this._core.getState();
2124
2177
  if (!state) throw new Error("Message is not available");
2125
2178
  const thread = this._threadBinding.getState();
2126
- if (_optionalChain([thread, 'access', _82 => _82.speech, 'optionalAccess', _83 => _83.messageId]) === state.id) {
2179
+ if (_optionalChain([thread, 'access', _86 => _86.speech, 'optionalAccess', _87 => _87.messageId]) === state.id) {
2127
2180
  this._threadBinding.getState().stopSpeaking();
2128
2181
  } else {
2129
2182
  throw new Error("Message is not being spoken");
@@ -2159,13 +2212,21 @@ var MessageRuntimeImpl = (_class5 = class {
2159
2212
  if (!targetBranch) throw new Error("Branch not found");
2160
2213
  this._threadBinding.getState().switchToBranch(targetBranch);
2161
2214
  }
2215
+ unstable_getCopyText() {
2216
+ return getThreadMessageText(this.getState());
2217
+ }
2162
2218
  subscribe(callback) {
2163
2219
  return this._core.subscribe(callback);
2164
2220
  }
2165
2221
  getContentPartByIndex(idx) {
2166
- if (idx < 0) throw new Error("Message index must be >= 0");
2222
+ if (idx < 0) throw new Error("Content part index must be >= 0");
2167
2223
  return new ContentPartRuntimeImpl(
2168
2224
  new ShallowMemoizeSubject({
2225
+ path: {
2226
+ ...this.path,
2227
+ ref: this.path.ref + `${this.path.ref}.content[${idx}]`,
2228
+ contentPartSelector: { type: "index", index: idx }
2229
+ },
2169
2230
  getState: () => {
2170
2231
  return getContentPartState(this.getState(), idx);
2171
2232
  },
@@ -2175,12 +2236,40 @@ var MessageRuntimeImpl = (_class5 = class {
2175
2236
  this._threadBinding
2176
2237
  );
2177
2238
  }
2239
+ getContentPartByToolCallId(toolCallId) {
2240
+ return new ContentPartRuntimeImpl(
2241
+ new ShallowMemoizeSubject({
2242
+ path: {
2243
+ ...this.path,
2244
+ ref: this.path.ref + `${this.path.ref}.content[toolCallId=${JSON.stringify(toolCallId)}]`,
2245
+ contentPartSelector: { type: "toolCallId", toolCallId }
2246
+ },
2247
+ getState: () => {
2248
+ const state = this._core.getState();
2249
+ const idx = state.content.findIndex(
2250
+ (part) => part.type === "tool-call" && part.toolCallId === toolCallId
2251
+ );
2252
+ if (idx === -1) return SKIP_UPDATE;
2253
+ return getContentPartState(state, idx);
2254
+ },
2255
+ subscribe: (callback) => this._core.subscribe(callback)
2256
+ }),
2257
+ this._core,
2258
+ this._threadBinding
2259
+ );
2260
+ }
2178
2261
  getAttachmentByIndex(idx) {
2179
2262
  return new MessageAttachmentRuntimeImpl(
2180
2263
  new ShallowMemoizeSubject({
2264
+ path: {
2265
+ ...this.path,
2266
+ ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,
2267
+ attachmentSource: "message",
2268
+ attachmentSelector: { type: "index", index: idx }
2269
+ },
2181
2270
  getState: () => {
2182
2271
  const attachments = this.getState().attachments;
2183
- const attachment = _optionalChain([attachments, 'optionalAccess', _84 => _84[idx]]);
2272
+ const attachment = _optionalChain([attachments, 'optionalAccess', _88 => _88[idx]]);
2184
2273
  if (!attachment) return SKIP_UPDATE;
2185
2274
  return {
2186
2275
  ...attachment,
@@ -2192,7 +2281,7 @@ var MessageRuntimeImpl = (_class5 = class {
2192
2281
  })
2193
2282
  );
2194
2283
  }
2195
- }, _class5);
2284
+ };
2196
2285
 
2197
2286
  // src/primitives/message/MessageContent.tsx
2198
2287
 
@@ -2263,7 +2352,7 @@ var MessageContentPartImpl = ({
2263
2352
  };
2264
2353
  var MessageContentPart = _react.memo.call(void 0,
2265
2354
  MessageContentPartImpl,
2266
- (prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _85 => _85.components, 'optionalAccess', _86 => _86.Text]) === _optionalChain([next, 'access', _87 => _87.components, 'optionalAccess', _88 => _88.Text]) && _optionalChain([prev, 'access', _89 => _89.components, 'optionalAccess', _90 => _90.Image]) === _optionalChain([next, 'access', _91 => _91.components, 'optionalAccess', _92 => _92.Image]) && _optionalChain([prev, 'access', _93 => _93.components, 'optionalAccess', _94 => _94.UI]) === _optionalChain([next, 'access', _95 => _95.components, 'optionalAccess', _96 => _96.UI]) && _optionalChain([prev, 'access', _97 => _97.components, 'optionalAccess', _98 => _98.tools]) === _optionalChain([next, 'access', _99 => _99.components, 'optionalAccess', _100 => _100.tools])
2355
+ (prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _89 => _89.components, 'optionalAccess', _90 => _90.Text]) === _optionalChain([next, 'access', _91 => _91.components, 'optionalAccess', _92 => _92.Text]) && _optionalChain([prev, 'access', _93 => _93.components, 'optionalAccess', _94 => _94.Image]) === _optionalChain([next, 'access', _95 => _95.components, 'optionalAccess', _96 => _96.Image]) && _optionalChain([prev, 'access', _97 => _97.components, 'optionalAccess', _98 => _98.UI]) === _optionalChain([next, 'access', _99 => _99.components, 'optionalAccess', _100 => _100.UI]) && _optionalChain([prev, 'access', _101 => _101.components, 'optionalAccess', _102 => _102.tools]) === _optionalChain([next, 'access', _103 => _103.components, 'optionalAccess', _104 => _104.tools])
2267
2356
  );
2268
2357
  var MessagePrimitiveContent = ({
2269
2358
  components
@@ -2329,11 +2418,11 @@ var getComponent = (components, attachment) => {
2329
2418
  const type = attachment.type;
2330
2419
  switch (type) {
2331
2420
  case "image":
2332
- return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _101 => _101.Image]), () => ( _optionalChain([components, 'optionalAccess', _102 => _102.Attachment])));
2421
+ return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _105 => _105.Image]), () => ( _optionalChain([components, 'optionalAccess', _106 => _106.Attachment])));
2333
2422
  case "document":
2334
- return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _103 => _103.Document]), () => ( _optionalChain([components, 'optionalAccess', _104 => _104.Attachment])));
2423
+ return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _107 => _107.Document]), () => ( _optionalChain([components, 'optionalAccess', _108 => _108.Attachment])));
2335
2424
  case "file":
2336
- return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _105 => _105.File]), () => ( _optionalChain([components, 'optionalAccess', _106 => _106.Attachment])));
2425
+ return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _109 => _109.File]), () => ( _optionalChain([components, 'optionalAccess', _110 => _110.Attachment])));
2337
2426
  default:
2338
2427
  const _exhaustiveCheck = type;
2339
2428
  throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
@@ -2356,7 +2445,7 @@ var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
2356
2445
  };
2357
2446
  var MessageAttachment = _react.memo.call(void 0,
2358
2447
  MessageAttachmentImpl,
2359
- (prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access', _107 => _107.components, 'optionalAccess', _108 => _108.Image]) === _optionalChain([next, 'access', _109 => _109.components, 'optionalAccess', _110 => _110.Image]) && _optionalChain([prev, 'access', _111 => _111.components, 'optionalAccess', _112 => _112.Document]) === _optionalChain([next, 'access', _113 => _113.components, 'optionalAccess', _114 => _114.Document]) && _optionalChain([prev, 'access', _115 => _115.components, 'optionalAccess', _116 => _116.File]) === _optionalChain([next, 'access', _117 => _117.components, 'optionalAccess', _118 => _118.File]) && _optionalChain([prev, 'access', _119 => _119.components, 'optionalAccess', _120 => _120.Attachment]) === _optionalChain([next, 'access', _121 => _121.components, 'optionalAccess', _122 => _122.Attachment])
2448
+ (prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access', _111 => _111.components, 'optionalAccess', _112 => _112.Image]) === _optionalChain([next, 'access', _113 => _113.components, 'optionalAccess', _114 => _114.Image]) && _optionalChain([prev, 'access', _115 => _115.components, 'optionalAccess', _116 => _116.Document]) === _optionalChain([next, 'access', _117 => _117.components, 'optionalAccess', _118 => _118.Document]) && _optionalChain([prev, 'access', _119 => _119.components, 'optionalAccess', _120 => _120.File]) === _optionalChain([next, 'access', _121 => _121.components, 'optionalAccess', _122 => _122.File]) && _optionalChain([prev, 'access', _123 => _123.components, 'optionalAccess', _124 => _124.Attachment]) === _optionalChain([next, 'access', _125 => _125.components, 'optionalAccess', _126 => _126.Attachment])
2360
2449
  );
2361
2450
  var MessagePrimitiveAttachments = ({ components }) => {
2362
2451
  const attachmentsCount = useMessage(({ message }) => {
@@ -2482,7 +2571,7 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
2482
2571
  const { isRunning } = threadRuntime.getState();
2483
2572
  if (!isRunning) {
2484
2573
  e.preventDefault();
2485
- _optionalChain([textareaRef, 'access', _123 => _123.current, 'optionalAccess', _124 => _124.closest, 'call', _125 => _125("form"), 'optionalAccess', _126 => _126.requestSubmit, 'call', _127 => _127()]);
2574
+ _optionalChain([textareaRef, 'access', _127 => _127.current, 'optionalAccess', _128 => _128.closest, 'call', _129 => _129("form"), 'optionalAccess', _130 => _130.requestSubmit, 'call', _131 => _131()]);
2486
2575
  }
2487
2576
  }
2488
2577
  };
@@ -2556,11 +2645,11 @@ var getComponent2 = (components, attachment) => {
2556
2645
  const type = attachment.type;
2557
2646
  switch (type) {
2558
2647
  case "image":
2559
- return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _128 => _128.Image]), () => ( _optionalChain([components, 'optionalAccess', _129 => _129.Attachment])));
2648
+ return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _132 => _132.Image]), () => ( _optionalChain([components, 'optionalAccess', _133 => _133.Attachment])));
2560
2649
  case "document":
2561
- return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _130 => _130.Document]), () => ( _optionalChain([components, 'optionalAccess', _131 => _131.Attachment])));
2650
+ return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _134 => _134.Document]), () => ( _optionalChain([components, 'optionalAccess', _135 => _135.Attachment])));
2562
2651
  case "file":
2563
- return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _132 => _132.File]), () => ( _optionalChain([components, 'optionalAccess', _133 => _133.Attachment])));
2652
+ return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _136 => _136.File]), () => ( _optionalChain([components, 'optionalAccess', _137 => _137.Attachment])));
2564
2653
  default:
2565
2654
  const _exhaustiveCheck = type;
2566
2655
  throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
@@ -2583,7 +2672,7 @@ var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
2583
2672
  };
2584
2673
  var ComposerAttachment = _react.memo.call(void 0,
2585
2674
  ComposerAttachmentImpl,
2586
- (prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access', _134 => _134.components, 'optionalAccess', _135 => _135.Image]) === _optionalChain([next, 'access', _136 => _136.components, 'optionalAccess', _137 => _137.Image]) && _optionalChain([prev, 'access', _138 => _138.components, 'optionalAccess', _139 => _139.Document]) === _optionalChain([next, 'access', _140 => _140.components, 'optionalAccess', _141 => _141.Document]) && _optionalChain([prev, 'access', _142 => _142.components, 'optionalAccess', _143 => _143.File]) === _optionalChain([next, 'access', _144 => _144.components, 'optionalAccess', _145 => _145.File]) && _optionalChain([prev, 'access', _146 => _146.components, 'optionalAccess', _147 => _147.Attachment]) === _optionalChain([next, 'access', _148 => _148.components, 'optionalAccess', _149 => _149.Attachment])
2675
+ (prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access', _138 => _138.components, 'optionalAccess', _139 => _139.Image]) === _optionalChain([next, 'access', _140 => _140.components, 'optionalAccess', _141 => _141.Image]) && _optionalChain([prev, 'access', _142 => _142.components, 'optionalAccess', _143 => _143.Document]) === _optionalChain([next, 'access', _144 => _144.components, 'optionalAccess', _145 => _145.Document]) && _optionalChain([prev, 'access', _146 => _146.components, 'optionalAccess', _147 => _147.File]) === _optionalChain([next, 'access', _148 => _148.components, 'optionalAccess', _149 => _149.File]) && _optionalChain([prev, 'access', _150 => _150.components, 'optionalAccess', _151 => _151.Attachment]) === _optionalChain([next, 'access', _152 => _152.components, 'optionalAccess', _153 => _153.Attachment])
2587
2676
  );
2588
2677
  var ComposerPrimitiveAttachments = ({ components }) => {
2589
2678
  const attachmentsCount = useComposer((s) => s.attachments.length);
@@ -2927,7 +3016,7 @@ var subscribeToMainThread = (runtime, callback) => {
2927
3016
  let first = true;
2928
3017
  let cleanup;
2929
3018
  const inner = () => {
2930
- _optionalChain([cleanup, 'optionalCall', _150 => _150()]);
3019
+ _optionalChain([cleanup, 'optionalCall', _154 => _154()]);
2931
3020
  cleanup = runtime.thread.subscribe(callback);
2932
3021
  if (!first) {
2933
3022
  callback();
@@ -2938,7 +3027,7 @@ var subscribeToMainThread = (runtime, callback) => {
2938
3027
  inner();
2939
3028
  return () => {
2940
3029
  unsubscribe();
2941
- _optionalChain([cleanup, 'optionalCall', _151 => _151()]);
3030
+ _optionalChain([cleanup, 'optionalCall', _155 => _155()]);
2942
3031
  };
2943
3032
  };
2944
3033
 
@@ -2946,8 +3035,8 @@ var subscribeToMainThread = (runtime, callback) => {
2946
3035
 
2947
3036
 
2948
3037
  // src/runtimes/core/BaseAssistantRuntimeCore.tsx
2949
- var BaseAssistantRuntimeCore = (_class6 = class {
2950
- constructor(_thread) {;_class6.prototype.__init10.call(this);_class6.prototype.__init11.call(this);
3038
+ var BaseAssistantRuntimeCore = (_class5 = class {
3039
+ constructor(_thread) {;_class5.prototype.__init9.call(this);_class5.prototype.__init10.call(this);
2951
3040
  this._thread = _thread;
2952
3041
  this._thread = _thread;
2953
3042
  }
@@ -2958,15 +3047,15 @@ var BaseAssistantRuntimeCore = (_class6 = class {
2958
3047
  this._thread = thread;
2959
3048
  this.subscriptionHandler();
2960
3049
  }
2961
- __init10() {this._subscriptions = /* @__PURE__ */ new Set()}
3050
+ __init9() {this._subscriptions = /* @__PURE__ */ new Set()}
2962
3051
  subscribe(callback) {
2963
3052
  this._subscriptions.add(callback);
2964
3053
  return () => this._subscriptions.delete(callback);
2965
3054
  }
2966
- __init11() {this.subscriptionHandler = () => {
3055
+ __init10() {this.subscriptionHandler = () => {
2967
3056
  for (const callback of this._subscriptions) callback();
2968
3057
  }}
2969
- }, _class6);
3058
+ }, _class5);
2970
3059
 
2971
3060
  // src/internal.ts
2972
3061
  var internal_exports = {};
@@ -2986,12 +3075,12 @@ _chunkPZ5AY32Cjs.__export.call(void 0, internal_exports, {
2986
3075
 
2987
3076
  // src/runtimes/composer/BaseComposerRuntimeCore.tsx
2988
3077
  var isAttachmentComplete = (a) => a.status.type === "complete";
2989
- var BaseComposerRuntimeCore = (_class7 = class {constructor() { _class7.prototype.__init12.call(this);_class7.prototype.__init13.call(this);_class7.prototype.__init14.call(this);_class7.prototype.__init15.call(this); }
2990
- __init12() {this.isEditing = true}
3078
+ var BaseComposerRuntimeCore = (_class6 = class {constructor() { _class6.prototype.__init11.call(this);_class6.prototype.__init12.call(this);_class6.prototype.__init13.call(this);_class6.prototype.__init14.call(this); }
3079
+ __init11() {this.isEditing = true}
2991
3080
  getAttachmentAccept() {
2992
- return _nullishCoalesce(_optionalChain([this, 'access', _152 => _152.getAttachmentAdapter, 'call', _153 => _153(), 'optionalAccess', _154 => _154.accept]), () => ( "*"));
3081
+ return _nullishCoalesce(_optionalChain([this, 'access', _156 => _156.getAttachmentAdapter, 'call', _157 => _157(), 'optionalAccess', _158 => _158.accept]), () => ( "*"));
2993
3082
  }
2994
- __init13() {this._attachments = []}
3083
+ __init12() {this._attachments = []}
2995
3084
  set attachments(value) {
2996
3085
  this._attachments = value;
2997
3086
  this.notifySubscribers();
@@ -3002,7 +3091,7 @@ var BaseComposerRuntimeCore = (_class7 = class {constructor() { _class7.prototyp
3002
3091
  get isEmpty() {
3003
3092
  return !this.text.trim() && !this.attachments.length;
3004
3093
  }
3005
- __init14() {this._text = ""}
3094
+ __init13() {this._text = ""}
3006
3095
  get text() {
3007
3096
  return this._text;
3008
3097
  }
@@ -3021,7 +3110,7 @@ var BaseComposerRuntimeCore = (_class7 = class {constructor() { _class7.prototyp
3021
3110
  this.attachments.map(async (a) => {
3022
3111
  if (isAttachmentComplete(a)) return a;
3023
3112
  const result = await adapter.send(a);
3024
- if (_optionalChain([result, 'access', _155 => _155.status, 'optionalAccess', _156 => _156.type]) !== "complete") {
3113
+ if (_optionalChain([result, 'access', _159 => _159.status, 'optionalAccess', _160 => _160.type]) !== "complete") {
3025
3114
  result.status = { type: "complete" };
3026
3115
  }
3027
3116
  return result;
@@ -3055,7 +3144,7 @@ var BaseComposerRuntimeCore = (_class7 = class {constructor() { _class7.prototyp
3055
3144
  this._attachments = this._attachments.toSpliced(index, 1);
3056
3145
  this.notifySubscribers();
3057
3146
  }
3058
- __init15() {this._subscriptions = /* @__PURE__ */ new Set()}
3147
+ __init14() {this._subscriptions = /* @__PURE__ */ new Set()}
3059
3148
  notifySubscribers() {
3060
3149
  for (const callback of this._subscriptions) callback();
3061
3150
  }
@@ -3063,16 +3152,16 @@ var BaseComposerRuntimeCore = (_class7 = class {constructor() { _class7.prototyp
3063
3152
  this._subscriptions.add(callback);
3064
3153
  return () => this._subscriptions.delete(callback);
3065
3154
  }
3066
- }, _class7);
3155
+ }, _class6);
3067
3156
 
3068
3157
  // src/runtimes/composer/DefaultThreadComposerRuntimeCore.tsx
3069
- var DefaultThreadComposerRuntimeCore = (_class8 = class extends BaseComposerRuntimeCore {
3158
+ var DefaultThreadComposerRuntimeCore = (_class7 = class extends BaseComposerRuntimeCore {
3070
3159
  constructor(runtime) {
3071
- super();_class8.prototype.__init16.call(this);;
3160
+ super();_class7.prototype.__init15.call(this);;
3072
3161
  this.runtime = runtime;
3073
3162
  this.connect();
3074
3163
  }
3075
- __init16() {this._canCancel = false}
3164
+ __init15() {this._canCancel = false}
3076
3165
  get canCancel() {
3077
3166
  return this._canCancel;
3078
3167
  }
@@ -3080,7 +3169,7 @@ var DefaultThreadComposerRuntimeCore = (_class8 = class extends BaseComposerRunt
3080
3169
  return super.attachments;
3081
3170
  }
3082
3171
  getAttachmentAdapter() {
3083
- return _optionalChain([this, 'access', _157 => _157.runtime, 'access', _158 => _158.adapters, 'optionalAccess', _159 => _159.attachments]);
3172
+ return _optionalChain([this, 'access', _161 => _161.runtime, 'access', _162 => _162.adapters, 'optionalAccess', _163 => _163.attachments]);
3084
3173
  }
3085
3174
  connect() {
3086
3175
  return this.runtime.subscribe(() => {
@@ -3093,27 +3182,41 @@ var DefaultThreadComposerRuntimeCore = (_class8 = class extends BaseComposerRunt
3093
3182
  async handleSend(message) {
3094
3183
  this.runtime.append({
3095
3184
  ...message,
3096
- parentId: _nullishCoalesce(_optionalChain([this, 'access', _160 => _160.runtime, 'access', _161 => _161.messages, 'access', _162 => _162.at, 'call', _163 => _163(-1), 'optionalAccess', _164 => _164.id]), () => ( null))
3185
+ parentId: _nullishCoalesce(_optionalChain([this, 'access', _164 => _164.runtime, 'access', _165 => _165.messages, 'access', _166 => _166.at, 'call', _167 => _167(-1), 'optionalAccess', _168 => _168.id]), () => ( null))
3097
3186
  });
3098
3187
  }
3099
3188
  async cancel() {
3100
3189
  this.runtime.cancelRun();
3101
3190
  }
3102
- }, _class8);
3191
+ }, _class7);
3103
3192
 
3104
3193
  // src/utils/ProxyConfigProvider.ts
3105
- var ProxyConfigProvider = (_class9 = class {constructor() { _class9.prototype.__init17.call(this); }
3106
- __init17() {this._providers = /* @__PURE__ */ new Set()}
3194
+ var ProxyConfigProvider = (_class8 = class {constructor() { _class8.prototype.__init16.call(this);_class8.prototype.__init17.call(this); }
3195
+ __init16() {this._providers = /* @__PURE__ */ new Set()}
3107
3196
  getModelConfig() {
3108
- return _chunkBDPD5HCKjs.mergeModelConfigs.call(void 0, this._providers);
3197
+ return _chunkC6UZOY5Ajs.mergeModelConfigs.call(void 0, this._providers);
3109
3198
  }
3110
3199
  registerModelConfigProvider(provider) {
3111
3200
  this._providers.add(provider);
3201
+ const unsubscribe = _optionalChain([provider, 'access', _169 => _169.subscribe, 'optionalCall', _170 => _170(() => {
3202
+ this.notifySubscribers();
3203
+ })]);
3204
+ this.notifySubscribers();
3112
3205
  return () => {
3113
3206
  this._providers.delete(provider);
3207
+ _optionalChain([unsubscribe, 'optionalCall', _171 => _171()]);
3208
+ this.notifySubscribers();
3114
3209
  };
3115
3210
  }
3116
- }, _class9);
3211
+ __init17() {this._subscribers = /* @__PURE__ */ new Set()}
3212
+ notifySubscribers() {
3213
+ for (const callback of this._subscribers) callback();
3214
+ }
3215
+ subscribe(callback) {
3216
+ this._subscribers.add(callback);
3217
+ return () => this._subscribers.delete(callback);
3218
+ }
3219
+ }, _class8);
3117
3220
 
3118
3221
  // src/utils/idUtils.tsx
3119
3222
  var _nonsecure = require('nanoid/non-secure');
@@ -3180,7 +3283,7 @@ var findHead = (message) => {
3180
3283
  if ("current" in message) return message;
3181
3284
  return null;
3182
3285
  };
3183
- var MessageRepository = (_class10 = class {constructor() { _class10.prototype.__init18.call(this);_class10.prototype.__init19.call(this);_class10.prototype.__init20.call(this); }
3286
+ var MessageRepository = (_class9 = class {constructor() { _class9.prototype.__init18.call(this);_class9.prototype.__init19.call(this);_class9.prototype.__init20.call(this); }
3184
3287
  __init18() {this.messages = /* @__PURE__ */ new Map()}
3185
3288
  // message_id -> item
3186
3289
  __init19() {this.head = null}
@@ -3226,7 +3329,7 @@ var MessageRepository = (_class10 = class {constructor() { _class10.prototype.__
3226
3329
  }
3227
3330
  }
3228
3331
  getMessages() {
3229
- const messages2 = new Array(_nullishCoalesce(_optionalChain([this, 'access', _165 => _165.head, 'optionalAccess', _166 => _166.level]), () => ( 0)));
3332
+ const messages2 = new Array(_nullishCoalesce(_optionalChain([this, 'access', _172 => _172.head, 'optionalAccess', _173 => _173.level]), () => ( 0)));
3230
3333
  for (let current = this.head; current; current = current.prev) {
3231
3334
  messages2[current.level] = current.current;
3232
3335
  }
@@ -3264,7 +3367,7 @@ var MessageRepository = (_class10 = class {constructor() { _class10.prototype.__
3264
3367
  "MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui."
3265
3368
  );
3266
3369
  return {
3267
- parentId: _nullishCoalesce(_optionalChain([message, 'access', _167 => _167.prev, 'optionalAccess', _168 => _168.current, 'access', _169 => _169.id]), () => ( null)),
3370
+ parentId: _nullishCoalesce(_optionalChain([message, 'access', _174 => _174.prev, 'optionalAccess', _175 => _175.current, 'access', _176 => _176.id]), () => ( null)),
3268
3371
  message: message.current
3269
3372
  };
3270
3373
  }
@@ -3348,11 +3451,11 @@ var MessageRepository = (_class10 = class {constructor() { _class10.prototype.__
3348
3451
  for (const [, message] of this.messages) {
3349
3452
  exportItems.push({
3350
3453
  message: message.current,
3351
- parentId: _nullishCoalesce(_optionalChain([message, 'access', _170 => _170.prev, 'optionalAccess', _171 => _171.current, 'access', _172 => _172.id]), () => ( null))
3454
+ parentId: _nullishCoalesce(_optionalChain([message, 'access', _177 => _177.prev, 'optionalAccess', _178 => _178.current, 'access', _179 => _179.id]), () => ( null))
3352
3455
  });
3353
3456
  }
3354
3457
  return {
3355
- headId: _nullishCoalesce(_optionalChain([this, 'access', _173 => _173.head, 'optionalAccess', _174 => _174.current, 'access', _175 => _175.id]), () => ( null)),
3458
+ headId: _nullishCoalesce(_optionalChain([this, 'access', _180 => _180.head, 'optionalAccess', _181 => _181.current, 'access', _182 => _182.id]), () => ( null)),
3356
3459
  messages: exportItems
3357
3460
  };
3358
3461
  }
@@ -3360,9 +3463,9 @@ var MessageRepository = (_class10 = class {constructor() { _class10.prototype.__
3360
3463
  for (const { message, parentId } of messages2) {
3361
3464
  this.addOrUpdateMessage(parentId, message);
3362
3465
  }
3363
- this.resetHead(_nullishCoalesce(_nullishCoalesce(headId, () => ( _optionalChain([messages2, 'access', _176 => _176.at, 'call', _177 => _177(-1), 'optionalAccess', _178 => _178.message, 'access', _179 => _179.id]))), () => ( null)));
3466
+ this.resetHead(_nullishCoalesce(_nullishCoalesce(headId, () => ( _optionalChain([messages2, 'access', _183 => _183.at, 'call', _184 => _184(-1), 'optionalAccess', _185 => _185.message, 'access', _186 => _186.id]))), () => ( null)));
3364
3467
  }
3365
- }, _class10);
3468
+ }, _class9);
3366
3469
 
3367
3470
  // src/ui/base/tooltip-icon-button.tsx
3368
3471
 
@@ -3464,7 +3567,7 @@ TooltipIconButton.displayName = "TooltipIconButton";
3464
3567
  var toAppendMessage = (messages2, message) => {
3465
3568
  if (typeof message === "string") {
3466
3569
  return {
3467
- parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _180 => _180.at, 'call', _181 => _181(-1), 'optionalAccess', _182 => _182.id]), () => ( null)),
3570
+ parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _187 => _187.at, 'call', _188 => _188(-1), 'optionalAccess', _189 => _189.id]), () => ( null)),
3468
3571
  role: "user",
3469
3572
  content: [{ type: "text", text: message }],
3470
3573
  attachments: []
@@ -3474,7 +3577,7 @@ var toAppendMessage = (messages2, message) => {
3474
3577
  return message;
3475
3578
  }
3476
3579
  return {
3477
- parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([messages2, 'access', _183 => _183.at, 'call', _184 => _184(-1), 'optionalAccess', _185 => _185.id]))), () => ( null)),
3580
+ parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([messages2, 'access', _190 => _190.at, 'call', _191 => _191(-1), 'optionalAccess', _192 => _192.id]))), () => ( null)),
3478
3581
  role: _nullishCoalesce(message.role, () => ( "user")),
3479
3582
  content: message.content,
3480
3583
  attachments: _nullishCoalesce(message.attachments, () => ( []))
@@ -3486,15 +3589,17 @@ var getThreadState = (runtime) => {
3486
3589
  threadId: runtime.threadId,
3487
3590
  capabilities: runtime.capabilities,
3488
3591
  isDisabled: runtime.isDisabled,
3489
- isRunning: _optionalChain([lastMessage, 'optionalAccess', _186 => _186.role]) !== "assistant" ? false : lastMessage.status.type === "running",
3592
+ isRunning: _optionalChain([lastMessage, 'optionalAccess', _193 => _193.role]) !== "assistant" ? false : lastMessage.status.type === "running",
3490
3593
  messages: runtime.messages,
3491
3594
  suggestions: runtime.suggestions,
3492
3595
  extras: runtime.extras,
3493
3596
  speech: runtime.speech
3494
3597
  });
3495
3598
  };
3496
- var ThreadRuntimeImpl = (_class11 = class {
3497
- // public path = "assistant.threads[main]"; // TODO
3599
+ var ThreadRuntimeImpl = (_class10 = class {
3600
+ get path() {
3601
+ return this._threadBinding.path;
3602
+ }
3498
3603
  /**
3499
3604
  * @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
3500
3605
  */
@@ -3547,24 +3652,32 @@ var ThreadRuntimeImpl = (_class11 = class {
3547
3652
  return this._threadBinding.getState();
3548
3653
  }
3549
3654
 
3550
- constructor(threadBinding) {;_class11.prototype.__init21.call(this);_class11.prototype.__init22.call(this);
3655
+ constructor(threadBinding) {;_class10.prototype.__init21.call(this);
3551
3656
  const stateBinding = new LazyMemoizeSubject({
3657
+ path: threadBinding.path,
3552
3658
  getState: () => getThreadState(threadBinding.getState()),
3553
3659
  subscribe: (callback) => threadBinding.subscribe(callback)
3554
3660
  });
3555
3661
  this._threadBinding = {
3662
+ path: threadBinding.path,
3556
3663
  getState: () => threadBinding.getState(),
3557
3664
  getStateState: () => stateBinding.getState(),
3558
3665
  outerSubscribe: (callback) => threadBinding.outerSubscribe(callback),
3559
3666
  subscribe: (callback) => threadBinding.subscribe(callback)
3560
3667
  };
3668
+ this.composer = new ThreadComposerRuntimeImpl(
3669
+ new NestedSubscriptionSubject({
3670
+ path: {
3671
+ ...this.path,
3672
+ ref: this.path.ref + `${this.path.ref}.composer`,
3673
+ composerSource: "thread"
3674
+ },
3675
+ getState: () => this._threadBinding.getState().composer,
3676
+ subscribe: (callback) => this._threadBinding.subscribe(callback)
3677
+ })
3678
+ );
3561
3679
  }
3562
- __init21() {this.composer = new ThreadComposerRuntimeImpl(
3563
- new NestedSubscriptionSubject({
3564
- getState: () => this._threadBinding.getState().composer,
3565
- subscribe: (callback) => this._threadBinding.subscribe(callback)
3566
- })
3567
- )}
3680
+
3568
3681
  getState() {
3569
3682
  return this._threadBinding.getStateState();
3570
3683
  }
@@ -3642,37 +3755,67 @@ var ThreadRuntimeImpl = (_class11 = class {
3642
3755
  }
3643
3756
  getMesssageByIndex(idx) {
3644
3757
  if (idx < 0) throw new Error("Message index must be >= 0");
3758
+ return this._getMessageRuntime(
3759
+ {
3760
+ ...this.path,
3761
+ ref: this.path.ref + `${this.path.ref}.messages[${idx}]`,
3762
+ messageSelector: { type: "index", index: idx }
3763
+ },
3764
+ () => {
3765
+ const messages2 = this._threadBinding.getState().messages;
3766
+ const message = messages2[idx];
3767
+ if (!message) return void 0;
3768
+ return {
3769
+ message,
3770
+ parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _194 => _194[idx - 1], 'optionalAccess', _195 => _195.id]), () => ( null))
3771
+ };
3772
+ }
3773
+ );
3774
+ }
3775
+ getMesssageById(messageId) {
3776
+ return this._getMessageRuntime(
3777
+ {
3778
+ ...this.path,
3779
+ ref: this.path.ref + `${this.path.ref}.messages[messageId=${JSON.stringify(messageId)}]`,
3780
+ messageSelector: { type: "messageId", messageId }
3781
+ },
3782
+ () => this._threadBinding.getState().getMessageById(messageId)
3783
+ );
3784
+ }
3785
+ _getMessageRuntime(path, callback) {
3645
3786
  return new MessageRuntimeImpl(
3646
3787
  new ShallowMemoizeSubject({
3788
+ path,
3647
3789
  getState: () => {
3648
- const { messages: messages2, speech: speechState } = this.getState();
3649
- const message = messages2[idx];
3650
- if (!message) return SKIP_UPDATE;
3790
+ const { message, parentId } = _nullishCoalesce(callback(), () => ( {}));
3791
+ const { messages: messages2, speech: speechState } = this._threadBinding.getState();
3792
+ if (!message || parentId === void 0) return SKIP_UPDATE;
3651
3793
  const thread = this._threadBinding.getState();
3652
3794
  const branches = thread.getBranches(message.id);
3653
3795
  const submittedFeedback = thread.getSubmittedFeedback(message.id);
3654
3796
  return {
3655
3797
  ...message,
3656
3798
  message,
3657
- isLast: idx === messages2.length - 1,
3658
- parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _187 => _187[idx - 1], 'optionalAccess', _188 => _188.id]), () => ( null)),
3799
+ isLast: _optionalChain([messages2, 'access', _196 => _196.at, 'call', _197 => _197(-1), 'optionalAccess', _198 => _198.id]) === message.id,
3800
+ parentId,
3659
3801
  branches,
3660
3802
  branchNumber: branches.indexOf(message.id) + 1,
3661
3803
  branchCount: branches.length,
3662
- speech: _optionalChain([speechState, 'optionalAccess', _189 => _189.messageId]) === message.id ? speechState : void 0,
3804
+ speech: _optionalChain([speechState, 'optionalAccess', _199 => _199.messageId]) === message.id ? speechState : void 0,
3663
3805
  submittedFeedback
3664
3806
  };
3665
3807
  },
3666
- subscribe: (callback) => this._threadBinding.subscribe(callback)
3808
+ subscribe: (callback2) => this._threadBinding.subscribe(callback2)
3667
3809
  }),
3668
3810
  this._threadBinding
3669
3811
  );
3670
3812
  }
3671
- __init22() {this._eventListenerNestedSubscriptions = /* @__PURE__ */ new Map()}
3813
+ __init21() {this._eventListenerNestedSubscriptions = /* @__PURE__ */ new Map()}
3672
3814
  unstable_on(event, callback) {
3673
3815
  let subject = this._eventListenerNestedSubscriptions.get(event);
3674
3816
  if (!subject) {
3675
3817
  subject = new NestedSubscriptionSubject({
3818
+ path: this.path,
3676
3819
  getState: () => ({
3677
3820
  subscribe: (callback2) => this._threadBinding.getState().unstable_on(event, callback2)
3678
3821
  }),
@@ -3682,7 +3825,7 @@ var ThreadRuntimeImpl = (_class11 = class {
3682
3825
  }
3683
3826
  return subject.subscribe(callback);
3684
3827
  }
3685
- }, _class11);
3828
+ }, _class10);
3686
3829
 
3687
3830
  // src/api/AssistantRuntime.ts
3688
3831
  var AssistantRuntimeImpl = class _AssistantRuntimeImpl {
@@ -3702,16 +3845,19 @@ var AssistantRuntimeImpl = class _AssistantRuntimeImpl {
3702
3845
  registerModelConfigProvider(provider) {
3703
3846
  return this._core.registerModelConfigProvider(provider);
3704
3847
  }
3705
- // TODO events for thread switching
3706
3848
  /**
3707
3849
  * @deprecated Thread is now static and never gets updated. This will be removed in 0.6.0.
3708
3850
  */
3709
3851
  subscribe(callback) {
3710
3852
  return this._core.subscribe(callback);
3711
3853
  }
3712
- static createThreadRuntime(_core, CustomThreadRuntime = ThreadRuntimeImpl) {
3854
+ static createMainThreadRuntime(_core, CustomThreadRuntime = ThreadRuntimeImpl) {
3713
3855
  return new CustomThreadRuntime(
3714
3856
  new NestedSubscriptionSubject({
3857
+ path: {
3858
+ ref: "threads.main",
3859
+ threadSelector: { type: "main" }
3860
+ },
3715
3861
  getState: () => _core.thread,
3716
3862
  subscribe: (callback) => _core.subscribe(callback)
3717
3863
  })
@@ -3720,7 +3866,7 @@ var AssistantRuntimeImpl = class _AssistantRuntimeImpl {
3720
3866
  static create(_core, CustomThreadRuntime = ThreadRuntimeImpl) {
3721
3867
  return new _AssistantRuntimeImpl(
3722
3868
  _core,
3723
- _AssistantRuntimeImpl.createThreadRuntime(_core, CustomThreadRuntime)
3869
+ _AssistantRuntimeImpl.createMainThreadRuntime(_core, CustomThreadRuntime)
3724
3870
  );
3725
3871
  }
3726
3872
  };
@@ -3791,7 +3937,7 @@ var fromLanguageModelMessages = (lm, { mergeSteps }) => {
3791
3937
  });
3792
3938
  if (mergeSteps) {
3793
3939
  const previousMessage = messages2[messages2.length - 1];
3794
- if (_optionalChain([previousMessage, 'optionalAccess', _190 => _190.role]) === "assistant") {
3940
+ if (_optionalChain([previousMessage, 'optionalAccess', _200 => _200.role]) === "assistant") {
3795
3941
  previousMessage.content.push(...newContent);
3796
3942
  break;
3797
3943
  }
@@ -3804,7 +3950,7 @@ var fromLanguageModelMessages = (lm, { mergeSteps }) => {
3804
3950
  }
3805
3951
  case "tool": {
3806
3952
  const previousMessage = messages2[messages2.length - 1];
3807
- if (_optionalChain([previousMessage, 'optionalAccess', _191 => _191.role]) !== "assistant")
3953
+ if (_optionalChain([previousMessage, 'optionalAccess', _201 => _201.role]) !== "assistant")
3808
3954
  throw new Error(
3809
3955
  "A tool message must be preceded by an assistant message."
3810
3956
  );
@@ -3880,14 +4026,14 @@ function streamPartDecoderStream() {
3880
4026
  controller.enqueue(decodeStreamPart(chunk));
3881
4027
  }
3882
4028
  });
3883
- return new (0, _chunkBDPD5HCKjs.PipeableTransformStream)((readable) => {
4029
+ return new (0, _chunkC6UZOY5Ajs.PipeableTransformStream)((readable) => {
3884
4030
  return readable.pipeThrough(new TextDecoderStream()).pipeThrough(chunkByLineStream()).pipeThrough(decodeStream);
3885
4031
  });
3886
4032
  }
3887
4033
 
3888
4034
  // src/runtimes/edge/streams/utils/index.ts
3889
4035
  var streamUtils = {
3890
- streamPartEncoderStream: _chunkBDPD5HCKjs.streamPartEncoderStream,
4036
+ streamPartEncoderStream: _chunkC6UZOY5Ajs.streamPartEncoderStream,
3891
4037
  streamPartDecoderStream
3892
4038
  };
3893
4039
 
@@ -3922,12 +4068,19 @@ function assistantDecoderStream() {
3922
4068
  const { toolCallId: id, toolName: name } = value;
3923
4069
  toolCallNames.set(id, name);
3924
4070
  currentToolCall = { id, name, argsText: "" };
4071
+ controller.enqueue({
4072
+ type: "tool-call-delta",
4073
+ toolCallType: "function",
4074
+ toolCallId: id,
4075
+ toolName: name,
4076
+ argsTextDelta: ""
4077
+ });
3925
4078
  break;
3926
4079
  }
3927
4080
  case "c" /* ToolCallDelta */: {
3928
4081
  const { toolCallId, argsTextDelta } = value;
3929
4082
  const toolName = toolCallNames.get(toolCallId);
3930
- if (_optionalChain([currentToolCall, 'optionalAccess', _192 => _192.id]) === toolCallId) {
4083
+ if (_optionalChain([currentToolCall, 'optionalAccess', _202 => _202.id]) === toolCallId) {
3931
4084
  currentToolCall.argsText += argsTextDelta;
3932
4085
  }
3933
4086
  controller.enqueue({
@@ -4028,8 +4181,8 @@ var EdgeChatAdapter = class {
4028
4181
  credentials: _nullishCoalesce(this.options.credentials, () => ( "same-origin")),
4029
4182
  body: JSON.stringify({
4030
4183
  system: config.system,
4031
- messages: _chunkBDPD5HCKjs.toCoreMessages.call(void 0, messages2),
4032
- tools: config.tools ? _chunkBDPD5HCKjs.toLanguageModelTools.call(void 0, config.tools) : [],
4184
+ messages: _chunkC6UZOY5Ajs.toCoreMessages.call(void 0, messages2),
4185
+ tools: config.tools ? _chunkC6UZOY5Ajs.toLanguageModelTools.call(void 0, config.tools) : [],
4033
4186
  ...config.callSettings,
4034
4187
  ...config.config,
4035
4188
  ...this.options.body
@@ -4039,7 +4192,7 @@ var EdgeChatAdapter = class {
4039
4192
  if (!result.ok) {
4040
4193
  throw new Error(`Status ${result.status}: ${await result.text()}`);
4041
4194
  }
4042
- const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(_chunkBDPD5HCKjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkBDPD5HCKjs.runResultStream.call(void 0, ));
4195
+ const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(_chunkC6UZOY5Ajs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkC6UZOY5Ajs.runResultStream.call(void 0, ));
4043
4196
  let update;
4044
4197
  for await (update of asAsyncIterable(stream)) {
4045
4198
  yield update;
@@ -4071,7 +4224,7 @@ var useEdgeRuntime = (options) => {
4071
4224
  };
4072
4225
 
4073
4226
  // src/runtimes/local/shouldContinue.tsx
4074
- 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);
4227
+ var shouldContinue = (result) => _optionalChain([result, 'access', _203 => _203.status, 'optionalAccess', _204 => _204.type]) === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
4075
4228
 
4076
4229
  // src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx
4077
4230
  var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
@@ -4091,7 +4244,7 @@ var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
4091
4244
  return true;
4092
4245
  }
4093
4246
  getAttachmentAdapter() {
4094
- return _optionalChain([this, 'access', _195 => _195.runtime, 'access', _196 => _196.adapters, 'optionalAccess', _197 => _197.attachments]);
4247
+ return _optionalChain([this, 'access', _205 => _205.runtime, 'access', _206 => _206.adapters, 'optionalAccess', _207 => _207.attachments]);
4095
4248
  }
4096
4249
 
4097
4250
 
@@ -4115,20 +4268,23 @@ var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
4115
4268
  };
4116
4269
 
4117
4270
  // src/runtimes/core/BaseThreadRuntimeCore.tsx
4118
- var BaseThreadRuntimeCore = (_class12 = class {
4119
- constructor(configProvider) {;_class12.prototype.__init23.call(this);_class12.prototype.__init24.call(this);_class12.prototype.__init25.call(this);_class12.prototype.__init26.call(this);_class12.prototype.__init27.call(this);_class12.prototype.__init28.call(this);
4271
+ var BaseThreadRuntimeCore = (_class11 = class {
4272
+ constructor(configProvider) {;_class11.prototype.__init22.call(this);_class11.prototype.__init23.call(this);_class11.prototype.__init24.call(this);_class11.prototype.__init25.call(this);_class11.prototype.__init26.call(this);_class11.prototype.__init27.call(this);
4120
4273
  this.configProvider = configProvider;
4274
+ _optionalChain([this, 'access', _208 => _208.configProvider, 'access', _209 => _209.subscribe, 'optionalCall', _210 => _210(() => {
4275
+ this._notifyEventSubscribers("model-config-update");
4276
+ })]);
4121
4277
  }
4122
- __init23() {this._subscriptions = /* @__PURE__ */ new Set()}
4123
- __init24() {this.repository = new MessageRepository()}
4278
+ __init22() {this._subscriptions = /* @__PURE__ */ new Set()}
4279
+ __init23() {this.repository = new MessageRepository()}
4124
4280
  get messages() {
4125
4281
  return this.repository.getMessages();
4126
4282
  }
4127
- __init25() {this.composer = new DefaultThreadComposerRuntimeCore(this)}
4283
+ __init24() {this.composer = new DefaultThreadComposerRuntimeCore(this)}
4128
4284
  getModelConfig() {
4129
4285
  return this.configProvider.getModelConfig();
4130
4286
  }
4131
- __init26() {this._editComposers = /* @__PURE__ */ new Map()}
4287
+ __init25() {this._editComposers = /* @__PURE__ */ new Map()}
4132
4288
  getEditComposer(messageId) {
4133
4289
  return this._editComposers.get(messageId);
4134
4290
  }
@@ -4145,6 +4301,9 @@ var BaseThreadRuntimeCore = (_class12 = class {
4145
4301
  );
4146
4302
  this._notifySubscribers();
4147
4303
  }
4304
+ getMessageById(messageId) {
4305
+ return this.repository.getMessage(messageId);
4306
+ }
4148
4307
  getBranches(messageId) {
4149
4308
  return this.repository.getBranches(messageId);
4150
4309
  }
@@ -4164,12 +4323,12 @@ var BaseThreadRuntimeCore = (_class12 = class {
4164
4323
  this._subscriptions.add(callback);
4165
4324
  return () => this._subscriptions.delete(callback);
4166
4325
  }
4167
- __init27() {this._submittedFeedback = {}}
4326
+ __init26() {this._submittedFeedback = {}}
4168
4327
  getSubmittedFeedback(messageId) {
4169
4328
  return this._submittedFeedback[messageId];
4170
4329
  }
4171
4330
  submitFeedback({ messageId, type }) {
4172
- const adapter = _optionalChain([this, 'access', _198 => _198.adapters, 'optionalAccess', _199 => _199.feedback]);
4331
+ const adapter = _optionalChain([this, 'access', _211 => _211.adapters, 'optionalAccess', _212 => _212.feedback]);
4173
4332
  if (!adapter) throw new Error("Feedback adapter not configured");
4174
4333
  const { message } = this.repository.getMessage(messageId);
4175
4334
  adapter.submit({ message, type });
@@ -4179,11 +4338,11 @@ var BaseThreadRuntimeCore = (_class12 = class {
4179
4338
 
4180
4339
 
4181
4340
  speak(messageId) {
4182
- const adapter = _optionalChain([this, 'access', _200 => _200.adapters, 'optionalAccess', _201 => _201.speech]);
4341
+ const adapter = _optionalChain([this, 'access', _213 => _213.adapters, 'optionalAccess', _214 => _214.speech]);
4183
4342
  if (!adapter) throw new Error("Speech adapter not configured");
4184
4343
  const { message } = this.repository.getMessage(messageId);
4185
- _optionalChain([this, 'access', _202 => _202._stopSpeaking, 'optionalCall', _203 => _203()]);
4186
- const utterance = adapter.speak(message);
4344
+ _optionalChain([this, 'access', _215 => _215._stopSpeaking, 'optionalCall', _216 => _216()]);
4345
+ const utterance = adapter.speak(getThreadMessageText(message));
4187
4346
  const unsub = utterance.subscribe(() => {
4188
4347
  if (utterance.status.type === "ended") {
4189
4348
  this._stopSpeaking = void 0;
@@ -4214,7 +4373,7 @@ var BaseThreadRuntimeCore = (_class12 = class {
4214
4373
  this.repository.import(data);
4215
4374
  this._notifySubscribers();
4216
4375
  }
4217
- __init28() {this._eventSubscribers = /* @__PURE__ */ new Map()}
4376
+ __init27() {this._eventSubscribers = /* @__PURE__ */ new Map()}
4218
4377
  unstable_on(event, callback) {
4219
4378
  const subscribers = this._eventSubscribers.get(event);
4220
4379
  if (!subscribers) {
@@ -4227,12 +4386,12 @@ var BaseThreadRuntimeCore = (_class12 = class {
4227
4386
  subscribers2.delete(callback);
4228
4387
  };
4229
4388
  }
4230
- }, _class12);
4389
+ }, _class11);
4231
4390
 
4232
4391
  // src/runtimes/local/LocalThreadRuntimeCore.tsx
4233
- var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4392
+ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
4234
4393
  constructor(configProvider, adapter, { initialMessages, ...options }) {
4235
- super(configProvider);_class13.prototype.__init29.call(this);_class13.prototype.__init30.call(this);_class13.prototype.__init31.call(this);_class13.prototype.__init32.call(this);;
4394
+ super(configProvider);_class12.prototype.__init28.call(this);_class12.prototype.__init29.call(this);_class12.prototype.__init30.call(this);_class12.prototype.__init31.call(this);;
4236
4395
  this.adapter = adapter;
4237
4396
  this.threadId = generateId();
4238
4397
  this.options = options;
@@ -4245,7 +4404,7 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4245
4404
  }
4246
4405
  }
4247
4406
  }
4248
- __init29() {this.capabilities = {
4407
+ __init28() {this.capabilities = {
4249
4408
  switchToBranch: true,
4250
4409
  edit: true,
4251
4410
  reload: true,
@@ -4255,10 +4414,10 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4255
4414
  attachments: false,
4256
4415
  feedback: false
4257
4416
  }}
4258
- __init30() {this.abortController = null}
4417
+ __init29() {this.abortController = null}
4259
4418
 
4260
- __init31() {this.isDisabled = false}
4261
- __init32() {this.suggestions = []}
4419
+ __init30() {this.isDisabled = false}
4420
+ __init31() {this.suggestions = []}
4262
4421
  get adapters() {
4263
4422
  return this.options.adapters;
4264
4423
  }
@@ -4272,17 +4431,17 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4272
4431
  set options({ initialMessages, ...options }) {
4273
4432
  this._options = options;
4274
4433
  let hasUpdates = false;
4275
- const canSpeak = _optionalChain([options, 'access', _204 => _204.adapters, 'optionalAccess', _205 => _205.speech]) !== void 0;
4434
+ const canSpeak = _optionalChain([options, 'access', _217 => _217.adapters, 'optionalAccess', _218 => _218.speech]) !== void 0;
4276
4435
  if (this.capabilities.speech !== canSpeak) {
4277
4436
  this.capabilities.speech = canSpeak;
4278
4437
  hasUpdates = true;
4279
4438
  }
4280
- const canAttach = _optionalChain([options, 'access', _206 => _206.adapters, 'optionalAccess', _207 => _207.attachments]) !== void 0;
4439
+ const canAttach = _optionalChain([options, 'access', _219 => _219.adapters, 'optionalAccess', _220 => _220.attachments]) !== void 0;
4281
4440
  if (this.capabilities.attachments !== canAttach) {
4282
4441
  this.capabilities.attachments = canAttach;
4283
4442
  hasUpdates = true;
4284
4443
  }
4285
- const canFeedback = _optionalChain([options, 'access', _208 => _208.adapters, 'optionalAccess', _209 => _209.feedback]) !== void 0;
4444
+ const canFeedback = _optionalChain([options, 'access', _221 => _221.adapters, 'optionalAccess', _222 => _222.feedback]) !== void 0;
4286
4445
  if (this.capabilities.feedback !== canFeedback) {
4287
4446
  this.capabilities.feedback = canFeedback;
4288
4447
  hasUpdates = true;
@@ -4318,13 +4477,13 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4318
4477
  }
4319
4478
  async performRoundtrip(parentId, message) {
4320
4479
  const messages2 = this.repository.getMessages();
4321
- _optionalChain([this, 'access', _210 => _210.abortController, 'optionalAccess', _211 => _211.abort, 'call', _212 => _212()]);
4480
+ _optionalChain([this, 'access', _223 => _223.abortController, 'optionalAccess', _224 => _224.abort, 'call', _225 => _225()]);
4322
4481
  this.abortController = new AbortController();
4323
4482
  const initialContent = message.content;
4324
- const initialSteps = _optionalChain([message, 'access', _213 => _213.metadata, 'optionalAccess', _214 => _214.steps]);
4325
- const initalCustom = _optionalChain([message, 'access', _215 => _215.metadata, 'optionalAccess', _216 => _216.custom]);
4483
+ const initialSteps = _optionalChain([message, 'access', _226 => _226.metadata, 'optionalAccess', _227 => _227.steps]);
4484
+ const initalCustom = _optionalChain([message, 'access', _228 => _228.metadata, 'optionalAccess', _229 => _229.custom]);
4326
4485
  const updateMessage = (m) => {
4327
- const newSteps = _optionalChain([m, 'access', _217 => _217.metadata, 'optionalAccess', _218 => _218.steps]) || _optionalChain([m, 'access', _219 => _219.metadata, 'optionalAccess', _220 => _220.roundtrips]);
4486
+ const newSteps = _optionalChain([m, 'access', _230 => _230.metadata, 'optionalAccess', _231 => _231.steps]) || _optionalChain([m, 'access', _232 => _232.metadata, 'optionalAccess', _233 => _233.roundtrips]);
4328
4487
  const steps2 = newSteps ? [..._nullishCoalesce(initialSteps, () => ( [])), ...newSteps] : void 0;
4329
4488
  message = {
4330
4489
  ...message,
@@ -4336,7 +4495,7 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4336
4495
  metadata: {
4337
4496
  ...message.metadata,
4338
4497
  ...steps2 ? { roundtrips: steps2, steps: steps2 } : void 0,
4339
- ..._optionalChain([m, 'access', _221 => _221.metadata, 'optionalAccess', _222 => _222.custom]) ? {
4498
+ ..._optionalChain([m, 'access', _234 => _234.metadata, 'optionalAccess', _235 => _235.custom]) ? {
4340
4499
  custom: { ..._nullishCoalesce(initalCustom, () => ( {})), ...m.metadata.custom }
4341
4500
  } : void 0
4342
4501
  }
@@ -4346,7 +4505,7 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4346
4505
  this._notifySubscribers();
4347
4506
  };
4348
4507
  const maxSteps = this.options.maxSteps ? this.options.maxSteps : (_nullishCoalesce(this.options.maxToolRoundtrips, () => ( 1))) + 1;
4349
- const steps = _nullishCoalesce(_optionalChain([message, 'access', _223 => _223.metadata, 'optionalAccess', _224 => _224.steps, 'optionalAccess', _225 => _225.length]), () => ( 0));
4508
+ const steps = _nullishCoalesce(_optionalChain([message, 'access', _236 => _236.metadata, 'optionalAccess', _237 => _237.steps, 'optionalAccess', _238 => _238.length]), () => ( 0));
4350
4509
  if (steps >= maxSteps) {
4351
4510
  updateMessage({
4352
4511
  status: {
@@ -4398,7 +4557,7 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4398
4557
  return message;
4399
4558
  }
4400
4559
  cancelRun() {
4401
- _optionalChain([this, 'access', _226 => _226.abortController, 'optionalAccess', _227 => _227.abort, 'call', _228 => _228()]);
4560
+ _optionalChain([this, 'access', _239 => _239.abortController, 'optionalAccess', _240 => _240.abort, 'call', _241 => _241()]);
4402
4561
  this.abortController = null;
4403
4562
  }
4404
4563
  addToolResult({
@@ -4434,7 +4593,7 @@ var LocalThreadRuntimeCore = (_class13 = class extends BaseThreadRuntimeCore {
4434
4593
  this.performRoundtrip(parentId, message);
4435
4594
  }
4436
4595
  }
4437
- }, _class13);
4596
+ }, _class12);
4438
4597
 
4439
4598
  // src/runtimes/local/LocalRuntimeCore.tsx
4440
4599
  var LocalRuntimeCore = class extends BaseAssistantRuntimeCore {
@@ -4470,7 +4629,7 @@ var LocalRuntimeCore = class extends BaseAssistantRuntimeCore {
4470
4629
  const messages2 = fromCoreMessages(initialMessages);
4471
4630
  this.thread.import({
4472
4631
  messages: messages2.map((m, idx) => ({
4473
- parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _229 => _229[idx - 1], 'optionalAccess', _230 => _230.id]), () => ( null)),
4632
+ parentId: _nullishCoalesce(_optionalChain([messages2, 'access', _242 => _242[idx - 1], 'optionalAccess', _243 => _243.id]), () => ( null)),
4474
4633
  message: m
4475
4634
  }))
4476
4635
  });
@@ -4489,7 +4648,7 @@ var LocalRuntimeImpl = class _LocalRuntimeImpl extends AssistantRuntimeImpl {
4489
4648
  static create(_core) {
4490
4649
  return new _LocalRuntimeImpl(
4491
4650
  _core,
4492
- AssistantRuntimeImpl.createThreadRuntime(_core, ThreadRuntimeImpl)
4651
+ AssistantRuntimeImpl.createMainThreadRuntime(_core, ThreadRuntimeImpl)
4493
4652
  );
4494
4653
  }
4495
4654
  };
@@ -4512,8 +4671,8 @@ var getExternalStoreMessage = (message) => {
4512
4671
  };
4513
4672
 
4514
4673
  // src/runtimes/external-store/ThreadMessageConverter.ts
4515
- var ThreadMessageConverter = (_class14 = class {constructor() { _class14.prototype.__init33.call(this); }
4516
- __init33() {this.cache = /* @__PURE__ */ new WeakMap()}
4674
+ var ThreadMessageConverter = (_class13 = class {constructor() { _class13.prototype.__init32.call(this); }
4675
+ __init32() {this.cache = /* @__PURE__ */ new WeakMap()}
4517
4676
  convertMessages(messages2, converter) {
4518
4677
  return messages2.map((m, idx) => {
4519
4678
  const cached = this.cache.get(m);
@@ -4522,7 +4681,7 @@ var ThreadMessageConverter = (_class14 = class {constructor() { _class14.prototy
4522
4681
  return newMessage;
4523
4682
  });
4524
4683
  }
4525
- }, _class14);
4684
+ }, _class13);
4526
4685
 
4527
4686
  // src/runtimes/external-store/auto-status.tsx
4528
4687
  var AUTO_STATUS_RUNNING = Object.freeze({ type: "running" });
@@ -4610,11 +4769,11 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
4610
4769
  // src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx
4611
4770
  var EMPTY_ARRAY2 = Object.freeze([]);
4612
4771
  var hasUpcomingMessage = (isRunning, messages2) => {
4613
- return isRunning && _optionalChain([messages2, 'access', _231 => _231[messages2.length - 1], 'optionalAccess', _232 => _232.role]) !== "assistant";
4772
+ return isRunning && _optionalChain([messages2, 'access', _244 => _244[messages2.length - 1], 'optionalAccess', _245 => _245.role]) !== "assistant";
4614
4773
  };
4615
- var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntimeCore {
4616
- __init34() {this.assistantOptimisticId = null}
4617
- __init35() {this._capabilities = {
4774
+ var ExternalStoreThreadRuntimeCore = (_class14 = class extends BaseThreadRuntimeCore {
4775
+ __init33() {this.assistantOptimisticId = null}
4776
+ __init34() {this._capabilities = {
4618
4777
  switchToBranch: false,
4619
4778
  edit: false,
4620
4779
  reload: false,
@@ -4636,9 +4795,9 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4636
4795
  get adapters() {
4637
4796
  return this._store.adapters;
4638
4797
  }
4639
- __init36() {this.suggestions = []}
4640
- __init37() {this.extras = void 0}
4641
- __init38() {this._converter = new ThreadMessageConverter()}
4798
+ __init35() {this.suggestions = []}
4799
+ __init36() {this.extras = void 0}
4800
+ __init37() {this._converter = new ThreadMessageConverter()}
4642
4801
 
4643
4802
  beginEdit(messageId) {
4644
4803
  if (!this.store.onEdit)
@@ -4646,7 +4805,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4646
4805
  super.beginEdit(messageId);
4647
4806
  }
4648
4807
  constructor(configProvider, store) {
4649
- super(configProvider);_class15.prototype.__init34.call(this);_class15.prototype.__init35.call(this);_class15.prototype.__init36.call(this);_class15.prototype.__init37.call(this);_class15.prototype.__init38.call(this);_class15.prototype.__init39.call(this);;
4808
+ super(configProvider);_class14.prototype.__init33.call(this);_class14.prototype.__init34.call(this);_class14.prototype.__init35.call(this);_class14.prototype.__init36.call(this);_class14.prototype.__init37.call(this);_class14.prototype.__init38.call(this);;
4650
4809
  this.store = store;
4651
4810
  }
4652
4811
  get store() {
@@ -4666,11 +4825,11 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4666
4825
  edit: this._store.onEdit !== void 0,
4667
4826
  reload: this._store.onReload !== void 0,
4668
4827
  cancel: this._store.onCancel !== void 0,
4669
- speech: _optionalChain([this, 'access', _236 => _236._store, 'access', _237 => _237.adapters, 'optionalAccess', _238 => _238.speech]) !== void 0,
4670
- unstable_copy: _optionalChain([this, 'access', _239 => _239._store, 'access', _240 => _240.unstable_capabilities, 'optionalAccess', _241 => _241.copy]) !== false,
4828
+ speech: _optionalChain([this, 'access', _249 => _249._store, 'access', _250 => _250.adapters, 'optionalAccess', _251 => _251.speech]) !== void 0,
4829
+ unstable_copy: _optionalChain([this, 'access', _252 => _252._store, 'access', _253 => _253.unstable_capabilities, 'optionalAccess', _254 => _254.copy]) !== false,
4671
4830
  // default true
4672
- attachments: !!_optionalChain([this, 'access', _242 => _242.store, 'access', _243 => _243.adapters, 'optionalAccess', _244 => _244.attachments]),
4673
- feedback: !!_optionalChain([this, 'access', _245 => _245.store, 'access', _246 => _246.adapters, 'optionalAccess', _247 => _247.feedback])
4831
+ attachments: !!_optionalChain([this, 'access', _255 => _255.store, 'access', _256 => _256.adapters, 'optionalAccess', _257 => _257.attachments]),
4832
+ feedback: !!_optionalChain([this, 'access', _258 => _258.store, 'access', _259 => _259.adapters, 'optionalAccess', _260 => _260.feedback])
4674
4833
  };
4675
4834
  if (oldStore) {
4676
4835
  if (oldStore.convertMessage !== store.convertMessage) {
@@ -4697,7 +4856,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4697
4856
  for (let i = 0; i < messages2.length; i++) {
4698
4857
  const message = messages2[i];
4699
4858
  const parent = messages2[i - 1];
4700
- this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _248 => _248.id]), () => ( null)), message);
4859
+ this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _261 => _261.id]), () => ( null)), message);
4701
4860
  }
4702
4861
  if (this.assistantOptimisticId) {
4703
4862
  this.repository.deleteMessage(this.assistantOptimisticId);
@@ -4705,7 +4864,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4705
4864
  }
4706
4865
  if (hasUpcomingMessage(isRunning, messages2)) {
4707
4866
  this.assistantOptimisticId = this.repository.appendOptimisticMessage(
4708
- _nullishCoalesce(_optionalChain([messages2, 'access', _249 => _249.at, 'call', _250 => _250(-1), 'optionalAccess', _251 => _251.id]), () => ( null)),
4867
+ _nullishCoalesce(_optionalChain([messages2, 'access', _262 => _262.at, 'call', _263 => _263(-1), 'optionalAccess', _264 => _264.id]), () => ( null)),
4709
4868
  {
4710
4869
  role: "assistant",
4711
4870
  content: []
@@ -4713,7 +4872,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4713
4872
  );
4714
4873
  }
4715
4874
  this.repository.resetHead(
4716
- _nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages2, 'access', _252 => _252.at, 'call', _253 => _253(-1), 'optionalAccess', _254 => _254.id]))), () => ( null))
4875
+ _nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages2, 'access', _265 => _265.at, 'call', _266 => _266(-1), 'optionalAccess', _267 => _267.id]))), () => ( null))
4717
4876
  );
4718
4877
  this._messages = this.repository.getMessages();
4719
4878
  this._notifySubscribers();
@@ -4725,7 +4884,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4725
4884
  this.updateMessages(this.repository.getMessages());
4726
4885
  }
4727
4886
  async append(message) {
4728
- if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _255 => _255.messages, 'access', _256 => _256.at, 'call', _257 => _257(-1), 'optionalAccess', _258 => _258.id]), () => ( null)))) {
4887
+ if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _268 => _268.messages, 'access', _269 => _269.at, 'call', _270 => _270(-1), 'optionalAccess', _271 => _271.id]), () => ( null)))) {
4729
4888
  if (!this._store.onEdit)
4730
4889
  throw new Error("Runtime does not support editing messages.");
4731
4890
  await this._store.onEdit(message);
@@ -4748,7 +4907,7 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4748
4907
  }
4749
4908
  let messages2 = this.repository.getMessages();
4750
4909
  const previousMessage = messages2[messages2.length - 1];
4751
- if (_optionalChain([previousMessage, 'optionalAccess', _259 => _259.role]) === "user" && previousMessage.id === _optionalChain([messages2, 'access', _260 => _260.at, 'call', _261 => _261(-1), 'optionalAccess', _262 => _262.id])) {
4910
+ if (_optionalChain([previousMessage, 'optionalAccess', _272 => _272.role]) === "user" && previousMessage.id === _optionalChain([messages2, 'access', _273 => _273.at, 'call', _274 => _274(-1), 'optionalAccess', _275 => _275.id])) {
4752
4911
  this.repository.deleteMessage(previousMessage.id);
4753
4912
  if (!this.composer.text.trim()) {
4754
4913
  this.composer.setText(getThreadMessageText(previousMessage));
@@ -4766,12 +4925,12 @@ var ExternalStoreThreadRuntimeCore = (_class15 = class extends BaseThreadRuntime
4766
4925
  throw new Error("Runtime does not support tool results.");
4767
4926
  this._store.onAddToolResult(options);
4768
4927
  }
4769
- __init39() {this.updateMessages = (messages2) => {
4770
- _optionalChain([this, 'access', _263 => _263._store, 'access', _264 => _264.setMessages, 'optionalCall', _265 => _265(
4928
+ __init38() {this.updateMessages = (messages2) => {
4929
+ _optionalChain([this, 'access', _276 => _276._store, 'access', _277 => _277.setMessages, 'optionalCall', _278 => _278(
4771
4930
  messages2.flatMap(getExternalStoreMessage).filter((m) => m != null)
4772
4931
  )]);
4773
4932
  }}
4774
- }, _class15);
4933
+ }, _class14);
4775
4934
 
4776
4935
  // src/runtimes/external-store/ExternalStoreRuntimeCore.tsx
4777
4936
  var ExternalStoreRuntimeCore = class extends BaseAssistantRuntimeCore {
@@ -4987,18 +5146,18 @@ var DangerousInBrowserAdapter = class {
4987
5146
  this.options = options;
4988
5147
  }
4989
5148
  async *run({ messages: messages2, abortSignal, config }) {
4990
- const res = await _chunkBDPD5HCKjs.getEdgeRuntimeStream.call(void 0, {
5149
+ const res = await _chunkC6UZOY5Ajs.getEdgeRuntimeStream.call(void 0, {
4991
5150
  options: this.options,
4992
5151
  abortSignal,
4993
5152
  requestData: {
4994
5153
  system: config.system,
4995
- messages: _chunkBDPD5HCKjs.toCoreMessages.call(void 0, messages2),
4996
- tools: config.tools ? _chunkBDPD5HCKjs.toLanguageModelTools.call(void 0, config.tools) : [],
5154
+ messages: _chunkC6UZOY5Ajs.toCoreMessages.call(void 0, messages2),
5155
+ tools: config.tools ? _chunkC6UZOY5Ajs.toLanguageModelTools.call(void 0, config.tools) : [],
4997
5156
  ...config.callSettings,
4998
5157
  ...config.config
4999
5158
  }
5000
5159
  });
5001
- const stream = res.pipeThrough(_chunkBDPD5HCKjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkBDPD5HCKjs.runResultStream.call(void 0, ));
5160
+ const stream = res.pipeThrough(_chunkC6UZOY5Ajs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkC6UZOY5Ajs.runResultStream.call(void 0, ));
5002
5161
  for await (const update of asAsyncIterable(stream)) {
5003
5162
  yield update;
5004
5163
  }
@@ -5014,8 +5173,7 @@ var useDangerousInBrowserRuntime = (options) => {
5014
5173
 
5015
5174
  // src/runtimes/speech/WebSpeechSynthesisAdapter.ts
5016
5175
  var WebSpeechSynthesisAdapter = class {
5017
- speak(message) {
5018
- const text = getThreadMessageText(message);
5176
+ speak(text) {
5019
5177
  const utterance = new SpeechSynthesisUtterance(text);
5020
5178
  const subscribers = /* @__PURE__ */ new Set();
5021
5179
  const handleEnd = (reason, error) => {
@@ -5054,8 +5212,8 @@ var WebSpeechSynthesisAdapter = class {
5054
5212
  };
5055
5213
 
5056
5214
  // src/runtimes/attachment/SimpleImageAttachmentAdapter.ts
5057
- var SimpleImageAttachmentAdapter = (_class16 = class {constructor() { _class16.prototype.__init40.call(this); }
5058
- __init40() {this.accept = "image/*"}
5215
+ var SimpleImageAttachmentAdapter = (_class15 = class {constructor() { _class15.prototype.__init39.call(this); }
5216
+ __init39() {this.accept = "image/*"}
5059
5217
  async add(state) {
5060
5218
  return {
5061
5219
  id: state.file.name,
@@ -5080,7 +5238,7 @@ var SimpleImageAttachmentAdapter = (_class16 = class {constructor() { _class16.p
5080
5238
  }
5081
5239
  async remove() {
5082
5240
  }
5083
- }, _class16);
5241
+ }, _class15);
5084
5242
  var getFileDataURL = (file) => new Promise((resolve, reject) => {
5085
5243
  const reader = new FileReader();
5086
5244
  reader.onload = () => resolve(reader.result);
@@ -5089,8 +5247,8 @@ var getFileDataURL = (file) => new Promise((resolve, reject) => {
5089
5247
  });
5090
5248
 
5091
5249
  // src/runtimes/attachment/SimpleTextAttachmentAdapter.ts
5092
- var SimpleTextAttachmentAdapter = (_class17 = class {constructor() { _class17.prototype.__init41.call(this); }
5093
- __init41() {this.accept = "text/plain,text/html,text/markdown,text/csv,text/xml,text/json,text/css"}
5250
+ var SimpleTextAttachmentAdapter = (_class16 = class {constructor() { _class16.prototype.__init40.call(this); }
5251
+ __init40() {this.accept = "text/plain,text/html,text/markdown,text/csv,text/xml,text/json,text/css"}
5094
5252
  async add(state) {
5095
5253
  return {
5096
5254
  id: state.file.name,
@@ -5117,7 +5275,7 @@ ${await getFileText(attachment.file)}
5117
5275
  }
5118
5276
  async remove() {
5119
5277
  }
5120
- }, _class17);
5278
+ }, _class16);
5121
5279
  var getFileText = (file) => new Promise((resolve, reject) => {
5122
5280
  const reader = new FileReader();
5123
5281
  reader.onload = () => resolve(reader.result);
@@ -5218,7 +5376,7 @@ var ThreadConfigProvider = ({
5218
5376
  }) => {
5219
5377
  const hasAssistant = !!useAssistantRuntime({ optional: true });
5220
5378
  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 });
5221
- if (!_optionalChain([config, 'optionalAccess', _266 => _266.runtime])) return configProvider;
5379
+ if (!_optionalChain([config, 'optionalAccess', _279 => _279.runtime])) return configProvider;
5222
5380
  if (hasAssistant) {
5223
5381
  throw new Error(
5224
5382
  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
@@ -5546,7 +5704,7 @@ var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: comp
5546
5704
  {
5547
5705
  components: {
5548
5706
  ...componentsProp,
5549
- Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _267 => _267.Text]), () => ( components.Text)), () => ( content_part_default.Text)),
5707
+ Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _280 => _280.Text]), () => ( components.Text)), () => ( content_part_default.Text)),
5550
5708
  tools: toolsComponents
5551
5709
  }
5552
5710
  }
@@ -5657,7 +5815,7 @@ var useAttachmentSrc = () => {
5657
5815
  const { file, src } = useAttachment((a) => {
5658
5816
  if (a.type !== "image") return {};
5659
5817
  if (a.file) return { file: a.file };
5660
- 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]);
5818
+ const src2 = _optionalChain([a, 'access', _281 => _281.content, 'optionalAccess', _282 => _282.filter, 'call', _283 => _283((c) => c.type === "image"), 'access', _284 => _284[0], 'optionalAccess', _285 => _285.image]);
5661
5819
  if (!src2) return {};
5662
5820
  return { src: src2 };
5663
5821
  });
@@ -5801,7 +5959,7 @@ var ComposerAttachments = ({ components }) => {
5801
5959
  {
5802
5960
  components: {
5803
5961
  ...components,
5804
- Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _273 => _273.Attachment]), () => ( attachment_default))
5962
+ Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _286 => _286.Attachment]), () => ( attachment_default))
5805
5963
  }
5806
5964
  }
5807
5965
  ) });
@@ -5929,7 +6087,7 @@ var ThreadWelcomeSuggestions = () => {
5929
6087
  const suggestions2 = useThread((t) => t.suggestions);
5930
6088
  const { welcome: { suggestions } = {} } = useThreadConfig();
5931
6089
  const finalSuggestions = suggestions2.length ? suggestions2 : suggestions;
5932
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([finalSuggestions, 'optionalAccess', _274 => _274.map, 'call', _275 => _275((suggestion, idx) => {
6090
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([finalSuggestions, 'optionalAccess', _287 => _287.map, 'call', _288 => _288((suggestion, idx) => {
5933
6091
  const key = `${suggestion.prompt}-${idx}`;
5934
6092
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
5935
6093
  })]) });
@@ -6007,7 +6165,7 @@ var UserMessageContent = _react.forwardRef.call(void 0, ({ components, ...props
6007
6165
  {
6008
6166
  components: {
6009
6167
  ...components,
6010
- Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _276 => _276.Text]), () => ( content_part_default.Text))
6168
+ Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _289 => _289.Text]), () => ( content_part_default.Text))
6011
6169
  }
6012
6170
  }
6013
6171
  ) });
@@ -6024,7 +6182,7 @@ var UserMessageAttachments = ({
6024
6182
  {
6025
6183
  components: {
6026
6184
  ...components,
6027
- Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _277 => _277.Attachment]), () => ( attachment_default))
6185
+ Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _290 => _290.Attachment]), () => ( attachment_default))
6028
6186
  }
6029
6187
  }
6030
6188
  ) }) });
@@ -6127,10 +6285,10 @@ var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ..
6127
6285
  thread_exports.Messages,
6128
6286
  {
6129
6287
  components: {
6130
- UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _278 => _278.UserMessage]), () => ( user_message_default)),
6131
- EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _279 => _279.EditComposer]), () => ( edit_composer_default)),
6132
- AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _280 => _280.AssistantMessage]), () => ( assistant_message_default)),
6133
- SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _281 => _281.SystemMessage]), () => ( SystemMessage))
6288
+ UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _291 => _291.UserMessage]), () => ( user_message_default)),
6289
+ EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _292 => _292.EditComposer]), () => ( edit_composer_default)),
6290
+ AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _293 => _293.AssistantMessage]), () => ( assistant_message_default)),
6291
+ SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _294 => _294.SystemMessage]), () => ( SystemMessage))
6134
6292
  },
6135
6293
  ...rest
6136
6294
  }
@@ -6141,7 +6299,7 @@ var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ..
6141
6299
  ThreadMessages.displayName = "ThreadMessages";
6142
6300
  var ThreadFollowupSuggestions = () => {
6143
6301
  const suggestions = useThread((t) => t.suggestions);
6144
- 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,
6302
+ 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', _295 => _295.map, 'call', _296 => _296((suggestion, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6145
6303
  thread_exports.Suggestion,
6146
6304
  {
6147
6305
  className: "aui-thread-followup-suggestion",
@@ -6374,5 +6532,6 @@ var assistant_modal_default = Object.assign(AssistantModal, exports12);
6374
6532
 
6375
6533
 
6376
6534
 
6377
- 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 = _chunkBDPD5HCKjs.toCoreMessage; exports.toCoreMessages = _chunkBDPD5HCKjs.toCoreMessages; exports.toLanguageModelMessages = _chunkBDPD5HCKjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkBDPD5HCKjs.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;
6535
+
6536
+ 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 = _chunkC6UZOY5Ajs.toCoreMessage; exports.toCoreMessages = _chunkC6UZOY5Ajs.toCoreMessages; exports.toLanguageModelMessages = _chunkC6UZOY5Ajs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkC6UZOY5Ajs.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.useThreadModelConfig = useThreadModelConfig; 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;
6378
6537
  //# sourceMappingURL=index.js.map