@mastra/playground-ui 5.1.2-alpha.3 → 5.1.2-alpha.5
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 +13 -85
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +14 -84
- package/dist/index.es.js.map +1 -1
- package/dist/src/domains/traces/utils.d.ts +0 -3
- package/dist/src/domains/workflows/context/workflow-run-context.d.ts +1 -0
- package/dist/src/domains/workflows/workflow/workflow-graph-inner.d.ts +3 -1
- package/dist/src/index.d.ts +0 -2
- package/package.json +2 -2
- package/dist/src/hooks/index.d.ts +0 -1
- package/dist/src/hooks/use-traces.d.ts +0 -9
package/dist/index.cjs.js
CHANGED
|
@@ -6057,42 +6057,6 @@ function transformKey(key) {
|
|
|
6057
6057
|
const newKey = key.split(".").join(" ").split("_").join(" ").replaceAll("ai", "AI");
|
|
6058
6058
|
return newKey.substring(0, 1).toUpperCase() + newKey.substring(1);
|
|
6059
6059
|
}
|
|
6060
|
-
const refineTraces = (traces, isWorkflow = false) => {
|
|
6061
|
-
const listOfSpanIds = /* @__PURE__ */ new Set();
|
|
6062
|
-
const newName = (name) => {
|
|
6063
|
-
if (name?.startsWith("workflow.") && isWorkflow) {
|
|
6064
|
-
return name?.split(".")?.slice(2)?.join(".");
|
|
6065
|
-
}
|
|
6066
|
-
if (name?.startsWith("agent.") && !isWorkflow) {
|
|
6067
|
-
return name?.split(".")?.slice(1)?.join(".");
|
|
6068
|
-
}
|
|
6069
|
-
return name;
|
|
6070
|
-
};
|
|
6071
|
-
const groupedTraces = traces?.reduce((acc, curr) => {
|
|
6072
|
-
const newCurr = { ...curr, name: newName(curr.name), duration: curr.endTime - curr.startTime };
|
|
6073
|
-
listOfSpanIds.add(curr.id);
|
|
6074
|
-
return { ...acc, [curr.traceId]: [...acc[curr.traceId] || [], newCurr] };
|
|
6075
|
-
}, {});
|
|
6076
|
-
const tracesData = Object.entries(groupedTraces).map(([key, value]) => {
|
|
6077
|
-
const parentSpan = value.find((span) => !span.parentSpanId || !listOfSpanIds.has(span.parentSpanId));
|
|
6078
|
-
const enrichedSpans = value.map((span) => ({
|
|
6079
|
-
...span,
|
|
6080
|
-
parentSpanId: parentSpan?.id === span.id ? null : span?.parentSpanId
|
|
6081
|
-
}));
|
|
6082
|
-
const failedStatus = value.find((span) => span.status.code !== 0)?.status;
|
|
6083
|
-
const runId = value?.[0]?.attributes?.runId;
|
|
6084
|
-
return {
|
|
6085
|
-
traceId: key,
|
|
6086
|
-
serviceName: parentSpan?.name || key,
|
|
6087
|
-
duration: parentSpan?.duration || value.reduce((acc, curr) => acc + curr.duration, 0),
|
|
6088
|
-
status: failedStatus || parentSpan?.status || value[0].status,
|
|
6089
|
-
started: value[0].startTime,
|
|
6090
|
-
trace: enrichedSpans,
|
|
6091
|
-
runId: runId ? String(runId) : void 0
|
|
6092
|
-
};
|
|
6093
|
-
});
|
|
6094
|
-
return tracesData;
|
|
6095
|
-
};
|
|
6096
6060
|
|
|
6097
6061
|
function SpanDetail() {
|
|
6098
6062
|
const { span, setSpan, trace, setIsOpen } = React.useContext(TraceContext);
|
|
@@ -6389,7 +6353,7 @@ function MastraNetworkRuntimeProvider({
|
|
|
6389
6353
|
console.log(messages);
|
|
6390
6354
|
setIsRunning(false);
|
|
6391
6355
|
} catch (error) {
|
|
6392
|
-
console.error("Error
|
|
6356
|
+
console.error("Error occurred in MastraRuntimeProvider", error);
|
|
6393
6357
|
setIsRunning(false);
|
|
6394
6358
|
}
|
|
6395
6359
|
};
|
|
@@ -7787,7 +7751,8 @@ function WorkflowRunProvider({
|
|
|
7787
7751
|
setResult,
|
|
7788
7752
|
payload,
|
|
7789
7753
|
setPayload,
|
|
7790
|
-
clearData
|
|
7754
|
+
clearData,
|
|
7755
|
+
snapshot
|
|
7791
7756
|
},
|
|
7792
7757
|
children
|
|
7793
7758
|
}
|
|
@@ -9597,8 +9562,9 @@ function WorkflowGraphInner({ workflow, onShowTrace }) {
|
|
|
9597
9562
|
|
|
9598
9563
|
function WorkflowGraph({ workflowId, onShowTrace }) {
|
|
9599
9564
|
const { workflow, isLoading } = useWorkflow(workflowId);
|
|
9565
|
+
const { snapshot } = React.useContext(WorkflowRunContext);
|
|
9600
9566
|
if (isLoading) {
|
|
9601
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-
|
|
9567
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-full" }) });
|
|
9602
9568
|
}
|
|
9603
9569
|
if (!workflow) {
|
|
9604
9570
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
@@ -9610,7 +9576,13 @@ function WorkflowGraph({ workflowId, onShowTrace }) {
|
|
|
9610
9576
|
] })
|
|
9611
9577
|
] }) });
|
|
9612
9578
|
}
|
|
9613
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9579
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ReactFlowProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9580
|
+
WorkflowGraphInner,
|
|
9581
|
+
{
|
|
9582
|
+
workflow: snapshot?.serializedStepGraph ? { stepGraph: snapshot?.serializedStepGraph } : workflow,
|
|
9583
|
+
onShowTrace
|
|
9584
|
+
}
|
|
9585
|
+
) }) }, snapshot?.runId ?? workflowId);
|
|
9614
9586
|
}
|
|
9615
9587
|
|
|
9616
9588
|
const WorkflowStatus = ({ stepId, status }) => {
|
|
@@ -9818,7 +9790,7 @@ const DataTable = ({
|
|
|
9818
9790
|
const rows = table.getRowModel().rows;
|
|
9819
9791
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
9820
9792
|
/* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
|
|
9821
|
-
/* @__PURE__ */ jsxRuntime.jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => {
|
|
9793
|
+
/* @__PURE__ */ jsxRuntime.jsx(Thead, { className: "sticky top-0 bg-surface2", children: ths.headers.map((header) => {
|
|
9822
9794
|
const size = header.column.getSize();
|
|
9823
9795
|
const meta = header.column.columnDef.meta;
|
|
9824
9796
|
return /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: meta?.width || size || "auto" }, children: header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
|
|
@@ -10126,48 +10098,6 @@ function usePolling({
|
|
|
10126
10098
|
};
|
|
10127
10099
|
}
|
|
10128
10100
|
|
|
10129
|
-
const useTraces = (componentName, isWorkflow = false) => {
|
|
10130
|
-
const [traces, setTraces] = React.useState([]);
|
|
10131
|
-
const client = React.useMemo(() => useMastraClient(), []);
|
|
10132
|
-
const fetchFn = React.useCallback(async () => {
|
|
10133
|
-
try {
|
|
10134
|
-
const res = await client.getTelemetry({
|
|
10135
|
-
attribute: {
|
|
10136
|
-
componentName
|
|
10137
|
-
}
|
|
10138
|
-
});
|
|
10139
|
-
if (!res.traces) {
|
|
10140
|
-
throw new Error("Error fetching traces");
|
|
10141
|
-
}
|
|
10142
|
-
const refinedTraces = refineTraces(res?.traces || [], isWorkflow);
|
|
10143
|
-
return refinedTraces;
|
|
10144
|
-
} catch (error2) {
|
|
10145
|
-
throw error2;
|
|
10146
|
-
}
|
|
10147
|
-
}, [client, componentName, isWorkflow]);
|
|
10148
|
-
const onSuccess = React.useCallback((newTraces) => {
|
|
10149
|
-
if (newTraces.length > 0) {
|
|
10150
|
-
setTraces(() => newTraces);
|
|
10151
|
-
}
|
|
10152
|
-
}, []);
|
|
10153
|
-
const onError = React.useCallback((error2) => {
|
|
10154
|
-
console.log(`error, onError`, error2);
|
|
10155
|
-
sonner.toast.error(error2.message);
|
|
10156
|
-
}, []);
|
|
10157
|
-
const shouldContinue = React.useCallback(() => {
|
|
10158
|
-
return true;
|
|
10159
|
-
}, []);
|
|
10160
|
-
const { firstCallLoading, error } = usePolling({
|
|
10161
|
-
fetchFn,
|
|
10162
|
-
interval: 3e3,
|
|
10163
|
-
onSuccess,
|
|
10164
|
-
onError,
|
|
10165
|
-
shouldContinue,
|
|
10166
|
-
enabled: true
|
|
10167
|
-
});
|
|
10168
|
-
return { traces, firstCallLoading, error };
|
|
10169
|
-
};
|
|
10170
|
-
|
|
10171
10101
|
exports.AgentChat = AgentChat;
|
|
10172
10102
|
exports.AgentCoinIcon = AgentCoinIcon;
|
|
10173
10103
|
exports.AgentContext = AgentContext;
|
|
@@ -10262,11 +10192,9 @@ exports.WorkflowRunContext = WorkflowRunContext;
|
|
|
10262
10192
|
exports.WorkflowRunProvider = WorkflowRunProvider;
|
|
10263
10193
|
exports.WorkflowTraces = WorkflowTraces;
|
|
10264
10194
|
exports.WorkflowTrigger = WorkflowTrigger;
|
|
10265
|
-
exports.refineTraces = refineTraces;
|
|
10266
10195
|
exports.useCurrentRun = useCurrentRun;
|
|
10267
10196
|
exports.useMastraClient = useMastraClient;
|
|
10268
10197
|
exports.usePlaygroundStore = usePlaygroundStore;
|
|
10269
10198
|
exports.usePolling = usePolling;
|
|
10270
10199
|
exports.useSpeechRecognition = useSpeechRecognition;
|
|
10271
|
-
exports.useTraces = useTraces;
|
|
10272
10200
|
//# sourceMappingURL=index.cjs.js.map
|