@mastra/playground-ui 5.0.1-alpha.1 → 5.0.1-alpha.2
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/domains/agents/agent/agent-traces.d.ts +1 -4
- package/dist/domains/traces/context/trace-context.d.ts +0 -2
- package/dist/domains/traces/trace-details.d.ts +1 -1
- package/dist/domains/traces/trace-span-details.d.ts +1 -1
- package/dist/domains/traces/trace-span-view.d.ts +4 -6
- package/dist/domains/traces/traces-sidebar.d.ts +1 -4
- package/dist/domains/traces/utils/getSpanVariant.d.ts +4 -0
- package/dist/domains/traces/utils.d.ts +1 -1
- package/dist/domains/workflows/workflow/workflow-traces.d.ts +1 -4
- package/dist/ds/components/TraceTree/Span.d.ts +22 -1
- package/dist/ds/components/TraceTree/Trace.d.ts +4 -1
- package/dist/ds/icons/LatencyIcon.d.ts +3 -0
- package/dist/ds/icons/index.d.ts +1 -0
- package/dist/index.cjs.js +444 -483
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +445 -485
- package/dist/index.es.js.map +1 -1
- package/dist/lib/mastra-client.d.ts +3 -0
- package/package.json +3 -3
- package/dist/domains/traces/trace-tree-view.d.ts +0 -6
package/dist/index.cjs.js
CHANGED
|
@@ -3148,7 +3148,7 @@ const Icon = ({ children, className, size = "default", ...props }) => {
|
|
|
3148
3148
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: clsx("block", sizes[size], className), ...props, children });
|
|
3149
3149
|
};
|
|
3150
3150
|
|
|
3151
|
-
const variantClasses$
|
|
3151
|
+
const variantClasses$2 = {
|
|
3152
3152
|
default: "text-icon3",
|
|
3153
3153
|
success: "text-accent1",
|
|
3154
3154
|
error: "text-accent2",
|
|
@@ -3161,12 +3161,12 @@ const Badge$1 = ({ icon, variant = "default", className, children, ...props }) =
|
|
|
3161
3161
|
className: clsx(
|
|
3162
3162
|
"bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md",
|
|
3163
3163
|
icon ? "pl-md pr-1.5" : "px-1.5",
|
|
3164
|
-
icon || variant === "default" ? "text-icon5" : variantClasses$
|
|
3164
|
+
icon || variant === "default" ? "text-icon5" : variantClasses$2[variant],
|
|
3165
3165
|
className
|
|
3166
3166
|
),
|
|
3167
3167
|
...props,
|
|
3168
3168
|
children: [
|
|
3169
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: variantClasses$
|
|
3169
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: variantClasses$2[variant], children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon }) }),
|
|
3170
3170
|
children
|
|
3171
3171
|
]
|
|
3172
3172
|
}
|
|
@@ -3789,6 +3789,30 @@ const WorkflowCoinIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { wid
|
|
|
3789
3789
|
)
|
|
3790
3790
|
] });
|
|
3791
3791
|
|
|
3792
|
+
const LatencyIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3793
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3794
|
+
"path",
|
|
3795
|
+
{
|
|
3796
|
+
d: "M2.0625 5.99976C2.0625 3.82513 3.82538 2.06226 6 2.06226C6.58712 2.06226 7.14423 2.19076 7.64473 2.42117V1.21042C7.12905 1.03337 6.57575 0.937256 6 0.937256C3.20406 0.937256 0.9375 3.20381 0.9375 5.99976C0.9375 8.7957 3.20406 11.0623 6 11.0623C8.79594 11.0623 11.0625 8.7957 11.0625 5.99976H9.9375C9.9375 8.17438 8.17462 9.93726 6 9.93726C3.82538 9.93726 2.0625 8.17438 2.0625 5.99976Z",
|
|
3797
|
+
fill: "currentColor"
|
|
3798
|
+
}
|
|
3799
|
+
),
|
|
3800
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3801
|
+
"path",
|
|
3802
|
+
{
|
|
3803
|
+
d: "M9.28577 4.3986C9.08709 4.3986 8.92603 4.23753 8.92603 4.03885V0.978563C8.92603 0.681899 9.16652 0.441406 9.46318 0.441406C9.75985 0.441406 10.0003 0.6819 10.0003 0.978564V3.25858C10.0003 3.33638 10.0634 3.39944 10.1412 3.39944H11.2091C11.485 3.39944 11.7087 3.62311 11.7087 3.89902C11.7087 4.17493 11.485 4.3986 11.2091 4.3986H9.28577Z",
|
|
3804
|
+
fill: "currentColor"
|
|
3805
|
+
}
|
|
3806
|
+
),
|
|
3807
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3808
|
+
"path",
|
|
3809
|
+
{
|
|
3810
|
+
d: "M6.57568 3.69244C6.57568 3.38178 6.32384 3.12994 6.01318 3.12994C5.70252 3.12994 5.45068 3.38178 5.45068 3.69244V6.22272L6.7242 7.88675C6.91301 8.13346 7.26606 8.18039 7.51276 7.99159C7.75946 7.80278 7.8064 7.44973 7.61759 7.20303L6.57568 5.84162V3.69244Z",
|
|
3811
|
+
fill: "currentColor"
|
|
3812
|
+
}
|
|
3813
|
+
)
|
|
3814
|
+
] });
|
|
3815
|
+
|
|
3792
3816
|
const useCodemirrorTheme$1 = () => {
|
|
3793
3817
|
return React.useMemo(
|
|
3794
3818
|
() => codemirrorThemeDracula.draculaInit({
|
|
@@ -3930,31 +3954,23 @@ const Thread = ({ ToolFallback }) => {
|
|
|
3930
3954
|
const WrappedAssistantMessage = (props) => {
|
|
3931
3955
|
return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback });
|
|
3932
3956
|
};
|
|
3933
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-100px)]", children: [
|
|
3934
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
}
|
|
3951
|
-
}
|
|
3952
|
-
)
|
|
3953
|
-
] }),
|
|
3954
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
|
|
3955
|
-
]
|
|
3956
|
-
}
|
|
3957
|
-
),
|
|
3957
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-100px)] px-4", children: [
|
|
3958
|
+
/* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
3959
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3960
|
+
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, {}),
|
|
3961
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3962
|
+
react.ThreadPrimitive.Messages,
|
|
3963
|
+
{
|
|
3964
|
+
components: {
|
|
3965
|
+
UserMessage,
|
|
3966
|
+
EditComposer,
|
|
3967
|
+
AssistantMessage: WrappedAssistantMessage
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
)
|
|
3971
|
+
] }),
|
|
3972
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
|
|
3973
|
+
] }),
|
|
3958
3974
|
/* @__PURE__ */ jsxRuntime.jsx(Composer, {})
|
|
3959
3975
|
] });
|
|
3960
3976
|
};
|
|
@@ -4006,6 +4022,14 @@ const CircleStopIcon = () => {
|
|
|
4006
4022
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
|
|
4007
4023
|
};
|
|
4008
4024
|
|
|
4025
|
+
const createMastraClient = (baseUrl) => {
|
|
4026
|
+
return new clientJs.MastraClient({
|
|
4027
|
+
baseUrl: baseUrl || "",
|
|
4028
|
+
// only add the header if the baseUrl is not provided i.e it's a local dev environment
|
|
4029
|
+
headers: !baseUrl ? { "x-mastra-dev-playground": "true" } : {}
|
|
4030
|
+
});
|
|
4031
|
+
};
|
|
4032
|
+
|
|
4009
4033
|
const convertMessage$1 = (message) => {
|
|
4010
4034
|
return message;
|
|
4011
4035
|
};
|
|
@@ -4049,9 +4073,7 @@ function MastraRuntimeProvider({
|
|
|
4049
4073
|
}
|
|
4050
4074
|
}
|
|
4051
4075
|
}, [initialMessages, threadId, memory]);
|
|
4052
|
-
const mastra =
|
|
4053
|
-
baseUrl: baseUrl || ""
|
|
4054
|
-
});
|
|
4076
|
+
const mastra = createMastraClient(baseUrl);
|
|
4055
4077
|
const agent = mastra.getAgent(agentId);
|
|
4056
4078
|
const onNew = async (message) => {
|
|
4057
4079
|
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
@@ -4523,9 +4545,7 @@ TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
|
|
|
4523
4545
|
const useEvalsByAgentId = (agentId, type, baseUrl) => {
|
|
4524
4546
|
const [evals, setEvals] = React.useState([]);
|
|
4525
4547
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
4526
|
-
const client =
|
|
4527
|
-
baseUrl: baseUrl || ""
|
|
4528
|
-
});
|
|
4548
|
+
const client = createMastraClient(baseUrl);
|
|
4529
4549
|
const fetchEvals = async (_agentId) => {
|
|
4530
4550
|
setIsLoading(true);
|
|
4531
4551
|
const activeAgentId = _agentId ?? agentId;
|
|
@@ -4804,7 +4824,6 @@ function TraceProvider({ children }) {
|
|
|
4804
4824
|
const [traces, setTraces] = React.useState([]);
|
|
4805
4825
|
const [currentTraceIndex, setCurrentTraceIndex] = React.useState(0);
|
|
4806
4826
|
const [span, setSpan] = React.useState(null);
|
|
4807
|
-
const [openDetail, setOpenDetail] = React.useState(false);
|
|
4808
4827
|
const nextTrace = () => {
|
|
4809
4828
|
if (currentTraceIndex < traces.length - 1) {
|
|
4810
4829
|
const nextIndex = currentTraceIndex + 1;
|
|
@@ -4829,7 +4848,6 @@ function TraceProvider({ children }) {
|
|
|
4829
4848
|
setOpen(false);
|
|
4830
4849
|
setTrace(null);
|
|
4831
4850
|
setSpan(null);
|
|
4832
|
-
setOpenDetail(false);
|
|
4833
4851
|
};
|
|
4834
4852
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4835
4853
|
TraceContext.Provider,
|
|
@@ -4847,8 +4865,6 @@ function TraceProvider({ children }) {
|
|
|
4847
4865
|
prevTrace,
|
|
4848
4866
|
span,
|
|
4849
4867
|
setSpan,
|
|
4850
|
-
openDetail,
|
|
4851
|
-
setOpenDetail,
|
|
4852
4868
|
clearData
|
|
4853
4869
|
},
|
|
4854
4870
|
children
|
|
@@ -4998,10 +5014,8 @@ function transformKey(key) {
|
|
|
4998
5014
|
if (key.includes(".result")) {
|
|
4999
5015
|
return "Output";
|
|
5000
5016
|
}
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
function cleanString(string) {
|
|
5004
|
-
return string.replace(/\\n/g, "").replace(/\n/g, "").replace(/\s+/g, " ").trim();
|
|
5017
|
+
const newKey = key.split(".").join(" ").split("_").join(" ").replaceAll("ai", "AI");
|
|
5018
|
+
return newKey.substring(0, 1).toUpperCase() + newKey.substring(1);
|
|
5005
5019
|
}
|
|
5006
5020
|
const refineTraces = (traces, isWorkflow = false) => {
|
|
5007
5021
|
const listOfSpanIds = /* @__PURE__ */ new Set();
|
|
@@ -5038,35 +5052,11 @@ const refineTraces = (traces, isWorkflow = false) => {
|
|
|
5038
5052
|
});
|
|
5039
5053
|
return tracesData;
|
|
5040
5054
|
};
|
|
5041
|
-
const allowedAiSpanAttributes = [
|
|
5042
|
-
"operation.name",
|
|
5043
|
-
"ai.operationId",
|
|
5044
|
-
"ai.model.provider",
|
|
5045
|
-
"ai.model.id",
|
|
5046
|
-
"ai.prompt.format",
|
|
5047
|
-
"ai.prompt.messages",
|
|
5048
|
-
"ai.prompt.tools",
|
|
5049
|
-
"ai.prompt.toolChoice",
|
|
5050
|
-
"ai.settings.toolChoice",
|
|
5051
|
-
"ai.schema",
|
|
5052
|
-
"ai.settings.output",
|
|
5053
|
-
"ai.response.object",
|
|
5054
|
-
"ai.response.text",
|
|
5055
|
-
"ai.response.timestamp",
|
|
5056
|
-
"componentName",
|
|
5057
|
-
"ai.usage.promptTokens",
|
|
5058
|
-
"ai.usage.completionTokens"
|
|
5059
|
-
];
|
|
5060
5055
|
|
|
5061
5056
|
const useTraces = (componentName, baseUrl, isWorkflow = false) => {
|
|
5062
5057
|
const [traces, setTraces] = React.useState([]);
|
|
5063
5058
|
const { setTraces: setTraceContextTraces } = React.useContext(TraceContext);
|
|
5064
|
-
const client = React.useMemo(
|
|
5065
|
-
() => new clientJs.MastraClient({
|
|
5066
|
-
baseUrl: baseUrl || ""
|
|
5067
|
-
}),
|
|
5068
|
-
[baseUrl]
|
|
5069
|
-
);
|
|
5059
|
+
const client = React.useMemo(() => createMastraClient(baseUrl), [baseUrl]);
|
|
5070
5060
|
const fetchFn = React.useCallback(async () => {
|
|
5071
5061
|
try {
|
|
5072
5062
|
const res = await client.getTelemetry({
|
|
@@ -5123,7 +5113,10 @@ const Th = ({ className, children, ...props }) => {
|
|
|
5123
5113
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5124
5114
|
"th",
|
|
5125
5115
|
{
|
|
5126
|
-
className: clsx(
|
|
5116
|
+
className: clsx(
|
|
5117
|
+
"text-icon3 text-ui-sm h-full text-left font-normal uppercase first:pl-5 last:pr-5 whitespace-nowrap",
|
|
5118
|
+
className
|
|
5119
|
+
),
|
|
5127
5120
|
...props,
|
|
5128
5121
|
children
|
|
5129
5122
|
}
|
|
@@ -5202,7 +5195,6 @@ const useOpenTrace = () => {
|
|
|
5202
5195
|
setIsOpen: setOpen,
|
|
5203
5196
|
trace: currentTrace,
|
|
5204
5197
|
setSpan,
|
|
5205
|
-
setOpenDetail,
|
|
5206
5198
|
setCurrentTraceIndex
|
|
5207
5199
|
} = React.useContext(TraceContext);
|
|
5208
5200
|
const openTrace = (trace, traceIndex) => {
|
|
@@ -5212,7 +5204,6 @@ const useOpenTrace = () => {
|
|
|
5212
5204
|
setCurrentTraceIndex(traceIndex);
|
|
5213
5205
|
if (open && currentTrace?.[0]?.id !== trace[0].id) return;
|
|
5214
5206
|
setOpen((prev) => !prev);
|
|
5215
|
-
setOpenDetail((prev) => !prev);
|
|
5216
5207
|
};
|
|
5217
5208
|
return { openTrace };
|
|
5218
5209
|
};
|
|
@@ -5226,12 +5217,12 @@ const TracesTableEmpty = ({ colsCount }) => {
|
|
|
5226
5217
|
const TracesTableError = ({ error, colsCount }) => {
|
|
5227
5218
|
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: error.message }) }) }) });
|
|
5228
5219
|
};
|
|
5229
|
-
const TraceRow = ({ trace, index }) => {
|
|
5220
|
+
const TraceRow = ({ trace, index, isActive }) => {
|
|
5230
5221
|
const { openTrace } = useOpenTrace();
|
|
5231
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Row, { children: [
|
|
5222
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Row, { className: isActive ? "bg-surface4" : "", children: [
|
|
5232
5223
|
/* @__PURE__ */ jsxRuntime.jsx(DateTimeCell, { dateTime: new Date(trace.started / 1e3) }),
|
|
5233
5224
|
/* @__PURE__ */ jsxRuntime.jsx(TxtCell, { children: trace.traceId }),
|
|
5234
|
-
/* @__PURE__ */ jsxRuntime.jsx(UnitCell, { unit: "ms", children: trace.duration }),
|
|
5225
|
+
/* @__PURE__ */ jsxRuntime.jsx(UnitCell, { unit: "ms", children: trace.duration / 1e3 }),
|
|
5235
5226
|
/* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => openTrace(trace.trace, index), children: /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(TraceIcon, {}), children: [
|
|
5236
5227
|
trace.trace.length,
|
|
5237
5228
|
" span",
|
|
@@ -5241,6 +5232,7 @@ const TraceRow = ({ trace, index }) => {
|
|
|
5241
5232
|
};
|
|
5242
5233
|
const TracesTable = ({ traces, isLoading, error }) => {
|
|
5243
5234
|
const hasNoTraces = !traces || traces.length === 0;
|
|
5235
|
+
const { currentTraceIndex } = React.useContext(TraceContext);
|
|
5244
5236
|
const colsCount = 4;
|
|
5245
5237
|
return /* @__PURE__ */ jsxRuntime.jsxs(Table, { size: "small", children: [
|
|
5246
5238
|
/* @__PURE__ */ jsxRuntime.jsxs(Thead, { children: [
|
|
@@ -5249,7 +5241,7 @@ const TracesTable = ({ traces, isLoading, error }) => {
|
|
|
5249
5241
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Duration" }),
|
|
5250
5242
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Spans" })
|
|
5251
5243
|
] }),
|
|
5252
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableSkeleton, { colsCount }) : error ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsxRuntime.jsx(TraceRow, { trace, index }, trace.traceId)) })
|
|
5244
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableSkeleton, { colsCount }) : error ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsxRuntime.jsx(TraceRow, { trace, index, isActive: index === currentTraceIndex }, trace.traceId)) })
|
|
5253
5245
|
] });
|
|
5254
5246
|
};
|
|
5255
5247
|
|
|
@@ -5319,8 +5311,8 @@ const MastraResizablePanel = ({
|
|
|
5319
5311
|
!disabled && dividerPosition === "left" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5320
5312
|
"div",
|
|
5321
5313
|
{
|
|
5322
|
-
className: `w-
|
|
5323
|
-
${isDragging ? "bg-
|
|
5314
|
+
className: `w-px bg-border1 h-full cursor-col-resize hover:w-1.5 hover:bg-mastra-border-2 hover:bg-[#424242] active:bg-mastra-border-3 active:bg-[#3e3e3e] transition-colors absolute inset-y-0 z-10
|
|
5315
|
+
${isDragging ? "bg-border2 w-1.5 cursor- col-resize" : ""}`,
|
|
5324
5316
|
onMouseDown: handleMouseDown
|
|
5325
5317
|
}
|
|
5326
5318
|
) : null,
|
|
@@ -5328,183 +5320,257 @@ const MastraResizablePanel = ({
|
|
|
5328
5320
|
!disabled && dividerPosition === "right" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5329
5321
|
"div",
|
|
5330
5322
|
{
|
|
5331
|
-
className: `w-
|
|
5332
|
-
${isDragging ? "bg-
|
|
5323
|
+
className: `w-px bg-border1 h-full cursor-col-resize hover:w-1.5 hover:bg-border2 active:bg-border3 transition-colors absolute inset-y-0 z-10
|
|
5324
|
+
${isDragging ? "bg-border2 w-1.5 cursor- col-resize" : ""}`,
|
|
5333
5325
|
onMouseDown: handleMouseDown
|
|
5334
5326
|
}
|
|
5335
5327
|
) : null
|
|
5336
5328
|
] });
|
|
5337
5329
|
};
|
|
5338
5330
|
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
)
|
|
5385
|
-
}
|
|
5386
|
-
) : null,
|
|
5387
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full gap-4 pr-4", children: [
|
|
5388
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5389
|
-
"p",
|
|
5390
|
-
{
|
|
5391
|
-
className: cn("max-w-[250px] text-sm", {
|
|
5392
|
-
"text-white": node?.status?.code === 0,
|
|
5393
|
-
"text-[#FF4500]": node?.status?.code !== 0,
|
|
5394
|
-
"px-1": depth === 0,
|
|
5395
|
-
truncate: containerRef.current?.offsetWidth && containerRef.current?.offsetWidth < 450 && depth > 1 && node.name?.length > 16
|
|
5396
|
-
}),
|
|
5397
|
-
children: node.name
|
|
5398
|
-
}
|
|
5399
|
-
),
|
|
5400
|
-
node.duration > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
|
|
5401
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-[11px] h-px w-full bg-[hsl(220,14%,19%)]" }),
|
|
5402
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5403
|
-
"div",
|
|
5404
|
-
{
|
|
5405
|
-
style: {
|
|
5406
|
-
width: `${widthPercentage}%`,
|
|
5407
|
-
left: 0
|
|
5408
|
-
},
|
|
5409
|
-
className: cn(
|
|
5410
|
-
"absolute top-[9px] z-0 h-[5px] rounded-[5px] bg-white transition-all",
|
|
5411
|
-
node.name.includes("agent") && "left-1/2 bg-green-500",
|
|
5412
|
-
node.name.includes("llm") && "bg-[#5699A8]",
|
|
5413
|
-
node.name.includes("ai") && "left-2/4 w-5 bg-[#F09A56]"
|
|
5414
|
-
)
|
|
5415
|
-
}
|
|
5416
|
-
),
|
|
5417
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "absolute left-0 top-3 text-[0.63rem] text-mastra-el-3", children: [
|
|
5418
|
-
formatDuration(node.duration),
|
|
5419
|
-
"ms"
|
|
5420
|
-
] })
|
|
5421
|
-
] })
|
|
5422
|
-
] })
|
|
5423
|
-
]
|
|
5424
|
-
}
|
|
5425
|
-
),
|
|
5426
|
-
hasChildren && isExpanded && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: node.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(TreeNode, { node: child, depth: depth + 1 }, child.id)) })
|
|
5331
|
+
const sizeClasses = {
|
|
5332
|
+
md: "h-button-md gap-md",
|
|
5333
|
+
lg: "h-button-lg gap-lg"
|
|
5334
|
+
};
|
|
5335
|
+
const variantClasses$1 = {
|
|
5336
|
+
default: "bg-surface2 hover:bg-surface4 text-icon3 hover:text-icon6",
|
|
5337
|
+
light: "bg-surface3 hover:bg-surface5 text-icon6"
|
|
5338
|
+
};
|
|
5339
|
+
const Button = ({ className, as, size = "md", variant = "default", ...props }) => {
|
|
5340
|
+
const Component = as || "button";
|
|
5341
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5342
|
+
Component,
|
|
5343
|
+
{
|
|
5344
|
+
className: clsx(
|
|
5345
|
+
"bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
|
|
5346
|
+
variantClasses$1[variant],
|
|
5347
|
+
sizeClasses[size],
|
|
5348
|
+
className
|
|
5349
|
+
),
|
|
5350
|
+
...props
|
|
5351
|
+
}
|
|
5352
|
+
);
|
|
5353
|
+
};
|
|
5354
|
+
|
|
5355
|
+
const TraceTree = ({ children }) => {
|
|
5356
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ol", { children });
|
|
5357
|
+
};
|
|
5358
|
+
|
|
5359
|
+
const variantClasses = {
|
|
5360
|
+
agent: "bg-accent1"
|
|
5361
|
+
};
|
|
5362
|
+
const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
|
|
5363
|
+
const variantClass = variant ? variantClasses[variant] : "bg-accent3";
|
|
5364
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
5365
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("absolute h-1 rounded-full", variantClass), style: { width: `${progressPercent}%` } }) }),
|
|
5366
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 pt-0.5", children: [
|
|
5367
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
|
|
5368
|
+
durationMs,
|
|
5369
|
+
"ms"
|
|
5370
|
+
] }),
|
|
5371
|
+
tokenCount && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
|
|
5372
|
+
tokenCount,
|
|
5373
|
+
"t"
|
|
5374
|
+
] })
|
|
5375
|
+
] })
|
|
5427
5376
|
] });
|
|
5428
|
-
}
|
|
5377
|
+
};
|
|
5378
|
+
|
|
5379
|
+
const TraceDurationContext = React.createContext(0);
|
|
5380
|
+
const useTraceDuration = () => {
|
|
5381
|
+
return React.useContext(TraceDurationContext);
|
|
5382
|
+
};
|
|
5383
|
+
const TraceDurationProvider = ({ children, durationMs }) => {
|
|
5384
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceDurationContext.Provider, { value: durationMs, children });
|
|
5385
|
+
};
|
|
5386
|
+
|
|
5387
|
+
const spanIconMap = {
|
|
5388
|
+
tool: ToolsIcon,
|
|
5389
|
+
agent: AgentIcon,
|
|
5390
|
+
workflow: WorkflowIcon,
|
|
5391
|
+
memory: MemoryIcon,
|
|
5392
|
+
rag: TraceIcon,
|
|
5393
|
+
storage: DbIcon,
|
|
5394
|
+
eval: ScoreIcon,
|
|
5395
|
+
other: TraceIcon
|
|
5396
|
+
};
|
|
5397
|
+
const spanVariantClasses = {
|
|
5398
|
+
tool: "text-[#ECB047]",
|
|
5399
|
+
agent: "text-accent1",
|
|
5400
|
+
workflow: "text-accent3",
|
|
5401
|
+
memory: "text-accent2",
|
|
5402
|
+
rag: "text-accent2",
|
|
5403
|
+
storage: "text-accent2",
|
|
5404
|
+
eval: "text-accent4",
|
|
5405
|
+
other: "text-icon6"
|
|
5406
|
+
};
|
|
5407
|
+
const Span = ({ children, durationMs, variant, tokenCount, spans, isRoot, onClick, isActive }) => {
|
|
5408
|
+
const [isExpanded, setIsExpanded] = React.useState(true);
|
|
5409
|
+
const traceDuration = useTraceDuration();
|
|
5410
|
+
const VariantIcon = spanIconMap[variant];
|
|
5411
|
+
const variantClass = spanVariantClasses[variant];
|
|
5412
|
+
const progressPercent = durationMs / traceDuration * 100;
|
|
5413
|
+
const TextEl = onClick ? "button" : "div";
|
|
5414
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceDurationProvider, { durationMs, children: /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
5415
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("grid grid-cols-2 items-center gap-2 rounded-md pl-2", isActive && "bg-surface4"), children: [
|
|
5416
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-8 items-center gap-1", children: [
|
|
5417
|
+
spans ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5418
|
+
"button",
|
|
5419
|
+
{
|
|
5420
|
+
type: "button",
|
|
5421
|
+
"aria-label": isExpanded ? "Collapse span" : "Expand span",
|
|
5422
|
+
"aria-expanded": isExpanded,
|
|
5423
|
+
className: "text-icon3 flex h-4 w-4",
|
|
5424
|
+
onClick: () => setIsExpanded(!isExpanded),
|
|
5425
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { className: clsx("transition-transform -rotate-90", { "rotate-0": isExpanded }) }) })
|
|
5426
|
+
}
|
|
5427
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": true, className: "h-full w-4", children: !isRoot && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-[7px] h-full w-px rounded-full" }) }),
|
|
5428
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TextEl, { className: "flex items-center gap-2 min-w-0", onClick, children: [
|
|
5429
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("bg-surface4 flex items-center justify-center rounded-md p-[3px]", variantClass), children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(VariantIcon, {}) }) }),
|
|
5430
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-md", className: "text-icon6 truncate", children })
|
|
5431
|
+
] })
|
|
5432
|
+
] }),
|
|
5433
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5434
|
+
Time,
|
|
5435
|
+
{
|
|
5436
|
+
durationMs,
|
|
5437
|
+
tokenCount,
|
|
5438
|
+
variant: variant === "agent" ? "agent" : void 0,
|
|
5439
|
+
progressPercent
|
|
5440
|
+
}
|
|
5441
|
+
)
|
|
5442
|
+
] }),
|
|
5443
|
+
isExpanded && spans && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-4", children: spans })
|
|
5444
|
+
] }) });
|
|
5445
|
+
};
|
|
5446
|
+
|
|
5447
|
+
const Spans = ({ children }) => {
|
|
5448
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ol", { children });
|
|
5449
|
+
};
|
|
5450
|
+
|
|
5451
|
+
const Trace = ({ name, spans, durationMs, tokenCount, onClick, variant, isActive }) => {
|
|
5452
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceDurationProvider, { durationMs, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5453
|
+
Span,
|
|
5454
|
+
{
|
|
5455
|
+
isRoot: true,
|
|
5456
|
+
durationMs,
|
|
5457
|
+
variant,
|
|
5458
|
+
spans: /* @__PURE__ */ jsxRuntime.jsx(Spans, { children: spans }),
|
|
5459
|
+
onClick,
|
|
5460
|
+
isActive,
|
|
5461
|
+
children: name
|
|
5462
|
+
}
|
|
5463
|
+
) });
|
|
5464
|
+
};
|
|
5465
|
+
|
|
5466
|
+
const getSpanVariant = (span) => {
|
|
5467
|
+
const attributes = Object.keys(span.attributes || {}).map((k) => k.toLowerCase());
|
|
5468
|
+
const lowerCaseName = span.name.toLowerCase();
|
|
5469
|
+
const isAiSpan = lowerCaseName.startsWith("ai.");
|
|
5470
|
+
if (isAiSpan) {
|
|
5471
|
+
const isAiAboutTool = lowerCaseName.includes("tool");
|
|
5472
|
+
if (isAiAboutTool) return "tool";
|
|
5473
|
+
return "other";
|
|
5474
|
+
}
|
|
5475
|
+
const hasMemoryRelatedAttributes = attributes.some((key) => key.includes("memory") || key.includes("storage"));
|
|
5476
|
+
if (hasMemoryRelatedAttributes) return "memory";
|
|
5477
|
+
const hasToolRelatedAttributes = attributes.some((key) => key.includes("tool"));
|
|
5478
|
+
if (hasToolRelatedAttributes) return "tool";
|
|
5479
|
+
const hasAgentRelatedAttributes = attributes.some((key) => key.includes("agent."));
|
|
5480
|
+
if (hasAgentRelatedAttributes) return "agent";
|
|
5481
|
+
if (lowerCaseName.includes(".insert")) {
|
|
5482
|
+
const evalRelatedAttribute = attributes.find((key) => String(span.attributes?.[key])?.includes("mastra_evals"));
|
|
5483
|
+
if (evalRelatedAttribute) return "eval";
|
|
5484
|
+
}
|
|
5485
|
+
return "other";
|
|
5486
|
+
};
|
|
5429
5487
|
|
|
5430
|
-
function TreeView({ tree }) {
|
|
5431
|
-
return /* @__PURE__ */ jsxRuntime.jsx("ul", { children: tree.map((node) => /* @__PURE__ */ jsxRuntime.jsx(TreeNode, { node }, node.id)) });
|
|
5432
|
-
}
|
|
5433
5488
|
function buildTree(items, parentSpanId = null) {
|
|
5434
5489
|
return items.filter((item) => item.parentSpanId === parentSpanId).map((item) => ({
|
|
5435
5490
|
...item,
|
|
5436
5491
|
children: buildTree(items, item.id)
|
|
5437
5492
|
}));
|
|
5438
5493
|
}
|
|
5494
|
+
const NestedSpans = ({ spans }) => {
|
|
5495
|
+
const { span: activeSpan, setSpan } = React.useContext(TraceContext);
|
|
5496
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Spans, { children: spans.map((span) => {
|
|
5497
|
+
const isActive = span.id === activeSpan?.id;
|
|
5498
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5499
|
+
Span,
|
|
5500
|
+
{
|
|
5501
|
+
spans: span.children.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(NestedSpans, { spans: span.children }),
|
|
5502
|
+
durationMs: span.duration / 1e3,
|
|
5503
|
+
variant: getSpanVariant(span),
|
|
5504
|
+
isActive,
|
|
5505
|
+
onClick: () => setSpan(span),
|
|
5506
|
+
children: span.name
|
|
5507
|
+
},
|
|
5508
|
+
span.id
|
|
5509
|
+
);
|
|
5510
|
+
}) });
|
|
5511
|
+
};
|
|
5439
5512
|
function SpanView({ trace }) {
|
|
5440
|
-
const
|
|
5441
|
-
|
|
5513
|
+
const shallowCopy = [...trace];
|
|
5514
|
+
const tree = buildTree(shallowCopy.reverse());
|
|
5515
|
+
const { span: activeSpan, setSpan } = React.useContext(TraceContext);
|
|
5516
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceTree, { children: tree.map((node) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5517
|
+
Trace,
|
|
5518
|
+
{
|
|
5519
|
+
name: node.name,
|
|
5520
|
+
durationMs: node.duration / 1e3,
|
|
5521
|
+
spans: /* @__PURE__ */ jsxRuntime.jsx(NestedSpans, { spans: node.children }),
|
|
5522
|
+
variant: getSpanVariant(node),
|
|
5523
|
+
isActive: node.id === activeSpan?.id,
|
|
5524
|
+
onClick: () => setSpan(node)
|
|
5525
|
+
}
|
|
5526
|
+
)) });
|
|
5442
5527
|
}
|
|
5443
5528
|
|
|
5529
|
+
const Header = ({ children, border = true }) => {
|
|
5530
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5531
|
+
"header",
|
|
5532
|
+
{
|
|
5533
|
+
className: clsx("h-header-default z-50 flex w-full items-center gap-[18px] bg-transparent px-5", {
|
|
5534
|
+
"border-b-sm border-border1": border
|
|
5535
|
+
}),
|
|
5536
|
+
children
|
|
5537
|
+
}
|
|
5538
|
+
);
|
|
5539
|
+
};
|
|
5540
|
+
const HeaderTitle = ({ children }) => {
|
|
5541
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "h1", variant: "ui-lg", className: "font-medium text-white", children });
|
|
5542
|
+
};
|
|
5543
|
+
const HeaderAction = ({ children }) => {
|
|
5544
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto", children });
|
|
5545
|
+
};
|
|
5546
|
+
const HeaderGroup = ({ children }) => {
|
|
5547
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gap-lg flex items-center", children });
|
|
5548
|
+
};
|
|
5549
|
+
|
|
5444
5550
|
function TraceDetails() {
|
|
5445
5551
|
const { trace, currentTraceIndex, prevTrace, nextTrace, traces, clearData } = React.useContext(TraceContext);
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
] }),
|
|
5453
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-mastra-el-3", children: [
|
|
5454
|
-
trace?.length ? trace.length : 0,
|
|
5455
|
-
" span",
|
|
5456
|
-
trace?.length && trace.length > 1 ? "s" : ""
|
|
5457
|
-
] })
|
|
5458
|
-
] }),
|
|
5459
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
5460
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
5461
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5462
|
-
Button$1,
|
|
5463
|
-
{
|
|
5464
|
-
onClick: () => {
|
|
5465
|
-
prevTrace();
|
|
5466
|
-
},
|
|
5467
|
-
disabled: currentTraceIndex === 0,
|
|
5468
|
-
variant: "secondary",
|
|
5469
|
-
size: "icon",
|
|
5470
|
-
className: "!h-3 !w-3 rotate-180 !px-3 py-3 text-mastra-el-3 transition-colors hover:text-white",
|
|
5471
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {})
|
|
5472
|
-
}
|
|
5473
|
-
),
|
|
5474
|
-
" ",
|
|
5475
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5476
|
-
Button$1,
|
|
5477
|
-
{
|
|
5478
|
-
onClick: () => {
|
|
5479
|
-
nextTrace();
|
|
5480
|
-
},
|
|
5481
|
-
disabled: currentTraceIndex === traces.length - 1,
|
|
5482
|
-
variant: "secondary",
|
|
5483
|
-
size: "icon",
|
|
5484
|
-
className: "!h-3 !w-3 !px-3 py-3 text-mastra-el-3 transition-colors hover:text-white",
|
|
5485
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {})
|
|
5486
|
-
}
|
|
5487
|
-
)
|
|
5488
|
-
] }),
|
|
5489
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-secondary inline-block h-5 w-px" }),
|
|
5552
|
+
const actualTrace = traces[currentTraceIndex];
|
|
5553
|
+
if (!actualTrace || !trace) return null;
|
|
5554
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("aside", { children: [
|
|
5555
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Header, { children: [
|
|
5556
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
5557
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { className: "bg-transparent border-none", onClick: prevTrace, disabled: currentTraceIndex === 0, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, {}) }) }),
|
|
5490
5558
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5491
|
-
Button
|
|
5559
|
+
Button,
|
|
5492
5560
|
{
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
size: "icon",
|
|
5498
|
-
className: "!h-3 !w-3 !px-3 py-3 text-mastra-el-3 transition-colors hover:text-white",
|
|
5499
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {})
|
|
5561
|
+
className: "bg-transparent border-none",
|
|
5562
|
+
onClick: nextTrace,
|
|
5563
|
+
disabled: currentTraceIndex === traces.length - 1,
|
|
5564
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {}) })
|
|
5500
5565
|
}
|
|
5501
5566
|
)
|
|
5502
|
-
] })
|
|
5567
|
+
] }),
|
|
5568
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5", children: [
|
|
5569
|
+
"Trace ",
|
|
5570
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-icon3", children: actualTrace.traceId.substring(0, 5) })
|
|
5571
|
+
] }) })
|
|
5503
5572
|
] }),
|
|
5504
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5505
|
-
" ",
|
|
5506
|
-
trace && /* @__PURE__ */ jsxRuntime.jsx(SpanView, { trace })
|
|
5507
|
-
] })
|
|
5573
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-5", children: /* @__PURE__ */ jsxRuntime.jsx(SpanView, { trace }) })
|
|
5508
5574
|
] });
|
|
5509
5575
|
}
|
|
5510
5576
|
|
|
@@ -5531,179 +5597,135 @@ const SyntaxHighlighter = ({ data }) => {
|
|
|
5531
5597
|
};
|
|
5532
5598
|
|
|
5533
5599
|
function SpanDetail() {
|
|
5534
|
-
const { span } = React.useContext(TraceContext);
|
|
5535
|
-
|
|
5536
|
-
const
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
[
|
|
5540
|
-
}
|
|
5541
|
-
}
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5600
|
+
const { span, setSpan, trace } = React.useContext(TraceContext);
|
|
5601
|
+
if (!span || !trace) return null;
|
|
5602
|
+
const prevSpan = () => {
|
|
5603
|
+
const currentIndex = trace.findIndex((t) => t.id === span.id);
|
|
5604
|
+
if (currentIndex !== -1 && currentIndex < trace.length - 1) {
|
|
5605
|
+
setSpan(trace[currentIndex + 1]);
|
|
5606
|
+
}
|
|
5607
|
+
};
|
|
5608
|
+
const nextSpan = () => {
|
|
5609
|
+
const currentIndex = trace.findIndex((t) => t.id === span.id);
|
|
5610
|
+
if (currentIndex !== -1 && currentIndex > 0) {
|
|
5611
|
+
setSpan(trace[currentIndex - 1]);
|
|
5612
|
+
}
|
|
5613
|
+
};
|
|
5614
|
+
const SpanIcon = spanIconMap[getSpanVariant(span)];
|
|
5615
|
+
const variantClass = spanVariantClasses[getSpanVariant(span)];
|
|
5616
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("aside", { children: [
|
|
5617
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Header, { children: [
|
|
5618
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
5619
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { className: "bg-transparent border-none", onClick: prevSpan, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, {}) }) }),
|
|
5620
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { className: "bg-transparent border-none", onClick: nextSpan, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, {}) }) })
|
|
5621
|
+
] }),
|
|
5622
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5", as: "h2", children: [
|
|
5623
|
+
"Span ",
|
|
5624
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-icon3", children: span.id.substring(0, 5) })
|
|
5625
|
+
] }) })
|
|
5554
5626
|
] }),
|
|
5555
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
5556
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
5557
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
5558
|
-
|
|
5559
|
-
" ",
|
|
5560
|
-
span?.duration ? formatDuration(span?.duration) : "",
|
|
5561
|
-
"ms"
|
|
5562
|
-
] })
|
|
5627
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-5", children: [
|
|
5628
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "header-md", as: "h3", className: "text-icon-6 flex items-center gap-4 pb-3", children: [
|
|
5629
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: "bg-surface4 p-1 rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(SpanIcon, { className: variantClass }) }),
|
|
5630
|
+
span.name
|
|
5563
5631
|
] }),
|
|
5564
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5565
|
-
|
|
5566
|
-
|
|
5632
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 items-center", children: /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(LatencyIcon, {}), children: [
|
|
5633
|
+
formatDuration(span.duration),
|
|
5634
|
+
"ms"
|
|
5635
|
+
] }) }),
|
|
5636
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
5637
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "grid grid-cols-2 justify-between gap-2", children: [
|
|
5638
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "font-medium text-ui-md text-icon3", children: "ID" }),
|
|
5639
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "text-ui-md text-icon6", children: span.id }),
|
|
5640
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "font-medium text-ui-md text-icon3", children: "Created at" }),
|
|
5641
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "text-ui-md text-icon6", children: span.startTime ? formatOtelTimestamp(span.startTime) : "" })
|
|
5567
5642
|
] }),
|
|
5568
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
] })
|
|
5572
|
-
] }),
|
|
5573
|
-
span?.status?.code !== 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t-[0.5px] px-6 pt-4", children: span && span?.events?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Events, { span }) }) : null,
|
|
5574
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t-[0.5px] px-6 pt-4", children: span && /* @__PURE__ */ jsxRuntime.jsx(Attributes, { span: { ...span, attributes: isAiSpan ? aiSpanAttributes : span?.attributes } }) }),
|
|
5575
|
-
span?.status?.code === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t-[0.5px] px-6 pt-4", children: span && span?.events?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Events, { span }) }) : null
|
|
5643
|
+
span.attributes && /* @__PURE__ */ jsxRuntime.jsx(Attributes, { attributes: span.attributes }),
|
|
5644
|
+
span.events?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Events, { span })
|
|
5645
|
+
] })
|
|
5576
5646
|
] });
|
|
5577
5647
|
}
|
|
5648
|
+
function Attributes({ attributes }) {
|
|
5649
|
+
if (!attributes) return null;
|
|
5650
|
+
const entries = Object.entries(attributes);
|
|
5651
|
+
if (entries.length === 0) return null;
|
|
5652
|
+
const keysToHide = ["http.request_id", "componentName"];
|
|
5653
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: entries.filter(([key]) => !keysToHide.includes(key)).map(([key, val]) => {
|
|
5654
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
5655
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
5656
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "h4", variant: "ui-md", className: "text-icon3 pb-2", children: transformKey(key) }),
|
|
5657
|
+
/* @__PURE__ */ jsxRuntime.jsx(AttributeValue, { value: val })
|
|
5658
|
+
] }, key);
|
|
5659
|
+
}) });
|
|
5660
|
+
}
|
|
5661
|
+
const AttributeValue = ({ value }) => {
|
|
5662
|
+
if (!value)
|
|
5663
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-md", className: "text-icon6", children: "N/A" });
|
|
5664
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
5665
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-md", className: "text-icon6", children: String(value) });
|
|
5666
|
+
}
|
|
5667
|
+
if (typeof value === "object") {
|
|
5668
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter, { data: value });
|
|
5669
|
+
}
|
|
5670
|
+
try {
|
|
5671
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter, { data: JSON.parse(value) });
|
|
5672
|
+
} catch {
|
|
5673
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-md", className: "text-icon6", children: String(value) });
|
|
5674
|
+
}
|
|
5675
|
+
};
|
|
5578
5676
|
function Events({ span }) {
|
|
5579
5677
|
if (!span.events) return null;
|
|
5580
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
5581
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
5678
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
5679
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
|
|
5680
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-md", className: "text-icon6 pb-2", children: "Events" }),
|
|
5582
5681
|
span.events.map((event) => {
|
|
5583
|
-
const
|
|
5584
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5585
|
-
"div",
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
5590
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
event.name
|
|
5597
|
-
|
|
5682
|
+
const isLast = event === span.events[span.events.length - 1];
|
|
5683
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
5684
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
5685
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "grid grid-cols-2 justify-between gap-2 pb-2", children: [
|
|
5686
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "font-medium text-ui-md text-icon3", children: "Name" }),
|
|
5687
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "text-ui-md text-icon6", children: event.name }),
|
|
5688
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "font-medium text-ui-md text-icon3", children: "Time" }),
|
|
5689
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "text-ui-md text-icon6", children: event.timeUnixNano ? formatOtelTimestamp2(Number(event.timeUnixNano)) : "N/A" })
|
|
5690
|
+
] }),
|
|
5691
|
+
event.attributes?.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-2", children: event.attributes.filter((attribute) => attribute !== null).map((attribute) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
5692
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "h4", variant: "ui-md", className: "text-icon3 pb-2", children: transformKey(attribute.key) }),
|
|
5693
|
+
/* @__PURE__ */ jsxRuntime.jsx(AttributeValue, { value: attribute.value })
|
|
5694
|
+
] }, attribute.key)) }) : null
|
|
5695
|
+
] }, event.name),
|
|
5696
|
+
!isLast && /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" })
|
|
5697
|
+
] }, event.name);
|
|
5598
5698
|
})
|
|
5599
5699
|
] });
|
|
5600
5700
|
}
|
|
5601
|
-
function Attributes({ span }) {
|
|
5602
|
-
if (!span.attributes) return null;
|
|
5603
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AttributesValues, { attributes: span.attributes });
|
|
5604
|
-
}
|
|
5605
|
-
function AttributesValues({
|
|
5606
|
-
attributes,
|
|
5607
|
-
depth = 0,
|
|
5608
|
-
keyName
|
|
5609
|
-
}) {
|
|
5610
|
-
if (attributes === null || attributes === void 0 || Array.isArray(attributes) && attributes.length === 0 || typeof attributes === "object" && attributes !== null && Object.keys(attributes).length === 0) {
|
|
5611
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm overflow-x-scroll", children: "N/A" });
|
|
5612
|
-
}
|
|
5613
|
-
if (typeof attributes === "string") {
|
|
5614
|
-
try {
|
|
5615
|
-
const attr = JSON.parse(attributes);
|
|
5616
|
-
if (typeof attr === "object" || Array.isArray(attr)) {
|
|
5617
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter, { data: attr });
|
|
5618
|
-
}
|
|
5619
|
-
} catch {
|
|
5620
|
-
const val = attributes ? cleanString(attributes.toString()) : "N/A";
|
|
5621
|
-
if (keyName === "Input" && val === "[Not Serializable]") {
|
|
5622
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm overflow-x-scroll", children: "No input" });
|
|
5623
|
-
}
|
|
5624
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm overflow-x-scroll", children: attributes ? cleanString(attributes.toString()) : "N/A" });
|
|
5625
|
-
}
|
|
5626
|
-
}
|
|
5627
|
-
const processedValue = attributes;
|
|
5628
|
-
if (Array.isArray(processedValue)) {
|
|
5629
|
-
if (processedValue.length === 0) return null;
|
|
5630
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 gap-3", children: processedValue.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntime.jsx(AttributesValues, { attributes: item, depth: depth + 1 }, index) }, index)) }) });
|
|
5631
|
-
}
|
|
5632
|
-
if (typeof processedValue === "object") {
|
|
5633
|
-
const entries = Object.entries(processedValue);
|
|
5634
|
-
if (entries.length === 0) return null;
|
|
5635
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: entries.map(([key, val]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 p-2 pl-0", children: [
|
|
5636
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm capitalize text-mastra-el-3", children: transformKey(key) }),
|
|
5637
|
-
/* @__PURE__ */ jsxRuntime.jsx(AttributesValues, { attributes: val, depth: depth + 1, keyName: transformKey(key) })
|
|
5638
|
-
] }, key)) }) });
|
|
5639
|
-
}
|
|
5640
|
-
if (typeof processedValue === "boolean")
|
|
5641
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-sm", children: processedValue.toString() || "N/A" });
|
|
5642
|
-
if (typeof processedValue === "number") return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-sm", children: processedValue.toString() });
|
|
5643
|
-
if (typeof processedValue === "string")
|
|
5644
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-sm", children: processedValue ? cleanString(processedValue.toString()) : "N/A" });
|
|
5645
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400", children: String(processedValue) });
|
|
5646
|
-
}
|
|
5647
5701
|
|
|
5648
|
-
const TracesSidebar = ({
|
|
5649
|
-
|
|
5650
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5702
|
+
const TracesSidebar = ({ onResize }) => {
|
|
5703
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5651
5704
|
MastraResizablePanel,
|
|
5652
5705
|
{
|
|
5653
|
-
className:
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
defaultWidth: open ? 50 : 30,
|
|
5658
|
-
minimumWidth: open ? 50 : 30,
|
|
5659
|
-
maximumWidth: open ? 90 : 50,
|
|
5706
|
+
className: "h-full",
|
|
5707
|
+
defaultWidth: 70,
|
|
5708
|
+
minimumWidth: 50,
|
|
5709
|
+
maximumWidth: 70,
|
|
5660
5710
|
setCurrentWidth: onResize,
|
|
5661
|
-
children: [
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
className: "h-full overflow-x-scroll px-0 absolute left-0 top-0 min-w-[50%] bg-mastra-bg-1 bg-[#121212]",
|
|
5666
|
-
style: { width: `${width}%` },
|
|
5667
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(TraceDetails, {})
|
|
5668
|
-
}
|
|
5669
|
-
),
|
|
5670
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5671
|
-
MastraResizablePanel,
|
|
5672
|
-
{
|
|
5673
|
-
defaultWidth: 50,
|
|
5674
|
-
minimumWidth: 30,
|
|
5675
|
-
maximumWidth: 80,
|
|
5676
|
-
className: cn("h-full overflow-y-hidden border-l-[0.5px] right-0 top-0 z-20 bg-mastra-bg-1 bg-[#121212]", {
|
|
5677
|
-
absolute: open,
|
|
5678
|
-
"unset-position": !open
|
|
5679
|
-
}),
|
|
5680
|
-
disabled: !open,
|
|
5681
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-y-scroll", children: !openDetail ? children : /* @__PURE__ */ jsxRuntime.jsx(SpanDetail, {}) })
|
|
5682
|
-
}
|
|
5683
|
-
)
|
|
5684
|
-
]
|
|
5711
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full grid grid-cols-2", children: [
|
|
5712
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-scroll w-full h-[calc(100%-40px)]", children: /* @__PURE__ */ jsxRuntime.jsx(TraceDetails, {}) }),
|
|
5713
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[calc(100%-40px)] overflow-x-scroll w-full border-l border-border1", children: /* @__PURE__ */ jsxRuntime.jsx(SpanDetail, {}) })
|
|
5714
|
+
] })
|
|
5685
5715
|
}
|
|
5686
5716
|
);
|
|
5687
5717
|
};
|
|
5688
5718
|
|
|
5689
|
-
function AgentTraces({ agentName, baseUrl
|
|
5690
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(AgentTracesInner, { agentName, baseUrl
|
|
5719
|
+
function AgentTraces({ agentName, baseUrl }) {
|
|
5720
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(AgentTracesInner, { agentName, baseUrl }) });
|
|
5691
5721
|
}
|
|
5692
|
-
function AgentTracesInner({ agentName, baseUrl
|
|
5693
|
-
const [sidebarWidth, setSidebarWidth] = React.useState(
|
|
5722
|
+
function AgentTracesInner({ agentName, baseUrl }) {
|
|
5723
|
+
const [sidebarWidth, setSidebarWidth] = React.useState(100);
|
|
5694
5724
|
const { traces, firstCallLoading, error } = useTraces(agentName, baseUrl);
|
|
5695
5725
|
const { isOpen: open } = React.useContext(TraceContext);
|
|
5696
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("main", { className: "h-full relative overflow-hidden flex
|
|
5697
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
5698
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5699
|
-
TracesSidebar,
|
|
5700
|
-
{
|
|
5701
|
-
className: cn(open ? "grid grid-cols-2 w-[60%]" : "min-w-[325px]"),
|
|
5702
|
-
width: 100 - sidebarWidth,
|
|
5703
|
-
onResize: setSidebarWidth,
|
|
5704
|
-
children: sidebarChild
|
|
5705
|
-
}
|
|
5706
|
-
)
|
|
5726
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("main", { className: "h-full relative overflow-hidden flex", children: [
|
|
5727
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("h-full", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
|
|
5728
|
+
open && /* @__PURE__ */ jsxRuntime.jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
|
|
5707
5729
|
] });
|
|
5708
5730
|
}
|
|
5709
5731
|
|
|
@@ -5730,9 +5752,7 @@ function MastraNetworkRuntimeProvider({
|
|
|
5730
5752
|
}
|
|
5731
5753
|
}
|
|
5732
5754
|
}, [initialMessages, threadId, memory, messages]);
|
|
5733
|
-
const mastra =
|
|
5734
|
-
baseUrl: baseUrl || ""
|
|
5735
|
-
});
|
|
5755
|
+
const mastra = createMastraClient(baseUrl);
|
|
5736
5756
|
console.log("MastraClient initialized");
|
|
5737
5757
|
console.log(messages, "###");
|
|
5738
5758
|
const network = mastra.getNetwork(agentId);
|
|
@@ -6121,24 +6141,16 @@ const NetworkChat = ({ agentId, memory }) => {
|
|
|
6121
6141
|
return /* @__PURE__ */ jsxRuntime.jsx(MastraNetworkRuntimeProvider, { agentId, memory, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { ToolFallback }) }) });
|
|
6122
6142
|
};
|
|
6123
6143
|
|
|
6124
|
-
function WorkflowTraces({ workflowName, baseUrl
|
|
6125
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowTracesInner, { workflowName, baseUrl
|
|
6144
|
+
function WorkflowTraces({ workflowName, baseUrl }) {
|
|
6145
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowTracesInner, { workflowName, baseUrl }) });
|
|
6126
6146
|
}
|
|
6127
|
-
function WorkflowTracesInner({ workflowName, baseUrl
|
|
6128
|
-
const [sidebarWidth, setSidebarWidth] = React.useState(
|
|
6147
|
+
function WorkflowTracesInner({ workflowName, baseUrl }) {
|
|
6148
|
+
const [sidebarWidth, setSidebarWidth] = React.useState(100);
|
|
6129
6149
|
const { traces, error, firstCallLoading } = useTraces(workflowName, baseUrl, true);
|
|
6130
6150
|
const { isOpen: open } = React.useContext(TraceContext);
|
|
6131
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("main", { className: "h-full relative overflow-hidden flex
|
|
6132
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
6133
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6134
|
-
TracesSidebar,
|
|
6135
|
-
{
|
|
6136
|
-
className: cn(open ? "grid grid-cols-2 w-[60%]" : "min-w-[325px]"),
|
|
6137
|
-
width: 100 - sidebarWidth,
|
|
6138
|
-
onResize: setSidebarWidth,
|
|
6139
|
-
children: sidebarChild
|
|
6140
|
-
}
|
|
6141
|
-
)
|
|
6151
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("main", { className: "h-full relative overflow-hidden flex", children: [
|
|
6152
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("h-full", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
|
|
6153
|
+
open && /* @__PURE__ */ jsxRuntime.jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
|
|
6142
6154
|
] });
|
|
6143
6155
|
}
|
|
6144
6156
|
|
|
@@ -6180,9 +6192,7 @@ const sanitizeVNexWorkflowWatchResult = (record) => {
|
|
|
6180
6192
|
const useWorkflow = (workflowId, baseUrl) => {
|
|
6181
6193
|
const [workflow, setWorkflow] = React.useState(null);
|
|
6182
6194
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
6183
|
-
const client =
|
|
6184
|
-
baseUrl: baseUrl || ""
|
|
6185
|
-
});
|
|
6195
|
+
const client = createMastraClient(baseUrl);
|
|
6186
6196
|
React.useEffect(() => {
|
|
6187
6197
|
const fetchWorkflow = async () => {
|
|
6188
6198
|
setIsLoading(true);
|
|
@@ -6227,9 +6237,7 @@ const useWorkflow = (workflowId, baseUrl) => {
|
|
|
6227
6237
|
const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
6228
6238
|
const [vNextWorkflow, setVNextWorkflow] = React.useState(null);
|
|
6229
6239
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
6230
|
-
const client =
|
|
6231
|
-
baseUrl: baseUrl || ""
|
|
6232
|
-
});
|
|
6240
|
+
const client = createMastraClient(baseUrl);
|
|
6233
6241
|
React.useEffect(() => {
|
|
6234
6242
|
const fetchWorkflow = async () => {
|
|
6235
6243
|
setIsLoading(true);
|
|
@@ -6254,9 +6262,7 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
|
|
|
6254
6262
|
return { vNextWorkflow, isLoading };
|
|
6255
6263
|
};
|
|
6256
6264
|
const useExecuteWorkflow = (baseUrl) => {
|
|
6257
|
-
const client =
|
|
6258
|
-
baseUrl: baseUrl || ""
|
|
6259
|
-
});
|
|
6265
|
+
const client = createMastraClient(baseUrl);
|
|
6260
6266
|
const createWorkflowRun = async ({ workflowId, prevRunId }) => {
|
|
6261
6267
|
try {
|
|
6262
6268
|
const workflow = client.getWorkflow(workflowId);
|
|
@@ -6354,12 +6360,9 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6354
6360
|
const watchWorkflow = async ({ workflowId, runId }) => {
|
|
6355
6361
|
try {
|
|
6356
6362
|
setIsWatchingWorkflow(true);
|
|
6357
|
-
const client =
|
|
6358
|
-
baseUrl
|
|
6359
|
-
});
|
|
6363
|
+
const client = createMastraClient(baseUrl);
|
|
6360
6364
|
const workflow = client.getWorkflow(workflowId);
|
|
6361
6365
|
await workflow.watch({ runId }, (record) => {
|
|
6362
|
-
console.log("record in use-workflows==", record);
|
|
6363
6366
|
try {
|
|
6364
6367
|
debouncedSetWatchResult(record);
|
|
6365
6368
|
} catch (err) {
|
|
@@ -6383,12 +6386,9 @@ const useWatchWorkflow = (baseUrl) => {
|
|
|
6383
6386
|
const watchVNextWorkflow = async ({ workflowId, runId }) => {
|
|
6384
6387
|
try {
|
|
6385
6388
|
setIsWatchingVNextWorkflow(true);
|
|
6386
|
-
const client =
|
|
6387
|
-
baseUrl
|
|
6388
|
-
});
|
|
6389
|
+
const client = createMastraClient(baseUrl);
|
|
6389
6390
|
const workflow = client.getVNextWorkflow(workflowId);
|
|
6390
6391
|
await workflow.watch({ runId }, (record) => {
|
|
6391
|
-
console.log("record in use-workflows===", record);
|
|
6392
6392
|
try {
|
|
6393
6393
|
debouncedSetVNextWatchResult(record);
|
|
6394
6394
|
} catch (err) {
|
|
@@ -6425,9 +6425,7 @@ const useResumeWorkflow = (baseUrl) => {
|
|
|
6425
6425
|
}) => {
|
|
6426
6426
|
try {
|
|
6427
6427
|
setIsResumingWorkflow(true);
|
|
6428
|
-
const client =
|
|
6429
|
-
baseUrl: baseUrl || ""
|
|
6430
|
-
});
|
|
6428
|
+
const client = createMastraClient(baseUrl);
|
|
6431
6429
|
const response = await client.getWorkflow(workflowId).resume({ stepId, runId, context });
|
|
6432
6430
|
return response;
|
|
6433
6431
|
} catch (error) {
|
|
@@ -6446,9 +6444,7 @@ const useResumeWorkflow = (baseUrl) => {
|
|
|
6446
6444
|
}) => {
|
|
6447
6445
|
try {
|
|
6448
6446
|
setIsResumingVNextWorkflow(true);
|
|
6449
|
-
const client =
|
|
6450
|
-
baseUrl: baseUrl || ""
|
|
6451
|
-
});
|
|
6447
|
+
const client = createMastraClient(baseUrl);
|
|
6452
6448
|
const response = await client.getVNextWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext });
|
|
6453
6449
|
return response;
|
|
6454
6450
|
} catch (error) {
|
|
@@ -7539,12 +7535,12 @@ const ErrorMessage = ({ error }) => /* @__PURE__ */ jsxRuntime.jsxs(Alert, { var
|
|
|
7539
7535
|
|
|
7540
7536
|
const SubmitButton = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Button$1, { type: "submit", children });
|
|
7541
7537
|
|
|
7542
|
-
const StringField = ({ inputProps, error, id }) => {
|
|
7538
|
+
const StringField = ({ inputProps, error, field, id }) => {
|
|
7543
7539
|
const { key, ...props } = inputProps;
|
|
7544
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Input, { id, className: error ? "border-destructive" : "", ...props });
|
|
7540
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Input, { id, className: error ? "border-destructive" : "", ...props, defaultValue: field.default });
|
|
7545
7541
|
};
|
|
7546
7542
|
|
|
7547
|
-
const NumberField = ({ inputProps, error, id }) => {
|
|
7543
|
+
const NumberField = ({ inputProps, error, field, id }) => {
|
|
7548
7544
|
const { key, ...props } = inputProps;
|
|
7549
7545
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7550
7546
|
Input,
|
|
@@ -7553,6 +7549,7 @@ const NumberField = ({ inputProps, error, id }) => {
|
|
|
7553
7549
|
type: "number",
|
|
7554
7550
|
className: error ? "border-destructive" : "",
|
|
7555
7551
|
...props,
|
|
7552
|
+
defaultValue: field.default,
|
|
7556
7553
|
onChange: (e) => {
|
|
7557
7554
|
const value = e.target.value;
|
|
7558
7555
|
if (value !== "" && !isNaN(Number(value))) {
|
|
@@ -7587,7 +7584,7 @@ const Checkbox = React__namespace.forwardRef(({ className, ...props }, ref) => /
|
|
|
7587
7584
|
));
|
|
7588
7585
|
Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
|
|
7589
7586
|
|
|
7590
|
-
const BooleanField = ({ field, label, id, inputProps }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
7587
|
+
const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
7591
7588
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7592
7589
|
Checkbox,
|
|
7593
7590
|
{
|
|
@@ -7595,13 +7592,13 @@ const BooleanField = ({ field, label, id, inputProps }) => /* @__PURE__ */ jsxRu
|
|
|
7595
7592
|
onCheckedChange: (checked) => {
|
|
7596
7593
|
const event = {
|
|
7597
7594
|
target: {
|
|
7598
|
-
name:
|
|
7595
|
+
name: inputProps.name,
|
|
7599
7596
|
value: checked
|
|
7600
7597
|
}
|
|
7601
7598
|
};
|
|
7602
7599
|
inputProps.onChange(event);
|
|
7603
7600
|
},
|
|
7604
|
-
|
|
7601
|
+
defaultChecked: field.default
|
|
7605
7602
|
}
|
|
7606
7603
|
),
|
|
7607
7604
|
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: id, children: [
|
|
@@ -7838,9 +7835,17 @@ const DefaultButton = React__namespace.forwardRef(
|
|
|
7838
7835
|
);
|
|
7839
7836
|
DefaultButton.displayName = "DefaultButton";
|
|
7840
7837
|
|
|
7841
|
-
const DateField = ({ inputProps, error, id }) => {
|
|
7838
|
+
const DateField = ({ inputProps, field, error, id }) => {
|
|
7842
7839
|
const { key, ...props } = inputProps;
|
|
7843
7840
|
const [value, setValue] = React.useState(null);
|
|
7841
|
+
React.useEffect(() => {
|
|
7842
|
+
if (field.default) {
|
|
7843
|
+
const date = new Date(field.default);
|
|
7844
|
+
if (dateFns.isValid(date)) {
|
|
7845
|
+
setValue(date);
|
|
7846
|
+
}
|
|
7847
|
+
}
|
|
7848
|
+
}, [field]);
|
|
7844
7849
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7845
7850
|
DatePicker,
|
|
7846
7851
|
{
|
|
@@ -7920,16 +7925,16 @@ const SelectItem = React__namespace.forwardRef(({ className, children, ...props
|
|
|
7920
7925
|
));
|
|
7921
7926
|
SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
|
|
7922
7927
|
|
|
7923
|
-
const SelectField = ({ field, inputProps, error, id }) => {
|
|
7928
|
+
const SelectField = ({ field, inputProps, error, id, value }) => {
|
|
7924
7929
|
const { key, ...props } = inputProps;
|
|
7925
7930
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7926
7931
|
Select,
|
|
7927
7932
|
{
|
|
7928
7933
|
...props,
|
|
7929
|
-
onValueChange: (
|
|
7934
|
+
onValueChange: (value2) => {
|
|
7930
7935
|
const syntheticEvent = {
|
|
7931
7936
|
target: {
|
|
7932
|
-
value,
|
|
7937
|
+
value: value2,
|
|
7933
7938
|
name: inputProps.name
|
|
7934
7939
|
}
|
|
7935
7940
|
};
|
|
@@ -7976,10 +7981,10 @@ const ArrayElementWrapper = ({ children, onRemove }) => {
|
|
|
7976
7981
|
] });
|
|
7977
7982
|
};
|
|
7978
7983
|
|
|
7979
|
-
const RecordField = ({ inputProps, error, id }) => {
|
|
7980
|
-
const { key,
|
|
7984
|
+
const RecordField = ({ inputProps, field, error, id }) => {
|
|
7985
|
+
const { key, onChange, ...props } = inputProps;
|
|
7981
7986
|
const [pairs, setPairs] = React__namespace.useState(
|
|
7982
|
-
() => Object.entries(
|
|
7987
|
+
() => Object.entries(field.default || {}).map(([key2, val]) => ({
|
|
7983
7988
|
id: key2 || uuid.v4(),
|
|
7984
7989
|
key: key2,
|
|
7985
7990
|
value: val
|
|
@@ -8007,8 +8012,8 @@ const RecordField = ({ inputProps, error, id }) => {
|
|
|
8007
8012
|
},
|
|
8008
8013
|
[onChange, inputProps.name]
|
|
8009
8014
|
);
|
|
8010
|
-
const handleChange = (id2,
|
|
8011
|
-
setPairs((prev) => prev.map((pair) => pair.id === id2 ? { ...pair, [
|
|
8015
|
+
const handleChange = (id2, field2, newValue) => {
|
|
8016
|
+
setPairs((prev) => prev.map((pair) => pair.id === id2 ? { ...pair, [field2]: newValue } : pair));
|
|
8012
8017
|
};
|
|
8013
8018
|
const handleBlur = () => {
|
|
8014
8019
|
updateForm(pairs);
|
|
@@ -8193,7 +8198,7 @@ function DynamicForm({
|
|
|
8193
8198
|
onSubmit: async (values) => {
|
|
8194
8199
|
await onSubmit(values[""]);
|
|
8195
8200
|
},
|
|
8196
|
-
defaultValues,
|
|
8201
|
+
defaultValues: defaultValues ? { "": defaultValues } : void 0,
|
|
8197
8202
|
formProps: {
|
|
8198
8203
|
className: "space-y-4 p-4"
|
|
8199
8204
|
},
|
|
@@ -8676,7 +8681,7 @@ function VNextWorkflowTrigger({
|
|
|
8676
8681
|
] }),
|
|
8677
8682
|
isSuspendedSteps && suspendedSteps?.map((step) => {
|
|
8678
8683
|
const stepDefinition = vNextWorkflow.steps[step.stepId];
|
|
8679
|
-
const stepSchema = stepDefinition?.
|
|
8684
|
+
const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(stepDefinition.resumeSchema))) : z.z.record(z.z.string(), z.z.any());
|
|
8680
8685
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4", children: [
|
|
8681
8686
|
/* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
|
|
8682
8687
|
step.suspendPayload && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -8798,30 +8803,6 @@ const DataTable = ({
|
|
|
8798
8803
|
] });
|
|
8799
8804
|
};
|
|
8800
8805
|
|
|
8801
|
-
const sizeClasses = {
|
|
8802
|
-
md: "h-button-md gap-md",
|
|
8803
|
-
lg: "h-button-lg gap-lg"
|
|
8804
|
-
};
|
|
8805
|
-
const variantClasses = {
|
|
8806
|
-
default: "bg-surface2 hover:bg-surface4 text-icon3 hover:text-icon6",
|
|
8807
|
-
light: "bg-surface3 hover:bg-surface5 text-icon6"
|
|
8808
|
-
};
|
|
8809
|
-
const Button = ({ className, as, size = "md", variant = "default", ...props }) => {
|
|
8810
|
-
const Component = as || "button";
|
|
8811
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8812
|
-
Component,
|
|
8813
|
-
{
|
|
8814
|
-
className: clsx(
|
|
8815
|
-
"bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
|
|
8816
|
-
variantClasses[variant],
|
|
8817
|
-
sizeClasses[size],
|
|
8818
|
-
className
|
|
8819
|
-
),
|
|
8820
|
-
...props
|
|
8821
|
-
}
|
|
8822
|
-
);
|
|
8823
|
-
};
|
|
8824
|
-
|
|
8825
8806
|
const Breadcrumb = ({ children, label }) => {
|
|
8826
8807
|
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": label, children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "gap-sm flex items-center", children }) });
|
|
8827
8808
|
};
|
|
@@ -8840,27 +8821,6 @@ const Crumb = ({ className, as, isCurrent, ...props }) => {
|
|
|
8840
8821
|
] });
|
|
8841
8822
|
};
|
|
8842
8823
|
|
|
8843
|
-
const Header = ({ children, border = true }) => {
|
|
8844
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8845
|
-
"header",
|
|
8846
|
-
{
|
|
8847
|
-
className: clsx("h-header-default z-50 flex w-full items-center gap-[18px] bg-transparent px-5", {
|
|
8848
|
-
"border-b-sm border-border1": border
|
|
8849
|
-
}),
|
|
8850
|
-
children
|
|
8851
|
-
}
|
|
8852
|
-
);
|
|
8853
|
-
};
|
|
8854
|
-
const HeaderTitle = ({ children }) => {
|
|
8855
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "h1", variant: "ui-lg", className: "font-medium text-white", children });
|
|
8856
|
-
};
|
|
8857
|
-
const HeaderAction = ({ children }) => {
|
|
8858
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto", children });
|
|
8859
|
-
};
|
|
8860
|
-
const HeaderGroup = ({ children }) => {
|
|
8861
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gap-lg flex items-center", children });
|
|
8862
|
-
};
|
|
8863
|
-
|
|
8864
8824
|
const DarkLogo = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "100", height: "100", viewBox: "0 0 100 100", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
8865
8825
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8866
8826
|
"path",
|
|
@@ -8961,6 +8921,7 @@ exports.HomeIcon = HomeIcon;
|
|
|
8961
8921
|
exports.Icon = Icon;
|
|
8962
8922
|
exports.InfoIcon = InfoIcon;
|
|
8963
8923
|
exports.JudgeIcon = JudgeIcon;
|
|
8924
|
+
exports.LatencyIcon = LatencyIcon;
|
|
8964
8925
|
exports.LogsIcon = LogsIcon;
|
|
8965
8926
|
exports.MastraResizablePanel = MastraResizablePanel;
|
|
8966
8927
|
exports.MemoryIcon = MemoryIcon;
|