@mastra/playground-ui 5.0.4 → 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 +635 -385
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.es.js +630 -385
- 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/agents/agent/context/agent-context.d.ts +4 -3
- package/dist/src/domains/traces/types.d.ts +9 -4
- package/dist/src/domains/traces/utils/createSpanTree.d.ts +3 -0
- 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/components/Entity/Entity.d.ts +10 -0
- package/dist/src/ds/components/Entity/index.d.ts +1 -0
- package/dist/src/ds/components/TraceTree/Span.d.ts +3 -1
- package/dist/src/ds/components/TraceTree/Time.d.ts +2 -1
- package/dist/src/ds/components/TraceTree/Trace.d.ts +2 -1
- package/dist/src/ds/icons/Icon.d.ts +1 -1
- package/dist/src/ds/tokens/sizes.d.ts +1 -0
- package/dist/src/hooks/use-workflows.d.ts +24 -24
- package/dist/src/index.d.ts +1 -0
- package/dist/src/store/agent-store.d.ts +20 -0
- package/dist/src/types.d.ts +1 -4
- 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/src/ds/components/TraceTree/Trace.context.d.ts +0 -9
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,10 +3181,12 @@ 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 = {
|
|
3189
|
+
sm: "[&>svg]:h-icon-sm [&>svg]:w-icon-sm",
|
|
3148
3190
|
default: "[&>svg]:h-icon-default [&>svg]:w-icon-default",
|
|
3149
3191
|
lg: "[&>svg]:h-icon-lg [&>svg]:w-icon-lg"
|
|
3150
3192
|
};
|
|
@@ -3523,10 +3565,10 @@ const GithubIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "1
|
|
|
3523
3565
|
"path",
|
|
3524
3566
|
{
|
|
3525
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",
|
|
3526
|
-
fill: "
|
|
3568
|
+
fill: "currentColor"
|
|
3527
3569
|
}
|
|
3528
3570
|
) }),
|
|
3529
|
-
/* @__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)" }) }) })
|
|
3530
3572
|
] });
|
|
3531
3573
|
|
|
3532
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: [
|
|
@@ -3755,7 +3797,7 @@ const WorkflowIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "
|
|
|
3755
3797
|
fillRule: "evenodd",
|
|
3756
3798
|
clipRule: "evenodd",
|
|
3757
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",
|
|
3758
|
-
fill: "
|
|
3800
|
+
fill: "currentColor"
|
|
3759
3801
|
}
|
|
3760
3802
|
) });
|
|
3761
3803
|
|
|
@@ -3888,7 +3930,10 @@ const AssistantMessage = ({
|
|
|
3888
3930
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3889
3931
|
react.MessagePrimitive.Content,
|
|
3890
3932
|
{
|
|
3891
|
-
components: {
|
|
3933
|
+
components: {
|
|
3934
|
+
Text: MarkdownText,
|
|
3935
|
+
tools: { Fallback: ToolFallbackCustom || ToolFallback$1 }
|
|
3936
|
+
}
|
|
3892
3937
|
}
|
|
3893
3938
|
) }),
|
|
3894
3939
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar, {}) })
|
|
@@ -3952,13 +3997,27 @@ const useAutoscroll = (ref, { enabled = true }) => {
|
|
|
3952
3997
|
}, [enabled, ref]);
|
|
3953
3998
|
};
|
|
3954
3999
|
|
|
3955
|
-
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 }) => {
|
|
3956
4015
|
const areaRef = React.useRef(null);
|
|
3957
4016
|
useAutoscroll(areaRef, { enabled: true });
|
|
3958
4017
|
const WrappedAssistantMessage = (props) => {
|
|
3959
4018
|
return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback });
|
|
3960
4019
|
};
|
|
3961
|
-
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: [
|
|
3962
4021
|
/* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
3963
4022
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3964
4023
|
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { agentName }),
|
|
@@ -3975,7 +4034,7 @@ const Thread = ({ ToolFallback, agentName }) => {
|
|
|
3975
4034
|
] }),
|
|
3976
4035
|
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
|
|
3977
4036
|
] }),
|
|
3978
|
-
/* @__PURE__ */ jsxRuntime.jsx(Composer, {})
|
|
4037
|
+
/* @__PURE__ */ jsxRuntime.jsx(Composer, { hasMemory })
|
|
3979
4038
|
] });
|
|
3980
4039
|
};
|
|
3981
4040
|
const ThreadWelcome = ({ agentName }) => {
|
|
@@ -3994,19 +4053,25 @@ const ThreadWelcome = ({ agentName }) => {
|
|
|
3994
4053
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
3995
4054
|
] }) });
|
|
3996
4055
|
};
|
|
3997
|
-
const Composer = () => {
|
|
3998
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3999
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4000
|
-
"
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
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
|
+
] })
|
|
4010
4075
|
] });
|
|
4011
4076
|
};
|
|
4012
4077
|
const ComposerAction = () => {
|
|
@@ -4348,6 +4413,20 @@ function MastraRuntimeProvider({
|
|
|
4348
4413
|
] });
|
|
4349
4414
|
}
|
|
4350
4415
|
|
|
4416
|
+
const useAgentStore = zustand.create()(
|
|
4417
|
+
middleware.persist(
|
|
4418
|
+
(set) => ({
|
|
4419
|
+
modelSettings: {},
|
|
4420
|
+
setModelSettings: (modelSettings) => set((state) => ({ modelSettings: { ...state.modelSettings, ...modelSettings } })),
|
|
4421
|
+
chatWithGenerate: {},
|
|
4422
|
+
setChatWithGenerate: (chatWithGenerate) => set((state) => ({ chatWithGenerate: { ...state.chatWithGenerate, ...chatWithGenerate } }))
|
|
4423
|
+
}),
|
|
4424
|
+
{
|
|
4425
|
+
name: "mastra-agent-store"
|
|
4426
|
+
}
|
|
4427
|
+
)
|
|
4428
|
+
);
|
|
4429
|
+
|
|
4351
4430
|
const defaultModelSettings$1 = {
|
|
4352
4431
|
maxRetries: 2,
|
|
4353
4432
|
maxSteps: 5,
|
|
@@ -4355,12 +4434,24 @@ const defaultModelSettings$1 = {
|
|
|
4355
4434
|
topP: 1
|
|
4356
4435
|
};
|
|
4357
4436
|
const AgentContext = React.createContext({});
|
|
4358
|
-
function AgentProvider({ children }) {
|
|
4359
|
-
const
|
|
4360
|
-
|
|
4437
|
+
function AgentProvider({ agentId, children }) {
|
|
4438
|
+
const {
|
|
4439
|
+
modelSettings: modelSettingsStore,
|
|
4440
|
+
setModelSettings: setModelSettingsStore,
|
|
4441
|
+
chatWithGenerate: chatWithGenerateStore,
|
|
4442
|
+
setChatWithGenerate: setChatWithGenerateStore
|
|
4443
|
+
} = useAgentStore();
|
|
4444
|
+
const modelSettings = modelSettingsStore[agentId] || defaultModelSettings$1;
|
|
4445
|
+
const setModelSettings = (modelSettings2) => {
|
|
4446
|
+
setModelSettingsStore({ [agentId]: modelSettings2 });
|
|
4447
|
+
};
|
|
4361
4448
|
const resetModelSettings = () => {
|
|
4362
4449
|
setModelSettings(defaultModelSettings$1);
|
|
4363
4450
|
};
|
|
4451
|
+
const chatWithGenerate = chatWithGenerateStore[agentId] || false;
|
|
4452
|
+
const setChatWithGenerate = (chatWithGenerate2) => {
|
|
4453
|
+
setChatWithGenerateStore({ [agentId]: chatWithGenerate2 });
|
|
4454
|
+
};
|
|
4364
4455
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4365
4456
|
AgentContext.Provider,
|
|
4366
4457
|
{
|
|
@@ -4412,7 +4503,7 @@ const AgentChat = ({
|
|
|
4412
4503
|
modelSettings,
|
|
4413
4504
|
chatWithGenerate,
|
|
4414
4505
|
runtimeContext,
|
|
4415
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4", 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 }) })
|
|
4416
4507
|
}
|
|
4417
4508
|
);
|
|
4418
4509
|
};
|
|
@@ -4472,18 +4563,18 @@ function FormattedDate({ date }) {
|
|
|
4472
4563
|
}
|
|
4473
4564
|
|
|
4474
4565
|
const inputVariants = cva(
|
|
4475
|
-
"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",
|
|
4476
4567
|
{
|
|
4477
4568
|
variants: {
|
|
4478
4569
|
variant: {
|
|
4479
|
-
default: "border-
|
|
4480
|
-
filled: "bg-inputFill border-
|
|
4481
|
-
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"
|
|
4482
4573
|
},
|
|
4483
4574
|
customSize: {
|
|
4484
|
-
default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-
|
|
4575
|
+
default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-8",
|
|
4485
4576
|
sm: "h-[30px] px-[13px] text-xs",
|
|
4486
|
-
lg: "h-10 px-[17px]
|
|
4577
|
+
lg: "h-10 px-[17px] text-[calc(13_/_16_*_1rem)]"
|
|
4487
4578
|
}
|
|
4488
4579
|
},
|
|
4489
4580
|
defaultVariants: {
|
|
@@ -4962,20 +5053,6 @@ const Row = ({ className, children, selected = false, onClick }) => {
|
|
|
4962
5053
|
);
|
|
4963
5054
|
};
|
|
4964
5055
|
|
|
4965
|
-
const variants = {
|
|
4966
|
-
"header-md": "text-header-md leading-header-md",
|
|
4967
|
-
"ui-lg": "text-ui-lg leading-ui-lg",
|
|
4968
|
-
"ui-md": "text-ui-md leading-ui-md",
|
|
4969
|
-
"ui-sm": "text-ui-sm leading-ui-sm",
|
|
4970
|
-
"ui-xs": "text-ui-xs leading-ui-xs"
|
|
4971
|
-
};
|
|
4972
|
-
const fonts = {
|
|
4973
|
-
mono: "font-mono"
|
|
4974
|
-
};
|
|
4975
|
-
const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
|
|
4976
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
|
|
4977
|
-
};
|
|
4978
|
-
|
|
4979
5056
|
const formatDateCell = (date) => {
|
|
4980
5057
|
const month = new Intl.DateTimeFormat("en-US", { month: "short" }).format(date).toUpperCase();
|
|
4981
5058
|
const day = date.getDate();
|
|
@@ -5198,11 +5275,17 @@ const TraceTree = ({ children }) => {
|
|
|
5198
5275
|
const variantClasses = {
|
|
5199
5276
|
agent: "bg-accent1"
|
|
5200
5277
|
};
|
|
5201
|
-
const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
|
|
5278
|
+
const Time = ({ durationMs, tokenCount, variant, progressPercent, offsetPercent }) => {
|
|
5202
5279
|
const variantClass = variant ? variantClasses[variant] : "bg-accent3";
|
|
5203
5280
|
const percent = Math.min(100, progressPercent);
|
|
5204
5281
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[80px] xl:w-[166px] shrink-0", children: [
|
|
5205
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5282
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5283
|
+
"div",
|
|
5284
|
+
{
|
|
5285
|
+
className: clsx("absolute h-1 rounded-full", variantClass),
|
|
5286
|
+
style: { width: `${percent}%`, left: `${offsetPercent}%` }
|
|
5287
|
+
}
|
|
5288
|
+
) }),
|
|
5206
5289
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 pt-0.5", children: [
|
|
5207
5290
|
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
|
|
5208
5291
|
toSigFigs(durationMs, 3),
|
|
@@ -5216,14 +5299,6 @@ const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
|
|
|
5216
5299
|
] });
|
|
5217
5300
|
};
|
|
5218
5301
|
|
|
5219
|
-
const TraceDurationContext = React.createContext(0);
|
|
5220
|
-
const useTraceDuration = () => {
|
|
5221
|
-
return React.useContext(TraceDurationContext);
|
|
5222
|
-
};
|
|
5223
|
-
const TraceDurationProvider = ({ children, durationMs }) => {
|
|
5224
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TraceDurationContext.Provider, { value: durationMs, children });
|
|
5225
|
-
};
|
|
5226
|
-
|
|
5227
5302
|
const spanIconMap = {
|
|
5228
5303
|
tool: ToolsIcon,
|
|
5229
5304
|
agent: AgentIcon,
|
|
@@ -5244,14 +5319,25 @@ const spanVariantClasses = {
|
|
|
5244
5319
|
eval: "text-accent4",
|
|
5245
5320
|
other: "text-icon6"
|
|
5246
5321
|
};
|
|
5247
|
-
const Span = ({
|
|
5322
|
+
const Span = ({
|
|
5323
|
+
children,
|
|
5324
|
+
durationMs,
|
|
5325
|
+
variant,
|
|
5326
|
+
tokenCount,
|
|
5327
|
+
spans,
|
|
5328
|
+
isRoot,
|
|
5329
|
+
onClick,
|
|
5330
|
+
isActive,
|
|
5331
|
+
offsetMs,
|
|
5332
|
+
totalDurationMs
|
|
5333
|
+
}) => {
|
|
5248
5334
|
const [isExpanded, setIsExpanded] = React.useState(true);
|
|
5249
|
-
const traceDuration = useTraceDuration();
|
|
5250
5335
|
const VariantIcon = spanIconMap[variant];
|
|
5251
5336
|
const variantClass = spanVariantClasses[variant];
|
|
5252
|
-
const progressPercent = durationMs /
|
|
5337
|
+
const progressPercent = durationMs / totalDurationMs * 100;
|
|
5338
|
+
const offsetPercent = offsetMs / totalDurationMs * 100;
|
|
5253
5339
|
const TextEl = onClick ? "button" : "div";
|
|
5254
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
5340
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
5255
5341
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("flex justify-between items-center gap-2 rounded-md pl-2", isActive && "bg-surface4"), children: [
|
|
5256
5342
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-8 items-center gap-1 min-w-0", children: [
|
|
5257
5343
|
spans ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5276,20 +5362,30 @@ const Span = ({ children, durationMs, variant, tokenCount, spans, isRoot, onClic
|
|
|
5276
5362
|
durationMs,
|
|
5277
5363
|
tokenCount,
|
|
5278
5364
|
variant: variant === "agent" ? "agent" : void 0,
|
|
5279
|
-
progressPercent
|
|
5365
|
+
progressPercent,
|
|
5366
|
+
offsetPercent
|
|
5280
5367
|
}
|
|
5281
5368
|
)
|
|
5282
5369
|
] }),
|
|
5283
5370
|
isExpanded && spans && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-4", children: spans })
|
|
5284
|
-
] })
|
|
5371
|
+
] });
|
|
5285
5372
|
};
|
|
5286
5373
|
|
|
5287
5374
|
const Spans = ({ children }) => {
|
|
5288
5375
|
return /* @__PURE__ */ jsxRuntime.jsx("ol", { children });
|
|
5289
5376
|
};
|
|
5290
5377
|
|
|
5291
|
-
const Trace = ({
|
|
5292
|
-
|
|
5378
|
+
const Trace = ({
|
|
5379
|
+
name,
|
|
5380
|
+
spans,
|
|
5381
|
+
durationMs,
|
|
5382
|
+
tokenCount,
|
|
5383
|
+
onClick,
|
|
5384
|
+
variant,
|
|
5385
|
+
isActive,
|
|
5386
|
+
totalDurationMs
|
|
5387
|
+
}) => {
|
|
5388
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5293
5389
|
Span,
|
|
5294
5390
|
{
|
|
5295
5391
|
isRoot: true,
|
|
@@ -5298,9 +5394,11 @@ const Trace = ({ name, spans, durationMs, tokenCount, onClick, variant, isActive
|
|
|
5298
5394
|
spans: /* @__PURE__ */ jsxRuntime.jsx(Spans, { children: spans }),
|
|
5299
5395
|
onClick,
|
|
5300
5396
|
isActive,
|
|
5397
|
+
offsetMs: 0,
|
|
5398
|
+
totalDurationMs,
|
|
5301
5399
|
children: name
|
|
5302
5400
|
}
|
|
5303
|
-
)
|
|
5401
|
+
);
|
|
5304
5402
|
};
|
|
5305
5403
|
|
|
5306
5404
|
const getSpanVariant = (span) => {
|
|
@@ -5325,40 +5423,71 @@ const getSpanVariant = (span) => {
|
|
|
5325
5423
|
return "other";
|
|
5326
5424
|
};
|
|
5327
5425
|
|
|
5328
|
-
function buildTree(
|
|
5329
|
-
return
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5426
|
+
function buildTree(spans, minStartTime, totalDurationMs, parentSpanId = null) {
|
|
5427
|
+
return spans.filter((span) => span.parentSpanId === parentSpanId).map((span) => {
|
|
5428
|
+
return {
|
|
5429
|
+
...span,
|
|
5430
|
+
children: buildTree(spans, minStartTime, totalDurationMs, span.id),
|
|
5431
|
+
offset: (span.startTime - minStartTime) / 1e3,
|
|
5432
|
+
// ns to ms
|
|
5433
|
+
duration: span.duration / 1e3,
|
|
5434
|
+
totalDurationMs
|
|
5435
|
+
};
|
|
5436
|
+
});
|
|
5333
5437
|
}
|
|
5334
|
-
const
|
|
5438
|
+
const createSpanTree = (spans) => {
|
|
5439
|
+
if (spans.length === 0) return [];
|
|
5440
|
+
let minStartTime;
|
|
5441
|
+
let maxEndTime;
|
|
5442
|
+
const orderedTree = [];
|
|
5443
|
+
const listSize = spans.length;
|
|
5444
|
+
for (let i = listSize - 1; i >= 0; i--) {
|
|
5445
|
+
const span = spans[i];
|
|
5446
|
+
if (!minStartTime || span.startTime < minStartTime) {
|
|
5447
|
+
minStartTime = span.startTime;
|
|
5448
|
+
}
|
|
5449
|
+
if (!maxEndTime || span.endTime > maxEndTime) {
|
|
5450
|
+
maxEndTime = span.endTime;
|
|
5451
|
+
}
|
|
5452
|
+
if (span.name !== ".insert" && span.name !== "mastra.getStorage") {
|
|
5453
|
+
orderedTree.push(span);
|
|
5454
|
+
}
|
|
5455
|
+
}
|
|
5456
|
+
if (!minStartTime || !maxEndTime) return [];
|
|
5457
|
+
const totalDurationMs = (maxEndTime - minStartTime) / 1e3;
|
|
5458
|
+
return buildTree(orderedTree, minStartTime, totalDurationMs);
|
|
5459
|
+
};
|
|
5460
|
+
|
|
5461
|
+
const NestedSpans = ({ spanNodes }) => {
|
|
5335
5462
|
const { span: activeSpan, setSpan } = React.useContext(TraceContext);
|
|
5336
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Spans, { children:
|
|
5337
|
-
const isActive =
|
|
5463
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Spans, { children: spanNodes.map((spanNode) => {
|
|
5464
|
+
const isActive = spanNode.id === activeSpan?.id;
|
|
5338
5465
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5339
5466
|
Span,
|
|
5340
5467
|
{
|
|
5341
|
-
spans:
|
|
5342
|
-
durationMs:
|
|
5343
|
-
|
|
5468
|
+
spans: spanNode.children.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(NestedSpans, { spanNodes: spanNode.children }),
|
|
5469
|
+
durationMs: spanNode.duration,
|
|
5470
|
+
offsetMs: spanNode.offset,
|
|
5471
|
+
variant: getSpanVariant(spanNode),
|
|
5344
5472
|
isActive,
|
|
5345
|
-
onClick: () => setSpan(
|
|
5346
|
-
|
|
5473
|
+
onClick: () => setSpan(spanNode),
|
|
5474
|
+
totalDurationMs: spanNode.totalDurationMs,
|
|
5475
|
+
children: spanNode.name
|
|
5347
5476
|
},
|
|
5348
|
-
|
|
5477
|
+
spanNode.id
|
|
5349
5478
|
);
|
|
5350
5479
|
}) });
|
|
5351
5480
|
};
|
|
5352
5481
|
function SpanView({ trace }) {
|
|
5353
|
-
const shallowCopy = [...trace];
|
|
5354
|
-
const tree = buildTree(shallowCopy.reverse());
|
|
5355
5482
|
const { span: activeSpan, setSpan } = React.useContext(TraceContext);
|
|
5483
|
+
const tree = createSpanTree(trace);
|
|
5356
5484
|
return /* @__PURE__ */ jsxRuntime.jsx(TraceTree, { children: tree.map((node) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5357
5485
|
Trace,
|
|
5358
5486
|
{
|
|
5359
5487
|
name: node.name,
|
|
5360
|
-
durationMs: node.duration
|
|
5361
|
-
|
|
5488
|
+
durationMs: node.duration,
|
|
5489
|
+
totalDurationMs: node.totalDurationMs,
|
|
5490
|
+
spans: /* @__PURE__ */ jsxRuntime.jsx(NestedSpans, { spanNodes: node.children }),
|
|
5362
5491
|
variant: getSpanVariant(node),
|
|
5363
5492
|
isActive: node.id === activeSpan?.id,
|
|
5364
5493
|
onClick: () => setSpan(node)
|
|
@@ -5494,8 +5623,7 @@ const refineTraces = (traces, isWorkflow = false) => {
|
|
|
5494
5623
|
const parentSpan = value.find((span) => !span.parentSpanId || !listOfSpanIds.has(span.parentSpanId));
|
|
5495
5624
|
const enrichedSpans = value.map((span) => ({
|
|
5496
5625
|
...span,
|
|
5497
|
-
parentSpanId: parentSpan?.id === span.id ? null : span?.parentSpanId
|
|
5498
|
-
relativePercentage: parentSpan ? span.duration / parentSpan.duration : 0
|
|
5626
|
+
parentSpanId: parentSpan?.id === span.id ? null : span?.parentSpanId
|
|
5499
5627
|
}));
|
|
5500
5628
|
const failedStatus = value.find((span) => span.status.code !== 0)?.status;
|
|
5501
5629
|
return {
|
|
@@ -6106,7 +6234,7 @@ function WorkflowTracesInner({ traces, isLoading, error }) {
|
|
|
6106
6234
|
] });
|
|
6107
6235
|
}
|
|
6108
6236
|
|
|
6109
|
-
const
|
|
6237
|
+
const sanitizeWorkflowWatchResult = (record) => {
|
|
6110
6238
|
const formattedResults = Object.entries(record.payload.workflowState.steps || {}).reduce(
|
|
6111
6239
|
(acc, [key, value]) => {
|
|
6112
6240
|
let output = value.status === "success" ? value.output : void 0;
|
|
@@ -6141,8 +6269,8 @@ const sanitizeVNexWorkflowWatchResult = (record) => {
|
|
|
6141
6269
|
};
|
|
6142
6270
|
return sanitizedRecord;
|
|
6143
6271
|
};
|
|
6144
|
-
const
|
|
6145
|
-
const [
|
|
6272
|
+
const useLegacyWorkflow = (workflowId, baseUrl) => {
|
|
6273
|
+
const [legacyWorkflow, setLegacyWorkflow] = React.useState(null);
|
|
6146
6274
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
6147
6275
|
const client = createMastraClient(baseUrl);
|
|
6148
6276
|
React.useEffect(() => {
|
|
@@ -6150,22 +6278,22 @@ const useWorkflow = (workflowId, baseUrl) => {
|
|
|
6150
6278
|
setIsLoading(true);
|
|
6151
6279
|
try {
|
|
6152
6280
|
if (!workflowId) {
|
|
6153
|
-
|
|
6281
|
+
setLegacyWorkflow(null);
|
|
6154
6282
|
setIsLoading(false);
|
|
6155
6283
|
return;
|
|
6156
6284
|
}
|
|
6157
|
-
const res = await client.
|
|
6285
|
+
const res = await client.getLegacyWorkflow(workflowId).details();
|
|
6158
6286
|
if (!res) {
|
|
6159
|
-
|
|
6160
|
-
console.error("Error fetching workflow");
|
|
6161
|
-
sonner.toast.error("Error fetching workflow");
|
|
6287
|
+
setLegacyWorkflow(null);
|
|
6288
|
+
console.error("Error fetching legacy workflow");
|
|
6289
|
+
sonner.toast.error("Error fetching legacy workflow");
|
|
6162
6290
|
return;
|
|
6163
6291
|
}
|
|
6164
6292
|
const steps = res.steps;
|
|
6165
6293
|
const stepsWithWorkflow = await Promise.all(
|
|
6166
6294
|
Object.values(steps)?.map(async (step) => {
|
|
6167
6295
|
if (!step.workflowId) return step;
|
|
6168
|
-
const wFlow = await client.
|
|
6296
|
+
const wFlow = await client.getLegacyWorkflow(step.workflowId).details();
|
|
6169
6297
|
if (!wFlow) return step;
|
|
6170
6298
|
return { ...step, stepGraph: wFlow.stepGraph, stepSubscriberGraph: wFlow.stepSubscriberGraph };
|
|
6171
6299
|
})
|
|
@@ -6173,21 +6301,21 @@ const useWorkflow = (workflowId, baseUrl) => {
|
|
|
6173
6301
|
const _steps = stepsWithWorkflow.reduce((acc, b) => {
|
|
6174
6302
|
return { ...acc, [b.id]: b };
|
|
6175
6303
|
}, {});
|
|
6176
|
-
|
|
6304
|
+
setLegacyWorkflow({ ...res, steps: _steps });
|
|
6177
6305
|
} catch (error) {
|
|
6178
|
-
|
|
6179
|
-
console.error("Error fetching workflow", error);
|
|
6180
|
-
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");
|
|
6181
6309
|
} finally {
|
|
6182
6310
|
setIsLoading(false);
|
|
6183
6311
|
}
|
|
6184
6312
|
};
|
|
6185
6313
|
fetchWorkflow();
|
|
6186
6314
|
}, [workflowId]);
|
|
6187
|
-
return {
|
|
6315
|
+
return { legacyWorkflow, isLoading };
|
|
6188
6316
|
};
|
|
6189
|
-
const
|
|
6190
|
-
const [
|
|
6317
|
+
const useWorkflow = (workflowId, baseUrl) => {
|
|
6318
|
+
const [workflow, setWorkflow] = React.useState(null);
|
|
6191
6319
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
6192
6320
|
const client = createMastraClient(baseUrl);
|
|
6193
6321
|
React.useEffect(() => {
|
|
@@ -6195,14 +6323,14 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
|
6195
6323
|
setIsLoading(true);
|
|
6196
6324
|
try {
|
|
6197
6325
|
if (!workflowId) {
|
|
6198
|
-
|
|
6326
|
+
setWorkflow(null);
|
|
6199
6327
|
setIsLoading(false);
|
|
6200
6328
|
return;
|
|
6201
6329
|
}
|
|
6202
|
-
const res = await client.
|
|
6203
|
-
|
|
6330
|
+
const res = await client.getWorkflow(workflowId).details();
|
|
6331
|
+
setWorkflow(res);
|
|
6204
6332
|
} catch (error) {
|
|
6205
|
-
|
|
6333
|
+
setWorkflow(null);
|
|
6206
6334
|
console.error("Error fetching workflow", error);
|
|
6207
6335
|
sonner.toast.error("Error fetching workflow");
|
|
6208
6336
|
} finally {
|
|
@@ -6211,13 +6339,13 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
|
6211
6339
|
};
|
|
6212
6340
|
fetchWorkflow();
|
|
6213
6341
|
}, [workflowId]);
|
|
6214
|
-
return {
|
|
6342
|
+
return { workflow, isLoading };
|
|
6215
6343
|
};
|
|
6216
6344
|
const useExecuteWorkflow = (baseUrl) => {
|
|
6217
6345
|
const client = createMastraClient(baseUrl);
|
|
6218
|
-
const
|
|
6346
|
+
const createLegacyWorkflowRun = async ({ workflowId, prevRunId }) => {
|
|
6219
6347
|
try {
|
|
6220
|
-
const workflow = client.
|
|
6348
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6221
6349
|
const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
|
|
6222
6350
|
return { runId: newRunId };
|
|
6223
6351
|
} catch (error) {
|
|
@@ -6225,9 +6353,9 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6225
6353
|
throw error;
|
|
6226
6354
|
}
|
|
6227
6355
|
};
|
|
6228
|
-
const
|
|
6356
|
+
const createWorkflowRun = async ({ workflowId, prevRunId }) => {
|
|
6229
6357
|
try {
|
|
6230
|
-
const workflow = client.
|
|
6358
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6231
6359
|
const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
|
|
6232
6360
|
return { runId: newRunId };
|
|
6233
6361
|
} catch (error) {
|
|
@@ -6235,16 +6363,20 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6235
6363
|
throw error;
|
|
6236
6364
|
}
|
|
6237
6365
|
};
|
|
6238
|
-
const
|
|
6366
|
+
const startLegacyWorkflowRun = async ({
|
|
6367
|
+
workflowId,
|
|
6368
|
+
runId,
|
|
6369
|
+
input
|
|
6370
|
+
}) => {
|
|
6239
6371
|
try {
|
|
6240
|
-
const workflow = client.
|
|
6372
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6241
6373
|
await workflow.start({ runId, triggerData: input || {} });
|
|
6242
6374
|
} catch (error) {
|
|
6243
6375
|
console.error("Error starting workflow run:", error);
|
|
6244
6376
|
throw error;
|
|
6245
6377
|
}
|
|
6246
6378
|
};
|
|
6247
|
-
const
|
|
6379
|
+
const startWorkflowRun = async ({
|
|
6248
6380
|
workflowId,
|
|
6249
6381
|
runId,
|
|
6250
6382
|
input,
|
|
@@ -6255,14 +6387,14 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6255
6387
|
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6256
6388
|
runtimeContext$1.set(key, value);
|
|
6257
6389
|
});
|
|
6258
|
-
const workflow = client.
|
|
6390
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6259
6391
|
await workflow.start({ runId, inputData: input || {}, runtimeContext: runtimeContext$1 });
|
|
6260
6392
|
} catch (error) {
|
|
6261
6393
|
console.error("Error starting workflow run:", error);
|
|
6262
6394
|
throw error;
|
|
6263
6395
|
}
|
|
6264
6396
|
};
|
|
6265
|
-
const
|
|
6397
|
+
const startAsyncWorkflowRun = async ({
|
|
6266
6398
|
workflowId,
|
|
6267
6399
|
runId,
|
|
6268
6400
|
input,
|
|
@@ -6273,7 +6405,7 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6273
6405
|
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6274
6406
|
runtimeContext$1.set(key, value);
|
|
6275
6407
|
});
|
|
6276
|
-
const workflow = client.
|
|
6408
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6277
6409
|
const result = await workflow.startAsync({ runId, inputData: input || {}, runtimeContext: runtimeContext$1 });
|
|
6278
6410
|
return result;
|
|
6279
6411
|
} catch (error) {
|
|
@@ -6284,17 +6416,17 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6284
6416
|
return {
|
|
6285
6417
|
startWorkflowRun,
|
|
6286
6418
|
createWorkflowRun,
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6419
|
+
startLegacyWorkflowRun,
|
|
6420
|
+
createLegacyWorkflowRun,
|
|
6421
|
+
startAsyncWorkflowRun
|
|
6290
6422
|
};
|
|
6291
6423
|
};
|
|
6292
6424
|
const useWatchWorkflow = (baseUrl) => {
|
|
6425
|
+
const [isWatchingLegacyWorkflow, setIsWatchingLegacyWorkflow] = React.useState(false);
|
|
6293
6426
|
const [isWatchingWorkflow, setIsWatchingWorkflow] = React.useState(false);
|
|
6294
|
-
const [
|
|
6427
|
+
const [legacyWatchResult, setLegacyWatchResult] = React.useState(null);
|
|
6295
6428
|
const [watchResult, setWatchResult] = React.useState(null);
|
|
6296
|
-
const
|
|
6297
|
-
const debouncedSetWatchResult = useDebounce.useDebouncedCallback((record) => {
|
|
6429
|
+
const debouncedSetLegacyWorkflowWatchResult = useDebounce.useDebouncedCallback((record) => {
|
|
6298
6430
|
const formattedResults = Object.entries(record.results || {}).reduce(
|
|
6299
6431
|
(acc, [key, value]) => {
|
|
6300
6432
|
let output = value.status === "success" ? value.output : void 0;
|
|
@@ -6317,19 +6449,19 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6317
6449
|
...record,
|
|
6318
6450
|
sanitizedOutput: record ? JSON.stringify({ ...record, results: formattedResults }, null, 2).slice(0, 5e4) : null
|
|
6319
6451
|
};
|
|
6320
|
-
|
|
6452
|
+
setLegacyWatchResult(sanitizedRecord);
|
|
6321
6453
|
}, 100);
|
|
6322
|
-
const
|
|
6454
|
+
const watchLegacyWorkflow = async ({ workflowId, runId }) => {
|
|
6323
6455
|
try {
|
|
6324
|
-
|
|
6456
|
+
setIsWatchingLegacyWorkflow(true);
|
|
6325
6457
|
const client = createMastraClient(baseUrl);
|
|
6326
|
-
const workflow = client.
|
|
6458
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6327
6459
|
await workflow.watch({ runId }, (record) => {
|
|
6328
6460
|
try {
|
|
6329
|
-
|
|
6461
|
+
debouncedSetLegacyWorkflowWatchResult(record);
|
|
6330
6462
|
} catch (err) {
|
|
6331
6463
|
console.error("Error processing workflow record:", err);
|
|
6332
|
-
|
|
6464
|
+
setLegacyWatchResult({
|
|
6333
6465
|
...record
|
|
6334
6466
|
});
|
|
6335
6467
|
}
|
|
@@ -6338,24 +6470,24 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6338
6470
|
console.error("Error watching workflow:", error);
|
|
6339
6471
|
throw error;
|
|
6340
6472
|
} finally {
|
|
6341
|
-
|
|
6473
|
+
setIsWatchingLegacyWorkflow(false);
|
|
6342
6474
|
}
|
|
6343
6475
|
};
|
|
6344
|
-
const
|
|
6345
|
-
const sanitizedRecord =
|
|
6346
|
-
|
|
6476
|
+
const debouncedSetWorkflowWatchResult = useDebounce.useDebouncedCallback((record) => {
|
|
6477
|
+
const sanitizedRecord = sanitizeWorkflowWatchResult(record);
|
|
6478
|
+
setWatchResult(sanitizedRecord);
|
|
6347
6479
|
}, 100);
|
|
6348
|
-
const
|
|
6480
|
+
const watchWorkflow = async ({ workflowId, runId }) => {
|
|
6349
6481
|
try {
|
|
6350
|
-
|
|
6482
|
+
setIsWatchingWorkflow(true);
|
|
6351
6483
|
const client = createMastraClient(baseUrl);
|
|
6352
|
-
const workflow = client.
|
|
6484
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6353
6485
|
await workflow.watch({ runId }, (record) => {
|
|
6354
6486
|
try {
|
|
6355
|
-
|
|
6487
|
+
debouncedSetWorkflowWatchResult(record);
|
|
6356
6488
|
} catch (err) {
|
|
6357
6489
|
console.error("Error processing workflow record:", err);
|
|
6358
|
-
|
|
6490
|
+
setWatchResult({
|
|
6359
6491
|
...record
|
|
6360
6492
|
});
|
|
6361
6493
|
}
|
|
@@ -6364,40 +6496,40 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6364
6496
|
console.error("Error watching workflow:", error);
|
|
6365
6497
|
throw error;
|
|
6366
6498
|
} finally {
|
|
6367
|
-
|
|
6499
|
+
setIsWatchingWorkflow(false);
|
|
6368
6500
|
}
|
|
6369
6501
|
};
|
|
6370
6502
|
return {
|
|
6503
|
+
watchLegacyWorkflow,
|
|
6504
|
+
isWatchingLegacyWorkflow,
|
|
6505
|
+
legacyWatchResult,
|
|
6371
6506
|
watchWorkflow,
|
|
6372
6507
|
isWatchingWorkflow,
|
|
6373
|
-
watchResult
|
|
6374
|
-
watchVNextWorkflow,
|
|
6375
|
-
isWatchingVNextWorkflow,
|
|
6376
|
-
watchVNextResult
|
|
6508
|
+
watchResult
|
|
6377
6509
|
};
|
|
6378
6510
|
};
|
|
6379
6511
|
const useResumeWorkflow = (baseUrl) => {
|
|
6512
|
+
const [isResumingLegacyWorkflow, setIsResumingLegacyWorkflow] = React.useState(false);
|
|
6380
6513
|
const [isResumingWorkflow, setIsResumingWorkflow] = React.useState(false);
|
|
6381
|
-
const
|
|
6382
|
-
const resumeWorkflow = async ({
|
|
6514
|
+
const resumeLegacyWorkflow = async ({
|
|
6383
6515
|
workflowId,
|
|
6384
6516
|
stepId,
|
|
6385
6517
|
runId,
|
|
6386
6518
|
context
|
|
6387
6519
|
}) => {
|
|
6388
6520
|
try {
|
|
6389
|
-
|
|
6521
|
+
setIsResumingLegacyWorkflow(true);
|
|
6390
6522
|
const client = createMastraClient(baseUrl);
|
|
6391
|
-
const response = await client.
|
|
6523
|
+
const response = await client.getLegacyWorkflow(workflowId).resume({ stepId, runId, context });
|
|
6392
6524
|
return response;
|
|
6393
6525
|
} catch (error) {
|
|
6394
6526
|
console.error("Error resuming workflow:", error);
|
|
6395
6527
|
throw error;
|
|
6396
6528
|
} finally {
|
|
6397
|
-
|
|
6529
|
+
setIsResumingLegacyWorkflow(false);
|
|
6398
6530
|
}
|
|
6399
6531
|
};
|
|
6400
|
-
const
|
|
6532
|
+
const resumeWorkflow = async ({
|
|
6401
6533
|
workflowId,
|
|
6402
6534
|
step,
|
|
6403
6535
|
runId,
|
|
@@ -6405,26 +6537,26 @@ const useResumeWorkflow = (baseUrl) => {
|
|
|
6405
6537
|
runtimeContext: playgroundRuntimeContext
|
|
6406
6538
|
}) => {
|
|
6407
6539
|
try {
|
|
6408
|
-
|
|
6540
|
+
setIsResumingWorkflow(true);
|
|
6409
6541
|
const client = createMastraClient(baseUrl);
|
|
6410
6542
|
const runtimeContext$1 = new runtimeContext.RuntimeContext();
|
|
6411
6543
|
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6412
6544
|
runtimeContext$1.set(key, value);
|
|
6413
6545
|
});
|
|
6414
|
-
const response = await client.
|
|
6546
|
+
const response = await client.getWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext: runtimeContext$1 });
|
|
6415
6547
|
return response;
|
|
6416
6548
|
} catch (error) {
|
|
6417
6549
|
console.error("Error resuming workflow:", error);
|
|
6418
6550
|
throw error;
|
|
6419
6551
|
} finally {
|
|
6420
|
-
|
|
6552
|
+
setIsResumingWorkflow(false);
|
|
6421
6553
|
}
|
|
6422
6554
|
};
|
|
6423
6555
|
return {
|
|
6556
|
+
resumeLegacyWorkflow,
|
|
6557
|
+
isResumingLegacyWorkflow,
|
|
6424
6558
|
resumeWorkflow,
|
|
6425
|
-
isResumingWorkflow
|
|
6426
|
-
resumeVNextWorkflow,
|
|
6427
|
-
isResumingVNextWorkflow
|
|
6559
|
+
isResumingWorkflow
|
|
6428
6560
|
};
|
|
6429
6561
|
};
|
|
6430
6562
|
|
|
@@ -6511,7 +6643,7 @@ const defaultEdgeOptions = {
|
|
|
6511
6643
|
color: "#8e8e8e"
|
|
6512
6644
|
}
|
|
6513
6645
|
};
|
|
6514
|
-
const
|
|
6646
|
+
const contructLegacyNodesAndEdges = ({
|
|
6515
6647
|
stepGraph,
|
|
6516
6648
|
stepSubscriberGraph,
|
|
6517
6649
|
steps: mainSteps = {}
|
|
@@ -6962,7 +7094,7 @@ const getStepNodeAndEdge = ({
|
|
|
6962
7094
|
}
|
|
6963
7095
|
return { nodes: [], edges: [], nextPrevNodeIds: [] };
|
|
6964
7096
|
};
|
|
6965
|
-
const
|
|
7097
|
+
const constructNodesAndEdges = ({
|
|
6966
7098
|
stepGraph
|
|
6967
7099
|
}) => {
|
|
6968
7100
|
if (!stepGraph) {
|
|
@@ -7301,12 +7433,12 @@ function Spinner({ color = "#fff", className }) {
|
|
|
7301
7433
|
);
|
|
7302
7434
|
}
|
|
7303
7435
|
|
|
7304
|
-
function
|
|
7436
|
+
function LegacyWorkflowNestedGraph({
|
|
7305
7437
|
stepGraph,
|
|
7306
7438
|
stepSubscriberGraph,
|
|
7307
7439
|
open
|
|
7308
7440
|
}) {
|
|
7309
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
7441
|
+
const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
|
|
7310
7442
|
stepGraph,
|
|
7311
7443
|
stepSubscriberGraph
|
|
7312
7444
|
});
|
|
@@ -7344,10 +7476,10 @@ function WorkflowNestedGraph({
|
|
|
7344
7476
|
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) });
|
|
7345
7477
|
}
|
|
7346
7478
|
|
|
7347
|
-
const
|
|
7479
|
+
const LegacyWorkflowNestedGraphContext = React.createContext(
|
|
7348
7480
|
{}
|
|
7349
7481
|
);
|
|
7350
|
-
function
|
|
7482
|
+
function LegacyWorkflowNestedGraphProvider({ children }) {
|
|
7351
7483
|
const [stepGraph, setStepGraph] = React.useState(null);
|
|
7352
7484
|
const [stepSubscriberGraph, setStepSubscriberGraph] = React.useState(null);
|
|
7353
7485
|
const [openDialog, setOpenDialog] = React.useState(false);
|
|
@@ -7369,7 +7501,7 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
7369
7501
|
setOpenDialog(true);
|
|
7370
7502
|
};
|
|
7371
7503
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7372
|
-
|
|
7504
|
+
LegacyWorkflowNestedGraphContext.Provider,
|
|
7373
7505
|
{
|
|
7374
7506
|
value: {
|
|
7375
7507
|
showNestedGraph,
|
|
@@ -7385,16 +7517,23 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
7385
7517
|
" workflow"
|
|
7386
7518
|
] })
|
|
7387
7519
|
] }),
|
|
7388
|
-
/* @__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
|
+
) })
|
|
7389
7528
|
] }) }) })
|
|
7390
7529
|
]
|
|
7391
7530
|
}
|
|
7392
7531
|
);
|
|
7393
7532
|
}
|
|
7394
7533
|
|
|
7395
|
-
function
|
|
7534
|
+
function LegacyWorkflowNestedNode({ data }) {
|
|
7396
7535
|
const { label, withoutTopHandle, withoutBottomHandle, stepGraph, stepSubscriberGraph } = data;
|
|
7397
|
-
const { showNestedGraph } = React.useContext(
|
|
7536
|
+
const { showNestedGraph } = React.useContext(LegacyWorkflowNestedGraphContext);
|
|
7398
7537
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
|
|
7399
7538
|
!withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$2.Handle, { type: "target", position: react$2.Position.Top, style: { visibility: "hidden" } }),
|
|
7400
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: [
|
|
@@ -7405,8 +7544,8 @@ function WorkflowNestedNode({ data }) {
|
|
|
7405
7544
|
] });
|
|
7406
7545
|
}
|
|
7407
7546
|
|
|
7408
|
-
function
|
|
7409
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
7547
|
+
function LegacyWorkflowGraphInner({ workflow }) {
|
|
7548
|
+
const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
|
|
7410
7549
|
stepGraph: workflow.serializedStepGraph || workflow.stepGraph,
|
|
7411
7550
|
stepSubscriberGraph: workflow.serializedStepSubscriberGraph || workflow.stepSubscriberGraph,
|
|
7412
7551
|
steps: workflow.steps
|
|
@@ -7418,7 +7557,7 @@ function WorkflowGraphInner({ workflow }) {
|
|
|
7418
7557
|
"condition-node": WorkflowConditionNode,
|
|
7419
7558
|
"after-node": WorkflowAfterNode,
|
|
7420
7559
|
"loop-result-node": WorkflowLoopResultNode,
|
|
7421
|
-
"nested-node":
|
|
7560
|
+
"nested-node": LegacyWorkflowNestedNode
|
|
7422
7561
|
};
|
|
7423
7562
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7424
7563
|
react$2.ReactFlow,
|
|
@@ -7445,12 +7584,12 @@ const lodashTitleCase = (str) => {
|
|
|
7445
7584
|
return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
|
|
7446
7585
|
};
|
|
7447
7586
|
|
|
7448
|
-
function
|
|
7449
|
-
const {
|
|
7587
|
+
function LegacyWorkflowGraph({ workflowId, baseUrl }) {
|
|
7588
|
+
const { legacyWorkflow, isLoading } = useLegacyWorkflow(workflowId, baseUrl);
|
|
7450
7589
|
if (isLoading) {
|
|
7451
7590
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-[600px]" }) });
|
|
7452
7591
|
}
|
|
7453
|
-
if (!
|
|
7592
|
+
if (!legacyWorkflow) {
|
|
7454
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: [
|
|
7455
7594
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, {}),
|
|
7456
7595
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -7460,28 +7599,24 @@ function WorkflowGraph({ workflowId, baseUrl }) {
|
|
|
7460
7599
|
] })
|
|
7461
7600
|
] }) });
|
|
7462
7601
|
}
|
|
7463
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7602
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(LegacyWorkflowGraphInner, { workflow: legacyWorkflow }) }) });
|
|
7464
7603
|
}
|
|
7465
7604
|
|
|
7466
7605
|
const Form = React.forwardRef(({ children, ...props }, ref) => {
|
|
7467
7606
|
return /* @__PURE__ */ jsxRuntime.jsx("form", { ref, className: "space-y-4", ...props, children });
|
|
7468
7607
|
});
|
|
7469
7608
|
|
|
7470
|
-
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
7471
|
-
const Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(LabelPrimitive__namespace.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
7472
|
-
Label.displayName = LabelPrimitive__namespace.Root.displayName;
|
|
7473
|
-
|
|
7474
7609
|
const DISABLED_LABELS = ["boolean", "object", "array"];
|
|
7475
7610
|
const FieldWrapper = ({ label, children, id, field, error }) => {
|
|
7476
7611
|
const isDisabled = DISABLED_LABELS.includes(field.type);
|
|
7477
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
7478
|
-
!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: [
|
|
7479
7614
|
label,
|
|
7480
|
-
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
7615
|
+
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent2", children: " *" })
|
|
7481
7616
|
] }),
|
|
7482
7617
|
children,
|
|
7483
|
-
field.fieldConfig?.description && /* @__PURE__ */ jsxRuntime.jsx("p",
|
|
7484
|
-
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 })
|
|
7485
7620
|
] });
|
|
7486
7621
|
};
|
|
7487
7622
|
|
|
@@ -7590,9 +7725,9 @@ const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ *
|
|
|
7590
7725
|
defaultChecked: field.default
|
|
7591
7726
|
}
|
|
7592
7727
|
),
|
|
7593
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7728
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3", htmlFor: id, children: [
|
|
7594
7729
|
label,
|
|
7595
|
-
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
7730
|
+
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-accent2", children: " *" })
|
|
7596
7731
|
] })
|
|
7597
7732
|
] });
|
|
7598
7733
|
|
|
@@ -7939,34 +8074,53 @@ const SelectField = ({ field, inputProps, error, id, value }) => {
|
|
|
7939
8074
|
};
|
|
7940
8075
|
|
|
7941
8076
|
const ObjectWrapper = ({ label, children }) => {
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
children
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
const ArrayWrapper = ({ label, children, onAddItem }) => {
|
|
7949
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
7950
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-medium", children: label }),
|
|
7951
|
-
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
|
+
] }),
|
|
7952
8083
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7953
|
-
|
|
8084
|
+
"div",
|
|
7954
8085
|
{
|
|
7955
|
-
className: "
|
|
7956
|
-
|
|
7957
|
-
variant: "outline",
|
|
7958
|
-
size: "sm",
|
|
7959
|
-
type: "button",
|
|
7960
|
-
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
|
|
7961
8088
|
}
|
|
7962
8089
|
)
|
|
7963
8090
|
] });
|
|
7964
8091
|
};
|
|
7965
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
|
+
|
|
7966
8117
|
const ArrayElementWrapper = ({ children, onRemove }) => {
|
|
7967
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
7968
|
-
|
|
7969
|
-
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
|
+
] })
|
|
7970
8124
|
] });
|
|
7971
8125
|
};
|
|
7972
8126
|
|
|
@@ -8165,6 +8319,10 @@ class CustomZodProvider extends zod.ZodProvider {
|
|
|
8165
8319
|
}
|
|
8166
8320
|
}
|
|
8167
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
|
+
|
|
8168
8326
|
function isEmptyZodObject(schema) {
|
|
8169
8327
|
if (schema instanceof z.ZodObject) {
|
|
8170
8328
|
return Object.keys(schema.shape).length === 0;
|
|
@@ -8176,7 +8334,7 @@ function DynamicForm({
|
|
|
8176
8334
|
onSubmit,
|
|
8177
8335
|
defaultValues,
|
|
8178
8336
|
isSubmitLoading,
|
|
8179
|
-
submitButtonLabel
|
|
8337
|
+
submitButtonLabel
|
|
8180
8338
|
}) {
|
|
8181
8339
|
if (!schema) {
|
|
8182
8340
|
console.error("no form schema found");
|
|
@@ -8198,17 +8356,17 @@ function DynamicForm({
|
|
|
8198
8356
|
},
|
|
8199
8357
|
defaultValues: defaultValues ? { "": defaultValues } : void 0,
|
|
8200
8358
|
formProps: {
|
|
8201
|
-
className: "
|
|
8359
|
+
className: ""
|
|
8202
8360
|
},
|
|
8203
8361
|
uiComponents: {
|
|
8204
|
-
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 })
|
|
8205
8363
|
},
|
|
8206
8364
|
formComponents: {
|
|
8207
8365
|
Label: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-normal", children: value })
|
|
8208
8366
|
},
|
|
8209
8367
|
withSubmit: true
|
|
8210
8368
|
};
|
|
8211
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8369
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntime.jsx(AutoForm, { ...formProps }) });
|
|
8212
8370
|
}
|
|
8213
8371
|
|
|
8214
8372
|
function resolveSerializedZodOutput(obj) {
|
|
@@ -8238,22 +8396,22 @@ function CodeBlockDemo({
|
|
|
8238
8396
|
|
|
8239
8397
|
const WorkflowRunContext = React.createContext({});
|
|
8240
8398
|
function WorkflowRunProvider({ children }) {
|
|
8399
|
+
const [legacyResult, setLegacyResult] = React.useState(null);
|
|
8241
8400
|
const [result, setResult] = React.useState(null);
|
|
8242
|
-
const [vNextResult, setVNextResult] = React.useState(null);
|
|
8243
8401
|
const [payload, setPayload] = React.useState(null);
|
|
8244
8402
|
const clearData = () => {
|
|
8403
|
+
setLegacyResult(null);
|
|
8245
8404
|
setResult(null);
|
|
8246
|
-
setVNextResult(null);
|
|
8247
8405
|
setPayload(null);
|
|
8248
8406
|
};
|
|
8249
8407
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8250
8408
|
WorkflowRunContext.Provider,
|
|
8251
8409
|
{
|
|
8252
8410
|
value: {
|
|
8411
|
+
legacyResult,
|
|
8412
|
+
setLegacyResult,
|
|
8253
8413
|
result,
|
|
8254
8414
|
setResult,
|
|
8255
|
-
vNextResult,
|
|
8256
|
-
setVNextResult,
|
|
8257
8415
|
payload,
|
|
8258
8416
|
setPayload,
|
|
8259
8417
|
clearData
|
|
@@ -8263,16 +8421,81 @@ function WorkflowRunProvider({ children }) {
|
|
|
8263
8421
|
);
|
|
8264
8422
|
}
|
|
8265
8423
|
|
|
8266
|
-
|
|
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({
|
|
8267
8486
|
workflowId,
|
|
8268
8487
|
baseUrl,
|
|
8269
8488
|
setRunId
|
|
8270
8489
|
}) {
|
|
8271
|
-
const { result, setResult, payload, setPayload } = React.useContext(WorkflowRunContext);
|
|
8272
|
-
const { isLoading, workflow } =
|
|
8273
|
-
const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
8274
|
-
const {
|
|
8275
|
-
|
|
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);
|
|
8276
8499
|
const [suspendedSteps, setSuspendedSteps] = React.useState([]);
|
|
8277
8500
|
const [isRunning, setIsRunning] = React.useState(false);
|
|
8278
8501
|
const triggerSchema = workflow?.triggerSchema;
|
|
@@ -8303,7 +8526,7 @@ function WorkflowTrigger({
|
|
|
8303
8526
|
});
|
|
8304
8527
|
};
|
|
8305
8528
|
const watchResultToUse = result ?? watchResult;
|
|
8306
|
-
const workflowActivePaths = watchResultToUse?.activePaths ??
|
|
8529
|
+
const workflowActivePaths = watchResultToUse?.activePaths ?? {};
|
|
8307
8530
|
React.useEffect(() => {
|
|
8308
8531
|
setIsRunning(isWatchingWorkflow);
|
|
8309
8532
|
}, [isWatchingWorkflow]);
|
|
@@ -8331,50 +8554,34 @@ function WorkflowTrigger({
|
|
|
8331
8554
|
const isSuspendedSteps = suspendedSteps.length > 0;
|
|
8332
8555
|
const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(triggerSchema))) : null;
|
|
8333
8556
|
const { sanitizedOutput, ...restResult } = result ?? {};
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8340
|
-
" Resuming workflow"
|
|
8341
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
|
8342
|
-
] }),
|
|
8343
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8344
|
-
DynamicForm,
|
|
8345
|
-
{
|
|
8346
|
-
schema: zodInputSchema,
|
|
8347
|
-
defaultValues: payload,
|
|
8348
|
-
isSubmitLoading: isWatchingWorkflow,
|
|
8349
|
-
onSubmit: (data) => {
|
|
8350
|
-
setPayload(data);
|
|
8351
|
-
handleExecuteWorkflow(data);
|
|
8352
|
-
}
|
|
8353
|
-
}
|
|
8354
|
-
)
|
|
8355
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 space-y-4", children: [
|
|
8356
|
-
isResumingWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
|
|
8357
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8358
|
-
" Resuming workflow"
|
|
8359
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
|
|
8360
|
-
/* @__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" })
|
|
8361
|
-
] }) }),
|
|
8362
|
-
Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8363
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
8364
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
|
|
8365
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
|
|
8366
|
-
const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : "Completed";
|
|
8367
|
-
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" });
|
|
8368
|
-
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: [
|
|
8369
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: path.charAt(0).toUpperCase() + path.slice(1) }),
|
|
8370
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8371
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
|
|
8372
|
-
status
|
|
8373
|
-
] })
|
|
8374
|
-
] }) }, idx);
|
|
8375
|
-
}) });
|
|
8376
|
-
}) })
|
|
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" })
|
|
8377
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
|
+
) }),
|
|
8378
8585
|
isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8379
8586
|
const stepDefinition = workflow.steps[step.stepId];
|
|
8380
8587
|
const stepSchema = stepDefinition?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.inputSchema))) : z.z.record(z.z.string(), z.z.any());
|
|
@@ -8406,29 +8613,23 @@ function WorkflowTrigger({
|
|
|
8406
8613
|
)
|
|
8407
8614
|
] });
|
|
8408
8615
|
}),
|
|
8409
|
-
|
|
8410
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8411
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8419
|
-
|
|
8420
|
-
{
|
|
8421
|
-
className: "w-full overflow-x-auto",
|
|
8422
|
-
code: sanitizedOutput || JSON.stringify(restResult, null, 2),
|
|
8423
|
-
language: "json"
|
|
8424
|
-
}
|
|
8425
|
-
)
|
|
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) })
|
|
8426
8627
|
] })
|
|
8427
8628
|
] }) });
|
|
8428
8629
|
}
|
|
8429
8630
|
|
|
8430
|
-
function
|
|
8431
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
8631
|
+
function WorkflowNestedGraph({ stepGraph, open }) {
|
|
8632
|
+
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges({
|
|
8432
8633
|
stepGraph
|
|
8433
8634
|
});
|
|
8434
8635
|
const [isMounted, setIsMounted] = React.useState(false);
|
|
@@ -8439,7 +8640,7 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
|
|
|
8439
8640
|
"condition-node": WorkflowConditionNode,
|
|
8440
8641
|
"after-node": WorkflowAfterNode,
|
|
8441
8642
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8442
|
-
"nested-node":
|
|
8643
|
+
"nested-node": WorkflowNestedNode
|
|
8443
8644
|
};
|
|
8444
8645
|
React.useEffect(() => {
|
|
8445
8646
|
if (open) {
|
|
@@ -8466,10 +8667,10 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
|
|
|
8466
8667
|
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }) });
|
|
8467
8668
|
}
|
|
8468
8669
|
|
|
8469
|
-
const
|
|
8670
|
+
const WorkflowNestedGraphContext = React.createContext(
|
|
8470
8671
|
{}
|
|
8471
8672
|
);
|
|
8472
|
-
function
|
|
8673
|
+
function WorkflowNestedGraphProvider({ children }) {
|
|
8473
8674
|
const [stepGraph, setStepGraph] = React.useState(null);
|
|
8474
8675
|
const [parentStepGraphList, setParentStepGraphList] = React.useState([]);
|
|
8475
8676
|
const [openDialog, setOpenDialog] = React.useState(false);
|
|
@@ -8507,7 +8708,7 @@ function VNextWorkflowNestedGraphProvider({ children }) {
|
|
|
8507
8708
|
}, 500);
|
|
8508
8709
|
};
|
|
8509
8710
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8510
|
-
|
|
8711
|
+
WorkflowNestedGraphContext.Provider,
|
|
8511
8712
|
{
|
|
8512
8713
|
value: {
|
|
8513
8714
|
showNestedGraph,
|
|
@@ -8523,16 +8724,16 @@ function VNextWorkflowNestedGraphProvider({ children }) {
|
|
|
8523
8724
|
" workflow"
|
|
8524
8725
|
] })
|
|
8525
8726
|
] }),
|
|
8526
|
-
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 }) })
|
|
8527
8728
|
] }) }) })
|
|
8528
8729
|
]
|
|
8529
8730
|
}
|
|
8530
8731
|
);
|
|
8531
8732
|
}
|
|
8532
8733
|
|
|
8533
|
-
function
|
|
8734
|
+
function WorkflowNestedNode({ data }) {
|
|
8534
8735
|
const { label, withoutTopHandle, withoutBottomHandle, stepGraph } = data;
|
|
8535
|
-
const { showNestedGraph } = React.useContext(
|
|
8736
|
+
const { showNestedGraph } = React.useContext(WorkflowNestedGraphContext);
|
|
8536
8737
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
|
|
8537
8738
|
!withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$2.Handle, { type: "target", position: react$2.Position.Top, style: { visibility: "hidden" } }),
|
|
8538
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: [
|
|
@@ -8543,8 +8744,8 @@ function VNextWorkflowNestedNode({ data }) {
|
|
|
8543
8744
|
] });
|
|
8544
8745
|
}
|
|
8545
8746
|
|
|
8546
|
-
function
|
|
8547
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
8747
|
+
function WorkflowGraphInner({ workflow }) {
|
|
8748
|
+
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges(workflow);
|
|
8548
8749
|
const [nodes, _, onNodesChange] = react$2.useNodesState(initialNodes);
|
|
8549
8750
|
const [edges] = react$2.useEdgesState(initialEdges);
|
|
8550
8751
|
const nodeTypes = {
|
|
@@ -8552,7 +8753,7 @@ function VNextWorkflowGraphInner({ workflow }) {
|
|
|
8552
8753
|
"condition-node": WorkflowConditionNode,
|
|
8553
8754
|
"after-node": WorkflowAfterNode,
|
|
8554
8755
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8555
|
-
"nested-node":
|
|
8756
|
+
"nested-node": WorkflowNestedNode
|
|
8556
8757
|
};
|
|
8557
8758
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8558
8759
|
react$2.ReactFlow,
|
|
@@ -8574,12 +8775,12 @@ function VNextWorkflowGraphInner({ workflow }) {
|
|
|
8574
8775
|
) });
|
|
8575
8776
|
}
|
|
8576
8777
|
|
|
8577
|
-
function
|
|
8578
|
-
const {
|
|
8778
|
+
function WorkflowGraph({ workflowId, baseUrl }) {
|
|
8779
|
+
const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
|
|
8579
8780
|
if (isLoading) {
|
|
8580
8781
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-[600px]" }) });
|
|
8581
8782
|
}
|
|
8582
|
-
if (!
|
|
8783
|
+
if (!workflow) {
|
|
8583
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: [
|
|
8584
8785
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, {}),
|
|
8585
8786
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -8589,43 +8790,60 @@ function VNextWorkflowGraph({ workflowId, baseUrl }) {
|
|
|
8589
8790
|
] })
|
|
8590
8791
|
] }) });
|
|
8591
8792
|
}
|
|
8592
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8793
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowGraphInner, { workflow }) }) });
|
|
8593
8794
|
}
|
|
8594
8795
|
|
|
8595
|
-
|
|
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({
|
|
8596
8814
|
workflowId,
|
|
8597
8815
|
baseUrl,
|
|
8598
8816
|
setRunId
|
|
8599
8817
|
}) {
|
|
8600
8818
|
const { runtimeContext } = usePlaygroundStore();
|
|
8601
|
-
const {
|
|
8602
|
-
const { isLoading,
|
|
8603
|
-
const {
|
|
8604
|
-
const {
|
|
8605
|
-
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);
|
|
8606
8824
|
const [suspendedSteps, setSuspendedSteps] = React.useState([]);
|
|
8607
8825
|
const [isRunning, setIsRunning] = React.useState(false);
|
|
8608
|
-
const triggerSchema =
|
|
8826
|
+
const triggerSchema = workflow?.inputSchema;
|
|
8609
8827
|
const handleExecuteWorkflow = async (data) => {
|
|
8610
8828
|
try {
|
|
8611
|
-
if (!
|
|
8829
|
+
if (!workflow) return;
|
|
8612
8830
|
setIsRunning(true);
|
|
8613
|
-
|
|
8614
|
-
const { runId } = await
|
|
8831
|
+
setResult(null);
|
|
8832
|
+
const { runId } = await createWorkflowRun({ workflowId });
|
|
8615
8833
|
setRunId?.(runId);
|
|
8616
|
-
|
|
8617
|
-
|
|
8834
|
+
watchWorkflow({ workflowId, runId });
|
|
8835
|
+
startWorkflowRun({ workflowId, runId, input: data, runtimeContext });
|
|
8618
8836
|
} catch (err) {
|
|
8619
8837
|
setIsRunning(false);
|
|
8620
8838
|
sonner.toast.error("Error executing workflow");
|
|
8621
8839
|
}
|
|
8622
8840
|
};
|
|
8623
8841
|
const handleResumeWorkflow = async (step) => {
|
|
8624
|
-
if (!
|
|
8842
|
+
if (!workflow) return;
|
|
8625
8843
|
const { stepId, runId: prevRunId, resumeData } = step;
|
|
8626
|
-
const { runId } = await
|
|
8627
|
-
|
|
8628
|
-
await
|
|
8844
|
+
const { runId } = await createWorkflowRun({ workflowId, prevRunId });
|
|
8845
|
+
watchWorkflow({ workflowId, runId });
|
|
8846
|
+
await resumeWorkflow({
|
|
8629
8847
|
step: stepId,
|
|
8630
8848
|
runId,
|
|
8631
8849
|
resumeData,
|
|
@@ -8633,78 +8851,65 @@ function VNextWorkflowTrigger({
|
|
|
8633
8851
|
runtimeContext
|
|
8634
8852
|
});
|
|
8635
8853
|
};
|
|
8636
|
-
const watchResultToUse =
|
|
8854
|
+
const watchResultToUse = result ?? watchResult;
|
|
8637
8855
|
const workflowActivePaths = watchResultToUse?.payload?.workflowState?.steps ?? {};
|
|
8638
8856
|
React.useEffect(() => {
|
|
8639
|
-
setIsRunning(
|
|
8640
|
-
}, [
|
|
8857
|
+
setIsRunning(isWatchingWorkflow);
|
|
8858
|
+
}, [isWatchingWorkflow]);
|
|
8641
8859
|
React.useEffect(() => {
|
|
8642
|
-
if (!watchResultToUse?.payload?.workflowState?.steps || !
|
|
8860
|
+
if (!watchResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
|
|
8643
8861
|
const suspended = Object.entries(watchResultToUse.payload.workflowState.steps).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
|
|
8644
8862
|
stepId,
|
|
8645
|
-
runId:
|
|
8863
|
+
runId: result.runId,
|
|
8646
8864
|
suspendPayload: payload2
|
|
8647
8865
|
}));
|
|
8648
8866
|
setSuspendedSteps(suspended);
|
|
8649
|
-
}, [watchResultToUse,
|
|
8867
|
+
}, [watchResultToUse, result]);
|
|
8650
8868
|
React.useEffect(() => {
|
|
8651
|
-
if (
|
|
8652
|
-
|
|
8869
|
+
if (watchResult) {
|
|
8870
|
+
setResult(watchResult);
|
|
8653
8871
|
}
|
|
8654
|
-
}, [
|
|
8872
|
+
}, [watchResult]);
|
|
8655
8873
|
if (isLoading) {
|
|
8656
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: [
|
|
8657
8875
|
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-10" }),
|
|
8658
8876
|
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-10" })
|
|
8659
8877
|
] }) });
|
|
8660
8878
|
}
|
|
8661
|
-
if (!
|
|
8879
|
+
if (!workflow) return null;
|
|
8662
8880
|
const isSuspendedSteps = suspendedSteps.length > 0;
|
|
8663
8881
|
const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(triggerSchema))) : null;
|
|
8664
|
-
const { sanitizedOutput, ...restResult } =
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8671
|
-
" Resuming workflow"
|
|
8672
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
|
8673
|
-
] }),
|
|
8674
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8675
|
-
DynamicForm,
|
|
8676
|
-
{
|
|
8677
|
-
schema: zodInputSchema,
|
|
8678
|
-
defaultValues: payload,
|
|
8679
|
-
isSubmitLoading: isWatchingVNextWorkflow,
|
|
8680
|
-
onSubmit: (data) => {
|
|
8681
|
-
setPayload(data);
|
|
8682
|
-
handleExecuteWorkflow(data);
|
|
8683
|
-
}
|
|
8684
|
-
}
|
|
8685
|
-
)
|
|
8686
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 space-y-4", children: [
|
|
8687
|
-
isResumingVNextWorkflow ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
|
|
8688
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8689
|
-
" Resuming workflow"
|
|
8690
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
|
|
8691
|
-
/* @__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" })
|
|
8692
|
-
] }) }),
|
|
8693
|
-
Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8694
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
8695
|
-
/* @__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 }]) => {
|
|
8696
|
-
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" });
|
|
8697
|
-
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: [
|
|
8698
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) }),
|
|
8699
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2 capitalize", children: [
|
|
8700
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
|
|
8701
|
-
status
|
|
8702
|
-
] })
|
|
8703
|
-
] }) }, stepId) });
|
|
8704
|
-
}) })
|
|
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" })
|
|
8705
8888
|
] }),
|
|
8706
|
-
!
|
|
8707
|
-
|
|
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];
|
|
8708
8913
|
const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.resumeSchema))) : z.z.record(z.z.string(), z.z.any());
|
|
8709
8914
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4", children: [
|
|
8710
8915
|
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
|
|
@@ -8720,7 +8925,7 @@ function VNextWorkflowTrigger({
|
|
|
8720
8925
|
DynamicForm,
|
|
8721
8926
|
{
|
|
8722
8927
|
schema: stepSchema,
|
|
8723
|
-
isSubmitLoading:
|
|
8928
|
+
isSubmitLoading: isResumingWorkflow,
|
|
8724
8929
|
submitButtonLabel: "Resume",
|
|
8725
8930
|
onSubmit: (data) => {
|
|
8726
8931
|
handleResumeWorkflow({
|
|
@@ -8734,23 +8939,18 @@ function VNextWorkflowTrigger({
|
|
|
8734
8939
|
)
|
|
8735
8940
|
] });
|
|
8736
8941
|
}),
|
|
8737
|
-
|
|
8738
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8739
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8740
|
-
|
|
8741
|
-
{
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
className: "w-full overflow-x-auto",
|
|
8750
|
-
code: sanitizedOutput || JSON.stringify(restResult, null, 2),
|
|
8751
|
-
language: "json"
|
|
8752
|
-
}
|
|
8753
|
-
)
|
|
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) })
|
|
8754
8954
|
] })
|
|
8755
8955
|
] }) });
|
|
8756
8956
|
}
|
|
@@ -8764,7 +8964,8 @@ const DataTable = ({
|
|
|
8764
8964
|
getRowId,
|
|
8765
8965
|
selectedRowId,
|
|
8766
8966
|
isLoading,
|
|
8767
|
-
emptyText
|
|
8967
|
+
emptyText,
|
|
8968
|
+
onClick
|
|
8768
8969
|
}) => {
|
|
8769
8970
|
const [sorting, setSorting] = React.useState([]);
|
|
8770
8971
|
const [{ pageIndex, pageSize }, setPagination] = React.useState({
|
|
@@ -8806,7 +9007,16 @@ const DataTable = ({
|
|
|
8806
9007
|
const meta = header.column.columnDef.meta;
|
|
8807
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);
|
|
8808
9009
|
}) }),
|
|
8809
|
-
/* @__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 })
|
|
8810
9020
|
] }),
|
|
8811
9021
|
pagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex items-center justify-between px-2", children: [
|
|
8812
9022
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -8943,6 +9153,41 @@ const DarkLogo = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "100
|
|
|
8943
9153
|
)
|
|
8944
9154
|
] });
|
|
8945
9155
|
|
|
9156
|
+
const Entity = ({ children, className, onClick }) => {
|
|
9157
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9158
|
+
"div",
|
|
9159
|
+
{
|
|
9160
|
+
tabIndex: onClick ? 0 : void 0,
|
|
9161
|
+
onKeyDown: (e) => {
|
|
9162
|
+
if (!onClick) return;
|
|
9163
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
9164
|
+
e.preventDefault();
|
|
9165
|
+
onClick?.();
|
|
9166
|
+
}
|
|
9167
|
+
},
|
|
9168
|
+
className: clsx(
|
|
9169
|
+
"flex gap-3 group/entity bg-surface3 rounded-lg border-sm border-border1 py-3 px-4",
|
|
9170
|
+
onClick && "cursor-pointer hover:bg-surface4 transition-all",
|
|
9171
|
+
className
|
|
9172
|
+
),
|
|
9173
|
+
onClick,
|
|
9174
|
+
children
|
|
9175
|
+
}
|
|
9176
|
+
);
|
|
9177
|
+
};
|
|
9178
|
+
const EntityIcon = ({ children, className }) => {
|
|
9179
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: clsx("text-icon3 mt-1", className), children });
|
|
9180
|
+
};
|
|
9181
|
+
const EntityName = ({ children, className }) => {
|
|
9182
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-lg", className: clsx("text-icon6 font-medium", className), children });
|
|
9183
|
+
};
|
|
9184
|
+
const EntityDescription = ({ children, className }) => {
|
|
9185
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: clsx("text-icon3", className), children });
|
|
9186
|
+
};
|
|
9187
|
+
const EntityContent = ({ children, className }) => {
|
|
9188
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
|
|
9189
|
+
};
|
|
9190
|
+
|
|
8946
9191
|
function usePolling({
|
|
8947
9192
|
fetchFn,
|
|
8948
9193
|
interval = 3e3,
|
|
@@ -9125,6 +9370,11 @@ exports.DeploymentIcon = DeploymentIcon;
|
|
|
9125
9370
|
exports.DividerIcon = DividerIcon;
|
|
9126
9371
|
exports.DocsIcon = DocsIcon;
|
|
9127
9372
|
exports.DynamicForm = DynamicForm;
|
|
9373
|
+
exports.Entity = Entity;
|
|
9374
|
+
exports.EntityContent = EntityContent;
|
|
9375
|
+
exports.EntityDescription = EntityDescription;
|
|
9376
|
+
exports.EntityIcon = EntityIcon;
|
|
9377
|
+
exports.EntityName = EntityName;
|
|
9128
9378
|
exports.EntryCell = EntryCell;
|
|
9129
9379
|
exports.EnvIcon = EnvIcon;
|
|
9130
9380
|
exports.EvaluatorCoinIcon = EvaluatorCoinIcon;
|
|
@@ -9141,6 +9391,8 @@ exports.Icon = Icon;
|
|
|
9141
9391
|
exports.InfoIcon = InfoIcon;
|
|
9142
9392
|
exports.JudgeIcon = JudgeIcon;
|
|
9143
9393
|
exports.LatencyIcon = LatencyIcon;
|
|
9394
|
+
exports.LegacyWorkflowGraph = LegacyWorkflowGraph;
|
|
9395
|
+
exports.LegacyWorkflowTrigger = LegacyWorkflowTrigger;
|
|
9144
9396
|
exports.LogsIcon = LogsIcon;
|
|
9145
9397
|
exports.MastraResizablePanel = MastraResizablePanel;
|
|
9146
9398
|
exports.MemoryIcon = MemoryIcon;
|
|
@@ -9171,8 +9423,6 @@ exports.TsIcon = TsIcon;
|
|
|
9171
9423
|
exports.Txt = Txt;
|
|
9172
9424
|
exports.TxtCell = TxtCell;
|
|
9173
9425
|
exports.UnitCell = UnitCell;
|
|
9174
|
-
exports.VNextWorkflowGraph = VNextWorkflowGraph;
|
|
9175
|
-
exports.VNextWorkflowTrigger = VNextWorkflowTrigger;
|
|
9176
9426
|
exports.VariablesIcon = VariablesIcon;
|
|
9177
9427
|
exports.WorkflowCoinIcon = WorkflowCoinIcon;
|
|
9178
9428
|
exports.WorkflowGraph = WorkflowGraph;
|