@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.cjs.js CHANGED
@@ -41,13 +41,13 @@ const jsonSchemaToZod = require('json-schema-to-zod');
41
41
  const superjson = require('superjson');
42
42
  const z = require('zod');
43
43
  const react$3 = require('@autoform/react');
44
- const LabelPrimitive = require('@radix-ui/react-label');
45
44
  const CheckboxPrimitive = require('@radix-ui/react-checkbox');
46
45
  const reactDayPicker = require('react-day-picker');
47
46
  const PopoverPrimitive = require('@radix-ui/react-popover');
48
47
  const SelectPrimitive = require('@radix-ui/react-select');
49
48
  const uuid = require('@lukeed/uuid');
50
49
  const zod = require('@autoform/zod');
50
+ const LabelPrimitive = require('@radix-ui/react-label');
51
51
  const reactCodeBlock = require('react-code-block');
52
52
  const reactTable = require('@tanstack/react-table');
53
53
 
@@ -75,10 +75,10 @@ const TabsPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TabsPrimi
75
75
  const CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(CollapsiblePrimitive);
76
76
  const DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
77
77
  const ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(ScrollAreaPrimitive);
78
- const LabelPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(LabelPrimitive);
79
78
  const CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(CheckboxPrimitive);
80
79
  const PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(PopoverPrimitive);
81
80
  const SelectPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(SelectPrimitive);
81
+ const LabelPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(LabelPrimitive);
82
82
 
83
83
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
84
84
 
@@ -2922,6 +2922,46 @@ const AvatarFallback = React__namespace.forwardRef(({ className, ...props }, ref
2922
2922
  ));
2923
2923
  AvatarFallback.displayName = AvatarPrimitive__namespace.Fallback.displayName;
2924
2924
 
2925
+ const ImageWithFallback = ({ alt, src, ...rest }) => {
2926
+ const [error, setError] = React.useState(false);
2927
+ React.useEffect(() => {
2928
+ setError(false);
2929
+ }, [src]);
2930
+ return error || !src ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2931
+ /* @__PURE__ */ jsxRuntime.jsx(
2932
+ "svg",
2933
+ {
2934
+ xmlns: "http://www.w3.org/2000/svg",
2935
+ fill: "none",
2936
+ viewBox: "0 0 24 24",
2937
+ strokeWidth: "1.5",
2938
+ stroke: "currentColor",
2939
+ width: "150",
2940
+ height: "150",
2941
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2942
+ "path",
2943
+ {
2944
+ strokeLinecap: "round",
2945
+ strokeLinejoin: "round",
2946
+ 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"
2947
+ }
2948
+ )
2949
+ }
2950
+ ),
2951
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs italic text-muted-foreground -mt-[0.625rem] mb-[0.625rem]", children: "Image link is broken" })
2952
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
2953
+ "img",
2954
+ {
2955
+ src,
2956
+ alt,
2957
+ ...rest,
2958
+ onError: () => {
2959
+ setError(true);
2960
+ }
2961
+ }
2962
+ );
2963
+ };
2964
+
2925
2965
  const SyntaxHighlighter$2 = reactSyntaxHighlighter.makePrismAsyncSyntaxHighlighter({
2926
2966
  style: prism.coldarkDark,
2927
2967
  customStyle: {
@@ -3141,7 +3181,8 @@ const defaultComponents = reactMarkdown.unstable_memoizeMarkdownComponents({
3141
3181
  );
3142
3182
  },
3143
3183
  CodeHeader,
3144
- SyntaxHighlighter: SyntaxHighlighter$2
3184
+ SyntaxHighlighter: SyntaxHighlighter$2,
3185
+ img: ImageWithFallback
3145
3186
  });
3146
3187
 
3147
3188
  const sizes = {
@@ -3524,10 +3565,10 @@ const GithubIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "1
3524
3565
  "path",
3525
3566
  {
3526
3567
  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",
3527
- fill: "white"
3568
+ fill: "currentColor"
3528
3569
  }
3529
3570
  ) }),
3530
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "14", height: "14", fill: "white", transform: "translate(0.5 0.75)" }) }) })
3571
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "14", height: "14", fill: "currentColor", transform: "translate(0.5 0.75)" }) }) })
3531
3572
  ] });
3532
3573
 
3533
3574
  const GoogleIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
@@ -3756,7 +3797,7 @@ const WorkflowIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "
3756
3797
  fillRule: "evenodd",
3757
3798
  clipRule: "evenodd",
3758
3799
  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",
3759
- fill: "white"
3800
+ fill: "currentColor"
3760
3801
  }
3761
3802
  ) });
3762
3803
 
@@ -3818,6 +3859,33 @@ const LatencyIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "
3818
3859
  )
3819
3860
  ] });
3820
3861
 
3862
+ const McpServerIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
3863
+ /* @__PURE__ */ jsxRuntime.jsx(
3864
+ "path",
3865
+ {
3866
+ 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",
3867
+ fill: "currentColor"
3868
+ }
3869
+ ),
3870
+ /* @__PURE__ */ jsxRuntime.jsx(
3871
+ "path",
3872
+ {
3873
+ 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",
3874
+ fill: "currentColor"
3875
+ }
3876
+ )
3877
+ ] });
3878
+
3879
+ const FolderIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
3880
+ "path",
3881
+ {
3882
+ 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",
3883
+ stroke: "currentColor",
3884
+ strokeLinecap: "round",
3885
+ strokeLinejoin: "round"
3886
+ }
3887
+ ) });
3888
+
3821
3889
  const useCodemirrorTheme$1 = () => {
3822
3890
  return React.useMemo(
3823
3891
  () => codemirrorThemeDracula.draculaInit({
@@ -3889,7 +3957,10 @@ const AssistantMessage = ({
3889
3957
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
3890
3958
  react.MessagePrimitive.Content,
3891
3959
  {
3892
- components: { Text: MarkdownText, tools: { Fallback: ToolFallbackCustom || ToolFallback$1 } }
3960
+ components: {
3961
+ Text: MarkdownText,
3962
+ tools: { Fallback: ToolFallbackCustom || ToolFallback$1 }
3963
+ }
3893
3964
  }
3894
3965
  ) }),
3895
3966
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar, {}) })
@@ -3953,13 +4024,27 @@ const useAutoscroll = (ref, { enabled = true }) => {
3953
4024
  }, [enabled, ref]);
3954
4025
  };
3955
4026
 
3956
- const Thread = ({ ToolFallback, agentName }) => {
4027
+ const variants = {
4028
+ "header-md": "text-header-md leading-header-md",
4029
+ "ui-lg": "text-ui-lg leading-ui-lg",
4030
+ "ui-md": "text-ui-md leading-ui-md",
4031
+ "ui-sm": "text-ui-sm leading-ui-sm",
4032
+ "ui-xs": "text-ui-xs leading-ui-xs"
4033
+ };
4034
+ const fonts = {
4035
+ mono: "font-mono"
4036
+ };
4037
+ const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
4038
+ return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
4039
+ };
4040
+
4041
+ const Thread = ({ ToolFallback, agentName, hasMemory }) => {
3957
4042
  const areaRef = React.useRef(null);
3958
4043
  useAutoscroll(areaRef, { enabled: true });
3959
4044
  const WrappedAssistantMessage = (props) => {
3960
4045
  return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback });
3961
4046
  };
3962
- return /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-100px)] px-4", children: [
4047
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-110px)] px-4", children: [
3963
4048
  /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
3964
4049
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3965
4050
  /* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { agentName }),
@@ -3976,7 +4061,7 @@ const Thread = ({ ToolFallback, agentName }) => {
3976
4061
  ] }),
3977
4062
  /* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
3978
4063
  ] }),
3979
- /* @__PURE__ */ jsxRuntime.jsx(Composer, {})
4064
+ /* @__PURE__ */ jsxRuntime.jsx(Composer, { hasMemory })
3980
4065
  ] });
3981
4066
  };
3982
4067
  const ThreadWelcome = ({ agentName }) => {
@@ -3995,19 +4080,25 @@ const ThreadWelcome = ({ agentName }) => {
3995
4080
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
3996
4081
  ] }) });
3997
4082
  };
3998
- const Composer = () => {
3999
- return /* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
4000
- /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
4001
- "textarea",
4002
- {
4003
- className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
4004
- autoFocus: true,
4005
- placeholder: "Enter your message...",
4006
- name: "",
4007
- id: ""
4008
- }
4009
- ) }),
4010
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ComposerAction, {}) })
4083
+ const Composer = ({ hasMemory }) => {
4084
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4085
+ /* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
4086
+ /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
4087
+ "textarea",
4088
+ {
4089
+ className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
4090
+ autoFocus: true,
4091
+ placeholder: "Enter your message...",
4092
+ name: "",
4093
+ id: ""
4094
+ }
4095
+ ) }),
4096
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ComposerAction, {}) })
4097
+ ] }),
4098
+ !hasMemory && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
4099
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, {}) }),
4100
+ "Memory is not enabled. The conversation will not be persisted."
4101
+ ] })
4011
4102
  ] });
4012
4103
  };
4013
4104
  const ComposerAction = () => {
@@ -4439,7 +4530,7 @@ const AgentChat = ({
4439
4530
  modelSettings,
4440
4531
  chatWithGenerate,
4441
4532
  runtimeContext,
4442
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "" }) })
4533
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "", hasMemory: memory }) })
4443
4534
  }
4444
4535
  );
4445
4536
  };
@@ -4499,18 +4590,18 @@ function FormattedDate({ date }) {
4499
4590
  }
4500
4591
 
4501
4592
  const inputVariants = cva(
4502
- "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",
4593
+ "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",
4503
4594
  {
4504
4595
  variants: {
4505
4596
  variant: {
4506
- default: "border-mastra-border-1 border-border-1 placeholder:text-muted-foreground",
4507
- filled: "bg-inputFill border-border-1 placeholder:text-muted-foreground",
4508
- unstyled: "border-0 bg-transparent placeholder:text-muted-foreground focus-visible:ring-transparent focus-visible:outline-none"
4597
+ default: "border-sm border-border1 placeholder:text-icon3",
4598
+ filled: "border-sm bg-inputFill border-border1 placeholder:text-icon3",
4599
+ unstyled: "border-0 bg-transparent placeholder:text-icon3 focus-visible:ring-transparent focus-visible:outline-none"
4509
4600
  },
4510
4601
  customSize: {
4511
- default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-[34px]",
4602
+ default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-8",
4512
4603
  sm: "h-[30px] px-[13px] text-xs",
4513
- lg: "h-10 px-[17px] rounded-md text-[calc(13_/_16_*_1rem)]"
4604
+ lg: "h-10 px-[17px] text-[calc(13_/_16_*_1rem)]"
4514
4605
  }
4515
4606
  },
4516
4607
  defaultVariants: {
@@ -4989,20 +5080,6 @@ const Row = ({ className, children, selected = false, onClick }) => {
4989
5080
  );
4990
5081
  };
4991
5082
 
4992
- const variants = {
4993
- "header-md": "text-header-md leading-header-md",
4994
- "ui-lg": "text-ui-lg leading-ui-lg",
4995
- "ui-md": "text-ui-md leading-ui-md",
4996
- "ui-sm": "text-ui-sm leading-ui-sm",
4997
- "ui-xs": "text-ui-xs leading-ui-xs"
4998
- };
4999
- const fonts = {
5000
- mono: "font-mono"
5001
- };
5002
- const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
5003
- return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
5004
- };
5005
-
5006
5083
  const formatDateCell = (date) => {
5007
5084
  const month = new Intl.DateTimeFormat("en-US", { month: "short" }).format(date).toUpperCase();
5008
5085
  const day = date.getDate();
@@ -6184,7 +6261,7 @@ function WorkflowTracesInner({ traces, isLoading, error }) {
6184
6261
  ] });
6185
6262
  }
6186
6263
 
6187
- const sanitizeVNexWorkflowWatchResult = (record) => {
6264
+ const sanitizeWorkflowWatchResult = (record) => {
6188
6265
  const formattedResults = Object.entries(record.payload.workflowState.steps || {}).reduce(
6189
6266
  (acc, [key, value]) => {
6190
6267
  let output = value.status === "success" ? value.output : void 0;
@@ -6219,8 +6296,8 @@ const sanitizeVNexWorkflowWatchResult = (record) => {
6219
6296
  };
6220
6297
  return sanitizedRecord;
6221
6298
  };
6222
- const useWorkflow = (workflowId, baseUrl) => {
6223
- const [workflow, setWorkflow] = React.useState(null);
6299
+ const useLegacyWorkflow = (workflowId, baseUrl) => {
6300
+ const [legacyWorkflow, setLegacyWorkflow] = React.useState(null);
6224
6301
  const [isLoading, setIsLoading] = React.useState(true);
6225
6302
  const client = createMastraClient(baseUrl);
6226
6303
  React.useEffect(() => {
@@ -6228,22 +6305,22 @@ const useWorkflow = (workflowId, baseUrl) => {
6228
6305
  setIsLoading(true);
6229
6306
  try {
6230
6307
  if (!workflowId) {
6231
- setWorkflow(null);
6308
+ setLegacyWorkflow(null);
6232
6309
  setIsLoading(false);
6233
6310
  return;
6234
6311
  }
6235
- const res = await client.getWorkflow(workflowId).details();
6312
+ const res = await client.getLegacyWorkflow(workflowId).details();
6236
6313
  if (!res) {
6237
- setWorkflow(null);
6238
- console.error("Error fetching workflow");
6239
- sonner.toast.error("Error fetching workflow");
6314
+ setLegacyWorkflow(null);
6315
+ console.error("Error fetching legacy workflow");
6316
+ sonner.toast.error("Error fetching legacy workflow");
6240
6317
  return;
6241
6318
  }
6242
6319
  const steps = res.steps;
6243
6320
  const stepsWithWorkflow = await Promise.all(
6244
6321
  Object.values(steps)?.map(async (step) => {
6245
6322
  if (!step.workflowId) return step;
6246
- const wFlow = await client.getWorkflow(step.workflowId).details();
6323
+ const wFlow = await client.getLegacyWorkflow(step.workflowId).details();
6247
6324
  if (!wFlow) return step;
6248
6325
  return { ...step, stepGraph: wFlow.stepGraph, stepSubscriberGraph: wFlow.stepSubscriberGraph };
6249
6326
  })
@@ -6251,21 +6328,21 @@ const useWorkflow = (workflowId, baseUrl) => {
6251
6328
  const _steps = stepsWithWorkflow.reduce((acc, b) => {
6252
6329
  return { ...acc, [b.id]: b };
6253
6330
  }, {});
6254
- setWorkflow({ ...res, steps: _steps });
6331
+ setLegacyWorkflow({ ...res, steps: _steps });
6255
6332
  } catch (error) {
6256
- setWorkflow(null);
6257
- console.error("Error fetching workflow", error);
6258
- sonner.toast.error("Error fetching workflow");
6333
+ setLegacyWorkflow(null);
6334
+ console.error("Error fetching legacy workflow", error);
6335
+ sonner.toast.error("Error fetching legacy workflow");
6259
6336
  } finally {
6260
6337
  setIsLoading(false);
6261
6338
  }
6262
6339
  };
6263
6340
  fetchWorkflow();
6264
6341
  }, [workflowId]);
6265
- return { workflow, isLoading };
6342
+ return { legacyWorkflow, isLoading };
6266
6343
  };
6267
- const useVNextWorkflow = (workflowId, baseUrl) => {
6268
- const [vNextWorkflow, setVNextWorkflow] = React.useState(null);
6344
+ const useWorkflow = (workflowId, baseUrl) => {
6345
+ const [workflow, setWorkflow] = React.useState(null);
6269
6346
  const [isLoading, setIsLoading] = React.useState(true);
6270
6347
  const client = createMastraClient(baseUrl);
6271
6348
  React.useEffect(() => {
@@ -6273,14 +6350,14 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
6273
6350
  setIsLoading(true);
6274
6351
  try {
6275
6352
  if (!workflowId) {
6276
- setVNextWorkflow(null);
6353
+ setWorkflow(null);
6277
6354
  setIsLoading(false);
6278
6355
  return;
6279
6356
  }
6280
- const res = await client.getVNextWorkflow(workflowId).details();
6281
- setVNextWorkflow(res);
6357
+ const res = await client.getWorkflow(workflowId).details();
6358
+ setWorkflow(res);
6282
6359
  } catch (error) {
6283
- setVNextWorkflow(null);
6360
+ setWorkflow(null);
6284
6361
  console.error("Error fetching workflow", error);
6285
6362
  sonner.toast.error("Error fetching workflow");
6286
6363
  } finally {
@@ -6289,13 +6366,13 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
6289
6366
  };
6290
6367
  fetchWorkflow();
6291
6368
  }, [workflowId]);
6292
- return { vNextWorkflow, isLoading };
6369
+ return { workflow, isLoading };
6293
6370
  };
6294
6371
  const useExecuteWorkflow = (baseUrl) => {
6295
6372
  const client = createMastraClient(baseUrl);
6296
- const createWorkflowRun = async ({ workflowId, prevRunId }) => {
6373
+ const createLegacyWorkflowRun = async ({ workflowId, prevRunId }) => {
6297
6374
  try {
6298
- const workflow = client.getWorkflow(workflowId);
6375
+ const workflow = client.getLegacyWorkflow(workflowId);
6299
6376
  const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
6300
6377
  return { runId: newRunId };
6301
6378
  } catch (error) {
@@ -6303,9 +6380,9 @@ const useExecuteWorkflow = (baseUrl) => {
6303
6380
  throw error;
6304
6381
  }
6305
6382
  };
6306
- const createVNextWorkflowRun = async ({ workflowId, prevRunId }) => {
6383
+ const createWorkflowRun = async ({ workflowId, prevRunId }) => {
6307
6384
  try {
6308
- const workflow = client.getVNextWorkflow(workflowId);
6385
+ const workflow = client.getWorkflow(workflowId);
6309
6386
  const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
6310
6387
  return { runId: newRunId };
6311
6388
  } catch (error) {
@@ -6313,16 +6390,20 @@ const useExecuteWorkflow = (baseUrl) => {
6313
6390
  throw error;
6314
6391
  }
6315
6392
  };
6316
- const startWorkflowRun = async ({ workflowId, runId, input }) => {
6393
+ const startLegacyWorkflowRun = async ({
6394
+ workflowId,
6395
+ runId,
6396
+ input
6397
+ }) => {
6317
6398
  try {
6318
- const workflow = client.getWorkflow(workflowId);
6399
+ const workflow = client.getLegacyWorkflow(workflowId);
6319
6400
  await workflow.start({ runId, triggerData: input || {} });
6320
6401
  } catch (error) {
6321
6402
  console.error("Error starting workflow run:", error);
6322
6403
  throw error;
6323
6404
  }
6324
6405
  };
6325
- const startVNextWorkflowRun = async ({
6406
+ const startWorkflowRun = async ({
6326
6407
  workflowId,
6327
6408
  runId,
6328
6409
  input,
@@ -6333,14 +6414,14 @@ const useExecuteWorkflow = (baseUrl) => {
6333
6414
  Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
6334
6415
  runtimeContext$1.set(key, value);
6335
6416
  });
6336
- const workflow = client.getVNextWorkflow(workflowId);
6417
+ const workflow = client.getWorkflow(workflowId);
6337
6418
  await workflow.start({ runId, inputData: input || {}, runtimeContext: runtimeContext$1 });
6338
6419
  } catch (error) {
6339
6420
  console.error("Error starting workflow run:", error);
6340
6421
  throw error;
6341
6422
  }
6342
6423
  };
6343
- const startAsyncVNextWorkflowRun = async ({
6424
+ const startAsyncWorkflowRun = async ({
6344
6425
  workflowId,
6345
6426
  runId,
6346
6427
  input,
@@ -6351,7 +6432,7 @@ const useExecuteWorkflow = (baseUrl) => {
6351
6432
  Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
6352
6433
  runtimeContext$1.set(key, value);
6353
6434
  });
6354
- const workflow = client.getVNextWorkflow(workflowId);
6435
+ const workflow = client.getWorkflow(workflowId);
6355
6436
  const result = await workflow.startAsync({ runId, inputData: input || {}, runtimeContext: runtimeContext$1 });
6356
6437
  return result;
6357
6438
  } catch (error) {
@@ -6362,17 +6443,17 @@ const useExecuteWorkflow = (baseUrl) => {
6362
6443
  return {
6363
6444
  startWorkflowRun,
6364
6445
  createWorkflowRun,
6365
- startVNextWorkflowRun,
6366
- createVNextWorkflowRun,
6367
- startAsyncVNextWorkflowRun
6446
+ startLegacyWorkflowRun,
6447
+ createLegacyWorkflowRun,
6448
+ startAsyncWorkflowRun
6368
6449
  };
6369
6450
  };
6370
6451
  const useWatchWorkflow = (baseUrl) => {
6452
+ const [isWatchingLegacyWorkflow, setIsWatchingLegacyWorkflow] = React.useState(false);
6371
6453
  const [isWatchingWorkflow, setIsWatchingWorkflow] = React.useState(false);
6372
- const [isWatchingVNextWorkflow, setIsWatchingVNextWorkflow] = React.useState(false);
6454
+ const [legacyWatchResult, setLegacyWatchResult] = React.useState(null);
6373
6455
  const [watchResult, setWatchResult] = React.useState(null);
6374
- const [watchVNextResult, setWatchVNextResult] = React.useState(null);
6375
- const debouncedSetWatchResult = useDebounce.useDebouncedCallback((record) => {
6456
+ const debouncedSetLegacyWorkflowWatchResult = useDebounce.useDebouncedCallback((record) => {
6376
6457
  const formattedResults = Object.entries(record.results || {}).reduce(
6377
6458
  (acc, [key, value]) => {
6378
6459
  let output = value.status === "success" ? value.output : void 0;
@@ -6395,19 +6476,19 @@ const useWatchWorkflow = (baseUrl) => {
6395
6476
  ...record,
6396
6477
  sanitizedOutput: record ? JSON.stringify({ ...record, results: formattedResults }, null, 2).slice(0, 5e4) : null
6397
6478
  };
6398
- setWatchResult(sanitizedRecord);
6479
+ setLegacyWatchResult(sanitizedRecord);
6399
6480
  }, 100);
6400
- const watchWorkflow = async ({ workflowId, runId }) => {
6481
+ const watchLegacyWorkflow = async ({ workflowId, runId }) => {
6401
6482
  try {
6402
- setIsWatchingWorkflow(true);
6483
+ setIsWatchingLegacyWorkflow(true);
6403
6484
  const client = createMastraClient(baseUrl);
6404
- const workflow = client.getWorkflow(workflowId);
6485
+ const workflow = client.getLegacyWorkflow(workflowId);
6405
6486
  await workflow.watch({ runId }, (record) => {
6406
6487
  try {
6407
- debouncedSetWatchResult(record);
6488
+ debouncedSetLegacyWorkflowWatchResult(record);
6408
6489
  } catch (err) {
6409
6490
  console.error("Error processing workflow record:", err);
6410
- setWatchResult({
6491
+ setLegacyWatchResult({
6411
6492
  ...record
6412
6493
  });
6413
6494
  }
@@ -6416,24 +6497,24 @@ const useWatchWorkflow = (baseUrl) => {
6416
6497
  console.error("Error watching workflow:", error);
6417
6498
  throw error;
6418
6499
  } finally {
6419
- setIsWatchingWorkflow(false);
6500
+ setIsWatchingLegacyWorkflow(false);
6420
6501
  }
6421
6502
  };
6422
- const debouncedSetVNextWatchResult = useDebounce.useDebouncedCallback((record) => {
6423
- const sanitizedRecord = sanitizeVNexWorkflowWatchResult(record);
6424
- setWatchVNextResult(sanitizedRecord);
6503
+ const debouncedSetWorkflowWatchResult = useDebounce.useDebouncedCallback((record) => {
6504
+ const sanitizedRecord = sanitizeWorkflowWatchResult(record);
6505
+ setWatchResult(sanitizedRecord);
6425
6506
  }, 100);
6426
- const watchVNextWorkflow = async ({ workflowId, runId }) => {
6507
+ const watchWorkflow = async ({ workflowId, runId }) => {
6427
6508
  try {
6428
- setIsWatchingVNextWorkflow(true);
6509
+ setIsWatchingWorkflow(true);
6429
6510
  const client = createMastraClient(baseUrl);
6430
- const workflow = client.getVNextWorkflow(workflowId);
6511
+ const workflow = client.getWorkflow(workflowId);
6431
6512
  await workflow.watch({ runId }, (record) => {
6432
6513
  try {
6433
- debouncedSetVNextWatchResult(record);
6514
+ debouncedSetWorkflowWatchResult(record);
6434
6515
  } catch (err) {
6435
6516
  console.error("Error processing workflow record:", err);
6436
- setWatchVNextResult({
6517
+ setWatchResult({
6437
6518
  ...record
6438
6519
  });
6439
6520
  }
@@ -6442,40 +6523,40 @@ const useWatchWorkflow = (baseUrl) => {
6442
6523
  console.error("Error watching workflow:", error);
6443
6524
  throw error;
6444
6525
  } finally {
6445
- setIsWatchingVNextWorkflow(false);
6526
+ setIsWatchingWorkflow(false);
6446
6527
  }
6447
6528
  };
6448
6529
  return {
6530
+ watchLegacyWorkflow,
6531
+ isWatchingLegacyWorkflow,
6532
+ legacyWatchResult,
6449
6533
  watchWorkflow,
6450
6534
  isWatchingWorkflow,
6451
- watchResult,
6452
- watchVNextWorkflow,
6453
- isWatchingVNextWorkflow,
6454
- watchVNextResult
6535
+ watchResult
6455
6536
  };
6456
6537
  };
6457
6538
  const useResumeWorkflow = (baseUrl) => {
6539
+ const [isResumingLegacyWorkflow, setIsResumingLegacyWorkflow] = React.useState(false);
6458
6540
  const [isResumingWorkflow, setIsResumingWorkflow] = React.useState(false);
6459
- const [isResumingVNextWorkflow, setIsResumingVNextWorkflow] = React.useState(false);
6460
- const resumeWorkflow = async ({
6541
+ const resumeLegacyWorkflow = async ({
6461
6542
  workflowId,
6462
6543
  stepId,
6463
6544
  runId,
6464
6545
  context
6465
6546
  }) => {
6466
6547
  try {
6467
- setIsResumingWorkflow(true);
6548
+ setIsResumingLegacyWorkflow(true);
6468
6549
  const client = createMastraClient(baseUrl);
6469
- const response = await client.getWorkflow(workflowId).resume({ stepId, runId, context });
6550
+ const response = await client.getLegacyWorkflow(workflowId).resume({ stepId, runId, context });
6470
6551
  return response;
6471
6552
  } catch (error) {
6472
6553
  console.error("Error resuming workflow:", error);
6473
6554
  throw error;
6474
6555
  } finally {
6475
- setIsResumingWorkflow(false);
6556
+ setIsResumingLegacyWorkflow(false);
6476
6557
  }
6477
6558
  };
6478
- const resumeVNextWorkflow = async ({
6559
+ const resumeWorkflow = async ({
6479
6560
  workflowId,
6480
6561
  step,
6481
6562
  runId,
@@ -6483,26 +6564,26 @@ const useResumeWorkflow = (baseUrl) => {
6483
6564
  runtimeContext: playgroundRuntimeContext
6484
6565
  }) => {
6485
6566
  try {
6486
- setIsResumingVNextWorkflow(true);
6567
+ setIsResumingWorkflow(true);
6487
6568
  const client = createMastraClient(baseUrl);
6488
6569
  const runtimeContext$1 = new runtimeContext.RuntimeContext();
6489
6570
  Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
6490
6571
  runtimeContext$1.set(key, value);
6491
6572
  });
6492
- const response = await client.getVNextWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext: runtimeContext$1 });
6573
+ const response = await client.getWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext: runtimeContext$1 });
6493
6574
  return response;
6494
6575
  } catch (error) {
6495
6576
  console.error("Error resuming workflow:", error);
6496
6577
  throw error;
6497
6578
  } finally {
6498
- setIsResumingVNextWorkflow(false);
6579
+ setIsResumingWorkflow(false);
6499
6580
  }
6500
6581
  };
6501
6582
  return {
6583
+ resumeLegacyWorkflow,
6584
+ isResumingLegacyWorkflow,
6502
6585
  resumeWorkflow,
6503
- isResumingWorkflow,
6504
- resumeVNextWorkflow,
6505
- isResumingVNextWorkflow
6586
+ isResumingWorkflow
6506
6587
  };
6507
6588
  };
6508
6589
 
@@ -6589,7 +6670,7 @@ const defaultEdgeOptions = {
6589
6670
  color: "#8e8e8e"
6590
6671
  }
6591
6672
  };
6592
- const contructNodesAndEdges = ({
6673
+ const contructLegacyNodesAndEdges = ({
6593
6674
  stepGraph,
6594
6675
  stepSubscriberGraph,
6595
6676
  steps: mainSteps = {}
@@ -7040,7 +7121,7 @@ const getStepNodeAndEdge = ({
7040
7121
  }
7041
7122
  return { nodes: [], edges: [], nextPrevNodeIds: [] };
7042
7123
  };
7043
- const constructVNextNodesAndEdges = ({
7124
+ const constructNodesAndEdges = ({
7044
7125
  stepGraph
7045
7126
  }) => {
7046
7127
  if (!stepGraph) {
@@ -7379,12 +7460,12 @@ function Spinner({ color = "#fff", className }) {
7379
7460
  );
7380
7461
  }
7381
7462
 
7382
- function WorkflowNestedGraph({
7463
+ function LegacyWorkflowNestedGraph({
7383
7464
  stepGraph,
7384
7465
  stepSubscriberGraph,
7385
7466
  open
7386
7467
  }) {
7387
- const { nodes: initialNodes, edges: initialEdges } = contructNodesAndEdges({
7468
+ const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
7388
7469
  stepGraph,
7389
7470
  stepSubscriberGraph
7390
7471
  });
@@ -7422,10 +7503,10 @@ function WorkflowNestedGraph({
7422
7503
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) });
7423
7504
  }
7424
7505
 
7425
- const WorkflowNestedGraphContext = React.createContext(
7506
+ const LegacyWorkflowNestedGraphContext = React.createContext(
7426
7507
  {}
7427
7508
  );
7428
- function WorkflowNestedGraphProvider({ children }) {
7509
+ function LegacyWorkflowNestedGraphProvider({ children }) {
7429
7510
  const [stepGraph, setStepGraph] = React.useState(null);
7430
7511
  const [stepSubscriberGraph, setStepSubscriberGraph] = React.useState(null);
7431
7512
  const [openDialog, setOpenDialog] = React.useState(false);
@@ -7447,7 +7528,7 @@ function WorkflowNestedGraphProvider({ children }) {
7447
7528
  setOpenDialog(true);
7448
7529
  };
7449
7530
  return /* @__PURE__ */ jsxRuntime.jsxs(
7450
- WorkflowNestedGraphContext.Provider,
7531
+ LegacyWorkflowNestedGraphContext.Provider,
7451
7532
  {
7452
7533
  value: {
7453
7534
  showNestedGraph,
@@ -7463,16 +7544,23 @@ function WorkflowNestedGraphProvider({ children }) {
7463
7544
  " workflow"
7464
7545
  ] })
7465
7546
  ] }),
7466
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraph, { stepGraph, open: openDialog, stepSubscriberGraph }) })
7547
+ /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
7548
+ LegacyWorkflowNestedGraph,
7549
+ {
7550
+ stepGraph,
7551
+ open: openDialog,
7552
+ stepSubscriberGraph
7553
+ }
7554
+ ) })
7467
7555
  ] }) }) })
7468
7556
  ]
7469
7557
  }
7470
7558
  );
7471
7559
  }
7472
7560
 
7473
- function WorkflowNestedNode({ data }) {
7561
+ function LegacyWorkflowNestedNode({ data }) {
7474
7562
  const { label, withoutTopHandle, withoutBottomHandle, stepGraph, stepSubscriberGraph } = data;
7475
- const { showNestedGraph } = React.useContext(WorkflowNestedGraphContext);
7563
+ const { showNestedGraph } = React.useContext(LegacyWorkflowNestedGraphContext);
7476
7564
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
7477
7565
  !withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$2.Handle, { type: "target", position: react$2.Position.Top, style: { visibility: "hidden" } }),
7478
7566
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph, stepSubscriberGraph }), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
@@ -7483,8 +7571,8 @@ function WorkflowNestedNode({ data }) {
7483
7571
  ] });
7484
7572
  }
7485
7573
 
7486
- function WorkflowGraphInner({ workflow }) {
7487
- const { nodes: initialNodes, edges: initialEdges } = contructNodesAndEdges({
7574
+ function LegacyWorkflowGraphInner({ workflow }) {
7575
+ const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
7488
7576
  stepGraph: workflow.serializedStepGraph || workflow.stepGraph,
7489
7577
  stepSubscriberGraph: workflow.serializedStepSubscriberGraph || workflow.stepSubscriberGraph,
7490
7578
  steps: workflow.steps
@@ -7496,7 +7584,7 @@ function WorkflowGraphInner({ workflow }) {
7496
7584
  "condition-node": WorkflowConditionNode,
7497
7585
  "after-node": WorkflowAfterNode,
7498
7586
  "loop-result-node": WorkflowLoopResultNode,
7499
- "nested-node": WorkflowNestedNode
7587
+ "nested-node": LegacyWorkflowNestedNode
7500
7588
  };
7501
7589
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
7502
7590
  react$2.ReactFlow,
@@ -7523,12 +7611,12 @@ const lodashTitleCase = (str) => {
7523
7611
  return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
7524
7612
  };
7525
7613
 
7526
- function WorkflowGraph({ workflowId, baseUrl }) {
7527
- const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
7614
+ function LegacyWorkflowGraph({ workflowId, baseUrl }) {
7615
+ const { legacyWorkflow, isLoading } = useLegacyWorkflow(workflowId, baseUrl);
7528
7616
  if (isLoading) {
7529
7617
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-[600px]" }) });
7530
7618
  }
7531
- if (!workflow) {
7619
+ if (!legacyWorkflow) {
7532
7620
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
7533
7621
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, {}),
7534
7622
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -7538,28 +7626,24 @@ function WorkflowGraph({ workflowId, baseUrl }) {
7538
7626
  ] })
7539
7627
  ] }) });
7540
7628
  }
7541
- return /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowGraphInner, { workflow }) }) });
7629
+ return /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowGraphInner, { workflow: legacyWorkflow }) }) });
7542
7630
  }
7543
7631
 
7544
7632
  const Form = React.forwardRef(({ children, ...props }, ref) => {
7545
7633
  return /* @__PURE__ */ jsxRuntime.jsx("form", { ref, className: "space-y-4", ...props, children });
7546
7634
  });
7547
7635
 
7548
- const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
7549
- const Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(LabelPrimitive__namespace.Root, { ref, className: cn(labelVariants(), className), ...props }));
7550
- Label.displayName = LabelPrimitive__namespace.Root.displayName;
7551
-
7552
7636
  const DISABLED_LABELS = ["boolean", "object", "array"];
7553
7637
  const FieldWrapper = ({ label, children, id, field, error }) => {
7554
7638
  const isDisabled = DISABLED_LABELS.includes(field.type);
7555
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
7556
- !isDisabled && /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: id, children: [
7639
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pb-4 last:pb-0", children: [
7640
+ !isDisabled && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3 pb-1 block", htmlFor: id, children: [
7557
7641
  label,
7558
- field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: " *" })
7642
+ field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent2", children: " *" })
7559
7643
  ] }),
7560
7644
  children,
7561
- field.fieldConfig?.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: field.fieldConfig.description }),
7562
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: error })
7645
+ field.fieldConfig?.description && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon6", children: field.fieldConfig.description }),
7646
+ error && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: "text-accent2", children: error })
7563
7647
  ] });
7564
7648
  };
7565
7649
 
@@ -7668,9 +7752,9 @@ const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ *
7668
7752
  defaultChecked: field.default
7669
7753
  }
7670
7754
  ),
7671
- /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: id, children: [
7755
+ /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3", htmlFor: id, children: [
7672
7756
  label,
7673
- field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: " *" })
7757
+ field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent2", children: " *" })
7674
7758
  ] })
7675
7759
  ] });
7676
7760
 
@@ -8017,34 +8101,53 @@ const SelectField = ({ field, inputProps, error, id, value }) => {
8017
8101
  };
8018
8102
 
8019
8103
  const ObjectWrapper = ({ label, children }) => {
8020
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 border p-2 rounded-md", children: [
8021
- label === "​" ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) : /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-medium", children: label }),
8022
- children
8023
- ] });
8024
- };
8025
-
8026
- const ArrayWrapper = ({ label, children, onAddItem }) => {
8027
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8028
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-medium", children: label }),
8029
- children,
8104
+ const hasLabel = label !== "" && label !== "";
8105
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "", children: [
8106
+ hasLabel && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 flex items-center gap-1 pb-2", children: [
8107
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Braces, {}) }),
8108
+ label
8109
+ ] }),
8030
8110
  /* @__PURE__ */ jsxRuntime.jsx(
8031
- Button$1,
8111
+ "div",
8032
8112
  {
8033
- className: "w-full flex items-center justify-center",
8034
- onClick: onAddItem,
8035
- variant: "outline",
8036
- size: "sm",
8037
- type: "button",
8038
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "h-4 w-4" })
8113
+ className: hasLabel ? "flex flex-col gap-1 [&>*]:border-dashed [&>*]:border-l [&>*]:border-l-border1 [&>*]:pl-4" : "",
8114
+ children
8039
8115
  }
8040
8116
  )
8041
8117
  ] });
8042
8118
  };
8043
8119
 
8120
+ const ArrayWrapper = ({ label, children, onAddItem }) => {
8121
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
8122
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 justify-between", children: [
8123
+ /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 pb-2 flex items-center gap-1", children: [
8124
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Brackets, {}) }),
8125
+ label
8126
+ ] }),
8127
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { delayDuration: 0, children: [
8128
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
8129
+ "button",
8130
+ {
8131
+ onClick: onAddItem,
8132
+ type: "button",
8133
+ className: "text-icon3 bg-surface3 rounded-md p-1 hover:bg-surface4 hover:text-icon6 h-icon-sm w-icon-sm",
8134
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, {}) })
8135
+ }
8136
+ ) }),
8137
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Add item" })
8138
+ ] }) })
8139
+ ] }),
8140
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children })
8141
+ ] });
8142
+ };
8143
+
8044
8144
  const ArrayElementWrapper = ({ children, onRemove }) => {
8045
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative border p-4 rounded-md mt-2", children: [
8046
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: onRemove, variant: "ghost", className: "absolute top-2 right-2", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrashIcon, { className: "h-4 w-4" }) }),
8047
- children
8145
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pl-4 border-l border-border1", children: [
8146
+ children,
8147
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: onRemove, type: "button", children: [
8148
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrashIcon, {}) }),
8149
+ "Delete"
8150
+ ] })
8048
8151
  ] });
8049
8152
  };
8050
8153
 
@@ -8243,6 +8346,10 @@ class CustomZodProvider extends zod.ZodProvider {
8243
8346
  }
8244
8347
  }
8245
8348
 
8349
+ const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
8350
+ const Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(LabelPrimitive__namespace.Root, { ref, className: cn(labelVariants(), className), ...props }));
8351
+ Label.displayName = LabelPrimitive__namespace.Root.displayName;
8352
+
8246
8353
  function isEmptyZodObject(schema) {
8247
8354
  if (schema instanceof z.ZodObject) {
8248
8355
  return Object.keys(schema.shape).length === 0;
@@ -8254,7 +8361,7 @@ function DynamicForm({
8254
8361
  onSubmit,
8255
8362
  defaultValues,
8256
8363
  isSubmitLoading,
8257
- submitButtonLabel = "Submit"
8364
+ submitButtonLabel
8258
8365
  }) {
8259
8366
  if (!schema) {
8260
8367
  console.error("no form schema found");
@@ -8276,17 +8383,17 @@ function DynamicForm({
8276
8383
  },
8277
8384
  defaultValues: defaultValues ? { "​": defaultValues } : void 0,
8278
8385
  formProps: {
8279
- className: "space-y-4 p-4"
8386
+ className: ""
8280
8387
  },
8281
8388
  uiComponents: {
8282
- SubmitButton: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Button$1, { className: "w-full", type: "submit", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : children || submitButtonLabel })
8389
+ SubmitButton: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "light", className: "w-full", size: "lg", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : submitButtonLabel || children })
8283
8390
  },
8284
8391
  formComponents: {
8285
8392
  Label: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-normal", children: value })
8286
8393
  },
8287
8394
  withSubmit: true
8288
8395
  };
8289
- return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntime.jsx(AutoForm, { ...formProps }) });
8396
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntime.jsx(AutoForm, { ...formProps }) });
8290
8397
  }
8291
8398
 
8292
8399
  function resolveSerializedZodOutput(obj) {
@@ -8316,22 +8423,22 @@ function CodeBlockDemo({
8316
8423
 
8317
8424
  const WorkflowRunContext = React.createContext({});
8318
8425
  function WorkflowRunProvider({ children }) {
8426
+ const [legacyResult, setLegacyResult] = React.useState(null);
8319
8427
  const [result, setResult] = React.useState(null);
8320
- const [vNextResult, setVNextResult] = React.useState(null);
8321
8428
  const [payload, setPayload] = React.useState(null);
8322
8429
  const clearData = () => {
8430
+ setLegacyResult(null);
8323
8431
  setResult(null);
8324
- setVNextResult(null);
8325
8432
  setPayload(null);
8326
8433
  };
8327
8434
  return /* @__PURE__ */ jsxRuntime.jsx(
8328
8435
  WorkflowRunContext.Provider,
8329
8436
  {
8330
8437
  value: {
8438
+ legacyResult,
8439
+ setLegacyResult,
8331
8440
  result,
8332
8441
  setResult,
8333
- vNextResult,
8334
- setVNextResult,
8335
8442
  payload,
8336
8443
  setPayload,
8337
8444
  clearData
@@ -8341,16 +8448,81 @@ function WorkflowRunProvider({ children }) {
8341
8448
  );
8342
8449
  }
8343
8450
 
8344
- function WorkflowTrigger({
8451
+ const WorkflowCard = ({ header, children, footer }) => {
8452
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border-sm border-border1 bg-surface4", children: [
8453
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 px-2 flex items-center gap-3", children: header }),
8454
+ children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t-sm border-border1", children }),
8455
+ footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 px-2 border-t-sm border-border1", children: footer })
8456
+ ] });
8457
+ };
8458
+
8459
+ const LegacyWorkflowStatus = ({ stepId, pathStatus, path }) => {
8460
+ const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : pathStatus === "executing" ? "Executing" : "Completed";
8461
+ return /* @__PURE__ */ jsxRuntime.jsx(
8462
+ WorkflowCard,
8463
+ {
8464
+ header: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
8465
+ /* @__PURE__ */ jsxRuntime.jsxs(Icon, { children: [
8466
+ status === "Completed" && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "text-accent1" }),
8467
+ status === "Failed" && /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }),
8468
+ status === "Executing" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "text-icon3 animate-spin" })
8469
+ ] }),
8470
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: path })
8471
+ ] })
8472
+ }
8473
+ );
8474
+ };
8475
+
8476
+ const WorkflowResult = ({ jsonResult, sanitizedJsonResult }) => {
8477
+ const { handleCopy } = useCopyToClipboard({ text: jsonResult });
8478
+ const [expanded, setExpanded] = React.useState(false);
8479
+ return /* @__PURE__ */ jsxRuntime.jsx(
8480
+ WorkflowCard,
8481
+ {
8482
+ header: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 justify-between w-full", children: [
8483
+ /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "text-icon6 flex items-center gap-3 font-medium", children: [
8484
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(DeploymentIcon, {}) }),
8485
+ "Results"
8486
+ ] }),
8487
+ /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
8488
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
8489
+ "button",
8490
+ {
8491
+ className: "p-2 rounded-lg hover:bg-surface5 transition-colors duration-150 ease-in-out text-icon3 hover:text-icon6",
8492
+ onClick: () => handleCopy(),
8493
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) })
8494
+ }
8495
+ ) }),
8496
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Copy result" })
8497
+ ] })
8498
+ ] }),
8499
+ footer: /* @__PURE__ */ jsxRuntime.jsx(
8500
+ "button",
8501
+ {
8502
+ className: "w-full h-full text-center text-icon2 hover:text-icon6 text-ui-md",
8503
+ onClick: () => setExpanded((s) => !s),
8504
+ children: expanded ? "collapse" : "expand"
8505
+ }
8506
+ ),
8507
+ children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(CodeBlockDemo, { className: "w-full overflow-x-auto", code: sanitizedJsonResult || jsonResult, language: "json" }) : null
8508
+ }
8509
+ );
8510
+ };
8511
+
8512
+ function LegacyWorkflowTrigger({
8345
8513
  workflowId,
8346
8514
  baseUrl,
8347
8515
  setRunId
8348
8516
  }) {
8349
- const { result, setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
8350
- const { isLoading, workflow } = useWorkflow(workflowId, baseUrl);
8351
- const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
8352
- const { watchWorkflow, watchResult, isWatchingWorkflow } = useWatchWorkflow(baseUrl);
8353
- const { resumeWorkflow, isResumingWorkflow } = useResumeWorkflow(baseUrl);
8517
+ const { legacyResult: result, setLegacyResult: setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
8518
+ const { isLoading, legacyWorkflow: workflow } = useLegacyWorkflow(workflowId, baseUrl);
8519
+ const { createLegacyWorkflowRun: createWorkflowRun, startLegacyWorkflowRun: startWorkflowRun } = useExecuteWorkflow(baseUrl);
8520
+ const {
8521
+ watchLegacyWorkflow: watchWorkflow,
8522
+ legacyWatchResult: watchResult,
8523
+ isWatchingLegacyWorkflow: isWatchingWorkflow
8524
+ } = useWatchWorkflow(baseUrl);
8525
+ const { resumeLegacyWorkflow: resumeWorkflow, isResumingLegacyWorkflow: isResumingWorkflow } = useResumeWorkflow(baseUrl);
8354
8526
  const [suspendedSteps, setSuspendedSteps] = React.useState([]);
8355
8527
  const [isRunning, setIsRunning] = React.useState(false);
8356
8528
  const triggerSchema = workflow?.triggerSchema;
@@ -8381,7 +8553,7 @@ function WorkflowTrigger({
8381
8553
  });
8382
8554
  };
8383
8555
  const watchResultToUse = result ?? watchResult;
8384
- const workflowActivePaths = watchResultToUse?.activePaths ?? [];
8556
+ const workflowActivePaths = watchResultToUse?.activePaths ?? {};
8385
8557
  React.useEffect(() => {
8386
8558
  setIsRunning(isWatchingWorkflow);
8387
8559
  }, [isWatchingWorkflow]);
@@ -8409,50 +8581,34 @@ function WorkflowTrigger({
8409
8581
  const isSuspendedSteps = suspendedSteps.length > 0;
8410
8582
  const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(triggerSchema))) : null;
8411
8583
  const { sanitizedOutput, ...restResult } = result ?? {};
8412
- return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs w-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8413
- !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
8414
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between w-full", children: [
8415
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Input" }),
8416
- isResumingWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
8417
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8418
- " Resuming workflow"
8419
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
8420
- ] }),
8421
- /* @__PURE__ */ jsxRuntime.jsx(
8422
- DynamicForm,
8423
- {
8424
- schema: zodInputSchema,
8425
- defaultValues: payload,
8426
- isSubmitLoading: isWatchingWorkflow,
8427
- onSubmit: (data) => {
8428
- setPayload(data);
8429
- handleExecuteWorkflow(data);
8430
- }
8431
- }
8432
- )
8433
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 space-y-4", children: [
8434
- isResumingWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
8435
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8436
- " Resuming workflow"
8437
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
8438
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
8439
- ] }) }),
8440
- Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
8441
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
8442
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
8443
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
8444
- const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : "Completed";
8445
- const statusIcon = status === "Completed" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "Failed" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
8446
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center justify-between p-3`, children: [
8447
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: path.charAt(0).toUpperCase() + path.slice(1) }),
8448
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
8449
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
8450
- status
8451
- ] })
8452
- ] }) }, idx);
8453
- }) });
8454
- }) })
8584
+ const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
8585
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8586
+ isResumingWorkflow && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
8587
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin text-icon6" }) }),
8588
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { children: "Resuming workflow" })
8455
8589
  ] }),
8590
+ !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsx(
8591
+ DynamicForm,
8592
+ {
8593
+ schema: zodInputSchema,
8594
+ defaultValues: payload,
8595
+ isSubmitLoading: isWatchingWorkflow,
8596
+ submitButtonLabel: "Run",
8597
+ onSubmit: (data) => {
8598
+ setPayload(data);
8599
+ handleExecuteWorkflow(data);
8600
+ }
8601
+ }
8602
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
8603
+ Button,
8604
+ {
8605
+ className: "w-full",
8606
+ variant: "light",
8607
+ disabled: isRunning,
8608
+ onClick: () => handleExecuteWorkflow(null),
8609
+ children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : "Trigger"
8610
+ }
8611
+ ) }),
8456
8612
  isSuspendedSteps && suspendedSteps?.map((step) => {
8457
8613
  const stepDefinition = workflow.steps[step.stepId];
8458
8614
  const stepSchema = stepDefinition?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.inputSchema))) : z.z.record(z.z.string(), z.z.any());
@@ -8484,29 +8640,23 @@ function WorkflowTrigger({
8484
8640
  )
8485
8641
  ] });
8486
8642
  }),
8487
- result && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col group relative", children: [
8488
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Output" }),
8489
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8490
- CopyButton,
8491
- {
8492
- 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",
8493
- content: JSON.stringify(restResult, null, 2)
8494
- }
8495
- ) }),
8496
- /* @__PURE__ */ jsxRuntime.jsx(
8497
- CodeBlockDemo,
8498
- {
8499
- className: "w-full overflow-x-auto",
8500
- code: sanitizedOutput || JSON.stringify(restResult, null, 2),
8501
- language: "json"
8502
- }
8503
- )
8643
+ hasWorkflowActivePaths && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8644
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
8645
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
8646
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
8647
+ return /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowStatus, { stepId, pathStatus, path }, idx);
8648
+ }) }, stepId);
8649
+ }) })
8650
+ ] }),
8651
+ result && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8652
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
8653
+ /* @__PURE__ */ jsxRuntime.jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
8504
8654
  ] })
8505
8655
  ] }) });
8506
8656
  }
8507
8657
 
8508
- function VNextWorkflowNestedGraph({ stepGraph, open }) {
8509
- const { nodes: initialNodes, edges: initialEdges } = constructVNextNodesAndEdges({
8658
+ function WorkflowNestedGraph({ stepGraph, open }) {
8659
+ const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges({
8510
8660
  stepGraph
8511
8661
  });
8512
8662
  const [isMounted, setIsMounted] = React.useState(false);
@@ -8517,7 +8667,7 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
8517
8667
  "condition-node": WorkflowConditionNode,
8518
8668
  "after-node": WorkflowAfterNode,
8519
8669
  "loop-result-node": WorkflowLoopResultNode,
8520
- "nested-node": VNextWorkflowNestedNode
8670
+ "nested-node": WorkflowNestedNode
8521
8671
  };
8522
8672
  React.useEffect(() => {
8523
8673
  if (open) {
@@ -8544,10 +8694,10 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
8544
8694
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) });
8545
8695
  }
8546
8696
 
8547
- const VNextWorkflowNestedGraphContext = React.createContext(
8697
+ const WorkflowNestedGraphContext = React.createContext(
8548
8698
  {}
8549
8699
  );
8550
- function VNextWorkflowNestedGraphProvider({ children }) {
8700
+ function WorkflowNestedGraphProvider({ children }) {
8551
8701
  const [stepGraph, setStepGraph] = React.useState(null);
8552
8702
  const [parentStepGraphList, setParentStepGraphList] = React.useState([]);
8553
8703
  const [openDialog, setOpenDialog] = React.useState(false);
@@ -8585,7 +8735,7 @@ function VNextWorkflowNestedGraphProvider({ children }) {
8585
8735
  }, 500);
8586
8736
  };
8587
8737
  return /* @__PURE__ */ jsxRuntime.jsxs(
8588
- VNextWorkflowNestedGraphContext.Provider,
8738
+ WorkflowNestedGraphContext.Provider,
8589
8739
  {
8590
8740
  value: {
8591
8741
  showNestedGraph,
@@ -8601,16 +8751,16 @@ function VNextWorkflowNestedGraphProvider({ children }) {
8601
8751
  " workflow"
8602
8752
  ] })
8603
8753
  ] }),
8604
- switching ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(VNextWorkflowNestedGraph, { stepGraph, open: openDialog }) })
8754
+ switching ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraph, { stepGraph, open: openDialog }) })
8605
8755
  ] }) }) })
8606
8756
  ]
8607
8757
  }
8608
8758
  );
8609
8759
  }
8610
8760
 
8611
- function VNextWorkflowNestedNode({ data }) {
8761
+ function WorkflowNestedNode({ data }) {
8612
8762
  const { label, withoutTopHandle, withoutBottomHandle, stepGraph } = data;
8613
- const { showNestedGraph } = React.useContext(VNextWorkflowNestedGraphContext);
8763
+ const { showNestedGraph } = React.useContext(WorkflowNestedGraphContext);
8614
8764
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
8615
8765
  !withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$2.Handle, { type: "target", position: react$2.Position.Top, style: { visibility: "hidden" } }),
8616
8766
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph }), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
@@ -8621,8 +8771,8 @@ function VNextWorkflowNestedNode({ data }) {
8621
8771
  ] });
8622
8772
  }
8623
8773
 
8624
- function VNextWorkflowGraphInner({ workflow }) {
8625
- const { nodes: initialNodes, edges: initialEdges } = constructVNextNodesAndEdges(workflow);
8774
+ function WorkflowGraphInner({ workflow }) {
8775
+ const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges(workflow);
8626
8776
  const [nodes, _, onNodesChange] = react$2.useNodesState(initialNodes);
8627
8777
  const [edges] = react$2.useEdgesState(initialEdges);
8628
8778
  const nodeTypes = {
@@ -8630,7 +8780,7 @@ function VNextWorkflowGraphInner({ workflow }) {
8630
8780
  "condition-node": WorkflowConditionNode,
8631
8781
  "after-node": WorkflowAfterNode,
8632
8782
  "loop-result-node": WorkflowLoopResultNode,
8633
- "nested-node": VNextWorkflowNestedNode
8783
+ "nested-node": WorkflowNestedNode
8634
8784
  };
8635
8785
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
8636
8786
  react$2.ReactFlow,
@@ -8652,12 +8802,12 @@ function VNextWorkflowGraphInner({ workflow }) {
8652
8802
  ) });
8653
8803
  }
8654
8804
 
8655
- function VNextWorkflowGraph({ workflowId, baseUrl }) {
8656
- const { vNextWorkflow, isLoading } = useVNextWorkflow(workflowId, baseUrl);
8805
+ function WorkflowGraph({ workflowId, baseUrl }) {
8806
+ const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
8657
8807
  if (isLoading) {
8658
8808
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-[600px]" }) });
8659
8809
  }
8660
- if (!vNextWorkflow) {
8810
+ if (!workflow) {
8661
8811
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
8662
8812
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, {}),
8663
8813
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -8667,43 +8817,60 @@ function VNextWorkflowGraph({ workflowId, baseUrl }) {
8667
8817
  ] })
8668
8818
  ] }) });
8669
8819
  }
8670
- return /* @__PURE__ */ jsxRuntime.jsx(VNextWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(VNextWorkflowGraphInner, { workflow: vNextWorkflow }) }) });
8820
+ return /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowGraphInner, { workflow }) }) });
8671
8821
  }
8672
8822
 
8673
- function VNextWorkflowTrigger({
8823
+ const WorkflowStatus = ({ stepId, status }) => {
8824
+ return /* @__PURE__ */ jsxRuntime.jsx(
8825
+ WorkflowCard,
8826
+ {
8827
+ header: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
8828
+ /* @__PURE__ */ jsxRuntime.jsxs(Icon, { children: [
8829
+ status === "success" && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "text-accent1" }),
8830
+ status === "failed" && /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }),
8831
+ status === "suspended" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CirclePause, { className: "text-icon3" }),
8832
+ status === "running" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "text-icon3 animate-spin" })
8833
+ ] }),
8834
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) })
8835
+ ] })
8836
+ }
8837
+ );
8838
+ };
8839
+
8840
+ function WorkflowTrigger({
8674
8841
  workflowId,
8675
8842
  baseUrl,
8676
8843
  setRunId
8677
8844
  }) {
8678
8845
  const { runtimeContext } = usePlaygroundStore();
8679
- const { vNextResult, setVNextResult, payload, setPayload } = React.useContext(WorkflowRunContext);
8680
- const { isLoading, vNextWorkflow } = useVNextWorkflow(workflowId, baseUrl);
8681
- const { createVNextWorkflowRun, startVNextWorkflowRun } = useExecuteWorkflow(baseUrl);
8682
- const { watchVNextWorkflow, watchVNextResult, isWatchingVNextWorkflow } = useWatchWorkflow(baseUrl);
8683
- const { resumeVNextWorkflow, isResumingVNextWorkflow } = useResumeWorkflow(baseUrl);
8846
+ const { result, setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
8847
+ const { isLoading, workflow } = useWorkflow(workflowId, baseUrl);
8848
+ const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
8849
+ const { watchWorkflow, watchResult, isWatchingWorkflow } = useWatchWorkflow(baseUrl);
8850
+ const { resumeWorkflow, isResumingWorkflow } = useResumeWorkflow(baseUrl);
8684
8851
  const [suspendedSteps, setSuspendedSteps] = React.useState([]);
8685
8852
  const [isRunning, setIsRunning] = React.useState(false);
8686
- const triggerSchema = vNextWorkflow?.inputSchema;
8853
+ const triggerSchema = workflow?.inputSchema;
8687
8854
  const handleExecuteWorkflow = async (data) => {
8688
8855
  try {
8689
- if (!vNextWorkflow) return;
8856
+ if (!workflow) return;
8690
8857
  setIsRunning(true);
8691
- setVNextResult(null);
8692
- const { runId } = await createVNextWorkflowRun({ workflowId });
8858
+ setResult(null);
8859
+ const { runId } = await createWorkflowRun({ workflowId });
8693
8860
  setRunId?.(runId);
8694
- watchVNextWorkflow({ workflowId, runId });
8695
- startVNextWorkflowRun({ workflowId, runId, input: data, runtimeContext });
8861
+ watchWorkflow({ workflowId, runId });
8862
+ startWorkflowRun({ workflowId, runId, input: data, runtimeContext });
8696
8863
  } catch (err) {
8697
8864
  setIsRunning(false);
8698
8865
  sonner.toast.error("Error executing workflow");
8699
8866
  }
8700
8867
  };
8701
8868
  const handleResumeWorkflow = async (step) => {
8702
- if (!vNextWorkflow) return;
8869
+ if (!workflow) return;
8703
8870
  const { stepId, runId: prevRunId, resumeData } = step;
8704
- const { runId } = await createVNextWorkflowRun({ workflowId, prevRunId });
8705
- watchVNextWorkflow({ workflowId, runId });
8706
- await resumeVNextWorkflow({
8871
+ const { runId } = await createWorkflowRun({ workflowId, prevRunId });
8872
+ watchWorkflow({ workflowId, runId });
8873
+ await resumeWorkflow({
8707
8874
  step: stepId,
8708
8875
  runId,
8709
8876
  resumeData,
@@ -8711,78 +8878,65 @@ function VNextWorkflowTrigger({
8711
8878
  runtimeContext
8712
8879
  });
8713
8880
  };
8714
- const watchResultToUse = vNextResult ?? watchVNextResult;
8881
+ const watchResultToUse = result ?? watchResult;
8715
8882
  const workflowActivePaths = watchResultToUse?.payload?.workflowState?.steps ?? {};
8716
8883
  React.useEffect(() => {
8717
- setIsRunning(isWatchingVNextWorkflow);
8718
- }, [isWatchingVNextWorkflow]);
8884
+ setIsRunning(isWatchingWorkflow);
8885
+ }, [isWatchingWorkflow]);
8719
8886
  React.useEffect(() => {
8720
- if (!watchResultToUse?.payload?.workflowState?.steps || !vNextResult?.runId) return;
8887
+ if (!watchResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
8721
8888
  const suspended = Object.entries(watchResultToUse.payload.workflowState.steps).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
8722
8889
  stepId,
8723
- runId: vNextResult.runId,
8890
+ runId: result.runId,
8724
8891
  suspendPayload: payload2
8725
8892
  }));
8726
8893
  setSuspendedSteps(suspended);
8727
- }, [watchResultToUse, vNextResult]);
8894
+ }, [watchResultToUse, result]);
8728
8895
  React.useEffect(() => {
8729
- if (watchVNextResult) {
8730
- setVNextResult(watchVNextResult);
8896
+ if (watchResult) {
8897
+ setResult(watchResult);
8731
8898
  }
8732
- }, [watchVNextResult]);
8899
+ }, [watchResult]);
8733
8900
  if (isLoading) {
8734
8901
  return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8735
8902
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-10" }),
8736
8903
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-10" })
8737
8904
  ] }) });
8738
8905
  }
8739
- if (!vNextWorkflow) return null;
8906
+ if (!workflow) return null;
8740
8907
  const isSuspendedSteps = suspendedSteps.length > 0;
8741
8908
  const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(triggerSchema))) : null;
8742
- const { sanitizedOutput, ...restResult } = vNextResult ?? {};
8743
- return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs w-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8744
- !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
8745
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between w-full", children: [
8746
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Input" }),
8747
- isResumingVNextWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
8748
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8749
- " Resuming workflow"
8750
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
8751
- ] }),
8752
- /* @__PURE__ */ jsxRuntime.jsx(
8753
- DynamicForm,
8754
- {
8755
- schema: zodInputSchema,
8756
- defaultValues: payload,
8757
- isSubmitLoading: isWatchingVNextWorkflow,
8758
- onSubmit: (data) => {
8759
- setPayload(data);
8760
- handleExecuteWorkflow(data);
8761
- }
8762
- }
8763
- )
8764
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 space-y-4", children: [
8765
- isResumingVNextWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
8766
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
8767
- " Resuming workflow"
8768
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
8769
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
8770
- ] }) }),
8771
- Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
8772
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
8773
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
8774
- const statusIcon = status === "success" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "failed" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
8775
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center justify-between p-3`, children: [
8776
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) }),
8777
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2 capitalize", children: [
8778
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
8779
- status
8780
- ] })
8781
- ] }) }, stepId) });
8782
- }) })
8909
+ const { sanitizedOutput, ...restResult } = result ?? {};
8910
+ const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
8911
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8912
+ isResumingWorkflow && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
8913
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin text-icon6" }) }),
8914
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { children: "Resuming workflow" })
8783
8915
  ] }),
8784
- !isWatchingVNextWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
8785
- const stepDefinition = vNextWorkflow.steps[step.stepId];
8916
+ !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsx(
8917
+ DynamicForm,
8918
+ {
8919
+ schema: zodInputSchema,
8920
+ defaultValues: payload,
8921
+ isSubmitLoading: isWatchingWorkflow,
8922
+ submitButtonLabel: "Run",
8923
+ onSubmit: (data) => {
8924
+ setPayload(data);
8925
+ handleExecuteWorkflow(data);
8926
+ }
8927
+ }
8928
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
8929
+ Button,
8930
+ {
8931
+ className: "w-full",
8932
+ variant: "light",
8933
+ disabled: isRunning,
8934
+ onClick: () => handleExecuteWorkflow(null),
8935
+ children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : "Trigger"
8936
+ }
8937
+ ) }),
8938
+ !isWatchingWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
8939
+ const stepDefinition = workflow.steps[step.stepId];
8786
8940
  const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.resumeSchema))) : z.z.record(z.z.string(), z.z.any());
8787
8941
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4", children: [
8788
8942
  /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
@@ -8798,7 +8952,7 @@ function VNextWorkflowTrigger({
8798
8952
  DynamicForm,
8799
8953
  {
8800
8954
  schema: stepSchema,
8801
- isSubmitLoading: isResumingVNextWorkflow,
8955
+ isSubmitLoading: isResumingWorkflow,
8802
8956
  submitButtonLabel: "Resume",
8803
8957
  onSubmit: (data) => {
8804
8958
  handleResumeWorkflow({
@@ -8812,23 +8966,18 @@ function VNextWorkflowTrigger({
8812
8966
  )
8813
8967
  ] });
8814
8968
  }),
8815
- vNextResult && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col group relative", children: [
8816
- /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Output" }),
8817
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8818
- CopyButton,
8819
- {
8820
- 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",
8821
- content: JSON.stringify(restResult, null, 2)
8822
- }
8823
- ) }),
8824
- /* @__PURE__ */ jsxRuntime.jsx(
8825
- CodeBlockDemo,
8826
- {
8827
- className: "w-full overflow-x-auto",
8828
- code: sanitizedOutput || JSON.stringify(restResult, null, 2),
8829
- language: "json"
8830
- }
8831
- )
8969
+ hasWorkflowActivePaths && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8970
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
8971
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
8972
+ /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
8973
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
8974
+ return /* @__PURE__ */ jsxRuntime.jsx(WorkflowStatus, { stepId, status });
8975
+ }) })
8976
+ ] })
8977
+ ] }),
8978
+ result && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8979
+ /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
8980
+ /* @__PURE__ */ jsxRuntime.jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
8832
8981
  ] })
8833
8982
  ] }) });
8834
8983
  }
@@ -8842,7 +8991,8 @@ const DataTable = ({
8842
8991
  getRowId,
8843
8992
  selectedRowId,
8844
8993
  isLoading,
8845
- emptyText
8994
+ emptyText,
8995
+ onClick
8846
8996
  }) => {
8847
8997
  const [sorting, setSorting] = React.useState([]);
8848
8998
  const [{ pageIndex, pageSize }, setPagination] = React.useState({
@@ -8884,7 +9034,16 @@ const DataTable = ({
8884
9034
  const meta = header.column.columnDef.meta;
8885
9035
  return /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: meta?.width || size || "auto" }, children: header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
8886
9036
  }) }),
8887
- /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(Row, { children: Array.from({ length: columns.length }).map((_2, cellIndex) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }, `row-${rowIndex}-cell-${cellIndex}`)) }, rowIndex)) }) : rows?.length > 0 ? rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { "data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected", children: row.getVisibleCells().map((cell) => reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())) }, row.id)) : emptyNode })
9037
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => {
9038
+ }, children: Array.from({ length: columns.length }).map((_2, cellIndex) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }, `row-${rowIndex}-cell-${cellIndex}`)) }, rowIndex)) }) : rows?.length > 0 ? rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
9039
+ Row,
9040
+ {
9041
+ "data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected",
9042
+ onClick: () => onClick?.(row.original),
9043
+ children: row.getVisibleCells().map((cell) => reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()))
9044
+ },
9045
+ row.id
9046
+ )) : emptyNode })
8888
9047
  ] }),
8889
9048
  pagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex items-center justify-between px-2", children: [
8890
9049
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground text-sm", children: [
@@ -9247,6 +9406,7 @@ exports.EntryCell = EntryCell;
9247
9406
  exports.EnvIcon = EnvIcon;
9248
9407
  exports.EvaluatorCoinIcon = EvaluatorCoinIcon;
9249
9408
  exports.FiltersIcon = FiltersIcon;
9409
+ exports.FolderIcon = FolderIcon;
9250
9410
  exports.GithubCoinIcon = GithubCoinIcon;
9251
9411
  exports.GithubIcon = GithubIcon;
9252
9412
  exports.GoogleIcon = GoogleIcon;
@@ -9259,8 +9419,11 @@ exports.Icon = Icon;
9259
9419
  exports.InfoIcon = InfoIcon;
9260
9420
  exports.JudgeIcon = JudgeIcon;
9261
9421
  exports.LatencyIcon = LatencyIcon;
9422
+ exports.LegacyWorkflowGraph = LegacyWorkflowGraph;
9423
+ exports.LegacyWorkflowTrigger = LegacyWorkflowTrigger;
9262
9424
  exports.LogsIcon = LogsIcon;
9263
9425
  exports.MastraResizablePanel = MastraResizablePanel;
9426
+ exports.McpServerIcon = McpServerIcon;
9264
9427
  exports.MemoryIcon = MemoryIcon;
9265
9428
  exports.NetworkChat = NetworkChat;
9266
9429
  exports.NetworkContext = NetworkContext;
@@ -9289,8 +9452,6 @@ exports.TsIcon = TsIcon;
9289
9452
  exports.Txt = Txt;
9290
9453
  exports.TxtCell = TxtCell;
9291
9454
  exports.UnitCell = UnitCell;
9292
- exports.VNextWorkflowGraph = VNextWorkflowGraph;
9293
- exports.VNextWorkflowTrigger = VNextWorkflowTrigger;
9294
9455
  exports.VariablesIcon = VariablesIcon;
9295
9456
  exports.WorkflowCoinIcon = WorkflowCoinIcon;
9296
9457
  exports.WorkflowGraph = WorkflowGraph;