@mastra/playground-ui 5.0.5-alpha.0 → 5.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +475 -343
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +475 -343
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/assistant-ui/image-with-fallback.d.ts +3 -0
- package/dist/src/components/assistant-ui/thread.d.ts +2 -1
- package/dist/src/components/ui/data-table.d.ts +2 -1
- package/dist/src/domains/workflows/context/legacy-workflow-nested-graph-context.d.ts +13 -0
- package/dist/src/domains/workflows/context/workflow-nested-graph-context.d.ts +4 -3
- package/dist/src/domains/workflows/context/workflow-run-context.d.ts +4 -4
- package/dist/src/domains/workflows/index.d.ts +3 -3
- package/dist/src/domains/workflows/workflow/legacy-workflow-graph-inner.d.ts +5 -0
- package/dist/src/domains/workflows/workflow/{v-next-workflow-graph.d.ts → legacy-workflow-graph.d.ts} +1 -1
- package/dist/src/domains/workflows/workflow/legacy-workflow-nested-graph.d.ts +6 -0
- package/dist/src/domains/workflows/workflow/legacy-workflow-nested-node.d.ts +12 -0
- package/dist/src/domains/workflows/workflow/legacy-workflow-status.d.ts +6 -0
- package/dist/src/domains/workflows/workflow/{v-next-workflow-trigger.d.ts → legacy-workflow-trigger.d.ts} +1 -1
- package/dist/src/domains/workflows/workflow/utils.d.ts +5 -5
- package/dist/src/domains/workflows/workflow/workflow-card.d.ts +6 -0
- package/dist/src/domains/workflows/workflow/workflow-graph-inner.d.ts +2 -2
- package/dist/src/domains/workflows/workflow/workflow-nested-graph.d.ts +3 -3
- package/dist/src/domains/workflows/workflow/workflow-nested-node.d.ts +2 -2
- package/dist/src/domains/workflows/workflow/workflow-result.d.ts +5 -0
- package/dist/src/domains/workflows/workflow/workflow-status.d.ts +5 -0
- package/dist/src/ds/tokens/sizes.d.ts +1 -0
- package/dist/src/hooks/use-workflows.d.ts +24 -24
- package/dist/tokens.cjs.js +1 -0
- package/dist/tokens.cjs.js.map +1 -1
- package/dist/tokens.es.js +1 -0
- package/dist/tokens.es.js.map +1 -1
- package/package.json +6 -5
- package/dist/src/domains/workflows/context/v-next-workflow-nested-graph-context.d.ts +0 -14
- package/dist/src/domains/workflows/workflow/v-next-workflow-graph-inner.d.ts +0 -5
- package/dist/src/domains/workflows/workflow/v-next-workflow-nested-graph.d.ts +0 -6
- package/dist/src/domains/workflows/workflow/v-next-workflow-nested-node.d.ts +0 -11
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useMessage, MessagePrimitive, ActionBarPrimitive, ThreadPrimitive, ComposerPrimitive, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
|
|
3
|
-
import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, X, Check, ChevronUp, ChevronDown, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, PlusIcon, TrashIcon, Plus, Loader2 } from 'lucide-react';
|
|
3
|
+
import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, X, Check, ChevronUp, ChevronDown, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, Braces, Brackets, PlusIcon, TrashIcon, Plus, Loader2, CirclePause } from 'lucide-react';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import React__default, { forwardRef,
|
|
5
|
+
import React__default, { forwardRef, useState, useEffect, memo, useMemo, useRef, createContext, useContext, useCallback, Suspense, Fragment as Fragment$1 } from 'react';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
8
8
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
@@ -38,13 +38,13 @@ import jsonSchemaToZod from 'json-schema-to-zod';
|
|
|
38
38
|
import { parse } from 'superjson';
|
|
39
39
|
import z$1, { z, ZodObject } from 'zod';
|
|
40
40
|
import { AutoForm as AutoForm$1, buildZodFieldConfig } from '@autoform/react';
|
|
41
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
42
41
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
43
42
|
import { DayPicker } from 'react-day-picker';
|
|
44
43
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
45
44
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
46
45
|
import { v4 } from '@lukeed/uuid';
|
|
47
46
|
import { ZodProvider, getFieldConfigInZodStack, getDefaultValueInZodStack } from '@autoform/zod';
|
|
47
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
48
48
|
import { CodeBlock as CodeBlock$1 } from 'react-code-block';
|
|
49
49
|
import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
50
50
|
|
|
@@ -2890,6 +2890,46 @@ const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
2890
2890
|
));
|
|
2891
2891
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
2892
2892
|
|
|
2893
|
+
const ImageWithFallback = ({ alt, src, ...rest }) => {
|
|
2894
|
+
const [error, setError] = useState(false);
|
|
2895
|
+
useEffect(() => {
|
|
2896
|
+
setError(false);
|
|
2897
|
+
}, [src]);
|
|
2898
|
+
return error || !src ? /* @__PURE__ */ jsxs("div", { children: [
|
|
2899
|
+
/* @__PURE__ */ jsx(
|
|
2900
|
+
"svg",
|
|
2901
|
+
{
|
|
2902
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2903
|
+
fill: "none",
|
|
2904
|
+
viewBox: "0 0 24 24",
|
|
2905
|
+
strokeWidth: "1.5",
|
|
2906
|
+
stroke: "currentColor",
|
|
2907
|
+
width: "150",
|
|
2908
|
+
height: "150",
|
|
2909
|
+
children: /* @__PURE__ */ jsx(
|
|
2910
|
+
"path",
|
|
2911
|
+
{
|
|
2912
|
+
strokeLinecap: "round",
|
|
2913
|
+
strokeLinejoin: "round",
|
|
2914
|
+
d: "m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"
|
|
2915
|
+
}
|
|
2916
|
+
)
|
|
2917
|
+
}
|
|
2918
|
+
),
|
|
2919
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs italic text-muted-foreground -mt-[0.625rem] mb-[0.625rem]", children: "Image link is broken" })
|
|
2920
|
+
] }) : /* @__PURE__ */ jsx(
|
|
2921
|
+
"img",
|
|
2922
|
+
{
|
|
2923
|
+
src,
|
|
2924
|
+
alt,
|
|
2925
|
+
...rest,
|
|
2926
|
+
onError: () => {
|
|
2927
|
+
setError(true);
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
);
|
|
2931
|
+
};
|
|
2932
|
+
|
|
2893
2933
|
const SyntaxHighlighter$2 = makePrismAsyncSyntaxHighlighter({
|
|
2894
2934
|
style: coldarkDark,
|
|
2895
2935
|
customStyle: {
|
|
@@ -3109,7 +3149,8 @@ const defaultComponents = unstable_memoizeMarkdownComponents({
|
|
|
3109
3149
|
);
|
|
3110
3150
|
},
|
|
3111
3151
|
CodeHeader,
|
|
3112
|
-
SyntaxHighlighter: SyntaxHighlighter$2
|
|
3152
|
+
SyntaxHighlighter: SyntaxHighlighter$2,
|
|
3153
|
+
img: ImageWithFallback
|
|
3113
3154
|
});
|
|
3114
3155
|
|
|
3115
3156
|
const sizes = {
|
|
@@ -3492,10 +3533,10 @@ const GithubIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "15", height:
|
|
|
3492
3533
|
"path",
|
|
3493
3534
|
{
|
|
3494
3535
|
d: "M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",
|
|
3495
|
-
fill: "
|
|
3536
|
+
fill: "currentColor"
|
|
3496
3537
|
}
|
|
3497
3538
|
) }),
|
|
3498
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsx("rect", { width: "14", height: "14", fill: "
|
|
3539
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_21999_22095", children: /* @__PURE__ */ jsx("rect", { width: "14", height: "14", fill: "currentColor", transform: "translate(0.5 0.75)" }) }) })
|
|
3499
3540
|
] });
|
|
3500
3541
|
|
|
3501
3542
|
const GoogleIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
@@ -3724,7 +3765,7 @@ const WorkflowIcon = (props) => /* @__PURE__ */ jsx("svg", { width: "17", height
|
|
|
3724
3765
|
fillRule: "evenodd",
|
|
3725
3766
|
clipRule: "evenodd",
|
|
3726
3767
|
d: "M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",
|
|
3727
|
-
fill: "
|
|
3768
|
+
fill: "currentColor"
|
|
3728
3769
|
}
|
|
3729
3770
|
) });
|
|
3730
3771
|
|
|
@@ -3857,7 +3898,10 @@ const AssistantMessage = ({
|
|
|
3857
3898
|
/* @__PURE__ */ jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsx(
|
|
3858
3899
|
MessagePrimitive.Content,
|
|
3859
3900
|
{
|
|
3860
|
-
components: {
|
|
3901
|
+
components: {
|
|
3902
|
+
Text: MarkdownText,
|
|
3903
|
+
tools: { Fallback: ToolFallbackCustom || ToolFallback$1 }
|
|
3904
|
+
}
|
|
3861
3905
|
}
|
|
3862
3906
|
) }),
|
|
3863
3907
|
/* @__PURE__ */ jsx("div", { className: "h-6 pt-1", children: !isSolelyToolCall && /* @__PURE__ */ jsx(AssistantActionBar, {}) })
|
|
@@ -3921,13 +3965,27 @@ const useAutoscroll = (ref, { enabled = true }) => {
|
|
|
3921
3965
|
}, [enabled, ref]);
|
|
3922
3966
|
};
|
|
3923
3967
|
|
|
3924
|
-
const
|
|
3968
|
+
const variants = {
|
|
3969
|
+
"header-md": "text-header-md leading-header-md",
|
|
3970
|
+
"ui-lg": "text-ui-lg leading-ui-lg",
|
|
3971
|
+
"ui-md": "text-ui-md leading-ui-md",
|
|
3972
|
+
"ui-sm": "text-ui-sm leading-ui-sm",
|
|
3973
|
+
"ui-xs": "text-ui-xs leading-ui-xs"
|
|
3974
|
+
};
|
|
3975
|
+
const fonts = {
|
|
3976
|
+
mono: "font-mono"
|
|
3977
|
+
};
|
|
3978
|
+
const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
|
|
3979
|
+
return /* @__PURE__ */ jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
|
|
3980
|
+
};
|
|
3981
|
+
|
|
3982
|
+
const Thread = ({ ToolFallback, agentName, hasMemory }) => {
|
|
3925
3983
|
const areaRef = useRef(null);
|
|
3926
3984
|
useAutoscroll(areaRef, { enabled: true });
|
|
3927
3985
|
const WrappedAssistantMessage = (props) => {
|
|
3928
3986
|
return /* @__PURE__ */ jsx(AssistantMessage, { ...props, ToolFallback });
|
|
3929
3987
|
};
|
|
3930
|
-
return /* @__PURE__ */ jsxs(ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-
|
|
3988
|
+
return /* @__PURE__ */ jsxs(ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-110px)] px-4", children: [
|
|
3931
3989
|
/* @__PURE__ */ jsxs(ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
3932
3990
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
3933
3991
|
/* @__PURE__ */ jsx(ThreadWelcome, { agentName }),
|
|
@@ -3944,7 +4002,7 @@ const Thread = ({ ToolFallback, agentName }) => {
|
|
|
3944
4002
|
] }),
|
|
3945
4003
|
/* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
|
|
3946
4004
|
] }),
|
|
3947
|
-
/* @__PURE__ */ jsx(Composer, {})
|
|
4005
|
+
/* @__PURE__ */ jsx(Composer, { hasMemory })
|
|
3948
4006
|
] });
|
|
3949
4007
|
};
|
|
3950
4008
|
const ThreadWelcome = ({ agentName }) => {
|
|
@@ -3963,19 +4021,25 @@ const ThreadWelcome = ({ agentName }) => {
|
|
|
3963
4021
|
/* @__PURE__ */ jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
3964
4022
|
] }) });
|
|
3965
4023
|
};
|
|
3966
|
-
const Composer = () => {
|
|
3967
|
-
return /* @__PURE__ */ jsxs(
|
|
3968
|
-
/* @__PURE__ */
|
|
3969
|
-
"
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
4024
|
+
const Composer = ({ hasMemory }) => {
|
|
4025
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4026
|
+
/* @__PURE__ */ jsxs(ComposerPrimitive.Root, { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
|
|
4027
|
+
/* @__PURE__ */ jsx(ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsx(
|
|
4028
|
+
"textarea",
|
|
4029
|
+
{
|
|
4030
|
+
className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
|
|
4031
|
+
autoFocus: true,
|
|
4032
|
+
placeholder: "Enter your message...",
|
|
4033
|
+
name: "",
|
|
4034
|
+
id: ""
|
|
4035
|
+
}
|
|
4036
|
+
) }),
|
|
4037
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(ComposerAction, {}) })
|
|
4038
|
+
] }),
|
|
4039
|
+
!hasMemory && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
|
|
4040
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(InfoIcon, {}) }),
|
|
4041
|
+
"Memory is not enabled. The conversation will not be persisted."
|
|
4042
|
+
] })
|
|
3979
4043
|
] });
|
|
3980
4044
|
};
|
|
3981
4045
|
const ComposerAction = () => {
|
|
@@ -4407,7 +4471,7 @@ const AgentChat = ({
|
|
|
4407
4471
|
modelSettings,
|
|
4408
4472
|
chatWithGenerate,
|
|
4409
4473
|
runtimeContext,
|
|
4410
|
-
children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "" }) })
|
|
4474
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "", hasMemory: memory }) })
|
|
4411
4475
|
}
|
|
4412
4476
|
);
|
|
4413
4477
|
};
|
|
@@ -4467,18 +4531,18 @@ function FormattedDate({ date }) {
|
|
|
4467
4531
|
}
|
|
4468
4532
|
|
|
4469
4533
|
const inputVariants = cva(
|
|
4470
|
-
"flex w-full text-
|
|
4534
|
+
"flex w-full text-icon6 rounded-lg border bg-transparent shadow-sm focus-visible:ring-ring transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
4471
4535
|
{
|
|
4472
4536
|
variants: {
|
|
4473
4537
|
variant: {
|
|
4474
|
-
default: "border-
|
|
4475
|
-
filled: "bg-inputFill border-
|
|
4476
|
-
unstyled: "border-0 bg-transparent placeholder:text-
|
|
4538
|
+
default: "border-sm border-border1 placeholder:text-icon3",
|
|
4539
|
+
filled: "border-sm bg-inputFill border-border1 placeholder:text-icon3",
|
|
4540
|
+
unstyled: "border-0 bg-transparent placeholder:text-icon3 focus-visible:ring-transparent focus-visible:outline-none"
|
|
4477
4541
|
},
|
|
4478
4542
|
customSize: {
|
|
4479
|
-
default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-
|
|
4543
|
+
default: "px-[13px] text-[calc(13_/_16_*_1rem)] h-8",
|
|
4480
4544
|
sm: "h-[30px] px-[13px] text-xs",
|
|
4481
|
-
lg: "h-10 px-[17px]
|
|
4545
|
+
lg: "h-10 px-[17px] text-[calc(13_/_16_*_1rem)]"
|
|
4482
4546
|
}
|
|
4483
4547
|
},
|
|
4484
4548
|
defaultVariants: {
|
|
@@ -4957,20 +5021,6 @@ const Row = ({ className, children, selected = false, onClick }) => {
|
|
|
4957
5021
|
);
|
|
4958
5022
|
};
|
|
4959
5023
|
|
|
4960
|
-
const variants = {
|
|
4961
|
-
"header-md": "text-header-md leading-header-md",
|
|
4962
|
-
"ui-lg": "text-ui-lg leading-ui-lg",
|
|
4963
|
-
"ui-md": "text-ui-md leading-ui-md",
|
|
4964
|
-
"ui-sm": "text-ui-sm leading-ui-sm",
|
|
4965
|
-
"ui-xs": "text-ui-xs leading-ui-xs"
|
|
4966
|
-
};
|
|
4967
|
-
const fonts = {
|
|
4968
|
-
mono: "font-mono"
|
|
4969
|
-
};
|
|
4970
|
-
const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
|
|
4971
|
-
return /* @__PURE__ */ jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
|
|
4972
|
-
};
|
|
4973
|
-
|
|
4974
5024
|
const formatDateCell = (date) => {
|
|
4975
5025
|
const month = new Intl.DateTimeFormat("en-US", { month: "short" }).format(date).toUpperCase();
|
|
4976
5026
|
const day = date.getDate();
|
|
@@ -6152,7 +6202,7 @@ function WorkflowTracesInner({ traces, isLoading, error }) {
|
|
|
6152
6202
|
] });
|
|
6153
6203
|
}
|
|
6154
6204
|
|
|
6155
|
-
const
|
|
6205
|
+
const sanitizeWorkflowWatchResult = (record) => {
|
|
6156
6206
|
const formattedResults = Object.entries(record.payload.workflowState.steps || {}).reduce(
|
|
6157
6207
|
(acc, [key, value]) => {
|
|
6158
6208
|
let output = value.status === "success" ? value.output : void 0;
|
|
@@ -6187,8 +6237,8 @@ const sanitizeVNexWorkflowWatchResult = (record) => {
|
|
|
6187
6237
|
};
|
|
6188
6238
|
return sanitizedRecord;
|
|
6189
6239
|
};
|
|
6190
|
-
const
|
|
6191
|
-
const [
|
|
6240
|
+
const useLegacyWorkflow = (workflowId, baseUrl) => {
|
|
6241
|
+
const [legacyWorkflow, setLegacyWorkflow] = useState(null);
|
|
6192
6242
|
const [isLoading, setIsLoading] = useState(true);
|
|
6193
6243
|
const client = createMastraClient(baseUrl);
|
|
6194
6244
|
useEffect(() => {
|
|
@@ -6196,22 +6246,22 @@ const useWorkflow = (workflowId, baseUrl) => {
|
|
|
6196
6246
|
setIsLoading(true);
|
|
6197
6247
|
try {
|
|
6198
6248
|
if (!workflowId) {
|
|
6199
|
-
|
|
6249
|
+
setLegacyWorkflow(null);
|
|
6200
6250
|
setIsLoading(false);
|
|
6201
6251
|
return;
|
|
6202
6252
|
}
|
|
6203
|
-
const res = await client.
|
|
6253
|
+
const res = await client.getLegacyWorkflow(workflowId).details();
|
|
6204
6254
|
if (!res) {
|
|
6205
|
-
|
|
6206
|
-
console.error("Error fetching workflow");
|
|
6207
|
-
toast.error("Error fetching workflow");
|
|
6255
|
+
setLegacyWorkflow(null);
|
|
6256
|
+
console.error("Error fetching legacy workflow");
|
|
6257
|
+
toast.error("Error fetching legacy workflow");
|
|
6208
6258
|
return;
|
|
6209
6259
|
}
|
|
6210
6260
|
const steps = res.steps;
|
|
6211
6261
|
const stepsWithWorkflow = await Promise.all(
|
|
6212
6262
|
Object.values(steps)?.map(async (step) => {
|
|
6213
6263
|
if (!step.workflowId) return step;
|
|
6214
|
-
const wFlow = await client.
|
|
6264
|
+
const wFlow = await client.getLegacyWorkflow(step.workflowId).details();
|
|
6215
6265
|
if (!wFlow) return step;
|
|
6216
6266
|
return { ...step, stepGraph: wFlow.stepGraph, stepSubscriberGraph: wFlow.stepSubscriberGraph };
|
|
6217
6267
|
})
|
|
@@ -6219,21 +6269,21 @@ const useWorkflow = (workflowId, baseUrl) => {
|
|
|
6219
6269
|
const _steps = stepsWithWorkflow.reduce((acc, b) => {
|
|
6220
6270
|
return { ...acc, [b.id]: b };
|
|
6221
6271
|
}, {});
|
|
6222
|
-
|
|
6272
|
+
setLegacyWorkflow({ ...res, steps: _steps });
|
|
6223
6273
|
} catch (error) {
|
|
6224
|
-
|
|
6225
|
-
console.error("Error fetching workflow", error);
|
|
6226
|
-
toast.error("Error fetching workflow");
|
|
6274
|
+
setLegacyWorkflow(null);
|
|
6275
|
+
console.error("Error fetching legacy workflow", error);
|
|
6276
|
+
toast.error("Error fetching legacy workflow");
|
|
6227
6277
|
} finally {
|
|
6228
6278
|
setIsLoading(false);
|
|
6229
6279
|
}
|
|
6230
6280
|
};
|
|
6231
6281
|
fetchWorkflow();
|
|
6232
6282
|
}, [workflowId]);
|
|
6233
|
-
return {
|
|
6283
|
+
return { legacyWorkflow, isLoading };
|
|
6234
6284
|
};
|
|
6235
|
-
const
|
|
6236
|
-
const [
|
|
6285
|
+
const useWorkflow = (workflowId, baseUrl) => {
|
|
6286
|
+
const [workflow, setWorkflow] = useState(null);
|
|
6237
6287
|
const [isLoading, setIsLoading] = useState(true);
|
|
6238
6288
|
const client = createMastraClient(baseUrl);
|
|
6239
6289
|
useEffect(() => {
|
|
@@ -6241,14 +6291,14 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
|
6241
6291
|
setIsLoading(true);
|
|
6242
6292
|
try {
|
|
6243
6293
|
if (!workflowId) {
|
|
6244
|
-
|
|
6294
|
+
setWorkflow(null);
|
|
6245
6295
|
setIsLoading(false);
|
|
6246
6296
|
return;
|
|
6247
6297
|
}
|
|
6248
|
-
const res = await client.
|
|
6249
|
-
|
|
6298
|
+
const res = await client.getWorkflow(workflowId).details();
|
|
6299
|
+
setWorkflow(res);
|
|
6250
6300
|
} catch (error) {
|
|
6251
|
-
|
|
6301
|
+
setWorkflow(null);
|
|
6252
6302
|
console.error("Error fetching workflow", error);
|
|
6253
6303
|
toast.error("Error fetching workflow");
|
|
6254
6304
|
} finally {
|
|
@@ -6257,13 +6307,13 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
|
6257
6307
|
};
|
|
6258
6308
|
fetchWorkflow();
|
|
6259
6309
|
}, [workflowId]);
|
|
6260
|
-
return {
|
|
6310
|
+
return { workflow, isLoading };
|
|
6261
6311
|
};
|
|
6262
6312
|
const useExecuteWorkflow = (baseUrl) => {
|
|
6263
6313
|
const client = createMastraClient(baseUrl);
|
|
6264
|
-
const
|
|
6314
|
+
const createLegacyWorkflowRun = async ({ workflowId, prevRunId }) => {
|
|
6265
6315
|
try {
|
|
6266
|
-
const workflow = client.
|
|
6316
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6267
6317
|
const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
|
|
6268
6318
|
return { runId: newRunId };
|
|
6269
6319
|
} catch (error) {
|
|
@@ -6271,9 +6321,9 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6271
6321
|
throw error;
|
|
6272
6322
|
}
|
|
6273
6323
|
};
|
|
6274
|
-
const
|
|
6324
|
+
const createWorkflowRun = async ({ workflowId, prevRunId }) => {
|
|
6275
6325
|
try {
|
|
6276
|
-
const workflow = client.
|
|
6326
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6277
6327
|
const { runId: newRunId } = await workflow.createRun({ runId: prevRunId });
|
|
6278
6328
|
return { runId: newRunId };
|
|
6279
6329
|
} catch (error) {
|
|
@@ -6281,16 +6331,20 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6281
6331
|
throw error;
|
|
6282
6332
|
}
|
|
6283
6333
|
};
|
|
6284
|
-
const
|
|
6334
|
+
const startLegacyWorkflowRun = async ({
|
|
6335
|
+
workflowId,
|
|
6336
|
+
runId,
|
|
6337
|
+
input
|
|
6338
|
+
}) => {
|
|
6285
6339
|
try {
|
|
6286
|
-
const workflow = client.
|
|
6340
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6287
6341
|
await workflow.start({ runId, triggerData: input || {} });
|
|
6288
6342
|
} catch (error) {
|
|
6289
6343
|
console.error("Error starting workflow run:", error);
|
|
6290
6344
|
throw error;
|
|
6291
6345
|
}
|
|
6292
6346
|
};
|
|
6293
|
-
const
|
|
6347
|
+
const startWorkflowRun = async ({
|
|
6294
6348
|
workflowId,
|
|
6295
6349
|
runId,
|
|
6296
6350
|
input,
|
|
@@ -6301,14 +6355,14 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6301
6355
|
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6302
6356
|
runtimeContext.set(key, value);
|
|
6303
6357
|
});
|
|
6304
|
-
const workflow = client.
|
|
6358
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6305
6359
|
await workflow.start({ runId, inputData: input || {}, runtimeContext });
|
|
6306
6360
|
} catch (error) {
|
|
6307
6361
|
console.error("Error starting workflow run:", error);
|
|
6308
6362
|
throw error;
|
|
6309
6363
|
}
|
|
6310
6364
|
};
|
|
6311
|
-
const
|
|
6365
|
+
const startAsyncWorkflowRun = async ({
|
|
6312
6366
|
workflowId,
|
|
6313
6367
|
runId,
|
|
6314
6368
|
input,
|
|
@@ -6319,7 +6373,7 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6319
6373
|
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6320
6374
|
runtimeContext.set(key, value);
|
|
6321
6375
|
});
|
|
6322
|
-
const workflow = client.
|
|
6376
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6323
6377
|
const result = await workflow.startAsync({ runId, inputData: input || {}, runtimeContext });
|
|
6324
6378
|
return result;
|
|
6325
6379
|
} catch (error) {
|
|
@@ -6330,17 +6384,17 @@ const useExecuteWorkflow = (baseUrl) => {
|
|
|
6330
6384
|
return {
|
|
6331
6385
|
startWorkflowRun,
|
|
6332
6386
|
createWorkflowRun,
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6387
|
+
startLegacyWorkflowRun,
|
|
6388
|
+
createLegacyWorkflowRun,
|
|
6389
|
+
startAsyncWorkflowRun
|
|
6336
6390
|
};
|
|
6337
6391
|
};
|
|
6338
6392
|
const useWatchWorkflow = (baseUrl) => {
|
|
6393
|
+
const [isWatchingLegacyWorkflow, setIsWatchingLegacyWorkflow] = useState(false);
|
|
6339
6394
|
const [isWatchingWorkflow, setIsWatchingWorkflow] = useState(false);
|
|
6340
|
-
const [
|
|
6395
|
+
const [legacyWatchResult, setLegacyWatchResult] = useState(null);
|
|
6341
6396
|
const [watchResult, setWatchResult] = useState(null);
|
|
6342
|
-
const
|
|
6343
|
-
const debouncedSetWatchResult = useDebouncedCallback((record) => {
|
|
6397
|
+
const debouncedSetLegacyWorkflowWatchResult = useDebouncedCallback((record) => {
|
|
6344
6398
|
const formattedResults = Object.entries(record.results || {}).reduce(
|
|
6345
6399
|
(acc, [key, value]) => {
|
|
6346
6400
|
let output = value.status === "success" ? value.output : void 0;
|
|
@@ -6363,19 +6417,19 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6363
6417
|
...record,
|
|
6364
6418
|
sanitizedOutput: record ? JSON.stringify({ ...record, results: formattedResults }, null, 2).slice(0, 5e4) : null
|
|
6365
6419
|
};
|
|
6366
|
-
|
|
6420
|
+
setLegacyWatchResult(sanitizedRecord);
|
|
6367
6421
|
}, 100);
|
|
6368
|
-
const
|
|
6422
|
+
const watchLegacyWorkflow = async ({ workflowId, runId }) => {
|
|
6369
6423
|
try {
|
|
6370
|
-
|
|
6424
|
+
setIsWatchingLegacyWorkflow(true);
|
|
6371
6425
|
const client = createMastraClient(baseUrl);
|
|
6372
|
-
const workflow = client.
|
|
6426
|
+
const workflow = client.getLegacyWorkflow(workflowId);
|
|
6373
6427
|
await workflow.watch({ runId }, (record) => {
|
|
6374
6428
|
try {
|
|
6375
|
-
|
|
6429
|
+
debouncedSetLegacyWorkflowWatchResult(record);
|
|
6376
6430
|
} catch (err) {
|
|
6377
6431
|
console.error("Error processing workflow record:", err);
|
|
6378
|
-
|
|
6432
|
+
setLegacyWatchResult({
|
|
6379
6433
|
...record
|
|
6380
6434
|
});
|
|
6381
6435
|
}
|
|
@@ -6384,24 +6438,24 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6384
6438
|
console.error("Error watching workflow:", error);
|
|
6385
6439
|
throw error;
|
|
6386
6440
|
} finally {
|
|
6387
|
-
|
|
6441
|
+
setIsWatchingLegacyWorkflow(false);
|
|
6388
6442
|
}
|
|
6389
6443
|
};
|
|
6390
|
-
const
|
|
6391
|
-
const sanitizedRecord =
|
|
6392
|
-
|
|
6444
|
+
const debouncedSetWorkflowWatchResult = useDebouncedCallback((record) => {
|
|
6445
|
+
const sanitizedRecord = sanitizeWorkflowWatchResult(record);
|
|
6446
|
+
setWatchResult(sanitizedRecord);
|
|
6393
6447
|
}, 100);
|
|
6394
|
-
const
|
|
6448
|
+
const watchWorkflow = async ({ workflowId, runId }) => {
|
|
6395
6449
|
try {
|
|
6396
|
-
|
|
6450
|
+
setIsWatchingWorkflow(true);
|
|
6397
6451
|
const client = createMastraClient(baseUrl);
|
|
6398
|
-
const workflow = client.
|
|
6452
|
+
const workflow = client.getWorkflow(workflowId);
|
|
6399
6453
|
await workflow.watch({ runId }, (record) => {
|
|
6400
6454
|
try {
|
|
6401
|
-
|
|
6455
|
+
debouncedSetWorkflowWatchResult(record);
|
|
6402
6456
|
} catch (err) {
|
|
6403
6457
|
console.error("Error processing workflow record:", err);
|
|
6404
|
-
|
|
6458
|
+
setWatchResult({
|
|
6405
6459
|
...record
|
|
6406
6460
|
});
|
|
6407
6461
|
}
|
|
@@ -6410,40 +6464,40 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6410
6464
|
console.error("Error watching workflow:", error);
|
|
6411
6465
|
throw error;
|
|
6412
6466
|
} finally {
|
|
6413
|
-
|
|
6467
|
+
setIsWatchingWorkflow(false);
|
|
6414
6468
|
}
|
|
6415
6469
|
};
|
|
6416
6470
|
return {
|
|
6471
|
+
watchLegacyWorkflow,
|
|
6472
|
+
isWatchingLegacyWorkflow,
|
|
6473
|
+
legacyWatchResult,
|
|
6417
6474
|
watchWorkflow,
|
|
6418
6475
|
isWatchingWorkflow,
|
|
6419
|
-
watchResult
|
|
6420
|
-
watchVNextWorkflow,
|
|
6421
|
-
isWatchingVNextWorkflow,
|
|
6422
|
-
watchVNextResult
|
|
6476
|
+
watchResult
|
|
6423
6477
|
};
|
|
6424
6478
|
};
|
|
6425
6479
|
const useResumeWorkflow = (baseUrl) => {
|
|
6480
|
+
const [isResumingLegacyWorkflow, setIsResumingLegacyWorkflow] = useState(false);
|
|
6426
6481
|
const [isResumingWorkflow, setIsResumingWorkflow] = useState(false);
|
|
6427
|
-
const
|
|
6428
|
-
const resumeWorkflow = async ({
|
|
6482
|
+
const resumeLegacyWorkflow = async ({
|
|
6429
6483
|
workflowId,
|
|
6430
6484
|
stepId,
|
|
6431
6485
|
runId,
|
|
6432
6486
|
context
|
|
6433
6487
|
}) => {
|
|
6434
6488
|
try {
|
|
6435
|
-
|
|
6489
|
+
setIsResumingLegacyWorkflow(true);
|
|
6436
6490
|
const client = createMastraClient(baseUrl);
|
|
6437
|
-
const response = await client.
|
|
6491
|
+
const response = await client.getLegacyWorkflow(workflowId).resume({ stepId, runId, context });
|
|
6438
6492
|
return response;
|
|
6439
6493
|
} catch (error) {
|
|
6440
6494
|
console.error("Error resuming workflow:", error);
|
|
6441
6495
|
throw error;
|
|
6442
6496
|
} finally {
|
|
6443
|
-
|
|
6497
|
+
setIsResumingLegacyWorkflow(false);
|
|
6444
6498
|
}
|
|
6445
6499
|
};
|
|
6446
|
-
const
|
|
6500
|
+
const resumeWorkflow = async ({
|
|
6447
6501
|
workflowId,
|
|
6448
6502
|
step,
|
|
6449
6503
|
runId,
|
|
@@ -6451,26 +6505,26 @@ const useResumeWorkflow = (baseUrl) => {
|
|
|
6451
6505
|
runtimeContext: playgroundRuntimeContext
|
|
6452
6506
|
}) => {
|
|
6453
6507
|
try {
|
|
6454
|
-
|
|
6508
|
+
setIsResumingWorkflow(true);
|
|
6455
6509
|
const client = createMastraClient(baseUrl);
|
|
6456
6510
|
const runtimeContext = new RuntimeContext$1();
|
|
6457
6511
|
Object.entries(playgroundRuntimeContext).forEach(([key, value]) => {
|
|
6458
6512
|
runtimeContext.set(key, value);
|
|
6459
6513
|
});
|
|
6460
|
-
const response = await client.
|
|
6514
|
+
const response = await client.getWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext });
|
|
6461
6515
|
return response;
|
|
6462
6516
|
} catch (error) {
|
|
6463
6517
|
console.error("Error resuming workflow:", error);
|
|
6464
6518
|
throw error;
|
|
6465
6519
|
} finally {
|
|
6466
|
-
|
|
6520
|
+
setIsResumingWorkflow(false);
|
|
6467
6521
|
}
|
|
6468
6522
|
};
|
|
6469
6523
|
return {
|
|
6524
|
+
resumeLegacyWorkflow,
|
|
6525
|
+
isResumingLegacyWorkflow,
|
|
6470
6526
|
resumeWorkflow,
|
|
6471
|
-
isResumingWorkflow
|
|
6472
|
-
resumeVNextWorkflow,
|
|
6473
|
-
isResumingVNextWorkflow
|
|
6527
|
+
isResumingWorkflow
|
|
6474
6528
|
};
|
|
6475
6529
|
};
|
|
6476
6530
|
|
|
@@ -6557,7 +6611,7 @@ const defaultEdgeOptions = {
|
|
|
6557
6611
|
color: "#8e8e8e"
|
|
6558
6612
|
}
|
|
6559
6613
|
};
|
|
6560
|
-
const
|
|
6614
|
+
const contructLegacyNodesAndEdges = ({
|
|
6561
6615
|
stepGraph,
|
|
6562
6616
|
stepSubscriberGraph,
|
|
6563
6617
|
steps: mainSteps = {}
|
|
@@ -7008,7 +7062,7 @@ const getStepNodeAndEdge = ({
|
|
|
7008
7062
|
}
|
|
7009
7063
|
return { nodes: [], edges: [], nextPrevNodeIds: [] };
|
|
7010
7064
|
};
|
|
7011
|
-
const
|
|
7065
|
+
const constructNodesAndEdges = ({
|
|
7012
7066
|
stepGraph
|
|
7013
7067
|
}) => {
|
|
7014
7068
|
if (!stepGraph) {
|
|
@@ -7347,12 +7401,12 @@ function Spinner({ color = "#fff", className }) {
|
|
|
7347
7401
|
);
|
|
7348
7402
|
}
|
|
7349
7403
|
|
|
7350
|
-
function
|
|
7404
|
+
function LegacyWorkflowNestedGraph({
|
|
7351
7405
|
stepGraph,
|
|
7352
7406
|
stepSubscriberGraph,
|
|
7353
7407
|
open
|
|
7354
7408
|
}) {
|
|
7355
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
7409
|
+
const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
|
|
7356
7410
|
stepGraph,
|
|
7357
7411
|
stepSubscriberGraph
|
|
7358
7412
|
});
|
|
@@ -7390,10 +7444,10 @@ function WorkflowNestedGraph({
|
|
|
7390
7444
|
) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) });
|
|
7391
7445
|
}
|
|
7392
7446
|
|
|
7393
|
-
const
|
|
7447
|
+
const LegacyWorkflowNestedGraphContext = createContext(
|
|
7394
7448
|
{}
|
|
7395
7449
|
);
|
|
7396
|
-
function
|
|
7450
|
+
function LegacyWorkflowNestedGraphProvider({ children }) {
|
|
7397
7451
|
const [stepGraph, setStepGraph] = useState(null);
|
|
7398
7452
|
const [stepSubscriberGraph, setStepSubscriberGraph] = useState(null);
|
|
7399
7453
|
const [openDialog, setOpenDialog] = useState(false);
|
|
@@ -7415,7 +7469,7 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
7415
7469
|
setOpenDialog(true);
|
|
7416
7470
|
};
|
|
7417
7471
|
return /* @__PURE__ */ jsxs(
|
|
7418
|
-
|
|
7472
|
+
LegacyWorkflowNestedGraphContext.Provider,
|
|
7419
7473
|
{
|
|
7420
7474
|
value: {
|
|
7421
7475
|
showNestedGraph,
|
|
@@ -7431,16 +7485,23 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
7431
7485
|
" workflow"
|
|
7432
7486
|
] })
|
|
7433
7487
|
] }),
|
|
7434
|
-
/* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
7488
|
+
/* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
7489
|
+
LegacyWorkflowNestedGraph,
|
|
7490
|
+
{
|
|
7491
|
+
stepGraph,
|
|
7492
|
+
open: openDialog,
|
|
7493
|
+
stepSubscriberGraph
|
|
7494
|
+
}
|
|
7495
|
+
) })
|
|
7435
7496
|
] }) }) })
|
|
7436
7497
|
]
|
|
7437
7498
|
}
|
|
7438
7499
|
);
|
|
7439
7500
|
}
|
|
7440
7501
|
|
|
7441
|
-
function
|
|
7502
|
+
function LegacyWorkflowNestedNode({ data }) {
|
|
7442
7503
|
const { label, withoutTopHandle, withoutBottomHandle, stepGraph, stepSubscriberGraph } = data;
|
|
7443
|
-
const { showNestedGraph } = useContext(
|
|
7504
|
+
const { showNestedGraph } = useContext(LegacyWorkflowNestedGraphContext);
|
|
7444
7505
|
return /* @__PURE__ */ jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
|
|
7445
7506
|
!withoutTopHandle && /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style: { visibility: "hidden" } }),
|
|
7446
7507
|
/* @__PURE__ */ jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph, stepSubscriberGraph }), children: /* @__PURE__ */ jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
|
|
@@ -7451,8 +7512,8 @@ function WorkflowNestedNode({ data }) {
|
|
|
7451
7512
|
] });
|
|
7452
7513
|
}
|
|
7453
7514
|
|
|
7454
|
-
function
|
|
7455
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
7515
|
+
function LegacyWorkflowGraphInner({ workflow }) {
|
|
7516
|
+
const { nodes: initialNodes, edges: initialEdges } = contructLegacyNodesAndEdges({
|
|
7456
7517
|
stepGraph: workflow.serializedStepGraph || workflow.stepGraph,
|
|
7457
7518
|
stepSubscriberGraph: workflow.serializedStepSubscriberGraph || workflow.stepSubscriberGraph,
|
|
7458
7519
|
steps: workflow.steps
|
|
@@ -7464,7 +7525,7 @@ function WorkflowGraphInner({ workflow }) {
|
|
|
7464
7525
|
"condition-node": WorkflowConditionNode,
|
|
7465
7526
|
"after-node": WorkflowAfterNode,
|
|
7466
7527
|
"loop-result-node": WorkflowLoopResultNode,
|
|
7467
|
-
"nested-node":
|
|
7528
|
+
"nested-node": LegacyWorkflowNestedNode
|
|
7468
7529
|
};
|
|
7469
7530
|
return /* @__PURE__ */ jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxs(
|
|
7470
7531
|
ReactFlow,
|
|
@@ -7491,12 +7552,12 @@ const lodashTitleCase = (str) => {
|
|
|
7491
7552
|
return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
|
|
7492
7553
|
};
|
|
7493
7554
|
|
|
7494
|
-
function
|
|
7495
|
-
const {
|
|
7555
|
+
function LegacyWorkflowGraph({ workflowId, baseUrl }) {
|
|
7556
|
+
const { legacyWorkflow, isLoading } = useLegacyWorkflow(workflowId, baseUrl);
|
|
7496
7557
|
if (isLoading) {
|
|
7497
7558
|
return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[600px]" }) });
|
|
7498
7559
|
}
|
|
7499
|
-
if (!
|
|
7560
|
+
if (!legacyWorkflow) {
|
|
7500
7561
|
return /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
7501
7562
|
/* @__PURE__ */ jsx(AlertCircleIcon, {}),
|
|
7502
7563
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -7506,28 +7567,24 @@ function WorkflowGraph({ workflowId, baseUrl }) {
|
|
|
7506
7567
|
] })
|
|
7507
7568
|
] }) });
|
|
7508
7569
|
}
|
|
7509
|
-
return /* @__PURE__ */ jsx(
|
|
7570
|
+
return /* @__PURE__ */ jsx(LegacyWorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(LegacyWorkflowGraphInner, { workflow: legacyWorkflow }) }) });
|
|
7510
7571
|
}
|
|
7511
7572
|
|
|
7512
7573
|
const Form = React__default.forwardRef(({ children, ...props }, ref) => {
|
|
7513
7574
|
return /* @__PURE__ */ jsx("form", { ref, className: "space-y-4", ...props, children });
|
|
7514
7575
|
});
|
|
7515
7576
|
|
|
7516
|
-
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
7517
|
-
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
7518
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
7519
|
-
|
|
7520
7577
|
const DISABLED_LABELS = ["boolean", "object", "array"];
|
|
7521
7578
|
const FieldWrapper = ({ label, children, id, field, error }) => {
|
|
7522
7579
|
const isDisabled = DISABLED_LABELS.includes(field.type);
|
|
7523
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
7524
|
-
!isDisabled && /* @__PURE__ */ jsxs(
|
|
7580
|
+
return /* @__PURE__ */ jsxs("div", { className: "pb-4 last:pb-0", children: [
|
|
7581
|
+
!isDisabled && /* @__PURE__ */ jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3 pb-1 block", htmlFor: id, children: [
|
|
7525
7582
|
label,
|
|
7526
|
-
field.required && /* @__PURE__ */ jsx("span", { className: "text-
|
|
7583
|
+
field.required && /* @__PURE__ */ jsx("span", { className: "text-accent2", children: " *" })
|
|
7527
7584
|
] }),
|
|
7528
7585
|
children,
|
|
7529
|
-
field.fieldConfig?.description && /* @__PURE__ */ jsx("p",
|
|
7530
|
-
error && /* @__PURE__ */ jsx("p",
|
|
7586
|
+
field.fieldConfig?.description && /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon6", children: field.fieldConfig.description }),
|
|
7587
|
+
error && /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-accent2", children: error })
|
|
7531
7588
|
] });
|
|
7532
7589
|
};
|
|
7533
7590
|
|
|
@@ -7636,9 +7693,9 @@ const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ *
|
|
|
7636
7693
|
defaultChecked: field.default
|
|
7637
7694
|
}
|
|
7638
7695
|
),
|
|
7639
|
-
/* @__PURE__ */ jsxs(
|
|
7696
|
+
/* @__PURE__ */ jsxs(Txt, { as: "label", variant: "ui-sm", className: "text-icon3", htmlFor: id, children: [
|
|
7640
7697
|
label,
|
|
7641
|
-
field.required && /* @__PURE__ */ jsx("span", { className: "text-
|
|
7698
|
+
field.required && /* @__PURE__ */ jsx("span", { className: "text-accent2", children: " *" })
|
|
7642
7699
|
] })
|
|
7643
7700
|
] });
|
|
7644
7701
|
|
|
@@ -7985,34 +8042,53 @@ const SelectField = ({ field, inputProps, error, id, value }) => {
|
|
|
7985
8042
|
};
|
|
7986
8043
|
|
|
7987
8044
|
const ObjectWrapper = ({ label, children }) => {
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
children
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
const ArrayWrapper = ({ label, children, onAddItem }) => {
|
|
7995
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
7996
|
-
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: label }),
|
|
7997
|
-
children,
|
|
8045
|
+
const hasLabel = label !== "" && label !== "";
|
|
8046
|
+
return /* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
8047
|
+
hasLabel && /* @__PURE__ */ jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 flex items-center gap-1 pb-2", children: [
|
|
8048
|
+
/* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(Braces, {}) }),
|
|
8049
|
+
label
|
|
8050
|
+
] }),
|
|
7998
8051
|
/* @__PURE__ */ jsx(
|
|
7999
|
-
|
|
8052
|
+
"div",
|
|
8000
8053
|
{
|
|
8001
|
-
className: "
|
|
8002
|
-
|
|
8003
|
-
variant: "outline",
|
|
8004
|
-
size: "sm",
|
|
8005
|
-
type: "button",
|
|
8006
|
-
children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-4 w-4" })
|
|
8054
|
+
className: hasLabel ? "flex flex-col gap-1 [&>*]:border-dashed [&>*]:border-l [&>*]:border-l-border1 [&>*]:pl-4" : "",
|
|
8055
|
+
children
|
|
8007
8056
|
}
|
|
8008
8057
|
)
|
|
8009
8058
|
] });
|
|
8010
8059
|
};
|
|
8011
8060
|
|
|
8061
|
+
const ArrayWrapper = ({ label, children, onAddItem }) => {
|
|
8062
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
8063
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 justify-between", children: [
|
|
8064
|
+
/* @__PURE__ */ jsxs(Txt, { as: "h3", variant: "ui-sm", className: "text-icon3 pb-2 flex items-center gap-1", children: [
|
|
8065
|
+
/* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(Brackets, {}) }),
|
|
8066
|
+
label
|
|
8067
|
+
] }),
|
|
8068
|
+
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 0, children: [
|
|
8069
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
8070
|
+
"button",
|
|
8071
|
+
{
|
|
8072
|
+
onClick: onAddItem,
|
|
8073
|
+
type: "button",
|
|
8074
|
+
className: "text-icon3 bg-surface3 rounded-md p-1 hover:bg-surface4 hover:text-icon6 h-icon-sm w-icon-sm",
|
|
8075
|
+
children: /* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(PlusIcon, {}) })
|
|
8076
|
+
}
|
|
8077
|
+
) }),
|
|
8078
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: "Add item" })
|
|
8079
|
+
] }) })
|
|
8080
|
+
] }),
|
|
8081
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children })
|
|
8082
|
+
] });
|
|
8083
|
+
};
|
|
8084
|
+
|
|
8012
8085
|
const ArrayElementWrapper = ({ children, onRemove }) => {
|
|
8013
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
8014
|
-
|
|
8015
|
-
children
|
|
8086
|
+
return /* @__PURE__ */ jsxs("div", { className: "pl-4 border-l border-border1", children: [
|
|
8087
|
+
children,
|
|
8088
|
+
/* @__PURE__ */ jsxs(Button, { onClick: onRemove, type: "button", children: [
|
|
8089
|
+
/* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(TrashIcon, {}) }),
|
|
8090
|
+
"Delete"
|
|
8091
|
+
] })
|
|
8016
8092
|
] });
|
|
8017
8093
|
};
|
|
8018
8094
|
|
|
@@ -8211,6 +8287,10 @@ class CustomZodProvider extends ZodProvider {
|
|
|
8211
8287
|
}
|
|
8212
8288
|
}
|
|
8213
8289
|
|
|
8290
|
+
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
8291
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
8292
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
8293
|
+
|
|
8214
8294
|
function isEmptyZodObject(schema) {
|
|
8215
8295
|
if (schema instanceof ZodObject) {
|
|
8216
8296
|
return Object.keys(schema.shape).length === 0;
|
|
@@ -8222,7 +8302,7 @@ function DynamicForm({
|
|
|
8222
8302
|
onSubmit,
|
|
8223
8303
|
defaultValues,
|
|
8224
8304
|
isSubmitLoading,
|
|
8225
|
-
submitButtonLabel
|
|
8305
|
+
submitButtonLabel
|
|
8226
8306
|
}) {
|
|
8227
8307
|
if (!schema) {
|
|
8228
8308
|
console.error("no form schema found");
|
|
@@ -8244,17 +8324,17 @@ function DynamicForm({
|
|
|
8244
8324
|
},
|
|
8245
8325
|
defaultValues: defaultValues ? { "": defaultValues } : void 0,
|
|
8246
8326
|
formProps: {
|
|
8247
|
-
className: "
|
|
8327
|
+
className: ""
|
|
8248
8328
|
},
|
|
8249
8329
|
uiComponents: {
|
|
8250
|
-
SubmitButton: ({ children }) => /* @__PURE__ */ jsx(Button
|
|
8330
|
+
SubmitButton: ({ children }) => /* @__PURE__ */ jsx(Button, { variant: "light", className: "w-full", size: "lg", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : submitButtonLabel || children })
|
|
8251
8331
|
},
|
|
8252
8332
|
formComponents: {
|
|
8253
8333
|
Label: ({ value }) => /* @__PURE__ */ jsx(Label, { className: "text-sm font-normal", children: value })
|
|
8254
8334
|
},
|
|
8255
8335
|
withSubmit: true
|
|
8256
8336
|
};
|
|
8257
|
-
return /* @__PURE__ */ jsx(
|
|
8337
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx(AutoForm, { ...formProps }) });
|
|
8258
8338
|
}
|
|
8259
8339
|
|
|
8260
8340
|
function resolveSerializedZodOutput(obj) {
|
|
@@ -8284,22 +8364,22 @@ function CodeBlockDemo({
|
|
|
8284
8364
|
|
|
8285
8365
|
const WorkflowRunContext = createContext({});
|
|
8286
8366
|
function WorkflowRunProvider({ children }) {
|
|
8367
|
+
const [legacyResult, setLegacyResult] = useState(null);
|
|
8287
8368
|
const [result, setResult] = useState(null);
|
|
8288
|
-
const [vNextResult, setVNextResult] = useState(null);
|
|
8289
8369
|
const [payload, setPayload] = useState(null);
|
|
8290
8370
|
const clearData = () => {
|
|
8371
|
+
setLegacyResult(null);
|
|
8291
8372
|
setResult(null);
|
|
8292
|
-
setVNextResult(null);
|
|
8293
8373
|
setPayload(null);
|
|
8294
8374
|
};
|
|
8295
8375
|
return /* @__PURE__ */ jsx(
|
|
8296
8376
|
WorkflowRunContext.Provider,
|
|
8297
8377
|
{
|
|
8298
8378
|
value: {
|
|
8379
|
+
legacyResult,
|
|
8380
|
+
setLegacyResult,
|
|
8299
8381
|
result,
|
|
8300
8382
|
setResult,
|
|
8301
|
-
vNextResult,
|
|
8302
|
-
setVNextResult,
|
|
8303
8383
|
payload,
|
|
8304
8384
|
setPayload,
|
|
8305
8385
|
clearData
|
|
@@ -8309,16 +8389,81 @@ function WorkflowRunProvider({ children }) {
|
|
|
8309
8389
|
);
|
|
8310
8390
|
}
|
|
8311
8391
|
|
|
8312
|
-
|
|
8392
|
+
const WorkflowCard = ({ header, children, footer }) => {
|
|
8393
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border-sm border-border1 bg-surface4", children: [
|
|
8394
|
+
/* @__PURE__ */ jsx("div", { className: "py-1 px-2 flex items-center gap-3", children: header }),
|
|
8395
|
+
children && /* @__PURE__ */ jsx("div", { className: "border-t-sm border-border1", children }),
|
|
8396
|
+
footer && /* @__PURE__ */ jsx("div", { className: "py-1 px-2 border-t-sm border-border1", children: footer })
|
|
8397
|
+
] });
|
|
8398
|
+
};
|
|
8399
|
+
|
|
8400
|
+
const LegacyWorkflowStatus = ({ stepId, pathStatus, path }) => {
|
|
8401
|
+
const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : pathStatus === "executing" ? "Executing" : "Completed";
|
|
8402
|
+
return /* @__PURE__ */ jsx(
|
|
8403
|
+
WorkflowCard,
|
|
8404
|
+
{
|
|
8405
|
+
header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
8406
|
+
/* @__PURE__ */ jsxs(Icon, { children: [
|
|
8407
|
+
status === "Completed" && /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }),
|
|
8408
|
+
status === "Failed" && /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }),
|
|
8409
|
+
status === "Executing" && /* @__PURE__ */ jsx(Loader2, { className: "text-icon3 animate-spin" })
|
|
8410
|
+
] }),
|
|
8411
|
+
/* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: path })
|
|
8412
|
+
] })
|
|
8413
|
+
}
|
|
8414
|
+
);
|
|
8415
|
+
};
|
|
8416
|
+
|
|
8417
|
+
const WorkflowResult = ({ jsonResult, sanitizedJsonResult }) => {
|
|
8418
|
+
const { handleCopy } = useCopyToClipboard({ text: jsonResult });
|
|
8419
|
+
const [expanded, setExpanded] = useState(false);
|
|
8420
|
+
return /* @__PURE__ */ jsx(
|
|
8421
|
+
WorkflowCard,
|
|
8422
|
+
{
|
|
8423
|
+
header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 justify-between w-full", children: [
|
|
8424
|
+
/* @__PURE__ */ jsxs(Txt, { variant: "ui-lg", className: "text-icon6 flex items-center gap-3 font-medium", children: [
|
|
8425
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(DeploymentIcon, {}) }),
|
|
8426
|
+
"Results"
|
|
8427
|
+
] }),
|
|
8428
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
8429
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
8430
|
+
"button",
|
|
8431
|
+
{
|
|
8432
|
+
className: "p-2 rounded-lg hover:bg-surface5 transition-colors duration-150 ease-in-out text-icon3 hover:text-icon6",
|
|
8433
|
+
onClick: () => handleCopy(),
|
|
8434
|
+
children: /* @__PURE__ */ jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsx(CopyIcon, {}) })
|
|
8435
|
+
}
|
|
8436
|
+
) }),
|
|
8437
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: "Copy result" })
|
|
8438
|
+
] })
|
|
8439
|
+
] }),
|
|
8440
|
+
footer: /* @__PURE__ */ jsx(
|
|
8441
|
+
"button",
|
|
8442
|
+
{
|
|
8443
|
+
className: "w-full h-full text-center text-icon2 hover:text-icon6 text-ui-md",
|
|
8444
|
+
onClick: () => setExpanded((s) => !s),
|
|
8445
|
+
children: expanded ? "collapse" : "expand"
|
|
8446
|
+
}
|
|
8447
|
+
),
|
|
8448
|
+
children: expanded ? /* @__PURE__ */ jsx(CodeBlockDemo, { className: "w-full overflow-x-auto", code: sanitizedJsonResult || jsonResult, language: "json" }) : null
|
|
8449
|
+
}
|
|
8450
|
+
);
|
|
8451
|
+
};
|
|
8452
|
+
|
|
8453
|
+
function LegacyWorkflowTrigger({
|
|
8313
8454
|
workflowId,
|
|
8314
8455
|
baseUrl,
|
|
8315
8456
|
setRunId
|
|
8316
8457
|
}) {
|
|
8317
|
-
const { result, setResult, payload, setPayload } = useContext(WorkflowRunContext);
|
|
8318
|
-
const { isLoading, workflow } =
|
|
8319
|
-
const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
8320
|
-
const {
|
|
8321
|
-
|
|
8458
|
+
const { legacyResult: result, setLegacyResult: setResult, payload, setPayload } = useContext(WorkflowRunContext);
|
|
8459
|
+
const { isLoading, legacyWorkflow: workflow } = useLegacyWorkflow(workflowId, baseUrl);
|
|
8460
|
+
const { createLegacyWorkflowRun: createWorkflowRun, startLegacyWorkflowRun: startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
8461
|
+
const {
|
|
8462
|
+
watchLegacyWorkflow: watchWorkflow,
|
|
8463
|
+
legacyWatchResult: watchResult,
|
|
8464
|
+
isWatchingLegacyWorkflow: isWatchingWorkflow
|
|
8465
|
+
} = useWatchWorkflow(baseUrl);
|
|
8466
|
+
const { resumeLegacyWorkflow: resumeWorkflow, isResumingLegacyWorkflow: isResumingWorkflow } = useResumeWorkflow(baseUrl);
|
|
8322
8467
|
const [suspendedSteps, setSuspendedSteps] = useState([]);
|
|
8323
8468
|
const [isRunning, setIsRunning] = useState(false);
|
|
8324
8469
|
const triggerSchema = workflow?.triggerSchema;
|
|
@@ -8349,7 +8494,7 @@ function WorkflowTrigger({
|
|
|
8349
8494
|
});
|
|
8350
8495
|
};
|
|
8351
8496
|
const watchResultToUse = result ?? watchResult;
|
|
8352
|
-
const workflowActivePaths = watchResultToUse?.activePaths ??
|
|
8497
|
+
const workflowActivePaths = watchResultToUse?.activePaths ?? {};
|
|
8353
8498
|
useEffect(() => {
|
|
8354
8499
|
setIsRunning(isWatchingWorkflow);
|
|
8355
8500
|
}, [isWatchingWorkflow]);
|
|
@@ -8377,50 +8522,34 @@ function WorkflowTrigger({
|
|
|
8377
8522
|
const isSuspendedSteps = suspendedSteps.length > 0;
|
|
8378
8523
|
const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(triggerSchema))) : null;
|
|
8379
8524
|
const { sanitizedOutput, ...restResult } = result ?? {};
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
/* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8386
|
-
" Resuming workflow"
|
|
8387
|
-
] }) : /* @__PURE__ */ jsx(Fragment, {})
|
|
8388
|
-
] }),
|
|
8389
|
-
/* @__PURE__ */ jsx(
|
|
8390
|
-
DynamicForm,
|
|
8391
|
-
{
|
|
8392
|
-
schema: zodInputSchema,
|
|
8393
|
-
defaultValues: payload,
|
|
8394
|
-
isSubmitLoading: isWatchingWorkflow,
|
|
8395
|
-
onSubmit: (data) => {
|
|
8396
|
-
setPayload(data);
|
|
8397
|
-
handleExecuteWorkflow(data);
|
|
8398
|
-
}
|
|
8399
|
-
}
|
|
8400
|
-
)
|
|
8401
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "px-4 space-y-4", children: [
|
|
8402
|
-
isResumingWorkflow ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
|
|
8403
|
-
/* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8404
|
-
" Resuming workflow"
|
|
8405
|
-
] }) : /* @__PURE__ */ jsx(Fragment, {}),
|
|
8406
|
-
/* @__PURE__ */ jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
|
|
8407
|
-
] }) }),
|
|
8408
|
-
Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8409
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
8410
|
-
/* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
|
|
8411
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
|
|
8412
|
-
const status = pathStatus === "completed" ? "Completed" : stepId === path ? pathStatus.charAt(0).toUpperCase() + pathStatus.slice(1) : "Completed";
|
|
8413
|
-
const statusIcon = status === "Completed" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "Failed" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
|
|
8414
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxs("div", { className: `flex items-center justify-between p-3`, children: [
|
|
8415
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: path.charAt(0).toUpperCase() + path.slice(1) }),
|
|
8416
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8417
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
|
|
8418
|
-
status
|
|
8419
|
-
] })
|
|
8420
|
-
] }) }, idx);
|
|
8421
|
-
}) });
|
|
8422
|
-
}) })
|
|
8525
|
+
const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
|
|
8526
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
8527
|
+
isResumingWorkflow && /* @__PURE__ */ jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
|
|
8528
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin text-icon6" }) }),
|
|
8529
|
+
/* @__PURE__ */ jsx(Txt, { children: "Resuming workflow" })
|
|
8423
8530
|
] }),
|
|
8531
|
+
!isSuspendedSteps && /* @__PURE__ */ jsx(Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsx(
|
|
8532
|
+
DynamicForm,
|
|
8533
|
+
{
|
|
8534
|
+
schema: zodInputSchema,
|
|
8535
|
+
defaultValues: payload,
|
|
8536
|
+
isSubmitLoading: isWatchingWorkflow,
|
|
8537
|
+
submitButtonLabel: "Run",
|
|
8538
|
+
onSubmit: (data) => {
|
|
8539
|
+
setPayload(data);
|
|
8540
|
+
handleExecuteWorkflow(data);
|
|
8541
|
+
}
|
|
8542
|
+
}
|
|
8543
|
+
) : /* @__PURE__ */ jsx(
|
|
8544
|
+
Button,
|
|
8545
|
+
{
|
|
8546
|
+
className: "w-full",
|
|
8547
|
+
variant: "light",
|
|
8548
|
+
disabled: isRunning,
|
|
8549
|
+
onClick: () => handleExecuteWorkflow(null),
|
|
8550
|
+
children: isRunning ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : "Trigger"
|
|
8551
|
+
}
|
|
8552
|
+
) }),
|
|
8424
8553
|
isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8425
8554
|
const stepDefinition = workflow.steps[step.stepId];
|
|
8426
8555
|
const stepSchema = stepDefinition?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(stepDefinition.inputSchema))) : z.record(z.string(), z.any());
|
|
@@ -8452,29 +8581,23 @@ function WorkflowTrigger({
|
|
|
8452
8581
|
)
|
|
8453
8582
|
] });
|
|
8454
8583
|
}),
|
|
8455
|
-
|
|
8456
|
-
/* @__PURE__ */ jsx(
|
|
8457
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
/* @__PURE__ */ jsx(
|
|
8465
|
-
|
|
8466
|
-
{
|
|
8467
|
-
className: "w-full overflow-x-auto",
|
|
8468
|
-
code: sanitizedOutput || JSON.stringify(restResult, null, 2),
|
|
8469
|
-
language: "json"
|
|
8470
|
-
}
|
|
8471
|
-
)
|
|
8584
|
+
hasWorkflowActivePaths && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8585
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8586
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.map(([stepId, { status: pathStatus, stepPath }]) => {
|
|
8587
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: stepPath?.map((path, idx) => {
|
|
8588
|
+
return /* @__PURE__ */ jsx(LegacyWorkflowStatus, { stepId, pathStatus, path }, idx);
|
|
8589
|
+
}) }, stepId);
|
|
8590
|
+
}) })
|
|
8591
|
+
] }),
|
|
8592
|
+
result && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8593
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8594
|
+
/* @__PURE__ */ jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
|
|
8472
8595
|
] })
|
|
8473
8596
|
] }) });
|
|
8474
8597
|
}
|
|
8475
8598
|
|
|
8476
|
-
function
|
|
8477
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
8599
|
+
function WorkflowNestedGraph({ stepGraph, open }) {
|
|
8600
|
+
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges({
|
|
8478
8601
|
stepGraph
|
|
8479
8602
|
});
|
|
8480
8603
|
const [isMounted, setIsMounted] = useState(false);
|
|
@@ -8485,7 +8608,7 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
|
|
|
8485
8608
|
"condition-node": WorkflowConditionNode,
|
|
8486
8609
|
"after-node": WorkflowAfterNode,
|
|
8487
8610
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8488
|
-
"nested-node":
|
|
8611
|
+
"nested-node": WorkflowNestedNode
|
|
8489
8612
|
};
|
|
8490
8613
|
useEffect(() => {
|
|
8491
8614
|
if (open) {
|
|
@@ -8512,10 +8635,10 @@ function VNextWorkflowNestedGraph({ stepGraph, open }) {
|
|
|
8512
8635
|
) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) });
|
|
8513
8636
|
}
|
|
8514
8637
|
|
|
8515
|
-
const
|
|
8638
|
+
const WorkflowNestedGraphContext = createContext(
|
|
8516
8639
|
{}
|
|
8517
8640
|
);
|
|
8518
|
-
function
|
|
8641
|
+
function WorkflowNestedGraphProvider({ children }) {
|
|
8519
8642
|
const [stepGraph, setStepGraph] = useState(null);
|
|
8520
8643
|
const [parentStepGraphList, setParentStepGraphList] = useState([]);
|
|
8521
8644
|
const [openDialog, setOpenDialog] = useState(false);
|
|
@@ -8553,7 +8676,7 @@ function VNextWorkflowNestedGraphProvider({ children }) {
|
|
|
8553
8676
|
}, 500);
|
|
8554
8677
|
};
|
|
8555
8678
|
return /* @__PURE__ */ jsxs(
|
|
8556
|
-
|
|
8679
|
+
WorkflowNestedGraphContext.Provider,
|
|
8557
8680
|
{
|
|
8558
8681
|
value: {
|
|
8559
8682
|
showNestedGraph,
|
|
@@ -8569,16 +8692,16 @@ function VNextWorkflowNestedGraphProvider({ children }) {
|
|
|
8569
8692
|
" workflow"
|
|
8570
8693
|
] })
|
|
8571
8694
|
] }),
|
|
8572
|
-
switching ? /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
8695
|
+
switching ? /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(WorkflowNestedGraph, { stepGraph, open: openDialog }) })
|
|
8573
8696
|
] }) }) })
|
|
8574
8697
|
]
|
|
8575
8698
|
}
|
|
8576
8699
|
);
|
|
8577
8700
|
}
|
|
8578
8701
|
|
|
8579
|
-
function
|
|
8702
|
+
function WorkflowNestedNode({ data }) {
|
|
8580
8703
|
const { label, withoutTopHandle, withoutBottomHandle, stepGraph } = data;
|
|
8581
|
-
const { showNestedGraph } = useContext(
|
|
8704
|
+
const { showNestedGraph } = useContext(WorkflowNestedGraphContext);
|
|
8582
8705
|
return /* @__PURE__ */ jsxs("div", { className: cn("bg-[rgba(29,29,29,0.5)] rounded-md h-full overflow-scroll w-[274px]"), children: [
|
|
8583
8706
|
!withoutTopHandle && /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style: { visibility: "hidden" } }),
|
|
8584
8707
|
/* @__PURE__ */ jsx("div", { className: "p-2 cursor-pointer", onClick: () => showNestedGraph({ label, stepGraph }), children: /* @__PURE__ */ jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-1.5 rounded-sm p-2 cursor-pointer", children: [
|
|
@@ -8589,8 +8712,8 @@ function VNextWorkflowNestedNode({ data }) {
|
|
|
8589
8712
|
] });
|
|
8590
8713
|
}
|
|
8591
8714
|
|
|
8592
|
-
function
|
|
8593
|
-
const { nodes: initialNodes, edges: initialEdges } =
|
|
8715
|
+
function WorkflowGraphInner({ workflow }) {
|
|
8716
|
+
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges(workflow);
|
|
8594
8717
|
const [nodes, _, onNodesChange] = useNodesState(initialNodes);
|
|
8595
8718
|
const [edges] = useEdgesState(initialEdges);
|
|
8596
8719
|
const nodeTypes = {
|
|
@@ -8598,7 +8721,7 @@ function VNextWorkflowGraphInner({ workflow }) {
|
|
|
8598
8721
|
"condition-node": WorkflowConditionNode,
|
|
8599
8722
|
"after-node": WorkflowAfterNode,
|
|
8600
8723
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8601
|
-
"nested-node":
|
|
8724
|
+
"nested-node": WorkflowNestedNode
|
|
8602
8725
|
};
|
|
8603
8726
|
return /* @__PURE__ */ jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxs(
|
|
8604
8727
|
ReactFlow,
|
|
@@ -8620,12 +8743,12 @@ function VNextWorkflowGraphInner({ workflow }) {
|
|
|
8620
8743
|
) });
|
|
8621
8744
|
}
|
|
8622
8745
|
|
|
8623
|
-
function
|
|
8624
|
-
const {
|
|
8746
|
+
function WorkflowGraph({ workflowId, baseUrl }) {
|
|
8747
|
+
const { workflow, isLoading } = useWorkflow(workflowId, baseUrl);
|
|
8625
8748
|
if (isLoading) {
|
|
8626
8749
|
return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[600px]" }) });
|
|
8627
8750
|
}
|
|
8628
|
-
if (!
|
|
8751
|
+
if (!workflow) {
|
|
8629
8752
|
return /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
8630
8753
|
/* @__PURE__ */ jsx(AlertCircleIcon, {}),
|
|
8631
8754
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -8635,43 +8758,60 @@ function VNextWorkflowGraph({ workflowId, baseUrl }) {
|
|
|
8635
8758
|
] })
|
|
8636
8759
|
] }) });
|
|
8637
8760
|
}
|
|
8638
|
-
return /* @__PURE__ */ jsx(
|
|
8761
|
+
return /* @__PURE__ */ jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(WorkflowGraphInner, { workflow }) }) });
|
|
8639
8762
|
}
|
|
8640
8763
|
|
|
8641
|
-
|
|
8764
|
+
const WorkflowStatus = ({ stepId, status }) => {
|
|
8765
|
+
return /* @__PURE__ */ jsx(
|
|
8766
|
+
WorkflowCard,
|
|
8767
|
+
{
|
|
8768
|
+
header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
8769
|
+
/* @__PURE__ */ jsxs(Icon, { children: [
|
|
8770
|
+
status === "success" && /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }),
|
|
8771
|
+
status === "failed" && /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }),
|
|
8772
|
+
status === "suspended" && /* @__PURE__ */ jsx(CirclePause, { className: "text-icon3" }),
|
|
8773
|
+
status === "running" && /* @__PURE__ */ jsx(Loader2, { className: "text-icon3 animate-spin" })
|
|
8774
|
+
] }),
|
|
8775
|
+
/* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) })
|
|
8776
|
+
] })
|
|
8777
|
+
}
|
|
8778
|
+
);
|
|
8779
|
+
};
|
|
8780
|
+
|
|
8781
|
+
function WorkflowTrigger({
|
|
8642
8782
|
workflowId,
|
|
8643
8783
|
baseUrl,
|
|
8644
8784
|
setRunId
|
|
8645
8785
|
}) {
|
|
8646
8786
|
const { runtimeContext } = usePlaygroundStore();
|
|
8647
|
-
const {
|
|
8648
|
-
const { isLoading,
|
|
8649
|
-
const {
|
|
8650
|
-
const {
|
|
8651
|
-
const {
|
|
8787
|
+
const { result, setResult, payload, setPayload } = useContext(WorkflowRunContext);
|
|
8788
|
+
const { isLoading, workflow } = useWorkflow(workflowId, baseUrl);
|
|
8789
|
+
const { createWorkflowRun, startWorkflowRun } = useExecuteWorkflow(baseUrl);
|
|
8790
|
+
const { watchWorkflow, watchResult, isWatchingWorkflow } = useWatchWorkflow(baseUrl);
|
|
8791
|
+
const { resumeWorkflow, isResumingWorkflow } = useResumeWorkflow(baseUrl);
|
|
8652
8792
|
const [suspendedSteps, setSuspendedSteps] = useState([]);
|
|
8653
8793
|
const [isRunning, setIsRunning] = useState(false);
|
|
8654
|
-
const triggerSchema =
|
|
8794
|
+
const triggerSchema = workflow?.inputSchema;
|
|
8655
8795
|
const handleExecuteWorkflow = async (data) => {
|
|
8656
8796
|
try {
|
|
8657
|
-
if (!
|
|
8797
|
+
if (!workflow) return;
|
|
8658
8798
|
setIsRunning(true);
|
|
8659
|
-
|
|
8660
|
-
const { runId } = await
|
|
8799
|
+
setResult(null);
|
|
8800
|
+
const { runId } = await createWorkflowRun({ workflowId });
|
|
8661
8801
|
setRunId?.(runId);
|
|
8662
|
-
|
|
8663
|
-
|
|
8802
|
+
watchWorkflow({ workflowId, runId });
|
|
8803
|
+
startWorkflowRun({ workflowId, runId, input: data, runtimeContext });
|
|
8664
8804
|
} catch (err) {
|
|
8665
8805
|
setIsRunning(false);
|
|
8666
8806
|
toast.error("Error executing workflow");
|
|
8667
8807
|
}
|
|
8668
8808
|
};
|
|
8669
8809
|
const handleResumeWorkflow = async (step) => {
|
|
8670
|
-
if (!
|
|
8810
|
+
if (!workflow) return;
|
|
8671
8811
|
const { stepId, runId: prevRunId, resumeData } = step;
|
|
8672
|
-
const { runId } = await
|
|
8673
|
-
|
|
8674
|
-
await
|
|
8812
|
+
const { runId } = await createWorkflowRun({ workflowId, prevRunId });
|
|
8813
|
+
watchWorkflow({ workflowId, runId });
|
|
8814
|
+
await resumeWorkflow({
|
|
8675
8815
|
step: stepId,
|
|
8676
8816
|
runId,
|
|
8677
8817
|
resumeData,
|
|
@@ -8679,78 +8819,65 @@ function VNextWorkflowTrigger({
|
|
|
8679
8819
|
runtimeContext
|
|
8680
8820
|
});
|
|
8681
8821
|
};
|
|
8682
|
-
const watchResultToUse =
|
|
8822
|
+
const watchResultToUse = result ?? watchResult;
|
|
8683
8823
|
const workflowActivePaths = watchResultToUse?.payload?.workflowState?.steps ?? {};
|
|
8684
8824
|
useEffect(() => {
|
|
8685
|
-
setIsRunning(
|
|
8686
|
-
}, [
|
|
8825
|
+
setIsRunning(isWatchingWorkflow);
|
|
8826
|
+
}, [isWatchingWorkflow]);
|
|
8687
8827
|
useEffect(() => {
|
|
8688
|
-
if (!watchResultToUse?.payload?.workflowState?.steps || !
|
|
8828
|
+
if (!watchResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
|
|
8689
8829
|
const suspended = Object.entries(watchResultToUse.payload.workflowState.steps).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
|
|
8690
8830
|
stepId,
|
|
8691
|
-
runId:
|
|
8831
|
+
runId: result.runId,
|
|
8692
8832
|
suspendPayload: payload2
|
|
8693
8833
|
}));
|
|
8694
8834
|
setSuspendedSteps(suspended);
|
|
8695
|
-
}, [watchResultToUse,
|
|
8835
|
+
}, [watchResultToUse, result]);
|
|
8696
8836
|
useEffect(() => {
|
|
8697
|
-
if (
|
|
8698
|
-
|
|
8837
|
+
if (watchResult) {
|
|
8838
|
+
setResult(watchResult);
|
|
8699
8839
|
}
|
|
8700
|
-
}, [
|
|
8840
|
+
}, [watchResult]);
|
|
8701
8841
|
if (isLoading) {
|
|
8702
8842
|
return /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
8703
8843
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-10" }),
|
|
8704
8844
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-10" })
|
|
8705
8845
|
] }) });
|
|
8706
8846
|
}
|
|
8707
|
-
if (!
|
|
8847
|
+
if (!workflow) return null;
|
|
8708
8848
|
const isSuspendedSteps = suspendedSteps.length > 0;
|
|
8709
8849
|
const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(triggerSchema))) : null;
|
|
8710
|
-
const { sanitizedOutput, ...restResult } =
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
/* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8717
|
-
" Resuming workflow"
|
|
8718
|
-
] }) : /* @__PURE__ */ jsx(Fragment, {})
|
|
8719
|
-
] }),
|
|
8720
|
-
/* @__PURE__ */ jsx(
|
|
8721
|
-
DynamicForm,
|
|
8722
|
-
{
|
|
8723
|
-
schema: zodInputSchema,
|
|
8724
|
-
defaultValues: payload,
|
|
8725
|
-
isSubmitLoading: isWatchingVNextWorkflow,
|
|
8726
|
-
onSubmit: (data) => {
|
|
8727
|
-
setPayload(data);
|
|
8728
|
-
handleExecuteWorkflow(data);
|
|
8729
|
-
}
|
|
8730
|
-
}
|
|
8731
|
-
)
|
|
8732
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "px-4 space-y-4", children: [
|
|
8733
|
-
isResumingVNextWorkflow ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
|
|
8734
|
-
/* @__PURE__ */ jsx(Loader2, { className: "w-3 h-3 animate-spin text-mastra-el-accent" }),
|
|
8735
|
-
" Resuming workflow"
|
|
8736
|
-
] }) : /* @__PURE__ */ jsx(Fragment, {}),
|
|
8737
|
-
/* @__PURE__ */ jsx(Button$1, { className: "w-full", disabled: isRunning, onClick: () => handleExecuteWorkflow(null), children: isRunning ? /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin" }) : "Trigger" })
|
|
8738
|
-
] }) }),
|
|
8739
|
-
Object.values(workflowActivePaths).length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8740
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
8741
|
-
/* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
|
|
8742
|
-
const statusIcon = status === "success" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }) : status === "failed" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-red-500 rounded-full" }) : /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-yellow-500 rounded-full animate-pulse" });
|
|
8743
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxs("div", { className: `flex items-center justify-between p-3`, children: [
|
|
8744
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) }),
|
|
8745
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 capitalize", children: [
|
|
8746
|
-
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: statusIcon }),
|
|
8747
|
-
status
|
|
8748
|
-
] })
|
|
8749
|
-
] }) }, stepId) });
|
|
8750
|
-
}) })
|
|
8850
|
+
const { sanitizedOutput, ...restResult } = result ?? {};
|
|
8851
|
+
const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
|
|
8852
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full px-5 pt-3 pb-12", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
8853
|
+
isResumingWorkflow && /* @__PURE__ */ jsxs("div", { className: "py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b-sm border-border1", children: [
|
|
8854
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin text-icon6" }) }),
|
|
8855
|
+
/* @__PURE__ */ jsx(Txt, { children: "Resuming workflow" })
|
|
8751
8856
|
] }),
|
|
8752
|
-
!
|
|
8753
|
-
|
|
8857
|
+
!isSuspendedSteps && /* @__PURE__ */ jsx(Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsx(
|
|
8858
|
+
DynamicForm,
|
|
8859
|
+
{
|
|
8860
|
+
schema: zodInputSchema,
|
|
8861
|
+
defaultValues: payload,
|
|
8862
|
+
isSubmitLoading: isWatchingWorkflow,
|
|
8863
|
+
submitButtonLabel: "Run",
|
|
8864
|
+
onSubmit: (data) => {
|
|
8865
|
+
setPayload(data);
|
|
8866
|
+
handleExecuteWorkflow(data);
|
|
8867
|
+
}
|
|
8868
|
+
}
|
|
8869
|
+
) : /* @__PURE__ */ jsx(
|
|
8870
|
+
Button,
|
|
8871
|
+
{
|
|
8872
|
+
className: "w-full",
|
|
8873
|
+
variant: "light",
|
|
8874
|
+
disabled: isRunning,
|
|
8875
|
+
onClick: () => handleExecuteWorkflow(null),
|
|
8876
|
+
children: isRunning ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : "Trigger"
|
|
8877
|
+
}
|
|
8878
|
+
) }),
|
|
8879
|
+
!isWatchingWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8880
|
+
const stepDefinition = workflow.steps[step.stepId];
|
|
8754
8881
|
const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(stepDefinition.resumeSchema))) : z.record(z.string(), z.any());
|
|
8755
8882
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-4", children: [
|
|
8756
8883
|
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
|
|
@@ -8766,7 +8893,7 @@ function VNextWorkflowTrigger({
|
|
|
8766
8893
|
DynamicForm,
|
|
8767
8894
|
{
|
|
8768
8895
|
schema: stepSchema,
|
|
8769
|
-
isSubmitLoading:
|
|
8896
|
+
isSubmitLoading: isResumingWorkflow,
|
|
8770
8897
|
submitButtonLabel: "Resume",
|
|
8771
8898
|
onSubmit: (data) => {
|
|
8772
8899
|
handleResumeWorkflow({
|
|
@@ -8780,23 +8907,18 @@ function VNextWorkflowTrigger({
|
|
|
8780
8907
|
)
|
|
8781
8908
|
] });
|
|
8782
8909
|
}),
|
|
8783
|
-
|
|
8784
|
-
/* @__PURE__ */ jsx(
|
|
8785
|
-
/* @__PURE__ */
|
|
8786
|
-
|
|
8787
|
-
{
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
className: "w-full overflow-x-auto",
|
|
8796
|
-
code: sanitizedOutput || JSON.stringify(restResult, null, 2),
|
|
8797
|
-
language: "json"
|
|
8798
|
-
}
|
|
8799
|
-
)
|
|
8910
|
+
hasWorkflowActivePaths && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8911
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8912
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8913
|
+
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
8914
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths)?.filter(([key, _]) => key !== "input" && !key.endsWith(".input"))?.map(([stepId, { status }]) => {
|
|
8915
|
+
return /* @__PURE__ */ jsx(WorkflowStatus, { stepId, status });
|
|
8916
|
+
}) })
|
|
8917
|
+
] })
|
|
8918
|
+
] }),
|
|
8919
|
+
result && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8920
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
8921
|
+
/* @__PURE__ */ jsx(WorkflowResult, { sanitizedJsonResult: sanitizedOutput, jsonResult: JSON.stringify(restResult, null, 2) })
|
|
8800
8922
|
] })
|
|
8801
8923
|
] }) });
|
|
8802
8924
|
}
|
|
@@ -8810,7 +8932,8 @@ const DataTable = ({
|
|
|
8810
8932
|
getRowId,
|
|
8811
8933
|
selectedRowId,
|
|
8812
8934
|
isLoading,
|
|
8813
|
-
emptyText
|
|
8935
|
+
emptyText,
|
|
8936
|
+
onClick
|
|
8814
8937
|
}) => {
|
|
8815
8938
|
const [sorting, setSorting] = useState([]);
|
|
8816
8939
|
const [{ pageIndex, pageSize }, setPagination] = useState({
|
|
@@ -8852,7 +8975,16 @@ const DataTable = ({
|
|
|
8852
8975
|
const meta = header.column.columnDef.meta;
|
|
8853
8976
|
return /* @__PURE__ */ jsx(Th, { style: { width: meta?.width || size || "auto" }, children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
|
|
8854
8977
|
}) }),
|
|
8855
|
-
/* @__PURE__ */ jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsx(Row, {
|
|
8978
|
+
/* @__PURE__ */ jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: 3 }).map((_, rowIndex) => /* @__PURE__ */ jsx(Row, { onClick: () => {
|
|
8979
|
+
}, children: Array.from({ length: columns.length }).map((_2, cellIndex) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }, `row-${rowIndex}-cell-${cellIndex}`)) }, rowIndex)) }) : rows?.length > 0 ? rows.map((row) => /* @__PURE__ */ jsx(
|
|
8980
|
+
Row,
|
|
8981
|
+
{
|
|
8982
|
+
"data-state": (row.getIsSelected() || row.id === selectedRowId) && "selected",
|
|
8983
|
+
onClick: () => onClick?.(row.original),
|
|
8984
|
+
children: row.getVisibleCells().map((cell) => flexRender(cell.column.columnDef.cell, cell.getContext()))
|
|
8985
|
+
},
|
|
8986
|
+
row.id
|
|
8987
|
+
)) : emptyNode })
|
|
8856
8988
|
] }),
|
|
8857
8989
|
pagination && /* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center justify-between px-2", children: [
|
|
8858
8990
|
/* @__PURE__ */ jsxs("div", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -9178,5 +9310,5 @@ const useTraces = (componentName, baseUrl, isWorkflow = false) => {
|
|
|
9178
9310
|
return { traces, firstCallLoading, error };
|
|
9179
9311
|
};
|
|
9180
9312
|
|
|
9181
|
-
export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LogsIcon, MastraResizablePanel, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolsIcon, TraceContext, TraceIcon, TraceProvider, TsIcon, Txt, TxtCell, UnitCell,
|
|
9313
|
+
export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraResizablePanel, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolsIcon, TraceContext, TraceIcon, TraceProvider, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, usePlaygroundStore, usePolling, useTraces };
|
|
9182
9314
|
//# sourceMappingURL=index.es.js.map
|