@superinterface/react 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // src/lib/misc/merge/index.ts
1
+ // src/components/core/SuperinterfaceProvider/index.tsx
2
2
  function _array_like_to_array(arr, len) {
3
3
  if (len == null || len > arr.length) len = arr.length;
4
4
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -265,6 +265,8 @@ function _ts_generator(thisArg, body) {
265
265
  }
266
266
  var _2;
267
267
  var _detect;
268
+ import { Toaster, toast } from "sonner";
269
+ // src/lib/misc/merge/index.ts
268
270
  import _21 from "lodash";
269
271
  // src/lib/misc/merge/customizer.ts
270
272
  import _ from "lodash";
@@ -291,7 +293,8 @@ var SuperinterfaceContext = createContext({
291
293
  defaultOptions: {
292
294
  queries: {},
293
295
  mutations: {}
294
- }
296
+ },
297
+ isToasterRendered: false
295
298
  });
296
299
  // src/hooks/core/useSuperinterfaceContext/index.ts
297
300
  import { useContext } from "react";
@@ -299,26 +302,42 @@ var useSuperinterfaceContext = function() {
299
302
  return useContext(SuperinterfaceContext);
300
303
  };
301
304
  // src/components/core/SuperinterfaceProvider/index.tsx
302
- import { jsx } from "react/jsx-runtime";
305
+ import { jsx, jsxs } from "react/jsx-runtime";
303
306
  var SuperinterfaceProvider = function(param) {
304
307
  var children = param.children, baseUrl = param.baseUrl, publicApiKey = param.publicApiKey, variables = param.variables, defaultOptions = param.defaultOptions;
305
308
  var superinterfaceContext = useSuperinterfaceContext();
306
- var value = merge(superinterfaceContext, _object_spread({}, baseUrl ? {
309
+ var value = merge(superinterfaceContext, _object_spread_props(_object_spread({}, baseUrl ? {
307
310
  baseUrl: baseUrl
308
311
  } : {}, publicApiKey ? {
309
312
  publicApiKey: publicApiKey
310
313
  } : {}, variables ? {
311
314
  variables: variables
312
- } : {}, defaultOptions ? {
315
+ } : {}, merge({
316
+ defaultOptions: {
317
+ mutations: {
318
+ onError: function(error) {
319
+ return toast.error(error.message);
320
+ }
321
+ }
322
+ }
323
+ }, defaultOptions !== null && defaultOptions !== void 0 ? defaultOptions : {
313
324
  defaultOptions: defaultOptions
314
- } : {}));
315
- return /* @__PURE__ */ jsx(SuperinterfaceContext.Provider, {
325
+ })), {
326
+ isToasterRendered: true
327
+ }));
328
+ return /* @__PURE__ */ jsxs(SuperinterfaceContext.Provider, {
316
329
  value: value,
317
- children: children
330
+ children: [
331
+ children,
332
+ !superinterfaceContext.isToasterRendered && /* @__PURE__ */ jsx(Toaster, {})
333
+ ]
318
334
  });
319
335
  };
320
336
  // src/components/threads/Thread/Messages/index.tsx
321
- import { Flex as Flex13 } from "@radix-ui/themes";
337
+ import { Flex as Flex12 } from "@radix-ui/themes";
338
+ // src/components/threads/Thread/Messages/Content/index.tsx
339
+ import { useEffect } from "react";
340
+ import { toast as toast2 } from "sonner";
322
341
  // src/hooks/messages/useMessages/index.tsx
323
342
  import { useMemo } from "react";
324
343
  import { useInfiniteQuery, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
@@ -329,7 +348,7 @@ var queryOptions = function(param) {
329
348
  var queryKey = _to_consumable_array(queryKeyBase).concat([
330
349
  threadContext.variables
331
350
  ]);
332
- return infiniteQueryOptions(_object_spread(_object_spread_props(_object_spread({
351
+ return infiniteQueryOptions(_object_spread_props(_object_spread({
333
352
  // @ts-ignore-next-line
334
353
  queryFn: function() {
335
354
  var _ref = _async_to_generator(function(param) {
@@ -401,9 +420,22 @@ var queryOptions = function(param) {
401
420
  return lastPage.lastId;
402
421
  },
403
422
  limit: 10
404
- }, queryClient.getQueryDefaults(queryKey)), {
423
+ }, threadContext.defaultOptions.queries, queryClient.getQueryDefaults(queryKey)), {
405
424
  queryKey: queryKey
406
- }), threadContext.defaultOptions.queries));
425
+ }));
426
+ };
427
+ // src/lib/messages/messagesQueryOptions.ts
428
+ var messagesQueryOptions = function(param) {
429
+ var queryClient = param.queryClient, threadContext = param.threadContext, superinterfaceContext = param.superinterfaceContext;
430
+ return queryOptions({
431
+ queryKeyBase: [
432
+ "messages"
433
+ ],
434
+ path: "/messages",
435
+ queryClient: queryClient,
436
+ threadContext: threadContext,
437
+ superinterfaceContext: superinterfaceContext
438
+ });
407
439
  };
408
440
  // src/hooks/messages/useMessages/index.tsx
409
441
  var messages = function(param) {
@@ -417,11 +449,7 @@ var useMessages = function() {
417
449
  var queryClient = useQueryClient2();
418
450
  var threadContext = useSuperinterfaceContext();
419
451
  var superinterfaceContext = useSuperinterfaceContext();
420
- var props = useInfiniteQuery(queryOptions({
421
- queryKeyBase: [
422
- "messages"
423
- ],
424
- path: "/messages",
452
+ var props = useInfiniteQuery(messagesQueryOptions({
425
453
  queryClient: queryClient,
426
454
  threadContext: threadContext,
427
455
  superinterfaceContext: superinterfaceContext
@@ -512,35 +540,18 @@ var useMessageGroups = function(param) {
512
540
  };
513
541
  // src/components/skeletons/MessagesSkeleton/index.tsx
514
542
  import { forwardRef as forwardRef2 } from "react";
515
- import { Flex as Flex4, Avatar, Box } from "@radix-ui/themes";
516
- // src/components/skeletons/Skeleton/index.tsx
517
- import { Flex } from "@radix-ui/themes";
518
- import { jsx as jsx2 } from "react/jsx-runtime";
519
- var Skeleton = function(_param) {
520
- var height = _param.height, style = _param.style, rest = _object_without_properties(_param, [
521
- "height",
522
- "style"
523
- ]);
524
- return /* @__PURE__ */ jsx2(Flex, _object_spread({
525
- height: "var(--space-".concat(height, ")"),
526
- style: _object_spread({
527
- animation: "pulse 2s cubic-bezier(.4,0,.6,1) infinite",
528
- borderRadius: "var(--radius-3)",
529
- backgroundColor: "var(--gray-5)"
530
- }, style)
531
- }, rest));
532
- };
543
+ import { Flex as Flex3, Avatar, Box, Skeleton } from "@radix-ui/themes";
533
544
  // src/components/messageGroups/MessageGroupBase/index.tsx
534
545
  import { forwardRef } from "react";
535
- import { Flex as Flex2, Container } from "@radix-ui/themes";
536
- import { jsx as jsx3 } from "react/jsx-runtime";
546
+ import { Flex, Container } from "@radix-ui/themes";
547
+ import { jsx as jsx2 } from "react/jsx-runtime";
537
548
  var MessageGroupBase = forwardRef(function MessageGroupBase2(param, ref) {
538
549
  var children = param.children;
539
- return /* @__PURE__ */ jsx3(Container, {
550
+ return /* @__PURE__ */ jsx2(Container, {
540
551
  ref: ref,
541
552
  size: "2",
542
553
  flexGrow: "0",
543
- children: /* @__PURE__ */ jsx3(Flex2, {
554
+ children: /* @__PURE__ */ jsx2(Flex, {
544
555
  flexShrink: "0",
545
556
  gap: "3",
546
557
  children: children
@@ -548,14 +559,14 @@ var MessageGroupBase = forwardRef(function MessageGroupBase2(param, ref) {
548
559
  });
549
560
  });
550
561
  // src/components/messageGroups/MessageGroupBase/Name.tsx
551
- import { Flex as Flex3, Text } from "@radix-ui/themes";
552
- import { jsx as jsx4 } from "react/jsx-runtime";
562
+ import { Flex as Flex2, Text } from "@radix-ui/themes";
563
+ import { jsx as jsx3 } from "react/jsx-runtime";
553
564
  var Name = function(param) {
554
565
  var children = param.children;
555
- return /* @__PURE__ */ jsx4(Flex3, {
566
+ return /* @__PURE__ */ jsx3(Flex2, {
556
567
  align: "center",
557
568
  height: "var(--space-5)",
558
- children: /* @__PURE__ */ jsx4(Text, {
569
+ children: /* @__PURE__ */ jsx3(Text, {
559
570
  size: "2",
560
571
  weight: "bold",
561
572
  children: children
@@ -563,44 +574,44 @@ var Name = function(param) {
563
574
  });
564
575
  };
565
576
  // src/components/skeletons/MessagesSkeleton/index.tsx
566
- import { jsx as jsx5, jsxs } from "react/jsx-runtime";
577
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
567
578
  var MessagesSkeleton = forwardRef2(function MessagesSkeleton2(_props, ref) {
568
- return /* @__PURE__ */ jsxs(MessageGroupBase, {
579
+ return /* @__PURE__ */ jsxs2(MessageGroupBase, {
569
580
  ref: ref,
570
581
  children: [
571
- /* @__PURE__ */ jsx5(Avatar, {
572
- fallback: /* @__PURE__ */ jsx5(Flex4, {}),
573
- size: "1",
574
- style: {
575
- animation: "pulse 2s cubic-bezier(.4,0,.6,1) infinite"
576
- }
582
+ /* @__PURE__ */ jsx4(Skeleton, {
583
+ loading: true,
584
+ children: /* @__PURE__ */ jsx4(Avatar, {
585
+ fallback: /* @__PURE__ */ jsx4(Flex3, {}),
586
+ size: "1"
587
+ })
577
588
  }),
578
- /* @__PURE__ */ jsxs(Box, {
589
+ /* @__PURE__ */ jsxs2(Box, {
579
590
  pb: "3",
580
591
  children: [
581
- /* @__PURE__ */ jsx5(Name, {
582
- children: /* @__PURE__ */ jsx5(Skeleton, {
583
- height: "1",
592
+ /* @__PURE__ */ jsx4(Name, {
593
+ children: /* @__PURE__ */ jsx4(Skeleton, {
594
+ loading: true,
584
595
  style: {
585
596
  width: "128px"
586
597
  }
587
598
  })
588
599
  }),
589
- /* @__PURE__ */ jsx5(Skeleton, {
590
- height: "2",
600
+ /* @__PURE__ */ jsx4(Skeleton, {
601
+ loading: true,
591
602
  style: {
592
603
  width: "256px"
593
604
  }
594
605
  }),
595
- /* @__PURE__ */ jsx5(Skeleton, {
596
- height: "2",
606
+ /* @__PURE__ */ jsx4(Skeleton, {
607
+ loading: true,
597
608
  style: {
598
609
  width: "256px",
599
610
  marginTop: "var(--space-2)"
600
611
  }
601
612
  }),
602
- /* @__PURE__ */ jsx5(Skeleton, {
603
- height: "2",
613
+ /* @__PURE__ */ jsx4(Skeleton, {
614
+ loading: true,
604
615
  style: {
605
616
  width: "256px",
606
617
  marginTop: "var(--space-2)"
@@ -613,25 +624,25 @@ var MessagesSkeleton = forwardRef2(function MessagesSkeleton2(_props, ref) {
613
624
  });
614
625
  // src/components/threads/Thread/Messages/Content/MessageGroup/index.tsx
615
626
  import { useContext as useContext5 } from "react";
616
- import { Box as Box8, Avatar as Avatar3 } from "@radix-ui/themes";
627
+ import { Box as Box9, Avatar as Avatar3 } from "@radix-ui/themes";
617
628
  import { PersonIcon } from "@radix-ui/react-icons";
618
629
  // src/components/messageGroups/MessageGroupBase/AssistantAvatar.tsx
619
630
  import { useContext as useContext2 } from "react";
620
- import { Flex as Flex5 } from "@radix-ui/themes";
631
+ import { Flex as Flex4 } from "@radix-ui/themes";
621
632
  // src/contexts/assistants/AssistantAvatarContext/index.tsx
622
633
  import { createContext as createContext2 } from "react";
623
634
  import { Avatar as Avatar2 } from "@radix-ui/themes";
624
635
  import { LightningBoltIcon } from "@radix-ui/react-icons";
625
- import { jsx as jsx6 } from "react/jsx-runtime";
626
- var AssistantAvatarContext = createContext2(/* @__PURE__ */ jsx6(Avatar2, {
627
- fallback: /* @__PURE__ */ jsx6(LightningBoltIcon, {}),
636
+ import { jsx as jsx5 } from "react/jsx-runtime";
637
+ var AssistantAvatarContext = createContext2(/* @__PURE__ */ jsx5(Avatar2, {
638
+ fallback: /* @__PURE__ */ jsx5(LightningBoltIcon, {}),
628
639
  size: "1"
629
640
  }));
630
641
  // src/components/messageGroups/MessageGroupBase/AssistantAvatar.tsx
631
- import { jsx as jsx7 } from "react/jsx-runtime";
642
+ import { jsx as jsx6 } from "react/jsx-runtime";
632
643
  var AssistantAvatar = function() {
633
644
  var AssistantAvatarContextValue = useContext2(AssistantAvatarContext);
634
- return /* @__PURE__ */ jsx7(Flex5, {
645
+ return /* @__PURE__ */ jsx6(Flex4, {
635
646
  flexShrink: "0",
636
647
  height: "24px",
637
648
  width: "24px",
@@ -646,16 +657,16 @@ var AssistantAvatar = function() {
646
657
  import { createContext as createContext3 } from "react";
647
658
  var AssistantNameContext = createContext3("Assistant");
648
659
  // src/components/threads/Thread/Messages/Content/MessageGroup/Content/index.tsx
649
- import { Flex as Flex11 } from "@radix-ui/themes";
660
+ import { Flex as Flex10 } from "@radix-ui/themes";
650
661
  // src/components/threads/Thread/Message/index.tsx
651
662
  import { useMemo as useMemo4 } from "react";
652
- import { Box as Box7 } from "@radix-ui/themes";
663
+ import { Box as Box8 } from "@radix-ui/themes";
653
664
  // src/components/runSteps/RunSteps/index.tsx
654
- import { Flex as Flex10 } from "@radix-ui/themes";
655
- // src/components/runSteps/RunStep/ToolCalls/index.tsx
656
665
  import { Flex as Flex9 } from "@radix-ui/themes";
657
- // src/components/runSteps/RunStep/ToolCalls/ToolCall/index.tsx
666
+ // src/components/runSteps/RunStep/ToolCalls/index.tsx
658
667
  import { Flex as Flex8 } from "@radix-ui/themes";
668
+ // src/components/runSteps/RunStep/ToolCalls/ToolCall/index.tsx
669
+ import { Flex as Flex7 } from "@radix-ui/themes";
659
670
  // src/components/runSteps/RunStep/ToolCalls/ToolCall/Fn/index.tsx
660
671
  import { useContext as useContext3 } from "react";
661
672
  // src/contexts/functions/FunctionComponentsContext/index.tsx
@@ -664,15 +675,15 @@ var FunctionComponentsContext = createContext4({});
664
675
  // src/components/functions/FunctionBase/index.tsx
665
676
  import { PopoverRoot, PopoverContent } from "@radix-ui/themes";
666
677
  // src/components/toolCalls/ToolCallBase/index.tsx
667
- import { Flex as Flex6, Button, PopoverTrigger } from "@radix-ui/themes";
668
- import { jsx as jsx8 } from "react/jsx-runtime";
678
+ import { Flex as Flex5, Button, PopoverTrigger } from "@radix-ui/themes";
679
+ import { jsx as jsx7 } from "react/jsx-runtime";
669
680
  var ToolCallBase = function(param) {
670
681
  var children = param.children;
671
- return /* @__PURE__ */ jsx8(Flex6, {
682
+ return /* @__PURE__ */ jsx7(Flex5, {
672
683
  py: "1",
673
684
  ml: "-2",
674
- children: /* @__PURE__ */ jsx8(PopoverTrigger, {
675
- children: /* @__PURE__ */ jsx8(Button, {
685
+ children: /* @__PURE__ */ jsx7(PopoverTrigger, {
686
+ children: /* @__PURE__ */ jsx7(Button, {
676
687
  size: "1",
677
688
  color: "gold",
678
689
  variant: "outline",
@@ -686,31 +697,31 @@ var ToolCallBase = function(param) {
686
697
  };
687
698
  // src/components/toolCalls/ToolCallBase/ToolCallTitle.tsx
688
699
  import { Text as Text2 } from "@radix-ui/themes";
689
- import { jsx as jsx9 } from "react/jsx-runtime";
700
+ import { jsx as jsx8 } from "react/jsx-runtime";
690
701
  var ToolCallTitle = function(param) {
691
702
  var children = param.children;
692
- return /* @__PURE__ */ jsx9(Text2, {
703
+ return /* @__PURE__ */ jsx8(Text2, {
693
704
  weight: "regular",
694
705
  children: children
695
706
  });
696
707
  };
697
708
  // src/components/functions/FunctionBase/Icon.tsx
698
709
  import { CircleIcon, CircleBackslashIcon, CheckCircledIcon } from "@radix-ui/react-icons";
699
- import { jsx as jsx10 } from "react/jsx-runtime";
710
+ import { jsx as jsx9 } from "react/jsx-runtime";
700
711
  var Icon = function(param) {
701
712
  var runStep = param.runStep;
702
713
  if (runStep.completed_at) {
703
- return /* @__PURE__ */ jsx10(CheckCircledIcon, {});
714
+ return /* @__PURE__ */ jsx9(CheckCircledIcon, {});
704
715
  } else if (runStep.cancelled_at || runStep.failed_at || runStep.status === "expired") {
705
- return /* @__PURE__ */ jsx10(CircleBackslashIcon, {});
716
+ return /* @__PURE__ */ jsx9(CircleBackslashIcon, {});
706
717
  } else {
707
- return /* @__PURE__ */ jsx10(CircleIcon, {});
718
+ return /* @__PURE__ */ jsx9(CircleIcon, {});
708
719
  }
709
720
  };
710
721
  // src/components/functions/FunctionBase/Content.tsx
711
722
  import { useMemo as useMemo3 } from "react";
712
723
  import { Code, Box as Box2 } from "@radix-ui/themes";
713
- import { jsx as jsx11, jsxs as jsxs2 } from "react/jsx-runtime";
724
+ import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
714
725
  var Content = function(param) {
715
726
  var fn = param.fn;
716
727
  var args = useMemo3(function() {
@@ -741,7 +752,7 @@ var Content = function(param) {
741
752
  if (!args) {
742
753
  return null;
743
754
  }
744
- return /* @__PURE__ */ jsxs2(Code, {
755
+ return /* @__PURE__ */ jsxs3(Code, {
745
756
  variant: "ghost",
746
757
  color: "gold",
747
758
  style: {
@@ -749,36 +760,36 @@ var Content = function(param) {
749
760
  wordBreak: "break-word"
750
761
  },
751
762
  children: [
752
- /* @__PURE__ */ jsx11(Box2, {
763
+ /* @__PURE__ */ jsx10(Box2, {
753
764
  children: args && JSON.stringify(args, null, 2)
754
765
  }),
755
- /* @__PURE__ */ jsx11(Box2, {
766
+ /* @__PURE__ */ jsx10(Box2, {
756
767
  children: output && JSON.stringify(output, null, 2)
757
768
  })
758
769
  ]
759
770
  });
760
771
  };
761
772
  // src/components/functions/FunctionBase/index.tsx
762
- import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
773
+ import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
763
774
  var FunctionBase = function(param) {
764
775
  var fn = param.fn, runStep = param.runStep, title2 = param.title;
765
- return /* @__PURE__ */ jsxs3(PopoverRoot, {
776
+ return /* @__PURE__ */ jsxs4(PopoverRoot, {
766
777
  children: [
767
- /* @__PURE__ */ jsxs3(ToolCallBase, {
778
+ /* @__PURE__ */ jsxs4(ToolCallBase, {
768
779
  children: [
769
- /* @__PURE__ */ jsx12(Icon, {
780
+ /* @__PURE__ */ jsx11(Icon, {
770
781
  runStep: runStep
771
782
  }),
772
- /* @__PURE__ */ jsx12(ToolCallTitle, {
783
+ /* @__PURE__ */ jsx11(ToolCallTitle, {
773
784
  children: title2
774
785
  })
775
786
  ]
776
787
  }),
777
- /* @__PURE__ */ jsx12(PopoverContent, {
788
+ /* @__PURE__ */ jsx11(PopoverContent, {
778
789
  style: {
779
790
  maxHeight: "500px"
780
791
  },
781
- children: /* @__PURE__ */ jsx12(Content, {
792
+ children: /* @__PURE__ */ jsx11(Content, {
782
793
  fn: fn
783
794
  })
784
795
  })
@@ -797,10 +808,10 @@ var title = function(param) {
797
808
  }
798
809
  };
799
810
  // src/components/runSteps/RunStep/ToolCalls/ToolCall/Fn/DefaultFunction/index.tsx
800
- import { jsx as jsx13 } from "react/jsx-runtime";
811
+ import { jsx as jsx12 } from "react/jsx-runtime";
801
812
  var DefaultFunction = function(param) {
802
813
  var fn = param.fn, runStep = param.runStep;
803
- return /* @__PURE__ */ jsx13(FunctionBase, {
814
+ return /* @__PURE__ */ jsx12(FunctionBase, {
804
815
  fn: fn,
805
816
  runStep: runStep,
806
817
  title: title({
@@ -810,66 +821,66 @@ var DefaultFunction = function(param) {
810
821
  });
811
822
  };
812
823
  // src/components/runSteps/RunStep/ToolCalls/ToolCall/Fn/index.tsx
813
- import { jsx as jsx14 } from "react/jsx-runtime";
824
+ import { jsx as jsx13 } from "react/jsx-runtime";
814
825
  var Fn = function(param) {
815
826
  var fn = param.fn, runStep = param.runStep;
816
827
  var functionComponentsContext = useContext3(FunctionComponentsContext);
817
828
  var Component = functionComponentsContext[fn.name] || DefaultFunction;
818
829
  return(// @ts-ignore-next-line
819
- /* @__PURE__ */ jsx14(Component, {
830
+ /* @__PURE__ */ jsx13(Component, {
820
831
  fn: fn,
821
832
  runStep: runStep
822
833
  }));
823
834
  };
824
835
  // src/components/runSteps/RunStep/ToolCalls/ToolCall/CodeInterpreter/index.tsx
825
- import { Flex as Flex7 } from "@radix-ui/themes";
826
- import { jsx as jsx15 } from "react/jsx-runtime";
836
+ import { Flex as Flex6 } from "@radix-ui/themes";
837
+ import { jsx as jsx14 } from "react/jsx-runtime";
827
838
  var CodeInterpreter = function(param) {
828
839
  var codeInterpreter = param.codeInterpreter;
829
- return /* @__PURE__ */ jsx15(Flex7, {
840
+ return /* @__PURE__ */ jsx14(Flex6, {
830
841
  children: codeInterpreter.input
831
842
  });
832
843
  };
833
844
  // src/components/runSteps/RunStep/ToolCalls/ToolCall/index.tsx
834
- import { jsx as jsx16 } from "react/jsx-runtime";
845
+ import { jsx as jsx15 } from "react/jsx-runtime";
835
846
  var ToolCall = function(param) {
836
847
  var toolCall = param.toolCall, runStep = param.runStep;
837
848
  if (toolCall.type === "function") {
838
- return /* @__PURE__ */ jsx16(Fn, {
849
+ return /* @__PURE__ */ jsx15(Fn, {
839
850
  fn: toolCall.function,
840
851
  runStep: runStep
841
852
  });
842
853
  }
843
854
  if (toolCall.type === "code_interpreter") {
844
- return /* @__PURE__ */ jsx16(CodeInterpreter, {
855
+ return /* @__PURE__ */ jsx15(CodeInterpreter, {
845
856
  codeInterpreter: toolCall.code_interpreter,
846
857
  runStep: runStep
847
858
  });
848
859
  }
849
- return /* @__PURE__ */ jsx16(Flex8, {
860
+ return /* @__PURE__ */ jsx15(Flex7, {
850
861
  children: toolCall.type
851
862
  });
852
863
  };
853
864
  // src/components/runSteps/RunStep/ToolCalls/Starting/index.tsx
854
865
  import { PopoverRoot as PopoverRoot2, PopoverContent as PopoverContent2, Text as Text3 } from "@radix-ui/themes";
855
866
  import { CircleIcon as CircleIcon2 } from "@radix-ui/react-icons";
856
- import { jsx as jsx17, jsxs as jsxs4 } from "react/jsx-runtime";
867
+ import { jsx as jsx16, jsxs as jsxs5 } from "react/jsx-runtime";
857
868
  var Starting = function() {
858
- return /* @__PURE__ */ jsxs4(PopoverRoot2, {
869
+ return /* @__PURE__ */ jsxs5(PopoverRoot2, {
859
870
  children: [
860
- /* @__PURE__ */ jsxs4(ToolCallBase, {
871
+ /* @__PURE__ */ jsxs5(ToolCallBase, {
861
872
  children: [
862
- /* @__PURE__ */ jsx17(CircleIcon2, {}),
863
- /* @__PURE__ */ jsx17(ToolCallTitle, {
873
+ /* @__PURE__ */ jsx16(CircleIcon2, {}),
874
+ /* @__PURE__ */ jsx16(ToolCallTitle, {
864
875
  children: "Starting actions"
865
876
  })
866
877
  ]
867
878
  }),
868
- /* @__PURE__ */ jsx17(PopoverContent2, {
879
+ /* @__PURE__ */ jsx16(PopoverContent2, {
869
880
  style: {
870
881
  maxHeight: "500px"
871
882
  },
872
- children: /* @__PURE__ */ jsx17(Text3, {
883
+ children: /* @__PURE__ */ jsx16(Text3, {
873
884
  children: "Getting ready to connect to domain API"
874
885
  })
875
886
  })
@@ -877,15 +888,15 @@ var Starting = function() {
877
888
  });
878
889
  };
879
890
  // src/components/runSteps/RunStep/ToolCalls/index.tsx
880
- import { jsx as jsx18, jsxs as jsxs5 } from "react/jsx-runtime";
891
+ import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
881
892
  var ToolCalls = function(param) {
882
893
  var stepDetails = param.stepDetails, runStep = param.runStep;
883
- return /* @__PURE__ */ jsxs5(Flex9, {
894
+ return /* @__PURE__ */ jsxs6(Flex8, {
884
895
  direction: "column",
885
896
  children: [
886
- !stepDetails.tool_calls.length && /* @__PURE__ */ jsx18(Starting, {}),
897
+ !stepDetails.tool_calls.length && /* @__PURE__ */ jsx17(Starting, {}),
887
898
  stepDetails.tool_calls.map(function(toolCall) {
888
- return /* @__PURE__ */ jsx18(ToolCall, {
899
+ return /* @__PURE__ */ jsx17(ToolCall, {
889
900
  toolCall: toolCall,
890
901
  runStep: runStep
891
902
  }, toolCall.id);
@@ -894,11 +905,11 @@ var ToolCalls = function(param) {
894
905
  });
895
906
  };
896
907
  // src/components/runSteps/RunStep/index.tsx
897
- import { jsx as jsx19 } from "react/jsx-runtime";
908
+ import { jsx as jsx18 } from "react/jsx-runtime";
898
909
  var RunStep = function(param) {
899
910
  var runStep = param.runStep;
900
911
  if (runStep.step_details.type === "tool_calls") {
901
- return /* @__PURE__ */ jsx19(ToolCalls, {
912
+ return /* @__PURE__ */ jsx18(ToolCalls, {
902
913
  stepDetails: runStep.step_details,
903
914
  runStep: runStep
904
915
  });
@@ -906,31 +917,39 @@ var RunStep = function(param) {
906
917
  return null;
907
918
  };
908
919
  // src/components/runSteps/RunSteps/index.tsx
909
- import { jsx as jsx20 } from "react/jsx-runtime";
920
+ import { jsx as jsx19 } from "react/jsx-runtime";
910
921
  var RunSteps = function(param) {
911
922
  var runSteps = param.runSteps;
912
- return /* @__PURE__ */ jsx20(Flex10, {
923
+ return /* @__PURE__ */ jsx19(Flex9, {
913
924
  direction: "column-reverse",
914
925
  children: runSteps.map(function(runStep) {
915
- return /* @__PURE__ */ jsx20(RunStep, {
926
+ return /* @__PURE__ */ jsx19(RunStep, {
916
927
  runStep: runStep
917
928
  }, runStep.id);
918
929
  })
919
930
  });
920
931
  };
921
- // src/components/threads/Thread/Message/TextContent/index.tsx
922
- import { useContext as useContext4 } from "react";
932
+ // src/contexts/messages/MessageContext/index.ts
933
+ import { createContext as createContext5 } from "react";
934
+ var MessageContext = createContext5({
935
+ message: null
936
+ });
937
+ // src/components/threads/Thread/Message/Provider.tsx
938
+ var Provider = MessageContext.Provider;
939
+ // src/components/threads/Thread/Message/TextContent.tsx
923
940
  import { useRemarkSync } from "react-remark";
941
+ // src/hooks/markdown/useMarkdownContext/index.ts
942
+ import { useContext as useContext4 } from "react";
924
943
  // src/contexts/markdown/MarkdownContext/index.ts
925
- import { createContext as createContext5 } from "react";
944
+ import { createContext as createContext6 } from "react";
926
945
  // src/contexts/markdown/MarkdownContext/lib/components/Paragraph.tsx
927
946
  import { Box as Box3, Text as Text4 } from "@radix-ui/themes";
928
- import { jsx as jsx21 } from "react/jsx-runtime";
947
+ import { jsx as jsx20 } from "react/jsx-runtime";
929
948
  var Paragraph = function(param) {
930
949
  var children = param.children;
931
- return /* @__PURE__ */ jsx21(Box3, {
950
+ return /* @__PURE__ */ jsx20(Box3, {
932
951
  pb: "3",
933
- children: /* @__PURE__ */ jsx21(Text4, {
952
+ children: /* @__PURE__ */ jsx20(Text4, {
934
953
  size: "3",
935
954
  style: {
936
955
  whiteSpace: "pre-line",
@@ -942,23 +961,23 @@ var Paragraph = function(param) {
942
961
  };
943
962
  // src/contexts/markdown/MarkdownContext/lib/components/Link.tsx
944
963
  import { Link as RadixLink } from "@radix-ui/themes";
945
- import { jsx as jsx22 } from "react/jsx-runtime";
964
+ import { jsx as jsx21 } from "react/jsx-runtime";
946
965
  var Link = function(param) {
947
966
  var children = param.children, href = param.href;
948
- return /* @__PURE__ */ jsx22(RadixLink, {
967
+ return /* @__PURE__ */ jsx21(RadixLink, {
949
968
  href: href,
950
969
  children: children
951
970
  });
952
971
  };
953
972
  // src/contexts/markdown/MarkdownContext/lib/components/UnorderedList.tsx
954
973
  import { Box as Box4 } from "@radix-ui/themes";
955
- import { jsx as jsx23 } from "react/jsx-runtime";
974
+ import { jsx as jsx22 } from "react/jsx-runtime";
956
975
  var UnorderedList = function(param) {
957
976
  var children = param.children;
958
- return /* @__PURE__ */ jsx23(Box4, {
977
+ return /* @__PURE__ */ jsx22(Box4, {
959
978
  pb: "3",
960
979
  asChild: true,
961
- children: /* @__PURE__ */ jsx23("ul", {
980
+ children: /* @__PURE__ */ jsx22("ul", {
962
981
  style: {
963
982
  listStylePosition: "inside"
964
983
  },
@@ -968,13 +987,13 @@ var UnorderedList = function(param) {
968
987
  };
969
988
  // src/contexts/markdown/MarkdownContext/lib/components/OrderedList.tsx
970
989
  import { Box as Box5 } from "@radix-ui/themes";
971
- import { jsx as jsx24 } from "react/jsx-runtime";
990
+ import { jsx as jsx23 } from "react/jsx-runtime";
972
991
  var OrderedList = function(param) {
973
992
  var children = param.children;
974
- return /* @__PURE__ */ jsx24(Box5, {
993
+ return /* @__PURE__ */ jsx23(Box5, {
975
994
  pb: "3",
976
995
  asChild: true,
977
- children: /* @__PURE__ */ jsx24("ol", {
996
+ children: /* @__PURE__ */ jsx23("ol", {
978
997
  style: {
979
998
  listStylePosition: "inside"
980
999
  },
@@ -984,22 +1003,44 @@ var OrderedList = function(param) {
984
1003
  };
985
1004
  // src/contexts/markdown/MarkdownContext/lib/components/ListItem.tsx
986
1005
  import { Box as Box6 } from "@radix-ui/themes";
987
- import { jsx as jsx25 } from "react/jsx-runtime";
1006
+ import { jsx as jsx24 } from "react/jsx-runtime";
988
1007
  var ListItem = function(param) {
989
1008
  var children = param.children;
990
- return /* @__PURE__ */ jsx25(Box6, {
1009
+ return /* @__PURE__ */ jsx24(Box6, {
991
1010
  pb: "1",
992
- children: /* @__PURE__ */ jsx25("li", {
1011
+ children: /* @__PURE__ */ jsx24("li", {
993
1012
  children: children
994
1013
  })
995
1014
  });
996
1015
  };
997
1016
  // src/contexts/markdown/MarkdownContext/lib/components/Strong.tsx
998
1017
  import { Strong as RadixStrong } from "@radix-ui/themes";
999
- import { jsx as jsx26 } from "react/jsx-runtime";
1018
+ import { jsx as jsx25 } from "react/jsx-runtime";
1000
1019
  var Strong = function(param) {
1001
1020
  var children = param.children;
1002
- return /* @__PURE__ */ jsx26(RadixStrong, {
1021
+ return /* @__PURE__ */ jsx25(RadixStrong, {
1022
+ children: children
1023
+ });
1024
+ };
1025
+ // src/contexts/markdown/MarkdownContext/lib/components/Pre.tsx
1026
+ import { Box as Box7 } from "@radix-ui/themes";
1027
+ import { jsx as jsx26 } from "react/jsx-runtime";
1028
+ var Pre = function(param) {
1029
+ var children = param.children;
1030
+ return /* @__PURE__ */ jsx26(Box7, {
1031
+ style: {
1032
+ whiteSpace: "pre-wrap",
1033
+ wordBreak: "break-word"
1034
+ },
1035
+ children: children
1036
+ });
1037
+ };
1038
+ // src/contexts/markdown/MarkdownContext/lib/components/Code.tsx
1039
+ import { Code as RadixCode } from "@radix-ui/themes";
1040
+ import { jsx as jsx27 } from "react/jsx-runtime";
1041
+ var Code2 = function(param) {
1042
+ var children = param.children;
1043
+ return /* @__PURE__ */ jsx27(RadixCode, {
1003
1044
  children: children
1004
1045
  });
1005
1046
  };
@@ -1010,23 +1051,29 @@ var components = {
1010
1051
  strong: Strong,
1011
1052
  ul: UnorderedList,
1012
1053
  ol: OrderedList,
1013
- li: ListItem
1054
+ li: ListItem,
1055
+ pre: Pre,
1056
+ code: Code2
1014
1057
  };
1015
1058
  // src/contexts/markdown/MarkdownContext/index.ts
1016
- var MarkdownContext = createContext5({
1059
+ var MarkdownContext = createContext6({
1017
1060
  remarkPlugins: [],
1018
1061
  rehypeReactOptions: {
1019
1062
  components: components
1020
1063
  }
1021
1064
  });
1022
- // src/components/threads/Thread/Message/TextContent/index.tsx
1065
+ // src/hooks/markdown/useMarkdownContext/index.ts
1066
+ var useMarkdownContext = function() {
1067
+ return useContext4(MarkdownContext);
1068
+ };
1069
+ // src/components/threads/Thread/Message/TextContent.tsx
1023
1070
  var TextContent = function(param) {
1024
1071
  var content = param.content;
1025
- var markdownContext = useContext4(MarkdownContext);
1072
+ var markdownContext = useMarkdownContext();
1026
1073
  return useRemarkSync(content.text.value, markdownContext);
1027
1074
  };
1028
1075
  // src/components/threads/Thread/Message/index.tsx
1029
- import { jsx as jsx27, jsxs as jsxs6 } from "react/jsx-runtime";
1076
+ import { jsx as jsx28, jsxs as jsxs7 } from "react/jsx-runtime";
1030
1077
  var Message = function(param) {
1031
1078
  var message = param.message;
1032
1079
  var _useMemo4 = _sliced_to_array(useMemo4(function() {
@@ -1061,55 +1108,60 @@ var Message = function(param) {
1061
1108
  }, [
1062
1109
  message
1063
1110
  ]), 2), olderRunSteps = _useMemo4[0], laterRunSteps = _useMemo4[1];
1064
- return /* @__PURE__ */ jsxs6(Box7, {
1065
- children: [
1066
- /* @__PURE__ */ jsx27(RunSteps, {
1067
- runSteps: olderRunSteps
1068
- }),
1069
- message.content.map(function(content, index) {
1070
- return /* @__PURE__ */ jsx27(Box7, {
1071
- children: content.type === "text" && /* @__PURE__ */ jsx27(TextContent, {
1072
- content: content
1073
- })
1074
- }, index);
1075
- }),
1076
- /* @__PURE__ */ jsx27(RunSteps, {
1077
- runSteps: laterRunSteps
1078
- })
1079
- ]
1111
+ return /* @__PURE__ */ jsx28(Provider, {
1112
+ value: {
1113
+ message: message
1114
+ },
1115
+ children: /* @__PURE__ */ jsxs7(Box8, {
1116
+ children: [
1117
+ /* @__PURE__ */ jsx28(RunSteps, {
1118
+ runSteps: olderRunSteps
1119
+ }),
1120
+ message.content.map(function(content, index) {
1121
+ return /* @__PURE__ */ jsx28(Box8, {
1122
+ children: content.type === "text" && /* @__PURE__ */ jsx28(TextContent, {
1123
+ content: content
1124
+ })
1125
+ }, index);
1126
+ }),
1127
+ /* @__PURE__ */ jsx28(RunSteps, {
1128
+ runSteps: laterRunSteps
1129
+ })
1130
+ ]
1131
+ })
1080
1132
  });
1081
1133
  };
1082
1134
  // src/components/threads/Thread/Messages/Content/MessageGroup/Content/index.tsx
1083
- import { jsx as jsx28 } from "react/jsx-runtime";
1135
+ import { jsx as jsx29 } from "react/jsx-runtime";
1084
1136
  var Content2 = function(param) {
1085
1137
  var messageGroup = param.messageGroup;
1086
- return /* @__PURE__ */ jsx28(Flex11, {
1138
+ return /* @__PURE__ */ jsx29(Flex10, {
1087
1139
  direction: "column-reverse",
1088
1140
  children: messageGroup.messages.map(function(message) {
1089
- return /* @__PURE__ */ jsx28(Message, {
1141
+ return /* @__PURE__ */ jsx29(Message, {
1090
1142
  message: message
1091
1143
  }, message.id);
1092
1144
  })
1093
1145
  });
1094
1146
  };
1095
1147
  // src/components/threads/Thread/Messages/Content/MessageGroup/index.tsx
1096
- import { jsx as jsx29, jsxs as jsxs7 } from "react/jsx-runtime";
1148
+ import { jsx as jsx30, jsxs as jsxs8 } from "react/jsx-runtime";
1097
1149
  var MessageGroup = function(param) {
1098
1150
  var messageGroup = param.messageGroup;
1099
1151
  var assistantNameContext = useContext5(AssistantNameContext);
1100
- return /* @__PURE__ */ jsxs7(MessageGroupBase, {
1152
+ return /* @__PURE__ */ jsxs8(MessageGroupBase, {
1101
1153
  children: [
1102
- messageGroup.role === "user" ? /* @__PURE__ */ jsx29(Avatar3, {
1103
- fallback: /* @__PURE__ */ jsx29(PersonIcon, {}),
1154
+ messageGroup.role === "user" ? /* @__PURE__ */ jsx30(Avatar3, {
1155
+ fallback: /* @__PURE__ */ jsx30(PersonIcon, {}),
1104
1156
  size: "1"
1105
- }) : /* @__PURE__ */ jsx29(AssistantAvatar, {}),
1106
- /* @__PURE__ */ jsxs7(Box8, {
1157
+ }) : /* @__PURE__ */ jsx30(AssistantAvatar, {}),
1158
+ /* @__PURE__ */ jsxs8(Box9, {
1107
1159
  flexGrow: "1",
1108
1160
  children: [
1109
- /* @__PURE__ */ jsx29(Name, {
1161
+ /* @__PURE__ */ jsx30(Name, {
1110
1162
  children: messageGroup.role === "user" ? "You" : assistantNameContext
1111
1163
  }),
1112
- /* @__PURE__ */ jsx29(Content2, {
1164
+ /* @__PURE__ */ jsx30(Content2, {
1113
1165
  messageGroup: messageGroup
1114
1166
  })
1115
1167
  ]
@@ -1118,18 +1170,25 @@ var MessageGroup = function(param) {
1118
1170
  });
1119
1171
  };
1120
1172
  // src/components/threads/Thread/Messages/Content/index.tsx
1121
- import { Fragment, jsx as jsx30 } from "react/jsx-runtime";
1173
+ import { Fragment, jsx as jsx31 } from "react/jsx-runtime";
1122
1174
  var Content3 = function() {
1123
1175
  var _useMessages = useMessages(), messages2 = _useMessages.messages, isLoading = _useMessages.isLoading, isLoadingError = _useMessages.isLoadingError;
1124
1176
  var _useMessageGroups = useMessageGroups({
1125
1177
  messages: messages2
1126
1178
  }), messageGroups2 = _useMessageGroups.messageGroups;
1179
+ useEffect(function() {
1180
+ if (isLoadingError) {
1181
+ toast2.error("Could not load messages. Please try again.");
1182
+ }
1183
+ }, [
1184
+ isLoadingError
1185
+ ]);
1127
1186
  if (isLoading || isLoadingError) {
1128
- return /* @__PURE__ */ jsx30(MessagesSkeleton, {});
1187
+ return /* @__PURE__ */ jsx31(MessagesSkeleton, {});
1129
1188
  }
1130
- return /* @__PURE__ */ jsx30(Fragment, {
1189
+ return /* @__PURE__ */ jsx31(Fragment, {
1131
1190
  children: messageGroups2.map(function(messageGroup) {
1132
- return /* @__PURE__ */ jsx30(MessageGroup, {
1191
+ return /* @__PURE__ */ jsx31(MessageGroup, {
1133
1192
  messageGroup: messageGroup
1134
1193
  }, messageGroup.id);
1135
1194
  })
@@ -1138,38 +1197,37 @@ var Content3 = function() {
1138
1197
  // src/components/threads/Thread/Messages/Progress/index.tsx
1139
1198
  import { Box as Box11 } from "@radix-ui/themes";
1140
1199
  // src/components/skeletons/StartingContentSkeleton/index.tsx
1141
- import { Box as Box9 } from "@radix-ui/themes";
1142
- import { jsx as jsx31 } from "react/jsx-runtime";
1200
+ import { Skeleton as Skeleton2 } from "@radix-ui/themes";
1201
+ import { jsx as jsx32 } from "react/jsx-runtime";
1143
1202
  var StartingContentSkeleton = function() {
1144
- return /* @__PURE__ */ jsx31(Box9, {
1145
- flexShrink: "0",
1203
+ return /* @__PURE__ */ jsx32(Skeleton2, {
1204
+ loading: true,
1146
1205
  mt: "1",
1147
1206
  height: "var(--space-4)",
1148
1207
  width: "var(--space-4)",
1149
1208
  style: {
1150
- animation: "pulse 2s cubic-bezier(.4,0,.6,1) infinite",
1151
- borderRadius: "var(--radius-3)",
1152
- backgroundColor: "var(--gray-12)"
1209
+ borderRadius: "var(--radius-6)",
1210
+ flexShrink: 0
1153
1211
  }
1154
1212
  });
1155
1213
  };
1156
1214
  // src/components/skeletons/StartingSkeleton/index.tsx
1157
1215
  import { useContext as useContext6 } from "react";
1158
1216
  import { Box as Box10 } from "@radix-ui/themes";
1159
- import { jsx as jsx32, jsxs as jsxs8 } from "react/jsx-runtime";
1217
+ import { jsx as jsx33, jsxs as jsxs9 } from "react/jsx-runtime";
1160
1218
  var StartingSkeleton = function(param) {
1161
1219
  var children = param.children;
1162
1220
  var assistantNameContext = useContext6(AssistantNameContext);
1163
- return /* @__PURE__ */ jsxs8(MessageGroupBase, {
1221
+ return /* @__PURE__ */ jsxs9(MessageGroupBase, {
1164
1222
  children: [
1165
- /* @__PURE__ */ jsx32(AssistantAvatar, {}),
1166
- /* @__PURE__ */ jsxs8(Box10, {
1223
+ /* @__PURE__ */ jsx33(AssistantAvatar, {}),
1224
+ /* @__PURE__ */ jsxs9(Box10, {
1167
1225
  children: [
1168
- /* @__PURE__ */ jsx32(Name, {
1226
+ /* @__PURE__ */ jsx33(Name, {
1169
1227
  children: assistantNameContext
1170
1228
  }),
1171
1229
  children,
1172
- /* @__PURE__ */ jsx32(StartingContentSkeleton, {})
1230
+ /* @__PURE__ */ jsx33(StartingContentSkeleton, {})
1173
1231
  ]
1174
1232
  })
1175
1233
  ]
@@ -1195,6 +1253,19 @@ import { useMemo as useMemo7 } from "react";
1195
1253
  // src/hooks/runs/useRuns/index.tsx
1196
1254
  import { useMemo as useMemo6 } from "react";
1197
1255
  import { useInfiniteQuery as useInfiniteQuery2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
1256
+ // src/lib/runs/runsQueryOptions.ts
1257
+ var runsQueryOptions = function(param) {
1258
+ var queryClient = param.queryClient, threadContext = param.threadContext, superinterfaceContext = param.superinterfaceContext;
1259
+ return queryOptions({
1260
+ queryKeyBase: [
1261
+ "runs"
1262
+ ],
1263
+ path: "/runs",
1264
+ queryClient: queryClient,
1265
+ threadContext: threadContext,
1266
+ superinterfaceContext: superinterfaceContext
1267
+ });
1268
+ };
1198
1269
  // src/hooks/runs/useRuns/lib/getRuns.ts
1199
1270
  var getRuns = function(param) {
1200
1271
  var data3 = param.data;
@@ -1208,11 +1279,7 @@ var useRuns = function() {
1208
1279
  var queryClient = useQueryClient3();
1209
1280
  var superinterfaceContext = useSuperinterfaceContext();
1210
1281
  var threadContext = useSuperinterfaceContext();
1211
- var props = useInfiniteQuery2(queryOptions({
1212
- queryKeyBase: [
1213
- "runs"
1214
- ],
1215
- path: "/runs",
1282
+ var props = useInfiniteQuery2(runsQueryOptions({
1216
1283
  queryClient: queryClient,
1217
1284
  threadContext: threadContext,
1218
1285
  superinterfaceContext: superinterfaceContext
@@ -1252,6 +1319,18 @@ var isRunEditingMessage = function(param) {
1252
1319
  });
1253
1320
  return !hasContent;
1254
1321
  };
1322
+ // src/hooks/runs/usePollingContext/index.ts
1323
+ import { useContext as useContext7 } from "react";
1324
+ // src/contexts/runs/PollingContext/index.tsx
1325
+ import { createContext as createContext7 } from "react";
1326
+ var PollingContext = createContext7({
1327
+ isPollRefetching: false,
1328
+ setIsPollRefetching: function() {}
1329
+ });
1330
+ // src/hooks/runs/usePollingContext/index.ts
1331
+ var usePollingContext = function() {
1332
+ return useContext7(PollingContext);
1333
+ };
1255
1334
  // src/hooks/runs/useIsRunActive/index.tsx
1256
1335
  var progressStatuses = [
1257
1336
  "queued",
@@ -1265,8 +1344,9 @@ var stoppedStatuses = [
1265
1344
  "failed"
1266
1345
  ];
1267
1346
  var isRunActive = function(param) {
1268
- var latestRunProps = param.latestRunProps, latestMessageProps = param.latestMessageProps, isMutating = param.isMutating;
1347
+ var pollingContext = param.pollingContext, latestRunProps = param.latestRunProps, latestMessageProps = param.latestMessageProps, isMutating = param.isMutating;
1269
1348
  var _latestMessageProps_latestMessage_metadata, _latestMessageProps_latestMessage;
1349
+ if (pollingContext.isPollRefetching) return true;
1270
1350
  if ((_latestMessageProps_latestMessage = latestMessageProps.latestMessage) === null || _latestMessageProps_latestMessage === void 0 ? void 0 : (_latestMessageProps_latestMessage_metadata = _latestMessageProps_latestMessage.metadata) === null || _latestMessageProps_latestMessage_metadata === void 0 ? void 0 : _latestMessageProps_latestMessage_metadata.isBlocking) return false;
1271
1351
  if (isMutating) return true;
1272
1352
  if (!latestRunProps.latestRun) return false;
@@ -1280,6 +1360,7 @@ var useIsRunActive = function() {
1280
1360
  var latestRunProps = useLatestRun();
1281
1361
  var latestMessageProps = useLatestMessage();
1282
1362
  var threadContext = useSuperinterfaceContext();
1363
+ var pollingContext = usePollingContext();
1283
1364
  var isMutatingCreateRun = useIsMutating({
1284
1365
  mutationKey: [
1285
1366
  "createRun",
@@ -1301,6 +1382,7 @@ var useIsRunActive = function() {
1301
1382
  return useMemo8(function() {
1302
1383
  return _object_spread_props(_object_spread({}, latestRunProps), {
1303
1384
  isRunActive: isRunActive({
1385
+ pollingContext: pollingContext,
1304
1386
  latestRunProps: latestRunProps,
1305
1387
  latestMessageProps: latestMessageProps,
1306
1388
  isMutating: isMutatingCreateRun > 0 || isMutatingCreateMessage > 0 || isMutatingCreateHandleAction > 0
@@ -1309,38 +1391,39 @@ var useIsRunActive = function() {
1309
1391
  }, [
1310
1392
  latestRunProps,
1311
1393
  latestMessageProps,
1394
+ pollingContext,
1312
1395
  isMutatingCreateRun,
1313
1396
  isMutatingCreateMessage,
1314
1397
  isMutatingCreateHandleAction
1315
1398
  ]);
1316
1399
  };
1317
1400
  // src/components/threads/Thread/Messages/Progress/index.tsx
1318
- import { jsx as jsx33, jsxs as jsxs9 } from "react/jsx-runtime";
1401
+ import { jsx as jsx34, jsxs as jsxs10 } from "react/jsx-runtime";
1319
1402
  var Progress = function() {
1320
1403
  var _useIsRunActive = useIsRunActive(), isRunActive2 = _useIsRunActive.isRunActive;
1321
1404
  var latestMessage = useLatestMessage().latestMessage;
1322
1405
  if (!latestMessage) return null;
1323
1406
  if (!isRunActive2) return null;
1324
1407
  if (latestMessage.role === "user") {
1325
- return /* @__PURE__ */ jsx33(StartingSkeleton, {});
1408
+ return /* @__PURE__ */ jsx34(StartingSkeleton, {});
1326
1409
  }
1327
- return /* @__PURE__ */ jsxs9(MessageGroupBase, {
1410
+ return /* @__PURE__ */ jsxs10(MessageGroupBase, {
1328
1411
  children: [
1329
- /* @__PURE__ */ jsx33(Box11, {
1412
+ /* @__PURE__ */ jsx34(Box11, {
1330
1413
  pl: "5"
1331
1414
  }),
1332
- /* @__PURE__ */ jsx33(StartingContentSkeleton, {})
1415
+ /* @__PURE__ */ jsx34(StartingContentSkeleton, {})
1333
1416
  ]
1334
1417
  });
1335
1418
  };
1336
1419
  // src/components/threads/Thread/Messages/Root/index.tsx
1337
- import { Flex as Flex12 } from "@radix-ui/themes";
1420
+ import { Flex as Flex11 } from "@radix-ui/themes";
1338
1421
  // src/hooks/misc/useInfiniteScroll/index.tsx
1339
1422
  import { useRef as useRef2 } from "react";
1340
1423
  import { useInView } from "react-intersection-observer";
1341
1424
  // src/hooks/misc/useThrottledEffect/index.tsx
1342
1425
  import _5 from "lodash";
1343
- import { useRef, useEffect, useCallback } from "react";
1426
+ import { useRef, useEffect as useEffect2, useCallback } from "react";
1344
1427
  var useThrottledEffect = function(cb, delay, additionalDeps) {
1345
1428
  var _cbRef;
1346
1429
  var cbRef = useRef(cb);
@@ -1355,10 +1438,10 @@ var useThrottledEffect = function(cb, delay, additionalDeps) {
1355
1438
  }), [
1356
1439
  delay
1357
1440
  ]);
1358
- useEffect(function() {
1441
+ useEffect2(function() {
1359
1442
  cbRef.current = cb;
1360
1443
  });
1361
- useEffect(throttledCb, [
1444
+ useEffect2(throttledCb, [
1362
1445
  throttledCb
1363
1446
  ].concat(_to_consumable_array(additionalDeps)));
1364
1447
  };
@@ -1390,8 +1473,9 @@ var useInfiniteScroll = function(param) {
1390
1473
  };
1391
1474
  };
1392
1475
  // src/hooks/runs/useManageRuns/index.tsx
1476
+ import { toast as toast3 } from "sonner";
1393
1477
  import { useQueryClient as useQueryClient5 } from "@tanstack/react-query";
1394
- import { useEffect as useEffect2 } from "react";
1478
+ import { useEffect as useEffect3, useState } from "react";
1395
1479
  // src/hooks/runs/useCreateRun/index.ts
1396
1480
  import { partob } from "radash";
1397
1481
  import { useMutation, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
@@ -1401,7 +1485,7 @@ var mutationOptions = function(param) {
1401
1485
  var mutationKey = _to_consumable_array(mutationKeyBase).concat([
1402
1486
  threadContext.variables
1403
1487
  ]);
1404
- return _object_spread(_object_spread_props(_object_spread({
1488
+ return _object_spread_props(_object_spread({
1405
1489
  mutationFn: function(variables) {
1406
1490
  return fetch("".concat(superinterfaceContext.baseUrl).concat(path), _object_spread({
1407
1491
  method: "POST",
@@ -1419,7 +1503,7 @@ var mutationOptions = function(param) {
1419
1503
  case 0:
1420
1504
  if (!(response.status !== 200)) return [
1421
1505
  3,
1422
- 4
1506
+ 5
1423
1507
  ];
1424
1508
  _state.label = 1;
1425
1509
  case 1:
@@ -1429,17 +1513,23 @@ var mutationOptions = function(param) {
1429
1513
  ,
1430
1514
  4
1431
1515
  ]);
1516
+ console.log("response", response);
1432
1517
  return [
1433
1518
  4,
1434
1519
  response.json()
1435
1520
  ];
1436
1521
  case 2:
1437
1522
  errorResponse = _state.sent();
1438
- throw new Error(errorResponse.error);
1523
+ return [
1524
+ 3,
1525
+ 4
1526
+ ];
1439
1527
  case 3:
1440
1528
  error = _state.sent();
1441
1529
  throw new Error("Failed to fetch");
1442
1530
  case 4:
1531
+ throw new Error(errorResponse.error);
1532
+ case 5:
1443
1533
  return [
1444
1534
  2,
1445
1535
  response.json()
@@ -1452,9 +1542,9 @@ var mutationOptions = function(param) {
1452
1542
  };
1453
1543
  }());
1454
1544
  }
1455
- }, queryClient.getMutationDefaults(mutationKey)), {
1545
+ }, threadContext.defaultOptions.mutations, queryClient.getMutationDefaults(mutationKey)), {
1456
1546
  mutationKey: mutationKey
1457
- }), threadContext.defaultOptions.mutations);
1547
+ });
1458
1548
  };
1459
1549
  // src/hooks/runs/useCreateRun/lib/onSuccess.ts
1460
1550
  var onSuccess = function(param) {
@@ -1673,7 +1763,22 @@ var useManageRuns = function() {
1673
1763
  var latestMessageProps = useLatestMessage();
1674
1764
  var createRunProps = useCreateRun();
1675
1765
  var threadContext = useSuperinterfaceContext();
1676
- useEffect2(function() {
1766
+ var _useState = _sliced_to_array(useState([]), 2), toastedErrorRunIds = _useState[0], setToastedErrorRunIds = _useState[1];
1767
+ useEffect3(function() {
1768
+ var _latestRunProps_latestRun;
1769
+ if (((_latestRunProps_latestRun = latestRunProps.latestRun) === null || _latestRunProps_latestRun === void 0 ? void 0 : _latestRunProps_latestRun.status) !== "failed") return;
1770
+ if (toastedErrorRunIds.includes(latestRunProps.latestRun.id)) return;
1771
+ setToastedErrorRunIds(function(prev) {
1772
+ return _to_consumable_array(prev).concat([
1773
+ latestRunProps.latestRun.id
1774
+ ]);
1775
+ });
1776
+ toast3.error("AI run failed. Please try again.");
1777
+ }, [
1778
+ latestRunProps,
1779
+ toastedErrorRunIds
1780
+ ]);
1781
+ useEffect3(function() {
1677
1782
  if (createRunProps.isPending) return;
1678
1783
  if (latestRunProps.isFetching) return;
1679
1784
  if (latestMessageProps.isFetching) return;
@@ -1749,19 +1854,35 @@ var refetch = function() {
1749
1854
  var usePolling = function() {
1750
1855
  var threadContext = useSuperinterfaceContext();
1751
1856
  var queryClient = useQueryClient6();
1857
+ var setIsPollRefetching = usePollingContext().setIsPollRefetching;
1752
1858
  var isRunActiveProps = useIsRunActive();
1753
- useInterval(function() {
1754
- refetch({
1755
- queryClient: queryClient,
1756
- threadContext: threadContext
1859
+ useInterval(/*#__PURE__*/ _async_to_generator(function() {
1860
+ return _ts_generator(this, function(_state) {
1861
+ switch(_state.label){
1862
+ case 0:
1863
+ setIsPollRefetching(true);
1864
+ return [
1865
+ 4,
1866
+ refetch({
1867
+ queryClient: queryClient,
1868
+ threadContext: threadContext
1869
+ })
1870
+ ];
1871
+ case 1:
1872
+ _state.sent();
1873
+ setIsPollRefetching(false);
1874
+ console.log("Polling...");
1875
+ return [
1876
+ 2
1877
+ ];
1878
+ }
1757
1879
  });
1758
- console.log("poll refetched");
1759
- }, isRunActiveProps.isRunActive ? 3e3 : null);
1880
+ }), isRunActiveProps.isRunActive ? 3e3 : null);
1760
1881
  return null;
1761
1882
  };
1762
1883
  // src/hooks/actions/useManageActions/index.tsx
1763
1884
  import { useQueryClient as useQueryClient8 } from "@tanstack/react-query";
1764
- import { useEffect as useEffect3 } from "react";
1885
+ import { useEffect as useEffect4 } from "react";
1765
1886
  // src/hooks/actions/useHandleAction/index.tsx
1766
1887
  import { partob as partob2 } from "radash";
1767
1888
  import { useMutation as useMutation2, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
@@ -1834,7 +1955,7 @@ var useManageActions = function() {
1834
1955
  var threadContext = useSuperinterfaceContext();
1835
1956
  var latestRunProps = useLatestRun();
1836
1957
  var handleActionProps = useHandleAction();
1837
- useEffect3(function() {
1958
+ useEffect4(function() {
1838
1959
  if (handleActionProps.isPending) return;
1839
1960
  if (latestRunProps.isFetching) return;
1840
1961
  if (!latestRunProps.latestRun) return;
@@ -1866,7 +1987,7 @@ var useLifecycle = function() {
1866
1987
  return null;
1867
1988
  };
1868
1989
  // src/components/threads/Thread/Messages/Root/index.tsx
1869
- import { jsx as jsx34, jsxs as jsxs10 } from "react/jsx-runtime";
1990
+ import { jsx as jsx35, jsxs as jsxs11 } from "react/jsx-runtime";
1870
1991
  var Root = function(param) {
1871
1992
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
1872
1993
  var _useMessages = useMessages(), isFetchingNextPage = _useMessages.isFetchingNextPage, hasNextPage = _useMessages.hasNextPage, fetchNextPage = _useMessages.fetchNextPage;
@@ -1876,7 +1997,7 @@ var Root = function(param) {
1876
1997
  hasNextPage: hasNextPage,
1877
1998
  fetchNextPage: fetchNextPage
1878
1999
  }), containerRef = _useInfiniteScroll.containerRef, loaderRef = _useInfiniteScroll.loaderRef;
1879
- return /* @__PURE__ */ jsxs10(Flex12, {
2000
+ return /* @__PURE__ */ jsxs11(Flex11, {
1880
2001
  ref: containerRef,
1881
2002
  direction: "column-reverse",
1882
2003
  flexGrow: "1",
@@ -1885,10 +2006,10 @@ var Root = function(param) {
1885
2006
  }),
1886
2007
  children: [
1887
2008
  children,
1888
- hasNextPage && /* @__PURE__ */ jsx34(Flex12, {
2009
+ hasNextPage && /* @__PURE__ */ jsx35(Flex11, {
1889
2010
  ref: loaderRef
1890
2011
  }),
1891
- /* @__PURE__ */ jsx34(Flex12, {
2012
+ /* @__PURE__ */ jsx35(Flex11, {
1892
2013
  flexShrink: "0",
1893
2014
  flexGrow: "1"
1894
2015
  })
@@ -1896,30 +2017,30 @@ var Root = function(param) {
1896
2017
  });
1897
2018
  };
1898
2019
  // src/components/threads/Thread/Messages/NextPageSkeleton.tsx
1899
- import { jsx as jsx35 } from "react/jsx-runtime";
2020
+ import { jsx as jsx36 } from "react/jsx-runtime";
1900
2021
  var NextPageSkeleton = function() {
1901
2022
  var hasNextPage = useMessages().hasNextPage;
1902
2023
  if (!hasNextPage) {
1903
2024
  return null;
1904
2025
  }
1905
- return /* @__PURE__ */ jsx35(MessagesSkeleton, {});
2026
+ return /* @__PURE__ */ jsx36(MessagesSkeleton, {});
1906
2027
  };
1907
2028
  // src/components/threads/Thread/Messages/index.tsx
1908
- import { jsx as jsx36, jsxs as jsxs11 } from "react/jsx-runtime";
2029
+ import { jsx as jsx37, jsxs as jsxs12 } from "react/jsx-runtime";
1909
2030
  var Messages = function(param) {
1910
2031
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
1911
- return /* @__PURE__ */ jsxs11(Root, {
2032
+ return /* @__PURE__ */ jsxs12(Root, {
1912
2033
  style: style,
1913
2034
  children: [
1914
- /* @__PURE__ */ jsx36(Flex13, {
2035
+ /* @__PURE__ */ jsx37(Flex12, {
1915
2036
  flexShrink: "0",
1916
2037
  height: "var(--space-3)"
1917
2038
  }),
1918
- /* @__PURE__ */ jsx36(Progress, {}),
2039
+ /* @__PURE__ */ jsx37(Progress, {}),
1919
2040
  children,
1920
- /* @__PURE__ */ jsx36(Content3, {}),
1921
- /* @__PURE__ */ jsx36(NextPageSkeleton, {}),
1922
- /* @__PURE__ */ jsx36(Flex13, {
2041
+ /* @__PURE__ */ jsx37(Content3, {}),
2042
+ /* @__PURE__ */ jsx37(NextPageSkeleton, {}),
2043
+ /* @__PURE__ */ jsx37(Flex12, {
1923
2044
  flexShrink: "0",
1924
2045
  flexGrow: "1"
1925
2046
  })
@@ -1930,45 +2051,21 @@ Messages.Root = Root;
1930
2051
  Messages.Message = Message;
1931
2052
  Messages.NextPageSkeleton = NextPageSkeleton;
1932
2053
  // src/components/threads/Thread/MessageForm/index.tsx
1933
- import { Flex as Flex15, Text as Text5 } from "@radix-ui/themes";
2054
+ import { Flex as Flex14, Text as Text5 } from "@radix-ui/themes";
1934
2055
  // src/components/threads/Thread/MessageForm/Submit/index.tsx
1935
2056
  import { ArrowUpIcon } from "@radix-ui/react-icons";
1936
- import { Button as Button2 } from "@radix-ui/themes";
1937
- // src/components/spinners/Spinner/index.tsx
1938
- import { jsx as jsx37 } from "react/jsx-runtime";
1939
- var Spinner = function(props) {
1940
- return /* @__PURE__ */ jsx37("svg", _object_spread_props(_object_spread({
1941
- xmlns: "http://www.w3.org/2000/svg",
1942
- width: "24",
1943
- height: "24",
1944
- viewBox: "0 0 24 24",
1945
- fill: "none",
1946
- stroke: "currentColor",
1947
- strokeWidth: "2",
1948
- strokeLinecap: "round",
1949
- strokeLinejoin: "round",
1950
- style: {
1951
- height: "var(--space-4)",
1952
- width: "var(--space-4)",
1953
- animation: "spin 1s linear infinite"
1954
- }
1955
- }, props), {
1956
- children: /* @__PURE__ */ jsx37("path", {
1957
- d: "M21 12a9 9 0 1 1-6.219-8.56"
1958
- })
1959
- }));
1960
- };
2057
+ import { Button as Button2, Spinner } from "@radix-ui/themes";
1961
2058
  // src/hooks/messages/useMessageFormContext/index.ts
1962
- import { useContext as useContext7 } from "react";
2059
+ import { useContext as useContext8 } from "react";
1963
2060
  // src/contexts/messages/MessageFormContext/index.ts
1964
- import { createContext as createContext6 } from "react";
1965
- var MessageFormContext = createContext6({
2061
+ import { createContext as createContext8 } from "react";
2062
+ var MessageFormContext = createContext8({
1966
2063
  isDisabled: false,
1967
2064
  isLoading: false
1968
2065
  });
1969
2066
  // src/hooks/messages/useMessageFormContext/index.ts
1970
2067
  var useMessageFormContext = function() {
1971
- return useContext7(MessageFormContext);
2068
+ return useContext8(MessageFormContext);
1972
2069
  };
1973
2070
  // src/components/threads/Thread/MessageForm/Submit/index.tsx
1974
2071
  import { jsx as jsx38 } from "react/jsx-runtime";
@@ -1977,8 +2074,11 @@ var Submit = function() {
1977
2074
  return /* @__PURE__ */ jsx38(Button2, {
1978
2075
  type: "submit",
1979
2076
  radius: "large",
1980
- disabled: isDisabled,
1981
- children: isLoading ? /* @__PURE__ */ jsx38(Spinner, {}) : /* @__PURE__ */ jsx38(ArrowUpIcon, {})
2077
+ disabled: isDisabled || isLoading,
2078
+ children: /* @__PURE__ */ jsx38(Spinner, {
2079
+ loading: isLoading,
2080
+ children: /* @__PURE__ */ jsx38(ArrowUpIcon, {})
2081
+ })
1982
2082
  });
1983
2083
  };
1984
2084
  // src/components/threads/Thread/MessageForm/Root/index.tsx
@@ -2224,32 +2324,42 @@ var Root2 = function(param) {
2224
2324
  };
2225
2325
  // src/components/threads/Thread/MessageForm/Field/index.tsx
2226
2326
  import { usePrevious } from "react-use";
2227
- import { useContext as useContext8, useMemo as useMemo10, useRef as useRef3, useEffect as useEffect4 } from "react";
2327
+ import { useContext as useContext9, useMemo as useMemo10, useRef as useRef3, useEffect as useEffect5 } from "react";
2228
2328
  // src/components/textareas/TextareaBase/index.tsx
2229
2329
  import { forwardRef as forwardRef3 } from "react";
2230
2330
  import TextareaAutosize from "react-textarea-autosize";
2231
- import { jsx as jsx40 } from "react/jsx-runtime";
2331
+ import { Fragment as Fragment2, jsx as jsx40, jsxs as jsxs13 } from "react/jsx-runtime";
2232
2332
  var UPSCALE_RATIO = 16 / 14;
2233
2333
  var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
2234
- return /* @__PURE__ */ jsx40(TextareaAutosize, _object_spread({
2235
- ref: ref,
2236
- className: "textarea-base",
2237
- style: {
2238
- resize: "none",
2239
- fontSize: "".concat(14 * UPSCALE_RATIO, "px"),
2240
- lineHeight: "".concat(24 * UPSCALE_RATIO, "px"),
2241
- transform: "scale(".concat(1 / UPSCALE_RATIO, ")"),
2242
- margin: "0 ".concat((-100 * UPSCALE_RATIO + 100) / 2, "%"),
2243
- width: "".concat(100 * UPSCALE_RATIO, "%"),
2244
- maxWidth: "".concat(100 * UPSCALE_RATIO, "%"),
2245
- flexGrow: 1,
2246
- display: "flex"
2247
- }
2248
- }, props));
2334
+ return /* @__PURE__ */ jsxs13(Fragment2, {
2335
+ children: [
2336
+ /* @__PURE__ */ jsx40("style", {
2337
+ children: ".superinterface-textarea { min-height: inherit; height: 30px; }"
2338
+ }),
2339
+ /* @__PURE__ */ jsx40(TextareaAutosize, _object_spread({
2340
+ ref: ref,
2341
+ className: "superinterface-textarea",
2342
+ style: {
2343
+ border: 0,
2344
+ outline: 0,
2345
+ boxSizing: "border-box",
2346
+ resize: "none",
2347
+ fontSize: "".concat(14 * UPSCALE_RATIO, "px"),
2348
+ lineHeight: "".concat(24 * UPSCALE_RATIO, "px"),
2349
+ transform: "scale(".concat(1 / UPSCALE_RATIO, ")"),
2350
+ margin: "0 ".concat((-100 * UPSCALE_RATIO + 100) / 2, "%"),
2351
+ width: "".concat(100 * UPSCALE_RATIO, "%"),
2352
+ maxWidth: "".concat(100 * UPSCALE_RATIO, "%"),
2353
+ flexGrow: 1,
2354
+ display: "flex"
2355
+ }
2356
+ }, props))
2357
+ ]
2358
+ });
2249
2359
  });
2250
2360
  // src/components/threads/Thread/MessageForm/Field/index.tsx
2251
2361
  import { useFormContext } from "react-hook-form";
2252
- import { Container as Container2, Flex as Flex14 } from "@radix-ui/themes";
2362
+ import { Container as Container2, Flex as Flex13 } from "@radix-ui/themes";
2253
2363
  import { jsx as jsx41 } from "react/jsx-runtime";
2254
2364
  var Root3 = function(param) {
2255
2365
  var children = param.children;
@@ -2257,13 +2367,13 @@ var Root3 = function(param) {
2257
2367
  return /* @__PURE__ */ jsx41(Container2, {
2258
2368
  size: "2",
2259
2369
  flexGrow: "0",
2260
- children: /* @__PURE__ */ jsx41(Flex14, {
2370
+ children: /* @__PURE__ */ jsx41(Flex13, {
2261
2371
  direction: "column",
2262
2372
  flexShrink: "0",
2263
- children: /* @__PURE__ */ jsx41(Flex14, {
2373
+ children: /* @__PURE__ */ jsx41(Flex13, {
2264
2374
  direction: "column",
2265
2375
  flexShrink: "0",
2266
- children: /* @__PURE__ */ jsx41(Flex14, {
2376
+ children: /* @__PURE__ */ jsx41(Flex13, {
2267
2377
  style: _object_spread({
2268
2378
  borderRadius: "var(--radius-2)",
2269
2379
  borderWidth: "1px",
@@ -2281,7 +2391,7 @@ var Root3 = function(param) {
2281
2391
  });
2282
2392
  };
2283
2393
  var Control = function() {
2284
- var assistantNameContext = useContext8(AssistantNameContext);
2394
+ var assistantNameContext = useContext9(AssistantNameContext);
2285
2395
  var register = useFormContext().register;
2286
2396
  var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
2287
2397
  var isSubmitDisabled = useMemo10(function() {
@@ -2293,7 +2403,7 @@ var Control = function() {
2293
2403
  var isDisabledPrevious = usePrevious(isDisabled);
2294
2404
  var textareaRef = useRef3(null);
2295
2405
  var textareaProps = register("content");
2296
- useEffect4(function() {
2406
+ useEffect5(function() {
2297
2407
  if (isDisabled) return;
2298
2408
  if (!isDisabledPrevious) return;
2299
2409
  if (!textareaRef.current) return;
@@ -2327,23 +2437,23 @@ var Field = {
2327
2437
  Control: Control
2328
2438
  };
2329
2439
  // src/components/threads/Thread/MessageForm/index.tsx
2330
- import { jsx as jsx42, jsxs as jsxs12 } from "react/jsx-runtime";
2440
+ import { jsx as jsx42, jsxs as jsxs14 } from "react/jsx-runtime";
2331
2441
  var MessageForm = function() {
2332
2442
  return /* @__PURE__ */ jsx42(Root2, {
2333
- children: /* @__PURE__ */ jsxs12(Field.Root, {
2443
+ children: /* @__PURE__ */ jsxs14(Field.Root, {
2334
2444
  children: [
2335
2445
  /* @__PURE__ */ jsx42(Text5, {
2336
2446
  size: "2",
2337
2447
  style: {
2338
2448
  flexGrow: 1
2339
2449
  },
2340
- children: /* @__PURE__ */ jsx42(Flex15, {
2450
+ children: /* @__PURE__ */ jsx42(Flex14, {
2341
2451
  flexGrow: "1",
2342
2452
  direction: "column",
2343
2453
  children: /* @__PURE__ */ jsx42(Field.Control, {})
2344
2454
  })
2345
2455
  }),
2346
- /* @__PURE__ */ jsx42(Flex15, {
2456
+ /* @__PURE__ */ jsx42(Flex14, {
2347
2457
  flexShrink: "0",
2348
2458
  align: "end",
2349
2459
  children: /* @__PURE__ */ jsx42(Submit, {})
@@ -2356,14 +2466,36 @@ MessageForm.Root = Root2;
2356
2466
  MessageForm.Field = Field;
2357
2467
  MessageForm.Submit = Submit;
2358
2468
  // src/components/threads/Thread/Root/index.tsx
2359
- import { Flex as Flex16 } from "@radix-ui/themes";
2469
+ import { Flex as Flex15 } from "@radix-ui/themes";
2470
+ // src/components/runs/PollingProvider/index.tsx
2471
+ import { useState as useState2 } from "react";
2360
2472
  import { jsx as jsx43 } from "react/jsx-runtime";
2473
+ var PollingProvider = function(param) {
2474
+ var children = param.children;
2475
+ var _useState2 = _sliced_to_array(useState2(false), 2), isPollRefetching = _useState2[0], setIsPollRefetching = _useState2[1];
2476
+ return /* @__PURE__ */ jsx43(PollingContext.Provider, {
2477
+ value: {
2478
+ isPollRefetching: isPollRefetching,
2479
+ setIsPollRefetching: setIsPollRefetching
2480
+ },
2481
+ children: children
2482
+ });
2483
+ };
2484
+ // src/components/threads/Thread/Provider/index.tsx
2485
+ import { jsx as jsx44 } from "react/jsx-runtime";
2486
+ var Provider2 = function(args) {
2487
+ return /* @__PURE__ */ jsx44(PollingProvider, {
2488
+ children: /* @__PURE__ */ jsx44(SuperinterfaceProvider, _object_spread({}, args))
2489
+ });
2490
+ };
2491
+ // src/components/threads/Thread/Root/index.tsx
2492
+ import { jsx as jsx45 } from "react/jsx-runtime";
2361
2493
  var Root4 = function(_param) {
2362
2494
  var children = _param.children, rest = _object_without_properties(_param, [
2363
2495
  "children"
2364
2496
  ]);
2365
- return /* @__PURE__ */ jsx43(SuperinterfaceProvider, _object_spread_props(_object_spread({}, rest), {
2366
- children: /* @__PURE__ */ jsx43(Flex16, {
2497
+ return /* @__PURE__ */ jsx45(Provider2, _object_spread_props(_object_spread({}, rest), {
2498
+ children: /* @__PURE__ */ jsx45(Flex15, {
2367
2499
  direction: "column",
2368
2500
  flexGrow: "1",
2369
2501
  children: children
@@ -2371,40 +2503,45 @@ var Root4 = function(_param) {
2371
2503
  }));
2372
2504
  };
2373
2505
  // src/components/threads/Thread/index.tsx
2374
- import { jsx as jsx44, jsxs as jsxs13 } from "react/jsx-runtime";
2506
+ import { jsx as jsx46, jsxs as jsxs15 } from "react/jsx-runtime";
2375
2507
  var Thread = function(props) {
2376
- return /* @__PURE__ */ jsxs13(Root4, _object_spread_props(_object_spread({}, props), {
2508
+ return /* @__PURE__ */ jsxs15(Root4, _object_spread_props(_object_spread({}, props), {
2377
2509
  children: [
2378
- /* @__PURE__ */ jsx44(Messages, {}),
2379
- /* @__PURE__ */ jsx44(MessageForm, {})
2510
+ /* @__PURE__ */ jsx46(Messages, {}),
2511
+ /* @__PURE__ */ jsx46(MessageForm, {})
2380
2512
  ]
2381
2513
  }));
2382
2514
  };
2383
2515
  Thread.Root = Root4;
2384
2516
  Thread.Messages = Messages;
2385
2517
  Thread.MessageForm = MessageForm;
2518
+ // src/hooks/messages/useMessageContext/index.ts
2519
+ import { useContext as useContext10 } from "react";
2520
+ var useMessageContext = function() {
2521
+ return useContext10(MessageContext);
2522
+ };
2386
2523
  // src/components/threads/ThreadDialog/Root/index.tsx
2387
- import { Flex as Flex17 } from "@radix-ui/themes";
2524
+ import { Flex as Flex16 } from "@radix-ui/themes";
2388
2525
  // src/components/threads/ThreadDialog/Provider/index.tsx
2389
- import { useState } from "react";
2526
+ import { useState as useState3 } from "react";
2390
2527
  // src/contexts/threads/ThreadDialogContext/index.ts
2391
- import { createContext as createContext7 } from "react";
2392
- var ThreadDialogContext = createContext7({
2528
+ import { createContext as createContext9 } from "react";
2529
+ var ThreadDialogContext = createContext9({
2393
2530
  isOpen: false,
2394
2531
  setIsOpen: function() {}
2395
2532
  });
2396
2533
  // src/hooks/threads/useThreadDialogContext/index.ts
2397
- import { useContext as useContext9 } from "react";
2534
+ import { useContext as useContext11 } from "react";
2398
2535
  var useThreadDialogContext = function() {
2399
- return useContext9(ThreadDialogContext);
2536
+ return useContext11(ThreadDialogContext);
2400
2537
  };
2401
2538
  // src/components/threads/ThreadDialog/Provider/index.tsx
2402
- import { jsx as jsx45 } from "react/jsx-runtime";
2403
- var Provider = function(param) {
2539
+ import { jsx as jsx47 } from "react/jsx-runtime";
2540
+ var Provider3 = function(param) {
2404
2541
  var children = param.children;
2405
2542
  var threadDialogContext = useThreadDialogContext();
2406
- var _useState = _sliced_to_array(useState(threadDialogContext.isOpen), 2), isOpen = _useState[0], setIsOpen = _useState[1];
2407
- return /* @__PURE__ */ jsx45(ThreadDialogContext.Provider, {
2543
+ var _useState3 = _sliced_to_array(useState3(threadDialogContext.isOpen), 2), isOpen = _useState3[0], setIsOpen = _useState3[1];
2544
+ return /* @__PURE__ */ jsx47(ThreadDialogContext.Provider, {
2408
2545
  value: {
2409
2546
  isOpen: isOpen,
2410
2547
  setIsOpen: setIsOpen
@@ -2413,11 +2550,11 @@ var Provider = function(param) {
2413
2550
  });
2414
2551
  };
2415
2552
  // src/components/threads/ThreadDialog/Root/index.tsx
2416
- import { jsx as jsx46 } from "react/jsx-runtime";
2553
+ import { jsx as jsx48 } from "react/jsx-runtime";
2417
2554
  var Root5 = function(param) {
2418
2555
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2419
- return /* @__PURE__ */ jsx46(Provider, {
2420
- children: /* @__PURE__ */ jsx46(Flex17, {
2556
+ return /* @__PURE__ */ jsx48(Provider3, {
2557
+ children: /* @__PURE__ */ jsx48(Flex16, {
2421
2558
  direction: "column",
2422
2559
  justify: "end",
2423
2560
  align: "end",
@@ -2433,12 +2570,12 @@ var Root5 = function(param) {
2433
2570
  });
2434
2571
  };
2435
2572
  // src/components/threads/ThreadDialog/Trigger/index.tsx
2436
- import { Flex as Flex18 } from "@radix-ui/themes";
2437
- import { jsx as jsx47 } from "react/jsx-runtime";
2573
+ import { Flex as Flex17 } from "@radix-ui/themes";
2574
+ import { jsx as jsx49 } from "react/jsx-runtime";
2438
2575
  var Trigger = function(param) {
2439
2576
  var children = param.children;
2440
2577
  var setIsOpen = useThreadDialogContext().setIsOpen;
2441
- return /* @__PURE__ */ jsx47(Flex18, {
2578
+ return /* @__PURE__ */ jsx49(Flex17, {
2442
2579
  onClick: function() {
2443
2580
  return setIsOpen(function(prev) {
2444
2581
  return !prev;
@@ -2452,22 +2589,22 @@ var Trigger = function(param) {
2452
2589
  // src/components/threads/ThreadDialog/Button/index.tsx
2453
2590
  import { IconButton } from "@radix-ui/themes";
2454
2591
  import { ChatBubbleIcon } from "@radix-ui/react-icons";
2455
- import { jsx as jsx48 } from "react/jsx-runtime";
2592
+ import { jsx as jsx50 } from "react/jsx-runtime";
2456
2593
  var Button3 = function() {
2457
- return /* @__PURE__ */ jsx48(IconButton, {
2594
+ return /* @__PURE__ */ jsx50(IconButton, {
2458
2595
  size: "4",
2459
2596
  radius: "full",
2460
- children: /* @__PURE__ */ jsx48(ChatBubbleIcon, {})
2597
+ children: /* @__PURE__ */ jsx50(ChatBubbleIcon, {})
2461
2598
  });
2462
2599
  };
2463
2600
  // src/components/threads/ThreadDialog/Content/index.tsx
2464
- import { Card, Inset, Flex as Flex19 } from "@radix-ui/themes";
2465
- import { jsx as jsx49, jsxs as jsxs14 } from "react/jsx-runtime";
2601
+ import { Card, Inset, Flex as Flex18 } from "@radix-ui/themes";
2602
+ import { jsx as jsx51, jsxs as jsxs16 } from "react/jsx-runtime";
2466
2603
  var Root6 = function(param) {
2467
2604
  var children = param.children;
2468
2605
  var isOpen = useThreadDialogContext().isOpen;
2469
2606
  if (!isOpen) return null;
2470
- return /* @__PURE__ */ jsx49(Card, {
2607
+ return /* @__PURE__ */ jsx51(Card, {
2471
2608
  mb: "3",
2472
2609
  style: {
2473
2610
  display: "flex",
@@ -2476,7 +2613,7 @@ var Root6 = function(param) {
2476
2613
  maxWidth: "400px",
2477
2614
  maxHeight: "720px"
2478
2615
  },
2479
- children: /* @__PURE__ */ jsx49(Inset, {
2616
+ children: /* @__PURE__ */ jsx51(Inset, {
2480
2617
  clip: "padding-box",
2481
2618
  side: "all",
2482
2619
  pb: "current",
@@ -2489,21 +2626,23 @@ var Root6 = function(param) {
2489
2626
  });
2490
2627
  };
2491
2628
  var Content4 = function() {
2492
- return /* @__PURE__ */ jsx49(Root6, {
2493
- children: /* @__PURE__ */ jsxs14(Thread.Root, {
2629
+ return /* @__PURE__ */ jsx51(Root6, {
2630
+ children: /* @__PURE__ */ jsxs16(Thread.Root, {
2494
2631
  children: [
2495
- /* @__PURE__ */ jsx49(Thread.Messages, {
2632
+ /* @__PURE__ */ jsx51(Thread.Messages, {
2496
2633
  style: {
2497
- padding: "var(--space-5)"
2634
+ paddingTop: "var(--space-5)",
2635
+ paddingRight: "var(--space-5)",
2636
+ paddingLeft: "var(--space-5)"
2498
2637
  }
2499
2638
  }),
2500
- /* @__PURE__ */ jsx49(Flex19, {
2639
+ /* @__PURE__ */ jsx51(Flex18, {
2501
2640
  direction: "column",
2502
2641
  pl: "5",
2503
2642
  pr: "5",
2504
2643
  pb: "3",
2505
2644
  flexShrink: "0",
2506
- children: /* @__PURE__ */ jsx49(Thread.MessageForm, {})
2645
+ children: /* @__PURE__ */ jsx51(Thread.MessageForm, {})
2507
2646
  })
2508
2647
  ]
2509
2648
  })
@@ -2511,13 +2650,13 @@ var Content4 = function() {
2511
2650
  };
2512
2651
  Content4.Root = Root6;
2513
2652
  // src/components/threads/ThreadDialog/index.tsx
2514
- import { jsx as jsx50, jsxs as jsxs15 } from "react/jsx-runtime";
2653
+ import { jsx as jsx52, jsxs as jsxs17 } from "react/jsx-runtime";
2515
2654
  var ThreadDialog = function() {
2516
- return /* @__PURE__ */ jsxs15(Root5, {
2655
+ return /* @__PURE__ */ jsxs17(Root5, {
2517
2656
  children: [
2518
- /* @__PURE__ */ jsx50(Content4, {}),
2519
- /* @__PURE__ */ jsx50(Trigger, {
2520
- children: /* @__PURE__ */ jsx50(Button3, {})
2657
+ /* @__PURE__ */ jsx52(Content4, {}),
2658
+ /* @__PURE__ */ jsx52(Trigger, {
2659
+ children: /* @__PURE__ */ jsx52(Button3, {})
2521
2660
  })
2522
2661
  ]
2523
2662
  });
@@ -2528,12 +2667,10 @@ ThreadDialog.Button = Button3;
2528
2667
  ThreadDialog.Content = Content4;
2529
2668
  // src/components/threads/AudioThread/Root/index.tsx
2530
2669
  import "regenerator-runtime/runtime";
2531
- import { useEffect as useEffect7, useRef as useRef6 } from "react";
2532
- import { Flex as Flex20 } from "@radix-ui/themes";
2533
- import SpeechRecognition, { useSpeechRecognition } from "react-speech-recognition";
2670
+ import { Flex as Flex19 } from "@radix-ui/themes";
2534
2671
  // src/contexts/threads/AudioThreadContext/index.ts
2535
- import { createContext as createContext8 } from "react";
2536
- var AudioThreadContext = createContext8({
2672
+ import { createContext as createContext10 } from "react";
2673
+ var AudioThreadContext = createContext10({
2537
2674
  status: "idle",
2538
2675
  recorderProps: {
2539
2676
  status: "idle",
@@ -2590,6 +2727,16 @@ var AudioThreadContext = createContext8({
2590
2727
  });
2591
2728
  // src/components/threads/AudioThread/Root/index.tsx
2592
2729
  import { usePermission } from "react-use";
2730
+ // src/components/threads/AudioThread/Root/lib/blobToData.ts
2731
+ var blobToData = function(blob) {
2732
+ return new Promise(function(resolve) {
2733
+ var reader = new FileReader();
2734
+ reader.onloadend = function() {
2735
+ return resolve(reader.result);
2736
+ };
2737
+ reader.readAsDataURL(blob);
2738
+ });
2739
+ };
2593
2740
  // src/hooks/audioThreads/useStatus/index.ts
2594
2741
  import { useMemo as useMemo11 } from "react";
2595
2742
  var useStatus = function(param) {
@@ -2618,27 +2765,21 @@ var useStatus = function(param) {
2618
2765
  // src/hooks/audioThreads/useRecorder/index.ts
2619
2766
  import dayjs from "dayjs";
2620
2767
  import { useAudioCapture } from "use-audio-capture";
2621
- import { useMemo as useMemo12, useRef as useRef4, useState as useState2, useCallback as useCallback2, useEffect as useEffect5 } from "react";
2768
+ import { useMemo as useMemo12, useRef as useRef4, useState as useState4, useCallback as useCallback2, useEffect as useEffect6 } from "react";
2622
2769
  import { useAudioPlayer } from "react-use-audio-player";
2623
2770
  import { useInterval as useInterval2 } from "react-use";
2624
2771
  var useRecorder = function(param) {
2625
2772
  var isStopOnSilence = param.isStopOnSilence, onStart = param.onStart, onStop = param.onStop;
2626
- var _useState2 = _sliced_to_array(useState2(null), 2), silenceStart = _useState2[0], setSilenceStart = _useState2[1];
2627
- var _useState21 = _sliced_to_array(useState2(null), 2), noiseStart = _useState21[0], setNoiseStart = _useState21[1];
2628
- var _useState22 = _sliced_to_array(useState2(null), 2), mediaStream = _useState22[0], setMediaStream = _useState22[1];
2629
- var _useState23 = _sliced_to_array(useState2("idle"), 2), status = _useState23[0], setStatus = _useState23[1];
2773
+ var _useState4 = _sliced_to_array(useState4(null), 2), silenceStart = _useState4[0], setSilenceStart = _useState4[1];
2774
+ var _useState41 = _sliced_to_array(useState4(null), 2), noiseStart = _useState41[0], setNoiseStart = _useState41[1];
2775
+ var _useState42 = _sliced_to_array(useState4(null), 2), mediaStream = _useState42[0], setMediaStream = _useState42[1];
2776
+ var _useState43 = _sliced_to_array(useState4("idle"), 2), status = _useState43[0], setStatus = _useState43[1];
2630
2777
  var startAudioPlayer = useAudioPlayer();
2631
2778
  var endAudioPlayer = useAudioPlayer();
2632
- var _useState24 = _sliced_to_array(useState2(false), 2), isLoaded = _useState24[0], setIsLoaded = _useState24[1];
2633
- useEffect5(function() {
2779
+ var _useState44 = _sliced_to_array(useState4(false), 2), isLoaded = _useState44[0], setIsLoaded = _useState44[1];
2780
+ useEffect6(function() {
2634
2781
  if (isLoaded) return;
2635
2782
  setIsLoaded(true);
2636
- startAudioPlayer.load("/sounds/warning.wav", {
2637
- html5: true
2638
- });
2639
- endAudioPlayer.load("/sounds/success.wav", {
2640
- html5: true
2641
- });
2642
2783
  }, [
2643
2784
  isLoaded,
2644
2785
  startAudioPlayer,
@@ -2646,7 +2787,6 @@ var useRecorder = function(param) {
2646
2787
  ]);
2647
2788
  var audioCaptureProps = useAudioCapture({
2648
2789
  onStart: function(event, opts) {
2649
- startAudioPlayer.play();
2650
2790
  setStatus("recording");
2651
2791
  setMediaStream(opts.mediaStream);
2652
2792
  isInited.current = false;
@@ -2663,7 +2803,6 @@ var useRecorder = function(param) {
2663
2803
  for(_len = _arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2664
2804
  args[_key] = _arguments[_key];
2665
2805
  }
2666
- endAudioPlayer.play();
2667
2806
  setStatus("stopped");
2668
2807
  if (!onStop) return [
2669
2808
  3,
@@ -2696,9 +2835,9 @@ var useRecorder = function(param) {
2696
2835
  setNoiseStart(null);
2697
2836
  }
2698
2837
  });
2699
- var _useState25 = _sliced_to_array(useState2(null), 2), audioEngine = _useState25[0], setAudioEngine = _useState25[1];
2838
+ var _useState45 = _sliced_to_array(useState4(null), 2), audioEngine = _useState45[0], setAudioEngine = _useState45[1];
2700
2839
  var isInited = useRef4(false);
2701
- useEffect5(function() {
2840
+ useEffect6(function() {
2702
2841
  if (!mediaStream) return;
2703
2842
  if (isInited.current) return;
2704
2843
  isInited.current = true;
@@ -2751,7 +2890,7 @@ var useRecorder = function(param) {
2751
2890
  setNoiseStart,
2752
2891
  setSilenceStart
2753
2892
  ]);
2754
- useEffect5(function() {
2893
+ useEffect6(function() {
2755
2894
  if (!isStopOnSilence) return;
2756
2895
  requestAnimationFrame(function() {
2757
2896
  return handleSilence();
@@ -2774,7 +2913,7 @@ var useRecorder = function(param) {
2774
2913
  });
2775
2914
  };
2776
2915
  // src/hooks/audioThreads/useMessageAudio/index.ts
2777
- import { useMemo as useMemo13, useRef as useRef5, useState as useState3, useEffect as useEffect6 } from "react";
2916
+ import { useMemo as useMemo13, useRef as useRef5, useState as useState5, useEffect as useEffect7 } from "react";
2778
2917
  import { Howler } from "howler";
2779
2918
  import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
2780
2919
  // src/hooks/audioThreads/useMessageAudio/lib/input.ts
@@ -2800,11 +2939,11 @@ var isHtmlAudioSupported = !unsupportedNames.includes(((_detect = detect()) ===
2800
2939
  // src/hooks/audioThreads/useMessageAudio/index.ts
2801
2940
  var useMessageAudio = function(param) {
2802
2941
  var onEnd = param.onEnd;
2803
- var _useState3 = _sliced_to_array(useState3([]), 2), playedMessageIds = _useState3[0], setPlayedMessageIds = _useState3[1];
2942
+ var _useState5 = _sliced_to_array(useState5([]), 2), playedMessageIds = _useState5[0], setPlayedMessageIds = _useState5[1];
2804
2943
  var audioPlayer = useAudioPlayer2();
2805
2944
  var superinterfaceContext = useSuperinterfaceContext();
2806
2945
  var latestMessageProps = useLatestMessage();
2807
- useEffect6(function() {
2946
+ useEffect7(function() {
2808
2947
  if (audioPlayer.playing) return;
2809
2948
  if (!latestMessageProps.latestMessage) return;
2810
2949
  if (latestMessageProps.latestMessage.role !== "assistant") return;
@@ -2822,7 +2961,14 @@ var useMessageAudio = function(param) {
2822
2961
  format: "mp3",
2823
2962
  autoplay: true,
2824
2963
  html5: isHtmlAudioSupported,
2825
- onend: onEnd
2964
+ onend: onEnd,
2965
+ xhr: _object_spread_props(_object_spread({}, superinterfaceContext.publicApiKey ? {
2966
+ headers: {
2967
+ Authorization: "Bearer ".concat(superinterfaceContext.publicApiKey)
2968
+ }
2969
+ } : {}), {
2970
+ withCredentials: true
2971
+ })
2826
2972
  });
2827
2973
  }, [
2828
2974
  superinterfaceContext,
@@ -2832,8 +2978,8 @@ var useMessageAudio = function(param) {
2832
2978
  onEnd
2833
2979
  ]);
2834
2980
  var isInited = useRef5(false);
2835
- var _useState31 = _sliced_to_array(useState3(null), 2), audioEngine = _useState31[0], setAudioEngine = _useState31[1];
2836
- useEffect6(function() {
2981
+ var _useState51 = _sliced_to_array(useState5(null), 2), audioEngine = _useState51[0], setAudioEngine = _useState51[1];
2982
+ useEffect7(function() {
2837
2983
  if (!audioPlayer.playing) return;
2838
2984
  if (isInited.current) return;
2839
2985
  isInited.current = true;
@@ -2868,48 +3014,47 @@ var useMessageAudio = function(param) {
2868
3014
  });
2869
3015
  };
2870
3016
  // src/components/threads/AudioThread/Root/index.tsx
2871
- import { jsx as jsx51 } from "react/jsx-runtime";
3017
+ import { jsx as jsx53 } from "react/jsx-runtime";
2872
3018
  var Root7 = function(param) {
2873
3019
  var children = param.children;
2874
3020
  useLifecycle();
2875
3021
  var createMessageProps = useCreateMessage();
2876
- var _useSpeechRecognition = useSpeechRecognition(), transcript = _useSpeechRecognition.transcript, resetTranscript = _useSpeechRecognition.resetTranscript;
2877
- var transcriptRef = useRef6(transcript);
2878
- useEffect7(function() {
2879
- transcriptRef.current = transcript;
2880
- }, [
2881
- transcript
2882
- ]);
2883
3022
  var recorderProps = useRecorder({
2884
3023
  isStopOnSilence: true,
2885
3024
  onStart: /*#__PURE__*/ _async_to_generator(function() {
2886
3025
  return _ts_generator(this, function(_state) {
2887
3026
  console.log("start");
2888
- resetTranscript();
2889
- SpeechRecognition.default.startListening({
2890
- continuous: true
2891
- });
2892
3027
  return [
2893
3028
  2
2894
3029
  ];
2895
3030
  });
2896
3031
  }),
2897
3032
  onStop: function() {
2898
- var _ref = _async_to_generator(function(_event, _chunks) {
3033
+ var _ref = _async_to_generator(function(_event, chunks) {
3034
+ var blob, audioContent;
2899
3035
  return _ts_generator(this, function(_state) {
2900
- console.log({
2901
- transcript: transcriptRef.current
2902
- });
2903
- return [
2904
- 2,
2905
- createMessageProps.createMessage({
2906
- // @ts-ignore-next-line
2907
- content: transcriptRef.current
2908
- })
2909
- ];
3036
+ switch(_state.label){
3037
+ case 0:
3038
+ blob = new Blob(chunks, {
3039
+ type: chunks[0].type
3040
+ });
3041
+ return [
3042
+ 4,
3043
+ blobToData(blob)
3044
+ ];
3045
+ case 1:
3046
+ audioContent = _state.sent();
3047
+ return [
3048
+ 2,
3049
+ createMessageProps.createMessage({
3050
+ // @ts-ignore-next-line
3051
+ audioContent: audioContent
3052
+ })
3053
+ ];
3054
+ }
2910
3055
  });
2911
3056
  });
2912
- return function(_event, _chunks) {
3057
+ return function(_event, chunks) {
2913
3058
  return _ref.apply(this, arguments);
2914
3059
  };
2915
3060
  }()
@@ -2929,13 +3074,13 @@ var Root7 = function(param) {
2929
3074
  createMessageProps: createMessageProps,
2930
3075
  messageAudioProps: messageAudioProps
2931
3076
  }).status;
2932
- return /* @__PURE__ */ jsx51(AudioThreadContext.Provider, {
3077
+ return /* @__PURE__ */ jsx53(AudioThreadContext.Provider, {
2933
3078
  value: {
2934
3079
  status: status,
2935
3080
  recorderProps: recorderProps,
2936
3081
  messageAudioProps: messageAudioProps
2937
3082
  },
2938
- children: /* @__PURE__ */ jsx51(Flex20, {
3083
+ children: /* @__PURE__ */ jsx53(Flex19, {
2939
3084
  direction: "column",
2940
3085
  flexGrow: "1",
2941
3086
  p: "5",
@@ -2944,23 +3089,23 @@ var Root7 = function(param) {
2944
3089
  });
2945
3090
  };
2946
3091
  // src/components/threads/AudioThread/Visualization/index.tsx
2947
- import { Flex as Flex21 } from "@radix-ui/themes";
3092
+ import { Flex as Flex20 } from "@radix-ui/themes";
2948
3093
  // src/hooks/threads/useAudioThreadContext/index.ts
2949
- import { useContext as useContext10 } from "react";
3094
+ import { useContext as useContext12 } from "react";
2950
3095
  var useAudioThreadContext = function() {
2951
- return useContext10(AudioThreadContext);
3096
+ return useContext12(AudioThreadContext);
2952
3097
  };
2953
3098
  // src/components/threads/AudioThread/Visualization/index.tsx
2954
- import { jsx as jsx52 } from "react/jsx-runtime";
3099
+ import { jsx as jsx54 } from "react/jsx-runtime";
2955
3100
  var Visualization = function() {
2956
3101
  var audioThreadContext = useAudioThreadContext();
2957
- return /* @__PURE__ */ jsx52(Flex21, {
3102
+ return /* @__PURE__ */ jsx54(Flex20, {
2958
3103
  direction: "column",
2959
3104
  align: "center",
2960
3105
  justify: "center",
2961
3106
  mb: "3",
2962
3107
  flexGrow: "1",
2963
- children: /* @__PURE__ */ jsx52(Flex21, {
3108
+ children: /* @__PURE__ */ jsx54(Flex20, {
2964
3109
  align: "center",
2965
3110
  justify: "center",
2966
3111
  height: "200px",
@@ -2974,21 +3119,21 @@ var Visualization = function() {
2974
3119
  };
2975
3120
  // src/components/threads/AudioThread/Form/index.tsx
2976
3121
  import { SpeakerModerateIcon } from "@radix-ui/react-icons";
2977
- import { Flex as Flex24 } from "@radix-ui/themes";
3122
+ import { Flex as Flex23 } from "@radix-ui/themes";
2978
3123
  // src/components/threads/AudioThread/Form/Visualizer/index.tsx
2979
3124
  import _7 from "lodash";
2980
- import { Flex as Flex22, Grid } from "@radix-ui/themes";
2981
- import { useState as useState4, useEffect as useEffect8, useCallback as useCallback3 } from "react";
3125
+ import { Flex as Flex21, Grid } from "@radix-ui/themes";
3126
+ import { useState as useState6, useEffect as useEffect8, useCallback as useCallback3 } from "react";
2982
3127
  import { cluster } from "radash";
2983
- import { jsx as jsx53 } from "react/jsx-runtime";
3128
+ import { jsx as jsx55 } from "react/jsx-runtime";
2984
3129
  var barCount = 4;
2985
3130
  var Visualizer = function() {
2986
3131
  var audioThreadContext = useAudioThreadContext();
2987
3132
  var visualizationAnalyser = audioThreadContext.recorderProps.visualizationAnalyser;
2988
- var _useState4 = _sliced_to_array(useState4(function() {
3133
+ var _useState6 = _sliced_to_array(useState6(function() {
2989
3134
  return new AudioContext().createAnalyser();
2990
- }), 1), emptyVisualizer = _useState4[0];
2991
- var _useState41 = _sliced_to_array(useState4([]), 2), barHeights = _useState41[0], setBarHeights = _useState41[1];
3135
+ }), 1), emptyVisualizer = _useState6[0];
3136
+ var _useState61 = _sliced_to_array(useState6([]), 2), barHeights = _useState61[0], setBarHeights = _useState61[1];
2992
3137
  var draw = useCallback3(function(param) {
2993
3138
  var visualizationAnalyser2 = param.visualizationAnalyser;
2994
3139
  var frequencyData = new Uint8Array(visualizationAnalyser2.frequencyBinCount / 15);
@@ -3012,7 +3157,7 @@ var Visualizer = function() {
3012
3157
  visualizationAnalyser,
3013
3158
  emptyVisualizer
3014
3159
  ]);
3015
- return /* @__PURE__ */ jsx53(Grid, {
3160
+ return /* @__PURE__ */ jsx55(Grid, {
3016
3161
  columns: "".concat(barCount),
3017
3162
  gap: "1",
3018
3163
  width: "auto",
@@ -3021,12 +3166,12 @@ var Visualizer = function() {
3021
3166
  gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
3022
3167
  },
3023
3168
  children: barHeights.map(function(barHeight, index) {
3024
- return /* @__PURE__ */ jsx53(Flex22, {
3169
+ return /* @__PURE__ */ jsx55(Flex21, {
3025
3170
  direction: "column",
3026
3171
  align: "center",
3027
3172
  justify: "center",
3028
3173
  height: "20px",
3029
- children: /* @__PURE__ */ jsx53(Flex22, {
3174
+ children: /* @__PURE__ */ jsx55(Flex21, {
3030
3175
  minHeight: "50%",
3031
3176
  maxHeight: "100%",
3032
3177
  height: "".concat(barHeight + 20, "%"),
@@ -3041,31 +3186,31 @@ var Visualizer = function() {
3041
3186
  });
3042
3187
  };
3043
3188
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
3044
- import { Flex as Flex23, IconButton as IconButton2, Tooltip } from "@radix-ui/themes";
3189
+ import { Flex as Flex22, IconButton as IconButton2, Tooltip } from "@radix-ui/themes";
3045
3190
  import { PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
3046
- import { jsx as jsx54, jsxs as jsxs16 } from "react/jsx-runtime";
3191
+ import { jsx as jsx56, jsxs as jsxs18 } from "react/jsx-runtime";
3047
3192
  var ActionButton = function() {
3048
3193
  var audioThreadContext = useAudioThreadContext();
3049
3194
  if (audioThreadContext.status === "recording") {
3050
- return /* @__PURE__ */ jsxs16(Flex23, {
3195
+ return /* @__PURE__ */ jsxs18(Flex22, {
3051
3196
  align: "center",
3052
3197
  children: [
3053
- /* @__PURE__ */ jsx54(Flex23, {
3198
+ /* @__PURE__ */ jsx56(Flex22, {
3054
3199
  mr: "3",
3055
3200
  ml: "-7",
3056
- children: /* @__PURE__ */ jsx54(IconButton2, {
3201
+ children: /* @__PURE__ */ jsx56(IconButton2, {
3057
3202
  onClick: audioThreadContext.recorderProps.pause,
3058
3203
  color: "gray",
3059
3204
  radius: "full",
3060
3205
  size: "1",
3061
- children: /* @__PURE__ */ jsx54(PauseIcon, {})
3206
+ children: /* @__PURE__ */ jsx56(PauseIcon, {})
3062
3207
  })
3063
3208
  }),
3064
- /* @__PURE__ */ jsx54(Tooltip, {
3209
+ /* @__PURE__ */ jsx56(Tooltip, {
3065
3210
  open: true,
3066
3211
  content: "Send your message",
3067
3212
  side: "bottom",
3068
- children: /* @__PURE__ */ jsx54(IconButton2, {
3213
+ children: /* @__PURE__ */ jsx56(IconButton2, {
3069
3214
  onClick: audioThreadContext.recorderProps.stop,
3070
3215
  color: "gray",
3071
3216
  highContrast: true,
@@ -3074,14 +3219,14 @@ var ActionButton = function() {
3074
3219
  style: {
3075
3220
  border: "2px solid var(--gray-8)"
3076
3221
  },
3077
- children: /* @__PURE__ */ jsx54(ArrowUpIcon2, {})
3222
+ children: /* @__PURE__ */ jsx56(ArrowUpIcon2, {})
3078
3223
  })
3079
3224
  })
3080
3225
  ]
3081
3226
  });
3082
3227
  }
3083
3228
  if (audioThreadContext.status === "recorderPaused") {
3084
- return /* @__PURE__ */ jsx54(IconButton2, {
3229
+ return /* @__PURE__ */ jsx56(IconButton2, {
3085
3230
  onClick: audioThreadContext.recorderProps.resume,
3086
3231
  color: "red",
3087
3232
  radius: "full",
@@ -3089,11 +3234,11 @@ var ActionButton = function() {
3089
3234
  style: {
3090
3235
  border: "2px solid var(--gray-8)"
3091
3236
  },
3092
- children: /* @__PURE__ */ jsx54(ResumeIcon, {})
3237
+ children: /* @__PURE__ */ jsx56(ResumeIcon, {})
3093
3238
  });
3094
3239
  }
3095
3240
  if (audioThreadContext.status === "idle") {
3096
- return /* @__PURE__ */ jsx54(IconButton2, {
3241
+ return /* @__PURE__ */ jsx56(IconButton2, {
3097
3242
  onClick: function() {
3098
3243
  return audioThreadContext.recorderProps.start();
3099
3244
  },
@@ -3106,7 +3251,7 @@ var ActionButton = function() {
3106
3251
  });
3107
3252
  }
3108
3253
  if (audioThreadContext.status === "playing") {
3109
- return /* @__PURE__ */ jsx54(IconButton2, {
3254
+ return /* @__PURE__ */ jsx56(IconButton2, {
3110
3255
  onClick: function() {
3111
3256
  return audioThreadContext.messageAudioProps.pause();
3112
3257
  },
@@ -3116,11 +3261,11 @@ var ActionButton = function() {
3116
3261
  style: {
3117
3262
  border: "2px solid var(--gray-8)"
3118
3263
  },
3119
- children: /* @__PURE__ */ jsx54(PauseIcon, {})
3264
+ children: /* @__PURE__ */ jsx56(PauseIcon, {})
3120
3265
  });
3121
3266
  }
3122
3267
  if (audioThreadContext.status === "playerPaused") {
3123
- return /* @__PURE__ */ jsx54(IconButton2, {
3268
+ return /* @__PURE__ */ jsx56(IconButton2, {
3124
3269
  onClick: function() {
3125
3270
  return audioThreadContext.messageAudioProps.play();
3126
3271
  },
@@ -3130,10 +3275,10 @@ var ActionButton = function() {
3130
3275
  style: {
3131
3276
  border: "2px solid var(--gray-8)"
3132
3277
  },
3133
- children: /* @__PURE__ */ jsx54(ResumeIcon, {})
3278
+ children: /* @__PURE__ */ jsx56(ResumeIcon, {})
3134
3279
  });
3135
3280
  }
3136
- return /* @__PURE__ */ jsx54(IconButton2, {
3281
+ return /* @__PURE__ */ jsx56(IconButton2, {
3137
3282
  size: "4",
3138
3283
  color: "red",
3139
3284
  radius: "full",
@@ -3144,49 +3289,49 @@ var ActionButton = function() {
3144
3289
  });
3145
3290
  };
3146
3291
  // src/components/threads/AudioThread/Form/index.tsx
3147
- import { jsx as jsx55, jsxs as jsxs17 } from "react/jsx-runtime";
3292
+ import { jsx as jsx57, jsxs as jsxs19 } from "react/jsx-runtime";
3148
3293
  var Form = function() {
3149
3294
  var audioThreadContext = useAudioThreadContext();
3150
- return /* @__PURE__ */ jsxs17(Flex24, {
3295
+ return /* @__PURE__ */ jsxs19(Flex23, {
3151
3296
  direction: "column",
3152
3297
  align: "center",
3153
3298
  children: [
3154
- /* @__PURE__ */ jsxs17(Flex24, {
3299
+ /* @__PURE__ */ jsxs19(Flex23, {
3155
3300
  pb: "3",
3156
3301
  align: "center",
3157
3302
  children: [
3158
- /* @__PURE__ */ jsx55(Flex24, {
3303
+ /* @__PURE__ */ jsx57(Flex23, {
3159
3304
  ml: "-5",
3160
3305
  mr: "2",
3161
3306
  align: "center",
3162
- children: /* @__PURE__ */ jsx55(SpeakerModerateIcon, {
3307
+ children: /* @__PURE__ */ jsx57(SpeakerModerateIcon, {
3163
3308
  style: {
3164
3309
  color: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-12)")
3165
3310
  }
3166
3311
  })
3167
3312
  }),
3168
- /* @__PURE__ */ jsx55(Flex24, {
3313
+ /* @__PURE__ */ jsx57(Flex23, {
3169
3314
  px: "2",
3170
3315
  py: "1",
3171
3316
  style: {
3172
3317
  backgroundColor: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-4)"),
3173
3318
  borderRadius: "var(--radius-6)"
3174
3319
  },
3175
- children: /* @__PURE__ */ jsx55(Visualizer, {})
3320
+ children: /* @__PURE__ */ jsx57(Visualizer, {})
3176
3321
  })
3177
3322
  ]
3178
3323
  }),
3179
- /* @__PURE__ */ jsx55(ActionButton, {})
3324
+ /* @__PURE__ */ jsx57(ActionButton, {})
3180
3325
  ]
3181
3326
  });
3182
3327
  };
3183
3328
  // src/components/threads/AudioThread/index.tsx
3184
- import { jsx as jsx56, jsxs as jsxs18 } from "react/jsx-runtime";
3329
+ import { jsx as jsx58, jsxs as jsxs20 } from "react/jsx-runtime";
3185
3330
  var AudioThread = function(props) {
3186
- return /* @__PURE__ */ jsxs18(Root7, _object_spread_props(_object_spread({}, props), {
3331
+ return /* @__PURE__ */ jsxs20(Root7, _object_spread_props(_object_spread({}, props), {
3187
3332
  children: [
3188
- /* @__PURE__ */ jsx56(Visualization, {}),
3189
- /* @__PURE__ */ jsx56(Form, {})
3333
+ /* @__PURE__ */ jsx58(Visualization, {}),
3334
+ /* @__PURE__ */ jsx58(Form, {})
3190
3335
  ]
3191
3336
  }));
3192
3337
  };
@@ -3194,15 +3339,15 @@ AudioThread.Root = Root7;
3194
3339
  AudioThread.Visualization = Visualization;
3195
3340
  AudioThread.Form = Form;
3196
3341
  // src/components/threads/AudioThreadDialog/index.tsx
3197
- import { jsx as jsx57, jsxs as jsxs19 } from "react/jsx-runtime";
3342
+ import { jsx as jsx59, jsxs as jsxs21 } from "react/jsx-runtime";
3198
3343
  var AudioThreadDialog = function() {
3199
- return /* @__PURE__ */ jsxs19(Root5, {
3344
+ return /* @__PURE__ */ jsxs21(Root5, {
3200
3345
  children: [
3201
- /* @__PURE__ */ jsx57(Content4.Root, {
3202
- children: /* @__PURE__ */ jsx57(AudioThread, {})
3346
+ /* @__PURE__ */ jsx59(Content4.Root, {
3347
+ children: /* @__PURE__ */ jsx59(AudioThread, {})
3203
3348
  }),
3204
- /* @__PURE__ */ jsx57(Trigger, {
3205
- children: /* @__PURE__ */ jsx57(Button3, {})
3349
+ /* @__PURE__ */ jsx59(Trigger, {
3350
+ children: /* @__PURE__ */ jsx59(Button3, {})
3206
3351
  })
3207
3352
  ]
3208
3353
  });
@@ -3212,84 +3357,125 @@ AudioThreadDialog.Trigger = Trigger;
3212
3357
  AudioThreadDialog.Button = Button3;
3213
3358
  AudioThreadDialog.Content = Content4;
3214
3359
  // src/components/suggestions/Suggestions/index.tsx
3360
+ import { useMemo as useMemo15 } from "react";
3361
+ // src/components/suggestions/Suggestions/Content.tsx
3215
3362
  import { useMemo as useMemo14 } from "react";
3216
- import { Flex as Flex25 } from "@radix-ui/themes";
3217
- // src/components/suggestions/Suggestion/index.tsx
3363
+ import { isEmpty as isEmpty2 } from "radash";
3364
+ import { onlyText } from "react-children-utilities";
3365
+ import { Flex as Flex24 } from "@radix-ui/themes";
3366
+ // src/components/suggestions/Suggestions/Item.tsx
3218
3367
  import { ArrowUpIcon as ArrowUpIcon3 } from "@radix-ui/react-icons";
3219
- import { Text as Text6, Button as Button4 } from "@radix-ui/themes";
3220
- import { jsx as jsx58, jsxs as jsxs20 } from "react/jsx-runtime";
3221
- var Suggestion = function(param) {
3222
- var suggestion = param.suggestion;
3223
- var createMessage = useCreateMessage().createMessage;
3224
- var _useIsRunActive = useIsRunActive(), isRunActive2 = _useIsRunActive.isRunActive;
3225
- return /* @__PURE__ */ jsxs20(Button4, {
3226
- variant: "soft",
3227
- style: {
3228
- justifyContent: "space-between"
3229
- },
3368
+ import { Text as Text6, Button as Button4, Spinner as Spinner2 } from "@radix-ui/themes";
3369
+ import { jsx as jsx60, jsxs as jsxs22 } from "react/jsx-runtime";
3370
+ var Item = function(param) {
3371
+ var suggestion = param.suggestion, isDisabled = param.isDisabled;
3372
+ var _useCreateMessage = useCreateMessage(), createMessage = _useCreateMessage.createMessage, isPending = _useCreateMessage.isPending;
3373
+ return /* @__PURE__ */ jsx60(Content5, {
3230
3374
  onClick: function() {
3231
3375
  createMessage({
3232
3376
  // @ts-ignore-next-line
3233
3377
  content: suggestion
3234
3378
  });
3235
3379
  },
3236
- disabled: isRunActive2,
3380
+ isDisabled: isDisabled,
3381
+ isPending: isPending,
3382
+ children: suggestion
3383
+ });
3384
+ };
3385
+ var Content5 = function(param) {
3386
+ var onClick = param.onClick, isDisabled = param.isDisabled, isPending = param.isPending, children = param.children;
3387
+ return /* @__PURE__ */ jsxs22(Button4, {
3388
+ variant: "soft",
3389
+ onClick: onClick,
3390
+ disabled: isDisabled,
3237
3391
  children: [
3238
- /* @__PURE__ */ jsx58(Text6, {
3392
+ /* @__PURE__ */ jsx60(Text6, {
3239
3393
  size: "1",
3240
3394
  weight: "regular",
3241
- children: suggestion
3395
+ children: children
3242
3396
  }),
3243
- /* @__PURE__ */ jsx58(ArrowUpIcon3, {})
3397
+ /* @__PURE__ */ jsx60(Spinner2, {
3398
+ loading: isPending,
3399
+ children: /* @__PURE__ */ jsx60(ArrowUpIcon3, {})
3400
+ })
3244
3401
  ]
3245
3402
  });
3246
3403
  };
3247
- // src/components/suggestions/Suggestions/index.tsx
3248
- import { jsx as jsx59 } from "react/jsx-runtime";
3249
- var Suggestions = function(param) {
3250
- var _param_emptyStateSuggestions = param.emptyStateSuggestions, emptyStateSuggestions = _param_emptyStateSuggestions === void 0 ? [] : _param_emptyStateSuggestions, _param_suggestions = param.suggestions, suggestions = _param_suggestions === void 0 ? [] : _param_suggestions;
3404
+ Item.Content = Content5;
3405
+ // src/components/suggestions/Suggestions/Content.tsx
3406
+ import { jsx as jsx61 } from "react/jsx-runtime";
3407
+ var Content6 = function(param) {
3408
+ var children = param.children;
3409
+ var messageContext = useMessageContext();
3251
3410
  var latestMessageProps = useLatestMessage();
3252
3411
  var isRunActiveProps = useIsRunActive();
3412
+ var suggestions = useMemo14(function() {
3413
+ return onlyText(children).split(/\r?\n/).filter(function(c) {
3414
+ return !isEmpty2(c);
3415
+ }).map(function(c) {
3416
+ return c.trim();
3417
+ });
3418
+ }, [
3419
+ children
3420
+ ]);
3253
3421
  var isDisabled = useMemo14(function() {
3254
- var // @ts-ignore-next-line
3255
- _latestMessageProps_latestMessage_metadata, _latestMessageProps_latestMessage;
3256
- return ((_latestMessageProps_latestMessage = latestMessageProps.latestMessage) === null || _latestMessageProps_latestMessage === void 0 ? void 0 : (_latestMessageProps_latestMessage_metadata = _latestMessageProps_latestMessage.metadata) === null || _latestMessageProps_latestMessage_metadata === void 0 ? void 0 : _latestMessageProps_latestMessage_metadata.isBlocking) || isRunActiveProps.isRunActive;
3422
+ var _messageContext_message;
3423
+ return ((_messageContext_message = messageContext.message) === null || _messageContext_message === void 0 ? void 0 : _messageContext_message.id) !== latestMessageProps.latestMessage.id || isRunActiveProps.isRunActive;
3257
3424
  }, [
3425
+ messageContext,
3258
3426
  latestMessageProps,
3259
3427
  isRunActiveProps
3260
3428
  ]);
3429
+ if (isEmpty2(suggestions)) return null;
3430
+ return /* @__PURE__ */ jsx61(Flex24, {
3431
+ gap: "2",
3432
+ py: "2",
3433
+ wrap: "wrap",
3434
+ children: suggestions.map(function(suggestion) {
3435
+ return /* @__PURE__ */ jsx61(Item, {
3436
+ suggestion: suggestion,
3437
+ isDisabled: isDisabled
3438
+ }, suggestion);
3439
+ })
3440
+ });
3441
+ };
3442
+ // src/components/suggestions/Suggestions/index.tsx
3443
+ import { jsx as jsx62 } from "react/jsx-runtime";
3444
+ var Suggestions = function(param) {
3445
+ var children = param.children;
3446
+ var latestMessageProps = useLatestMessage();
3447
+ var isDisabled = useMemo15(function() {
3448
+ var // @ts-ignore-next-line
3449
+ _latestMessageProps_latestMessage_metadata, _latestMessageProps_latestMessage;
3450
+ return (_latestMessageProps_latestMessage = latestMessageProps.latestMessage) === null || _latestMessageProps_latestMessage === void 0 ? void 0 : (_latestMessageProps_latestMessage_metadata = _latestMessageProps_latestMessage.metadata) === null || _latestMessageProps_latestMessage_metadata === void 0 ? void 0 : _latestMessageProps_latestMessage_metadata.isBlocking;
3451
+ }, [
3452
+ latestMessageProps
3453
+ ]);
3261
3454
  if (latestMessageProps.isLoading) return null;
3262
3455
  if (isDisabled) return null;
3263
- if (!latestMessageProps.latestMessage && emptyStateSuggestions.length > 0) {
3264
- return /* @__PURE__ */ jsx59(Flex25, {
3265
- gap: "2",
3266
- py: "2",
3267
- wrap: "wrap",
3268
- children: emptyStateSuggestions.map(function(suggestion) {
3269
- return /* @__PURE__ */ jsx59(Suggestion, {
3270
- suggestion: suggestion
3271
- }, suggestion);
3272
- })
3273
- });
3274
- }
3275
- if (latestMessageProps.latestMessage.role === "assistant") {
3276
- return /* @__PURE__ */ jsx59(Flex25, {
3277
- gap: "2",
3278
- py: "2",
3279
- wrap: "wrap",
3280
- children: suggestions.map(function(suggestion) {
3281
- return /* @__PURE__ */ jsx59(Suggestion, {
3282
- suggestion: suggestion
3283
- }, suggestion);
3284
- })
3285
- });
3286
- }
3287
- return null;
3456
+ return /* @__PURE__ */ jsx62(Content6, {
3457
+ children: children
3458
+ });
3288
3459
  };
3289
- // src/hooks/markdown/useMarkdownContext/index.ts
3290
- import { useContext as useContext11 } from "react";
3291
- var useMarkdownContext = function() {
3292
- return useContext11(MarkdownContext);
3460
+ Suggestions.Item = Item;
3461
+ // src/components/markdown/MarkdownProvider/index.tsx
3462
+ import { useMemo as useMemo16 } from "react";
3463
+ import { jsx as jsx63 } from "react/jsx-runtime";
3464
+ var MarkdownProvider = function(_param) {
3465
+ var children = _param.children, rest = _object_without_properties(_param, [
3466
+ "children"
3467
+ ]);
3468
+ var prevMarkdownContext = useMarkdownContext();
3469
+ var value = useMemo16(function() {
3470
+ return merge(prevMarkdownContext, rest);
3471
+ }, [
3472
+ rest,
3473
+ prevMarkdownContext
3474
+ ]);
3475
+ return /* @__PURE__ */ jsx63(MarkdownContext.Provider, {
3476
+ value: value,
3477
+ children: children
3478
+ });
3293
3479
  };
3294
- export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, FunctionBase, FunctionComponentsContext, MarkdownContext, Suggestion, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, useCreateMessage, useCreateRun, useIsRunActive, useLatestMessage, useLatestRun, useLifecycle, useMarkdownContext, useMessages, useRuns, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext };
3480
+ export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, useCreateMessage, useCreateRun, useIsRunActive, useLatestMessage, useLatestRun, useLifecycle, useMarkdownContext, useMessageContext, useMessages, useRuns, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext };
3295
3481
  //# sourceMappingURL=index.js.map