@mastra/playground-ui 5.1.8 → 5.1.9
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/{colors-CBG_Mm7P.js → colors-BauMYA7t.js} +3 -2
- package/dist/colors-BauMYA7t.js.map +1 -0
- package/dist/{colors-Du4i-E0i.cjs → colors-BjoU9dWU.cjs} +3 -2
- package/dist/colors-BjoU9dWU.cjs.map +1 -0
- package/dist/index.cjs.js +826 -298
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +818 -296
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/ui/entry.d.ts +7 -0
- package/dist/src/components/ui/radio-group.d.ts +5 -0
- package/dist/src/domains/agents/components/agent-advanced-settings.d.ts +1 -0
- package/dist/src/domains/agents/components/agent-model-settings.d.ts +1 -0
- package/dist/src/domains/agents/context/agent-context.d.ts +18 -0
- package/dist/src/domains/agents/hooks/use-agent-model-settings-state.d.ts +15 -0
- package/dist/src/domains/agents/index.d.ts +5 -4
- package/dist/src/domains/workflows/context/use-current-run.d.ts +2 -1
- package/dist/src/domains/workflows/context/workflow-nested-graph-context.d.ts +5 -1
- package/dist/src/domains/workflows/context/workflow-run-context.d.ts +3 -2
- package/dist/src/domains/workflows/utils.d.ts +2 -2
- package/dist/src/domains/workflows/workflow/workflow-default-node.d.ts +3 -1
- package/dist/src/domains/workflows/workflow/workflow-nested-graph.d.ts +5 -1
- package/dist/src/domains/workflows/workflow/workflow-nested-node.d.ts +7 -2
- package/dist/src/domains/workflows/workflow/workflow-status.d.ts +2 -1
- package/dist/src/domains/workflows/workflow/workflow-step-action-bar.d.ts +3 -1
- package/dist/src/domains/workflows/workflow/workflow-trigger.d.ts +12 -10
- package/dist/src/ds/tokens/colors.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/types.d.ts +17 -0
- package/dist/tokens.cjs.js +1 -1
- package/dist/tokens.es.js +1 -1
- package/package.json +6 -5
- package/dist/colors-CBG_Mm7P.js.map +0 -1
- package/dist/colors-Du4i-E0i.cjs.map +0 -1
- package/dist/src/domains/agents/agent/context/agent-context.d.ts +0 -19
- package/dist/src/store/agent-store.d.ts +0 -20
- /package/dist/src/domains/agents/{agent → components}/agent-chat.d.ts +0 -0
- /package/dist/src/domains/agents/{agent → components}/agent-evals.d.ts +0 -0
- /package/dist/src/domains/agents/{agent → components}/agent-traces.d.ts +0 -0
package/dist/index.es.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import React__default, { createContext, useContext, forwardRef, useState, useEffect, memo, useRef, useCallback, useMemo, Suspense, Fragment as Fragment$1 } from 'react';
|
|
4
4
|
import { MastraClient } from '@mastra/client-js';
|
|
5
5
|
import { useMessage, MessagePrimitive, ActionBarPrimitive, useComposerRuntime, ComposerPrimitive, useAttachment, AttachmentPrimitive, ThreadPrimitive, useExternalStoreRuntime, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, AssistantRuntimeProvider } from '@assistant-ui/react';
|
|
6
|
-
import { CheckIcon as CheckIcon$1, CopyIcon, Check, Copy, ChevronUpIcon, X, FileText, FileIcon, CircleXIcon, Mic, PlusIcon, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, ChevronUp, ChevronDown, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Network, PauseIcon, Loader2, CircleDashed, Footprints, CircleCheck, CircleX, Minus, Plus, Maximize, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, Braces, Brackets, TrashIcon } from 'lucide-react';
|
|
6
|
+
import { CheckIcon as CheckIcon$1, CopyIcon, Check, Copy, ChevronUpIcon, X, FileText, FileIcon, CircleXIcon, Mic, PlusIcon, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, ChevronUp, ChevronDown, Circle, RefreshCw, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Network, PauseIcon, HourglassIcon, Loader2, CircleDashed, Footprints, CircleCheck, CircleX, Minus, Plus, Maximize, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, Braces, Brackets, TrashIcon, CirclePause } from 'lucide-react';
|
|
7
7
|
import { Slot } from '@radix-ui/react-slot';
|
|
8
8
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
9
9
|
import { TooltipProvider as TooltipProvider$1 } from '@radix-ui/react-tooltip';
|
|
@@ -26,16 +26,18 @@ import { persist } from 'zustand/middleware';
|
|
|
26
26
|
import { format, formatDistanceToNow, isValid, formatDate } from 'date-fns';
|
|
27
27
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
28
28
|
import { AnimatePresence } from 'motion/react';
|
|
29
|
-
import { C as Colors } from './colors-
|
|
29
|
+
import { C as Colors } from './colors-BauMYA7t.js';
|
|
30
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
31
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
32
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
33
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
30
34
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
31
35
|
import Markdown from 'react-markdown';
|
|
32
36
|
import { MarkerType, Handle, Position, useViewport, useReactFlow, Panel, useNodesState, useEdgesState, ReactFlow, MiniMap, Background, BackgroundVariant, ReactFlowProvider, Controls } from '@xyflow/react';
|
|
33
37
|
import '@xyflow/react/dist/style.css';
|
|
34
38
|
import Dagre from '@dagrejs/dagre';
|
|
35
39
|
import { Highlight, themes } from 'prism-react-renderer';
|
|
36
|
-
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
37
40
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
38
|
-
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
39
41
|
import { useDebouncedCallback } from 'use-debounce';
|
|
40
42
|
import { v4 } from '@lukeed/uuid';
|
|
41
43
|
import prettier from 'prettier';
|
|
@@ -50,7 +52,6 @@ import { DayPicker } from 'react-day-picker';
|
|
|
50
52
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
51
53
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
52
54
|
import { ZodProvider, getFieldConfigInZodStack, getDefaultValueInZodStack } from '@autoform/zod';
|
|
53
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
54
55
|
import { CodeBlock as CodeBlock$1 } from 'react-code-block';
|
|
55
56
|
import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
56
57
|
|
|
@@ -4727,7 +4728,7 @@ const SpeechInput$1 = () => {
|
|
|
4727
4728
|
variant: "ghost",
|
|
4728
4729
|
className: "rounded-full",
|
|
4729
4730
|
onClick: () => isListening ? stop() : start(),
|
|
4730
|
-
children: isListening ? /* @__PURE__ */ jsx(CircleStopIcon$
|
|
4731
|
+
children: isListening ? /* @__PURE__ */ jsx(CircleStopIcon$2, {}) : /* @__PURE__ */ jsx(Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
4731
4732
|
}
|
|
4732
4733
|
);
|
|
4733
4734
|
};
|
|
@@ -4743,7 +4744,7 @@ const ComposerAction$1 = ({ showFileSupport }) => {
|
|
|
4743
4744
|
children: /* @__PURE__ */ jsx(ArrowUp, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
4744
4745
|
}
|
|
4745
4746
|
) }) }),
|
|
4746
|
-
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsx(ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsx(CircleStopIcon$
|
|
4747
|
+
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsx(ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsx(CircleStopIcon$2, {}) }) }) })
|
|
4747
4748
|
] });
|
|
4748
4749
|
};
|
|
4749
4750
|
const EditComposer$1 = () => {
|
|
@@ -4755,7 +4756,7 @@ const EditComposer$1 = () => {
|
|
|
4755
4756
|
] })
|
|
4756
4757
|
] });
|
|
4757
4758
|
};
|
|
4758
|
-
const CircleStopIcon$
|
|
4759
|
+
const CircleStopIcon$2 = () => {
|
|
4759
4760
|
return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
|
|
4760
4761
|
};
|
|
4761
4762
|
|
|
@@ -5186,83 +5187,79 @@ function MastraRuntimeProvider({
|
|
|
5186
5187
|
] });
|
|
5187
5188
|
}
|
|
5188
5189
|
|
|
5189
|
-
const useAgentStore = create()(
|
|
5190
|
-
persist(
|
|
5191
|
-
(set) => ({
|
|
5192
|
-
modelSettings: {},
|
|
5193
|
-
setModelSettings: (modelSettings) => set((state) => ({ modelSettings: { ...state.modelSettings, ...modelSettings } })),
|
|
5194
|
-
chatWithGenerate: {},
|
|
5195
|
-
setChatWithGenerate: (chatWithGenerate) => set((state) => ({ chatWithGenerate: { ...state.chatWithGenerate, ...chatWithGenerate } }))
|
|
5196
|
-
}),
|
|
5197
|
-
{
|
|
5198
|
-
name: "mastra-agent-store"
|
|
5199
|
-
}
|
|
5200
|
-
)
|
|
5201
|
-
);
|
|
5202
|
-
|
|
5203
5190
|
const defaultModelSettings$1 = {
|
|
5204
5191
|
maxRetries: 2,
|
|
5205
5192
|
maxSteps: 5,
|
|
5206
5193
|
temperature: 0.5,
|
|
5207
5194
|
topP: 1
|
|
5208
5195
|
};
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
const setChatWithGenerate = (chatWithGenerate2) => {
|
|
5224
|
-
setChatWithGenerateStore({ [agentId]: chatWithGenerate2 });
|
|
5225
|
-
};
|
|
5226
|
-
const modelSettings = useMemo(() => {
|
|
5227
|
-
if (modelSettingsStore[agentId]) return modelSettingsStore[agentId];
|
|
5228
|
-
if (chatWithGenerate) {
|
|
5229
|
-
return {
|
|
5230
|
-
maxRetries: defaultGenerateOptions?.maxRetries ?? defaultModelSettings$1.maxRetries,
|
|
5231
|
-
maxSteps: defaultGenerateOptions?.maxSteps ?? defaultModelSettings$1.maxSteps,
|
|
5232
|
-
temperature: defaultGenerateOptions?.temperature ?? defaultModelSettings$1.temperature,
|
|
5233
|
-
topP: defaultGenerateOptions?.topP ?? defaultModelSettings$1.topP,
|
|
5234
|
-
...defaultGenerateOptions
|
|
5235
|
-
};
|
|
5236
|
-
} else {
|
|
5237
|
-
return {
|
|
5238
|
-
maxRetries: defaultStreamOptions?.maxRetries ?? defaultModelSettings$1.maxRetries,
|
|
5239
|
-
maxSteps: defaultStreamOptions?.maxSteps ?? defaultModelSettings$1.maxSteps,
|
|
5240
|
-
temperature: defaultStreamOptions?.temperature ?? defaultModelSettings$1.temperature,
|
|
5241
|
-
topP: defaultStreamOptions?.topP ?? defaultModelSettings$1.topP,
|
|
5242
|
-
...defaultStreamOptions
|
|
5243
|
-
};
|
|
5196
|
+
function useAgentModelSettingsState({ agentId }) {
|
|
5197
|
+
const [modelSettings, setModelSettingsState] = useState(void 0);
|
|
5198
|
+
const [chatWithGenerate, setChatWithGenerateState] = useState(false);
|
|
5199
|
+
const LOCAL_STORAGE_KEY = `mastra-agent-store-${agentId}`;
|
|
5200
|
+
useEffect(() => {
|
|
5201
|
+
try {
|
|
5202
|
+
const stored = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
5203
|
+
if (stored) {
|
|
5204
|
+
const parsed = JSON.parse(stored);
|
|
5205
|
+
setModelSettingsState(parsed.modelSettings ?? void 0);
|
|
5206
|
+
setChatWithGenerateState(parsed.chatWithGenerate ?? false);
|
|
5207
|
+
}
|
|
5208
|
+
} catch (e) {
|
|
5209
|
+
console.error(e);
|
|
5244
5210
|
}
|
|
5245
|
-
}, [
|
|
5246
|
-
|
|
5247
|
-
|
|
5211
|
+
}, [LOCAL_STORAGE_KEY]);
|
|
5212
|
+
useEffect(() => {
|
|
5213
|
+
if (modelSettings) {
|
|
5214
|
+
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify({ modelSettings, chatWithGenerate, agentId }));
|
|
5215
|
+
}
|
|
5216
|
+
}, [modelSettings, chatWithGenerate, LOCAL_STORAGE_KEY]);
|
|
5217
|
+
const setModelSettings = (modelSettingsValue) => setModelSettingsState((prev) => ({ ...prev, ...modelSettingsValue }));
|
|
5218
|
+
const setChatWithGenerate = (chatWithGenerateValue) => setChatWithGenerateState(chatWithGenerateValue);
|
|
5219
|
+
const resetAll = () => {
|
|
5220
|
+
setModelSettingsState(defaultModelSettings$1);
|
|
5221
|
+
setChatWithGenerate(false);
|
|
5248
5222
|
};
|
|
5249
|
-
|
|
5250
|
-
|
|
5223
|
+
return {
|
|
5224
|
+
modelSettings,
|
|
5225
|
+
chatWithGenerate,
|
|
5226
|
+
setModelSettings,
|
|
5227
|
+
setChatWithGenerate,
|
|
5228
|
+
resetAll
|
|
5229
|
+
};
|
|
5230
|
+
}
|
|
5231
|
+
|
|
5232
|
+
const AgentSettingsContext = createContext({});
|
|
5233
|
+
function AgentSettingsProvider({ children, agentId }) {
|
|
5234
|
+
const { modelSettings, setModelSettings, chatWithGenerate, setChatWithGenerate, resetAll } = useAgentModelSettingsState({
|
|
5235
|
+
agentId
|
|
5236
|
+
});
|
|
5237
|
+
const onChangeModelSettings = (modelSettings2) => {
|
|
5238
|
+
setModelSettings(modelSettings2);
|
|
5239
|
+
};
|
|
5240
|
+
const onChangeChatWithGenerate = (chatWithGenerate2) => {
|
|
5241
|
+
setChatWithGenerate(chatWithGenerate2);
|
|
5242
|
+
};
|
|
5243
|
+
const onReset = () => {
|
|
5244
|
+
resetAll();
|
|
5251
5245
|
};
|
|
5252
5246
|
return /* @__PURE__ */ jsx(
|
|
5253
|
-
|
|
5247
|
+
AgentSettingsContext.Provider,
|
|
5254
5248
|
{
|
|
5255
5249
|
value: {
|
|
5256
|
-
modelSettings,
|
|
5257
|
-
setModelSettings,
|
|
5258
|
-
resetModelSettings,
|
|
5259
|
-
chatWithGenerate,
|
|
5260
|
-
setChatWithGenerate
|
|
5250
|
+
modelSettings: modelSettings ?? defaultModelSettings$1,
|
|
5251
|
+
setModelSettings: onChangeModelSettings,
|
|
5252
|
+
resetModelSettings: onReset,
|
|
5253
|
+
chatWithGenerate: chatWithGenerate ?? false,
|
|
5254
|
+
setChatWithGenerate: onChangeChatWithGenerate
|
|
5261
5255
|
},
|
|
5262
5256
|
children
|
|
5263
5257
|
}
|
|
5264
5258
|
);
|
|
5265
5259
|
}
|
|
5260
|
+
const useAgentSettings = () => {
|
|
5261
|
+
return useContext(AgentSettingsContext);
|
|
5262
|
+
};
|
|
5266
5263
|
|
|
5267
5264
|
const usePlaygroundStore = create()(
|
|
5268
5265
|
persist(
|
|
@@ -5285,7 +5282,7 @@ const AgentChat = ({
|
|
|
5285
5282
|
refreshThreadList,
|
|
5286
5283
|
showFileSupport
|
|
5287
5284
|
}) => {
|
|
5288
|
-
const { modelSettings, chatWithGenerate } =
|
|
5285
|
+
const { modelSettings, chatWithGenerate } = useAgentSettings();
|
|
5289
5286
|
const { runtimeContext } = usePlaygroundStore();
|
|
5290
5287
|
return /* @__PURE__ */ jsx(
|
|
5291
5288
|
MastraRuntimeProvider,
|
|
@@ -5998,7 +5995,10 @@ const Button = ({ className, as, size = "md", variant = "default", ...props }) =
|
|
|
5998
5995
|
"bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
|
|
5999
5996
|
variantClasses$1[variant],
|
|
6000
5997
|
sizeClasses[size],
|
|
6001
|
-
className
|
|
5998
|
+
className,
|
|
5999
|
+
{
|
|
6000
|
+
"cursor-not-allowed": props.disabled
|
|
6001
|
+
}
|
|
6002
6002
|
),
|
|
6003
6003
|
...props
|
|
6004
6004
|
}
|
|
@@ -6376,11 +6376,11 @@ function SpanDetail() {
|
|
|
6376
6376
|
span.name
|
|
6377
6377
|
] }),
|
|
6378
6378
|
/* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2 items-center", children: span.status.code === 0 ? /* @__PURE__ */ jsxs(Badge$1, { icon: /* @__PURE__ */ jsx(LatencyIcon, {}), variant: "success", children: [
|
|
6379
|
-
toSigFigs(span.duration
|
|
6379
|
+
toSigFigs(span.duration, 3),
|
|
6380
6380
|
"ms"
|
|
6381
6381
|
] }) : /* @__PURE__ */ jsxs(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsx(X, {}), children: [
|
|
6382
6382
|
"Failed in ",
|
|
6383
|
-
toSigFigs(span.duration
|
|
6383
|
+
toSigFigs(span.duration, 3),
|
|
6384
6384
|
"ms"
|
|
6385
6385
|
] }) }),
|
|
6386
6386
|
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
@@ -6478,6 +6478,218 @@ function AgentTracesInner({ className, traces, error }) {
|
|
|
6478
6478
|
] });
|
|
6479
6479
|
}
|
|
6480
6480
|
|
|
6481
|
+
const Slider = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
6482
|
+
SliderPrimitive.Root,
|
|
6483
|
+
{
|
|
6484
|
+
ref,
|
|
6485
|
+
className: cn("relative flex w-full touch-none select-none items-center", className),
|
|
6486
|
+
...props,
|
|
6487
|
+
children: [
|
|
6488
|
+
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary/50" }) }),
|
|
6489
|
+
/* @__PURE__ */ jsx(SliderPrimitive.Thumb, { className: "block h-4 w-4 rounded-full border border-primary/50 bg-white shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" })
|
|
6490
|
+
]
|
|
6491
|
+
}
|
|
6492
|
+
));
|
|
6493
|
+
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
6494
|
+
|
|
6495
|
+
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
6496
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
6497
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
6498
|
+
|
|
6499
|
+
const RadioGroup = React.forwardRef(({ className, ...props }, ref) => {
|
|
6500
|
+
return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, { className: cn("grid gap-2", className), ...props, ref });
|
|
6501
|
+
});
|
|
6502
|
+
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
6503
|
+
const RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
6504
|
+
return /* @__PURE__ */ jsx(
|
|
6505
|
+
RadioGroupPrimitive.Item,
|
|
6506
|
+
{
|
|
6507
|
+
ref,
|
|
6508
|
+
className: cn(
|
|
6509
|
+
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
6510
|
+
className
|
|
6511
|
+
),
|
|
6512
|
+
...props,
|
|
6513
|
+
children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(Circle, { className: "h-2.5 w-2.5 fill-current text-current" }) })
|
|
6514
|
+
}
|
|
6515
|
+
);
|
|
6516
|
+
});
|
|
6517
|
+
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
6518
|
+
|
|
6519
|
+
const Entry = ({ label, children }) => {
|
|
6520
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
6521
|
+
/* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-md", className: "text-icon3", children: label }),
|
|
6522
|
+
children
|
|
6523
|
+
] });
|
|
6524
|
+
};
|
|
6525
|
+
|
|
6526
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
6527
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
6528
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
6529
|
+
|
|
6530
|
+
const AgentAdvancedSettings = () => {
|
|
6531
|
+
const { modelSettings, setModelSettings } = useAgentSettings();
|
|
6532
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
6533
|
+
const collapsibleClassName = "rounded-lg border-sm border-border1 bg-surface3 overflow-clip";
|
|
6534
|
+
const collapsibleTriggerClassName = "text-icon3 text-ui-lg font-medium flex items-center gap-2 w-full p-[10px] justify-between";
|
|
6535
|
+
const collapsibleContentClassName = "bg-surface2 p-[10px] grid grid-cols-2 gap-[10px]";
|
|
6536
|
+
return /* @__PURE__ */ jsxs(Collapsible, { className: collapsibleClassName, open: isOpen, onOpenChange: setIsOpen, children: [
|
|
6537
|
+
/* @__PURE__ */ jsxs(CollapsibleTrigger, { className: collapsibleTriggerClassName, children: [
|
|
6538
|
+
"Advanced Settings",
|
|
6539
|
+
/* @__PURE__ */ jsx(Icon, { className: cn("transition-transform", isOpen ? "rotate-0" : "-rotate-90"), children: /* @__PURE__ */ jsx(ChevronDown, {}) })
|
|
6540
|
+
] }),
|
|
6541
|
+
/* @__PURE__ */ jsxs(CollapsibleContent, { className: collapsibleContentClassName, children: [
|
|
6542
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
6543
|
+
/* @__PURE__ */ jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "top-k", children: "Top K" }),
|
|
6544
|
+
/* @__PURE__ */ jsx(
|
|
6545
|
+
Input,
|
|
6546
|
+
{
|
|
6547
|
+
id: "top-k",
|
|
6548
|
+
type: "number",
|
|
6549
|
+
value: modelSettings?.topK || "",
|
|
6550
|
+
onChange: (e) => setModelSettings({ ...modelSettings, topK: e.target.value ? Number(e.target.value) : void 0 })
|
|
6551
|
+
}
|
|
6552
|
+
)
|
|
6553
|
+
] }),
|
|
6554
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
6555
|
+
/* @__PURE__ */ jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "frequency-penalty", children: "Frequency Penalty" }),
|
|
6556
|
+
/* @__PURE__ */ jsx(
|
|
6557
|
+
Input,
|
|
6558
|
+
{
|
|
6559
|
+
id: "frequency-penalty",
|
|
6560
|
+
type: "number",
|
|
6561
|
+
value: modelSettings?.frequencyPenalty || "",
|
|
6562
|
+
onChange: (e) => setModelSettings({
|
|
6563
|
+
...modelSettings,
|
|
6564
|
+
frequencyPenalty: e.target.value ? Number(e.target.value) : void 0
|
|
6565
|
+
})
|
|
6566
|
+
}
|
|
6567
|
+
)
|
|
6568
|
+
] }),
|
|
6569
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
6570
|
+
/* @__PURE__ */ jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "presence-penalty", children: "Presence Penalty" }),
|
|
6571
|
+
/* @__PURE__ */ jsx(
|
|
6572
|
+
Input,
|
|
6573
|
+
{
|
|
6574
|
+
id: "presence-penalty",
|
|
6575
|
+
type: "number",
|
|
6576
|
+
value: modelSettings?.presencePenalty || "",
|
|
6577
|
+
onChange: (e) => setModelSettings({
|
|
6578
|
+
...modelSettings,
|
|
6579
|
+
presencePenalty: e.target.value ? Number(e.target.value) : void 0
|
|
6580
|
+
})
|
|
6581
|
+
}
|
|
6582
|
+
)
|
|
6583
|
+
] }),
|
|
6584
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
6585
|
+
/* @__PURE__ */ jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "max-tokens", children: "Max Tokens" }),
|
|
6586
|
+
/* @__PURE__ */ jsx(
|
|
6587
|
+
Input,
|
|
6588
|
+
{
|
|
6589
|
+
id: "max-tokens",
|
|
6590
|
+
type: "number",
|
|
6591
|
+
value: modelSettings?.maxTokens || "",
|
|
6592
|
+
onChange: (e) => setModelSettings({
|
|
6593
|
+
...modelSettings,
|
|
6594
|
+
maxTokens: e.target.value ? Number(e.target.value) : void 0
|
|
6595
|
+
})
|
|
6596
|
+
}
|
|
6597
|
+
)
|
|
6598
|
+
] }),
|
|
6599
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
6600
|
+
/* @__PURE__ */ jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "max-steps", children: "Max Steps" }),
|
|
6601
|
+
/* @__PURE__ */ jsx(
|
|
6602
|
+
Input,
|
|
6603
|
+
{
|
|
6604
|
+
id: "max-steps",
|
|
6605
|
+
type: "number",
|
|
6606
|
+
value: modelSettings?.maxSteps || "",
|
|
6607
|
+
onChange: (e) => setModelSettings({
|
|
6608
|
+
...modelSettings,
|
|
6609
|
+
maxSteps: e.target.value ? Number(e.target.value) : void 0
|
|
6610
|
+
})
|
|
6611
|
+
}
|
|
6612
|
+
)
|
|
6613
|
+
] }),
|
|
6614
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
6615
|
+
/* @__PURE__ */ jsx(Txt, { as: "label", className: "text-icon3", variant: "ui-sm", htmlFor: "max-retries", children: "Max Retries" }),
|
|
6616
|
+
/* @__PURE__ */ jsx(
|
|
6617
|
+
Input,
|
|
6618
|
+
{
|
|
6619
|
+
id: "max-retries",
|
|
6620
|
+
type: "number",
|
|
6621
|
+
value: modelSettings?.maxRetries || "",
|
|
6622
|
+
onChange: (e) => setModelSettings({
|
|
6623
|
+
...modelSettings,
|
|
6624
|
+
maxRetries: e.target.value ? Number(e.target.value) : void 0
|
|
6625
|
+
})
|
|
6626
|
+
}
|
|
6627
|
+
)
|
|
6628
|
+
] })
|
|
6629
|
+
] })
|
|
6630
|
+
] });
|
|
6631
|
+
};
|
|
6632
|
+
|
|
6633
|
+
function AgentModelSettings() {
|
|
6634
|
+
const { modelSettings, setModelSettings, chatWithGenerate, setChatWithGenerate, resetModelSettings } = useAgentSettings();
|
|
6635
|
+
return /* @__PURE__ */ jsxs("div", { className: "px-5 text-xs py-2 pb-4", children: [
|
|
6636
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-7", children: [
|
|
6637
|
+
/* @__PURE__ */ jsx(Entry, { label: "Chat Method", children: /* @__PURE__ */ jsxs(
|
|
6638
|
+
RadioGroup,
|
|
6639
|
+
{
|
|
6640
|
+
orientation: "horizontal",
|
|
6641
|
+
value: chatWithGenerate ? "generate" : "stream",
|
|
6642
|
+
onValueChange: (value) => setChatWithGenerate(value === "generate"),
|
|
6643
|
+
className: "flex flex-row gap-4",
|
|
6644
|
+
children: [
|
|
6645
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6646
|
+
/* @__PURE__ */ jsx(RadioGroupItem, { value: "generate", id: "generate", className: "text-icon6" }),
|
|
6647
|
+
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "generate", children: "Generate" })
|
|
6648
|
+
] }),
|
|
6649
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6650
|
+
/* @__PURE__ */ jsx(RadioGroupItem, { value: "stream", id: "stream", className: "text-icon6" }),
|
|
6651
|
+
/* @__PURE__ */ jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "stream", children: "Stream" })
|
|
6652
|
+
] })
|
|
6653
|
+
]
|
|
6654
|
+
}
|
|
6655
|
+
) }),
|
|
6656
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-8", children: [
|
|
6657
|
+
/* @__PURE__ */ jsx(Entry, { label: "Temperature", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row justify-between items-center gap-2", children: [
|
|
6658
|
+
/* @__PURE__ */ jsx(
|
|
6659
|
+
Slider,
|
|
6660
|
+
{
|
|
6661
|
+
value: [modelSettings?.temperature ?? -0.1],
|
|
6662
|
+
max: 1,
|
|
6663
|
+
min: -0.1,
|
|
6664
|
+
step: 0.1,
|
|
6665
|
+
onValueChange: (value) => setModelSettings({ ...modelSettings, temperature: value[0] < 0 ? void 0 : value[0] })
|
|
6666
|
+
}
|
|
6667
|
+
),
|
|
6668
|
+
/* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon3", children: modelSettings?.temperature ?? "n/a" })
|
|
6669
|
+
] }) }),
|
|
6670
|
+
/* @__PURE__ */ jsx(Entry, { label: "Top P", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row justify-between items-center gap-2", children: [
|
|
6671
|
+
/* @__PURE__ */ jsx(
|
|
6672
|
+
Slider,
|
|
6673
|
+
{
|
|
6674
|
+
onValueChange: (value) => setModelSettings({ ...modelSettings, topP: value[0] < 0 ? void 0 : value[0] }),
|
|
6675
|
+
value: [modelSettings?.topP ?? -0.1],
|
|
6676
|
+
max: 1,
|
|
6677
|
+
min: -0.1,
|
|
6678
|
+
step: 0.1
|
|
6679
|
+
}
|
|
6680
|
+
),
|
|
6681
|
+
/* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon3", children: modelSettings?.topP ?? "n/a" })
|
|
6682
|
+
] }) })
|
|
6683
|
+
] })
|
|
6684
|
+
] }),
|
|
6685
|
+
/* @__PURE__ */ jsx("section", { className: "py-7", children: /* @__PURE__ */ jsx(AgentAdvancedSettings, {}) }),
|
|
6686
|
+
/* @__PURE__ */ jsxs(Button, { onClick: () => resetModelSettings(), variant: "light", className: "w-full", size: "lg", children: [
|
|
6687
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(RefreshCw, {}) }),
|
|
6688
|
+
"Reset"
|
|
6689
|
+
] })
|
|
6690
|
+
] });
|
|
6691
|
+
}
|
|
6692
|
+
|
|
6481
6693
|
const convertMessage$1 = (message) => {
|
|
6482
6694
|
return message;
|
|
6483
6695
|
};
|
|
@@ -6895,18 +7107,21 @@ const VNextNetworkChatProvider = ({ children }) => {
|
|
|
6895
7107
|
const [state, setState] = useState({});
|
|
6896
7108
|
const { chatWithLoop } = useContext(NetworkContext);
|
|
6897
7109
|
const handleStep = (uuid, record) => {
|
|
6898
|
-
const addFinishStep = chatWithLoop && record.type === "step-finish" && record.payload?.id === "final-step";
|
|
6899
|
-
|
|
6900
|
-
if (id
|
|
7110
|
+
const addFinishStep = chatWithLoop && record.type === "step-finish" && record.payload?.id === "final-step" || record.type === "error";
|
|
7111
|
+
let id = record?.type === "finish" ? "finish" : record.type === "start" ? "start" : record.payload?.id;
|
|
7112
|
+
if (id?.includes("mapping_")) return;
|
|
6901
7113
|
setState((prevState) => {
|
|
6902
7114
|
const current = prevState[uuid];
|
|
7115
|
+
if (record.type === "error") {
|
|
7116
|
+
id = current?.executionSteps?.[current?.executionSteps.length - 1];
|
|
7117
|
+
}
|
|
6903
7118
|
const currentMetadata = current?.steps?.[id]?.metadata;
|
|
6904
7119
|
let startTime = currentMetadata?.startTime;
|
|
6905
7120
|
let endTime = currentMetadata?.endTime;
|
|
6906
7121
|
if (record.type === "step-start") {
|
|
6907
7122
|
startTime = Date.now();
|
|
6908
7123
|
}
|
|
6909
|
-
if (record.type === "step-finish") {
|
|
7124
|
+
if (record.type === "step-finish" || record.type === "error") {
|
|
6910
7125
|
endTime = Date.now();
|
|
6911
7126
|
}
|
|
6912
7127
|
return {
|
|
@@ -6919,7 +7134,7 @@ const VNextNetworkChatProvider = ({ children }) => {
|
|
|
6919
7134
|
...current?.steps,
|
|
6920
7135
|
[id]: {
|
|
6921
7136
|
...current?.steps?.[id] || {},
|
|
6922
|
-
[record.type]: record.payload,
|
|
7137
|
+
[record.type]: record.payload || record?.error,
|
|
6923
7138
|
metadata: {
|
|
6924
7139
|
startTime,
|
|
6925
7140
|
endTime
|
|
@@ -7353,11 +7568,16 @@ const getStepNodeAndEdge = ({
|
|
|
7353
7568
|
}) => {
|
|
7354
7569
|
let nextNodeIds = [];
|
|
7355
7570
|
let nextStepIds = [];
|
|
7356
|
-
if (nextStepFlow?.type === "step" || nextStepFlow?.type === "foreach" || nextStepFlow?.type === "loop") {
|
|
7571
|
+
if (nextStepFlow?.type === "step" || nextStepFlow?.type === "foreach" || nextStepFlow?.type === "loop" || nextStepFlow?.type === "waitForEvent") {
|
|
7357
7572
|
const nextStepId = allPrevNodeIds?.includes(nextStepFlow.step.id) ? `${nextStepFlow.step.id}-${yIndex + 1}` : nextStepFlow.step.id;
|
|
7358
7573
|
nextNodeIds = [nextStepId];
|
|
7359
7574
|
nextStepIds = [nextStepFlow.step.id];
|
|
7360
7575
|
}
|
|
7576
|
+
if (nextStepFlow?.type === "sleep" || nextStepFlow?.type === "sleepUntil") {
|
|
7577
|
+
const nextStepId = allPrevNodeIds?.includes(nextStepFlow.id) ? `${nextStepFlow.id}-${yIndex + 1}` : nextStepFlow.id;
|
|
7578
|
+
nextNodeIds = [nextStepId];
|
|
7579
|
+
nextStepIds = [nextStepFlow.id];
|
|
7580
|
+
}
|
|
7361
7581
|
if (nextStepFlow?.type === "parallel") {
|
|
7362
7582
|
nextNodeIds = nextStepFlow?.steps.map((step) => {
|
|
7363
7583
|
const stepId = step.step.id;
|
|
@@ -7370,7 +7590,7 @@ const getStepNodeAndEdge = ({
|
|
|
7370
7590
|
nextNodeIds = nextStepFlow?.serializedConditions.map((cond) => cond.id) || [];
|
|
7371
7591
|
nextStepIds = nextStepFlow?.steps?.map((step) => step.step.id) || [];
|
|
7372
7592
|
}
|
|
7373
|
-
if (stepFlow.type === "step" || stepFlow.type === "foreach") {
|
|
7593
|
+
if (stepFlow.type === "step" || stepFlow.type === "foreach" || stepFlow.type === "waitForEvent") {
|
|
7374
7594
|
const hasGraph = stepFlow.step.component === "WORKFLOW";
|
|
7375
7595
|
const nodeId = allPrevNodeIds?.includes(stepFlow.step.id) ? `${stepFlow.step.id}-${yIndex}` : stepFlow.step.id;
|
|
7376
7596
|
const nodes = [
|
|
@@ -7400,7 +7620,8 @@ const getStepNodeAndEdge = ({
|
|
|
7400
7620
|
withoutTopHandle: condition ? false : !prevNodeIds.length,
|
|
7401
7621
|
withoutBottomHandle: !nextNodeIds.length,
|
|
7402
7622
|
stepGraph: hasGraph ? stepFlow.step.serializedStepFlow : void 0,
|
|
7403
|
-
mapConfig: stepFlow.step.mapConfig
|
|
7623
|
+
mapConfig: stepFlow.step.mapConfig,
|
|
7624
|
+
...stepFlow.type === "waitForEvent" ? { event: stepFlow.event } : {}
|
|
7404
7625
|
}
|
|
7405
7626
|
}
|
|
7406
7627
|
];
|
|
@@ -7437,6 +7658,70 @@ const getStepNodeAndEdge = ({
|
|
|
7437
7658
|
];
|
|
7438
7659
|
return { nodes, edges, nextPrevNodeIds: [nodeId], nextPrevStepIds: [stepFlow.step.id] };
|
|
7439
7660
|
}
|
|
7661
|
+
if (stepFlow.type === "sleep" || stepFlow.type === "sleepUntil") {
|
|
7662
|
+
const nodeId = allPrevNodeIds?.includes(stepFlow.id) ? `${stepFlow.id}-${yIndex}` : stepFlow.id;
|
|
7663
|
+
const nodes = [
|
|
7664
|
+
...condition ? [
|
|
7665
|
+
{
|
|
7666
|
+
id: condition.id,
|
|
7667
|
+
position: { x: xIndex * 300, y: yIndex * 100 },
|
|
7668
|
+
type: "condition-node",
|
|
7669
|
+
data: {
|
|
7670
|
+
label: condition.id,
|
|
7671
|
+
previousStepId: prevStepIds[prevStepIds.length - 1],
|
|
7672
|
+
nextStepId: stepFlow.id,
|
|
7673
|
+
withoutTopHandle: false,
|
|
7674
|
+
withoutBottomHandle: !nextNodeIds.length,
|
|
7675
|
+
isLarge: true,
|
|
7676
|
+
conditions: [{ type: "when", fnString: condition.fn }]
|
|
7677
|
+
}
|
|
7678
|
+
}
|
|
7679
|
+
] : [],
|
|
7680
|
+
{
|
|
7681
|
+
id: nodeId,
|
|
7682
|
+
position: { x: xIndex * 300, y: (yIndex + (condition ? 1 : 0)) * 100 },
|
|
7683
|
+
type: "default-node",
|
|
7684
|
+
data: {
|
|
7685
|
+
label: stepFlow.id,
|
|
7686
|
+
withoutTopHandle: condition ? false : !prevNodeIds.length,
|
|
7687
|
+
withoutBottomHandle: !nextNodeIds.length,
|
|
7688
|
+
...stepFlow.type === "sleepUntil" ? { date: stepFlow.date } : { duration: stepFlow.duration }
|
|
7689
|
+
}
|
|
7690
|
+
}
|
|
7691
|
+
];
|
|
7692
|
+
const edges = [
|
|
7693
|
+
...!prevNodeIds.length ? [] : condition ? [
|
|
7694
|
+
...prevNodeIds.map((prevNodeId, i) => ({
|
|
7695
|
+
id: `e${prevNodeId}-${condition.id}`,
|
|
7696
|
+
source: prevNodeId,
|
|
7697
|
+
data: { previousStepId: prevStepIds[i], nextStepId: stepFlow.id },
|
|
7698
|
+
target: condition.id,
|
|
7699
|
+
...defaultEdgeOptions
|
|
7700
|
+
})),
|
|
7701
|
+
{
|
|
7702
|
+
id: `e${condition.id}-${nodeId}`,
|
|
7703
|
+
source: condition.id,
|
|
7704
|
+
data: { previousStepId: prevStepIds[prevStepIds.length - 1], nextStepId: stepFlow.id },
|
|
7705
|
+
target: nodeId,
|
|
7706
|
+
...defaultEdgeOptions
|
|
7707
|
+
}
|
|
7708
|
+
] : prevNodeIds.map((prevNodeId, i) => ({
|
|
7709
|
+
id: `e${prevNodeId}-${nodeId}`,
|
|
7710
|
+
source: prevNodeId,
|
|
7711
|
+
data: { previousStepId: prevStepIds[i], nextStepId: stepFlow.id },
|
|
7712
|
+
target: nodeId,
|
|
7713
|
+
...defaultEdgeOptions
|
|
7714
|
+
})),
|
|
7715
|
+
...!nextNodeIds.length ? [] : nextNodeIds.map((nextNodeId, i) => ({
|
|
7716
|
+
id: `e${nodeId}-${nextNodeId}`,
|
|
7717
|
+
source: nodeId,
|
|
7718
|
+
data: { previousStepId: stepFlow.id, nextStepId: nextStepIds[i] },
|
|
7719
|
+
target: nextNodeId,
|
|
7720
|
+
...defaultEdgeOptions
|
|
7721
|
+
}))
|
|
7722
|
+
];
|
|
7723
|
+
return { nodes, edges, nextPrevNodeIds: [nodeId], nextPrevStepIds: [stepFlow.id] };
|
|
7724
|
+
}
|
|
7440
7725
|
if (stepFlow.type === "loop") {
|
|
7441
7726
|
const { step: _step, serializedCondition, loopType } = stepFlow;
|
|
7442
7727
|
const hasGraph = _step.component === "WORKFLOW";
|
|
@@ -7621,10 +7906,6 @@ const Text = ({ className, weight, variant, as: Tag = "span", size, ...props })
|
|
|
7621
7906
|
return /* @__PURE__ */ jsx(Tag, { className: cn(textVariants({ size, variant, weight, className })), ...props });
|
|
7622
7907
|
};
|
|
7623
7908
|
|
|
7624
|
-
const Collapsible = CollapsiblePrimitive.Root;
|
|
7625
|
-
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
7626
|
-
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
7627
|
-
|
|
7628
7909
|
const ScrollArea = React.forwardRef(
|
|
7629
7910
|
({ className, children, viewPortClassName, maxHeight, autoScroll = false, ...props }, ref) => {
|
|
7630
7911
|
const areaRef = React.useRef(null);
|
|
@@ -7764,7 +8045,8 @@ const useCurrentRun = () => {
|
|
|
7764
8045
|
endedAt: value.endedAt,
|
|
7765
8046
|
status: value.status,
|
|
7766
8047
|
output: value.output,
|
|
7767
|
-
input: value.payload
|
|
8048
|
+
input: value.payload,
|
|
8049
|
+
resumeData: value.resumePayload
|
|
7768
8050
|
}
|
|
7769
8051
|
};
|
|
7770
8052
|
}, {});
|
|
@@ -7796,18 +8078,22 @@ const CodeDialogContent = ({ data }) => {
|
|
|
7796
8078
|
const WorkflowStepActionBar = ({
|
|
7797
8079
|
input,
|
|
7798
8080
|
output,
|
|
8081
|
+
resumeData,
|
|
7799
8082
|
error,
|
|
7800
8083
|
mapConfig,
|
|
7801
8084
|
stepName,
|
|
7802
|
-
onShowTrace
|
|
8085
|
+
onShowTrace,
|
|
8086
|
+
onShowNestedGraph
|
|
7803
8087
|
}) => {
|
|
7804
8088
|
const [isInputOpen, setIsInputOpen] = useState(false);
|
|
7805
8089
|
const [isOutputOpen, setIsOutputOpen] = useState(false);
|
|
8090
|
+
const [isResumeDataOpen, setIsResumeDataOpen] = useState(false);
|
|
7806
8091
|
const [isErrorOpen, setIsErrorOpen] = useState(false);
|
|
7807
8092
|
const [isMapConfigOpen, setIsMapConfigOpen] = useState(false);
|
|
7808
8093
|
const dialogContentClass = "bg-surface2 rounded-lg border-sm border-border1 max-w-4xl w-full px-0";
|
|
7809
8094
|
const dialogTitleClass = "border-b-sm border-border1 pb-4 px-6";
|
|
7810
|
-
return /* @__PURE__ */ jsx(Fragment, { children: (input || output || error || mapConfig) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center bg-surface4 border-t-sm border-border1 px-2 py-1 gap-2 rounded-b-lg", children: [
|
|
8095
|
+
return /* @__PURE__ */ jsx(Fragment, { children: (input || output || error || mapConfig || resumeData || onShowNestedGraph) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center bg-surface4 border-t-sm border-border1 px-2 py-1 gap-2 rounded-b-lg", children: [
|
|
8096
|
+
onShowNestedGraph && /* @__PURE__ */ jsx(Button, { onClick: onShowNestedGraph, children: "View nested graph" }),
|
|
7811
8097
|
mapConfig && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7812
8098
|
/* @__PURE__ */ jsx(Button, { onClick: () => setIsMapConfigOpen(true), children: "Map config" }),
|
|
7813
8099
|
/* @__PURE__ */ jsx(Dialog, { open: isMapConfigOpen, onOpenChange: setIsMapConfigOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: dialogContentClass, children: [
|
|
@@ -7828,6 +8114,16 @@ const WorkflowStepActionBar = ({
|
|
|
7828
8114
|
/* @__PURE__ */ jsx("div", { className: "px-4 overflow-hidden", children: /* @__PURE__ */ jsx(CodeDialogContent, { data: input }) })
|
|
7829
8115
|
] }) })
|
|
7830
8116
|
] }),
|
|
8117
|
+
resumeData && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8118
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => setIsResumeDataOpen(true), children: "Resume data" }),
|
|
8119
|
+
/* @__PURE__ */ jsx(Dialog, { open: isResumeDataOpen, onOpenChange: setIsResumeDataOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: dialogContentClass, children: [
|
|
8120
|
+
/* @__PURE__ */ jsxs(DialogTitle, { className: dialogTitleClass, children: [
|
|
8121
|
+
stepName,
|
|
8122
|
+
" resume data"
|
|
8123
|
+
] }),
|
|
8124
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 overflow-hidden", children: /* @__PURE__ */ jsx(CodeDialogContent, { data: resumeData }) })
|
|
8125
|
+
] }) })
|
|
8126
|
+
] }),
|
|
7831
8127
|
output && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7832
8128
|
/* @__PURE__ */ jsx(Button, { onClick: () => setIsOutputOpen(true), children: "Output" }),
|
|
7833
8129
|
/* @__PURE__ */ jsx(Dialog, { open: isOutputOpen, onOpenChange: setIsOutputOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: dialogContentClass, children: [
|
|
@@ -7961,7 +8257,7 @@ function WorkflowDefaultNode({
|
|
|
7961
8257
|
parentWorkflowName
|
|
7962
8258
|
}) {
|
|
7963
8259
|
const { steps, isRunning, runId } = useCurrentRun();
|
|
7964
|
-
const { label, description, withoutTopHandle, withoutBottomHandle } = data;
|
|
8260
|
+
const { label, description, withoutTopHandle, withoutBottomHandle, mapConfig, event, duration, date } = data;
|
|
7965
8261
|
const fullLabel = parentWorkflowName ? `${parentWorkflowName}.${label}` : label;
|
|
7966
8262
|
const step = steps[fullLabel];
|
|
7967
8263
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -7972,14 +8268,17 @@ function WorkflowDefaultNode({
|
|
|
7972
8268
|
className: cn(
|
|
7973
8269
|
"bg-surface3 rounded-lg w-[274px] border-sm border-border1 pt-2",
|
|
7974
8270
|
step?.status === "success" && "ring-2 ring-accent1",
|
|
7975
|
-
step?.status === "failed" && "ring-2 ring-accent2"
|
|
8271
|
+
step?.status === "failed" && "ring-2 ring-accent2",
|
|
8272
|
+
step?.status === "suspended" && "ring-2 ring-accent3",
|
|
8273
|
+
step?.status === "waiting" && "ring-2 ring-accent5"
|
|
7976
8274
|
),
|
|
7977
8275
|
children: [
|
|
7978
8276
|
/* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2 px-3", !description && "pb-2"), children: [
|
|
7979
8277
|
isRunning && /* @__PURE__ */ jsxs(Icon, { children: [
|
|
7980
8278
|
step?.status === "failed" && /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }),
|
|
7981
8279
|
step?.status === "success" && /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }),
|
|
7982
|
-
step?.status === "suspended" && /* @__PURE__ */ jsx(PauseIcon, { className: "text-
|
|
8280
|
+
step?.status === "suspended" && /* @__PURE__ */ jsx(PauseIcon, { className: "text-accent3" }),
|
|
8281
|
+
step?.status === "waiting" && /* @__PURE__ */ jsx(HourglassIcon, { className: "text-accent5" }),
|
|
7983
8282
|
step?.status === "running" && /* @__PURE__ */ jsx(Loader2, { className: "text-icon6 animate-spin" }),
|
|
7984
8283
|
!step && /* @__PURE__ */ jsx(CircleDashed, { className: "text-icon2" })
|
|
7985
8284
|
] }),
|
|
@@ -7990,14 +8289,30 @@ function WorkflowDefaultNode({
|
|
|
7990
8289
|
] })
|
|
7991
8290
|
] }),
|
|
7992
8291
|
description && /* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 px-3 pb-2", children: description }),
|
|
8292
|
+
event && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon3 px-3 pb-2", children: [
|
|
8293
|
+
"waits for event: ",
|
|
8294
|
+
/* @__PURE__ */ jsx("strong", { children: event })
|
|
8295
|
+
] }),
|
|
8296
|
+
duration && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon3 px-3 pb-2", children: [
|
|
8297
|
+
"sleeps for ",
|
|
8298
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
8299
|
+
duration,
|
|
8300
|
+
"ms"
|
|
8301
|
+
] })
|
|
8302
|
+
] }),
|
|
8303
|
+
date && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon3 px-3 pb-2", children: [
|
|
8304
|
+
"sleeps until ",
|
|
8305
|
+
/* @__PURE__ */ jsx("strong", { children: new Date(date).toLocaleString() })
|
|
8306
|
+
] }),
|
|
7993
8307
|
/* @__PURE__ */ jsx(
|
|
7994
8308
|
WorkflowStepActionBar,
|
|
7995
8309
|
{
|
|
7996
8310
|
stepName: label,
|
|
7997
8311
|
input: step?.input,
|
|
8312
|
+
resumeData: step?.resumeData,
|
|
7998
8313
|
output: step?.output,
|
|
7999
8314
|
error: step?.error,
|
|
8000
|
-
mapConfig
|
|
8315
|
+
mapConfig,
|
|
8001
8316
|
onShowTrace: runId && onShowTrace ? () => onShowTrace?.({ runId, stepName: fullLabel }) : void 0
|
|
8002
8317
|
}
|
|
8003
8318
|
)
|
|
@@ -8060,20 +8375,6 @@ function WorkflowLoopResultNode({ data }) {
|
|
|
8060
8375
|
] });
|
|
8061
8376
|
}
|
|
8062
8377
|
|
|
8063
|
-
const Slider = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
8064
|
-
SliderPrimitive.Root,
|
|
8065
|
-
{
|
|
8066
|
-
ref,
|
|
8067
|
-
className: cn("relative flex w-full touch-none select-none items-center", className),
|
|
8068
|
-
...props,
|
|
8069
|
-
children: [
|
|
8070
|
-
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary/50" }) }),
|
|
8071
|
-
/* @__PURE__ */ jsx(SliderPrimitive.Thumb, { className: "block h-4 w-4 rounded-full border border-primary/50 bg-white shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" })
|
|
8072
|
-
]
|
|
8073
|
-
}
|
|
8074
|
-
));
|
|
8075
|
-
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
8076
|
-
|
|
8077
8378
|
const ZoomSlider = forwardRef(({ className, ...props }) => {
|
|
8078
8379
|
const { zoom } = useViewport();
|
|
8079
8380
|
const { zoomTo, zoomIn, zoomOut, fitView } = useReactFlow();
|
|
@@ -8102,7 +8403,7 @@ const ZoomSlider = forwardRef(({ className, ...props }) => {
|
|
|
8102
8403
|
});
|
|
8103
8404
|
ZoomSlider.displayName = "ZoomSlider";
|
|
8104
8405
|
|
|
8105
|
-
function WorkflowNestedGraph({ stepGraph, open, workflowName }) {
|
|
8406
|
+
function WorkflowNestedGraph({ stepGraph, open, workflowName, onShowTrace }) {
|
|
8106
8407
|
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges({
|
|
8107
8408
|
stepGraph
|
|
8108
8409
|
});
|
|
@@ -8111,11 +8412,11 @@ function WorkflowNestedGraph({ stepGraph, open, workflowName }) {
|
|
|
8111
8412
|
const [edges] = useEdgesState(initialEdges);
|
|
8112
8413
|
const { steps } = useCurrentRun();
|
|
8113
8414
|
const nodeTypes = {
|
|
8114
|
-
"default-node": (props) => /* @__PURE__ */ jsx(WorkflowDefaultNode, { parentWorkflowName: workflowName, ...props }),
|
|
8415
|
+
"default-node": (props) => /* @__PURE__ */ jsx(WorkflowDefaultNode, { parentWorkflowName: workflowName, onShowTrace, ...props }),
|
|
8115
8416
|
"condition-node": WorkflowConditionNode,
|
|
8116
8417
|
"after-node": WorkflowAfterNode,
|
|
8117
8418
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8118
|
-
"nested-node": (props) => /* @__PURE__ */ jsx(WorkflowNestedNode, { parentWorkflowName: workflowName, ...props })
|
|
8419
|
+
"nested-node": (props) => /* @__PURE__ */ jsx(WorkflowNestedNode, { parentWorkflowName: workflowName, onShowTrace, ...props })
|
|
8119
8420
|
};
|
|
8120
8421
|
useEffect(() => {
|
|
8121
8422
|
if (open) {
|
|
@@ -8155,24 +8456,22 @@ function WorkflowNestedGraph({ stepGraph, open, workflowName }) {
|
|
|
8155
8456
|
const WorkflowNestedGraphContext = createContext(
|
|
8156
8457
|
{}
|
|
8157
8458
|
);
|
|
8158
|
-
function WorkflowNestedGraphProvider({
|
|
8459
|
+
function WorkflowNestedGraphProvider({
|
|
8460
|
+
children,
|
|
8461
|
+
onShowTrace
|
|
8462
|
+
}) {
|
|
8159
8463
|
const [stepGraph, setStepGraph] = useState(null);
|
|
8160
8464
|
const [parentStepGraphList, setParentStepGraphList] = useState([]);
|
|
8161
8465
|
const [openDialog, setOpenDialog] = useState(false);
|
|
8162
8466
|
const [label, setLabel] = useState("");
|
|
8163
8467
|
const [fullStep, setFullStep] = useState("");
|
|
8164
|
-
const [switching, setSwitching] = useState(false);
|
|
8165
8468
|
const closeNestedGraph = () => {
|
|
8166
8469
|
if (parentStepGraphList.length) {
|
|
8167
|
-
setSwitching(true);
|
|
8168
8470
|
const lastStepGraph = parentStepGraphList[parentStepGraphList.length - 1];
|
|
8169
8471
|
setStepGraph(lastStepGraph.stepGraph);
|
|
8170
8472
|
setLabel(lastStepGraph.label);
|
|
8171
8473
|
setFullStep(lastStepGraph.fullStep);
|
|
8172
8474
|
setParentStepGraphList(parentStepGraphList.slice(0, -1));
|
|
8173
|
-
setTimeout(() => {
|
|
8174
|
-
setSwitching(false);
|
|
8175
|
-
}, 500);
|
|
8176
8475
|
} else {
|
|
8177
8476
|
setOpenDialog(false);
|
|
8178
8477
|
setStepGraph(null);
|
|
@@ -8186,16 +8485,12 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
8186
8485
|
fullStep: newFullStep
|
|
8187
8486
|
}) => {
|
|
8188
8487
|
if (stepGraph) {
|
|
8189
|
-
setSwitching(true);
|
|
8190
8488
|
setParentStepGraphList([...parentStepGraphList, { stepGraph, label, fullStep }]);
|
|
8191
8489
|
}
|
|
8192
8490
|
setLabel(newLabel);
|
|
8193
8491
|
setFullStep(newFullStep);
|
|
8194
8492
|
setStepGraph(newStepGraph);
|
|
8195
8493
|
setOpenDialog(true);
|
|
8196
|
-
setTimeout(() => {
|
|
8197
|
-
setSwitching(false);
|
|
8198
|
-
}, 500);
|
|
8199
8494
|
};
|
|
8200
8495
|
return /* @__PURE__ */ jsxs(
|
|
8201
8496
|
WorkflowNestedGraphContext.Provider,
|
|
@@ -8207,15 +8502,23 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
8207
8502
|
children: [
|
|
8208
8503
|
children,
|
|
8209
8504
|
/* @__PURE__ */ jsx(Dialog, { open: openDialog, onOpenChange: closeNestedGraph, children: /* @__PURE__ */ jsx(DialogPortal, { children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-[45rem] h-[45rem] max-w-[unset] bg-[#121212] p-[0.5rem]", children: [
|
|
8210
|
-
/* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-1.5 absolute top-
|
|
8505
|
+
/* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-1.5 absolute top-3 left-3 z-50", children: [
|
|
8211
8506
|
/* @__PURE__ */ jsx(Workflow, { className: "text-current w-4 h-4" }),
|
|
8212
8507
|
/* @__PURE__ */ jsxs(Text, { size: "xs", weight: "medium", className: "text-mastra-el-6 capitalize", children: [
|
|
8213
8508
|
label,
|
|
8214
8509
|
" workflow"
|
|
8215
8510
|
] })
|
|
8216
8511
|
] }),
|
|
8217
|
-
|
|
8218
|
-
|
|
8512
|
+
/* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
8513
|
+
WorkflowNestedGraph,
|
|
8514
|
+
{
|
|
8515
|
+
stepGraph,
|
|
8516
|
+
open: openDialog,
|
|
8517
|
+
workflowName: fullStep,
|
|
8518
|
+
onShowTrace
|
|
8519
|
+
}
|
|
8520
|
+
) })
|
|
8521
|
+
] }) }) }, `${label}-${fullStep}`)
|
|
8219
8522
|
]
|
|
8220
8523
|
}
|
|
8221
8524
|
);
|
|
@@ -8223,19 +8526,14 @@ function WorkflowNestedGraphProvider({ children }) {
|
|
|
8223
8526
|
|
|
8224
8527
|
function WorkflowNestedNode({
|
|
8225
8528
|
data,
|
|
8226
|
-
parentWorkflowName
|
|
8529
|
+
parentWorkflowName,
|
|
8530
|
+
onShowTrace
|
|
8227
8531
|
}) {
|
|
8228
|
-
const
|
|
8229
|
-
const [isOutputOpen, setIsOutputOpen] = useState(false);
|
|
8230
|
-
const [isErrorOpen, setIsErrorOpen] = useState(false);
|
|
8231
|
-
const [isMapConfigOpen, setIsMapConfigOpen] = useState(false);
|
|
8232
|
-
const { steps, isRunning } = useCurrentRun();
|
|
8532
|
+
const { steps, isRunning, runId } = useCurrentRun();
|
|
8233
8533
|
const { showNestedGraph } = useContext(WorkflowNestedGraphContext);
|
|
8234
8534
|
const { label, description, withoutTopHandle, withoutBottomHandle, stepGraph, mapConfig } = data;
|
|
8235
8535
|
const fullLabel = parentWorkflowName ? `${parentWorkflowName}.${label}` : label;
|
|
8236
8536
|
const step = steps[fullLabel];
|
|
8237
|
-
const dialogContentClass = "bg-surface2 rounded-lg border-sm border-border1 max-w-4xl w-full px-0";
|
|
8238
|
-
const dialogTitleClass = "border-b-sm border-border1 pb-4 px-6";
|
|
8239
8537
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8240
8538
|
!withoutTopHandle && /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style: { visibility: "hidden" } }),
|
|
8241
8539
|
/* @__PURE__ */ jsxs(
|
|
@@ -8262,49 +8560,19 @@ function WorkflowNestedNode({
|
|
|
8262
8560
|
] })
|
|
8263
8561
|
] }),
|
|
8264
8562
|
description && /* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 px-3 pb-2", children: description }),
|
|
8265
|
-
/* @__PURE__ */
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => setIsInputOpen(true), children: "Input" }),
|
|
8279
|
-
/* @__PURE__ */ jsx(Dialog, { open: isInputOpen, onOpenChange: setIsInputOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: dialogContentClass, children: [
|
|
8280
|
-
/* @__PURE__ */ jsxs(DialogTitle, { className: dialogTitleClass, children: [
|
|
8281
|
-
label,
|
|
8282
|
-
" input"
|
|
8283
|
-
] }),
|
|
8284
|
-
/* @__PURE__ */ jsx("div", { className: "px-4 overflow-hidden", children: /* @__PURE__ */ jsx(CodeDialogContent, { data: step.input }) })
|
|
8285
|
-
] }) })
|
|
8286
|
-
] }),
|
|
8287
|
-
step?.output && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8288
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => setIsOutputOpen(true), children: "Output" }),
|
|
8289
|
-
/* @__PURE__ */ jsx(Dialog, { open: isOutputOpen, onOpenChange: setIsOutputOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: dialogContentClass, children: [
|
|
8290
|
-
/* @__PURE__ */ jsxs(DialogTitle, { className: dialogTitleClass, children: [
|
|
8291
|
-
label,
|
|
8292
|
-
" output"
|
|
8293
|
-
] }),
|
|
8294
|
-
/* @__PURE__ */ jsx("div", { className: "px-4 overflow-hidden", children: /* @__PURE__ */ jsx(CodeDialogContent, { data: step.output }) })
|
|
8295
|
-
] }) })
|
|
8296
|
-
] }),
|
|
8297
|
-
step?.error && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8298
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => setIsErrorOpen(true), children: "Error" }),
|
|
8299
|
-
/* @__PURE__ */ jsx(Dialog, { open: isErrorOpen, onOpenChange: setIsErrorOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: dialogContentClass, children: [
|
|
8300
|
-
/* @__PURE__ */ jsxs(DialogTitle, { className: dialogTitleClass, children: [
|
|
8301
|
-
label,
|
|
8302
|
-
" error"
|
|
8303
|
-
] }),
|
|
8304
|
-
/* @__PURE__ */ jsx("div", { className: "px-4 overflow-hidden", children: /* @__PURE__ */ jsx(CodeDialogContent, { data: step?.error }) })
|
|
8305
|
-
] }) })
|
|
8306
|
-
] })
|
|
8307
|
-
] })
|
|
8563
|
+
/* @__PURE__ */ jsx(
|
|
8564
|
+
WorkflowStepActionBar,
|
|
8565
|
+
{
|
|
8566
|
+
stepName: label,
|
|
8567
|
+
input: step?.input,
|
|
8568
|
+
resumeData: step?.resumeData,
|
|
8569
|
+
output: step?.output,
|
|
8570
|
+
error: step?.error,
|
|
8571
|
+
mapConfig,
|
|
8572
|
+
onShowTrace: runId && onShowTrace ? () => onShowTrace?.({ runId, stepName: fullLabel }) : void 0,
|
|
8573
|
+
onShowNestedGraph: () => showNestedGraph({ label, fullStep: fullLabel, stepGraph })
|
|
8574
|
+
}
|
|
8575
|
+
)
|
|
8308
8576
|
]
|
|
8309
8577
|
}
|
|
8310
8578
|
),
|
|
@@ -8322,7 +8590,7 @@ function WorkflowGraphInner({ workflow, onShowTrace }) {
|
|
|
8322
8590
|
"condition-node": WorkflowConditionNode,
|
|
8323
8591
|
"after-node": WorkflowAfterNode,
|
|
8324
8592
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8325
|
-
"nested-node": WorkflowNestedNode
|
|
8593
|
+
"nested-node": (props) => /* @__PURE__ */ jsx(WorkflowNestedNode, { onShowTrace, ...props })
|
|
8326
8594
|
};
|
|
8327
8595
|
return /* @__PURE__ */ jsx("div", { className: "w-full h-full bg-surface1", children: /* @__PURE__ */ jsxs(
|
|
8328
8596
|
ReactFlow,
|
|
@@ -8367,7 +8635,7 @@ function WorkflowGraph({ workflowId, onShowTrace, workflow, isLoading }) {
|
|
|
8367
8635
|
] })
|
|
8368
8636
|
] }) });
|
|
8369
8637
|
}
|
|
8370
|
-
return /* @__PURE__ */ jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
8638
|
+
return /* @__PURE__ */ jsx(WorkflowNestedGraphProvider, { onShowTrace, children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
8371
8639
|
WorkflowGraphInner,
|
|
8372
8640
|
{
|
|
8373
8641
|
workflow: snapshot?.serializedStepGraph ? { stepGraph: snapshot?.serializedStepGraph } : workflow,
|
|
@@ -8595,9 +8863,14 @@ const useResumeWorkflow = () => {
|
|
|
8595
8863
|
};
|
|
8596
8864
|
|
|
8597
8865
|
const LabelMappings = {
|
|
8866
|
+
"Agent-Network-Outer-Workflow.routing-step": "Decision making process",
|
|
8598
8867
|
"routing-step": "Decision making process",
|
|
8599
8868
|
"agent-step": "Agent execution",
|
|
8869
|
+
"Agent-Network-Outer-Workflow.agent-step": "Agent execution",
|
|
8600
8870
|
"workflow-step": "Workflow execution",
|
|
8871
|
+
"Agent-Network-Outer-Workflow.workflow-step": "Workflow execution",
|
|
8872
|
+
toolStep: "Tool execution",
|
|
8873
|
+
"Agent-Network-Outer-Workflow.toolStep": "Tool execution",
|
|
8601
8874
|
"final-step": "Task completed"
|
|
8602
8875
|
};
|
|
8603
8876
|
const StepDropdown = () => {
|
|
@@ -8607,14 +8880,20 @@ const StepDropdown = () => {
|
|
|
8607
8880
|
const id = message?.metadata?.custom?.id;
|
|
8608
8881
|
if (!id) return /* @__PURE__ */ jsx("div", { children: "Something is wrong" });
|
|
8609
8882
|
const currentState = state[id];
|
|
8610
|
-
const latestStepId = currentState.executionSteps[currentState.executionSteps.length - 1];
|
|
8883
|
+
const latestStepId = currentState.executionSteps ? currentState.executionSteps?.[currentState.executionSteps.length - 1] : "";
|
|
8611
8884
|
const hasFinished = latestStepId === "finish";
|
|
8612
|
-
|
|
8885
|
+
const failed = Object.values(currentState?.steps || {}).some(
|
|
8886
|
+
(step) => step?.["error"] || step?.["step-result"]?.status === "failed"
|
|
8887
|
+
);
|
|
8888
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2 mb-2", children: [
|
|
8613
8889
|
/* @__PURE__ */ jsxs(Button, { onClick: () => setIsExpanded(!isExpanded), children: [
|
|
8614
|
-
hasFinished ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8890
|
+
hasFinished ? /* @__PURE__ */ jsx(Fragment, { children: failed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8891
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }) }),
|
|
8892
|
+
"Failed"
|
|
8893
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8615
8894
|
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }) }),
|
|
8616
8895
|
"Done"
|
|
8617
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8896
|
+
] }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8618
8897
|
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Spinner, { className: "animate-spin" }) }),
|
|
8619
8898
|
"Thinking..."
|
|
8620
8899
|
] }),
|
|
@@ -8626,11 +8905,29 @@ const StepDropdown = () => {
|
|
|
8626
8905
|
const Steps = ({ id }) => {
|
|
8627
8906
|
const { state } = useVNextNetworkChat();
|
|
8628
8907
|
const currentState = state[id];
|
|
8629
|
-
return /* @__PURE__ */ jsx("ol", { className: "flex flex-col gap-px rounded-lg overflow-hidden", children: currentState.executionSteps
|
|
8908
|
+
return /* @__PURE__ */ jsx("ol", { className: "flex flex-col gap-px rounded-lg overflow-hidden", children: currentState.executionSteps?.filter((stepId) => stepId !== "start").map((stepId, index) => /* @__PURE__ */ jsx(StepEntry, { stepId, step: currentState.steps[stepId] || {}, runId: currentState.runId }, index)) });
|
|
8630
8909
|
};
|
|
8631
8910
|
const StepEntry = ({ stepId, step, runId }) => {
|
|
8632
8911
|
const [expanded, setExpanded] = useState(false);
|
|
8633
|
-
|
|
8912
|
+
let stepResult = step["step-result"];
|
|
8913
|
+
const stepError = step["error"];
|
|
8914
|
+
if (stepId === "workflow-step" || stepId === "Agent-Network-Outer-Workflow.workflow-step") {
|
|
8915
|
+
const parsedResult = JSON.parse(stepResult?.output?.result ?? "{}") ?? {};
|
|
8916
|
+
if (!parsedResult?.runResult && stepResult?.status === "success") {
|
|
8917
|
+
stepResult = {
|
|
8918
|
+
...stepResult,
|
|
8919
|
+
status: "failed",
|
|
8920
|
+
error: "Something went wrong"
|
|
8921
|
+
};
|
|
8922
|
+
}
|
|
8923
|
+
}
|
|
8924
|
+
if (stepError) {
|
|
8925
|
+
stepResult = {
|
|
8926
|
+
...stepResult,
|
|
8927
|
+
status: "failed",
|
|
8928
|
+
error: stepError?.data?.error?.message
|
|
8929
|
+
};
|
|
8930
|
+
}
|
|
8634
8931
|
if (stepId === "finish") {
|
|
8635
8932
|
return /* @__PURE__ */ jsx("div", { className: "bg-surface4 py-2 px-3 text-icon6 flex items-center gap-4 justify-between", children: /* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: "Process completed" }) });
|
|
8636
8933
|
}
|
|
@@ -8649,7 +8946,7 @@ const StepEntry = ({ stepId, step, runId }) => {
|
|
|
8649
8946
|
]
|
|
8650
8947
|
}
|
|
8651
8948
|
),
|
|
8652
|
-
stepId === "routing-step" && expanded && /* @__PURE__ */ jsxs("div", { className: "bg-surface1 p-3 space-y-4", children: [
|
|
8949
|
+
(stepId === "routing-step" || stepId === "Agent-Network-Outer-Workflow.routing-step") && expanded && /* @__PURE__ */ jsxs("div", { className: "bg-surface1 p-3 space-y-4", children: [
|
|
8653
8950
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
8654
8951
|
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Selection reason:" }),
|
|
8655
8952
|
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.selectionReason || "N/A" })
|
|
@@ -8657,8 +8954,20 @@ const StepEntry = ({ stepId, step, runId }) => {
|
|
|
8657
8954
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
8658
8955
|
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Resource ID" }),
|
|
8659
8956
|
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.resourceId || "N/A" })
|
|
8660
|
-
] })
|
|
8957
|
+
] }),
|
|
8958
|
+
stepResult?.error ? /* @__PURE__ */ jsxs("div", { children: [
|
|
8959
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Error" }),
|
|
8960
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.error || "N/A" })
|
|
8961
|
+
] }) : null
|
|
8661
8962
|
] }),
|
|
8963
|
+
(stepId === "agent-step" || stepId === "Agent-Network-Outer-Workflow.agent-step") && (stepError || stepResult?.error) && expanded && /* @__PURE__ */ jsx("div", { className: "bg-surface1 p-3 space-y-4", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
8964
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Error" }),
|
|
8965
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepError?.message || stepError?.data?.error?.message || stepResult?.error || "N/A" })
|
|
8966
|
+
] }) }),
|
|
8967
|
+
(stepId === "toolStep" || stepId === "Agent-Network-Outer-Workflow.toolStep") && (stepError || stepResult?.error) && expanded && /* @__PURE__ */ jsx("div", { className: "bg-surface1 p-3 space-y-4", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
8968
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Error" }),
|
|
8969
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepError?.message || stepError?.data?.error?.message || stepResult?.error || "N/A" })
|
|
8970
|
+
] }) }),
|
|
8662
8971
|
stepId === "final-step" && expanded && /* @__PURE__ */ jsxs("div", { className: "bg-surface1 p-3 space-y-4", children: [
|
|
8663
8972
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
8664
8973
|
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3 font-medium", children: "Task:" }),
|
|
@@ -8669,7 +8978,7 @@ const StepEntry = ({ stepId, step, runId }) => {
|
|
|
8669
8978
|
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon6", children: stepResult?.output?.iteration || "N/A" })
|
|
8670
8979
|
] })
|
|
8671
8980
|
] }),
|
|
8672
|
-
stepId === "workflow-step" && stepResult?.output?.resourceId ? /* @__PURE__ */ jsx(
|
|
8981
|
+
(stepId === "workflow-step" || stepId === "Agent-Network-Outer-Workflow.workflow-step") && stepResult?.output?.resourceId ? /* @__PURE__ */ jsx(
|
|
8673
8982
|
WorkflowStepResultDialog,
|
|
8674
8983
|
{
|
|
8675
8984
|
open: expanded,
|
|
@@ -8690,7 +8999,7 @@ const WorkflowStepResultDialog = ({ open, onOpenChange, workflowId, runId }) =>
|
|
|
8690
8999
|
] }) }) }) });
|
|
8691
9000
|
};
|
|
8692
9001
|
const StatusIcon = ({ status }) => {
|
|
8693
|
-
if (status === "
|
|
9002
|
+
if (status === "failed") {
|
|
8694
9003
|
return /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }) });
|
|
8695
9004
|
}
|
|
8696
9005
|
if (status === "success") {
|
|
@@ -8841,7 +9150,7 @@ const SpeechInput = () => {
|
|
|
8841
9150
|
variant: "ghost",
|
|
8842
9151
|
className: "rounded-full",
|
|
8843
9152
|
onClick: () => isListening ? stop() : start(),
|
|
8844
|
-
children: isListening ? /* @__PURE__ */ jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsx(Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
9153
|
+
children: isListening ? /* @__PURE__ */ jsx(CircleStopIcon$1, {}) : /* @__PURE__ */ jsx(Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
8845
9154
|
}
|
|
8846
9155
|
);
|
|
8847
9156
|
};
|
|
@@ -8857,7 +9166,7 @@ const ComposerAction = ({ showFileSupport }) => {
|
|
|
8857
9166
|
children: /* @__PURE__ */ jsx(ArrowUp, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
8858
9167
|
}
|
|
8859
9168
|
) }) }),
|
|
8860
|
-
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsx(ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsx(CircleStopIcon, {}) }) }) })
|
|
9169
|
+
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsx(ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsx(CircleStopIcon$1, {}) }) }) })
|
|
8861
9170
|
] });
|
|
8862
9171
|
};
|
|
8863
9172
|
const EditComposer = () => {
|
|
@@ -8869,7 +9178,7 @@ const EditComposer = () => {
|
|
|
8869
9178
|
] })
|
|
8870
9179
|
] });
|
|
8871
9180
|
};
|
|
8872
|
-
const CircleStopIcon = () => {
|
|
9181
|
+
const CircleStopIcon$1 = () => {
|
|
8873
9182
|
return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
|
|
8874
9183
|
};
|
|
8875
9184
|
|
|
@@ -8932,26 +9241,30 @@ function VNextMastraNetworkRuntimeProvider({
|
|
|
8932
9241
|
const hasFinished = Boolean(currentState?.steps?.["finish"]);
|
|
8933
9242
|
if (!hasFinished) return;
|
|
8934
9243
|
const workflowStep = currentState?.steps?.["workflow-step"];
|
|
8935
|
-
|
|
9244
|
+
const toolStep = currentState?.steps?.["toolStep"];
|
|
9245
|
+
if (!workflowStep && !toolStep) return;
|
|
8936
9246
|
const workflowStepResult = workflowStep?.["step-result"];
|
|
8937
|
-
|
|
9247
|
+
const toolStepResult = toolStep?.["step-result"];
|
|
9248
|
+
if (!workflowStepResult && !toolStepResult) return;
|
|
8938
9249
|
const workflowStepResultOutput = workflowStepResult?.output;
|
|
8939
|
-
|
|
9250
|
+
const toolStepResultOutput = toolStepResult?.output;
|
|
9251
|
+
if (!workflowStepResultOutput && !toolStepResultOutput) return;
|
|
8940
9252
|
const run = async () => {
|
|
8941
|
-
const parsedResult = JSON.parse(workflowStepResult?.output?.result ?? "{}") ?? {};
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
9253
|
+
const parsedResult = workflowStepResult ? JSON.parse(workflowStepResult?.output?.result ?? "{}") ?? {} : { runResult: toolStepResultOutput?.result ?? {} };
|
|
9254
|
+
if (parsedResult?.runResult) {
|
|
9255
|
+
const runResult = parsedResult?.runResult ?? {};
|
|
9256
|
+
const formatted = await formatJSON(JSON.stringify(runResult));
|
|
9257
|
+
setMessages((msgs) => [
|
|
9258
|
+
...msgs,
|
|
9259
|
+
{ role: "assistant", content: [{ type: "text", text: `\`\`\`json
|
|
8947
9260
|
${formatted}\`\`\`` }] }
|
|
8948
|
-
|
|
9261
|
+
]);
|
|
9262
|
+
}
|
|
8949
9263
|
};
|
|
8950
9264
|
run();
|
|
8951
9265
|
}, [currentState]);
|
|
8952
9266
|
useEffect(() => {
|
|
8953
|
-
|
|
8954
|
-
if (messages.length === 0 || currentThreadId !== threadId || hasNewInitialMessages && currentThreadId === threadId) {
|
|
9267
|
+
if (messages.length === 0 || currentThreadId !== threadId) {
|
|
8955
9268
|
const run = async (result, messageId) => {
|
|
8956
9269
|
const formatted = await formatJSON(result);
|
|
8957
9270
|
const finalResponse = `\`\`\`json
|
|
@@ -8966,84 +9279,219 @@ ${formatted}\`\`\``;
|
|
|
8966
9279
|
});
|
|
8967
9280
|
};
|
|
8968
9281
|
if (initialMessages && threadId && memory) {
|
|
8969
|
-
|
|
9282
|
+
let userMessage = "";
|
|
9283
|
+
let iteration = 1;
|
|
9284
|
+
const formattedMessages = [];
|
|
9285
|
+
let assistantStep = freshAssistantStep();
|
|
9286
|
+
for (let i = 0; i < initialMessages.length; i++) {
|
|
9287
|
+
const message = initialMessages[i];
|
|
8970
9288
|
if (message.role === "user") {
|
|
8971
|
-
|
|
9289
|
+
assistantStep = freshAssistantStep();
|
|
9290
|
+
userMessage = message.content;
|
|
9291
|
+
formattedMessages.push({
|
|
9292
|
+
role: "user",
|
|
9293
|
+
message
|
|
9294
|
+
});
|
|
9295
|
+
continue;
|
|
8972
9296
|
}
|
|
8973
9297
|
if (message.role === "assistant") {
|
|
8974
|
-
const
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
const
|
|
8980
|
-
|
|
8981
|
-
|
|
9298
|
+
const responseArray = message.parts ?? [];
|
|
9299
|
+
let hasRoutingDecision = false;
|
|
9300
|
+
let hasTaskCompleteDecision = false;
|
|
9301
|
+
let directText = "";
|
|
9302
|
+
let jsonStringResponse = "";
|
|
9303
|
+
for (const part of responseArray) {
|
|
9304
|
+
if (part.type === "text" && part.text) {
|
|
9305
|
+
const parsed = safeParse(part.text);
|
|
9306
|
+
if (parsed?.resourceId && parsed?.resourceType) {
|
|
9307
|
+
hasRoutingDecision = true;
|
|
9308
|
+
assistantStep.routingDecision = parsed;
|
|
9309
|
+
}
|
|
9310
|
+
if (typeof parsed?.isComplete === "boolean") {
|
|
9311
|
+
hasTaskCompleteDecision = true;
|
|
9312
|
+
assistantStep.taskCompleteDecision = parsed;
|
|
9313
|
+
if (parsed?.isComplete) {
|
|
9314
|
+
assistantStep.finalResponse = parsed.finalResult;
|
|
9315
|
+
formattedMessages.push({ role: "assistant", message: assistantStep });
|
|
9316
|
+
assistantStep = freshAssistantStep();
|
|
9317
|
+
}
|
|
9318
|
+
}
|
|
9319
|
+
if (!parsed || !parsed.resourceId && !parsed.runResult && typeof parsed.isComplete !== "boolean") {
|
|
9320
|
+
directText = part.text;
|
|
9321
|
+
}
|
|
9322
|
+
if (parsed && !parsed.resourceId && typeof parsed.isComplete !== "boolean") {
|
|
9323
|
+
jsonStringResponse = part.text;
|
|
9324
|
+
}
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9327
|
+
if (!hasRoutingDecision && !hasTaskCompleteDecision) {
|
|
9328
|
+
assistantStep.finalResponse = directText || jsonStringResponse;
|
|
9329
|
+
if (assistantStep.routingDecision || assistantStep.finalResponse) {
|
|
9330
|
+
formattedMessages.push({ role: "assistant", message: assistantStep });
|
|
9331
|
+
assistantStep = freshAssistantStep();
|
|
9332
|
+
}
|
|
9333
|
+
}
|
|
9334
|
+
}
|
|
9335
|
+
if (i === initialMessages.length - 1 && (assistantStep.routingDecision || assistantStep.finalResponse)) {
|
|
9336
|
+
formattedMessages.push({ role: "assistant", message: assistantStep });
|
|
9337
|
+
}
|
|
9338
|
+
}
|
|
9339
|
+
for (const formattedMessage of formattedMessages) {
|
|
9340
|
+
const { role, message } = formattedMessage;
|
|
9341
|
+
if (role === "user") {
|
|
9342
|
+
iteration = 1;
|
|
9343
|
+
userMessage = message.content;
|
|
9344
|
+
setMessages((currentConversation) => {
|
|
9345
|
+
if (currentConversation.some((m) => m.id === message.id)) {
|
|
9346
|
+
return currentConversation;
|
|
9347
|
+
}
|
|
9348
|
+
return [...currentConversation, message];
|
|
9349
|
+
});
|
|
9350
|
+
}
|
|
9351
|
+
if (role === "assistant") {
|
|
9352
|
+
const { id: id2, formattedMessageId, finalStepId, routingDecision, finalResponse, taskCompleteDecision } = message;
|
|
9353
|
+
let resourceStepId = "";
|
|
9354
|
+
if (routingDecision?.resourceType === "agent") resourceStepId = "agent-step";
|
|
9355
|
+
if (routingDecision?.resourceType === "tool") resourceStepId = "toolStep";
|
|
9356
|
+
if (routingDecision?.resourceType === "workflow") resourceStepId = "workflow-step";
|
|
8982
9357
|
let runId = "";
|
|
8983
9358
|
let runResult = {};
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
9359
|
+
let finalStep = null;
|
|
9360
|
+
let finalResult = "";
|
|
9361
|
+
if (resourceStepId === "workflow-step" || resourceStepId === "toolStep") {
|
|
9362
|
+
const parsedResult = JSON.parse(finalResponse ?? "{}") ?? {};
|
|
9363
|
+
runResult = resourceStepId === "workflow-step" ? parsedResult?.runResult ?? {} : parsedResult ?? {};
|
|
8987
9364
|
runId = parsedResult?.runId ?? "";
|
|
8988
9365
|
}
|
|
9366
|
+
if (taskCompleteDecision?.isComplete) {
|
|
9367
|
+
finalStep = {
|
|
9368
|
+
executionSteps: ["start", "routing-step", "final-step", "finish"],
|
|
9369
|
+
runId: "",
|
|
9370
|
+
steps: {
|
|
9371
|
+
start: {},
|
|
9372
|
+
"routing-step": {
|
|
9373
|
+
"step-result": {
|
|
9374
|
+
output: {
|
|
9375
|
+
selectionReason: taskCompleteDecision?.completionReason ?? ""
|
|
9376
|
+
},
|
|
9377
|
+
status: "success"
|
|
9378
|
+
}
|
|
9379
|
+
},
|
|
9380
|
+
"final-step": {
|
|
9381
|
+
"step-result": {
|
|
9382
|
+
output: {
|
|
9383
|
+
iteration,
|
|
9384
|
+
task: userMessage
|
|
9385
|
+
},
|
|
9386
|
+
status: "success"
|
|
9387
|
+
}
|
|
9388
|
+
},
|
|
9389
|
+
finish: {}
|
|
9390
|
+
}
|
|
9391
|
+
};
|
|
9392
|
+
finalResult = taskCompleteDecision?.finalResult;
|
|
9393
|
+
}
|
|
9394
|
+
const routingStepFailed = resourceStepId === "workflow-step" || resourceStepId === "toolStep" ? Object.keys(runResult).length === 0 : !finalResponse;
|
|
8989
9395
|
setState((currentState2) => {
|
|
8990
9396
|
return {
|
|
8991
9397
|
...currentState2,
|
|
8992
|
-
[
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
"step
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9398
|
+
...finalStep ? { [finalStepId]: finalStep } : {
|
|
9399
|
+
[id2]: {
|
|
9400
|
+
executionSteps: ["start", "routing-step", resourceStepId, "finish"],
|
|
9401
|
+
runId,
|
|
9402
|
+
steps: {
|
|
9403
|
+
start: {},
|
|
9404
|
+
"routing-step": {
|
|
9405
|
+
"step-result": {
|
|
9406
|
+
output: routingDecision,
|
|
9407
|
+
status: routingDecision ? "success" : "failed",
|
|
9408
|
+
...routingDecision ? {} : { error: "Something went wrong" }
|
|
9409
|
+
}
|
|
9410
|
+
},
|
|
9411
|
+
[resourceStepId]: {
|
|
9412
|
+
"step-result": {
|
|
9413
|
+
output: {
|
|
9414
|
+
resourceId: routingDecision?.resourceId,
|
|
9415
|
+
result: finalResponse ?? ""
|
|
9416
|
+
},
|
|
9417
|
+
status: routingStepFailed ? "failed" : "success",
|
|
9418
|
+
...routingStepFailed ? { error: "Something went wrong" } : {}
|
|
9419
|
+
}
|
|
9420
|
+
},
|
|
9421
|
+
finish: {}
|
|
9422
|
+
}
|
|
9012
9423
|
}
|
|
9013
9424
|
}
|
|
9014
9425
|
};
|
|
9015
9426
|
});
|
|
9016
9427
|
setMessages((currentConversation) => {
|
|
9428
|
+
const assistantRoutingMessageExist = currentConversation.some(
|
|
9429
|
+
(message2) => message2.metadata?.custom?.id === id2
|
|
9430
|
+
);
|
|
9431
|
+
const assistantResponseMessageExist = currentConversation.some(
|
|
9432
|
+
(message2) => message2.metadata?.custom?.id === formattedMessageId
|
|
9433
|
+
);
|
|
9017
9434
|
return [
|
|
9018
9435
|
...currentConversation,
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9436
|
+
...finalResult ? [
|
|
9437
|
+
{
|
|
9438
|
+
role: "assistant",
|
|
9439
|
+
metadata: {
|
|
9440
|
+
custom: {
|
|
9441
|
+
id: finalStepId
|
|
9442
|
+
}
|
|
9443
|
+
},
|
|
9444
|
+
content: [
|
|
9445
|
+
{
|
|
9446
|
+
type: "text",
|
|
9447
|
+
text: "start"
|
|
9448
|
+
}
|
|
9449
|
+
]
|
|
9025
9450
|
},
|
|
9026
|
-
|
|
9451
|
+
{
|
|
9452
|
+
role: "assistant",
|
|
9453
|
+
content: [{ type: "text", text: finalResult }]
|
|
9454
|
+
}
|
|
9455
|
+
] : [
|
|
9456
|
+
...assistantRoutingMessageExist ? [] : [
|
|
9027
9457
|
{
|
|
9028
|
-
|
|
9029
|
-
|
|
9458
|
+
role: "assistant",
|
|
9459
|
+
metadata: {
|
|
9460
|
+
custom: {
|
|
9461
|
+
id: id2
|
|
9462
|
+
}
|
|
9463
|
+
},
|
|
9464
|
+
content: [
|
|
9465
|
+
{
|
|
9466
|
+
type: "text",
|
|
9467
|
+
text: "start"
|
|
9468
|
+
}
|
|
9469
|
+
]
|
|
9030
9470
|
}
|
|
9031
|
-
]
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9471
|
+
],
|
|
9472
|
+
...assistantResponseMessageExist ? [] : [
|
|
9473
|
+
{
|
|
9474
|
+
role: "assistant",
|
|
9475
|
+
content: [
|
|
9476
|
+
{
|
|
9477
|
+
type: "text",
|
|
9478
|
+
text: resourceStepId === "workflow-step" || resourceStepId === "toolStep" ? "" : finalResponse
|
|
9479
|
+
}
|
|
9480
|
+
],
|
|
9481
|
+
metadata: {
|
|
9482
|
+
custom: {
|
|
9483
|
+
id: formattedMessageId
|
|
9484
|
+
}
|
|
9485
|
+
}
|
|
9039
9486
|
}
|
|
9040
|
-
|
|
9041
|
-
|
|
9487
|
+
]
|
|
9488
|
+
]
|
|
9042
9489
|
];
|
|
9043
9490
|
});
|
|
9044
|
-
if (resourceStepId === "workflow-step") {
|
|
9491
|
+
if ((resourceStepId === "workflow-step" || resourceStepId === "toolStep") && !routingStepFailed) {
|
|
9045
9492
|
run(JSON.stringify(runResult), formattedMessageId);
|
|
9046
9493
|
}
|
|
9494
|
+
iteration++;
|
|
9047
9495
|
}
|
|
9048
9496
|
}
|
|
9049
9497
|
setCurrentThreadId(threadId);
|
|
@@ -9119,9 +9567,10 @@ ${formatted}\`\`\``;
|
|
|
9119
9567
|
handleStep(runIdRef.current, { ...record, type: "finish" });
|
|
9120
9568
|
runIdRef.current = void 0;
|
|
9121
9569
|
}
|
|
9122
|
-
} else if (record.type === "step-result" && record.payload?.id === "workflow-step") {
|
|
9570
|
+
} else if (record.type === "step-result" && (record.payload?.id === "Agent-Network-Outer-Workflow.workflow-step" || record.payload?.id === "Agent-Network-Outer-Workflow.toolStep")) {
|
|
9123
9571
|
handleStep(runIdRef.current, record);
|
|
9124
|
-
const
|
|
9572
|
+
const result = record?.payload?.output?.result;
|
|
9573
|
+
const parsedResult = typeof result === "string" ? JSON.parse(record?.payload?.output?.result ?? "{}") ?? {} : { runResult: result };
|
|
9125
9574
|
const runResult = parsedResult?.runResult ?? {};
|
|
9126
9575
|
const formatedOutputId = v4();
|
|
9127
9576
|
setMessages((msgs) => [
|
|
@@ -9160,9 +9609,11 @@ ${formatted}\`\`\``;
|
|
|
9160
9609
|
if (record.type === "step-finish" && record.payload?.id === "final-step") {
|
|
9161
9610
|
runIdRef.current = void 0;
|
|
9162
9611
|
}
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9612
|
+
if (record.type === "start" || record.type === "step-start" || record.type === "finish") {
|
|
9613
|
+
setTimeout(() => {
|
|
9614
|
+
refreshThreadList?.();
|
|
9615
|
+
}, 500);
|
|
9616
|
+
}
|
|
9166
9617
|
}
|
|
9167
9618
|
);
|
|
9168
9619
|
} else {
|
|
@@ -9178,9 +9629,6 @@ ${formatted}\`\`\``;
|
|
|
9178
9629
|
appendToLastMessage(record.argsTextDelta);
|
|
9179
9630
|
} else if (record.type === "tool-call-streaming-start") {
|
|
9180
9631
|
setMessages((msgs) => [...msgs, { role: "assistant", content: [{ type: "text", text: "" }] }]);
|
|
9181
|
-
setTimeout(() => {
|
|
9182
|
-
refreshThreadList?.();
|
|
9183
|
-
}, 500);
|
|
9184
9632
|
return;
|
|
9185
9633
|
} else {
|
|
9186
9634
|
handleStep(runIdRef.current, record);
|
|
@@ -9208,9 +9656,11 @@ ${formatted}\`\`\``;
|
|
|
9208
9656
|
];
|
|
9209
9657
|
});
|
|
9210
9658
|
}
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9659
|
+
if (record.type === "start" || record.type === "step-start" || record.type === "finish") {
|
|
9660
|
+
setTimeout(() => {
|
|
9661
|
+
refreshThreadList?.();
|
|
9662
|
+
}, 500);
|
|
9663
|
+
}
|
|
9214
9664
|
}
|
|
9215
9665
|
);
|
|
9216
9666
|
}
|
|
@@ -9231,6 +9681,21 @@ ${formatted}\`\`\``;
|
|
|
9231
9681
|
children,
|
|
9232
9682
|
" "
|
|
9233
9683
|
] });
|
|
9684
|
+
function safeParse(str) {
|
|
9685
|
+
try {
|
|
9686
|
+
return JSON.parse(str);
|
|
9687
|
+
} catch {
|
|
9688
|
+
return void 0;
|
|
9689
|
+
}
|
|
9690
|
+
}
|
|
9691
|
+
function freshAssistantStep() {
|
|
9692
|
+
return {
|
|
9693
|
+
id: v4(),
|
|
9694
|
+
formattedMessageId: v4(),
|
|
9695
|
+
finalStepId: v4(),
|
|
9696
|
+
finalResponse: ""
|
|
9697
|
+
};
|
|
9698
|
+
}
|
|
9234
9699
|
}
|
|
9235
9700
|
|
|
9236
9701
|
const VNextNetworkChat = ({
|
|
@@ -10167,10 +10632,6 @@ class CustomZodProvider extends ZodProvider {
|
|
|
10167
10632
|
}
|
|
10168
10633
|
}
|
|
10169
10634
|
|
|
10170
|
-
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
10171
|
-
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
10172
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
10173
|
-
|
|
10174
10635
|
function isEmptyZodObject(schema) {
|
|
10175
10636
|
if (schema instanceof ZodObject) {
|
|
10176
10637
|
return Object.keys(schema.shape).length === 0;
|
|
@@ -10249,9 +10710,13 @@ function CodeBlockDemo({
|
|
|
10249
10710
|
}
|
|
10250
10711
|
|
|
10251
10712
|
const WorkflowCard = ({ header, children, footer }) => {
|
|
10713
|
+
const [expanded, setExpanded] = useState(false);
|
|
10252
10714
|
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border-sm border-border1 bg-surface4", children: [
|
|
10253
|
-
/* @__PURE__ */
|
|
10254
|
-
|
|
10715
|
+
/* @__PURE__ */ jsxs("button", { className: "py-1 px-2 flex items-center gap-3 justify-between w-full", onClick: () => setExpanded((s) => !s), children: [
|
|
10716
|
+
/* @__PURE__ */ jsx("div", { className: "w-full", children: header }),
|
|
10717
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("text-icon3 transition-transform -rotate-90", expanded && "rotate-0") }) })
|
|
10718
|
+
] }),
|
|
10719
|
+
children && expanded && /* @__PURE__ */ jsx("div", { className: "border-t-sm border-border1", children }),
|
|
10255
10720
|
footer && /* @__PURE__ */ jsx("div", { className: "py-1 px-2 border-t-sm border-border1", children: footer })
|
|
10256
10721
|
] });
|
|
10257
10722
|
};
|
|
@@ -10454,33 +10919,59 @@ function LegacyWorkflowTrigger({
|
|
|
10454
10919
|
] }) });
|
|
10455
10920
|
}
|
|
10456
10921
|
|
|
10922
|
+
const WorkflowStatus = ({ stepId, status, result }) => {
|
|
10923
|
+
return /* @__PURE__ */ jsx(
|
|
10924
|
+
WorkflowCard,
|
|
10925
|
+
{
|
|
10926
|
+
header: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
10927
|
+
/* @__PURE__ */ jsxs(Icon, { children: [
|
|
10928
|
+
status === "success" && /* @__PURE__ */ jsx(CheckIcon, { className: "text-accent1" }),
|
|
10929
|
+
status === "failed" && /* @__PURE__ */ jsx(CrossIcon, { className: "text-accent2" }),
|
|
10930
|
+
status === "suspended" && /* @__PURE__ */ jsx(CirclePause, { className: "text-accent3" }),
|
|
10931
|
+
status === "waiting" && /* @__PURE__ */ jsx(HourglassIcon, { className: "text-accent5" }),
|
|
10932
|
+
status === "running" && /* @__PURE__ */ jsx(Loader2, { className: "text-icon3 animate-spin" })
|
|
10933
|
+
] }),
|
|
10934
|
+
/* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-lg", className: "text-icon6 font-medium", children: stepId.charAt(0).toUpperCase() + stepId.slice(1) })
|
|
10935
|
+
] }),
|
|
10936
|
+
children: /* @__PURE__ */ jsxs("div", { className: "rounded-md bg-surface4 p-1 font-mono relative", children: [
|
|
10937
|
+
/* @__PURE__ */ jsx(CopyButton, { content: JSON.stringify(result, null, 2), className: "absolute top-2 right-2 z-10" }),
|
|
10938
|
+
/* @__PURE__ */ jsx(SyntaxHighlighter, { data: result })
|
|
10939
|
+
] })
|
|
10940
|
+
}
|
|
10941
|
+
);
|
|
10942
|
+
};
|
|
10943
|
+
|
|
10457
10944
|
function WorkflowTrigger({
|
|
10458
10945
|
workflowId,
|
|
10459
10946
|
setRunId,
|
|
10460
10947
|
workflow,
|
|
10461
10948
|
isLoading,
|
|
10462
10949
|
createWorkflowRun,
|
|
10463
|
-
startWorkflowRun,
|
|
10464
10950
|
resumeWorkflow,
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
isResumingWorkflow
|
|
10951
|
+
streamWorkflow,
|
|
10952
|
+
isStreamingWorkflow,
|
|
10953
|
+
streamResult,
|
|
10954
|
+
isResumingWorkflow,
|
|
10955
|
+
isCancellingWorkflowRun,
|
|
10956
|
+
cancelWorkflowRun
|
|
10469
10957
|
}) {
|
|
10470
10958
|
const { runtimeContext } = usePlaygroundStore();
|
|
10471
10959
|
const { result, setResult, payload, setPayload } = useContext(WorkflowRunContext);
|
|
10472
10960
|
const [suspendedSteps, setSuspendedSteps] = useState([]);
|
|
10473
10961
|
const [isRunning, setIsRunning] = useState(false);
|
|
10962
|
+
const [innerRunId, setInnerRunId] = useState("");
|
|
10963
|
+
const [cancelResponse, setCancelResponse] = useState(null);
|
|
10474
10964
|
const triggerSchema = workflow?.inputSchema;
|
|
10475
10965
|
const handleExecuteWorkflow = async (data) => {
|
|
10476
10966
|
try {
|
|
10477
10967
|
if (!workflow) return;
|
|
10478
10968
|
setIsRunning(true);
|
|
10969
|
+
setCancelResponse(null);
|
|
10479
10970
|
setResult(null);
|
|
10480
10971
|
const { runId } = await createWorkflowRun({ workflowId });
|
|
10481
10972
|
setRunId?.(runId);
|
|
10482
|
-
|
|
10483
|
-
|
|
10973
|
+
setInnerRunId(runId);
|
|
10974
|
+
streamWorkflow({ workflowId, runId, inputData: data, runtimeContext });
|
|
10484
10975
|
} catch (err) {
|
|
10485
10976
|
setIsRunning(false);
|
|
10486
10977
|
toast.error("Error executing workflow");
|
|
@@ -10488,9 +10979,9 @@ function WorkflowTrigger({
|
|
|
10488
10979
|
};
|
|
10489
10980
|
const handleResumeWorkflow = async (step) => {
|
|
10490
10981
|
if (!workflow) return;
|
|
10982
|
+
setCancelResponse(null);
|
|
10491
10983
|
const { stepId, runId: prevRunId, resumeData } = step;
|
|
10492
10984
|
const { runId } = await createWorkflowRun({ workflowId, prevRunId });
|
|
10493
|
-
watchWorkflow({ workflowId, runId });
|
|
10494
10985
|
await resumeWorkflow({
|
|
10495
10986
|
step: stepId,
|
|
10496
10987
|
runId,
|
|
@@ -10499,25 +10990,29 @@ function WorkflowTrigger({
|
|
|
10499
10990
|
runtimeContext
|
|
10500
10991
|
});
|
|
10501
10992
|
};
|
|
10502
|
-
const
|
|
10993
|
+
const handleCancelWorkflowRun = async () => {
|
|
10994
|
+
const response = await cancelWorkflowRun({ workflowId, runId: innerRunId });
|
|
10995
|
+
setCancelResponse(response);
|
|
10996
|
+
};
|
|
10997
|
+
const streamResultToUse = result ?? streamResult;
|
|
10503
10998
|
useEffect(() => {
|
|
10504
|
-
setIsRunning(
|
|
10505
|
-
}, [
|
|
10999
|
+
setIsRunning(isStreamingWorkflow);
|
|
11000
|
+
}, [isStreamingWorkflow]);
|
|
10506
11001
|
useEffect(() => {
|
|
10507
|
-
if (!
|
|
10508
|
-
const suspended = Object.entries(
|
|
11002
|
+
if (!streamResultToUse?.payload?.workflowState?.steps || !result?.runId) return;
|
|
11003
|
+
const suspended = Object.entries(streamResultToUse.payload.workflowState.steps).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
|
|
10509
11004
|
stepId,
|
|
10510
11005
|
runId: result.runId,
|
|
10511
11006
|
suspendPayload: payload2,
|
|
10512
11007
|
isLoading: false
|
|
10513
11008
|
}));
|
|
10514
11009
|
setSuspendedSteps(suspended);
|
|
10515
|
-
}, [
|
|
11010
|
+
}, [streamResultToUse, result]);
|
|
10516
11011
|
useEffect(() => {
|
|
10517
|
-
if (
|
|
10518
|
-
setResult(
|
|
11012
|
+
if (streamResult) {
|
|
11013
|
+
setResult(streamResult);
|
|
10519
11014
|
}
|
|
10520
|
-
}, [
|
|
11015
|
+
}, [streamResult]);
|
|
10521
11016
|
if (isLoading) {
|
|
10522
11017
|
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: [
|
|
10523
11018
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-10" }),
|
|
@@ -10527,10 +11022,23 @@ function WorkflowTrigger({
|
|
|
10527
11022
|
if (!workflow) return null;
|
|
10528
11023
|
const isSuspendedSteps = suspendedSteps.length > 0;
|
|
10529
11024
|
const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(triggerSchema))) : null;
|
|
10530
|
-
const
|
|
11025
|
+
const workflowActivePaths = streamResultToUse?.payload?.workflowState?.steps ?? {};
|
|
11026
|
+
const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
|
|
10531
11027
|
return /* @__PURE__ */ jsxs("div", { className: "h-full pt-3 pb-12", children: [
|
|
10532
11028
|
/* @__PURE__ */ jsxs("div", { className: "space-y-4 px-5 pb-5 border-b-sm border-border1", children: [
|
|
10533
|
-
|
|
11029
|
+
result?.runId && /* @__PURE__ */ jsxs(
|
|
11030
|
+
Button,
|
|
11031
|
+
{
|
|
11032
|
+
variant: "light",
|
|
11033
|
+
onClick: handleCancelWorkflowRun,
|
|
11034
|
+
disabled: !!cancelResponse?.message || isCancellingWorkflowRun,
|
|
11035
|
+
children: [
|
|
11036
|
+
isCancellingWorkflowRun ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CircleStopIcon, {}) }),
|
|
11037
|
+
cancelResponse?.message || "Cancel Workflow Run"
|
|
11038
|
+
]
|
|
11039
|
+
}
|
|
11040
|
+
),
|
|
11041
|
+
(isResumingWorkflow || isSuspendedSteps && isStreamingWorkflow) && /* @__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: [
|
|
10534
11042
|
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin text-icon6" }) }),
|
|
10535
11043
|
/* @__PURE__ */ jsx(Txt, { children: "Resuming workflow" })
|
|
10536
11044
|
] }),
|
|
@@ -10539,7 +11047,7 @@ function WorkflowTrigger({
|
|
|
10539
11047
|
{
|
|
10540
11048
|
schema: zodInputSchema,
|
|
10541
11049
|
defaultValues: payload,
|
|
10542
|
-
isSubmitLoading:
|
|
11050
|
+
isSubmitLoading: isStreamingWorkflow,
|
|
10543
11051
|
submitButtonLabel: "Run",
|
|
10544
11052
|
onSubmit: (data) => {
|
|
10545
11053
|
setPayload(data);
|
|
@@ -10556,8 +11064,9 @@ function WorkflowTrigger({
|
|
|
10556
11064
|
children: isRunning ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : "Trigger"
|
|
10557
11065
|
}
|
|
10558
11066
|
) }),
|
|
10559
|
-
!
|
|
10560
|
-
const stepDefinition = workflow.
|
|
11067
|
+
!isStreamingWorkflow && isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
11068
|
+
const stepDefinition = workflow.allSteps[step.stepId];
|
|
11069
|
+
if (!stepDefinition || stepDefinition.isWorkflow) return null;
|
|
10561
11070
|
const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(stepDefinition.resumeSchema))) : z.record(z.string(), z.any());
|
|
10562
11071
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-4", children: [
|
|
10563
11072
|
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
|
|
@@ -10576,18 +11085,28 @@ function WorkflowTrigger({
|
|
|
10576
11085
|
isSubmitLoading: isResumingWorkflow,
|
|
10577
11086
|
submitButtonLabel: "Resume",
|
|
10578
11087
|
onSubmit: (data) => {
|
|
11088
|
+
const stepIds = step.stepId?.split(".");
|
|
10579
11089
|
handleResumeWorkflow({
|
|
10580
|
-
stepId:
|
|
11090
|
+
stepId: stepIds,
|
|
10581
11091
|
runId: step.runId,
|
|
10582
11092
|
suspendPayload: step.suspendPayload,
|
|
10583
11093
|
resumeData: data});
|
|
10584
11094
|
}
|
|
10585
11095
|
}
|
|
10586
11096
|
)
|
|
10587
|
-
] });
|
|
10588
|
-
})
|
|
11097
|
+
] }, step.stepId);
|
|
11098
|
+
}),
|
|
11099
|
+
hasWorkflowActivePaths && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11100
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
11101
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
11102
|
+
/* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
|
|
11103
|
+
/* @__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, output }]) => {
|
|
11104
|
+
return /* @__PURE__ */ jsx(WorkflowStatus, { stepId, status, result: output ?? {} }, stepId);
|
|
11105
|
+
}) })
|
|
11106
|
+
] })
|
|
11107
|
+
] })
|
|
10589
11108
|
] }),
|
|
10590
|
-
result && /* @__PURE__ */ jsx("div", { className: "p-5 border-b-sm border-border1", children: /* @__PURE__ */ jsx(WorkflowJsonDialog, { result
|
|
11109
|
+
result && /* @__PURE__ */ jsx("div", { className: "p-5 border-b-sm border-border1", children: /* @__PURE__ */ jsx(WorkflowJsonDialog, { result }) })
|
|
10591
11110
|
] });
|
|
10592
11111
|
}
|
|
10593
11112
|
const WorkflowJsonDialog = ({ result }) => {
|
|
@@ -10603,6 +11122,9 @@ const WorkflowJsonDialog = ({ result }) => {
|
|
|
10603
11122
|
] }) }) })
|
|
10604
11123
|
] });
|
|
10605
11124
|
};
|
|
11125
|
+
const CircleStopIcon = () => {
|
|
11126
|
+
return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
|
|
11127
|
+
};
|
|
10606
11128
|
|
|
10607
11129
|
const WorkflowRuns = ({ workflowId, runId, isLoading, runs, onPressRun }) => {
|
|
10608
11130
|
if (isLoading) {
|
|
@@ -11037,5 +11559,5 @@ function usePolling({
|
|
|
11037
11559
|
};
|
|
11038
11560
|
}
|
|
11039
11561
|
|
|
11040
|
-
export { AgentChat, AgentCoinIcon,
|
|
11562
|
+
export { AgentChat, AgentCoinIcon, AgentEvals, AgentIcon, AgentModelSettings, AgentNetworkCoinIcon, AgentSettingsContext, AgentSettingsProvider, 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, EmptyState, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, Entry, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MainContentContent, MainContentLayout, MastraClientProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RadioGroup, RadioGroupItem, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolsIcon, TraceIcon, TsIcon, Txt, TxtCell, UnitCell, VNextNetworkChat, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowRuns, WorkflowTraces, WorkflowTrigger, useAgentSettings, useCurrentRun, useMastraClient, usePlaygroundStore, usePolling, useSpeechRecognition };
|
|
11041
11563
|
//# sourceMappingURL=index.es.js.map
|