@mastra/playground-ui 5.0.5-alpha.0 → 5.1.0

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.
Files changed (38) hide show
  1. package/dist/index.cjs.js +504 -343
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +502 -343
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/src/components/assistant-ui/image-with-fallback.d.ts +3 -0
  6. package/dist/src/components/assistant-ui/thread.d.ts +2 -1
  7. package/dist/src/components/ui/data-table.d.ts +2 -1
  8. package/dist/src/domains/workflows/context/legacy-workflow-nested-graph-context.d.ts +13 -0
  9. package/dist/src/domains/workflows/context/workflow-nested-graph-context.d.ts +4 -3
  10. package/dist/src/domains/workflows/context/workflow-run-context.d.ts +4 -4
  11. package/dist/src/domains/workflows/index.d.ts +3 -3
  12. package/dist/src/domains/workflows/workflow/legacy-workflow-graph-inner.d.ts +5 -0
  13. package/dist/src/domains/workflows/workflow/{v-next-workflow-graph.d.ts → legacy-workflow-graph.d.ts} +1 -1
  14. package/dist/src/domains/workflows/workflow/legacy-workflow-nested-graph.d.ts +6 -0
  15. package/dist/src/domains/workflows/workflow/legacy-workflow-nested-node.d.ts +12 -0
  16. package/dist/src/domains/workflows/workflow/legacy-workflow-status.d.ts +6 -0
  17. package/dist/src/domains/workflows/workflow/{v-next-workflow-trigger.d.ts → legacy-workflow-trigger.d.ts} +1 -1
  18. package/dist/src/domains/workflows/workflow/utils.d.ts +5 -5
  19. package/dist/src/domains/workflows/workflow/workflow-card.d.ts +6 -0
  20. package/dist/src/domains/workflows/workflow/workflow-graph-inner.d.ts +2 -2
  21. package/dist/src/domains/workflows/workflow/workflow-nested-graph.d.ts +3 -3
  22. package/dist/src/domains/workflows/workflow/workflow-nested-node.d.ts +2 -2
  23. package/dist/src/domains/workflows/workflow/workflow-result.d.ts +5 -0
  24. package/dist/src/domains/workflows/workflow/workflow-status.d.ts +5 -0
  25. package/dist/src/ds/icons/FolderIcon.d.ts +3 -0
  26. package/dist/src/ds/icons/McpServerIcon.d.ts +3 -0
  27. package/dist/src/ds/icons/index.d.ts +2 -0
  28. package/dist/src/ds/tokens/sizes.d.ts +1 -0
  29. package/dist/src/hooks/use-workflows.d.ts +24 -24
  30. package/dist/tokens.cjs.js +1 -0
  31. package/dist/tokens.cjs.js.map +1 -1
  32. package/dist/tokens.es.js +1 -0
  33. package/dist/tokens.es.js.map +1 -1
  34. package/package.json +6 -5
  35. package/dist/src/domains/workflows/context/v-next-workflow-nested-graph-context.d.ts +0 -14
  36. package/dist/src/domains/workflows/workflow/v-next-workflow-graph-inner.d.ts +0 -5
  37. package/dist/src/domains/workflows/workflow/v-next-workflow-nested-graph.d.ts +0 -6
  38. package/dist/src/domains/workflows/workflow/v-next-workflow-nested-node.d.ts +0 -11
package/dist/index.es.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useMessage, MessagePrimitive, ActionBarPrimitive, ThreadPrimitive, ComposerPrimitive, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
3
- import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, X, Check, ChevronUp, ChevronDown, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, PlusIcon, TrashIcon, Plus, Loader2 } from 'lucide-react';
3
+ import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, X, Check, ChevronUp, ChevronDown, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, Braces, Brackets, PlusIcon, TrashIcon, Plus, Loader2, CirclePause } from 'lucide-react';
4
4
  import * as React from 'react';
5
- import React__default, { forwardRef, memo, useState, useMemo, useRef, useEffect, createContext, useContext, useCallback, Suspense, Fragment as Fragment$1 } from 'react';
5
+ import React__default, { forwardRef, useState, useEffect, memo, useMemo, useRef, createContext, useContext, useCallback, Suspense, Fragment as Fragment$1 } from 'react';
6
6
  import { Slot } from '@radix-ui/react-slot';
7
7
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
8
8
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
@@ -38,13 +38,13 @@ import jsonSchemaToZod from 'json-schema-to-zod';
38
38
  import { parse } from 'superjson';
39
39
  import z$1, { z, ZodObject } from 'zod';
40
40
  import { AutoForm as AutoForm$1, buildZodFieldConfig } from '@autoform/react';
41
- import * as LabelPrimitive from '@radix-ui/react-label';
42
41
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
43
42
  import { DayPicker } from 'react-day-picker';
44
43
  import * as PopoverPrimitive from '@radix-ui/react-popover';
45
44
  import * as SelectPrimitive from '@radix-ui/react-select';
46
45
  import { v4 } from '@lukeed/uuid';
47
46
  import { ZodProvider, getFieldConfigInZodStack, getDefaultValueInZodStack } from '@autoform/zod';
47
+ import * as LabelPrimitive from '@radix-ui/react-label';
48
48
  import { CodeBlock as CodeBlock$1 } from 'react-code-block';
49
49
  import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
50
50
 
@@ -2890,6 +2890,46 @@ const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__
2890
2890
  ));
2891
2891
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
2892
2892
 
2893
+ const ImageWithFallback = ({ alt, src, ...rest }) => {
2894
+ const [error, setError] = useState(false);
2895
+ useEffect(() => {
2896
+ setError(false);
2897
+ }, [src]);
2898
+ return error || !src ? /* @__PURE__ */ jsxs("div", { children: [
2899
+ /* @__PURE__ */ jsx(
2900
+ "svg",
2901
+ {
2902
+ xmlns: "http://www.w3.org/2000/svg",
2903
+ fill: "none",
2904
+ viewBox: "0 0 24 24",
2905
+ strokeWidth: "1.5",
2906
+ stroke: "currentColor",
2907
+ width: "150",
2908
+ height: "150",
2909
+ children: /* @__PURE__ */ jsx(
2910
+ "path",
2911
+ {
2912
+ strokeLinecap: "round",
2913
+ strokeLinejoin: "round",
2914
+ d: "m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"
2915
+ }
2916
+ )
2917
+ }
2918
+ ),
2919
+ /* @__PURE__ */ jsx("p", { className: "text-xs italic text-muted-foreground -mt-[0.625rem] mb-[0.625rem]", children: "Image link is broken" })
2920
+ ] }) : /* @__PURE__ */ jsx(
2921
+ "img",
2922
+ {
2923
+ src,
2924
+ alt,
2925
+ ...rest,
2926
+ onError: () => {
2927
+ setError(true);
2928
+ }
2929
+ }
2930
+ );
2931
+ };
2932
+
2893
2933
  const SyntaxHighlighter$2 = makePrismAsyncSyntaxHighlighter({
2894
2934
  style: coldarkDark,
2895
2935
  customStyle: {
@@ -3109,7 +3149,8 @@ const defaultComponents = unstable_memoizeMarkdownComponents({
3109
3149
  );
3110
3150
  },
3111
3151
  CodeHeader,
3112
- SyntaxHighlighter: SyntaxHighlighter$2
3152
+ SyntaxHighlighter: SyntaxHighlighter$2,
3153
+ img: ImageWithFallback
3113
3154
  });
3114
3155
 
3115
3156
  const sizes = {
@@ -3492,10 +3533,10 @@ const GithubIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "15", height:
3492
3533
  "path",
3493
3534
  {
3494
3535
  d: "M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",
3495
- fill: "white"
3536
+ fill: "currentColor"
3496
3537
  }
3497
3538
  ) }),
3498
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsx("rect", { width: "14", height: "14", fill: "white", transform: "translate(0.5 0.75)" }) }) })
3539
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsx("rect", { width: "14", height: "14", fill: "currentColor", transform: "translate(0.5 0.75)" }) }) })
3499
3540
  ] });
3500
3541
 
3501
3542
  const GoogleIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
@@ -3724,7 +3765,7 @@ const WorkflowIcon = (props) => /* @__PURE__ */ jsx("svg", { width: "17", height
3724
3765
  fillRule: "evenodd",
3725
3766
  clipRule: "evenodd",
3726
3767
  d: "M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",
3727
- fill: "white"
3768
+ fill: "currentColor"
3728
3769
  }
3729
3770
  ) });
3730
3771
 
@@ -3786,6 +3827,33 @@ const LatencyIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "12", height
3786
3827
  )
3787
3828
  ] });
3788
3829
 
3830
+ const McpServerIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
3831
+ /* @__PURE__ */ jsx(
3832
+ "path",
3833
+ {
3834
+ d: "M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",
3835
+ fill: "currentColor"
3836
+ }
3837
+ ),
3838
+ /* @__PURE__ */ jsx(
3839
+ "path",
3840
+ {
3841
+ d: "M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",
3842
+ fill: "currentColor"
3843
+ }
3844
+ )
3845
+ ] });
3846
+
3847
+ const FolderIcon = (props) => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx(
3848
+ "path",
3849
+ {
3850
+ d: "M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",
3851
+ stroke: "currentColor",
3852
+ strokeLinecap: "round",
3853
+ strokeLinejoin: "round"
3854
+ }
3855
+ ) });
3856
+
3789
3857
  const useCodemirrorTheme$1 = () => {
3790
3858
  return useMemo(
3791
3859
  () => draculaInit({
@@ -3857,7 +3925,10 @@ const AssistantMessage = ({
3857
3925
  /* @__PURE__ */ jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsx(
3858
3926
  MessagePrimitive.Content,
3859
3927
  {
3860
- components: { Text: MarkdownText, tools: { Fallback: ToolFallbackCustom || ToolFallback$1 } }
3928
+ components: {
3929
+ Text: MarkdownText,
3930
+ tools: { Fallback: ToolFallbackCustom || ToolFallback$1 }
3931
+ }
3861
3932
  }
3862
3933
  ) }),
3863
3934
  /* @__PURE__ */ jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsx(AssistantActionBar, {}) })
@@ -3921,13 +3992,27 @@ const useAutoscroll = (ref, { enabled = true }) => {
3921
3992
  }, [enabled, ref]);
3922
3993
  };
3923
3994
 
3924
- const Thread = ({ ToolFallback, agentName }) => {
3995
+ const variants = {
3996
+ "header-md": "text-header-md leading-header-md",
3997
+ "ui-lg": "text-ui-lg leading-ui-lg",
3998
+ "ui-md": "text-ui-md leading-ui-md",
3999
+ "ui-sm": "text-ui-sm leading-ui-sm",
4000
+ "ui-xs": "text-ui-xs leading-ui-xs"
4001
+ };
4002
+ const fonts = {
4003
+ mono: "font-mono"
4004
+ };
4005
+ const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
4006
+ return /* @__PURE__ */ jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
4007
+ };
4008
+
4009
+ const Thread = ({ ToolFallback, agentName, hasMemory }) => {
3925
4010
  const areaRef = useRef(null);
3926
4011
  useAutoscroll(areaRef, { enabled: true });
3927
4012
  const WrappedAssistantMessage = (props) => {
3928
4013
  return /* @__PURE__ */ jsx(AssistantMessage, { ...props, ToolFallback });
3929
4014
  };
3930
- return /* @__PURE__ */ jsxs(ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-100px)] px-4", children: [
4015
+ return /* @__PURE__ */ jsxs(ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-110px)] px-4", children: [
3931
4016
  /* @__PURE__ */ jsxs(ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
3932
4017
  /* @__PURE__ */ jsxs("div", { children: [
3933
4018
  /* @__PURE__ */ jsx(ThreadWelcome, { agentName }),
@@ -3944,7 +4029,7 @@ const Thread = ({ ToolFallback, agentName }) => {
3944
4029
  ] }),
3945
4030
  /* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
3946
4031
  ] }),
3947
- /* @__PURE__ */ jsx(Composer, {})
4032
+ /* @__PURE__ */ jsx(Composer, { hasMemory })
3948
4033
  ] });
3949
4034
  };
3950
4035
  const ThreadWelcome = ({ agentName }) => {
@@ -3963,19 +4048,25 @@ const ThreadWelcome = ({ agentName }) => {
3963
4048
  /* @__PURE__ */ jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
3964
4049
  ] }) });
3965
4050
  };
3966
- const Composer = () => {
3967
- return /* @__PURE__ */ jsxs(ComposerPrimitive.Root, { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
3968
- /* @__PURE__ */ jsx(ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsx(
3969
- "textarea",
3970
- {
3971
- className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
3972
- autoFocus: true,
3973
- placeholder: "Enter your message...",
3974
- name: "",
3975
- id: ""
3976
- }
3977
- ) }),
3978
- /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(ComposerAction, {}) })
4051
+ const Composer = ({ hasMemory }) => {
4052
+ return /* @__PURE__ */ jsxs("div", { children: [
4053
+ /* @__PURE__ */ jsxs(ComposerPrimitive.Root, { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
4054
+ /* @__PURE__ */ jsx(ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsx(
4055
+ "textarea",
4056
+ {
4057
+ className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
4058
+ autoFocus: true,
4059
+ placeholder: "Enter your message...",
4060
+ name: "",
4061
+ id: ""
4062
+ }
4063
+ ) }),
4064
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(ComposerAction, {}) })
4065
+ ] }),
4066
+ !hasMemory && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
4067
+ /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(InfoIcon, {}) }),
4068
+ "Memory is not enabled. The conversation will not be persisted."
4069
+ ] })
3979
4070
  ] });
3980
4071
  };
3981
4072
  const ComposerAction = () => {
@@ -4407,7 +4498,7 @@ const AgentChat = ({
4407
4498
  modelSettings,
4408
4499
  chatWithGenerate,
4409
4500
  runtimeContext,
4410
- children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "" }) })
4501
+ children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "", hasMemory: memory }) })
4411
4502
  }
4412
4503
  );
4413
4504
  };
@@ -4467,18 +4558,18 @@ function FormattedDate({ date }) {
4467
4558
  }
4468
4559
 
4469
4560
  const inputVariants = cva(
4470
- "flex w-full text-mastra-el-6 rounded-sm border bg-transparent shadow-sm focus-visible:ring-ring transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",
4561
+ "flex w-full text-icon6 rounded-lg border bg-transparent shadow-sm focus-visible:ring-ring transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",
4471
4562
  {
4472
4563
  variants: {
4473
4564
  variant: {
4474
- default: "border-mastra-border-1 border-border-1 placeholder:text-muted-foreground",
4475
- filled: "bg-inputFill border-border-1 placeholder:text-muted-foreground",
4476
- unstyled: "border-0 bg-transparent placeholder:text-muted-foreground focus-visible:ring-transparent focus-visible:outline-none"
4565
+ default: "border-sm border-border1 placeholder:text-icon3",
4566
+ filled: "border-sm bg-inputFill border-border1 placeholder:text-icon3",
4567
+ unstyled: "border-0 bg-transparent placeholder:text-icon3 focus-visible:ring-transparent focus-visible:outline-none"
4477
4568
  },
4478
4569
  customSize: {
4479
- default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-[34px]",
4570
+ default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-8",
4480
4571
  sm: "h-[30px] px-[13px] text-xs",
4481
- lg: "h-10 px-[17px] rounded-md text-[calc(13_/_16_*_1rem)]"
4572
+ lg: "h-10 px-[17px] text-[calc(13_/_16_*_1rem)]"
4482
4573
  }
4483
4574
  },
4484
4575
  defaultVariants: {
@@ -4957,20 +5048,6 @@ const Row = ({ className, children, selected = false, onClick }) => {
4957
5048
  );
4958
5049
  };
4959
5050
 
4960
- const variants = {
4961
- "header-md": "text-header-md leading-header-md",
4962
- "ui-lg": "text-ui-lg leading-ui-lg",
4963
- "ui-md": "text-ui-md leading-ui-md",
4964
- "ui-sm": "text-ui-sm leading-ui-sm",
4965
- "ui-xs": "text-ui-xs leading-ui-xs"
4966
- };
4967
- const fonts = {
4968
- mono: "font-mono"
4969
- };
4970
- const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
4971
- return /* @__PURE__ */ jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
4972
- };
4973
-
4974
5051
  const formatDateCell = (date) => {
4975
5052
  const month = new Intl.DateTimeFormat("en-US", { month: "short" }).format(date).toUpperCase();
4976
5053
  const day = date.getDate();
@@ -6152,7 +6229,7 @@ function WorkflowTracesInner({ traces, isLoading, error }) {
6152
6229
  ] });
6153
6230
  }
6154
6231
 
6155
- const sanitizeVNexWorkflowWatchResult = (record) => {
6232
+ const sanitizeWorkflowWatchResult = (record) => {
6156
6233
  const formattedResults = Object.entries(record.payload.workflowState.steps || {}).reduce(
6157
6234
  (acc, [key, value]) => {
6158
6235
  let output = value.status === "success" ? value.output : void 0;
@@ -6187,8 +6264,8 @@ const sanitizeVNexWorkflowWatchResult = (record) => {
6187
6264
  };
6188
6265
  return sanitizedRecord;
6189
6266
  };
6190
- const useWorkflow = (workflowId, baseUrl) => {
6191
- const [workflow, setWorkflow] = useState(null);
6267
+ const useLegacyWorkflow = (workflowId, baseUrl) => {
6268
+ const [legacyWorkflow, setLegacyWorkflow] = useState(null);
6192
6269
  const [isLoading, setIsLoading] = useState(true);
6193
6270
  const client = createMastraClient(baseUrl);
6194
6271
  useEffect(() => {
@@ -6196,22 +6273,22 @@ const useWorkflow = (workflowId, baseUrl) => {
6196
6273
  setIsLoading(true);
6197
6274
  try {
6198
6275
  if (!workflowId) {
6199
- setWorkflow(null);
6276
+ setLegacyWorkflow(null);
6200
6277
  setIsLoading(false);
6201
6278
  return;
6202
6279
  }
6203
- const res = await client.getWorkflow(workflowId).details();
6280
+ const res = await client.getLegacyWorkflow(workflowId).details();
6204
6281
  if (!res) {
6205
- setWorkflow(null);
6206
- console.error("Error fetching workflow");
6207
- toast.error("Error fetching workflow");
6282
+ setLegacyWorkflow(null);
6283
+ console.error("Error fetching legacy workflow");
6284
+ toast.error("Error fetching legacy workflow");
6208
6285
  return;
6209
6286
  }
6210
6287
  const steps = res.steps;
6211
6288
  const stepsWithWorkflow = await Promise.all(
6212
6289
  Object.values(steps)?.map(async (step) => {
6213
6290
  if (!step.workflowId) return step;
6214
- const wFlow = await client.getWorkflow(step.workflowId).details();
6291
+ const wFlow = await client.getLegacyWorkflow(step.workflowId).details();
6215
6292
  if (!wFlow) return step;
6216
6293
  return { ...step, stepGraph: wFlow.stepGraph, stepSubscriberGraph: wFlow.stepSubscriberGraph };
6217
6294
  })
@@ -6219,21 +6296,21 @@ const useWorkflow = (workflowId, baseUrl) => {
6219
6296
  const _steps = stepsWithWorkflow.reduce((acc, b) => {
6220
6297
  return { ...acc, [b.id]: b };
6221
6298
  }, {});
6222
- setWorkflow({ ...res, steps: _steps });
6299
+ setLegacyWorkflow({ ...res, steps: _steps });
6223
6300
  } catch (error) {
6224
- setWorkflow(null);
6225
- console.error("Error fetching workflow", error);
6226
- toast.error("Error fetching workflow");
6301
+ setLegacyWorkflow(null);
6302
+ console.error("Error fetching legacy workflow", error);
6303
+ toast.error("Error fetching legacy workflow");
6227
6304
  } finally {
6228
6305
  setIsLoading(false);
6229
6306
  }
6230
6307
  };
6231
6308
  fetchWorkflow();
6232
6309
  }, [workflowId]);
6233
- return { workflow, isLoading };
6310
+ return { legacyWorkflow, isLoading };
6234
6311
  };
6235
- const useVNextWorkflow = (workflowId, baseUrl) => {
6236
- const [vNextWorkflow, setVNextWorkflow] = useState(null);
6312
+ const useWorkflow = (workflowId, baseUrl) => {
6313
+ const [workflow, setWorkflow] = useState(null);
6237
6314
  const [isLoading, setIsLoading] = useState(true);
6238
6315
  const client = createMastraClient(baseUrl);
6239
6316
  useEffect(() => {
@@ -6241,14 +6318,14 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
6241
6318
  setIsLoading(true);
6242
6319
  try {
6243
6320
  if (!workflowId) {
6244
- setVNextWorkflow(null);
6321
+ setWorkflow(null);
6245
6322
  setIsLoading(false);
6246
6323
  return;
6247
6324
  }
6248
- const res = await client.getVNextWorkflow(workflowId).details();
6249
- setVNextWorkflow(res);
6325
+ const res = await client.getWorkflow(workflowId).details();
6326
+ setWorkflow(res);
6250
6327
  } catch (error) {
6251
- setVNextWorkflow(null);
6328
+ setWorkflow(null);
6252
6329
  console.error("Error fetching workflow", error);
6253
6330
  toast.error("Error fetching workflow");
6254
6331
  } finally {
@@ -6257,13 +6334,13 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
6257
6334
  };
6258
6335
  fetchWorkflow();
6259
6336
  }, [workflowId]);
6260
- return { vNextWorkflow, isLoading };
6337
+ return { workflow, isLoading };
6261
6338
  };
6262
6339
  const useExecuteWorkflow = (baseUrl) => {
6263
6340
  const client = createMastraClient(baseUrl);
6264
- const createWorkflowRun = async ({ workflowId, prevRunId }) => {
6341
+ const createLegacyWorkflowRun = async ({ workflowId, prevRunId }) => {
6265
6342
  try {
6266
- const workflow = client.getWorkflow(workflowId);
6343
+ const workflow = client.getLegacyWorkflow(workflowId);
6267
6344
  const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
6268
6345
  return { runId: newRunId };
6269
6346
  } catch (error) {
@@ -6271,9 +6348,9 @@ const useExecuteWorkflow = (baseUrl) => {
6271
6348
  throw error;
6272
6349
  }
6273
6350
  };
6274
- const createVNextWorkflowRun = async ({ workflowId, prevRunId }) => {
6351
+ const createWorkflowRun = async ({ workflowId, prevRunId }) => {
6275
6352
  try {
6276
- const workflow = client.getVNextWorkflow(workflowId);
6353
+ const workflow = client.getWorkflow(workflowId);
6277
6354
  const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
6278
6355
  return { runId: newRunId };
6279
6356
  } catch (error) {
@@ -6281,16 +6358,20 @@ const useExecuteWorkflow = (baseUrl) => {
6281
6358
  throw error;
6282
6359
  }
6283
6360
  };
6284
- const startWorkflowRun = async ({ workflowId, runId, input }) => {
6361
+ const startLegacyWorkflowRun = async ({
6362
+ workflowId,
6363
+ runId,
6364
+ input
6365
+ }) => {
6285
6366
  try {
6286
- const workflow = client.getWorkflow(workflowId);
6367
+ const workflow = client.getLegacyWorkflow(workflowId);
6287
6368
  await workflow.start({ runId, triggerData: input || {} });
6288
6369
  } catch (error) {
6289
6370
  console.error("Error starting workflow run:", error);
6290
6371
  throw error;
6291
6372
  }
6292
6373
  };
6293
- const startVNextWorkflowRun = async ({
6374
+ const startWorkflowRun = async ({
6294
6375
  workflowId,
6295
6376
  runId,
6296
6377
  input,
@@ -6301,14 +6382,14 @@ const useExecuteWorkflow = (baseUrl) => {
6301
6382
  Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
6302
6383
  runtimeContext.set(key, value);
6303
6384
  });
6304
- const workflow = client.getVNextWorkflow(workflowId);
6385
+ const workflow = client.getWorkflow(workflowId);
6305
6386
  await workflow.start({ runId, inputData: input || {}, runtimeContext });
6306
6387
  } catch (error) {
6307
6388
  console.error("Error starting workflow run:", error);
6308
6389
  throw error;
6309
6390
  }
6310
6391
  };
6311
- const startAsyncVNextWorkflowRun = async ({
6392
+ const startAsyncWorkflowRun = async ({
6312
6393
  workflowId,
6313
6394
  runId,
6314
6395
  input,
@@ -6319,7 +6400,7 @@ const useExecuteWorkflow = (baseUrl) => {
6319
6400
  Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
6320
6401
  runtimeContext.set(key, value);
6321
6402
  });
6322
- const workflow = client.getVNextWorkflow(workflowId);
6403
+ const workflow = client.getWorkflow(workflowId);
6323
6404
  const result = await workflow.startAsync({ runId, inputData: input || {}, runtimeContext });
6324
6405
  return result;
6325
6406
  } catch (error) {
@@ -6330,17 +6411,17 @@ const useExecuteWorkflow = (baseUrl) => {
6330
6411
  return {
6331
6412
  startWorkflowRun,
6332
6413
  createWorkflowRun,
6333
- startVNextWorkflowRun,
6334
- createVNextWorkflowRun,
6335
- startAsyncVNextWorkflowRun
6414
+ startLegacyWorkflowRun,
6415
+ createLegacyWorkflowRun,
6416
+ startAsyncWorkflowRun
6336
6417
  };
6337
6418
  };
6338
6419
  const useWatchWorkflow = (baseUrl) => {
6420
+ const [isWatchingLegacyWorkflow, setIsWatchingLegacyWorkflow] = useState(false);
6339
6421
  const [isWatchingWorkflow, setIsWatchingWorkflow] = useState(false);
6340
- const [isWatchingVNextWorkflow, setIsWatchingVNextWorkflow] = useState(false);
6422
+ const [legacyWatchResult, setLegacyWatchResult] = useState(null);
6341
6423
  const [watchResult, setWatchResult] = useState(null);
6342
- const [watchVNextResult, setWatchVNextResult] = useState(null);
6343
- const debouncedSetWatchResult = useDebouncedCallback((record) => {
6424
+ const debouncedSetLegacyWorkflowWatchResult = useDebouncedCallback((record) => {
6344
6425
  const formattedResults = Object.entries(record.results || {}).reduce(
6345
6426
  (acc, [key, value]) => {
6346
6427
  let output = value.status === "success" ? value.output : void 0;
@@ -6363,19 +6444,19 @@ const useWatchWorkflow = (baseUrl) => {
6363
6444
  ...record,
6364
6445
  sanitizedOutput: record ? JSON.stringify({ ...record, results: formattedResults }, null, 2).slice(0, 5e4) : null
6365
6446
  };
6366
- setWatchResult(sanitizedRecord);
6447
+ setLegacyWatchResult(sanitizedRecord);
6367
6448
  }, 100);
6368
- const watchWorkflow = async ({ workflowId, runId }) => {
6449
+ const watchLegacyWorkflow = async ({ workflowId, runId }) => {
6369
6450
  try {
6370
- setIsWatchingWorkflow(true);
6451
+ setIsWatchingLegacyWorkflow(true);
6371
6452
  const client = createMastraClient(baseUrl);
6372
- const workflow = client.getWorkflow(workflowId);
6453
+ const workflow = client.getLegacyWorkflow(workflowId);
6373
6454
  await workflow.watch({ runId }, (record) => {
6374
6455
  try {
6375
- debouncedSetWatchResult(record);
6456
+ debouncedSetLegacyWorkflowWatchResult(record);
6376
6457
  } catch (err) {
6377
6458
  console.error("Error processing workflow record:", err);
6378
- setWatchResult({
6459
+ setLegacyWatchResult({
6379
6460
  ...record
6380
6461
  });
6381
6462
  }
@@ -6384,24 +6465,24 @@ const useWatchWorkflow = (baseUrl) => {
6384
6465
  console.error("Error watching workflow:", error);
6385
6466
  throw error;
6386
6467
  } finally {
6387
- setIsWatchingWorkflow(false);
6468
+ setIsWatchingLegacyWorkflow(false);
6388
6469
  }
6389
6470
  };
6390
- const debouncedSetVNextWatchResult = useDebouncedCallback((record) => {
6391
- const sanitizedRecord = sanitizeVNexWorkflowWatchResult(record);
6392
- setWatchVNextResult(sanitizedRecord);
6471
+ const debouncedSetWorkflowWatchResult = useDebouncedCallback((record) => {
6472
+ const sanitizedRecord = sanitizeWorkflowWatchResult(record);
6473
+ setWatchResult(sanitizedRecord);
6393
6474
  }, 100);
6394
- const watchVNextWorkflow = async ({ workflowId, runId }) => {
6475
+ const watchWorkflow = async ({ workflowId, runId }) => {
6395
6476
  try {
6396
- setIsWatchingVNextWorkflow(true);
6477
+ setIsWatchingWorkflow(true);
6397
6478
  const client = createMastraClient(baseUrl);
6398
- const workflow = client.getVNextWorkflow(workflowId);
6479
+ const workflow = client.getWorkflow(workflowId);
6399
6480
  await workflow.watch({ runId }, (record) => {
6400
6481
  try {
6401
- debouncedSetVNextWatchResult(record);
6482
+ debouncedSetWorkflowWatchResult(record);
6402
6483
  } catch (err) {
6403
6484
  console.error("Error processing workflow record:", err);
6404
- setWatchVNextResult({
6485
+ setWatchResult({
6405
6486
  ...record
6406
6487
  });
6407
6488
  }
@@ -6410,40 +6491,40 @@ const useWatchWorkflow = (baseUrl) => {
6410
6491
  console.error("Error watching workflow:", error);
6411
6492
  throw error;
6412
6493
  } finally {
6413
- setIsWatchingVNextWorkflow(false);
6494
+ setIsWatchingWorkflow(false);
6414
6495
  }
6415
6496
  };
6416
6497
  return {
6498
+ watchLegacyWorkflow,
6499
+ isWatchingLegacyWorkflow,
6500
+ legacyWatchResult,
6417
6501
  watchWorkflow,
6418
6502
  isWatchingWorkflow,
6419
- watchResult,
6420
- watchVNextWorkflow,
6421
- isWatchingVNextWorkflow,
6422
- watchVNextResult
6503
+ watchResult
6423
6504
  };
6424
6505
  };
6425
6506
  const useResumeWorkflow = (baseUrl) => {
6507
+ const [isResumingLegacyWorkflow, setIsResumingLegacyWorkflow] = useState(false);
6426
6508
  const [isResumingWorkflow, setIsResumingWorkflow] = useState(false);
6427
- const [isResumingVNextWorkflow, setIsResumingVNextWorkflow] = useState(false);
6428
- const resumeWorkflow = async ({
6509
+ const resumeLegacyWorkflow = async ({
6429
6510
  workflowId,
6430
6511
  stepId,
6431
6512
  runId,
6432
6513
  context
6433
6514
  }) => {
6434
6515
  try {
6435
- setIsResumingWorkflow(true);
6516
+ setIsResumingLegacyWorkflow(true);
6436
6517
  const client = createMastraClient(baseUrl);
6437
- const response = await client.getWorkflow(workflowId).resume({ stepId, runId, context });
6518
+ const response = await client.getLegacyWorkflow(workflowId).resume({ stepId, runId, context });
6438
6519
  return response;
6439
6520
  } catch (error) {
6440
6521
  console.error("Error resuming workflow:", error);
6441
6522
  throw error;
6442
6523
  } finally {
6443
- setIsResumingWorkflow(false);
6524
+ setIsResumingLegacyWorkflow(false);
6444
6525
  }
6445
6526
  };
6446
- const resumeVNextWorkflow = async ({
6527
+ const resumeWorkflow = async ({
6447
6528
  workflowId,
6448
6529
  step,
6449
6530
  runId,
@@ -6451,26 +6532,26 @@ const useResumeWorkflow = (baseUrl) => {
6451
6532
  runtimeContext: playgroundRuntimeContext
6452
6533
  }) => {
6453
6534
  try {
6454
- setIsResumingVNextWorkflow(true);
6535
+ setIsResumingWorkflow(true);
6455
6536
  const client = createMastraClient(baseUrl);
6456
6537
  const runtimeContext = new RuntimeContext$1();
6457
6538
  Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
6458
6539
  runtimeContext.set(key, value);
6459
6540
  });
6460
- const response = await client.getVNextWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext });
6541
+ const response = await client.getWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext });
6461
6542
  return response;
6462
6543
  } catch (error) {
6463
6544
  console.error("Error resuming workflow:", error);
6464
6545
  throw error;
6465
6546
  } finally {
6466
- setIsResumingVNextWorkflow(false);
6547
+ setIsResumingWorkflow(false);
6467
6548
  }
6468
6549
  };
6469
6550
  return {
6551
+ resumeLegacyWorkflow,
6552
+ isResumingLegacyWorkflow,
6470
6553
  resumeWorkflow,
6471
- isResumingWorkflow,
6472
- resumeVNextWorkflow,
6473
- isResumingVNextWorkflow
6554
+ isResumingWorkflow
6474
6555
  };
6475
6556
  };
6476
6557
 
@@ -6557,7 +6638,7 @@ const defaultEdgeOptions = {
6557
6638
  color: "#8e8e8e"
6558
6639
  }
6559
6640
  };
6560
- const contructNodesAndEdges = ({
6641
+ const contructLegacyNodesAndEdges = ({
6561
6642
  stepGraph,
6562
6643
  stepSubscriberGraph,
6563
6644
  steps: mainSteps = {}
@@ -7008,7 +7089,7 @@ const getStepNodeAndEdge = ({
7008
7089
  }
7009
7090
  return { nodes: [], edges: [], nextPrevNodeIds: [] };
7010
7091
  };
7011
- const constructVNextNodesAndEdges = ({
7092
+ const constructNodesAndEdges = ({
7012
7093
  stepGraph
7013
7094
  }) => {
7014
7095
  if (!stepGraph) {
@@ -7347,12 +7428,12 @@ function Spinner({ color = "#fff", className }) {
7347
7428
  );
7348
7429
  }
7349
7430
 
7350
- function WorkflowNestedGraph({
7431
+ function LegacyWorkflowNestedGraph({
7351
7432
  stepGraph,
7352
7433
  stepSubscriberGraph,
7353
7434
  open
7354
7435
  }) {
7355
- const { nodes: initialNodes, edges: initialEdges } = contructNodesAndEdges({
7436
+ const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
7356
7437
  stepGraph,
7357
7438
  stepSubscriberGraph
7358
7439
  });
@@ -7390,10 +7471,10 @@ function WorkflowNestedGraph({
7390
7471
  ) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) });
7391
7472
  }
7392
7473
 
7393
- const WorkflowNestedGraphContext = createContext(
7474
+ const LegacyWorkflowNestedGraphContext = createContext(
7394
7475
  {}
7395
7476
  );
7396
- function WorkflowNestedGraphProvider({ children }) {
7477
+ function LegacyWorkflowNestedGraphProvider({ children }) {
7397
7478
  const [stepGraph, setStepGraph] = useState(null);
7398
7479
  const [stepSubscriberGraph, setStepSubscriberGraph] = useState(null);
7399
7480
  const [openDialog, setOpenDialog] = useState(false);
@@ -7415,7 +7496,7 @@ function WorkflowNestedGraphProvider({ children }) {
7415
7496
  setOpenDialog(true);
7416
7497
  };
7417
7498
  return /* @__PURE__ */ jsxs(
7418
- WorkflowNestedGraphContext.Provider,
7499
+ LegacyWorkflowNestedGraphContext.Provider,
7419
7500
  {
7420
7501
  value: {
7421
7502
  showNestedGraph,
@@ -7431,16 +7512,23 @@ function WorkflowNestedGraphProvider({ children }) {
7431
7512
  " workflow"
7432
7513
  ] })
7433
7514
  ] }),
7434
- /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(WorkflowNestedGraph, { stepGraph, open: openDialog, stepSubscriberGraph }) })
7515
+ /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
7516
+ LegacyWorkflowNestedGraph,
7517
+ {
7518
+ stepGraph,
7519
+ open: openDialog,
7520
+ stepSubscriberGraph
7521
+ }
7522
+ ) })
7435
7523
  ] }) }) })
7436
7524
  ]
7437
7525
  }
7438
7526
  );
7439
7527
  }
7440
7528
 
7441
- function WorkflowNestedNode({ data }) {
7529
+ function LegacyWorkflowNestedNode({ data }) {
7442
7530
  const { label, withoutTopHandle, withoutBottomHandle, stepGraph, stepSubscriberGraph } = data;
7443
- const { showNestedGraph } = useContext(WorkflowNestedGraphContext);
7531
+ const { showNestedGraph } = useContext(LegacyWorkflowNestedGraphContext);
7444
7532
  return /* @__PURE__ */ jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
7445
7533
  !withoutTopHandle && /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style: { visibility: "hidden" } }),
7446
7534
  /* @__PURE__ */ jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph, stepSubscriberGraph }), children: /* @__PURE__ */ jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
@@ -7451,8 +7539,8 @@ function WorkflowNestedNode({ data }) {
7451
7539
  ] });
7452
7540
  }
7453
7541
 
7454
- function WorkflowGraphInner({ workflow }) {
7455
- const { nodes: initialNodes, edges: initialEdges } = contructNodesAndEdges({
7542
+ function LegacyWorkflowGraphInner({ workflow }) {
7543
+ const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
7456
7544
  stepGraph: workflow.serializedStepGraph || workflow.stepGraph,
7457
7545
  stepSubscriberGraph: workflow.serializedStepSubscriberGraph || workflow.stepSubscriberGraph,
7458
7546
  steps: workflow.steps
@@ -7464,7 +7552,7 @@ function WorkflowGraphInner({ workflow }) {
7464
7552
  "condition-node": WorkflowConditionNode,
7465
7553
  "after-node": WorkflowAfterNode,
7466
7554
  "loop-result-node": WorkflowLoopResultNode,
7467
- "nested-node": WorkflowNestedNode
7555
+ "nested-node": LegacyWorkflowNestedNode
7468
7556
  };
7469
7557
  return /* @__PURE__ */ jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxs(
7470
7558
  ReactFlow,
@@ -7491,12 +7579,12 @@ const lodashTitleCase = (str) => {
7491
7579
  return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
7492
7580
  };
7493
7581
 
7494
- function WorkflowGraph({ workflowId, baseUrl }) {
7495
- const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
7582
+ function LegacyWorkflowGraph({ workflowId, baseUrl }) {
7583
+ const { legacyWorkflow, isLoading } = useLegacyWorkflow(workflowId, baseUrl);
7496
7584
  if (isLoading) {
7497
7585
  return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[600px]" }) });
7498
7586
  }
7499
- if (!workflow) {
7587
+ if (!legacyWorkflow) {
7500
7588
  return /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
7501
7589
  /* @__PURE__ */ jsx(AlertCircleIcon, {}),
7502
7590
  /* @__PURE__ */ jsxs("div", { children: [
@@ -7506,28 +7594,24 @@ function WorkflowGraph({ workflowId, baseUrl }) {
7506
7594
  ] })
7507
7595
  ] }) });
7508
7596
  }
7509
- return /* @__PURE__ */ jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(WorkflowGraphInner, { workflow }) }) });
7597
+ return /* @__PURE__ */ jsx(LegacyWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(LegacyWorkflowGraphInner, { workflow: legacyWorkflow }) }) });
7510
7598
  }
7511
7599
 
7512
7600
  const Form = React__default.forwardRef(({ children, ...props }, ref) => {
7513
7601
  return /* @__PURE__ */ jsx("form", { ref, className: "space-y-4", ...props, children });
7514
7602
  });
7515
7603
 
7516
- const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
7517
- const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
7518
- Label.displayName = LabelPrimitive.Root.displayName;
7519
-
7520
7604
  const DISABLED_LABELS = ["boolean", "object", "array"];
7521
7605
  const FieldWrapper = ({ label, children, id, field, error }) => {
7522
7606
  const isDisabled = DISABLED_LABELS.includes(field.type);
7523
- return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
7524
- !isDisabled && /* @__PURE__ */ jsxs(Label, { htmlFor: id, children: [
7607
+ return /* @__PURE__ */ jsxs("div", { className: "pb-4 last:pb-0", children: [
7608
+ !isDisabled && /* @__PURE__ */ jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3 pb-1 block", htmlFor: id, children: [
7525
7609
  label,
7526
- field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive", children: " *" })
7610
+ field.required && /* @__PURE__ */ jsx("span", { className: "text-accent2", children: " *" })
7527
7611
  ] }),
7528
7612
  children,
7529
- field.fieldConfig?.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.fieldConfig.description }),
7530
- error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error })
7613
+ field.fieldConfig?.description && /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon6", children: field.fieldConfig.description }),
7614
+ error && /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-accent2", children: error })
7531
7615
  ] });
7532
7616
  };
7533
7617
 
@@ -7636,9 +7720,9 @@ const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ *
7636
7720
  defaultChecked: field.default
7637
7721
  }
7638
7722
  ),
7639
- /* @__PURE__ */ jsxs(Label, { htmlFor: id, children: [
7723
+ /* @__PURE__ */ jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3", htmlFor: id, children: [
7640
7724
  label,
7641
- field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive", children: " *" })
7725
+ field.required && /* @__PURE__ */ jsx("span", { className: "text-accent2", children: " *" })
7642
7726
  ] })
7643
7727
  ] });
7644
7728
 
@@ -7985,34 +8069,53 @@ const SelectField = ({ field, inputProps, error, id, value }) => {
7985
8069
  };
7986
8070
 
7987
8071
  const ObjectWrapper = ({ label, children }) => {
7988
- return /* @__PURE__ */ jsxs("div", { className: "space-y-4 border p-2 rounded-md", children: [
7989
- label === "​" ? /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: label }),
7990
- children
7991
- ] });
7992
- };
7993
-
7994
- const ArrayWrapper = ({ label, children, onAddItem }) => {
7995
- return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
7996
- /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: label }),
7997
- children,
8072
+ const hasLabel = label !== "" && label !== "";
8073
+ return /* @__PURE__ */ jsxs("div", { className: "", children: [
8074
+ hasLabel && /* @__PURE__ */ jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 flex items-center gap-1 pb-2", children: [
8075
+ /* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(Braces, {}) }),
8076
+ label
8077
+ ] }),
7998
8078
  /* @__PURE__ */ jsx(
7999
- Button$1,
8079
+ "div",
8000
8080
  {
8001
- className: "w-full flex items-center justify-center",
8002
- onClick: onAddItem,
8003
- variant: "outline",
8004
- size: "sm",
8005
- type: "button",
8006
- children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-4 w-4" })
8081
+ className: hasLabel ? "flex flex-col gap-1 [&>*]:border-dashed [&>*]:border-l [&>*]:border-l-border1 [&>*]:pl-4" : "",
8082
+ children
8007
8083
  }
8008
8084
  )
8009
8085
  ] });
8010
8086
  };
8011
8087
 
8088
+ const ArrayWrapper = ({ label, children, onAddItem }) => {
8089
+ return /* @__PURE__ */ jsxs("div", { children: [
8090
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2 justify-between", children: [
8091
+ /* @__PURE__ */ jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 pb-2 flex items-center gap-1", children: [
8092
+ /* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(Brackets, {}) }),
8093
+ label
8094
+ ] }),
8095
+ /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 0, children: [
8096
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
8097
+ "button",
8098
+ {
8099
+ onClick: onAddItem,
8100
+ type: "button",
8101
+ className: "text-icon3 bg-surface3 rounded-md p-1 hover:bg-surface4 hover:text-icon6 h-icon-sm w-icon-sm",
8102
+ children: /* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(PlusIcon, {}) })
8103
+ }
8104
+ ) }),
8105
+ /* @__PURE__ */ jsx(TooltipContent, { children: "Add item" })
8106
+ ] }) })
8107
+ ] }),
8108
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children })
8109
+ ] });
8110
+ };
8111
+
8012
8112
  const ArrayElementWrapper = ({ children, onRemove }) => {
8013
- return /* @__PURE__ */ jsxs("div", { className: "relative border p-4 rounded-md mt-2", children: [
8014
- /* @__PURE__ */ jsx(Button$1, { onClick: onRemove, variant: "ghost", className: "absolute top-2 right-2", type: "button", children: /* @__PURE__ */ jsx(TrashIcon, { className: "h-4 w-4" }) }),
8015
- children
8113
+ return /* @__PURE__ */ jsxs("div", { className: "pl-4 border-l border-border1", children: [
8114
+ children,
8115
+ /* @__PURE__ */ jsxs(Button, { onClick: onRemove, type: "button", children: [
8116
+ /* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(TrashIcon, {}) }),
8117
+ "Delete"
8118
+ ] })
8016
8119
  ] });
8017
8120
  };
8018
8121
 
@@ -8211,6 +8314,10 @@ class CustomZodProvider extends ZodProvider {
8211
8314
  }
8212
8315
  }
8213
8316
 
8317
+ const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
8318
+ const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
8319
+ Label.displayName = LabelPrimitive.Root.displayName;
8320
+
8214
8321
  function isEmptyZodObject(schema) {
8215
8322
  if (schema instanceof ZodObject) {
8216
8323
  return Object.keys(schema.shape).length === 0;
@@ -8222,7 +8329,7 @@ function DynamicForm({
8222
8329
  onSubmit,
8223
8330
  defaultValues,
8224
8331
  isSubmitLoading,
8225
- submitButtonLabel = "Submit"
8332
+ submitButtonLabel
8226
8333
  }) {
8227
8334
  if (!schema) {
8228
8335
  console.error("no form schema found");
@@ -8244,17 +8351,17 @@ function DynamicForm({
8244
8351
  },
8245
8352
  defaultValues: defaultValues ? { "​": defaultValues } : void 0,
8246
8353
  formProps: {
8247
- className: "space-y-4 p-4"
8354
+ className: ""
8248
8355
  },
8249
8356
  uiComponents: {
8250
- SubmitButton: ({ children }) => /* @__PURE__ */ jsx(Button$1, { className: "w-full", type: "submit", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : children || submitButtonLabel })
8357
+ SubmitButton: ({ children }) => /* @__PURE__ */ jsx(Button, { variant: "light", className: "w-full", size: "lg", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : submitButtonLabel || children })
8251
8358
  },
8252
8359
  formComponents: {
8253
8360
  Label: ({ value }) => /* @__PURE__ */ jsx(Label, { className: "text-sm font-normal", children: value })
8254
8361
  },
8255
8362
  withSubmit: true
8256
8363
  };
8257
- return /* @__PURE__ */ jsx(ScrollArea, { className: "h-full w-full", children: /* @__PURE__ */ jsx(AutoForm, { ...formProps }) });
8364
+ return /* @__PURE__ */ jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx(AutoForm, { ...formProps }) });
8258
8365
  }
8259
8366
 
8260
8367
  function resolveSerializedZodOutput(obj) {
@@ -8284,22 +8391,22 @@ function CodeBlockDemo({
8284
8391
 
8285
8392
  const WorkflowRunContext = createContext({});
8286
8393
  function WorkflowRunProvider({ children }) {
8394
+ const [legacyResult, setLegacyResult] = useState(null);
8287
8395
  const [result, setResult] = useState(null);
8288
- const [vNextResult, setVNextResult] = useState(null);
8289
8396
  const [payload, setPayload] = useState(null);
8290
8397
  const clearData = () => {
8398
+ setLegacyResult(null);
8291
8399
  setResult(null);
8292
- setVNextResult(null);
8293
8400
  setPayload(null);
8294
8401
  };
8295
8402
  return /* @__PURE__ */ jsx(
8296
8403
  WorkflowRunContext.Provider,
8297
8404
  {
8298
8405
  value: {
8406
+ legacyResult,
8407
+ setLegacyResult,
8299
8408
  result,
8300
8409
  setResult,
8301
- vNextResult,
8302
- setVNextResult,
8303
8410
  payload,
8304
8411
  setPayload,
8305
8412
  clearData
@@ -8309,16 +8416,81 @@ function WorkflowRunProvider({ children }) {
8309
8416
  );
8310
8417
  }
8311
8418
 
8312
- function WorkflowTrigger({
8419
+ const WorkflowCard = ({ header, children, footer }) => {
8420
+ return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border-sm border-border1 bg-surface4", children: [
8421
+ /* @__PURE__ */ jsx("div", { className: "py-1 px-2 flex items-center gap-3", children: header }),
8422
+ children && /* @__PURE__ */ jsx("div", { className: "border-t-sm border-border1", children }),
8423
+ footer && /* @__PURE__ */ jsx("div", { className: "py-1 px-2 border-t-sm border-border1", children: footer })
8424
+ ] });
8425
+ };
8426
+
8427
+ const LegacyWorkflowStatus = ({ stepId, pathStatus, path }) => {
8428
+ const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : pathStatus === "executing" ? "Executing" : "Completed";
8429
+ return /* @__PURE__ */ jsx(
8430
+ WorkflowCard,
8431
+ {
8432
+ header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
8433
+ /* @__PURE__ */ jsxs(Icon, { children: [
8434
+ status === "Completed" && /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }),
8435
+ status === "Failed" && /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }),
8436
+ status === "Executing" && /* @__PURE__ */ jsx(Loader2, { className: "text-icon3 animate-spin" })
8437
+ ] }),
8438
+ /* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: path })
8439
+ ] })
8440
+ }
8441
+ );
8442
+ };
8443
+
8444
+ const WorkflowResult = ({ jsonResult, sanitizedJsonResult }) => {
8445
+ const { handleCopy } = useCopyToClipboard({ text: jsonResult });
8446
+ const [expanded, setExpanded] = useState(false);
8447
+ return /* @__PURE__ */ jsx(
8448
+ WorkflowCard,
8449
+ {
8450
+ header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 justify-between w-full", children: [
8451
+ /* @__PURE__ */ jsxs(Txt, { variant: "ui-lg", className: "text-icon6 flex items-center gap-3 font-medium", children: [
8452
+ /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(DeploymentIcon, {}) }),
8453
+ "Results"
8454
+ ] }),
8455
+ /* @__PURE__ */ jsxs(Tooltip, { children: [
8456
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
8457
+ "button",
8458
+ {
8459
+ className: "p-2 rounded-lg hover:bg-surface5 transition-colors duration-150 ease-in-out text-icon3 hover:text-icon6",
8460
+ onClick: () => handleCopy(),
8461
+ children: /* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(CopyIcon, {}) })
8462
+ }
8463
+ ) }),
8464
+ /* @__PURE__ */ jsx(TooltipContent, { children: "Copy result" })
8465
+ ] })
8466
+ ] }),
8467
+ footer: /* @__PURE__ */ jsx(
8468
+ "button",
8469
+ {
8470
+ className: "w-full h-full text-center text-icon2 hover:text-icon6 text-ui-md",
8471
+ onClick: () => setExpanded((s) => !s),
8472
+ children: expanded ? "collapse" : "expand"
8473
+ }
8474
+ ),
8475
+ children: expanded ? /* @__PURE__ */ jsx(CodeBlockDemo, { className: "w-full overflow-x-auto", code: sanitizedJsonResult || jsonResult, language: "json" }) : null
8476
+ }
8477
+ );
8478
+ };
8479
+
8480
+ function LegacyWorkflowTrigger({
8313
8481
  workflowId,
8314
8482
  baseUrl,
8315
8483
  setRunId
8316
8484
  }) {
8317
- const { result, setResult, payload, setPayload } = useContext(WorkflowRunContext);
8318
- const { isLoading, workflow } = useWorkflow(workflowId, baseUrl);
8319
- const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
8320
- const { watchWorkflow, watchResult, isWatchingWorkflow } = useWatchWorkflow(baseUrl);
8321
- const { resumeWorkflow, isResumingWorkflow } = useResumeWorkflow(baseUrl);
8485
+ const { legacyResult: result, setLegacyResult: setResult, payload, setPayload } = useContext(WorkflowRunContext);
8486
+ const { isLoading, legacyWorkflow: workflow } = useLegacyWorkflow(workflowId, baseUrl);
8487
+ const { createLegacyWorkflowRun: createWorkflowRun, startLegacyWorkflowRun: startWorkflowRun } = useExecuteWorkflow(baseUrl);
8488
+ const {
8489
+ watchLegacyWorkflow: watchWorkflow,
8490
+ legacyWatchResult: watchResult,
8491
+ isWatchingLegacyWorkflow: isWatchingWorkflow
8492
+ } = useWatchWorkflow(baseUrl);
8493
+ const { resumeLegacyWorkflow: resumeWorkflow, isResumingLegacyWorkflow: isResumingWorkflow } = useResumeWorkflow(baseUrl);
8322
8494
  const [suspendedSteps, setSuspendedSteps] = useState([]);
8323
8495
  const [isRunning, setIsRunning] = useState(false);
8324
8496
  const triggerSchema = workflow?.triggerSchema;
@@ -8349,7 +8521,7 @@ function WorkflowTrigger({
8349
8521
  });
8350
8522
  };
8351
8523
  const watchResultToUse = result ?? watchResult;
8352
- const workflowActivePaths = watchResultToUse?.activePaths ?? [];
8524
+ const workflowActivePaths = watchResultToUse?.activePaths ?? {};
8353
8525
  useEffect(() => {
8354
8526
  setIsRunning(isWatchingWorkflow);
8355
8527
  }, [isWatchingWorkflow]);
@@ -8377,50 +8549,34 @@ function WorkflowTrigger({
8377
8549
  const isSuspendedSteps = suspendedSteps.length > 0;
8378
8550
  const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(triggerSchema))) : null;
8379
8551
  const { sanitizedOutput, ...restResult } = result ?? {};
8380
- return /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs w-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
8381
- !isSuspendedSteps && /* @__PURE__ */ jsx(Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
8382
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full", children: [
8383
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Input" }),
8384
- isResumingWorkflow ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
8385
- /* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8386
- " Resuming workflow"
8387
- ] }) : /* @__PURE__ */ jsx(Fragment, {})
8388
- ] }),
8389
- /* @__PURE__ */ jsx(
8390
- DynamicForm,
8391
- {
8392
- schema: zodInputSchema,
8393
- defaultValues: payload,
8394
- isSubmitLoading: isWatchingWorkflow,
8395
- onSubmit: (data) => {
8396
- setPayload(data);
8397
- handleExecuteWorkflow(data);
8398
- }
8399
- }
8400
- )
8401
- ] }) : /* @__PURE__ */ jsxs("div", { className: "px-4 space-y-4", children: [
8402
- isResumingWorkflow ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
8403
- /* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8404
- " Resuming workflow"
8405
- ] }) : /* @__PURE__ */ jsx(Fragment, {}),
8406
- /* @__PURE__ */ jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
8407
- ] }) }),
8408
- Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8409
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
8410
- /* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
8411
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
8412
- const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : "Completed";
8413
- const statusIcon = status === "Completed" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "Failed" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
8414
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxs("div", { className: `flex items-center justify-between p-3`, children: [
8415
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: path.charAt(0).toUpperCase() + path.slice(1) }),
8416
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
8417
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
8418
- status
8419
- ] })
8420
- ] }) }, idx);
8421
- }) });
8422
- }) })
8552
+ const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
8553
+ return /* @__PURE__ */ jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
8554
+ isResumingWorkflow && /* @__PURE__ */ jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
8555
+ /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin text-icon6" }) }),
8556
+ /* @__PURE__ */ jsx(Txt, { children: "Resuming workflow" })
8423
8557
  ] }),
8558
+ !isSuspendedSteps && /* @__PURE__ */ jsx(Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsx(
8559
+ DynamicForm,
8560
+ {
8561
+ schema: zodInputSchema,
8562
+ defaultValues: payload,
8563
+ isSubmitLoading: isWatchingWorkflow,
8564
+ submitButtonLabel: "Run",
8565
+ onSubmit: (data) => {
8566
+ setPayload(data);
8567
+ handleExecuteWorkflow(data);
8568
+ }
8569
+ }
8570
+ ) : /* @__PURE__ */ jsx(
8571
+ Button,
8572
+ {
8573
+ className: "w-full",
8574
+ variant: "light",
8575
+ disabled: isRunning,
8576
+ onClick: () => handleExecuteWorkflow(null),
8577
+ children: isRunning ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : "Trigger"
8578
+ }
8579
+ ) }),
8424
8580
  isSuspendedSteps && suspendedSteps?.map((step) => {
8425
8581
  const stepDefinition = workflow.steps[step.stepId];
8426
8582
  const stepSchema = stepDefinition?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(stepDefinition.inputSchema))) : z.record(z.string(), z.any());
@@ -8452,29 +8608,23 @@ function WorkflowTrigger({
8452
8608
  )
8453
8609
  ] });
8454
8610
  }),
8455
- result && /* @__PURE__ */ jsxs("div", { className: "flex flex-col group relative", children: [
8456
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Output" }),
8457
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx(
8458
- CopyButton,
8459
- {
8460
- classname: "absolute z-40 w-8 h-8 p-0 transition-opacity duration-150 ease-in-out opacity-0 top-4 right-4 group-hover:opacity-100",
8461
- content: JSON.stringify(restResult, null, 2)
8462
- }
8463
- ) }),
8464
- /* @__PURE__ */ jsx(
8465
- CodeBlockDemo,
8466
- {
8467
- className: "w-full overflow-x-auto",
8468
- code: sanitizedOutput || JSON.stringify(restResult, null, 2),
8469
- language: "json"
8470
- }
8471
- )
8611
+ hasWorkflowActivePaths && /* @__PURE__ */ jsxs(Fragment, { children: [
8612
+ /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
8613
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
8614
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
8615
+ return /* @__PURE__ */ jsx(LegacyWorkflowStatus, { stepId, pathStatus, path }, idx);
8616
+ }) }, stepId);
8617
+ }) })
8618
+ ] }),
8619
+ result && /* @__PURE__ */ jsxs(Fragment, { children: [
8620
+ /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
8621
+ /* @__PURE__ */ jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
8472
8622
  ] })
8473
8623
  ] }) });
8474
8624
  }
8475
8625
 
8476
- function VNextWorkflowNestedGraph({ stepGraph, open }) {
8477
- const { nodes: initialNodes, edges: initialEdges } = constructVNextNodesAndEdges({
8626
+ function WorkflowNestedGraph({ stepGraph, open }) {
8627
+ const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges({
8478
8628
  stepGraph
8479
8629
  });
8480
8630
  const [isMounted, setIsMounted] = useState(false);
@@ -8485,7 +8635,7 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
8485
8635
  "condition-node": WorkflowConditionNode,
8486
8636
  "after-node": WorkflowAfterNode,
8487
8637
  "loop-result-node": WorkflowLoopResultNode,
8488
- "nested-node": VNextWorkflowNestedNode
8638
+ "nested-node": WorkflowNestedNode
8489
8639
  };
8490
8640
  useEffect(() => {
8491
8641
  if (open) {
@@ -8512,10 +8662,10 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
8512
8662
  ) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) });
8513
8663
  }
8514
8664
 
8515
- const VNextWorkflowNestedGraphContext = createContext(
8665
+ const WorkflowNestedGraphContext = createContext(
8516
8666
  {}
8517
8667
  );
8518
- function VNextWorkflowNestedGraphProvider({ children }) {
8668
+ function WorkflowNestedGraphProvider({ children }) {
8519
8669
  const [stepGraph, setStepGraph] = useState(null);
8520
8670
  const [parentStepGraphList, setParentStepGraphList] = useState([]);
8521
8671
  const [openDialog, setOpenDialog] = useState(false);
@@ -8553,7 +8703,7 @@ function VNextWorkflowNestedGraphProvider({ children }) {
8553
8703
  }, 500);
8554
8704
  };
8555
8705
  return /* @__PURE__ */ jsxs(
8556
- VNextWorkflowNestedGraphContext.Provider,
8706
+ WorkflowNestedGraphContext.Provider,
8557
8707
  {
8558
8708
  value: {
8559
8709
  showNestedGraph,
@@ -8569,16 +8719,16 @@ function VNextWorkflowNestedGraphProvider({ children }) {
8569
8719
  " workflow"
8570
8720
  ] })
8571
8721
  ] }),
8572
- switching ? /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(VNextWorkflowNestedGraph, { stepGraph, open: openDialog }) })
8722
+ switching ? /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(WorkflowNestedGraph, { stepGraph, open: openDialog }) })
8573
8723
  ] }) }) })
8574
8724
  ]
8575
8725
  }
8576
8726
  );
8577
8727
  }
8578
8728
 
8579
- function VNextWorkflowNestedNode({ data }) {
8729
+ function WorkflowNestedNode({ data }) {
8580
8730
  const { label, withoutTopHandle, withoutBottomHandle, stepGraph } = data;
8581
- const { showNestedGraph } = useContext(VNextWorkflowNestedGraphContext);
8731
+ const { showNestedGraph } = useContext(WorkflowNestedGraphContext);
8582
8732
  return /* @__PURE__ */ jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
8583
8733
  !withoutTopHandle && /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style: { visibility: "hidden" } }),
8584
8734
  /* @__PURE__ */ jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph }), children: /* @__PURE__ */ jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
@@ -8589,8 +8739,8 @@ function VNextWorkflowNestedNode({ data }) {
8589
8739
  ] });
8590
8740
  }
8591
8741
 
8592
- function VNextWorkflowGraphInner({ workflow }) {
8593
- const { nodes: initialNodes, edges: initialEdges } = constructVNextNodesAndEdges(workflow);
8742
+ function WorkflowGraphInner({ workflow }) {
8743
+ const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges(workflow);
8594
8744
  const [nodes, _, onNodesChange] = useNodesState(initialNodes);
8595
8745
  const [edges] = useEdgesState(initialEdges);
8596
8746
  const nodeTypes = {
@@ -8598,7 +8748,7 @@ function VNextWorkflowGraphInner({ workflow }) {
8598
8748
  "condition-node": WorkflowConditionNode,
8599
8749
  "after-node": WorkflowAfterNode,
8600
8750
  "loop-result-node": WorkflowLoopResultNode,
8601
- "nested-node": VNextWorkflowNestedNode
8751
+ "nested-node": WorkflowNestedNode
8602
8752
  };
8603
8753
  return /* @__PURE__ */ jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxs(
8604
8754
  ReactFlow,
@@ -8620,12 +8770,12 @@ function VNextWorkflowGraphInner({ workflow }) {
8620
8770
  ) });
8621
8771
  }
8622
8772
 
8623
- function VNextWorkflowGraph({ workflowId, baseUrl }) {
8624
- const { vNextWorkflow, isLoading } = useVNextWorkflow(workflowId, baseUrl);
8773
+ function WorkflowGraph({ workflowId, baseUrl }) {
8774
+ const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
8625
8775
  if (isLoading) {
8626
8776
  return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[600px]" }) });
8627
8777
  }
8628
- if (!vNextWorkflow) {
8778
+ if (!workflow) {
8629
8779
  return /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
8630
8780
  /* @__PURE__ */ jsx(AlertCircleIcon, {}),
8631
8781
  /* @__PURE__ */ jsxs("div", { children: [
@@ -8635,43 +8785,60 @@ function VNextWorkflowGraph({ workflowId, baseUrl }) {
8635
8785
  ] })
8636
8786
  ] }) });
8637
8787
  }
8638
- return /* @__PURE__ */ jsx(VNextWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(VNextWorkflowGraphInner, { workflow: vNextWorkflow }) }) });
8788
+ return /* @__PURE__ */ jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(WorkflowGraphInner, { workflow }) }) });
8639
8789
  }
8640
8790
 
8641
- function VNextWorkflowTrigger({
8791
+ const WorkflowStatus = ({ stepId, status }) => {
8792
+ return /* @__PURE__ */ jsx(
8793
+ WorkflowCard,
8794
+ {
8795
+ header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
8796
+ /* @__PURE__ */ jsxs(Icon, { children: [
8797
+ status === "success" && /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }),
8798
+ status === "failed" && /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }),
8799
+ status === "suspended" && /* @__PURE__ */ jsx(CirclePause, { className: "text-icon3" }),
8800
+ status === "running" && /* @__PURE__ */ jsx(Loader2, { className: "text-icon3 animate-spin" })
8801
+ ] }),
8802
+ /* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) })
8803
+ ] })
8804
+ }
8805
+ );
8806
+ };
8807
+
8808
+ function WorkflowTrigger({
8642
8809
  workflowId,
8643
8810
  baseUrl,
8644
8811
  setRunId
8645
8812
  }) {
8646
8813
  const { runtimeContext } = usePlaygroundStore();
8647
- const { vNextResult, setVNextResult, payload, setPayload } = useContext(WorkflowRunContext);
8648
- const { isLoading, vNextWorkflow } = useVNextWorkflow(workflowId, baseUrl);
8649
- const { createVNextWorkflowRun, startVNextWorkflowRun } = useExecuteWorkflow(baseUrl);
8650
- const { watchVNextWorkflow, watchVNextResult, isWatchingVNextWorkflow } = useWatchWorkflow(baseUrl);
8651
- const { resumeVNextWorkflow, isResumingVNextWorkflow } = useResumeWorkflow(baseUrl);
8814
+ const { result, setResult, payload, setPayload } = useContext(WorkflowRunContext);
8815
+ const { isLoading, workflow } = useWorkflow(workflowId, baseUrl);
8816
+ const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
8817
+ const { watchWorkflow, watchResult, isWatchingWorkflow } = useWatchWorkflow(baseUrl);
8818
+ const { resumeWorkflow, isResumingWorkflow } = useResumeWorkflow(baseUrl);
8652
8819
  const [suspendedSteps, setSuspendedSteps] = useState([]);
8653
8820
  const [isRunning, setIsRunning] = useState(false);
8654
- const triggerSchema = vNextWorkflow?.inputSchema;
8821
+ const triggerSchema = workflow?.inputSchema;
8655
8822
  const handleExecuteWorkflow = async (data) => {
8656
8823
  try {
8657
- if (!vNextWorkflow) return;
8824
+ if (!workflow) return;
8658
8825
  setIsRunning(true);
8659
- setVNextResult(null);
8660
- const { runId } = await createVNextWorkflowRun({ workflowId });
8826
+ setResult(null);
8827
+ const { runId } = await createWorkflowRun({ workflowId });
8661
8828
  setRunId?.(runId);
8662
- watchVNextWorkflow({ workflowId, runId });
8663
- startVNextWorkflowRun({ workflowId, runId, input: data, runtimeContext });
8829
+ watchWorkflow({ workflowId, runId });
8830
+ startWorkflowRun({ workflowId, runId, input: data, runtimeContext });
8664
8831
  } catch (err) {
8665
8832
  setIsRunning(false);
8666
8833
  toast.error("Error executing workflow");
8667
8834
  }
8668
8835
  };
8669
8836
  const handleResumeWorkflow = async (step) => {
8670
- if (!vNextWorkflow) return;
8837
+ if (!workflow) return;
8671
8838
  const { stepId, runId: prevRunId, resumeData } = step;
8672
- const { runId } = await createVNextWorkflowRun({ workflowId, prevRunId });
8673
- watchVNextWorkflow({ workflowId, runId });
8674
- await resumeVNextWorkflow({
8839
+ const { runId } = await createWorkflowRun({ workflowId, prevRunId });
8840
+ watchWorkflow({ workflowId, runId });
8841
+ await resumeWorkflow({
8675
8842
  step: stepId,
8676
8843
  runId,
8677
8844
  resumeData,
@@ -8679,78 +8846,65 @@ function VNextWorkflowTrigger({
8679
8846
  runtimeContext
8680
8847
  });
8681
8848
  };
8682
- const watchResultToUse = vNextResult ?? watchVNextResult;
8849
+ const watchResultToUse = result ?? watchResult;
8683
8850
  const workflowActivePaths = watchResultToUse?.payload?.workflowState?.steps ?? {};
8684
8851
  useEffect(() => {
8685
- setIsRunning(isWatchingVNextWorkflow);
8686
- }, [isWatchingVNextWorkflow]);
8852
+ setIsRunning(isWatchingWorkflow);
8853
+ }, [isWatchingWorkflow]);
8687
8854
  useEffect(() => {
8688
- if (!watchResultToUse?.payload?.workflowState?.steps || !vNextResult?.runId) return;
8855
+ if (!watchResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
8689
8856
  const suspended = Object.entries(watchResultToUse.payload.workflowState.steps).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
8690
8857
  stepId,
8691
- runId: vNextResult.runId,
8858
+ runId: result.runId,
8692
8859
  suspendPayload: payload2
8693
8860
  }));
8694
8861
  setSuspendedSteps(suspended);
8695
- }, [watchResultToUse, vNextResult]);
8862
+ }, [watchResultToUse, result]);
8696
8863
  useEffect(() => {
8697
- if (watchVNextResult) {
8698
- setVNextResult(watchVNextResult);
8864
+ if (watchResult) {
8865
+ setResult(watchResult);
8699
8866
  }
8700
- }, [watchVNextResult]);
8867
+ }, [watchResult]);
8701
8868
  if (isLoading) {
8702
8869
  return /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
8703
8870
  /* @__PURE__ */ jsx(Skeleton, { className: "h-10" }),
8704
8871
  /* @__PURE__ */ jsx(Skeleton, { className: "h-10" })
8705
8872
  ] }) });
8706
8873
  }
8707
- if (!vNextWorkflow) return null;
8874
+ if (!workflow) return null;
8708
8875
  const isSuspendedSteps = suspendedSteps.length > 0;
8709
8876
  const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(triggerSchema))) : null;
8710
- const { sanitizedOutput, ...restResult } = vNextResult ?? {};
8711
- return /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs w-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
8712
- !isSuspendedSteps && /* @__PURE__ */ jsx(Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
8713
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full", children: [
8714
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Input" }),
8715
- isResumingVNextWorkflow ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
8716
- /* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8717
- " Resuming workflow"
8718
- ] }) : /* @__PURE__ */ jsx(Fragment, {})
8719
- ] }),
8720
- /* @__PURE__ */ jsx(
8721
- DynamicForm,
8722
- {
8723
- schema: zodInputSchema,
8724
- defaultValues: payload,
8725
- isSubmitLoading: isWatchingVNextWorkflow,
8726
- onSubmit: (data) => {
8727
- setPayload(data);
8728
- handleExecuteWorkflow(data);
8729
- }
8730
- }
8731
- )
8732
- ] }) : /* @__PURE__ */ jsxs("div", { className: "px-4 space-y-4", children: [
8733
- isResumingVNextWorkflow ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
8734
- /* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8735
- " Resuming workflow"
8736
- ] }) : /* @__PURE__ */ jsx(Fragment, {}),
8737
- /* @__PURE__ */ jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
8738
- ] }) }),
8739
- Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8740
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
8741
- /* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
8742
- const statusIcon = status === "success" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "failed" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
8743
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxs("div", { className: `flex items-center justify-between p-3`, children: [
8744
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) }),
8745
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 capitalize", children: [
8746
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
8747
- status
8748
- ] })
8749
- ] }) }, stepId) });
8750
- }) })
8877
+ const { sanitizedOutput, ...restResult } = result ?? {};
8878
+ const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
8879
+ return /* @__PURE__ */ jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
8880
+ isResumingWorkflow && /* @__PURE__ */ jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
8881
+ /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin text-icon6" }) }),
8882
+ /* @__PURE__ */ jsx(Txt, { children: "Resuming workflow" })
8751
8883
  ] }),
8752
- !isWatchingVNextWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
8753
- const stepDefinition = vNextWorkflow.steps[step.stepId];
8884
+ !isSuspendedSteps && /* @__PURE__ */ jsx(Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsx(
8885
+ DynamicForm,
8886
+ {
8887
+ schema: zodInputSchema,
8888
+ defaultValues: payload,
8889
+ isSubmitLoading: isWatchingWorkflow,
8890
+ submitButtonLabel: "Run",
8891
+ onSubmit: (data) => {
8892
+ setPayload(data);
8893
+ handleExecuteWorkflow(data);
8894
+ }
8895
+ }
8896
+ ) : /* @__PURE__ */ jsx(
8897
+ Button,
8898
+ {
8899
+ className: "w-full",
8900
+ variant: "light",
8901
+ disabled: isRunning,
8902
+ onClick: () => handleExecuteWorkflow(null),
8903
+ children: isRunning ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : "Trigger"
8904
+ }
8905
+ ) }),
8906
+ !isWatchingWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
8907
+ const stepDefinition = workflow.steps[step.stepId];
8754
8908
  const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(stepDefinition.resumeSchema))) : z.record(z.string(), z.any());
8755
8909
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-4", children: [
8756
8910
  /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
@@ -8766,7 +8920,7 @@ function VNextWorkflowTrigger({
8766
8920
  DynamicForm,
8767
8921
  {
8768
8922
  schema: stepSchema,
8769
- isSubmitLoading: isResumingVNextWorkflow,
8923
+ isSubmitLoading: isResumingWorkflow,
8770
8924
  submitButtonLabel: "Resume",
8771
8925
  onSubmit: (data) => {
8772
8926
  handleResumeWorkflow({
@@ -8780,23 +8934,18 @@ function VNextWorkflowTrigger({
8780
8934
  )
8781
8935
  ] });
8782
8936
  }),
8783
- vNextResult && /* @__PURE__ */ jsxs("div", { className: "flex flex-col group relative", children: [
8784
- /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Output" }),
8785
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx(
8786
- CopyButton,
8787
- {
8788
- classname: "absolute z-40 w-8 h-8 p-0 transition-opacity duration-150 ease-in-out opacity-0 top-4 right-4 group-hover:opacity-100",
8789
- content: JSON.stringify(restResult, null, 2)
8790
- }
8791
- ) }),
8792
- /* @__PURE__ */ jsx(
8793
- CodeBlockDemo,
8794
- {
8795
- className: "w-full overflow-x-auto",
8796
- code: sanitizedOutput || JSON.stringify(restResult, null, 2),
8797
- language: "json"
8798
- }
8799
- )
8937
+ hasWorkflowActivePaths && /* @__PURE__ */ jsxs(Fragment, { children: [
8938
+ /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
8939
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8940
+ /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
8941
+ /* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
8942
+ return /* @__PURE__ */ jsx(WorkflowStatus, { stepId, status });
8943
+ }) })
8944
+ ] })
8945
+ ] }),
8946
+ result && /* @__PURE__ */ jsxs(Fragment, { children: [
8947
+ /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
8948
+ /* @__PURE__ */ jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
8800
8949
  ] })
8801
8950
  ] }) });
8802
8951
  }
@@ -8810,7 +8959,8 @@ const DataTable = ({
8810
8959
  getRowId,
8811
8960
  selectedRowId,
8812
8961
  isLoading,
8813
- emptyText
8962
+ emptyText,
8963
+ onClick
8814
8964
  }) => {
8815
8965
  const [sorting, setSorting] = useState([]);
8816
8966
  const [{ pageIndex, pageSize }, setPagination] = useState({
@@ -8852,7 +9002,16 @@ const DataTable = ({
8852
9002
  const meta = header.column.columnDef.meta;
8853
9003
  return /* @__PURE__ */ jsx(Th, { style: { width: meta?.width || size || "auto" }, children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
8854
9004
  }) }),
8855
- /* @__PURE__ */ jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsx(Row, { children: Array.from({ length: columns.length }).map((_2, cellIndex) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }, `row-${rowIndex}-cell-${cellIndex}`)) }, rowIndex)) }) : rows?.length > 0 ? rows.map((row) => /* @__PURE__ */ jsx(Row, { "data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected", children: row.getVisibleCells().map((cell) => flexRender(cell.column.columnDef.cell, cell.getContext())) }, row.id)) : emptyNode })
9005
+ /* @__PURE__ */ jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsx(Row, { onClick: () => {
9006
+ }, children: Array.from({ length: columns.length }).map((_2, cellIndex) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }, `row-${rowIndex}-cell-${cellIndex}`)) }, rowIndex)) }) : rows?.length > 0 ? rows.map((row) => /* @__PURE__ */ jsx(
9007
+ Row,
9008
+ {
9009
+ "data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected",
9010
+ onClick: () => onClick?.(row.original),
9011
+ children: row.getVisibleCells().map((cell) => flexRender(cell.column.columnDef.cell, cell.getContext()))
9012
+ },
9013
+ row.id
9014
+ )) : emptyNode })
8856
9015
  ] }),
8857
9016
  pagination && /* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center justify-between px-2", children: [
8858
9017
  /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground text-sm", children: [
@@ -9178,5 +9337,5 @@ const useTraces = (componentName, baseUrl, isWorkflow = false) => {
9178
9337
  return { traces, firstCallLoading, error };
9179
9338
  };
9180
9339
 
9181
- export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LogsIcon, MastraResizablePanel, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolsIcon, TraceContext, TraceIcon, TraceProvider, TsIcon, Txt, TxtCell, UnitCell, VNextWorkflowGraph, VNextWorkflowTrigger, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, usePlaygroundStore, usePolling, useTraces };
9340
+ export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraResizablePanel, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolsIcon, TraceContext, TraceIcon, TraceProvider, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, usePlaygroundStore, usePolling, useTraces };
9182
9341
  //# sourceMappingURL=index.es.js.map