@mastra/playground-ui 5.1.9 → 5.1.10-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +184 -39
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +185 -40
- package/dist/index.es.js.map +1 -1
- package/dist/src/domains/workflows/context/workflow-nested-graph-context.d.ts +3 -1
- package/dist/src/domains/workflows/workflow/workflow-default-node.d.ts +3 -1
- package/dist/src/domains/workflows/workflow/workflow-graph-inner.d.ts +3 -1
- package/dist/src/domains/workflows/workflow/workflow-graph.d.ts +3 -1
- package/dist/src/domains/workflows/workflow/workflow-nested-graph.d.ts +3 -1
- package/dist/src/domains/workflows/workflow/workflow-nested-node.d.ts +4 -1
- package/dist/src/domains/workflows/workflow/workflow-run-event-form.d.ts +12 -0
- package/dist/src/domains/workflows/workflow/workflow-step-action-bar.d.ts +6 -1
- package/dist/src/lib/formatting.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -40,11 +40,11 @@ require('@xyflow/react/dist/style.css');
|
|
|
40
40
|
const Dagre = require('@dagrejs/dagre');
|
|
41
41
|
const prismReactRenderer = require('prism-react-renderer');
|
|
42
42
|
const ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
43
|
-
const useDebounce = require('use-debounce');
|
|
44
|
-
const uuid = require('@lukeed/uuid');
|
|
45
43
|
const prettier = require('prettier');
|
|
46
44
|
const prettierPluginBabel = require('prettier/plugins/babel');
|
|
47
45
|
const prettierPluginEstree = require('prettier/plugins/estree');
|
|
46
|
+
const useDebounce = require('use-debounce');
|
|
47
|
+
const uuid = require('@lukeed/uuid');
|
|
48
48
|
const jsonSchemaToZod = require('json-schema-to-zod');
|
|
49
49
|
const superjson = require('superjson');
|
|
50
50
|
const z = require('zod');
|
|
@@ -4867,6 +4867,12 @@ class PDFAttachmentAdapter {
|
|
|
4867
4867
|
const convertMessage$2 = (message) => {
|
|
4868
4868
|
return message;
|
|
4869
4869
|
};
|
|
4870
|
+
const handleFinishReason = (finishReason) => {
|
|
4871
|
+
switch (finishReason) {
|
|
4872
|
+
case "tool-calls":
|
|
4873
|
+
throw new Error("Stream finished with reason tool-calls, try increasing maxSteps");
|
|
4874
|
+
}
|
|
4875
|
+
};
|
|
4870
4876
|
const convertToAIAttachments = async (attachments) => {
|
|
4871
4877
|
const promises = attachments.filter((attachment) => attachment.type === "image" || attachment.type === "document").map(async (attachment) => {
|
|
4872
4878
|
if (attachment.type === "document") {
|
|
@@ -5055,6 +5061,7 @@ function MastraRuntimeProvider({
|
|
|
5055
5061
|
{ role: "assistant", content: [] }
|
|
5056
5062
|
);
|
|
5057
5063
|
setMessages((currentConversation) => [...currentConversation, latestMessage]);
|
|
5064
|
+
handleFinishReason(generateResponse.finishReason);
|
|
5058
5065
|
}
|
|
5059
5066
|
} else {
|
|
5060
5067
|
let updater = function() {
|
|
@@ -5184,6 +5191,9 @@ function MastraRuntimeProvider({
|
|
|
5184
5191
|
},
|
|
5185
5192
|
onErrorPart(error) {
|
|
5186
5193
|
throw new Error(error);
|
|
5194
|
+
},
|
|
5195
|
+
onFinishMessagePart({ finishReason }) {
|
|
5196
|
+
handleFinishReason(finishReason);
|
|
5187
5197
|
}
|
|
5188
5198
|
});
|
|
5189
5199
|
}
|
|
@@ -5196,7 +5206,7 @@ function MastraRuntimeProvider({
|
|
|
5196
5206
|
setIsRunning(false);
|
|
5197
5207
|
setMessages((currentConversation) => [
|
|
5198
5208
|
...currentConversation,
|
|
5199
|
-
{ role: "assistant", content: [{ type: "text", text:
|
|
5209
|
+
{ role: "assistant", content: [{ type: "text", text: `${error}` }] }
|
|
5200
5210
|
]);
|
|
5201
5211
|
}
|
|
5202
5212
|
};
|
|
@@ -8108,6 +8118,92 @@ const CodeDialogContent = ({ data }) => {
|
|
|
8108
8118
|
}
|
|
8109
8119
|
};
|
|
8110
8120
|
|
|
8121
|
+
const formatJSON = async (code) => {
|
|
8122
|
+
const formatted = await prettier.format(code, {
|
|
8123
|
+
semi: false,
|
|
8124
|
+
parser: "json",
|
|
8125
|
+
printWidth: 80,
|
|
8126
|
+
tabWidth: 2,
|
|
8127
|
+
plugins: [prettierPluginBabel, prettierPluginEstree]
|
|
8128
|
+
});
|
|
8129
|
+
return formatted;
|
|
8130
|
+
};
|
|
8131
|
+
const isValidJson = (str) => {
|
|
8132
|
+
try {
|
|
8133
|
+
const obj = JSON.parse(str);
|
|
8134
|
+
return !!obj && typeof obj === "object";
|
|
8135
|
+
} catch (e) {
|
|
8136
|
+
return false;
|
|
8137
|
+
}
|
|
8138
|
+
};
|
|
8139
|
+
|
|
8140
|
+
const WorkflowRunEventForm = ({ event, runId, onSendEvent }) => {
|
|
8141
|
+
const [eventData, setEventData] = React.useState("");
|
|
8142
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
8143
|
+
const [error, setError] = React.useState(null);
|
|
8144
|
+
const theme = useCodemirrorTheme();
|
|
8145
|
+
const { handleCopy } = useCopyToClipboard({ text: eventData });
|
|
8146
|
+
const handleSendEvent = async () => {
|
|
8147
|
+
let data;
|
|
8148
|
+
setIsLoading(true);
|
|
8149
|
+
setError(null);
|
|
8150
|
+
try {
|
|
8151
|
+
data = JSON.parse(eventData);
|
|
8152
|
+
} catch (error2) {
|
|
8153
|
+
setError("Invalid JSON");
|
|
8154
|
+
setIsLoading(false);
|
|
8155
|
+
return;
|
|
8156
|
+
}
|
|
8157
|
+
try {
|
|
8158
|
+
const result = await onSendEvent({ event, data, runId });
|
|
8159
|
+
sonner.toast.success(result.message);
|
|
8160
|
+
} catch (error2) {
|
|
8161
|
+
console.error("Error sending event", error2);
|
|
8162
|
+
setError("Error sending event");
|
|
8163
|
+
} finally {
|
|
8164
|
+
setIsLoading(false);
|
|
8165
|
+
}
|
|
8166
|
+
};
|
|
8167
|
+
const buttonClass = "text-icon3 hover:text-icon6";
|
|
8168
|
+
const formatEventData = async () => {
|
|
8169
|
+
if (!isValidJson(eventData)) {
|
|
8170
|
+
setError("Invalid JSON");
|
|
8171
|
+
return;
|
|
8172
|
+
}
|
|
8173
|
+
const formatted = await formatJSON(eventData);
|
|
8174
|
+
setEventData(formatted);
|
|
8175
|
+
};
|
|
8176
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8177
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
8178
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between pb-2", children: [
|
|
8179
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", variant: "ui-md", className: "text-icon3", children: "Event data (JSON)" }),
|
|
8180
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8181
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
8182
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: formatEventData, className: buttonClass, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Braces, {}) }) }) }),
|
|
8183
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Format the event data JSON" })
|
|
8184
|
+
] }),
|
|
8185
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
8186
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: handleCopy, className: buttonClass, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) }) }) }),
|
|
8187
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Copy event data" })
|
|
8188
|
+
] })
|
|
8189
|
+
] })
|
|
8190
|
+
] }),
|
|
8191
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8192
|
+
CodeMirror,
|
|
8193
|
+
{
|
|
8194
|
+
value: eventData,
|
|
8195
|
+
onChange: setEventData,
|
|
8196
|
+
theme,
|
|
8197
|
+
extensions: [langJson.jsonLanguage],
|
|
8198
|
+
className: "h-[400px] overflow-y-scroll bg-surface3 rounded-lg overflow-hidden p-3"
|
|
8199
|
+
}
|
|
8200
|
+
),
|
|
8201
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-md", className: "text-accent2", children: error })
|
|
8202
|
+
] }),
|
|
8203
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end pt-4", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleSendEvent, disabled: isLoading, children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 animate-spin" }) : "Send" }) })
|
|
8204
|
+
] });
|
|
8205
|
+
};
|
|
8206
|
+
|
|
8111
8207
|
const WorkflowStepActionBar = ({
|
|
8112
8208
|
input,
|
|
8113
8209
|
output,
|
|
@@ -8115,17 +8211,22 @@ const WorkflowStepActionBar = ({
|
|
|
8115
8211
|
error,
|
|
8116
8212
|
mapConfig,
|
|
8117
8213
|
stepName,
|
|
8214
|
+
event,
|
|
8118
8215
|
onShowTrace,
|
|
8119
|
-
onShowNestedGraph
|
|
8216
|
+
onShowNestedGraph,
|
|
8217
|
+
onSendEvent,
|
|
8218
|
+
runId
|
|
8120
8219
|
}) => {
|
|
8121
8220
|
const [isInputOpen, setIsInputOpen] = React.useState(false);
|
|
8122
8221
|
const [isOutputOpen, setIsOutputOpen] = React.useState(false);
|
|
8123
8222
|
const [isResumeDataOpen, setIsResumeDataOpen] = React.useState(false);
|
|
8124
8223
|
const [isErrorOpen, setIsErrorOpen] = React.useState(false);
|
|
8125
8224
|
const [isMapConfigOpen, setIsMapConfigOpen] = React.useState(false);
|
|
8225
|
+
const [isEventFormOpen, setIsEventFormOpen] = React.useState(false);
|
|
8126
8226
|
const dialogContentClass = "bg-surface2 rounded-lg border-sm border-border1 max-w-4xl w-full px-0";
|
|
8127
8227
|
const dialogTitleClass = "border-b-sm border-border1 pb-4 px-6";
|
|
8128
|
-
|
|
8228
|
+
const showEventForm = event && onSendEvent && runId;
|
|
8229
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: (input || output || error || mapConfig || resumeData || onShowNestedGraph || showEventForm) && /* @__PURE__ */ jsxRuntime.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: [
|
|
8129
8230
|
onShowNestedGraph && /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onShowNestedGraph, children: "View nested graph" }),
|
|
8130
8231
|
mapConfig && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8131
8232
|
/* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsMapConfigOpen(true), children: "Map config" }),
|
|
@@ -8177,7 +8278,18 @@ const WorkflowStepActionBar = ({
|
|
|
8177
8278
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(CodeDialogContent, { data: error }) })
|
|
8178
8279
|
] }) })
|
|
8179
8280
|
] }),
|
|
8180
|
-
onShowTrace && /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onShowTrace, children: "Show trace" })
|
|
8281
|
+
onShowTrace && /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onShowTrace, children: "Show trace" }),
|
|
8282
|
+
showEventForm && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8283
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsEventFormOpen(true), children: "Send event" }),
|
|
8284
|
+
/* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isEventFormOpen, onOpenChange: setIsEventFormOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
|
|
8285
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
|
|
8286
|
+
"Send ",
|
|
8287
|
+
event,
|
|
8288
|
+
" event"
|
|
8289
|
+
] }),
|
|
8290
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowRunEventForm, { event, runId, onSendEvent }) })
|
|
8291
|
+
] }) })
|
|
8292
|
+
] })
|
|
8181
8293
|
] }) });
|
|
8182
8294
|
};
|
|
8183
8295
|
|
|
@@ -8287,7 +8399,8 @@ function WorkflowConditionNode({ data }) {
|
|
|
8287
8399
|
function WorkflowDefaultNode({
|
|
8288
8400
|
data,
|
|
8289
8401
|
onShowTrace,
|
|
8290
|
-
parentWorkflowName
|
|
8402
|
+
parentWorkflowName,
|
|
8403
|
+
onSendEvent
|
|
8291
8404
|
}) {
|
|
8292
8405
|
const { steps, isRunning, runId } = useCurrentRun();
|
|
8293
8406
|
const { label, description, withoutTopHandle, withoutBottomHandle, mapConfig, event, duration, date } = data;
|
|
@@ -8346,7 +8459,10 @@ function WorkflowDefaultNode({
|
|
|
8346
8459
|
output: step?.output,
|
|
8347
8460
|
error: step?.error,
|
|
8348
8461
|
mapConfig,
|
|
8349
|
-
|
|
8462
|
+
event: step?.status === "waiting" ? event : void 0,
|
|
8463
|
+
onShowTrace: runId && onShowTrace ? () => onShowTrace?.({ runId, stepName: fullLabel }) : void 0,
|
|
8464
|
+
runId,
|
|
8465
|
+
onSendEvent
|
|
8350
8466
|
}
|
|
8351
8467
|
)
|
|
8352
8468
|
]
|
|
@@ -8436,7 +8552,13 @@ const ZoomSlider = React.forwardRef(({ className, ...props }) => {
|
|
|
8436
8552
|
});
|
|
8437
8553
|
ZoomSlider.displayName = "ZoomSlider";
|
|
8438
8554
|
|
|
8439
|
-
function WorkflowNestedGraph({
|
|
8555
|
+
function WorkflowNestedGraph({
|
|
8556
|
+
stepGraph,
|
|
8557
|
+
open,
|
|
8558
|
+
workflowName,
|
|
8559
|
+
onShowTrace,
|
|
8560
|
+
onSendEvent
|
|
8561
|
+
}) {
|
|
8440
8562
|
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges({
|
|
8441
8563
|
stepGraph
|
|
8442
8564
|
});
|
|
@@ -8445,11 +8567,27 @@ function WorkflowNestedGraph({ stepGraph, open, workflowName, onShowTrace }) {
|
|
|
8445
8567
|
const [edges] = react$2.useEdgesState(initialEdges);
|
|
8446
8568
|
const { steps } = useCurrentRun();
|
|
8447
8569
|
const nodeTypes = {
|
|
8448
|
-
"default-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8570
|
+
"default-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8571
|
+
WorkflowDefaultNode,
|
|
8572
|
+
{
|
|
8573
|
+
parentWorkflowName: workflowName,
|
|
8574
|
+
onShowTrace,
|
|
8575
|
+
onSendEvent,
|
|
8576
|
+
...props
|
|
8577
|
+
}
|
|
8578
|
+
),
|
|
8449
8579
|
"condition-node": WorkflowConditionNode,
|
|
8450
8580
|
"after-node": WorkflowAfterNode,
|
|
8451
8581
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8452
|
-
"nested-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8582
|
+
"nested-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8583
|
+
WorkflowNestedNode,
|
|
8584
|
+
{
|
|
8585
|
+
parentWorkflowName: workflowName,
|
|
8586
|
+
onShowTrace,
|
|
8587
|
+
onSendEvent,
|
|
8588
|
+
...props
|
|
8589
|
+
}
|
|
8590
|
+
)
|
|
8453
8591
|
};
|
|
8454
8592
|
React.useEffect(() => {
|
|
8455
8593
|
if (open) {
|
|
@@ -8491,7 +8629,8 @@ const WorkflowNestedGraphContext = React.createContext(
|
|
|
8491
8629
|
);
|
|
8492
8630
|
function WorkflowNestedGraphProvider({
|
|
8493
8631
|
children,
|
|
8494
|
-
onShowTrace
|
|
8632
|
+
onShowTrace,
|
|
8633
|
+
onSendEvent
|
|
8495
8634
|
}) {
|
|
8496
8635
|
const [stepGraph, setStepGraph] = React.useState(null);
|
|
8497
8636
|
const [parentStepGraphList, setParentStepGraphList] = React.useState([]);
|
|
@@ -8548,7 +8687,8 @@ function WorkflowNestedGraphProvider({
|
|
|
8548
8687
|
stepGraph,
|
|
8549
8688
|
open: openDialog,
|
|
8550
8689
|
workflowName: fullStep,
|
|
8551
|
-
onShowTrace
|
|
8690
|
+
onShowTrace,
|
|
8691
|
+
onSendEvent
|
|
8552
8692
|
}
|
|
8553
8693
|
) })
|
|
8554
8694
|
] }) }) }, `${label}-${fullStep}`)
|
|
@@ -8560,11 +8700,12 @@ function WorkflowNestedGraphProvider({
|
|
|
8560
8700
|
function WorkflowNestedNode({
|
|
8561
8701
|
data,
|
|
8562
8702
|
parentWorkflowName,
|
|
8563
|
-
onShowTrace
|
|
8703
|
+
onShowTrace,
|
|
8704
|
+
onSendEvent
|
|
8564
8705
|
}) {
|
|
8565
8706
|
const { steps, isRunning, runId } = useCurrentRun();
|
|
8566
8707
|
const { showNestedGraph } = React.useContext(WorkflowNestedGraphContext);
|
|
8567
|
-
const { label, description, withoutTopHandle, withoutBottomHandle, stepGraph, mapConfig } = data;
|
|
8708
|
+
const { label, description, withoutTopHandle, withoutBottomHandle, stepGraph, mapConfig, event } = data;
|
|
8568
8709
|
const fullLabel = parentWorkflowName ? `${parentWorkflowName}.${label}` : label;
|
|
8569
8710
|
const step = steps[fullLabel];
|
|
8570
8711
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -8575,14 +8716,17 @@ function WorkflowNestedNode({
|
|
|
8575
8716
|
className: cn(
|
|
8576
8717
|
"bg-surface3 rounded-lg w-[274px] border-sm border-border1 pt-2",
|
|
8577
8718
|
step?.status === "success" && "ring-2 ring-accent1",
|
|
8578
|
-
step?.status === "failed" && "ring-2 ring-accent2"
|
|
8719
|
+
step?.status === "failed" && "ring-2 ring-accent2",
|
|
8720
|
+
step?.status === "suspended" && "ring-2 ring-accent3",
|
|
8721
|
+
step?.status === "waiting" && "ring-2 ring-accent5"
|
|
8579
8722
|
),
|
|
8580
8723
|
children: [
|
|
8581
8724
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2 px-3", !description && "pb-2"), children: [
|
|
8582
8725
|
isRunning && /* @__PURE__ */ jsxRuntime.jsxs(Icon, { children: [
|
|
8583
8726
|
step?.status === "failed" && /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }),
|
|
8584
8727
|
step?.status === "success" && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "text-accent1" }),
|
|
8585
|
-
step?.status === "suspended" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PauseIcon, { className: "text-
|
|
8728
|
+
step?.status === "suspended" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PauseIcon, { className: "text-accent3" }),
|
|
8729
|
+
step?.status === "waiting" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.HourglassIcon, { className: "text-accent5" }),
|
|
8586
8730
|
step?.status === "running" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "text-icon6 animate-spin" }),
|
|
8587
8731
|
!step && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleDashed, { className: "text-icon2" })
|
|
8588
8732
|
] }),
|
|
@@ -8603,7 +8747,10 @@ function WorkflowNestedNode({
|
|
|
8603
8747
|
error: step?.error,
|
|
8604
8748
|
mapConfig,
|
|
8605
8749
|
onShowTrace: runId && onShowTrace ? () => onShowTrace?.({ runId, stepName: fullLabel }) : void 0,
|
|
8606
|
-
onShowNestedGraph: () => showNestedGraph({ label, fullStep: fullLabel, stepGraph })
|
|
8750
|
+
onShowNestedGraph: () => showNestedGraph({ label, fullStep: fullLabel, stepGraph }),
|
|
8751
|
+
onSendEvent,
|
|
8752
|
+
event: step?.status === "waiting" ? event : void 0,
|
|
8753
|
+
runId
|
|
8607
8754
|
}
|
|
8608
8755
|
)
|
|
8609
8756
|
]
|
|
@@ -8613,17 +8760,17 @@ function WorkflowNestedNode({
|
|
|
8613
8760
|
] });
|
|
8614
8761
|
}
|
|
8615
8762
|
|
|
8616
|
-
function WorkflowGraphInner({ workflow, onShowTrace }) {
|
|
8763
|
+
function WorkflowGraphInner({ workflow, onShowTrace, onSendEvent }) {
|
|
8617
8764
|
const { nodes: initialNodes, edges: initialEdges } = constructNodesAndEdges(workflow);
|
|
8618
8765
|
const [nodes, _, onNodesChange] = react$2.useNodesState(initialNodes);
|
|
8619
8766
|
const [edges] = react$2.useEdgesState(initialEdges);
|
|
8620
8767
|
const { steps, runId } = useCurrentRun();
|
|
8621
8768
|
const nodeTypes = {
|
|
8622
|
-
"default-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowDefaultNode, { onShowTrace, ...props }),
|
|
8769
|
+
"default-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowDefaultNode, { onShowTrace, onSendEvent, ...props }),
|
|
8623
8770
|
"condition-node": WorkflowConditionNode,
|
|
8624
8771
|
"after-node": WorkflowAfterNode,
|
|
8625
8772
|
"loop-result-node": WorkflowLoopResultNode,
|
|
8626
|
-
"nested-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedNode, { onShowTrace, ...props })
|
|
8773
|
+
"nested-node": (props) => /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedNode, { onShowTrace, onSendEvent, ...props })
|
|
8627
8774
|
};
|
|
8628
8775
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8629
8776
|
react$2.ReactFlow,
|
|
@@ -8653,7 +8800,7 @@ function WorkflowGraphInner({ workflow, onShowTrace }) {
|
|
|
8653
8800
|
) });
|
|
8654
8801
|
}
|
|
8655
8802
|
|
|
8656
|
-
function WorkflowGraph({ workflowId, onShowTrace, workflow, isLoading }) {
|
|
8803
|
+
function WorkflowGraph({ workflowId, onShowTrace, workflow, isLoading, onSendEvent }) {
|
|
8657
8804
|
const { snapshot } = React.useContext(WorkflowRunContext);
|
|
8658
8805
|
if (isLoading) {
|
|
8659
8806
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-full" }) });
|
|
@@ -8668,13 +8815,22 @@ function WorkflowGraph({ workflowId, onShowTrace, workflow, isLoading }) {
|
|
|
8668
8815
|
] })
|
|
8669
8816
|
] }) });
|
|
8670
8817
|
}
|
|
8671
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8672
|
-
|
|
8818
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8819
|
+
WorkflowNestedGraphProvider,
|
|
8673
8820
|
{
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8821
|
+
onShowTrace,
|
|
8822
|
+
onSendEvent,
|
|
8823
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8824
|
+
WorkflowGraphInner,
|
|
8825
|
+
{
|
|
8826
|
+
workflow: snapshot?.serializedStepGraph ? { stepGraph: snapshot?.serializedStepGraph } : workflow,
|
|
8827
|
+
onShowTrace,
|
|
8828
|
+
onSendEvent
|
|
8829
|
+
}
|
|
8830
|
+
) })
|
|
8831
|
+
},
|
|
8832
|
+
snapshot?.runId ?? workflowId
|
|
8833
|
+
);
|
|
8678
8834
|
}
|
|
8679
8835
|
|
|
8680
8836
|
const useWorkflowRuns = (workflowId) => {
|
|
@@ -9239,17 +9395,6 @@ const MessagesProvider = ({ children }) => {
|
|
|
9239
9395
|
};
|
|
9240
9396
|
const useMessages = () => React.useContext(MessagesContext);
|
|
9241
9397
|
|
|
9242
|
-
const formatJSON = async (code) => {
|
|
9243
|
-
const formatted = await prettier.format(code, {
|
|
9244
|
-
semi: false,
|
|
9245
|
-
parser: "json",
|
|
9246
|
-
printWidth: 80,
|
|
9247
|
-
tabWidth: 2,
|
|
9248
|
-
plugins: [prettierPluginBabel, prettierPluginEstree]
|
|
9249
|
-
});
|
|
9250
|
-
return formatted;
|
|
9251
|
-
};
|
|
9252
|
-
|
|
9253
9398
|
const convertMessage = (message) => {
|
|
9254
9399
|
return message;
|
|
9255
9400
|
};
|