@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.es.js
CHANGED
|
@@ -6025,42 +6025,6 @@ function transformKey(key) {
|
|
|
6025
6025
|
const newKey = key.split(".").join(" ").split("_").join(" ").replaceAll("ai", "AI");
|
|
6026
6026
|
return newKey.substring(0, 1).toUpperCase() + newKey.substring(1);
|
|
6027
6027
|
}
|
|
6028
|
-
const refineTraces = (traces, isWorkflow = false) => {
|
|
6029
|
-
const listOfSpanIds = /* @__PURE__ */ new Set();
|
|
6030
|
-
const newName = (name) => {
|
|
6031
|
-
if (name?.startsWith("workflow.") && isWorkflow) {
|
|
6032
|
-
return name?.split(".")?.slice(2)?.join(".");
|
|
6033
|
-
}
|
|
6034
|
-
if (name?.startsWith("agent.") && !isWorkflow) {
|
|
6035
|
-
return name?.split(".")?.slice(1)?.join(".");
|
|
6036
|
-
}
|
|
6037
|
-
return name;
|
|
6038
|
-
};
|
|
6039
|
-
const groupedTraces = traces?.reduce((acc, curr) => {
|
|
6040
|
-
const newCurr = { ...curr, name: newName(curr.name), duration: curr.endTime - curr.startTime };
|
|
6041
|
-
listOfSpanIds.add(curr.id);
|
|
6042
|
-
return { ...acc, [curr.traceId]: [...acc[curr.traceId] || [], newCurr] };
|
|
6043
|
-
}, {});
|
|
6044
|
-
const tracesData = Object.entries(groupedTraces).map(([key, value]) => {
|
|
6045
|
-
const parentSpan = value.find((span) => !span.parentSpanId || !listOfSpanIds.has(span.parentSpanId));
|
|
6046
|
-
const enrichedSpans = value.map((span) => ({
|
|
6047
|
-
...span,
|
|
6048
|
-
parentSpanId: parentSpan?.id === span.id ? null : span?.parentSpanId
|
|
6049
|
-
}));
|
|
6050
|
-
const failedStatus = value.find((span) => span.status.code !== 0)?.status;
|
|
6051
|
-
const runId = value?.[0]?.attributes?.runId;
|
|
6052
|
-
return {
|
|
6053
|
-
traceId: key,
|
|
6054
|
-
serviceName: parentSpan?.name || key,
|
|
6055
|
-
duration: parentSpan?.duration || value.reduce((acc, curr) => acc + curr.duration, 0),
|
|
6056
|
-
status: failedStatus || parentSpan?.status || value[0].status,
|
|
6057
|
-
started: value[0].startTime,
|
|
6058
|
-
trace: enrichedSpans,
|
|
6059
|
-
runId: runId ? String(runId) : void 0
|
|
6060
|
-
};
|
|
6061
|
-
});
|
|
6062
|
-
return tracesData;
|
|
6063
|
-
};
|
|
6064
6028
|
|
|
6065
6029
|
function SpanDetail() {
|
|
6066
6030
|
const { span, setSpan, trace, setIsOpen } = useContext(TraceContext);
|
|
@@ -6357,7 +6321,7 @@ function MastraNetworkRuntimeProvider({
|
|
|
6357
6321
|
console.log(messages);
|
|
6358
6322
|
setIsRunning(false);
|
|
6359
6323
|
} catch (error) {
|
|
6360
|
-
console.error("Error
|
|
6324
|
+
console.error("Error occurred in MastraRuntimeProvider", error);
|
|
6361
6325
|
setIsRunning(false);
|
|
6362
6326
|
}
|
|
6363
6327
|
};
|
|
@@ -7755,7 +7719,8 @@ function WorkflowRunProvider({
|
|
|
7755
7719
|
setResult,
|
|
7756
7720
|
payload,
|
|
7757
7721
|
setPayload,
|
|
7758
|
-
clearData
|
|
7722
|
+
clearData,
|
|
7723
|
+
snapshot
|
|
7759
7724
|
},
|
|
7760
7725
|
children
|
|
7761
7726
|
}
|
|
@@ -9565,8 +9530,9 @@ function WorkflowGraphInner({ workflow, onShowTrace }) {
|
|
|
9565
9530
|
|
|
9566
9531
|
function WorkflowGraph({ workflowId, onShowTrace }) {
|
|
9567
9532
|
const { workflow, isLoading } = useWorkflow(workflowId);
|
|
9533
|
+
const { snapshot } = useContext(WorkflowRunContext);
|
|
9568
9534
|
if (isLoading) {
|
|
9569
|
-
return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-
|
|
9535
|
+
return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }) });
|
|
9570
9536
|
}
|
|
9571
9537
|
if (!workflow) {
|
|
9572
9538
|
return /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
@@ -9578,7 +9544,13 @@ function WorkflowGraph({ workflowId, onShowTrace }) {
|
|
|
9578
9544
|
] })
|
|
9579
9545
|
] }) });
|
|
9580
9546
|
}
|
|
9581
|
-
return /* @__PURE__ */ jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
9547
|
+
return /* @__PURE__ */ jsx(WorkflowNestedGraphProvider, { children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(
|
|
9548
|
+
WorkflowGraphInner,
|
|
9549
|
+
{
|
|
9550
|
+
workflow: snapshot?.serializedStepGraph ? { stepGraph: snapshot?.serializedStepGraph } : workflow,
|
|
9551
|
+
onShowTrace
|
|
9552
|
+
}
|
|
9553
|
+
) }) }, snapshot?.runId ?? workflowId);
|
|
9582
9554
|
}
|
|
9583
9555
|
|
|
9584
9556
|
const WorkflowStatus = ({ stepId, status }) => {
|
|
@@ -9786,7 +9758,7 @@ const DataTable = ({
|
|
|
9786
9758
|
const rows = table.getRowModel().rows;
|
|
9787
9759
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9788
9760
|
/* @__PURE__ */ jsxs(Table, { children: [
|
|
9789
|
-
/* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => {
|
|
9761
|
+
/* @__PURE__ */ jsx(Thead, { className: "sticky top-0 bg-surface2", children: ths.headers.map((header) => {
|
|
9790
9762
|
const size = header.column.getSize();
|
|
9791
9763
|
const meta = header.column.columnDef.meta;
|
|
9792
9764
|
return /* @__PURE__ */ jsx(Th, { style: { width: meta?.width || size || "auto" }, children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
|
|
@@ -10094,47 +10066,5 @@ function usePolling({
|
|
|
10094
10066
|
};
|
|
10095
10067
|
}
|
|
10096
10068
|
|
|
10097
|
-
|
|
10098
|
-
const [traces, setTraces] = useState([]);
|
|
10099
|
-
const client = useMemo(() => useMastraClient(), []);
|
|
10100
|
-
const fetchFn = useCallback(async () => {
|
|
10101
|
-
try {
|
|
10102
|
-
const res = await client.getTelemetry({
|
|
10103
|
-
attribute: {
|
|
10104
|
-
componentName
|
|
10105
|
-
}
|
|
10106
|
-
});
|
|
10107
|
-
if (!res.traces) {
|
|
10108
|
-
throw new Error("Error fetching traces");
|
|
10109
|
-
}
|
|
10110
|
-
const refinedTraces = refineTraces(res?.traces || [], isWorkflow);
|
|
10111
|
-
return refinedTraces;
|
|
10112
|
-
} catch (error2) {
|
|
10113
|
-
throw error2;
|
|
10114
|
-
}
|
|
10115
|
-
}, [client, componentName, isWorkflow]);
|
|
10116
|
-
const onSuccess = useCallback((newTraces) => {
|
|
10117
|
-
if (newTraces.length > 0) {
|
|
10118
|
-
setTraces(() => newTraces);
|
|
10119
|
-
}
|
|
10120
|
-
}, []);
|
|
10121
|
-
const onError = useCallback((error2) => {
|
|
10122
|
-
console.log(`error, onError`, error2);
|
|
10123
|
-
toast.error(error2.message);
|
|
10124
|
-
}, []);
|
|
10125
|
-
const shouldContinue = useCallback(() => {
|
|
10126
|
-
return true;
|
|
10127
|
-
}, []);
|
|
10128
|
-
const { firstCallLoading, error } = usePolling({
|
|
10129
|
-
fetchFn,
|
|
10130
|
-
interval: 3e3,
|
|
10131
|
-
onSuccess,
|
|
10132
|
-
onError,
|
|
10133
|
-
shouldContinue,
|
|
10134
|
-
enabled: true
|
|
10135
|
-
});
|
|
10136
|
-
return { traces, firstCallLoading, error };
|
|
10137
|
-
};
|
|
10138
|
-
|
|
10139
|
-
export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentNetworkCoinIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyState, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraClientProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolsIcon, TraceIcon, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, useCurrentRun, useMastraClient, usePlaygroundStore, usePolling, useSpeechRecognition, useTraces };
|
|
10069
|
+
export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentNetworkCoinIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyState, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraClientProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolsIcon, TraceIcon, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, useCurrentRun, useMastraClient, usePlaygroundStore, usePolling, useSpeechRecognition };
|
|
10140
10070
|
//# sourceMappingURL=index.es.js.map
|