@mastra/playground-ui 5.0.5-alpha.0 → 5.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +475 -343
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +475 -343
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/assistant-ui/image-with-fallback.d.ts +3 -0
- package/dist/src/components/assistant-ui/thread.d.ts +2 -1
- package/dist/src/components/ui/data-table.d.ts +2 -1
- package/dist/src/domains/workflows/context/legacy-workflow-nested-graph-context.d.ts +13 -0
- package/dist/src/domains/workflows/context/workflow-nested-graph-context.d.ts +4 -3
- package/dist/src/domains/workflows/context/workflow-run-context.d.ts +4 -4
- package/dist/src/domains/workflows/index.d.ts +3 -3
- package/dist/src/domains/workflows/workflow/legacy-workflow-graph-inner.d.ts +5 -0
- package/dist/src/domains/workflows/workflow/{v-next-workflow-graph.d.ts → legacy-workflow-graph.d.ts} +1 -1
- package/dist/src/domains/workflows/workflow/legacy-workflow-nested-graph.d.ts +6 -0
- package/dist/src/domains/workflows/workflow/legacy-workflow-nested-node.d.ts +12 -0
- package/dist/src/domains/workflows/workflow/legacy-workflow-status.d.ts +6 -0
- package/dist/src/domains/workflows/workflow/{v-next-workflow-trigger.d.ts → legacy-workflow-trigger.d.ts} +1 -1
- package/dist/src/domains/workflows/workflow/utils.d.ts +5 -5
- package/dist/src/domains/workflows/workflow/workflow-card.d.ts +6 -0
- package/dist/src/domains/workflows/workflow/workflow-graph-inner.d.ts +2 -2
- package/dist/src/domains/workflows/workflow/workflow-nested-graph.d.ts +3 -3
- package/dist/src/domains/workflows/workflow/workflow-nested-node.d.ts +2 -2
- package/dist/src/domains/workflows/workflow/workflow-result.d.ts +5 -0
- package/dist/src/domains/workflows/workflow/workflow-status.d.ts +5 -0
- package/dist/src/ds/tokens/sizes.d.ts +1 -0
- package/dist/src/hooks/use-workflows.d.ts +24 -24
- package/dist/tokens.cjs.js +1 -0
- package/dist/tokens.cjs.js.map +1 -1
- package/dist/tokens.es.js +1 -0
- package/dist/tokens.es.js.map +1 -1
- package/package.json +6 -5
- package/dist/src/domains/workflows/context/v-next-workflow-nested-graph-context.d.ts +0 -14
- package/dist/src/domains/workflows/workflow/v-next-workflow-graph-inner.d.ts +0 -5
- package/dist/src/domains/workflows/workflow/v-next-workflow-nested-graph.d.ts +0 -6
- 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: "
|
|
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: "
|
|
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: "
|
|
3800
|
+
fill: "currentColor"
|
|
3760
3801
|
}
|
|
3761
3802
|
) });
|
|
3762
3803
|
|
|
@@ -3889,7 +3930,10 @@ const AssistantMessage = ({
|
|
|
3889
3930
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3890
3931
|
react.MessagePrimitive.Content,
|
|
3891
3932
|
{
|
|
3892
|
-
components: {
|
|
3933
|
+
components: {
|
|
3934
|
+
Text: MarkdownText,
|
|
3935
|
+
tools: { Fallback: ToolFallbackCustom || ToolFallback$1 }
|
|
3936
|
+
}
|
|
3893
3937
|
}
|
|
3894
3938
|
) }),
|
|
3895
3939
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar, {}) })
|
|
@@ -3953,13 +3997,27 @@ const useAutoscroll = (ref, { enabled = true }) => {
|
|
|
3953
3997
|
}, [enabled, ref]);
|
|
3954
3998
|
};
|
|
3955
3999
|
|
|
3956
|
-
const
|
|
4000
|
+
const variants = {
|
|
4001
|
+
"header-md": "text-header-md leading-header-md",
|
|
4002
|
+
"ui-lg": "text-ui-lg leading-ui-lg",
|
|
4003
|
+
"ui-md": "text-ui-md leading-ui-md",
|
|
4004
|
+
"ui-sm": "text-ui-sm leading-ui-sm",
|
|
4005
|
+
"ui-xs": "text-ui-xs leading-ui-xs"
|
|
4006
|
+
};
|
|
4007
|
+
const fonts = {
|
|
4008
|
+
mono: "font-mono"
|
|
4009
|
+
};
|
|
4010
|
+
const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
|
|
4011
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
|
|
4012
|
+
};
|
|
4013
|
+
|
|
4014
|
+
const Thread = ({ ToolFallback, agentName, hasMemory }) => {
|
|
3957
4015
|
const areaRef = React.useRef(null);
|
|
3958
4016
|
useAutoscroll(areaRef, { enabled: true });
|
|
3959
4017
|
const WrappedAssistantMessage = (props) => {
|
|
3960
4018
|
return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback });
|
|
3961
4019
|
};
|
|
3962
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-
|
|
4020
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-110px)] px-4", children: [
|
|
3963
4021
|
/* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
3964
4022
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3965
4023
|
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { agentName }),
|
|
@@ -3976,7 +4034,7 @@ const Thread = ({ ToolFallback, agentName }) => {
|
|
|
3976
4034
|
] }),
|
|
3977
4035
|
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
|
|
3978
4036
|
] }),
|
|
3979
|
-
/* @__PURE__ */ jsxRuntime.jsx(Composer, {})
|
|
4037
|
+
/* @__PURE__ */ jsxRuntime.jsx(Composer, { hasMemory })
|
|
3980
4038
|
] });
|
|
3981
4039
|
};
|
|
3982
4040
|
const ThreadWelcome = ({ agentName }) => {
|
|
@@ -3995,19 +4053,25 @@ const ThreadWelcome = ({ agentName }) => {
|
|
|
3995
4053
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
3996
4054
|
] }) });
|
|
3997
4055
|
};
|
|
3998
|
-
const Composer = () => {
|
|
3999
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4000
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4001
|
-
"
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4056
|
+
const Composer = ({ hasMemory }) => {
|
|
4057
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4058
|
+
/* @__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: [
|
|
4059
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4060
|
+
"textarea",
|
|
4061
|
+
{
|
|
4062
|
+
className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
|
|
4063
|
+
autoFocus: true,
|
|
4064
|
+
placeholder: "Enter your message...",
|
|
4065
|
+
name: "",
|
|
4066
|
+
id: ""
|
|
4067
|
+
}
|
|
4068
|
+
) }),
|
|
4069
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ComposerAction, {}) })
|
|
4070
|
+
] }),
|
|
4071
|
+
!hasMemory && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
|
|
4072
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, {}) }),
|
|
4073
|
+
"Memory is not enabled. The conversation will not be persisted."
|
|
4074
|
+
] })
|
|
4011
4075
|
] });
|
|
4012
4076
|
};
|
|
4013
4077
|
const ComposerAction = () => {
|
|
@@ -4439,7 +4503,7 @@ const AgentChat = ({
|
|
|
4439
4503
|
modelSettings,
|
|
4440
4504
|
chatWithGenerate,
|
|
4441
4505
|
runtimeContext,
|
|
4442
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "" }) })
|
|
4506
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "", hasMemory: memory }) })
|
|
4443
4507
|
}
|
|
4444
4508
|
);
|
|
4445
4509
|
};
|
|
@@ -4499,18 +4563,18 @@ function FormattedDate({ date }) {
|
|
|
4499
4563
|
}
|
|
4500
4564
|
|
|
4501
4565
|
const inputVariants = cva(
|
|
4502
|
-
"flex w-full text-
|
|
4566
|
+
"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
4567
|
{
|
|
4504
4568
|
variants: {
|
|
4505
4569
|
variant: {
|
|
4506
|
-
default: "border-
|
|
4507
|
-
filled: "bg-inputFill border-
|
|
4508
|
-
unstyled: "border-0 bg-transparent placeholder:text-
|
|
4570
|
+
default: "border-sm border-border1 placeholder:text-icon3",
|
|
4571
|
+
filled: "border-sm bg-inputFill border-border1 placeholder:text-icon3",
|
|
4572
|
+
unstyled: "border-0 bg-transparent placeholder:text-icon3 focus-visible:ring-transparent focus-visible:outline-none"
|
|
4509
4573
|
},
|
|
4510
4574
|
customSize: {
|
|
4511
|
-
default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-
|
|
4575
|
+
default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-8",
|
|
4512
4576
|
sm: "h-[30px] px-[13px] text-xs",
|
|
4513
|
-
lg: "h-10 px-[17px]
|
|
4577
|
+
lg: "h-10 px-[17px] text-[calc(13_/_16_*_1rem)]"
|
|
4514
4578
|
}
|
|
4515
4579
|
},
|
|
4516
4580
|
defaultVariants: {
|
|
@@ -4989,20 +5053,6 @@ const Row = ({ className, children, selected = false, onClick }) => {
|
|
|
4989
5053
|
);
|
|
4990
5054
|
};
|
|
4991
5055
|
|
|
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
5056
|
const formatDateCell = (date) => {
|
|
5007
5057
|
const month = new Intl.DateTimeFormat("en-US", { month: "short" }).format(date).toUpperCase();
|
|
5008
5058
|
const day = date.getDate();
|
|
@@ -6184,7 +6234,7 @@ function WorkflowTracesInner({ traces, isLoading, error }) {
|
|
|
6184
6234
|
] });
|
|
6185
6235
|
}
|
|
6186
6236
|
|
|
6187
|
-
const
|
|
6237
|
+
const sanitizeWorkflowWatchResult = (record) => {
|
|
6188
6238
|
const formattedResults = Object.entries(record.payload.workflowState.steps || {}).reduce(
|
|
6189
6239
|
(acc, [key, value]) => {
|
|
6190
6240
|
let output = value.status === "success" ? value.output : void 0;
|
|
@@ -6219,8 +6269,8 @@ const sanitizeVNexWorkflowWatchResult = (record) => {
|
|
|
6219
6269
|
};
|
|
6220
6270
|
return sanitizedRecord;
|
|
6221
6271
|
};
|
|
6222
|
-
const
|
|
6223
|
-
const [
|
|
6272
|
+
const useLegacyWorkflow = (workflowId, baseUrl) => {
|
|
6273
|
+
const [legacyWorkflow, setLegacyWorkflow] = React.useState(null);
|
|
6224
6274
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
6225
6275
|
const client = createMastraClient(baseUrl);
|
|
6226
6276
|
React.useEffect(() => {
|
|
@@ -6228,22 +6278,22 @@ const useWorkflow = (workflowId, baseUrl) => {
|
|
|
6228
6278
|
setIsLoading(true);
|
|
6229
6279
|
try {
|
|
6230
6280
|
if (!workflowId) {
|
|
6231
|
-
|
|
6281
|
+
setLegacyWorkflow(null);
|
|
6232
6282
|
setIsLoading(false);
|
|
6233
6283
|
return;
|
|
6234
6284
|
}
|
|
6235
|
-
const res = await client.
|
|
6285
|
+
const res = await client.getLegacyWorkflow(workflowId).details();
|
|
6236
6286
|
if (!res) {
|
|
6237
|
-
|
|
6238
|
-
console.error("Error fetching workflow");
|
|
6239
|
-
sonner.toast.error("Error fetching workflow");
|
|
6287
|
+
setLegacyWorkflow(null);
|
|
6288
|
+
console.error("Error fetching legacy workflow");
|
|
6289
|
+
sonner.toast.error("Error fetching legacy workflow");
|
|
6240
6290
|
return;
|
|
6241
6291
|
}
|
|
6242
6292
|
const steps = res.steps;
|
|
6243
6293
|
const stepsWithWorkflow = await Promise.all(
|
|
6244
6294
|
Object.values(steps)?.map(async (step) => {
|
|
6245
6295
|
if (!step.workflowId) return step;
|
|
6246
|
-
const wFlow = await client.
|
|
6296
|
+
const wFlow = await client.getLegacyWorkflow(step.workflowId).details();
|
|
6247
6297
|
if (!wFlow) return step;
|
|
6248
6298
|
return { ...step, stepGraph: wFlow.stepGraph, stepSubscriberGraph: wFlow.stepSubscriberGraph };
|
|
6249
6299
|
})
|
|
@@ -6251,21 +6301,21 @@ const useWorkflow = (workflowId, baseUrl) => {
|
|
|
6251
6301
|
const _steps = stepsWithWorkflow.reduce((acc, b) => {
|
|
6252
6302
|
return { ...acc, [b.id]: b };
|
|
6253
6303
|
}, {});
|
|
6254
|
-
|
|
6304
|
+
setLegacyWorkflow({ ...res, steps: _steps });
|
|
6255
6305
|
} catch (error) {
|
|
6256
|
-
|
|
6257
|
-
console.error("Error fetching workflow", error);
|
|
6258
|
-
sonner.toast.error("Error fetching workflow");
|
|
6306
|
+
setLegacyWorkflow(null);
|
|
6307
|
+
console.error("Error fetching legacy workflow", error);
|
|
6308
|
+
sonner.toast.error("Error fetching legacy workflow");
|
|
6259
6309
|
} finally {
|
|
6260
6310
|
setIsLoading(false);
|
|
6261
6311
|
}
|
|
6262
6312
|
};
|
|
6263
6313
|
fetchWorkflow();
|
|
6264
6314
|
}, [workflowId]);
|
|
6265
|
-
return {
|
|
6315
|
+
return { legacyWorkflow, isLoading };
|
|
6266
6316
|
};
|
|
6267
|
-
const
|
|
6268
|
-
const [
|
|
6317
|
+
const useWorkflow = (workflowId, baseUrl) => {
|
|
6318
|
+
const [workflow, setWorkflow] = React.useState(null);
|
|
6269
6319
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
6270
6320
|
const client = createMastraClient(baseUrl);
|
|
6271
6321
|
React.useEffect(() => {
|
|
@@ -6273,14 +6323,14 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
|
6273
6323
|
setIsLoading(true);
|
|
6274
6324
|
try {
|
|
6275
6325
|
if (!workflowId) {
|
|
6276
|
-
|
|
6326
|
+
setWorkflow(null);
|
|
6277
6327
|
setIsLoading(false);
|
|
6278
6328
|
return;
|
|
6279
6329
|
}
|
|
6280
|
-
const res = await client.
|
|
6281
|
-
|
|
6330
|
+
const res = await client.getWorkflow(workflowId).details();
|
|
6331
|
+
setWorkflow(res);
|
|
6282
6332
|
} catch (error) {
|
|
6283
|
-
|
|
6333
|
+
setWorkflow(null);
|
|
6284
6334
|
console.error("Error fetching workflow", error);
|
|
6285
6335
|
sonner.toast.error("Error fetching workflow");
|
|
6286
6336
|
} finally {
|
|
@@ -6289,13 +6339,13 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
|
6289
6339
|
};
|
|
6290
6340
|
fetchWorkflow();
|
|
6291
6341
|
}, [workflowId]);
|
|
6292
|
-
return {
|
|
6342
|
+
return { workflow, isLoading };
|
|
6293
6343
|
};
|
|
6294
6344
|
const useExecuteWorkflow = (baseUrl) => {
|
|
6295
6345
|
const client = createMastraClient(baseUrl);
|
|
6296
|
-
const
|
|
6346
|
+
const createLegacyWorkflowRun = async ({ workflowId, prevRunId }) => {
|
|
6297
6347
|
try {
|
|
6298
|
-
const workflow = client.
|
|
6348
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6299
6349
|
const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
|
|
6300
6350
|
return { runId: newRunId };
|
|
6301
6351
|
} catch (error) {
|
|
@@ -6303,9 +6353,9 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6303
6353
|
throw error;
|
|
6304
6354
|
}
|
|
6305
6355
|
};
|
|
6306
|
-
const
|
|
6356
|
+
const createWorkflowRun = async ({ workflowId, prevRunId }) => {
|
|
6307
6357
|
try {
|
|
6308
|
-
const workflow = client.
|
|
6358
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6309
6359
|
const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
|
|
6310
6360
|
return { runId: newRunId };
|
|
6311
6361
|
} catch (error) {
|
|
@@ -6313,16 +6363,20 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6313
6363
|
throw error;
|
|
6314
6364
|
}
|
|
6315
6365
|
};
|
|
6316
|
-
const
|
|
6366
|
+
const startLegacyWorkflowRun = async ({
|
|
6367
|
+
workflowId,
|
|
6368
|
+
runId,
|
|
6369
|
+
input
|
|
6370
|
+
}) => {
|
|
6317
6371
|
try {
|
|
6318
|
-
const workflow = client.
|
|
6372
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6319
6373
|
await workflow.start({ runId, triggerData: input || {} });
|
|
6320
6374
|
} catch (error) {
|
|
6321
6375
|
console.error("Error starting workflow run:", error);
|
|
6322
6376
|
throw error;
|
|
6323
6377
|
}
|
|
6324
6378
|
};
|
|
6325
|
-
const
|
|
6379
|
+
const startWorkflowRun = async ({
|
|
6326
6380
|
workflowId,
|
|
6327
6381
|
runId,
|
|
6328
6382
|
input,
|
|
@@ -6333,14 +6387,14 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6333
6387
|
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6334
6388
|
runtimeContext$1.set(key, value);
|
|
6335
6389
|
});
|
|
6336
|
-
const workflow = client.
|
|
6390
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6337
6391
|
await workflow.start({ runId, inputData: input || {}, runtimeContext: runtimeContext$1 });
|
|
6338
6392
|
} catch (error) {
|
|
6339
6393
|
console.error("Error starting workflow run:", error);
|
|
6340
6394
|
throw error;
|
|
6341
6395
|
}
|
|
6342
6396
|
};
|
|
6343
|
-
const
|
|
6397
|
+
const startAsyncWorkflowRun = async ({
|
|
6344
6398
|
workflowId,
|
|
6345
6399
|
runId,
|
|
6346
6400
|
input,
|
|
@@ -6351,7 +6405,7 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6351
6405
|
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6352
6406
|
runtimeContext$1.set(key, value);
|
|
6353
6407
|
});
|
|
6354
|
-
const workflow = client.
|
|
6408
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6355
6409
|
const result = await workflow.startAsync({ runId, inputData: input || {}, runtimeContext: runtimeContext$1 });
|
|
6356
6410
|
return result;
|
|
6357
6411
|
} catch (error) {
|
|
@@ -6362,17 +6416,17 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6362
6416
|
return {
|
|
6363
6417
|
startWorkflowRun,
|
|
6364
6418
|
createWorkflowRun,
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6419
|
+
startLegacyWorkflowRun,
|
|
6420
|
+
createLegacyWorkflowRun,
|
|
6421
|
+
startAsyncWorkflowRun
|
|
6368
6422
|
};
|
|
6369
6423
|
};
|
|
6370
6424
|
const useWatchWorkflow = (baseUrl) => {
|
|
6425
|
+
const [isWatchingLegacyWorkflow, setIsWatchingLegacyWorkflow] = React.useState(false);
|
|
6371
6426
|
const [isWatchingWorkflow, setIsWatchingWorkflow] = React.useState(false);
|
|
6372
|
-
const [
|
|
6427
|
+
const [legacyWatchResult, setLegacyWatchResult] = React.useState(null);
|
|
6373
6428
|
const [watchResult, setWatchResult] = React.useState(null);
|
|
6374
|
-
const
|
|
6375
|
-
const debouncedSetWatchResult = useDebounce.useDebouncedCallback((record) => {
|
|
6429
|
+
const debouncedSetLegacyWorkflowWatchResult = useDebounce.useDebouncedCallback((record) => {
|
|
6376
6430
|
const formattedResults = Object.entries(record.results || {}).reduce(
|
|
6377
6431
|
(acc, [key, value]) => {
|
|
6378
6432
|
let output = value.status === "success" ? value.output : void 0;
|
|
@@ -6395,19 +6449,19 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6395
6449
|
...record,
|
|
6396
6450
|
sanitizedOutput: record ? JSON.stringify({ ...record, results: formattedResults }, null, 2).slice(0, 5e4) : null
|
|
6397
6451
|
};
|
|
6398
|
-
|
|
6452
|
+
setLegacyWatchResult(sanitizedRecord);
|
|
6399
6453
|
}, 100);
|
|
6400
|
-
const
|
|
6454
|
+
const watchLegacyWorkflow = async ({ workflowId, runId }) => {
|
|
6401
6455
|
try {
|
|
6402
|
-
|
|
6456
|
+
setIsWatchingLegacyWorkflow(true);
|
|
6403
6457
|
const client = createMastraClient(baseUrl);
|
|
6404
|
-
const workflow = client.
|
|
6458
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6405
6459
|
await workflow.watch({ runId }, (record) => {
|
|
6406
6460
|
try {
|
|
6407
|
-
|
|
6461
|
+
debouncedSetLegacyWorkflowWatchResult(record);
|
|
6408
6462
|
} catch (err) {
|
|
6409
6463
|
console.error("Error processing workflow record:", err);
|
|
6410
|
-
|
|
6464
|
+
setLegacyWatchResult({
|
|
6411
6465
|
...record
|
|
6412
6466
|
});
|
|
6413
6467
|
}
|
|
@@ -6416,24 +6470,24 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6416
6470
|
console.error("Error watching workflow:", error);
|
|
6417
6471
|
throw error;
|
|
6418
6472
|
} finally {
|
|
6419
|
-
|
|
6473
|
+
setIsWatchingLegacyWorkflow(false);
|
|
6420
6474
|
}
|
|
6421
6475
|
};
|
|
6422
|
-
const
|
|
6423
|
-
const sanitizedRecord =
|
|
6424
|
-
|
|
6476
|
+
const debouncedSetWorkflowWatchResult = useDebounce.useDebouncedCallback((record) => {
|
|
6477
|
+
const sanitizedRecord = sanitizeWorkflowWatchResult(record);
|
|
6478
|
+
setWatchResult(sanitizedRecord);
|
|
6425
6479
|
}, 100);
|
|
6426
|
-
const
|
|
6480
|
+
const watchWorkflow = async ({ workflowId, runId }) => {
|
|
6427
6481
|
try {
|
|
6428
|
-
|
|
6482
|
+
setIsWatchingWorkflow(true);
|
|
6429
6483
|
const client = createMastraClient(baseUrl);
|
|
6430
|
-
const workflow = client.
|
|
6484
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6431
6485
|
await workflow.watch({ runId }, (record) => {
|
|
6432
6486
|
try {
|
|
6433
|
-
|
|
6487
|
+
debouncedSetWorkflowWatchResult(record);
|
|
6434
6488
|
} catch (err) {
|
|
6435
6489
|
console.error("Error processing workflow record:", err);
|
|
6436
|
-
|
|
6490
|
+
setWatchResult({
|
|
6437
6491
|
...record
|
|
6438
6492
|
});
|
|
6439
6493
|
}
|
|
@@ -6442,40 +6496,40 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6442
6496
|
console.error("Error watching workflow:", error);
|
|
6443
6497
|
throw error;
|
|
6444
6498
|
} finally {
|
|
6445
|
-
|
|
6499
|
+
setIsWatchingWorkflow(false);
|
|
6446
6500
|
}
|
|
6447
6501
|
};
|
|
6448
6502
|
return {
|
|
6503
|
+
watchLegacyWorkflow,
|
|
6504
|
+
isWatchingLegacyWorkflow,
|
|
6505
|
+
legacyWatchResult,
|
|
6449
6506
|
watchWorkflow,
|
|
6450
6507
|
isWatchingWorkflow,
|
|
6451
|
-
watchResult
|
|
6452
|
-
watchVNextWorkflow,
|
|
6453
|
-
isWatchingVNextWorkflow,
|
|
6454
|
-
watchVNextResult
|
|
6508
|
+
watchResult
|
|
6455
6509
|
};
|
|
6456
6510
|
};
|
|
6457
6511
|
const useResumeWorkflow = (baseUrl) => {
|
|
6512
|
+
const [isResumingLegacyWorkflow, setIsResumingLegacyWorkflow] = React.useState(false);
|
|
6458
6513
|
const [isResumingWorkflow, setIsResumingWorkflow] = React.useState(false);
|
|
6459
|
-
const
|
|
6460
|
-
const resumeWorkflow = async ({
|
|
6514
|
+
const resumeLegacyWorkflow = async ({
|
|
6461
6515
|
workflowId,
|
|
6462
6516
|
stepId,
|
|
6463
6517
|
runId,
|
|
6464
6518
|
context
|
|
6465
6519
|
}) => {
|
|
6466
6520
|
try {
|
|
6467
|
-
|
|
6521
|
+
setIsResumingLegacyWorkflow(true);
|
|
6468
6522
|
const client = createMastraClient(baseUrl);
|
|
6469
|
-
const response = await client.
|
|
6523
|
+
const response = await client.getLegacyWorkflow(workflowId).resume({ stepId, runId, context });
|
|
6470
6524
|
return response;
|
|
6471
6525
|
} catch (error) {
|
|
6472
6526
|
console.error("Error resuming workflow:", error);
|
|
6473
6527
|
throw error;
|
|
6474
6528
|
} finally {
|
|
6475
|
-
|
|
6529
|
+
setIsResumingLegacyWorkflow(false);
|
|
6476
6530
|
}
|
|
6477
6531
|
};
|
|
6478
|
-
const
|
|
6532
|
+
const resumeWorkflow = async ({
|
|
6479
6533
|
workflowId,
|
|
6480
6534
|
step,
|
|
6481
6535
|
runId,
|
|
@@ -6483,26 +6537,26 @@ const useResumeWorkflow = (baseUrl) => {
|
|
|
6483
6537
|
runtimeContext: playgroundRuntimeContext
|
|
6484
6538
|
}) => {
|
|
6485
6539
|
try {
|
|
6486
|
-
|
|
6540
|
+
setIsResumingWorkflow(true);
|
|
6487
6541
|
const client = createMastraClient(baseUrl);
|
|
6488
6542
|
const runtimeContext$1 = new runtimeContext.RuntimeContext();
|
|
6489
6543
|
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6490
6544
|
runtimeContext$1.set(key, value);
|
|
6491
6545
|
});
|
|
6492
|
-
const response = await client.
|
|
6546
|
+
const response = await client.getWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext: runtimeContext$1 });
|
|
6493
6547
|
return response;
|
|
6494
6548
|
} catch (error) {
|
|
6495
6549
|
console.error("Error resuming workflow:", error);
|
|
6496
6550
|
throw error;
|
|
6497
6551
|
} finally {
|
|
6498
|
-
|
|
6552
|
+
setIsResumingWorkflow(false);
|
|
6499
6553
|
}
|
|
6500
6554
|
};
|
|
6501
6555
|
return {
|
|
6556
|
+
resumeLegacyWorkflow,
|
|
6557
|
+
isResumingLegacyWorkflow,
|
|
6502
6558
|
resumeWorkflow,
|
|
6503
|
-
isResumingWorkflow
|
|
6504
|
-
resumeVNextWorkflow,
|
|
6505
|
-
isResumingVNextWorkflow
|
|
6559
|
+
isResumingWorkflow
|
|
6506
6560
|
};
|
|
6507
6561
|
};
|
|
6508
6562
|
|
|
@@ -6589,7 +6643,7 @@ const defaultEdgeOptions = {
|
|
|
6589
6643
|
color: "#8e8e8e"
|
|
6590
6644
|
}
|
|
6591
6645
|
};
|
|
6592
|
-
const
|
|
6646
|
+
const contructLegacyNodesAndEdges = ({
|
|
6593
6647
|
stepGraph,
|
|
6594
6648
|
stepSubscriberGraph,
|
|
6595
6649
|
steps: mainSteps = {}
|
|
@@ -7040,7 +7094,7 @@ const getStepNodeAndEdge = ({
|
|
|
7040
7094
|
}
|
|
7041
7095
|
return { nodes: [], edges: [], nextPrevNodeIds: [] };
|
|
7042
7096
|
};
|
|
7043
|
-
const
|
|
7097
|
+
const constructNodesAndEdges = ({
|
|
7044
7098
|
stepGraph
|
|
7045
7099
|
}) => {
|
|
7046
7100
|
if (!stepGraph) {
|
|
@@ -7379,12 +7433,12 @@ function Spinner({ color = "#fff", className }) {
|
|
|
7379
7433
|
);
|
|
7380
7434
|
}
|
|
7381
7435
|
|
|
7382
|
-
function
|
|
7436
|
+
function LegacyWorkflowNestedGraph({
|
|
7383
7437
|
stepGraph,
|
|
7384
7438
|
stepSubscriberGraph,
|
|
7385
7439
|
open
|
|
7386
7440
|
}) {
|
|
7387
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
7441
|
+
const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
|
|
7388
7442
|
stepGraph,
|
|
7389
7443
|
stepSubscriberGraph
|
|
7390
7444
|
});
|
|
@@ -7422,10 +7476,10 @@ function WorkflowNestedGraph({
|
|
|
7422
7476
|
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) });
|
|
7423
7477
|
}
|
|
7424
7478
|
|
|
7425
|
-
const
|
|
7479
|
+
const LegacyWorkflowNestedGraphContext = React.createContext(
|
|
7426
7480
|
{}
|
|
7427
7481
|
);
|
|
7428
|
-
function
|
|
7482
|
+
function LegacyWorkflowNestedGraphProvider({ children }) {
|
|
7429
7483
|
const [stepGraph, setStepGraph] = React.useState(null);
|
|
7430
7484
|
const [stepSubscriberGraph, setStepSubscriberGraph] = React.useState(null);
|
|
7431
7485
|
const [openDialog, setOpenDialog] = React.useState(false);
|
|
@@ -7447,7 +7501,7 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
7447
7501
|
setOpenDialog(true);
|
|
7448
7502
|
};
|
|
7449
7503
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7450
|
-
|
|
7504
|
+
LegacyWorkflowNestedGraphContext.Provider,
|
|
7451
7505
|
{
|
|
7452
7506
|
value: {
|
|
7453
7507
|
showNestedGraph,
|
|
@@ -7463,16 +7517,23 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
7463
7517
|
" workflow"
|
|
7464
7518
|
] })
|
|
7465
7519
|
] }),
|
|
7466
|
-
/* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7520
|
+
/* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7521
|
+
LegacyWorkflowNestedGraph,
|
|
7522
|
+
{
|
|
7523
|
+
stepGraph,
|
|
7524
|
+
open: openDialog,
|
|
7525
|
+
stepSubscriberGraph
|
|
7526
|
+
}
|
|
7527
|
+
) })
|
|
7467
7528
|
] }) }) })
|
|
7468
7529
|
]
|
|
7469
7530
|
}
|
|
7470
7531
|
);
|
|
7471
7532
|
}
|
|
7472
7533
|
|
|
7473
|
-
function
|
|
7534
|
+
function LegacyWorkflowNestedNode({ data }) {
|
|
7474
7535
|
const { label, withoutTopHandle, withoutBottomHandle, stepGraph, stepSubscriberGraph } = data;
|
|
7475
|
-
const { showNestedGraph } = React.useContext(
|
|
7536
|
+
const { showNestedGraph } = React.useContext(LegacyWorkflowNestedGraphContext);
|
|
7476
7537
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
|
|
7477
7538
|
!withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$2.Handle, { type: "target", position: react$2.Position.Top, style: { visibility: "hidden" } }),
|
|
7478
7539
|
/* @__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 +7544,8 @@ function WorkflowNestedNode({ data }) {
|
|
|
7483
7544
|
] });
|
|
7484
7545
|
}
|
|
7485
7546
|
|
|
7486
|
-
function
|
|
7487
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
7547
|
+
function LegacyWorkflowGraphInner({ workflow }) {
|
|
7548
|
+
const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
|
|
7488
7549
|
stepGraph: workflow.serializedStepGraph || workflow.stepGraph,
|
|
7489
7550
|
stepSubscriberGraph: workflow.serializedStepSubscriberGraph || workflow.stepSubscriberGraph,
|
|
7490
7551
|
steps: workflow.steps
|
|
@@ -7496,7 +7557,7 @@ function WorkflowGraphInner({ workflow }) {
|
|
|
7496
7557
|
"condition-node": WorkflowConditionNode,
|
|
7497
7558
|
"after-node": WorkflowAfterNode,
|
|
7498
7559
|
"loop-result-node": WorkflowLoopResultNode,
|
|
7499
|
-
"nested-node":
|
|
7560
|
+
"nested-node": LegacyWorkflowNestedNode
|
|
7500
7561
|
};
|
|
7501
7562
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7502
7563
|
react$2.ReactFlow,
|
|
@@ -7523,12 +7584,12 @@ const lodashTitleCase = (str) => {
|
|
|
7523
7584
|
return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
|
|
7524
7585
|
};
|
|
7525
7586
|
|
|
7526
|
-
function
|
|
7527
|
-
const {
|
|
7587
|
+
function LegacyWorkflowGraph({ workflowId, baseUrl }) {
|
|
7588
|
+
const { legacyWorkflow, isLoading } = useLegacyWorkflow(workflowId, baseUrl);
|
|
7528
7589
|
if (isLoading) {
|
|
7529
7590
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-[600px]" }) });
|
|
7530
7591
|
}
|
|
7531
|
-
if (!
|
|
7592
|
+
if (!legacyWorkflow) {
|
|
7532
7593
|
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
7594
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, {}),
|
|
7534
7595
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -7538,28 +7599,24 @@ function WorkflowGraph({ workflowId, baseUrl }) {
|
|
|
7538
7599
|
] })
|
|
7539
7600
|
] }) });
|
|
7540
7601
|
}
|
|
7541
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7602
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowGraphInner, { workflow: legacyWorkflow }) }) });
|
|
7542
7603
|
}
|
|
7543
7604
|
|
|
7544
7605
|
const Form = React.forwardRef(({ children, ...props }, ref) => {
|
|
7545
7606
|
return /* @__PURE__ */ jsxRuntime.jsx("form", { ref, className: "space-y-4", ...props, children });
|
|
7546
7607
|
});
|
|
7547
7608
|
|
|
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
7609
|
const DISABLED_LABELS = ["boolean", "object", "array"];
|
|
7553
7610
|
const FieldWrapper = ({ label, children, id, field, error }) => {
|
|
7554
7611
|
const isDisabled = DISABLED_LABELS.includes(field.type);
|
|
7555
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
7556
|
-
!isDisabled && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7612
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pb-4 last:pb-0", children: [
|
|
7613
|
+
!isDisabled && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3 pb-1 block", htmlFor: id, children: [
|
|
7557
7614
|
label,
|
|
7558
|
-
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
7615
|
+
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent2", children: " *" })
|
|
7559
7616
|
] }),
|
|
7560
7617
|
children,
|
|
7561
|
-
field.fieldConfig?.description && /* @__PURE__ */ jsxRuntime.jsx("p",
|
|
7562
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("p",
|
|
7618
|
+
field.fieldConfig?.description && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon6", children: field.fieldConfig.description }),
|
|
7619
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: "text-accent2", children: error })
|
|
7563
7620
|
] });
|
|
7564
7621
|
};
|
|
7565
7622
|
|
|
@@ -7668,9 +7725,9 @@ const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ *
|
|
|
7668
7725
|
defaultChecked: field.default
|
|
7669
7726
|
}
|
|
7670
7727
|
),
|
|
7671
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7728
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3", htmlFor: id, children: [
|
|
7672
7729
|
label,
|
|
7673
|
-
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
7730
|
+
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent2", children: " *" })
|
|
7674
7731
|
] })
|
|
7675
7732
|
] });
|
|
7676
7733
|
|
|
@@ -8017,34 +8074,53 @@ const SelectField = ({ field, inputProps, error, id, value }) => {
|
|
|
8017
8074
|
};
|
|
8018
8075
|
|
|
8019
8076
|
const ObjectWrapper = ({ label, children }) => {
|
|
8020
|
-
|
|
8021
|
-
|
|
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,
|
|
8077
|
+
const hasLabel = label !== "" && label !== "";
|
|
8078
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "", children: [
|
|
8079
|
+
hasLabel && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 flex items-center gap-1 pb-2", children: [
|
|
8080
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Braces, {}) }),
|
|
8081
|
+
label
|
|
8082
|
+
] }),
|
|
8030
8083
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8031
|
-
|
|
8084
|
+
"div",
|
|
8032
8085
|
{
|
|
8033
|
-
className: "
|
|
8034
|
-
|
|
8035
|
-
variant: "outline",
|
|
8036
|
-
size: "sm",
|
|
8037
|
-
type: "button",
|
|
8038
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "h-4 w-4" })
|
|
8086
|
+
className: hasLabel ? "flex flex-col gap-1 [&>*]:border-dashed [&>*]:border-l [&>*]:border-l-border1 [&>*]:pl-4" : "",
|
|
8087
|
+
children
|
|
8039
8088
|
}
|
|
8040
8089
|
)
|
|
8041
8090
|
] });
|
|
8042
8091
|
};
|
|
8043
8092
|
|
|
8093
|
+
const ArrayWrapper = ({ label, children, onAddItem }) => {
|
|
8094
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8095
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 justify-between", children: [
|
|
8096
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 pb-2 flex items-center gap-1", children: [
|
|
8097
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Brackets, {}) }),
|
|
8098
|
+
label
|
|
8099
|
+
] }),
|
|
8100
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { delayDuration: 0, children: [
|
|
8101
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8102
|
+
"button",
|
|
8103
|
+
{
|
|
8104
|
+
onClick: onAddItem,
|
|
8105
|
+
type: "button",
|
|
8106
|
+
className: "text-icon3 bg-surface3 rounded-md p-1 hover:bg-surface4 hover:text-icon6 h-icon-sm w-icon-sm",
|
|
8107
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, {}) })
|
|
8108
|
+
}
|
|
8109
|
+
) }),
|
|
8110
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Add item" })
|
|
8111
|
+
] }) })
|
|
8112
|
+
] }),
|
|
8113
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children })
|
|
8114
|
+
] });
|
|
8115
|
+
};
|
|
8116
|
+
|
|
8044
8117
|
const ArrayElementWrapper = ({ children, onRemove }) => {
|
|
8045
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
8046
|
-
|
|
8047
|
-
children
|
|
8118
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pl-4 border-l border-border1", children: [
|
|
8119
|
+
children,
|
|
8120
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: onRemove, type: "button", children: [
|
|
8121
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrashIcon, {}) }),
|
|
8122
|
+
"Delete"
|
|
8123
|
+
] })
|
|
8048
8124
|
] });
|
|
8049
8125
|
};
|
|
8050
8126
|
|
|
@@ -8243,6 +8319,10 @@ class CustomZodProvider extends zod.ZodProvider {
|
|
|
8243
8319
|
}
|
|
8244
8320
|
}
|
|
8245
8321
|
|
|
8322
|
+
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
8323
|
+
const Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(LabelPrimitive__namespace.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
8324
|
+
Label.displayName = LabelPrimitive__namespace.Root.displayName;
|
|
8325
|
+
|
|
8246
8326
|
function isEmptyZodObject(schema) {
|
|
8247
8327
|
if (schema instanceof z.ZodObject) {
|
|
8248
8328
|
return Object.keys(schema.shape).length === 0;
|
|
@@ -8254,7 +8334,7 @@ function DynamicForm({
|
|
|
8254
8334
|
onSubmit,
|
|
8255
8335
|
defaultValues,
|
|
8256
8336
|
isSubmitLoading,
|
|
8257
|
-
submitButtonLabel
|
|
8337
|
+
submitButtonLabel
|
|
8258
8338
|
}) {
|
|
8259
8339
|
if (!schema) {
|
|
8260
8340
|
console.error("no form schema found");
|
|
@@ -8276,17 +8356,17 @@ function DynamicForm({
|
|
|
8276
8356
|
},
|
|
8277
8357
|
defaultValues: defaultValues ? { "": defaultValues } : void 0,
|
|
8278
8358
|
formProps: {
|
|
8279
|
-
className: "
|
|
8359
|
+
className: ""
|
|
8280
8360
|
},
|
|
8281
8361
|
uiComponents: {
|
|
8282
|
-
SubmitButton: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Button
|
|
8362
|
+
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
8363
|
},
|
|
8284
8364
|
formComponents: {
|
|
8285
8365
|
Label: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-normal", children: value })
|
|
8286
8366
|
},
|
|
8287
8367
|
withSubmit: true
|
|
8288
8368
|
};
|
|
8289
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8369
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntime.jsx(AutoForm, { ...formProps }) });
|
|
8290
8370
|
}
|
|
8291
8371
|
|
|
8292
8372
|
function resolveSerializedZodOutput(obj) {
|
|
@@ -8316,22 +8396,22 @@ function CodeBlockDemo({
|
|
|
8316
8396
|
|
|
8317
8397
|
const WorkflowRunContext = React.createContext({});
|
|
8318
8398
|
function WorkflowRunProvider({ children }) {
|
|
8399
|
+
const [legacyResult, setLegacyResult] = React.useState(null);
|
|
8319
8400
|
const [result, setResult] = React.useState(null);
|
|
8320
|
-
const [vNextResult, setVNextResult] = React.useState(null);
|
|
8321
8401
|
const [payload, setPayload] = React.useState(null);
|
|
8322
8402
|
const clearData = () => {
|
|
8403
|
+
setLegacyResult(null);
|
|
8323
8404
|
setResult(null);
|
|
8324
|
-
setVNextResult(null);
|
|
8325
8405
|
setPayload(null);
|
|
8326
8406
|
};
|
|
8327
8407
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8328
8408
|
WorkflowRunContext.Provider,
|
|
8329
8409
|
{
|
|
8330
8410
|
value: {
|
|
8411
|
+
legacyResult,
|
|
8412
|
+
setLegacyResult,
|
|
8331
8413
|
result,
|
|
8332
8414
|
setResult,
|
|
8333
|
-
vNextResult,
|
|
8334
|
-
setVNextResult,
|
|
8335
8415
|
payload,
|
|
8336
8416
|
setPayload,
|
|
8337
8417
|
clearData
|
|
@@ -8341,16 +8421,81 @@ function WorkflowRunProvider({ children }) {
|
|
|
8341
8421
|
);
|
|
8342
8422
|
}
|
|
8343
8423
|
|
|
8344
|
-
|
|
8424
|
+
const WorkflowCard = ({ header, children, footer }) => {
|
|
8425
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border-sm border-border1 bg-surface4", children: [
|
|
8426
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 px-2 flex items-center gap-3", children: header }),
|
|
8427
|
+
children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t-sm border-border1", children }),
|
|
8428
|
+
footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 px-2 border-t-sm border-border1", children: footer })
|
|
8429
|
+
] });
|
|
8430
|
+
};
|
|
8431
|
+
|
|
8432
|
+
const LegacyWorkflowStatus = ({ stepId, pathStatus, path }) => {
|
|
8433
|
+
const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : pathStatus === "executing" ? "Executing" : "Completed";
|
|
8434
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8435
|
+
WorkflowCard,
|
|
8436
|
+
{
|
|
8437
|
+
header: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
8438
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Icon, { children: [
|
|
8439
|
+
status === "Completed" && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "text-accent1" }),
|
|
8440
|
+
status === "Failed" && /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }),
|
|
8441
|
+
status === "Executing" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "text-icon3 animate-spin" })
|
|
8442
|
+
] }),
|
|
8443
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: path })
|
|
8444
|
+
] })
|
|
8445
|
+
}
|
|
8446
|
+
);
|
|
8447
|
+
};
|
|
8448
|
+
|
|
8449
|
+
const WorkflowResult = ({ jsonResult, sanitizedJsonResult }) => {
|
|
8450
|
+
const { handleCopy } = useCopyToClipboard({ text: jsonResult });
|
|
8451
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
8452
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8453
|
+
WorkflowCard,
|
|
8454
|
+
{
|
|
8455
|
+
header: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 justify-between w-full", children: [
|
|
8456
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "text-icon6 flex items-center gap-3 font-medium", children: [
|
|
8457
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(DeploymentIcon, {}) }),
|
|
8458
|
+
"Results"
|
|
8459
|
+
] }),
|
|
8460
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
8461
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8462
|
+
"button",
|
|
8463
|
+
{
|
|
8464
|
+
className: "p-2 rounded-lg hover:bg-surface5 transition-colors duration-150 ease-in-out text-icon3 hover:text-icon6",
|
|
8465
|
+
onClick: () => handleCopy(),
|
|
8466
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) })
|
|
8467
|
+
}
|
|
8468
|
+
) }),
|
|
8469
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Copy result" })
|
|
8470
|
+
] })
|
|
8471
|
+
] }),
|
|
8472
|
+
footer: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8473
|
+
"button",
|
|
8474
|
+
{
|
|
8475
|
+
className: "w-full h-full text-center text-icon2 hover:text-icon6 text-ui-md",
|
|
8476
|
+
onClick: () => setExpanded((s) => !s),
|
|
8477
|
+
children: expanded ? "collapse" : "expand"
|
|
8478
|
+
}
|
|
8479
|
+
),
|
|
8480
|
+
children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(CodeBlockDemo, { className: "w-full overflow-x-auto", code: sanitizedJsonResult || jsonResult, language: "json" }) : null
|
|
8481
|
+
}
|
|
8482
|
+
);
|
|
8483
|
+
};
|
|
8484
|
+
|
|
8485
|
+
function LegacyWorkflowTrigger({
|
|
8345
8486
|
workflowId,
|
|
8346
8487
|
baseUrl,
|
|
8347
8488
|
setRunId
|
|
8348
8489
|
}) {
|
|
8349
|
-
const { result, setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
|
|
8350
|
-
const { isLoading, workflow } =
|
|
8351
|
-
const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
8352
|
-
const {
|
|
8353
|
-
|
|
8490
|
+
const { legacyResult: result, setLegacyResult: setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
|
|
8491
|
+
const { isLoading, legacyWorkflow: workflow } = useLegacyWorkflow(workflowId, baseUrl);
|
|
8492
|
+
const { createLegacyWorkflowRun: createWorkflowRun, startLegacyWorkflowRun: startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
8493
|
+
const {
|
|
8494
|
+
watchLegacyWorkflow: watchWorkflow,
|
|
8495
|
+
legacyWatchResult: watchResult,
|
|
8496
|
+
isWatchingLegacyWorkflow: isWatchingWorkflow
|
|
8497
|
+
} = useWatchWorkflow(baseUrl);
|
|
8498
|
+
const { resumeLegacyWorkflow: resumeWorkflow, isResumingLegacyWorkflow: isResumingWorkflow } = useResumeWorkflow(baseUrl);
|
|
8354
8499
|
const [suspendedSteps, setSuspendedSteps] = React.useState([]);
|
|
8355
8500
|
const [isRunning, setIsRunning] = React.useState(false);
|
|
8356
8501
|
const triggerSchema = workflow?.triggerSchema;
|
|
@@ -8381,7 +8526,7 @@ function WorkflowTrigger({
|
|
|
8381
8526
|
});
|
|
8382
8527
|
};
|
|
8383
8528
|
const watchResultToUse = result ?? watchResult;
|
|
8384
|
-
const workflowActivePaths = watchResultToUse?.activePaths ??
|
|
8529
|
+
const workflowActivePaths = watchResultToUse?.activePaths ?? {};
|
|
8385
8530
|
React.useEffect(() => {
|
|
8386
8531
|
setIsRunning(isWatchingWorkflow);
|
|
8387
8532
|
}, [isWatchingWorkflow]);
|
|
@@ -8409,50 +8554,34 @@ function WorkflowTrigger({
|
|
|
8409
8554
|
const isSuspendedSteps = suspendedSteps.length > 0;
|
|
8410
8555
|
const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(triggerSchema))) : null;
|
|
8411
8556
|
const { sanitizedOutput, ...restResult } = result ?? {};
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
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
|
-
}) })
|
|
8557
|
+
const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
|
|
8558
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
8559
|
+
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: [
|
|
8560
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin text-icon6" }) }),
|
|
8561
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { children: "Resuming workflow" })
|
|
8455
8562
|
] }),
|
|
8563
|
+
!isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8564
|
+
DynamicForm,
|
|
8565
|
+
{
|
|
8566
|
+
schema: zodInputSchema,
|
|
8567
|
+
defaultValues: payload,
|
|
8568
|
+
isSubmitLoading: isWatchingWorkflow,
|
|
8569
|
+
submitButtonLabel: "Run",
|
|
8570
|
+
onSubmit: (data) => {
|
|
8571
|
+
setPayload(data);
|
|
8572
|
+
handleExecuteWorkflow(data);
|
|
8573
|
+
}
|
|
8574
|
+
}
|
|
8575
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8576
|
+
Button,
|
|
8577
|
+
{
|
|
8578
|
+
className: "w-full",
|
|
8579
|
+
variant: "light",
|
|
8580
|
+
disabled: isRunning,
|
|
8581
|
+
onClick: () => handleExecuteWorkflow(null),
|
|
8582
|
+
children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : "Trigger"
|
|
8583
|
+
}
|
|
8584
|
+
) }),
|
|
8456
8585
|
isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8457
8586
|
const stepDefinition = workflow.steps[step.stepId];
|
|
8458
8587
|
const stepSchema = stepDefinition?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.inputSchema))) : z.z.record(z.z.string(), z.z.any());
|
|
@@ -8484,29 +8613,23 @@ function WorkflowTrigger({
|
|
|
8484
8613
|
)
|
|
8485
8614
|
] });
|
|
8486
8615
|
}),
|
|
8487
|
-
|
|
8488
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8489
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8497
|
-
|
|
8498
|
-
{
|
|
8499
|
-
className: "w-full overflow-x-auto",
|
|
8500
|
-
code: sanitizedOutput || JSON.stringify(restResult, null, 2),
|
|
8501
|
-
language: "json"
|
|
8502
|
-
}
|
|
8503
|
-
)
|
|
8616
|
+
hasWorkflowActivePaths && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8617
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8618
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
|
|
8619
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
|
|
8620
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowStatus, { stepId, pathStatus, path }, idx);
|
|
8621
|
+
}) }, stepId);
|
|
8622
|
+
}) })
|
|
8623
|
+
] }),
|
|
8624
|
+
result && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8625
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8626
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
|
|
8504
8627
|
] })
|
|
8505
8628
|
] }) });
|
|
8506
8629
|
}
|
|
8507
8630
|
|
|
8508
|
-
function
|
|
8509
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
8631
|
+
function WorkflowNestedGraph({ stepGraph, open }) {
|
|
8632
|
+
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges({
|
|
8510
8633
|
stepGraph
|
|
8511
8634
|
});
|
|
8512
8635
|
const [isMounted, setIsMounted] = React.useState(false);
|
|
@@ -8517,7 +8640,7 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
|
|
|
8517
8640
|
"condition-node": WorkflowConditionNode,
|
|
8518
8641
|
"after-node": WorkflowAfterNode,
|
|
8519
8642
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8520
|
-
"nested-node":
|
|
8643
|
+
"nested-node": WorkflowNestedNode
|
|
8521
8644
|
};
|
|
8522
8645
|
React.useEffect(() => {
|
|
8523
8646
|
if (open) {
|
|
@@ -8544,10 +8667,10 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
|
|
|
8544
8667
|
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) });
|
|
8545
8668
|
}
|
|
8546
8669
|
|
|
8547
|
-
const
|
|
8670
|
+
const WorkflowNestedGraphContext = React.createContext(
|
|
8548
8671
|
{}
|
|
8549
8672
|
);
|
|
8550
|
-
function
|
|
8673
|
+
function WorkflowNestedGraphProvider({ children }) {
|
|
8551
8674
|
const [stepGraph, setStepGraph] = React.useState(null);
|
|
8552
8675
|
const [parentStepGraphList, setParentStepGraphList] = React.useState([]);
|
|
8553
8676
|
const [openDialog, setOpenDialog] = React.useState(false);
|
|
@@ -8585,7 +8708,7 @@ function VNextWorkflowNestedGraphProvider({ children }) {
|
|
|
8585
8708
|
}, 500);
|
|
8586
8709
|
};
|
|
8587
8710
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8588
|
-
|
|
8711
|
+
WorkflowNestedGraphContext.Provider,
|
|
8589
8712
|
{
|
|
8590
8713
|
value: {
|
|
8591
8714
|
showNestedGraph,
|
|
@@ -8601,16 +8724,16 @@ function VNextWorkflowNestedGraphProvider({ children }) {
|
|
|
8601
8724
|
" workflow"
|
|
8602
8725
|
] })
|
|
8603
8726
|
] }),
|
|
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(
|
|
8727
|
+
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
8728
|
] }) }) })
|
|
8606
8729
|
]
|
|
8607
8730
|
}
|
|
8608
8731
|
);
|
|
8609
8732
|
}
|
|
8610
8733
|
|
|
8611
|
-
function
|
|
8734
|
+
function WorkflowNestedNode({ data }) {
|
|
8612
8735
|
const { label, withoutTopHandle, withoutBottomHandle, stepGraph } = data;
|
|
8613
|
-
const { showNestedGraph } = React.useContext(
|
|
8736
|
+
const { showNestedGraph } = React.useContext(WorkflowNestedGraphContext);
|
|
8614
8737
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
|
|
8615
8738
|
!withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$2.Handle, { type: "target", position: react$2.Position.Top, style: { visibility: "hidden" } }),
|
|
8616
8739
|
/* @__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 +8744,8 @@ function VNextWorkflowNestedNode({ data }) {
|
|
|
8621
8744
|
] });
|
|
8622
8745
|
}
|
|
8623
8746
|
|
|
8624
|
-
function
|
|
8625
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
8747
|
+
function WorkflowGraphInner({ workflow }) {
|
|
8748
|
+
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges(workflow);
|
|
8626
8749
|
const [nodes, _, onNodesChange] = react$2.useNodesState(initialNodes);
|
|
8627
8750
|
const [edges] = react$2.useEdgesState(initialEdges);
|
|
8628
8751
|
const nodeTypes = {
|
|
@@ -8630,7 +8753,7 @@ function VNextWorkflowGraphInner({ workflow }) {
|
|
|
8630
8753
|
"condition-node": WorkflowConditionNode,
|
|
8631
8754
|
"after-node": WorkflowAfterNode,
|
|
8632
8755
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8633
|
-
"nested-node":
|
|
8756
|
+
"nested-node": WorkflowNestedNode
|
|
8634
8757
|
};
|
|
8635
8758
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8636
8759
|
react$2.ReactFlow,
|
|
@@ -8652,12 +8775,12 @@ function VNextWorkflowGraphInner({ workflow }) {
|
|
|
8652
8775
|
) });
|
|
8653
8776
|
}
|
|
8654
8777
|
|
|
8655
|
-
function
|
|
8656
|
-
const {
|
|
8778
|
+
function WorkflowGraph({ workflowId, baseUrl }) {
|
|
8779
|
+
const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
|
|
8657
8780
|
if (isLoading) {
|
|
8658
8781
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-[600px]" }) });
|
|
8659
8782
|
}
|
|
8660
|
-
if (!
|
|
8783
|
+
if (!workflow) {
|
|
8661
8784
|
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
8785
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, {}),
|
|
8663
8786
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -8667,43 +8790,60 @@ function VNextWorkflowGraph({ workflowId, baseUrl }) {
|
|
|
8667
8790
|
] })
|
|
8668
8791
|
] }) });
|
|
8669
8792
|
}
|
|
8670
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8793
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowGraphInner, { workflow }) }) });
|
|
8671
8794
|
}
|
|
8672
8795
|
|
|
8673
|
-
|
|
8796
|
+
const WorkflowStatus = ({ stepId, status }) => {
|
|
8797
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8798
|
+
WorkflowCard,
|
|
8799
|
+
{
|
|
8800
|
+
header: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
8801
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Icon, { children: [
|
|
8802
|
+
status === "success" && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "text-accent1" }),
|
|
8803
|
+
status === "failed" && /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }),
|
|
8804
|
+
status === "suspended" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CirclePause, { className: "text-icon3" }),
|
|
8805
|
+
status === "running" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "text-icon3 animate-spin" })
|
|
8806
|
+
] }),
|
|
8807
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) })
|
|
8808
|
+
] })
|
|
8809
|
+
}
|
|
8810
|
+
);
|
|
8811
|
+
};
|
|
8812
|
+
|
|
8813
|
+
function WorkflowTrigger({
|
|
8674
8814
|
workflowId,
|
|
8675
8815
|
baseUrl,
|
|
8676
8816
|
setRunId
|
|
8677
8817
|
}) {
|
|
8678
8818
|
const { runtimeContext } = usePlaygroundStore();
|
|
8679
|
-
const {
|
|
8680
|
-
const { isLoading,
|
|
8681
|
-
const {
|
|
8682
|
-
const {
|
|
8683
|
-
const {
|
|
8819
|
+
const { result, setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
|
|
8820
|
+
const { isLoading, workflow } = useWorkflow(workflowId, baseUrl);
|
|
8821
|
+
const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
8822
|
+
const { watchWorkflow, watchResult, isWatchingWorkflow } = useWatchWorkflow(baseUrl);
|
|
8823
|
+
const { resumeWorkflow, isResumingWorkflow } = useResumeWorkflow(baseUrl);
|
|
8684
8824
|
const [suspendedSteps, setSuspendedSteps] = React.useState([]);
|
|
8685
8825
|
const [isRunning, setIsRunning] = React.useState(false);
|
|
8686
|
-
const triggerSchema =
|
|
8826
|
+
const triggerSchema = workflow?.inputSchema;
|
|
8687
8827
|
const handleExecuteWorkflow = async (data) => {
|
|
8688
8828
|
try {
|
|
8689
|
-
if (!
|
|
8829
|
+
if (!workflow) return;
|
|
8690
8830
|
setIsRunning(true);
|
|
8691
|
-
|
|
8692
|
-
const { runId } = await
|
|
8831
|
+
setResult(null);
|
|
8832
|
+
const { runId } = await createWorkflowRun({ workflowId });
|
|
8693
8833
|
setRunId?.(runId);
|
|
8694
|
-
|
|
8695
|
-
|
|
8834
|
+
watchWorkflow({ workflowId, runId });
|
|
8835
|
+
startWorkflowRun({ workflowId, runId, input: data, runtimeContext });
|
|
8696
8836
|
} catch (err) {
|
|
8697
8837
|
setIsRunning(false);
|
|
8698
8838
|
sonner.toast.error("Error executing workflow");
|
|
8699
8839
|
}
|
|
8700
8840
|
};
|
|
8701
8841
|
const handleResumeWorkflow = async (step) => {
|
|
8702
|
-
if (!
|
|
8842
|
+
if (!workflow) return;
|
|
8703
8843
|
const { stepId, runId: prevRunId, resumeData } = step;
|
|
8704
|
-
const { runId } = await
|
|
8705
|
-
|
|
8706
|
-
await
|
|
8844
|
+
const { runId } = await createWorkflowRun({ workflowId, prevRunId });
|
|
8845
|
+
watchWorkflow({ workflowId, runId });
|
|
8846
|
+
await resumeWorkflow({
|
|
8707
8847
|
step: stepId,
|
|
8708
8848
|
runId,
|
|
8709
8849
|
resumeData,
|
|
@@ -8711,78 +8851,65 @@ function VNextWorkflowTrigger({
|
|
|
8711
8851
|
runtimeContext
|
|
8712
8852
|
});
|
|
8713
8853
|
};
|
|
8714
|
-
const watchResultToUse =
|
|
8854
|
+
const watchResultToUse = result ?? watchResult;
|
|
8715
8855
|
const workflowActivePaths = watchResultToUse?.payload?.workflowState?.steps ?? {};
|
|
8716
8856
|
React.useEffect(() => {
|
|
8717
|
-
setIsRunning(
|
|
8718
|
-
}, [
|
|
8857
|
+
setIsRunning(isWatchingWorkflow);
|
|
8858
|
+
}, [isWatchingWorkflow]);
|
|
8719
8859
|
React.useEffect(() => {
|
|
8720
|
-
if (!watchResultToUse?.payload?.workflowState?.steps || !
|
|
8860
|
+
if (!watchResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
|
|
8721
8861
|
const suspended = Object.entries(watchResultToUse.payload.workflowState.steps).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
|
|
8722
8862
|
stepId,
|
|
8723
|
-
runId:
|
|
8863
|
+
runId: result.runId,
|
|
8724
8864
|
suspendPayload: payload2
|
|
8725
8865
|
}));
|
|
8726
8866
|
setSuspendedSteps(suspended);
|
|
8727
|
-
}, [watchResultToUse,
|
|
8867
|
+
}, [watchResultToUse, result]);
|
|
8728
8868
|
React.useEffect(() => {
|
|
8729
|
-
if (
|
|
8730
|
-
|
|
8869
|
+
if (watchResult) {
|
|
8870
|
+
setResult(watchResult);
|
|
8731
8871
|
}
|
|
8732
|
-
}, [
|
|
8872
|
+
}, [watchResult]);
|
|
8733
8873
|
if (isLoading) {
|
|
8734
8874
|
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
8875
|
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-10" }),
|
|
8736
8876
|
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-10" })
|
|
8737
8877
|
] }) });
|
|
8738
8878
|
}
|
|
8739
|
-
if (!
|
|
8879
|
+
if (!workflow) return null;
|
|
8740
8880
|
const isSuspendedSteps = suspendedSteps.length > 0;
|
|
8741
8881
|
const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(triggerSchema))) : null;
|
|
8742
|
-
const { sanitizedOutput, ...restResult } =
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
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
|
-
}) })
|
|
8882
|
+
const { sanitizedOutput, ...restResult } = result ?? {};
|
|
8883
|
+
const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
|
|
8884
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
8885
|
+
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: [
|
|
8886
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin text-icon6" }) }),
|
|
8887
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { children: "Resuming workflow" })
|
|
8783
8888
|
] }),
|
|
8784
|
-
!
|
|
8785
|
-
|
|
8889
|
+
!isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8890
|
+
DynamicForm,
|
|
8891
|
+
{
|
|
8892
|
+
schema: zodInputSchema,
|
|
8893
|
+
defaultValues: payload,
|
|
8894
|
+
isSubmitLoading: isWatchingWorkflow,
|
|
8895
|
+
submitButtonLabel: "Run",
|
|
8896
|
+
onSubmit: (data) => {
|
|
8897
|
+
setPayload(data);
|
|
8898
|
+
handleExecuteWorkflow(data);
|
|
8899
|
+
}
|
|
8900
|
+
}
|
|
8901
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8902
|
+
Button,
|
|
8903
|
+
{
|
|
8904
|
+
className: "w-full",
|
|
8905
|
+
variant: "light",
|
|
8906
|
+
disabled: isRunning,
|
|
8907
|
+
onClick: () => handleExecuteWorkflow(null),
|
|
8908
|
+
children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : "Trigger"
|
|
8909
|
+
}
|
|
8910
|
+
) }),
|
|
8911
|
+
!isWatchingWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8912
|
+
const stepDefinition = workflow.steps[step.stepId];
|
|
8786
8913
|
const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.resumeSchema))) : z.z.record(z.z.string(), z.z.any());
|
|
8787
8914
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4", children: [
|
|
8788
8915
|
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
|
|
@@ -8798,7 +8925,7 @@ function VNextWorkflowTrigger({
|
|
|
8798
8925
|
DynamicForm,
|
|
8799
8926
|
{
|
|
8800
8927
|
schema: stepSchema,
|
|
8801
|
-
isSubmitLoading:
|
|
8928
|
+
isSubmitLoading: isResumingWorkflow,
|
|
8802
8929
|
submitButtonLabel: "Resume",
|
|
8803
8930
|
onSubmit: (data) => {
|
|
8804
8931
|
handleResumeWorkflow({
|
|
@@ -8812,23 +8939,18 @@ function VNextWorkflowTrigger({
|
|
|
8812
8939
|
)
|
|
8813
8940
|
] });
|
|
8814
8941
|
}),
|
|
8815
|
-
|
|
8816
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8817
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8818
|
-
|
|
8819
|
-
{
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
className: "w-full overflow-x-auto",
|
|
8828
|
-
code: sanitizedOutput || JSON.stringify(restResult, null, 2),
|
|
8829
|
-
language: "json"
|
|
8830
|
-
}
|
|
8831
|
-
)
|
|
8942
|
+
hasWorkflowActivePaths && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8943
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8944
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8945
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
8946
|
+
/* @__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 }]) => {
|
|
8947
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WorkflowStatus, { stepId, status });
|
|
8948
|
+
}) })
|
|
8949
|
+
] })
|
|
8950
|
+
] }),
|
|
8951
|
+
result && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8952
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8953
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
|
|
8832
8954
|
] })
|
|
8833
8955
|
] }) });
|
|
8834
8956
|
}
|
|
@@ -8842,7 +8964,8 @@ const DataTable = ({
|
|
|
8842
8964
|
getRowId,
|
|
8843
8965
|
selectedRowId,
|
|
8844
8966
|
isLoading,
|
|
8845
|
-
emptyText
|
|
8967
|
+
emptyText,
|
|
8968
|
+
onClick
|
|
8846
8969
|
}) => {
|
|
8847
8970
|
const [sorting, setSorting] = React.useState([]);
|
|
8848
8971
|
const [{ pageIndex, pageSize }, setPagination] = React.useState({
|
|
@@ -8884,7 +9007,16 @@ const DataTable = ({
|
|
|
8884
9007
|
const meta = header.column.columnDef.meta;
|
|
8885
9008
|
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
9009
|
}) }),
|
|
8887
|
-
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(Row, {
|
|
9010
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => {
|
|
9011
|
+
}, 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(
|
|
9012
|
+
Row,
|
|
9013
|
+
{
|
|
9014
|
+
"data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected",
|
|
9015
|
+
onClick: () => onClick?.(row.original),
|
|
9016
|
+
children: row.getVisibleCells().map((cell) => reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()))
|
|
9017
|
+
},
|
|
9018
|
+
row.id
|
|
9019
|
+
)) : emptyNode })
|
|
8888
9020
|
] }),
|
|
8889
9021
|
pagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex items-center justify-between px-2", children: [
|
|
8890
9022
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -9259,6 +9391,8 @@ exports.Icon = Icon;
|
|
|
9259
9391
|
exports.InfoIcon = InfoIcon;
|
|
9260
9392
|
exports.JudgeIcon = JudgeIcon;
|
|
9261
9393
|
exports.LatencyIcon = LatencyIcon;
|
|
9394
|
+
exports.LegacyWorkflowGraph = LegacyWorkflowGraph;
|
|
9395
|
+
exports.LegacyWorkflowTrigger = LegacyWorkflowTrigger;
|
|
9262
9396
|
exports.LogsIcon = LogsIcon;
|
|
9263
9397
|
exports.MastraResizablePanel = MastraResizablePanel;
|
|
9264
9398
|
exports.MemoryIcon = MemoryIcon;
|
|
@@ -9289,8 +9423,6 @@ exports.TsIcon = TsIcon;
|
|
|
9289
9423
|
exports.Txt = Txt;
|
|
9290
9424
|
exports.TxtCell = TxtCell;
|
|
9291
9425
|
exports.UnitCell = UnitCell;
|
|
9292
|
-
exports.VNextWorkflowGraph = VNextWorkflowGraph;
|
|
9293
|
-
exports.VNextWorkflowTrigger = VNextWorkflowTrigger;
|
|
9294
9426
|
exports.VariablesIcon = VariablesIcon;
|
|
9295
9427
|
exports.WorkflowCoinIcon = WorkflowCoinIcon;
|
|
9296
9428
|
exports.WorkflowGraph = WorkflowGraph;
|