@assistant-ui/react 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -9,9 +9,9 @@ import {
9
9
  useContentPartContext,
10
10
  useMessageContext,
11
11
  useThreadContext
12
- } from "./chunk-7O2URLFI.mjs";
12
+ } from "./chunk-KUACYNLE.mjs";
13
13
 
14
- // src/actions/useCopyMessage.tsx
14
+ // src/primitive-hooks/actionBar/useActionBarCopy.tsx
15
15
  import { useCallback } from "react";
16
16
 
17
17
  // src/utils/combined/useCombinedStore.ts
@@ -48,38 +48,56 @@ var getMessageText = (message) => {
48
48
  return textParts.map((part) => part.text).join("\n\n");
49
49
  };
50
50
 
51
- // src/actions/useCopyMessage.tsx
52
- var useCopyMessage = ({ copiedDuration = 3e3 }) => {
53
- const { useMessage, useMessageUtils, useComposer } = useMessageContext();
51
+ // src/primitive-hooks/actionBar/useActionBarCopy.tsx
52
+ var useActionBarCopy = ({
53
+ copiedDuration = 3e3
54
+ } = {}) => {
55
+ const { useMessage, useMessageUtils, useEditComposer } = useMessageContext();
54
56
  const hasCopyableContent = useCombinedStore(
55
- [useMessage, useComposer],
57
+ [useMessage, useEditComposer],
56
58
  (m, c) => {
57
- return c.isEditing || m.message.content.some((c2) => c2.type === "text");
59
+ return !c.isEditing && m.message.content.some((c2) => c2.type === "text");
58
60
  }
59
61
  );
60
62
  const callback = useCallback(() => {
61
63
  const { message } = useMessage.getState();
62
64
  const { setIsCopied } = useMessageUtils.getState();
63
- const { isEditing, value: composerValue } = useComposer.getState();
65
+ const { isEditing, value: composerValue } = useEditComposer.getState();
64
66
  const valueToCopy = isEditing ? composerValue : getMessageText(message);
65
67
  navigator.clipboard.writeText(valueToCopy);
66
68
  setIsCopied(true);
67
69
  setTimeout(() => setIsCopied(false), copiedDuration);
68
- }, [useMessage, useMessageUtils, useComposer, copiedDuration]);
70
+ }, [useMessage, useMessageUtils, useEditComposer, copiedDuration]);
69
71
  if (!hasCopyableContent) return null;
70
72
  return callback;
71
73
  };
72
74
 
73
- // src/actions/useReloadMessage.tsx
75
+ // src/primitive-hooks/actionBar/useActionBarEdit.tsx
74
76
  import { useCallback as useCallback2 } from "react";
75
- var useReloadMessage = () => {
77
+ var useActionBarEdit = () => {
78
+ const { useMessage, useEditComposer } = useMessageContext();
79
+ const disabled = useCombinedStore(
80
+ [useMessage, useEditComposer],
81
+ (m, c) => m.message.role !== "user" || c.isEditing
82
+ );
83
+ const callback = useCallback2(() => {
84
+ const { edit } = useEditComposer.getState();
85
+ edit();
86
+ }, [useEditComposer]);
87
+ if (disabled) return null;
88
+ return callback;
89
+ };
90
+
91
+ // src/primitive-hooks/actionBar/useActionBarReload.tsx
92
+ import { useCallback as useCallback3 } from "react";
93
+ var useActionBarReload = () => {
76
94
  const { useThread, useThreadActions, useViewport } = useThreadContext();
77
95
  const { useMessage } = useMessageContext();
78
96
  const disabled = useCombinedStore(
79
97
  [useThread, useMessage],
80
98
  (t, m) => t.isRunning || m.message.role !== "assistant"
81
99
  );
82
- const callback = useCallback2(() => {
100
+ const callback = useCallback3(() => {
83
101
  const { parentId } = useMessage.getState();
84
102
  useThreadActions.getState().startRun(parentId);
85
103
  useViewport.getState().scrollToBottom();
@@ -88,29 +106,20 @@ var useReloadMessage = () => {
88
106
  return callback;
89
107
  };
90
108
 
91
- // src/actions/useBeginMessageEdit.tsx
92
- import { useCallback as useCallback3 } from "react";
93
- var useBeginMessageEdit = () => {
94
- const { useMessage, useComposer } = useMessageContext();
95
- const disabled = useCombinedStore(
96
- [useMessage, useComposer],
97
- (m, c) => m.message.role !== "user" || c.isEditing
98
- );
99
- const callback = useCallback3(() => {
100
- const { edit } = useComposer.getState();
101
- edit();
102
- }, [useComposer]);
103
- if (disabled) return null;
104
- return callback;
109
+ // src/primitive-hooks/branchPicker/useBranchPickerCount.tsx
110
+ var useBranchPickerCount = () => {
111
+ const { useMessage } = useMessageContext();
112
+ const branchCount = useMessage((s) => s.branches.length);
113
+ return branchCount;
105
114
  };
106
115
 
107
- // src/actions/useGoToNextBranch.tsx
116
+ // src/primitive-hooks/branchPicker/useBranchPickerNext.tsx
108
117
  import { useCallback as useCallback4 } from "react";
109
- var useGoToNextBranch = () => {
118
+ var useBranchPickerNext = () => {
110
119
  const { useThreadActions } = useThreadContext();
111
- const { useMessage, useComposer } = useMessageContext();
120
+ const { useMessage, useEditComposer } = useMessageContext();
112
121
  const disabled = useCombinedStore(
113
- [useMessage, useComposer],
122
+ [useMessage, useEditComposer],
114
123
  (m, c) => c.isEditing || m.branches.indexOf(m.message.id) + 1 >= m.branches.length
115
124
  );
116
125
  const callback = useCallback4(() => {
@@ -121,13 +130,20 @@ var useGoToNextBranch = () => {
121
130
  return callback;
122
131
  };
123
132
 
124
- // src/actions/useGoToPreviousBranch.tsx
133
+ // src/primitive-hooks/branchPicker/useBranchPickerNumber.tsx
134
+ var useBranchPickerNumber = () => {
135
+ const { useMessage } = useMessageContext();
136
+ const branchIdx = useMessage((s) => s.branches.indexOf(s.message.id));
137
+ return branchIdx + 1;
138
+ };
139
+
140
+ // src/primitive-hooks/branchPicker/useBranchPickerPrevious.tsx
125
141
  import { useCallback as useCallback5 } from "react";
126
- var useGoToPreviousBranch = () => {
142
+ var useBranchPickerPrevious = () => {
127
143
  const { useThreadActions } = useThreadContext();
128
- const { useMessage, useComposer } = useMessageContext();
144
+ const { useMessage, useEditComposer } = useMessageContext();
129
145
  const disabled = useCombinedStore(
130
- [useMessage, useComposer],
146
+ [useMessage, useEditComposer],
131
147
  (m, c) => c.isEditing || m.branches.indexOf(m.message.id) <= 0
132
148
  );
133
149
  const callback = useCallback5(() => {
@@ -138,6 +154,159 @@ var useGoToPreviousBranch = () => {
138
154
  return callback;
139
155
  };
140
156
 
157
+ // src/primitive-hooks/composer/useComposerCancel.tsx
158
+ import { useCallback as useCallback6 } from "react";
159
+ var useComposerCancel = () => {
160
+ const { useComposer } = useComposerContext();
161
+ const disabled = useComposer((c) => !c.isEditing);
162
+ const callback = useCallback6(() => {
163
+ const { cancel } = useComposer.getState();
164
+ cancel();
165
+ }, [useComposer]);
166
+ if (disabled) return null;
167
+ return callback;
168
+ };
169
+
170
+ // src/primitive-hooks/composer/useComposerIf.tsx
171
+ var useComposerIf = (props) => {
172
+ const { useComposer } = useComposerContext();
173
+ return useComposer((composer) => {
174
+ if (props.editing === true && !composer.isEditing) return false;
175
+ if (props.editing === false && composer.isEditing) return false;
176
+ return true;
177
+ });
178
+ };
179
+
180
+ // src/primitive-hooks/composer/useComposerSend.tsx
181
+ import { useCallback as useCallback7 } from "react";
182
+ var useComposerSend = () => {
183
+ const { useComposer } = useComposerContext();
184
+ const disabled = useComposer((c) => !c.isEditing || c.value.length === 0);
185
+ const callback = useCallback7(() => {
186
+ const { send } = useComposer.getState();
187
+ send();
188
+ }, [useComposer]);
189
+ if (disabled) return null;
190
+ return callback;
191
+ };
192
+
193
+ // src/primitive-hooks/contentPart/useContentPartDisplay.tsx
194
+ var useContentPartDisplay = () => {
195
+ const { useContentPart } = useContentPartContext();
196
+ const display = useContentPart((c) => {
197
+ if (c.part.type !== "ui")
198
+ throw new Error(
199
+ "This component can only be used inside ui content parts."
200
+ );
201
+ return c.part.display;
202
+ });
203
+ return display;
204
+ };
205
+
206
+ // src/primitive-hooks/contentPart/useContentPartImage.tsx
207
+ var useContentPartImage = () => {
208
+ const { useContentPart } = useContentPartContext();
209
+ const image = useContentPart((c) => {
210
+ if (c.part.type !== "image")
211
+ throw new Error(
212
+ "ContentPartImage can only be used inside image content parts."
213
+ );
214
+ return c.part.image;
215
+ });
216
+ return image;
217
+ };
218
+
219
+ // src/primitive-hooks/contentPart/useContentPartInProgressIndicator.tsx
220
+ var useContentPartInProgressIndicator = () => {
221
+ const { useMessageUtils } = useMessageContext();
222
+ const { useContentPart } = useContentPartContext();
223
+ const indicator = useCombinedStore(
224
+ [useMessageUtils, useContentPart],
225
+ (m, c) => c.status === "in_progress" ? m.inProgressIndicator : null
226
+ );
227
+ return indicator;
228
+ };
229
+
230
+ // src/primitive-hooks/contentPart/useContentPartText.tsx
231
+ var useContentPartText = () => {
232
+ const { useContentPart } = useContentPartContext();
233
+ const text = useContentPart((c) => {
234
+ if (c.part.type !== "text")
235
+ throw new Error(
236
+ "ContentPartText can only be used inside text content parts."
237
+ );
238
+ return c.part.text;
239
+ });
240
+ return text;
241
+ };
242
+
243
+ // src/primitive-hooks/message/useMessageIf.tsx
244
+ var useMessageIf = (props) => {
245
+ const { useMessage, useMessageUtils } = useMessageContext();
246
+ return useCombinedStore(
247
+ [useMessage, useMessageUtils],
248
+ ({ message, branches, isLast }, { isCopied, isHovering }) => {
249
+ if (props.hasBranches === true && branches.length < 2) return false;
250
+ if (props.user && message.role !== "user") return false;
251
+ if (props.assistant && message.role !== "assistant") return false;
252
+ if (props.lastOrHover === true && !isHovering && !isLast) return false;
253
+ if (props.copied === true && !isCopied) return false;
254
+ if (props.copied === false && isCopied) return false;
255
+ return true;
256
+ }
257
+ );
258
+ };
259
+
260
+ // src/primitive-hooks/thread/useThreadIf.tsx
261
+ var useThreadIf = (props) => {
262
+ const { useThread } = useThreadContext();
263
+ return useThread((thread) => {
264
+ if (props.empty === true && thread.messages.length !== 0) return false;
265
+ if (props.empty === false && thread.messages.length === 0) return false;
266
+ if (props.running === true && !thread.isRunning) return false;
267
+ if (props.running === false && thread.isRunning) return false;
268
+ return true;
269
+ });
270
+ };
271
+
272
+ // src/primitive-hooks/thread/useThreadEmpty.tsx
273
+ var useThreadEmpty = () => {
274
+ return useThreadIf({ empty: true });
275
+ };
276
+
277
+ // src/primitive-hooks/thread/useThreadScrollToBottom.tsx
278
+ import { useCallback as useCallback8 } from "react";
279
+ var useThreadScrollToBottom = () => {
280
+ const { useViewport } = useThreadContext();
281
+ const isAtBottom = useViewport((s) => s.isAtBottom);
282
+ const handleScrollToBottom = useCallback8(() => {
283
+ const { scrollToBottom } = useViewport.getState();
284
+ scrollToBottom();
285
+ }, [useViewport]);
286
+ if (isAtBottom) return null;
287
+ return handleScrollToBottom;
288
+ };
289
+
290
+ // src/primitive-hooks/thread/useThreadSuggestion.tsx
291
+ import { useCallback as useCallback9 } from "react";
292
+ var useThreadSuggestion = ({
293
+ prompt,
294
+ autoSend
295
+ }) => {
296
+ const { useThread, useComposer } = useThreadContext();
297
+ const disabled = useThread((t) => t.isRunning);
298
+ const callback = useCallback9(() => {
299
+ const thread = useThread.getState();
300
+ const composer = useComposer.getState();
301
+ composer.setValue(prompt);
302
+ if (autoSend && !thread.isRunning) {
303
+ composer.send();
304
+ }
305
+ }, [useThread, useComposer, prompt, autoSend]);
306
+ if (disabled) return null;
307
+ return callback;
308
+ };
309
+
141
310
  // src/primitives/thread/index.ts
142
311
  var thread_exports = {};
143
312
  __export(thread_exports, {
@@ -162,16 +331,6 @@ var ThreadRoot = forwardRef(
162
331
  ThreadRoot.displayName = "ThreadRoot";
163
332
 
164
333
  // src/primitives/thread/ThreadIf.tsx
165
- var useThreadIf = (props) => {
166
- const { useThread } = useThreadContext();
167
- return useThread((thread) => {
168
- if (props.empty === true && thread.messages.length !== 0) return false;
169
- if (props.empty === false && thread.messages.length === 0) return false;
170
- if (props.running === true && !thread.isRunning) return false;
171
- if (props.running === false && thread.isRunning) return false;
172
- return true;
173
- });
174
- };
175
334
  var ThreadIf = ({ children, ...query }) => {
176
335
  const result = useThreadIf(query);
177
336
  return result ? children : null;
@@ -197,8 +356,8 @@ import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
197
356
  import { useEffect } from "react";
198
357
  var useOnResizeContent = (ref, callback) => {
199
358
  const callbackRef = useCallbackRef(callback);
200
- const el = ref.current;
201
359
  useEffect(() => {
360
+ const el = ref.current;
202
361
  if (!el) return;
203
362
  const resizeObserver = new ResizeObserver(() => {
204
363
  callbackRef();
@@ -227,7 +386,7 @@ var useOnResizeContent = (ref, callback) => {
227
386
  resizeObserver.disconnect();
228
387
  mutationObserver.disconnect();
229
388
  };
230
- }, [el, callbackRef]);
389
+ }, [ref, callbackRef]);
231
390
  };
232
391
 
233
392
  // src/utils/hooks/useOnScrollToBottom.tsx
@@ -307,7 +466,7 @@ import { memo } from "react";
307
466
  import { useEffect as useEffect3, useState } from "react";
308
467
  import { create as create3 } from "zustand";
309
468
 
310
- // src/context/stores/MessageComposer.ts
469
+ // src/context/stores/EditComposer.ts
311
470
  import { create } from "zustand";
312
471
 
313
472
  // src/context/stores/BaseComposer.ts
@@ -318,7 +477,7 @@ var makeBaseComposer = (set) => ({
318
477
  }
319
478
  });
320
479
 
321
- // src/context/stores/MessageComposer.ts
480
+ // src/context/stores/EditComposer.ts
322
481
  var makeEditComposerStore = ({
323
482
  onEdit,
324
483
  onSend
@@ -384,7 +543,7 @@ var useMessageContext2 = (messageIndex) => {
384
543
  const [context] = useState(() => {
385
544
  const useMessage = create3(() => ({}));
386
545
  const useMessageUtils = makeMessageUtilsStore();
387
- const useComposer = makeEditComposerStore({
546
+ const useEditComposer = makeEditComposerStore({
388
547
  onEdit: () => {
389
548
  const message = useMessage.getState().message;
390
549
  if (message.role !== "user")
@@ -415,7 +574,7 @@ var useMessageContext2 = (messageIndex) => {
415
574
  useMessage,
416
575
  messageIndex
417
576
  );
418
- return { useMessage, useMessageUtils, useComposer };
577
+ return { useMessage, useMessageUtils, useEditComposer };
419
578
  });
420
579
  useEffect3(() => {
421
580
  return useThread.subscribe((thread) => {
@@ -438,35 +597,12 @@ var MessageProvider = ({
438
597
  };
439
598
 
440
599
  // src/primitives/composer/ComposerIf.tsx
441
- var useComposerIf = (props) => {
442
- const { useComposer } = useComposerContext();
443
- return useComposer((composer) => {
444
- if (props.editing === true && !composer.isEditing) return false;
445
- if (props.editing === false && composer.isEditing) return false;
446
- return true;
447
- });
448
- };
449
600
  var ComposerIf = ({ children, ...query }) => {
450
601
  const result = useComposerIf(query);
451
602
  return result ? children : null;
452
603
  };
453
604
 
454
605
  // src/primitives/message/MessageIf.tsx
455
- var useMessageIf = (props) => {
456
- const { useMessage, useMessageUtils } = useMessageContext();
457
- return useCombinedStore(
458
- [useMessage, useMessageUtils],
459
- ({ message, branches, isLast }, { isCopied, isHovering }) => {
460
- if (props.hasBranches === true && branches.length < 2) return false;
461
- if (props.user && message.role !== "user") return false;
462
- if (props.assistant && message.role !== "assistant") return false;
463
- if (props.lastOrHover === true && !isHovering && !isLast) return false;
464
- if (props.copied === true && !isCopied) return false;
465
- if (props.copied === false && isCopied) return false;
466
- return true;
467
- }
468
- );
469
- };
470
606
  var MessageIf = ({ children, ...query }) => {
471
607
  const result = useMessageIf(query);
472
608
  return result ? children : null;
@@ -515,56 +651,42 @@ var ThreadMessages = ({ components }) => {
515
651
  });
516
652
  };
517
653
 
518
- // src/primitives/thread/ThreadScrollToBottom.tsx
654
+ // src/utils/createActionButton.tsx
519
655
  import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
520
656
  import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
521
657
  import { forwardRef as forwardRef3 } from "react";
522
658
  import { jsx as jsx6 } from "react/jsx-runtime";
523
- var ThreadScrollToBottom = forwardRef3(({ onClick, ...rest }, ref) => {
524
- const { useViewport } = useThreadContext();
525
- const isAtBottom = useViewport((s) => s.isAtBottom);
526
- const handleScrollToBottom = () => {
527
- useViewport.getState().scrollToBottom();
528
- };
529
- return /* @__PURE__ */ jsx6(
530
- Primitive3.button,
531
- {
532
- ...rest,
533
- disabled: isAtBottom,
534
- ref,
535
- onClick: composeEventHandlers2(onClick, handleScrollToBottom)
536
- }
537
- );
538
- });
539
- ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
659
+ var createActionButton = (displayName, useActionButton) => {
660
+ const ActionButton = forwardRef3((props, forwardedRef) => {
661
+ const callback = useActionButton(props);
662
+ return /* @__PURE__ */ jsx6(
663
+ Primitive3.button,
664
+ {
665
+ type: "button",
666
+ disabled: !callback,
667
+ ...props,
668
+ ref: forwardedRef,
669
+ onClick: composeEventHandlers2(props.onClick, () => {
670
+ callback?.();
671
+ })
672
+ }
673
+ );
674
+ });
675
+ ActionButton.displayName = displayName;
676
+ return ActionButton;
677
+ };
678
+
679
+ // src/primitives/thread/ThreadScrollToBottom.tsx
680
+ var ThreadScrollToBottom = createActionButton(
681
+ "ThreadScrollToBottom",
682
+ useThreadScrollToBottom
683
+ );
540
684
 
541
685
  // src/primitives/thread/ThreadSuggestion.tsx
542
- import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
543
- import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
544
- import { forwardRef as forwardRef4 } from "react";
545
- import { jsx as jsx7 } from "react/jsx-runtime";
546
- var ThreadSuggestion = forwardRef4(({ onClick, prompt, method, autoSend: send, ...rest }, ref) => {
547
- const { useThread, useComposer } = useThreadContext();
548
- const isDisabled = useThread((t) => t.isRunning);
549
- const handleApplySuggestion = () => {
550
- const thread = useThread.getState();
551
- const composer = useComposer.getState();
552
- composer.setValue(prompt);
553
- if (send && !thread.isRunning) {
554
- composer.send();
555
- }
556
- };
557
- return /* @__PURE__ */ jsx7(
558
- Primitive4.button,
559
- {
560
- ...rest,
561
- disabled: isDisabled,
562
- ref,
563
- onClick: composeEventHandlers3(onClick, handleApplySuggestion)
564
- }
565
- );
566
- });
567
- ThreadSuggestion.displayName = "ThreadSuggestion";
686
+ var ThreadSuggestion = createActionButton(
687
+ "ThreadSuggestion",
688
+ useThreadSuggestion
689
+ );
568
690
 
569
691
  // src/primitives/composer/index.ts
570
692
  var composer_exports = {};
@@ -577,15 +699,15 @@ __export(composer_exports, {
577
699
  });
578
700
 
579
701
  // src/primitives/composer/ComposerRoot.tsx
580
- import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
702
+ import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
581
703
  import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
582
- import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
704
+ import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
583
705
  import {
584
- forwardRef as forwardRef5,
706
+ forwardRef as forwardRef4,
585
707
  useRef as useRef2
586
708
  } from "react";
587
- import { jsx as jsx8 } from "react/jsx-runtime";
588
- var ComposerRoot = forwardRef5(
709
+ import { jsx as jsx7 } from "react/jsx-runtime";
710
+ var ComposerRoot = forwardRef4(
589
711
  ({ onSubmit, ...rest }, forwardedRef) => {
590
712
  const { useViewport } = useThreadContext();
591
713
  const { useComposer } = useComposerContext();
@@ -598,12 +720,12 @@ var ComposerRoot = forwardRef5(
598
720
  composerState.send();
599
721
  useViewport.getState().scrollToBottom();
600
722
  };
601
- return /* @__PURE__ */ jsx8(
602
- Primitive5.form,
723
+ return /* @__PURE__ */ jsx7(
724
+ Primitive4.form,
603
725
  {
604
726
  ...rest,
605
727
  ref,
606
- onSubmit: composeEventHandlers4(onSubmit, handleSubmit)
728
+ onSubmit: composeEventHandlers3(onSubmit, handleSubmit)
607
729
  }
608
730
  );
609
731
  }
@@ -611,18 +733,18 @@ var ComposerRoot = forwardRef5(
611
733
  ComposerRoot.displayName = "ComposerRoot";
612
734
 
613
735
  // src/primitives/composer/ComposerInput.tsx
614
- import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
736
+ import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
615
737
  import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
616
738
  import { Slot } from "@radix-ui/react-slot";
617
739
  import {
618
- forwardRef as forwardRef6,
619
- useCallback as useCallback6,
740
+ forwardRef as forwardRef5,
741
+ useCallback as useCallback10,
620
742
  useEffect as useEffect4,
621
743
  useRef as useRef3
622
744
  } from "react";
623
745
  import TextareaAutosize from "react-textarea-autosize";
624
- import { jsx as jsx9 } from "react/jsx-runtime";
625
- var ComposerInput = forwardRef6(
746
+ import { jsx as jsx8 } from "react/jsx-runtime";
747
+ var ComposerInput = forwardRef5(
626
748
  ({ autoFocus = false, asChild, disabled, onChange, onKeyDown, ...rest }, forwardedRef) => {
627
749
  const { useThread } = useThreadContext();
628
750
  const { useComposer, type } = useComposerContext();
@@ -649,10 +771,9 @@ var ComposerInput = forwardRef6(
649
771
  }
650
772
  };
651
773
  const autoFocusEnabled = autoFocus && !disabled;
652
- const focus = useCallback6(() => {
774
+ const focus = useCallback10(() => {
653
775
  const textarea = textareaRef.current;
654
776
  if (!textarea || !autoFocusEnabled) return;
655
- console.log("focus");
656
777
  textarea.focus();
657
778
  textarea.setSelectionRange(
658
779
  textareaRef.current.value.length,
@@ -665,7 +786,7 @@ var ComposerInput = forwardRef6(
665
786
  focus();
666
787
  }
667
788
  });
668
- return /* @__PURE__ */ jsx9(
789
+ return /* @__PURE__ */ jsx8(
669
790
  Component,
670
791
  {
671
792
  value,
@@ -673,12 +794,12 @@ var ComposerInput = forwardRef6(
673
794
  ref,
674
795
  autoFocus,
675
796
  disabled,
676
- onChange: composeEventHandlers5(onChange, (e) => {
797
+ onChange: composeEventHandlers4(onChange, (e) => {
677
798
  const composerState = useComposer.getState();
678
799
  if (!composerState.isEditing) return;
679
800
  return composerState.setValue(e.target.value);
680
801
  }),
681
- onKeyDown: composeEventHandlers5(onKeyDown, handleKeyPress)
802
+ onKeyDown: composeEventHandlers4(onKeyDown, handleKeyPress)
682
803
  }
683
804
  );
684
805
  }
@@ -686,47 +807,13 @@ var ComposerInput = forwardRef6(
686
807
  ComposerInput.displayName = "ComposerInput";
687
808
 
688
809
  // src/primitives/composer/ComposerSend.tsx
689
- import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
690
- import { forwardRef as forwardRef7 } from "react";
691
- import { jsx as jsx10 } from "react/jsx-runtime";
692
- var ComposerSend = forwardRef7(
693
- ({ disabled, ...rest }, ref) => {
694
- const { useComposer } = useComposerContext();
695
- const hasValue = useComposer((c) => c.isEditing && c.value.length > 0);
696
- return /* @__PURE__ */ jsx10(
697
- Primitive6.button,
698
- {
699
- type: "submit",
700
- ...rest,
701
- ref,
702
- disabled: disabled || !hasValue
703
- }
704
- );
705
- }
706
- );
707
- ComposerSend.displayName = "ComposerSend";
810
+ var ComposerSend = createActionButton("ComposerSend", useComposerSend);
708
811
 
709
812
  // src/primitives/composer/ComposerCancel.tsx
710
- import { composeEventHandlers as composeEventHandlers6 } from "@radix-ui/primitive";
711
- import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
712
- import { forwardRef as forwardRef8 } from "react";
713
- import { jsx as jsx11 } from "react/jsx-runtime";
714
- var ComposerCancel = forwardRef8(({ onClick, ...rest }, ref) => {
715
- const { useComposer } = useComposerContext();
716
- const handleCancel = () => {
717
- useComposer.getState().cancel();
718
- };
719
- return /* @__PURE__ */ jsx11(
720
- Primitive7.button,
721
- {
722
- type: "button",
723
- ...rest,
724
- ref,
725
- onClick: composeEventHandlers6(onClick, handleCancel)
726
- }
727
- );
728
- });
729
- ComposerCancel.displayName = "ComposerCancel";
813
+ var ComposerCancel = createActionButton(
814
+ "ComposerCancel",
815
+ useComposerCancel
816
+ );
730
817
 
731
818
  // src/primitives/message/index.ts
732
819
  var message_exports = {};
@@ -738,11 +825,11 @@ __export(message_exports, {
738
825
  });
739
826
 
740
827
  // src/primitives/message/MessageRoot.tsx
741
- import { composeEventHandlers as composeEventHandlers7 } from "@radix-ui/primitive";
742
- import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
743
- import { forwardRef as forwardRef9 } from "react";
744
- import { jsx as jsx12 } from "react/jsx-runtime";
745
- var MessageRoot = forwardRef9(
828
+ import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
829
+ import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
830
+ import { forwardRef as forwardRef6 } from "react";
831
+ import { jsx as jsx9 } from "react/jsx-runtime";
832
+ var MessageRoot = forwardRef6(
746
833
  ({ onMouseEnter, onMouseLeave, ...rest }, ref) => {
747
834
  const { useMessageUtils } = useMessageContext();
748
835
  const setIsHovering = useMessageUtils((s) => s.setIsHovering);
@@ -752,13 +839,13 @@ var MessageRoot = forwardRef9(
752
839
  const handleMouseLeave = () => {
753
840
  setIsHovering(false);
754
841
  };
755
- return /* @__PURE__ */ jsx12(
756
- Primitive8.div,
842
+ return /* @__PURE__ */ jsx9(
843
+ Primitive5.div,
757
844
  {
758
845
  ...rest,
759
846
  ref,
760
- onMouseEnter: composeEventHandlers7(onMouseEnter, handleMouseEnter),
761
- onMouseLeave: composeEventHandlers7(onMouseLeave, handleMouseLeave)
847
+ onMouseEnter: composeEventHandlers5(onMouseEnter, handleMouseEnter),
848
+ onMouseLeave: composeEventHandlers5(onMouseLeave, handleMouseLeave)
762
849
  }
763
850
  );
764
851
  }
@@ -771,7 +858,7 @@ import { memo as memo2 } from "react";
771
858
  // src/context/providers/ContentPartProvider.tsx
772
859
  import { useEffect as useEffect5, useState as useState2 } from "react";
773
860
  import { create as create4 } from "zustand";
774
- import { jsx as jsx13 } from "react/jsx-runtime";
861
+ import { jsx as jsx10 } from "react/jsx-runtime";
775
862
  var syncContentPart = ({ message }, useContentPart, partIndex) => {
776
863
  const part = message.content[partIndex];
777
864
  if (!part) return;
@@ -808,65 +895,46 @@ var ContentPartProvider = ({
808
895
  children
809
896
  }) => {
810
897
  const context = useContentPartContext2(partIndex);
811
- return /* @__PURE__ */ jsx13(ContentPartContext.Provider, { value: context, children });
898
+ return /* @__PURE__ */ jsx10(ContentPartContext.Provider, { value: context, children });
812
899
  };
813
900
 
814
901
  // src/primitives/contentPart/ContentPartDisplay.tsx
815
902
  var ContentPartDisplay = () => {
816
- const { useContentPart } = useContentPartContext();
817
- const display = useContentPart((c) => {
818
- if (c.part.type !== "ui")
819
- throw new Error(
820
- "ContentPartDisplay can only be used inside ui content parts."
821
- );
822
- return c.part.display;
823
- });
903
+ const display = useContentPartDisplay();
824
904
  return display ?? null;
825
905
  };
826
906
 
827
907
  // src/primitives/contentPart/ContentPartInProgressIndicator.tsx
828
908
  var ContentPartInProgressIndicator = () => {
829
- const { useMessageUtils } = useMessageContext();
830
- const { useContentPart } = useContentPartContext();
831
- const indicator = useCombinedStore(
832
- [useMessageUtils, useContentPart],
833
- (m, c) => c.status === "in_progress" ? m.inProgressIndicator : null
834
- );
909
+ const indicator = useContentPartInProgressIndicator();
835
910
  return indicator;
836
911
  };
837
912
 
838
913
  // src/primitives/contentPart/ContentPartText.tsx
839
- import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
840
- import { forwardRef as forwardRef10 } from "react";
841
- import { jsx as jsx14 } from "react/jsx-runtime";
842
- var ContentPartText = forwardRef10((props, forwardedRef) => {
843
- const { useContentPart } = useContentPartContext();
844
- const text = useContentPart((c) => {
845
- if (c.part.type !== "text")
846
- throw new Error(
847
- "ContentPartText can only be used inside text content parts."
848
- );
849
- return c.part.text;
850
- });
851
- return /* @__PURE__ */ jsx14(Primitive9.span, { ...props, ref: forwardedRef, children: text });
914
+ import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
915
+ import { forwardRef as forwardRef7 } from "react";
916
+ import { jsx as jsx11 } from "react/jsx-runtime";
917
+ var ContentPartText = forwardRef7((props, forwardedRef) => {
918
+ const text = useContentPartText();
919
+ return /* @__PURE__ */ jsx11(Primitive6.span, { ...props, ref: forwardedRef, children: text });
852
920
  });
853
921
  ContentPartText.displayName = "ContentPartText";
854
922
 
855
923
  // src/primitives/message/MessageContent.tsx
856
- import { Fragment, jsx as jsx15, jsxs as jsxs3 } from "react/jsx-runtime";
924
+ import { Fragment, jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
857
925
  var defaultComponents = {
858
926
  Text: () => /* @__PURE__ */ jsxs3(Fragment, { children: [
859
- /* @__PURE__ */ jsx15(ContentPartText, {}),
860
- /* @__PURE__ */ jsx15(ContentPartInProgressIndicator, {})
927
+ /* @__PURE__ */ jsx12(ContentPartText, {}),
928
+ /* @__PURE__ */ jsx12(ContentPartInProgressIndicator, {})
861
929
  ] }),
862
930
  Image: () => null,
863
- UI: () => /* @__PURE__ */ jsx15(ContentPartDisplay, {}),
931
+ UI: () => /* @__PURE__ */ jsx12(ContentPartDisplay, {}),
864
932
  tools: {
865
933
  Fallback: (props) => {
866
934
  const { useToolUIs } = useAssistantContext();
867
935
  const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
868
936
  if (!Render) return null;
869
- return /* @__PURE__ */ jsx15(Render, { ...props });
937
+ return /* @__PURE__ */ jsx12(Render, { ...props });
870
938
  }
871
939
  }
872
940
  };
@@ -885,15 +953,15 @@ var MessageContentPartComponent = ({
885
953
  const type = part.type;
886
954
  switch (type) {
887
955
  case "text":
888
- return /* @__PURE__ */ jsx15(Text, { part, status });
956
+ return /* @__PURE__ */ jsx12(Text, { part, status });
889
957
  case "image":
890
- return /* @__PURE__ */ jsx15(Image, { part, status });
958
+ return /* @__PURE__ */ jsx12(Image, { part, status });
891
959
  case "ui":
892
- return /* @__PURE__ */ jsx15(UI, { part, status });
960
+ return /* @__PURE__ */ jsx12(UI, { part, status });
893
961
  case "tool-call": {
894
962
  const Tool = by_name[part.toolName] || Fallback;
895
963
  const addResult = (result) => addToolResult(part.toolCallId, result);
896
- return /* @__PURE__ */ jsx15(Tool, { part, status, addResult });
964
+ return /* @__PURE__ */ jsx12(Tool, { part, status, addResult });
897
965
  }
898
966
  default:
899
967
  throw new Error(`Unknown content part type: ${type}`);
@@ -903,7 +971,7 @@ var MessageContentPartImpl = ({
903
971
  partIndex,
904
972
  components
905
973
  }) => {
906
- return /* @__PURE__ */ jsx15(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx15(MessageContentPartComponent, { components }) });
974
+ return /* @__PURE__ */ jsx12(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx12(MessageContentPartComponent, { components }) });
907
975
  };
908
976
  var MessageContentPart = memo2(
909
977
  MessageContentPartImpl,
@@ -914,7 +982,7 @@ var MessageContent = ({ components }) => {
914
982
  const contentLength = useMessage((s) => s.message.content.length);
915
983
  return new Array(contentLength).fill(null).map((_, idx) => {
916
984
  const partIndex = idx;
917
- return /* @__PURE__ */ jsx15(
985
+ return /* @__PURE__ */ jsx12(
918
986
  MessageContentPart,
919
987
  {
920
988
  partIndex,
@@ -926,16 +994,16 @@ var MessageContent = ({ components }) => {
926
994
  };
927
995
 
928
996
  // src/primitives/message/MessageInProgress.tsx
929
- import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
997
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
930
998
  import {
931
- forwardRef as forwardRef11,
999
+ forwardRef as forwardRef8,
932
1000
  useMemo as useMemo2
933
1001
  } from "react";
934
- import { jsx as jsx16 } from "react/jsx-runtime";
935
- var MessageInProgress = forwardRef11((props, ref) => {
1002
+ import { jsx as jsx13 } from "react/jsx-runtime";
1003
+ var MessageInProgress = forwardRef8((props, ref) => {
936
1004
  const { useMessageUtils } = useMessageContext();
937
1005
  useMemo2(() => {
938
- useMessageUtils.getState().setInProgressIndicator(/* @__PURE__ */ jsx16(Primitive10.span, { ...props, ref }));
1006
+ useMessageUtils.getState().setInProgressIndicator(/* @__PURE__ */ jsx13(Primitive7.span, { ...props, ref }));
939
1007
  }, [useMessageUtils, props, ref]);
940
1008
  return null;
941
1009
  });
@@ -951,57 +1019,38 @@ __export(branchPicker_exports, {
951
1019
  Root: () => BranchPickerRoot
952
1020
  });
953
1021
 
954
- // src/utils/createActionButton.tsx
955
- import { composeEventHandlers as composeEventHandlers8 } from "@radix-ui/primitive";
956
- import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
957
- import { forwardRef as forwardRef12 } from "react";
958
- import { jsx as jsx17 } from "react/jsx-runtime";
959
- var createActionButton = (useActionButton) => {
960
- const ActionButton = forwardRef12((props, forwardedRef) => {
961
- const onClick = useActionButton(props);
962
- return /* @__PURE__ */ jsx17(
963
- Primitive11.button,
964
- {
965
- type: "button",
966
- disabled: !onClick,
967
- ...props,
968
- ref: forwardedRef,
969
- onClick: composeEventHandlers8(props.onClick, onClick ?? void 0)
970
- }
971
- );
972
- });
973
- ActionButton.displayName = "ActionButton";
974
- return ActionButton;
975
- };
976
-
977
1022
  // src/primitives/branchPicker/BranchPickerNext.tsx
978
- var BranchPickerNext = createActionButton(useGoToNextBranch);
1023
+ var BranchPickerNext = createActionButton(
1024
+ "BranchPickerNext",
1025
+ useBranchPickerNext
1026
+ );
979
1027
 
980
1028
  // src/primitives/branchPicker/BranchPickerPrevious.tsx
981
- var BranchPickerPrevious = createActionButton(useGoToPreviousBranch);
1029
+ var BranchPickerPrevious = createActionButton(
1030
+ "BranchPickerPrevious",
1031
+ useBranchPickerPrevious
1032
+ );
982
1033
 
983
1034
  // src/primitives/branchPicker/BranchPickerCount.tsx
984
- import { Fragment as Fragment2, jsx as jsx18 } from "react/jsx-runtime";
1035
+ import { Fragment as Fragment2, jsx as jsx14 } from "react/jsx-runtime";
985
1036
  var BranchPickerCount = () => {
986
- const { useMessage } = useMessageContext();
987
- const branchCount = useMessage((s) => s.branches.length);
988
- return /* @__PURE__ */ jsx18(Fragment2, { children: branchCount });
1037
+ const branchCount = useBranchPickerCount();
1038
+ return /* @__PURE__ */ jsx14(Fragment2, { children: branchCount });
989
1039
  };
990
1040
 
991
1041
  // src/primitives/branchPicker/BranchPickerNumber.tsx
992
- import { Fragment as Fragment3, jsx as jsx19 } from "react/jsx-runtime";
1042
+ import { Fragment as Fragment3, jsx as jsx15 } from "react/jsx-runtime";
993
1043
  var BranchPickerNumber = () => {
994
- const { useMessage } = useMessageContext();
995
- const branchIdx = useMessage((s) => s.branches.indexOf(s.message.id));
996
- return /* @__PURE__ */ jsx19(Fragment3, { children: branchIdx + 1 });
1044
+ const branchNumber = useBranchPickerNumber();
1045
+ return /* @__PURE__ */ jsx15(Fragment3, { children: branchNumber });
997
1046
  };
998
1047
 
999
1048
  // src/primitives/branchPicker/BranchPickerRoot.tsx
1000
- import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
1001
- import { forwardRef as forwardRef13 } from "react";
1002
- import { jsx as jsx20 } from "react/jsx-runtime";
1003
- var BranchPickerRoot = forwardRef13(({ hideWhenSingleBranch, ...rest }, ref) => {
1004
- return /* @__PURE__ */ jsx20(MessageIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx20(Primitive12.div, { ...rest, ref }) });
1049
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
1050
+ import { forwardRef as forwardRef9 } from "react";
1051
+ import { jsx as jsx16 } from "react/jsx-runtime";
1052
+ var BranchPickerRoot = forwardRef9(({ hideWhenSingleBranch, ...rest }, ref) => {
1053
+ return /* @__PURE__ */ jsx16(MessageIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx16(Primitive8.div, { ...rest, ref }) });
1005
1054
  });
1006
1055
  BranchPickerRoot.displayName = "BranchPickerRoot";
1007
1056
 
@@ -1015,13 +1064,17 @@ __export(actionBar_exports, {
1015
1064
  });
1016
1065
 
1017
1066
  // src/primitives/actionBar/ActionBarRoot.tsx
1018
- import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
1019
- import { forwardRef as forwardRef14 } from "react";
1020
- import { jsx as jsx21 } from "react/jsx-runtime";
1021
- var ActionBarRoot = forwardRef14(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {
1067
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1068
+ import { forwardRef as forwardRef10 } from "react";
1069
+ import { jsx as jsx17 } from "react/jsx-runtime";
1070
+ var useActionBarFloatStatus = ({
1071
+ hideWhenRunning,
1072
+ autohide,
1073
+ autohideFloat
1074
+ }) => {
1022
1075
  const { useThread } = useThreadContext();
1023
1076
  const { useMessage, useMessageUtils } = useMessageContext();
1024
- const hideAndfloatStatus = useCombinedStore(
1077
+ return useCombinedStore(
1025
1078
  [useThread, useMessage, useMessageUtils],
1026
1079
  (t, m, mu) => {
1027
1080
  if (hideWhenRunning && t.isRunning) return "hidden" /* Hidden */;
@@ -1033,9 +1086,16 @@ var ActionBarRoot = forwardRef14(({ hideWhenRunning, autohide, autohideFloat, ..
1033
1086
  return "normal" /* Normal */;
1034
1087
  }
1035
1088
  );
1089
+ };
1090
+ var ActionBarRoot = forwardRef10(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {
1091
+ const hideAndfloatStatus = useActionBarFloatStatus({
1092
+ hideWhenRunning,
1093
+ autohide,
1094
+ autohideFloat
1095
+ });
1036
1096
  if (hideAndfloatStatus === "hidden" /* Hidden */) return null;
1037
- return /* @__PURE__ */ jsx21(
1038
- Primitive13.div,
1097
+ return /* @__PURE__ */ jsx17(
1098
+ Primitive9.div,
1039
1099
  {
1040
1100
  ...hideAndfloatStatus === "floating" /* Floating */ ? { "data-floating": "true" } : null,
1041
1101
  ...rest,
@@ -1046,13 +1106,22 @@ var ActionBarRoot = forwardRef14(({ hideWhenRunning, autohide, autohideFloat, ..
1046
1106
  ActionBarRoot.displayName = "ActionBarRoot";
1047
1107
 
1048
1108
  // src/primitives/actionBar/ActionBarCopy.tsx
1049
- var ActionBarCopy = createActionButton(useCopyMessage);
1109
+ var ActionBarCopy = createActionButton(
1110
+ "ActionBarCopy",
1111
+ useActionBarCopy
1112
+ );
1050
1113
 
1051
1114
  // src/primitives/actionBar/ActionBarReload.tsx
1052
- var ActionBarReload = createActionButton(useReloadMessage);
1115
+ var ActionBarReload = createActionButton(
1116
+ "ActionBarReload",
1117
+ useActionBarReload
1118
+ );
1053
1119
 
1054
1120
  // src/primitives/actionBar/ActionBarEdit.tsx
1055
- var ActionBarEdit = createActionButton(useBeginMessageEdit);
1121
+ var ActionBarEdit = createActionButton(
1122
+ "ActionBarEdit",
1123
+ useActionBarEdit
1124
+ );
1056
1125
 
1057
1126
  // src/primitives/contentPart/index.ts
1058
1127
  var contentPart_exports = {};
@@ -1064,19 +1133,12 @@ __export(contentPart_exports, {
1064
1133
  });
1065
1134
 
1066
1135
  // src/primitives/contentPart/ContentPartImage.tsx
1067
- import { Primitive as Primitive14 } from "@radix-ui/react-primitive";
1068
- import { forwardRef as forwardRef15 } from "react";
1069
- import { jsx as jsx22 } from "react/jsx-runtime";
1070
- var ContentPartImage = forwardRef15((props, forwardedRef) => {
1071
- const { useContentPart } = useContentPartContext();
1072
- const image = useContentPart((c) => {
1073
- if (c.part.type !== "image")
1074
- throw new Error(
1075
- "ContentPartImage can only be used inside image content parts."
1076
- );
1077
- return c.part.image;
1078
- });
1079
- return /* @__PURE__ */ jsx22(Primitive14.img, { src: image, ...props, ref: forwardedRef });
1136
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
1137
+ import { forwardRef as forwardRef11 } from "react";
1138
+ import { jsx as jsx18 } from "react/jsx-runtime";
1139
+ var ContentPartImage = forwardRef11((props, forwardedRef) => {
1140
+ const image = useContentPartImage();
1141
+ return /* @__PURE__ */ jsx18(Primitive10.img, { src: image, ...props, ref: forwardedRef });
1080
1142
  });
1081
1143
  ContentPartImage.displayName = "ContentPartImage";
1082
1144
 
@@ -1513,7 +1575,7 @@ var makeThreadActionStore = (runtimeRef) => {
1513
1575
  };
1514
1576
 
1515
1577
  // src/context/providers/ThreadProvider.tsx
1516
- import { jsx as jsx23, jsxs as jsxs4 } from "react/jsx-runtime";
1578
+ import { jsx as jsx19, jsxs as jsxs4 } from "react/jsx-runtime";
1517
1579
  var ThreadProvider = ({
1518
1580
  children,
1519
1581
  runtime
@@ -1549,13 +1611,13 @@ var ThreadProvider = ({
1549
1611
  }, [context, runtime]);
1550
1612
  const RuntimeSynchronizer = runtime.unstable_synchronizer;
1551
1613
  return /* @__PURE__ */ jsxs4(ThreadContext.Provider, { value: context, children: [
1552
- RuntimeSynchronizer && /* @__PURE__ */ jsx23(RuntimeSynchronizer, {}),
1614
+ RuntimeSynchronizer && /* @__PURE__ */ jsx19(RuntimeSynchronizer, {}),
1553
1615
  children
1554
1616
  ] });
1555
1617
  };
1556
1618
 
1557
1619
  // src/context/providers/AssistantProvider.tsx
1558
- import { jsx as jsx24 } from "react/jsx-runtime";
1620
+ import { jsx as jsx20 } from "react/jsx-runtime";
1559
1621
  var AssistantProvider = ({ children, runtime }) => {
1560
1622
  const runtimeRef = useRef5(runtime);
1561
1623
  useInsertionEffect3(() => {
@@ -1570,13 +1632,13 @@ var AssistantProvider = ({ children, runtime }) => {
1570
1632
  useEffect7(() => {
1571
1633
  return runtime.registerModelConfigProvider(getModelCOnfig);
1572
1634
  }, [runtime, getModelCOnfig]);
1573
- return /* @__PURE__ */ jsx24(AssistantContext.Provider, { value: context, children: /* @__PURE__ */ jsx24(ThreadProvider, { runtime, children }) });
1635
+ return /* @__PURE__ */ jsx20(AssistantContext.Provider, { value: context, children: /* @__PURE__ */ jsx20(ThreadProvider, { runtime, children }) });
1574
1636
  };
1575
1637
 
1576
1638
  // src/context/providers/AssistantRuntimeProvider.tsx
1577
- import { jsx as jsx25 } from "react/jsx-runtime";
1639
+ import { jsx as jsx21 } from "react/jsx-runtime";
1578
1640
  var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
1579
- return /* @__PURE__ */ jsx25(AssistantProvider, { runtime, children });
1641
+ return /* @__PURE__ */ jsx21(AssistantProvider, { runtime, children });
1580
1642
  };
1581
1643
  var AssistantRuntimeProvider = memo3(AssistantRuntimeProviderImpl);
1582
1644
 
@@ -1595,11 +1657,25 @@ export {
1595
1657
  internal_exports as INTERNAL,
1596
1658
  message_exports as MessagePrimitive,
1597
1659
  thread_exports as ThreadPrimitive,
1598
- useBeginMessageEdit,
1599
- useCopyMessage,
1600
- useGoToNextBranch,
1601
- useGoToPreviousBranch,
1660
+ useActionBarCopy,
1661
+ useActionBarEdit,
1662
+ useActionBarReload,
1663
+ useBranchPickerCount,
1664
+ useBranchPickerNext,
1665
+ useBranchPickerNumber,
1666
+ useBranchPickerPrevious,
1667
+ useComposerCancel,
1668
+ useComposerIf,
1669
+ useComposerSend,
1670
+ useContentPartDisplay,
1671
+ useContentPartImage,
1672
+ useContentPartInProgressIndicator,
1673
+ useContentPartText,
1602
1674
  useLocalRuntime,
1603
- useReloadMessage
1675
+ useMessageIf,
1676
+ useThreadEmpty,
1677
+ useThreadIf,
1678
+ useThreadScrollToBottom,
1679
+ useThreadSuggestion
1604
1680
  };
1605
1681
  //# sourceMappingURL=index.mjs.map