@mastra/playground-ui 5.1.2-alpha.0 → 5.1.2-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 +16 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +17 -27
- package/dist/index.es.js.map +1 -1
- package/dist/src/domains/agents/agent/agent-traces.d.ts +1 -2
- package/dist/src/domains/traces/context/trace-context.d.ts +1 -2
- package/dist/src/domains/traces/traces-table.d.ts +1 -2
- package/dist/src/domains/workflows/workflow/workflow-traces.d.ts +1 -2
- package/dist/src/index.d.ts +0 -1
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -5405,11 +5405,10 @@ function EvalTable({ evals, isCIMode = false }) {
|
|
|
5405
5405
|
const TraceContext = React.createContext({});
|
|
5406
5406
|
function TraceProvider({
|
|
5407
5407
|
children,
|
|
5408
|
-
initialTraces
|
|
5408
|
+
initialTraces: traces = []
|
|
5409
5409
|
}) {
|
|
5410
5410
|
const [open, setOpen] = React.useState(false);
|
|
5411
5411
|
const [trace, setTrace] = React.useState(null);
|
|
5412
|
-
const [traces, setTraces] = React.useState(initialTraces || []);
|
|
5413
5412
|
const [currentTraceIndex, setCurrentTraceIndex] = React.useState(0);
|
|
5414
5413
|
const [span, setSpan] = React.useState(null);
|
|
5415
5414
|
const nextTrace = () => {
|
|
@@ -5446,7 +5445,6 @@ function TraceProvider({
|
|
|
5446
5445
|
trace,
|
|
5447
5446
|
setTrace,
|
|
5448
5447
|
traces,
|
|
5449
|
-
setTraces,
|
|
5450
5448
|
currentTraceIndex,
|
|
5451
5449
|
setCurrentTraceIndex,
|
|
5452
5450
|
nextTrace,
|
|
@@ -5571,9 +5569,6 @@ const toSigFigs = (num, sigFigs) => {
|
|
|
5571
5569
|
return Number(num.toPrecision(sigFigs));
|
|
5572
5570
|
};
|
|
5573
5571
|
|
|
5574
|
-
const TracesTableSkeleton = ({ colsCount }) => {
|
|
5575
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: /* @__PURE__ */ jsxRuntime.jsx(Row, { children: Array.from({ length: colsCount }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-1/2" }) }, index)) }) });
|
|
5576
|
-
};
|
|
5577
5572
|
const TracesTableEmpty = ({ colsCount }) => {
|
|
5578
5573
|
return /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: /* @__PURE__ */ jsxRuntime.jsx(Row, { children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { colSpan: colsCount, className: "text-center py-4", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { children: "No traces found" }) }) }) });
|
|
5579
5574
|
};
|
|
@@ -5594,7 +5589,7 @@ const TraceRow = ({ trace, index, isActive }) => {
|
|
|
5594
5589
|
/* @__PURE__ */ jsxRuntime.jsx(Cell, { children: hasFailure ? /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: "Failed" }) : /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}), variant: "success", children: "Success" }) })
|
|
5595
5590
|
] });
|
|
5596
5591
|
};
|
|
5597
|
-
const TracesTable = ({ traces,
|
|
5592
|
+
const TracesTable = ({ traces, error }) => {
|
|
5598
5593
|
const hasNoTraces = !traces || traces.length === 0;
|
|
5599
5594
|
const { currentTraceIndex } = React.useContext(TraceContext);
|
|
5600
5595
|
const colsCount = 4;
|
|
@@ -5606,7 +5601,7 @@ const TracesTable = ({ traces, isLoading, error }) => {
|
|
|
5606
5601
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 120, children: "Spans" }),
|
|
5607
5602
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 120, children: "Status" })
|
|
5608
5603
|
] }),
|
|
5609
|
-
|
|
5604
|
+
error ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsxRuntime.jsx(TraceRow, { trace, index, isActive: index === currentTraceIndex }, trace.traceId)) }) })
|
|
5610
5605
|
] });
|
|
5611
5606
|
};
|
|
5612
5607
|
|
|
@@ -6214,14 +6209,14 @@ const TracesSidebar = ({ onResize }) => {
|
|
|
6214
6209
|
);
|
|
6215
6210
|
};
|
|
6216
6211
|
|
|
6217
|
-
function AgentTraces({ className, traces,
|
|
6218
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AgentTracesInner, { className, traces,
|
|
6212
|
+
function AgentTraces({ className, traces, error }) {
|
|
6213
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { initialTraces: traces || [], children: /* @__PURE__ */ jsxRuntime.jsx(AgentTracesInner, { className, traces, error }) });
|
|
6219
6214
|
}
|
|
6220
|
-
function AgentTracesInner({ className, traces,
|
|
6215
|
+
function AgentTracesInner({ className, traces, error }) {
|
|
6221
6216
|
const [sidebarWidth, setSidebarWidth] = React.useState(100);
|
|
6222
6217
|
const { isOpen: open } = React.useContext(TraceContext);
|
|
6223
6218
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("h-full relative overflow-hidden flex", className), children: [
|
|
6224
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces,
|
|
6219
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, error }) }),
|
|
6225
6220
|
open && /* @__PURE__ */ jsxRuntime.jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
|
|
6226
6221
|
] });
|
|
6227
6222
|
}
|
|
@@ -6673,10 +6668,10 @@ const NetworkChat = ({ agentId, memory }) => {
|
|
|
6673
6668
|
return /* @__PURE__ */ jsxRuntime.jsx(MastraNetworkRuntimeProvider, { agentId, memory, modelSettings, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { ToolFallback }) }) });
|
|
6674
6669
|
};
|
|
6675
6670
|
|
|
6676
|
-
function WorkflowTraces({ traces,
|
|
6677
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6671
|
+
function WorkflowTraces({ traces, error, runId, stepName }) {
|
|
6672
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { initialTraces: traces || [], children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowTracesInner, { traces, error, runId, stepName }) });
|
|
6678
6673
|
}
|
|
6679
|
-
function WorkflowTracesInner({ traces,
|
|
6674
|
+
function WorkflowTracesInner({ traces, error, runId, stepName }) {
|
|
6680
6675
|
const hasRunRef = React.useRef(false);
|
|
6681
6676
|
const [sidebarWidth, setSidebarWidth] = React.useState(100);
|
|
6682
6677
|
const { isOpen: open, setTrace, setIsOpen, setSpan } = React.useContext(TraceContext);
|
|
@@ -6693,7 +6688,7 @@ function WorkflowTracesInner({ traces, isLoading, error, runId, stepName }) {
|
|
|
6693
6688
|
hasRunRef.current = true;
|
|
6694
6689
|
}, [runId, traces, setTrace]);
|
|
6695
6690
|
return /* @__PURE__ */ jsxRuntime.jsxs("main", { className: "h-full relative overflow-hidden flex", children: [
|
|
6696
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces,
|
|
6691
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, error }) }),
|
|
6697
6692
|
open && /* @__PURE__ */ jsxRuntime.jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
|
|
6698
6693
|
] });
|
|
6699
6694
|
}
|
|
@@ -10131,7 +10126,6 @@ function usePolling({
|
|
|
10131
10126
|
|
|
10132
10127
|
const useTraces = (componentName, baseUrl, isWorkflow = false) => {
|
|
10133
10128
|
const [traces, setTraces] = React.useState([]);
|
|
10134
|
-
const { setTraces: setTraceContextTraces } = React.useContext(TraceContext);
|
|
10135
10129
|
const client = React.useMemo(() => createMastraClient(baseUrl), [baseUrl]);
|
|
10136
10130
|
const fetchFn = React.useCallback(async () => {
|
|
10137
10131
|
try {
|
|
@@ -10149,15 +10143,11 @@ const useTraces = (componentName, baseUrl, isWorkflow = false) => {
|
|
|
10149
10143
|
throw error2;
|
|
10150
10144
|
}
|
|
10151
10145
|
}, [client, componentName, isWorkflow]);
|
|
10152
|
-
const onSuccess = React.useCallback(
|
|
10153
|
-
(newTraces)
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
}
|
|
10158
|
-
},
|
|
10159
|
-
[setTraceContextTraces]
|
|
10160
|
-
);
|
|
10146
|
+
const onSuccess = React.useCallback((newTraces) => {
|
|
10147
|
+
if (newTraces.length > 0) {
|
|
10148
|
+
setTraces(() => newTraces);
|
|
10149
|
+
}
|
|
10150
|
+
}, []);
|
|
10161
10151
|
const onError = React.useCallback((error2) => {
|
|
10162
10152
|
console.log(`error, onError`, error2);
|
|
10163
10153
|
sonner.toast.error(error2.message);
|
|
@@ -10256,9 +10246,7 @@ exports.ThreadList = ThreadList;
|
|
|
10256
10246
|
exports.Threads = Threads;
|
|
10257
10247
|
exports.ToolCoinIcon = ToolCoinIcon;
|
|
10258
10248
|
exports.ToolsIcon = ToolsIcon;
|
|
10259
|
-
exports.TraceContext = TraceContext;
|
|
10260
10249
|
exports.TraceIcon = TraceIcon;
|
|
10261
|
-
exports.TraceProvider = TraceProvider;
|
|
10262
10250
|
exports.TsIcon = TsIcon;
|
|
10263
10251
|
exports.Txt = Txt;
|
|
10264
10252
|
exports.TxtCell = TxtCell;
|