@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/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useMessage, MessagePrimitive, ActionBarPrimitive, ThreadPrimitive, ComposerPrimitive, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
3
- import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, ChevronDown, XIcon, Check, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, X, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, PlusIcon, TrashIcon, Plus, Loader2 } from 'lucide-react';
3
+ import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, ChevronUp, ChevronDown, Check, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, X, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, PlusIcon, TrashIcon, Plus, Loader2 } from 'lucide-react';
4
4
  import * as React from 'react';
5
5
  import React__default, { forwardRef, memo, useState, useMemo, useRef, useEffect, createContext, useContext, useCallback, Suspense, Fragment as Fragment$1 } from 'react';
6
6
  import { Slot } from '@radix-ui/react-slot';
@@ -3116,7 +3116,7 @@ const Icon = ({ children, className, size = "default", ...props }) => {
3116
3116
  return /* @__PURE__ */ jsx("span", { className: clsx("block", sizes[size], className), ...props, children });
3117
3117
  };
3118
3118
 
3119
- const variantClasses$1 = {
3119
+ const variantClasses$2 = {
3120
3120
  default: "text-icon3",
3121
3121
  success: "text-accent1",
3122
3122
  error: "text-accent2",
@@ -3129,12 +3129,12 @@ const Badge$1 = ({ icon, variant = "default", className, children, ...props }) =
3129
3129
  className: clsx(
3130
3130
  "bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md",
3131
3131
  icon ? "pl-md pr-1.5" : "px-1.5",
3132
- icon || variant === "default" ? "text-icon5" : variantClasses$1[variant],
3132
+ icon || variant === "default" ? "text-icon5" : variantClasses$2[variant],
3133
3133
  className
3134
3134
  ),
3135
3135
  ...props,
3136
3136
  children: [
3137
- icon && /* @__PURE__ */ jsx("span", { className: variantClasses$1[variant], children: /* @__PURE__ */ jsx(Icon, { children: icon }) }),
3137
+ icon && /* @__PURE__ */ jsx("span", { className: variantClasses$2[variant], children: /* @__PURE__ */ jsx(Icon, { children: icon }) }),
3138
3138
  children
3139
3139
  ]
3140
3140
  }
@@ -3757,6 +3757,30 @@ const WorkflowCoinIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "126",
3757
3757
  )
3758
3758
  ] });
3759
3759
 
3760
+ const LatencyIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
3761
+ /* @__PURE__ */ jsx(
3762
+ "path",
3763
+ {
3764
+ 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",
3765
+ fill: "currentColor"
3766
+ }
3767
+ ),
3768
+ /* @__PURE__ */ jsx(
3769
+ "path",
3770
+ {
3771
+ 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",
3772
+ fill: "currentColor"
3773
+ }
3774
+ ),
3775
+ /* @__PURE__ */ jsx(
3776
+ "path",
3777
+ {
3778
+ 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",
3779
+ fill: "currentColor"
3780
+ }
3781
+ )
3782
+ ] });
3783
+
3760
3784
  const useCodemirrorTheme$1 = () => {
3761
3785
  return useMemo(
3762
3786
  () => draculaInit({
@@ -3898,31 +3922,23 @@ const Thread = ({ ToolFallback }) => {
3898
3922
  const WrappedAssistantMessage = (props) => {
3899
3923
  return /* @__PURE__ */ jsx(AssistantMessage, { ...props, ToolFallback });
3900
3924
  };
3901
- return /* @__PURE__ */ jsxs(ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-100px)]", children: [
3902
- /* @__PURE__ */ jsxs(
3903
- ThreadPrimitive.Viewport,
3904
- {
3905
- className: "py-10 overflow-y-auto scroll-smooth h-full px-4",
3906
- ref: areaRef,
3907
- autoScroll: false,
3908
- children: [
3909
- /* @__PURE__ */ jsxs("div", { children: [
3910
- /* @__PURE__ */ jsx(ThreadWelcome, {}),
3911
- /* @__PURE__ */ jsx(
3912
- ThreadPrimitive.Messages,
3913
- {
3914
- components: {
3915
- UserMessage,
3916
- EditComposer,
3917
- AssistantMessage: WrappedAssistantMessage
3918
- }
3919
- }
3920
- )
3921
- ] }),
3922
- /* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
3923
- ]
3924
- }
3925
- ),
3925
+ return /* @__PURE__ */ jsxs(ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-100px)] px-4", children: [
3926
+ /* @__PURE__ */ jsxs(ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
3927
+ /* @__PURE__ */ jsxs("div", { children: [
3928
+ /* @__PURE__ */ jsx(ThreadWelcome, {}),
3929
+ /* @__PURE__ */ jsx(
3930
+ ThreadPrimitive.Messages,
3931
+ {
3932
+ components: {
3933
+ UserMessage,
3934
+ EditComposer,
3935
+ AssistantMessage: WrappedAssistantMessage
3936
+ }
3937
+ }
3938
+ )
3939
+ ] }),
3940
+ /* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
3941
+ ] }),
3926
3942
  /* @__PURE__ */ jsx(Composer, {})
3927
3943
  ] });
3928
3944
  };
@@ -3974,6 +3990,14 @@ const CircleStopIcon = () => {
3974
3990
  return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", children: /* @__PURE__ */ jsx("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" }) });
3975
3991
  };
3976
3992
 
3993
+ const createMastraClient = (baseUrl) => {
3994
+ return new MastraClient({
3995
+ baseUrl: baseUrl || "",
3996
+ // only add the header if the baseUrl is not provided i.e it's a local dev environment
3997
+ headers: !baseUrl ? { "x-mastra-dev-playground": "true" } : {}
3998
+ });
3999
+ };
4000
+
3977
4001
  const convertMessage$1 = (message) => {
3978
4002
  return message;
3979
4003
  };
@@ -4017,9 +4041,7 @@ function MastraRuntimeProvider({
4017
4041
  }
4018
4042
  }
4019
4043
  }, [initialMessages, threadId, memory]);
4020
- const mastra = new MastraClient({
4021
- baseUrl: baseUrl || ""
4022
- });
4044
+ const mastra = createMastraClient(baseUrl);
4023
4045
  const agent = mastra.getAgent(agentId);
4024
4046
  const onNew = async (message) => {
4025
4047
  if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
@@ -4491,9 +4513,7 @@ TabsContent.displayName = TabsPrimitive.Content.displayName;
4491
4513
  const useEvalsByAgentId = (agentId, type, baseUrl) => {
4492
4514
  const [evals, setEvals] = useState([]);
4493
4515
  const [isLoading, setIsLoading] = useState(true);
4494
- const client = new MastraClient({
4495
- baseUrl: baseUrl || ""
4496
- });
4516
+ const client = createMastraClient(baseUrl);
4497
4517
  const fetchEvals = async (_agentId) => {
4498
4518
  setIsLoading(true);
4499
4519
  const activeAgentId = _agentId ?? agentId;
@@ -4772,7 +4792,6 @@ function TraceProvider({ children }) {
4772
4792
  const [traces, setTraces] = useState([]);
4773
4793
  const [currentTraceIndex, setCurrentTraceIndex] = useState(0);
4774
4794
  const [span, setSpan] = useState(null);
4775
- const [openDetail, setOpenDetail] = useState(false);
4776
4795
  const nextTrace = () => {
4777
4796
  if (currentTraceIndex < traces.length - 1) {
4778
4797
  const nextIndex = currentTraceIndex + 1;
@@ -4797,7 +4816,6 @@ function TraceProvider({ children }) {
4797
4816
  setOpen(false);
4798
4817
  setTrace(null);
4799
4818
  setSpan(null);
4800
- setOpenDetail(false);
4801
4819
  };
4802
4820
  return /* @__PURE__ */ jsx(
4803
4821
  TraceContext.Provider,
@@ -4815,8 +4833,6 @@ function TraceProvider({ children }) {
4815
4833
  prevTrace,
4816
4834
  span,
4817
4835
  setSpan,
4818
- openDetail,
4819
- setOpenDetail,
4820
4836
  clearData
4821
4837
  },
4822
4838
  children
@@ -4966,10 +4982,8 @@ function transformKey(key) {
4966
4982
  if (key.includes(".result")) {
4967
4983
  return "Output";
4968
4984
  }
4969
- return key.split(".").join(" ").split("_");
4970
- }
4971
- function cleanString(string) {
4972
- return string.replace(/\\n/g, "").replace(/\n/g, "").replace(/\s+/g, " ").trim();
4985
+ const newKey = key.split(".").join(" ").split("_").join(" ").replaceAll("ai", "AI");
4986
+ return newKey.substring(0, 1).toUpperCase() + newKey.substring(1);
4973
4987
  }
4974
4988
  const refineTraces = (traces, isWorkflow = false) => {
4975
4989
  const listOfSpanIds = /* @__PURE__ */ new Set();
@@ -5006,35 +5020,11 @@ const refineTraces = (traces, isWorkflow = false) => {
5006
5020
  });
5007
5021
  return tracesData;
5008
5022
  };
5009
- const allowedAiSpanAttributes = [
5010
- "operation.name",
5011
- "ai.operationId",
5012
- "ai.model.provider",
5013
- "ai.model.id",
5014
- "ai.prompt.format",
5015
- "ai.prompt.messages",
5016
- "ai.prompt.tools",
5017
- "ai.prompt.toolChoice",
5018
- "ai.settings.toolChoice",
5019
- "ai.schema",
5020
- "ai.settings.output",
5021
- "ai.response.object",
5022
- "ai.response.text",
5023
- "ai.response.timestamp",
5024
- "componentName",
5025
- "ai.usage.promptTokens",
5026
- "ai.usage.completionTokens"
5027
- ];
5028
5023
 
5029
5024
  const useTraces = (componentName, baseUrl, isWorkflow = false) => {
5030
5025
  const [traces, setTraces] = useState([]);
5031
5026
  const { setTraces: setTraceContextTraces } = useContext(TraceContext);
5032
- const client = useMemo(
5033
- () => new MastraClient({
5034
- baseUrl: baseUrl || ""
5035
- }),
5036
- [baseUrl]
5037
- );
5027
+ const client = useMemo(() => createMastraClient(baseUrl), [baseUrl]);
5038
5028
  const fetchFn = useCallback(async () => {
5039
5029
  try {
5040
5030
  const res = await client.getTelemetry({
@@ -5091,7 +5081,10 @@ const Th = ({ className, children, ...props }) => {
5091
5081
  return /* @__PURE__ */ jsx(
5092
5082
  "th",
5093
5083
  {
5094
- className: clsx("text-icon3 text-ui-sm h-full text-left font-normal uppercase first:pl-5 last:pr-5", className),
5084
+ className: clsx(
5085
+ "text-icon3 text-ui-sm h-full text-left font-normal uppercase first:pl-5 last:pr-5 whitespace-nowrap",
5086
+ className
5087
+ ),
5095
5088
  ...props,
5096
5089
  children
5097
5090
  }
@@ -5170,7 +5163,6 @@ const useOpenTrace = () => {
5170
5163
  setIsOpen: setOpen,
5171
5164
  trace: currentTrace,
5172
5165
  setSpan,
5173
- setOpenDetail,
5174
5166
  setCurrentTraceIndex
5175
5167
  } = useContext(TraceContext);
5176
5168
  const openTrace = (trace, traceIndex) => {
@@ -5180,7 +5172,6 @@ const useOpenTrace = () => {
5180
5172
  setCurrentTraceIndex(traceIndex);
5181
5173
  if (open && currentTrace?.[0]?.id !== trace[0].id) return;
5182
5174
  setOpen((prev) => !prev);
5183
- setOpenDetail((prev) => !prev);
5184
5175
  };
5185
5176
  return { openTrace };
5186
5177
  };
@@ -5194,12 +5185,12 @@ const TracesTableEmpty = ({ colsCount }) => {
5194
5185
  const TracesTableError = ({ error, colsCount }) => {
5195
5186
  return /* @__PURE__ */ jsx(Tbody, { children: /* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(Cell, { colSpan: colsCount, className: "text-center py-4", children: /* @__PURE__ */ jsx(Txt, { children: error.message }) }) }) });
5196
5187
  };
5197
- const TraceRow = ({ trace, index }) => {
5188
+ const TraceRow = ({ trace, index, isActive }) => {
5198
5189
  const { openTrace } = useOpenTrace();
5199
- return /* @__PURE__ */ jsxs(Row, { children: [
5190
+ return /* @__PURE__ */ jsxs(Row, { className: isActive ? "bg-surface4" : "", children: [
5200
5191
  /* @__PURE__ */ jsx(DateTimeCell, { dateTime: new Date(trace.started / 1e3) }),
5201
5192
  /* @__PURE__ */ jsx(TxtCell, { children: trace.traceId }),
5202
- /* @__PURE__ */ jsx(UnitCell, { unit: "ms", children: trace.duration }),
5193
+ /* @__PURE__ */ jsx(UnitCell, { unit: "ms", children: trace.duration / 1e3 }),
5203
5194
  /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx("button", { onClick: () => openTrace(trace.trace, index), children: /* @__PURE__ */ jsxs(Badge$1, { icon: /* @__PURE__ */ jsx(TraceIcon, {}), children: [
5204
5195
  trace.trace.length,
5205
5196
  " span",
@@ -5209,6 +5200,7 @@ const TraceRow = ({ trace, index }) => {
5209
5200
  };
5210
5201
  const TracesTable = ({ traces, isLoading, error }) => {
5211
5202
  const hasNoTraces = !traces || traces.length === 0;
5203
+ const { currentTraceIndex } = useContext(TraceContext);
5212
5204
  const colsCount = 4;
5213
5205
  return /* @__PURE__ */ jsxs(Table, { size: "small", children: [
5214
5206
  /* @__PURE__ */ jsxs(Thead, { children: [
@@ -5217,7 +5209,7 @@ const TracesTable = ({ traces, isLoading, error }) => {
5217
5209
  /* @__PURE__ */ jsx(Th, { width: 160, children: "Duration" }),
5218
5210
  /* @__PURE__ */ jsx(Th, { width: 160, children: "Spans" })
5219
5211
  ] }),
5220
- isLoading ? /* @__PURE__ */ jsx(TracesTableSkeleton, { colsCount }) : error ? /* @__PURE__ */ jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsx(TraceRow, { trace, index }, trace.traceId)) })
5212
+ isLoading ? /* @__PURE__ */ jsx(TracesTableSkeleton, { colsCount }) : error ? /* @__PURE__ */ jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsx(TraceRow, { trace, index, isActive: index === currentTraceIndex }, trace.traceId)) })
5221
5213
  ] });
5222
5214
  };
5223
5215
 
@@ -5287,8 +5279,8 @@ const MastraResizablePanel = ({
5287
5279
  !disabled && dividerPosition === "left" ? /* @__PURE__ */ jsx(
5288
5280
  "div",
5289
5281
  {
5290
- className: `w-1 bg-mastra-bg-1 bg-[#121212] 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 -left-1 -right-1 z-10
5291
- ${isDragging ? "bg-mastra-border-2 bg-[#424242] w-1.5 cursor- col-resize" : ""}`,
5282
+ 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
5283
+ ${isDragging ? "bg-border2 w-1.5 cursor- col-resize" : ""}`,
5292
5284
  onMouseDown: handleMouseDown
5293
5285
  }
5294
5286
  ) : null,
@@ -5296,183 +5288,257 @@ const MastraResizablePanel = ({
5296
5288
  !disabled && dividerPosition === "right" ? /* @__PURE__ */ jsx(
5297
5289
  "div",
5298
5290
  {
5299
- className: `w-1 bg-mastra-bg-1 bg-[#121212] 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 -left-1 -right-1 z-10
5300
- ${isDragging ? "bg-mastra-border-2 bg-[#424242] w-1.5 cursor- col-resize" : ""}`,
5291
+ 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
5292
+ ${isDragging ? "bg-border2 w-1.5 cursor- col-resize" : ""}`,
5301
5293
  onMouseDown: handleMouseDown
5302
5294
  }
5303
5295
  ) : null
5304
5296
  ] });
5305
5297
  };
5306
5298
 
5307
- function TreeNode({ node, depth = 0 }) {
5308
- const [isExpanded, setIsExpanded] = useState(true);
5309
- const hasChildren = node.children && node.children.length > 0;
5310
- const { setOpenDetail, setSpan, openDetail, span } = useContext(TraceContext);
5311
- const containerRef = useRef(null);
5312
- const widthPercentage = Math.min(node.relativePercentage ? node?.relativePercentage * 100 : 0, 100);
5313
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, children: [
5314
- /* @__PURE__ */ jsxs(
5315
- Button$1,
5316
- {
5317
- variant: "ghost",
5318
- className: cn("relative flex w-full items-center justify-start gap-2 py-3 pr-1 text-sm", {
5319
- "text-accent-foreground bg-accent": span?.id === node.id
5320
- }),
5321
- onClick: (e) => {
5322
- e.preventDefault();
5323
- e.stopPropagation();
5324
- setSpan(node);
5325
- if (openDetail && node.id !== span?.id) return;
5326
- setOpenDetail(true);
5327
- },
5328
- style: { paddingLeft: `${depth > 0 ? depth * 35 + 28 - depth * 3 : 24}px` },
5329
- children: [
5330
- hasChildren ? /* @__PURE__ */ jsx(
5331
- "div",
5332
- {
5333
- onClick: () => setIsExpanded(!isExpanded),
5334
- className: "relative grid h-auto flex-shrink-0 place-items-center rounded-sm bg-mastra-bg-3 p-2",
5335
- children: /* @__PURE__ */ jsx(
5336
- "svg",
5337
- {
5338
- className: cn("!h-2 !w-2 transition-transform", isExpanded ? "" : "-rotate-90"),
5339
- xmlns: "http://www.w3.org/2000/svg",
5340
- width: "7",
5341
- height: "6",
5342
- viewBox: "0 0 7 6",
5343
- fill: "none",
5344
- children: /* @__PURE__ */ jsx(
5345
- "path",
5346
- {
5347
- d: "M3.9338 5.5C3.74135 5.83333 3.26022 5.83333 3.06777 5.5L0.469694 0.999999C0.277244 0.666666 0.517814 0.25 0.902714 0.25L6.09886 0.25C6.48376 0.25 6.72433 0.666666 6.53188 1L3.9338 5.5Z",
5348
- fill: "#939393"
5349
- }
5350
- )
5351
- }
5352
- )
5353
- }
5354
- ) : null,
5355
- /* @__PURE__ */ jsxs("div", { className: "flex w-full gap-4 pr-4", children: [
5356
- /* @__PURE__ */ jsx(
5357
- "p",
5358
- {
5359
- className: cn("max-w-[250px] text-sm", {
5360
- "text-white": node?.status?.code === 0,
5361
- "text-[#FF4500]": node?.status?.code !== 0,
5362
- "px-1": depth === 0,
5363
- truncate: containerRef.current?.offsetWidth && containerRef.current?.offsetWidth < 450 && depth > 1 && node.name?.length > 16
5364
- }),
5365
- children: node.name
5366
- }
5367
- ),
5368
- node.duration > 0 && /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
5369
- /* @__PURE__ */ jsx("div", { className: "absolute top-[11px] h-px w-full bg-[hsl(220,14%,19%)]" }),
5370
- /* @__PURE__ */ jsx(
5371
- "div",
5372
- {
5373
- style: {
5374
- width: `${widthPercentage}%`,
5375
- left: 0
5376
- },
5377
- className: cn(
5378
- "absolute top-[9px] z-0 h-[5px] rounded-[5px] bg-white transition-all",
5379
- node.name.includes("agent") && "left-1/2 bg-green-500",
5380
- node.name.includes("llm") && "bg-[#5699A8]",
5381
- node.name.includes("ai") && "left-2/4 w-5 bg-[#F09A56]"
5382
- )
5383
- }
5384
- ),
5385
- /* @__PURE__ */ jsxs("span", { className: "absolute left-0 top-3 text-[0.63rem] text-mastra-el-3", children: [
5386
- formatDuration(node.duration),
5387
- "ms"
5388
- ] })
5389
- ] })
5390
- ] })
5391
- ]
5392
- }
5393
- ),
5394
- hasChildren && isExpanded && /* @__PURE__ */ jsx(Fragment, { children: node.children.map((child) => /* @__PURE__ */ jsx(TreeNode, { node: child, depth: depth + 1 }, child.id)) })
5299
+ const sizeClasses = {
5300
+ md: "h-button-md gap-md",
5301
+ lg: "h-button-lg gap-lg"
5302
+ };
5303
+ const variantClasses$1 = {
5304
+ default: "bg-surface2 hover:bg-surface4 text-icon3 hover:text-icon6",
5305
+ light: "bg-surface3 hover:bg-surface5 text-icon6"
5306
+ };
5307
+ const Button = ({ className, as, size = "md", variant = "default", ...props }) => {
5308
+ const Component = as || "button";
5309
+ return /* @__PURE__ */ jsx(
5310
+ Component,
5311
+ {
5312
+ className: clsx(
5313
+ "bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
5314
+ variantClasses$1[variant],
5315
+ sizeClasses[size],
5316
+ className
5317
+ ),
5318
+ ...props
5319
+ }
5320
+ );
5321
+ };
5322
+
5323
+ const TraceTree = ({ children }) => {
5324
+ return /* @__PURE__ */ jsx("ol", { children });
5325
+ };
5326
+
5327
+ const variantClasses = {
5328
+ agent: "bg-accent1"
5329
+ };
5330
+ const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
5331
+ const variantClass = variant ? variantClasses[variant] : "bg-accent3";
5332
+ return /* @__PURE__ */ jsxs("div", { children: [
5333
+ /* @__PURE__ */ jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: clsx("absolute h-1 rounded-full", variantClass), style: { width: `${progressPercent}%` } }) }),
5334
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 pt-0.5", children: [
5335
+ /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
5336
+ durationMs,
5337
+ "ms"
5338
+ ] }),
5339
+ tokenCount && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
5340
+ tokenCount,
5341
+ "t"
5342
+ ] })
5343
+ ] })
5395
5344
  ] });
5396
- }
5345
+ };
5346
+
5347
+ const TraceDurationContext = createContext(0);
5348
+ const useTraceDuration = () => {
5349
+ return useContext(TraceDurationContext);
5350
+ };
5351
+ const TraceDurationProvider = ({ children, durationMs }) => {
5352
+ return /* @__PURE__ */ jsx(TraceDurationContext.Provider, { value: durationMs, children });
5353
+ };
5354
+
5355
+ const spanIconMap = {
5356
+ tool: ToolsIcon,
5357
+ agent: AgentIcon,
5358
+ workflow: WorkflowIcon,
5359
+ memory: MemoryIcon,
5360
+ rag: TraceIcon,
5361
+ storage: DbIcon,
5362
+ eval: ScoreIcon,
5363
+ other: TraceIcon
5364
+ };
5365
+ const spanVariantClasses = {
5366
+ tool: "text-[#ECB047]",
5367
+ agent: "text-accent1",
5368
+ workflow: "text-accent3",
5369
+ memory: "text-accent2",
5370
+ rag: "text-accent2",
5371
+ storage: "text-accent2",
5372
+ eval: "text-accent4",
5373
+ other: "text-icon6"
5374
+ };
5375
+ const Span = ({ children, durationMs, variant, tokenCount, spans, isRoot, onClick, isActive }) => {
5376
+ const [isExpanded, setIsExpanded] = useState(true);
5377
+ const traceDuration = useTraceDuration();
5378
+ const VariantIcon = spanIconMap[variant];
5379
+ const variantClass = spanVariantClasses[variant];
5380
+ const progressPercent = durationMs / traceDuration * 100;
5381
+ const TextEl = onClick ? "button" : "div";
5382
+ return /* @__PURE__ */ jsx(TraceDurationProvider, { durationMs, children: /* @__PURE__ */ jsxs("li", { children: [
5383
+ /* @__PURE__ */ jsxs("div", { className: clsx("grid grid-cols-2 items-center gap-2 rounded-md pl-2", isActive && "bg-surface4"), children: [
5384
+ /* @__PURE__ */ jsxs("div", { className: "flex h-8 items-center gap-1", children: [
5385
+ spans ? /* @__PURE__ */ jsx(
5386
+ "button",
5387
+ {
5388
+ type: "button",
5389
+ "aria-label": isExpanded ? "Collapse span" : "Expand span",
5390
+ "aria-expanded": isExpanded,
5391
+ className: "text-icon3 flex h-4 w-4",
5392
+ onClick: () => setIsExpanded(!isExpanded),
5393
+ children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronIcon, { className: clsx("transition-transform -rotate-90", { "rotate-0": isExpanded }) }) })
5394
+ }
5395
+ ) : /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "h-full w-4", children: !isRoot && /* @__PURE__ */ jsx("div", { className: "ml-[7px] h-full w-px rounded-full" }) }),
5396
+ /* @__PURE__ */ jsxs(TextEl, { className: "flex items-center gap-2 min-w-0", onClick, children: [
5397
+ /* @__PURE__ */ jsx("div", { className: clsx("bg-surface4 flex items-center justify-center rounded-md p-[3px]", variantClass), children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(VariantIcon, {}) }) }),
5398
+ /* @__PURE__ */ jsx(Txt, { variant: "ui-md", className: "text-icon6 truncate", children })
5399
+ ] })
5400
+ ] }),
5401
+ /* @__PURE__ */ jsx(
5402
+ Time,
5403
+ {
5404
+ durationMs,
5405
+ tokenCount,
5406
+ variant: variant === "agent" ? "agent" : void 0,
5407
+ progressPercent
5408
+ }
5409
+ )
5410
+ ] }),
5411
+ isExpanded && spans && /* @__PURE__ */ jsx("div", { className: "ml-4", children: spans })
5412
+ ] }) });
5413
+ };
5414
+
5415
+ const Spans = ({ children }) => {
5416
+ return /* @__PURE__ */ jsx("ol", { children });
5417
+ };
5418
+
5419
+ const Trace = ({ name, spans, durationMs, tokenCount, onClick, variant, isActive }) => {
5420
+ return /* @__PURE__ */ jsx(TraceDurationProvider, { durationMs, children: /* @__PURE__ */ jsx(
5421
+ Span,
5422
+ {
5423
+ isRoot: true,
5424
+ durationMs,
5425
+ variant,
5426
+ spans: /* @__PURE__ */ jsx(Spans, { children: spans }),
5427
+ onClick,
5428
+ isActive,
5429
+ children: name
5430
+ }
5431
+ ) });
5432
+ };
5433
+
5434
+ const getSpanVariant = (span) => {
5435
+ const attributes = Object.keys(span.attributes || {}).map((k) => k.toLowerCase());
5436
+ const lowerCaseName = span.name.toLowerCase();
5437
+ const isAiSpan = lowerCaseName.startsWith("ai.");
5438
+ if (isAiSpan) {
5439
+ const isAiAboutTool = lowerCaseName.includes("tool");
5440
+ if (isAiAboutTool) return "tool";
5441
+ return "other";
5442
+ }
5443
+ const hasMemoryRelatedAttributes = attributes.some((key) => key.includes("memory") || key.includes("storage"));
5444
+ if (hasMemoryRelatedAttributes) return "memory";
5445
+ const hasToolRelatedAttributes = attributes.some((key) => key.includes("tool"));
5446
+ if (hasToolRelatedAttributes) return "tool";
5447
+ const hasAgentRelatedAttributes = attributes.some((key) => key.includes("agent."));
5448
+ if (hasAgentRelatedAttributes) return "agent";
5449
+ if (lowerCaseName.includes(".insert")) {
5450
+ const evalRelatedAttribute = attributes.find((key) => String(span.attributes?.[key])?.includes("mastra_evals"));
5451
+ if (evalRelatedAttribute) return "eval";
5452
+ }
5453
+ return "other";
5454
+ };
5397
5455
 
5398
- function TreeView({ tree }) {
5399
- return /* @__PURE__ */ jsx("ul", { children: tree.map((node) => /* @__PURE__ */ jsx(TreeNode, { node }, node.id)) });
5400
- }
5401
5456
  function buildTree(items, parentSpanId = null) {
5402
5457
  return items.filter((item) => item.parentSpanId === parentSpanId).map((item) => ({
5403
5458
  ...item,
5404
5459
  children: buildTree(items, item.id)
5405
5460
  }));
5406
5461
  }
5462
+ const NestedSpans = ({ spans }) => {
5463
+ const { span: activeSpan, setSpan } = useContext(TraceContext);
5464
+ return /* @__PURE__ */ jsx(Spans, { children: spans.map((span) => {
5465
+ const isActive = span.id === activeSpan?.id;
5466
+ return /* @__PURE__ */ jsx(
5467
+ Span,
5468
+ {
5469
+ spans: span.children.length > 0 && /* @__PURE__ */ jsx(NestedSpans, { spans: span.children }),
5470
+ durationMs: span.duration / 1e3,
5471
+ variant: getSpanVariant(span),
5472
+ isActive,
5473
+ onClick: () => setSpan(span),
5474
+ children: span.name
5475
+ },
5476
+ span.id
5477
+ );
5478
+ }) });
5479
+ };
5407
5480
  function SpanView({ trace }) {
5408
- const tree = buildTree(trace.concat([]).reverse());
5409
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(TreeView, { tree }) });
5481
+ const shallowCopy = [...trace];
5482
+ const tree = buildTree(shallowCopy.reverse());
5483
+ const { span: activeSpan, setSpan } = useContext(TraceContext);
5484
+ return /* @__PURE__ */ jsx(TraceTree, { children: tree.map((node) => /* @__PURE__ */ jsx(
5485
+ Trace,
5486
+ {
5487
+ name: node.name,
5488
+ durationMs: node.duration / 1e3,
5489
+ spans: /* @__PURE__ */ jsx(NestedSpans, { spans: node.children }),
5490
+ variant: getSpanVariant(node),
5491
+ isActive: node.id === activeSpan?.id,
5492
+ onClick: () => setSpan(node)
5493
+ }
5494
+ )) });
5410
5495
  }
5411
5496
 
5497
+ const Header = ({ children, border = true }) => {
5498
+ return /* @__PURE__ */ jsx(
5499
+ "header",
5500
+ {
5501
+ className: clsx("h-header-default z-50 flex w-full items-center gap-[18px] bg-transparent px-5", {
5502
+ "border-b-sm border-border1": border
5503
+ }),
5504
+ children
5505
+ }
5506
+ );
5507
+ };
5508
+ const HeaderTitle = ({ children }) => {
5509
+ return /* @__PURE__ */ jsx(Txt, { as: "h1", variant: "ui-lg", className: "font-medium text-white", children });
5510
+ };
5511
+ const HeaderAction = ({ children }) => {
5512
+ return /* @__PURE__ */ jsx("div", { className: "ml-auto", children });
5513
+ };
5514
+ const HeaderGroup = ({ children }) => {
5515
+ return /* @__PURE__ */ jsx("div", { className: "gap-lg flex items-center", children });
5516
+ };
5517
+
5412
5518
  function TraceDetails() {
5413
5519
  const { trace, currentTraceIndex, prevTrace, nextTrace, traces, clearData } = useContext(TraceContext);
5414
- return /* @__PURE__ */ jsxs("div", { children: [
5415
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 pt-[1.56rem]", children: [
5416
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
5417
- /* @__PURE__ */ jsxs("h3", { className: "text-[1.125rem]", children: [
5418
- "Trace Span",
5419
- trace?.length && trace.length > 1 ? "s" : ""
5420
- ] }),
5421
- /* @__PURE__ */ jsxs("span", { className: "text-xs text-mastra-el-3", children: [
5422
- trace?.length ? trace.length : 0,
5423
- " span",
5424
- trace?.length && trace.length > 1 ? "s" : ""
5425
- ] })
5426
- ] }),
5427
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
5428
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
5429
- /* @__PURE__ */ jsx(
5430
- Button$1,
5431
- {
5432
- onClick: () => {
5433
- prevTrace();
5434
- },
5435
- disabled: currentTraceIndex === 0,
5436
- variant: "secondary",
5437
- size: "icon",
5438
- className: "!h-3 !w-3 rotate-180 !px-3 py-3 text-mastra-el-3 transition-colors hover:text-white",
5439
- children: /* @__PURE__ */ jsx(ChevronDown, {})
5440
- }
5441
- ),
5442
- " ",
5443
- /* @__PURE__ */ jsx(
5444
- Button$1,
5445
- {
5446
- onClick: () => {
5447
- nextTrace();
5448
- },
5449
- disabled: currentTraceIndex === traces.length - 1,
5450
- variant: "secondary",
5451
- size: "icon",
5452
- className: "!h-3 !w-3 !px-3 py-3 text-mastra-el-3 transition-colors hover:text-white",
5453
- children: /* @__PURE__ */ jsx(ChevronDown, {})
5454
- }
5455
- )
5456
- ] }),
5457
- /* @__PURE__ */ jsx("span", { className: "bg-secondary inline-block h-5 w-px" }),
5520
+ const actualTrace = traces[currentTraceIndex];
5521
+ if (!actualTrace || !trace) return null;
5522
+ return /* @__PURE__ */ jsxs("aside", { children: [
5523
+ /* @__PURE__ */ jsxs(Header, { children: [
5524
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
5525
+ /* @__PURE__ */ jsx(Button, { className: "bg-transparent border-none", onClick: prevTrace, disabled: currentTraceIndex === 0, children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronUp, {}) }) }),
5458
5526
  /* @__PURE__ */ jsx(
5459
- Button$1,
5527
+ Button,
5460
5528
  {
5461
- onClick: () => {
5462
- clearData();
5463
- },
5464
- variant: "secondary",
5465
- size: "icon",
5466
- className: "!h-3 !w-3 !px-3 py-3 text-mastra-el-3 transition-colors hover:text-white",
5467
- children: /* @__PURE__ */ jsx(XIcon, {})
5529
+ className: "bg-transparent border-none",
5530
+ onClick: nextTrace,
5531
+ disabled: currentTraceIndex === traces.length - 1,
5532
+ children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronDown, {}) })
5468
5533
  }
5469
5534
  )
5470
- ] })
5535
+ ] }),
5536
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5", children: [
5537
+ "Trace ",
5538
+ /* @__PURE__ */ jsx("span", { className: "ml-2 text-icon3", children: actualTrace.traceId.substring(0, 5) })
5539
+ ] }) })
5471
5540
  ] }),
5472
- /* @__PURE__ */ jsxs("div", { className: "p-6 px-1", children: [
5473
- " ",
5474
- trace && /* @__PURE__ */ jsx(SpanView, { trace })
5475
- ] })
5541
+ /* @__PURE__ */ jsx("div", { className: "p-5", children: /* @__PURE__ */ jsx(SpanView, { trace }) })
5476
5542
  ] });
5477
5543
  }
5478
5544
 
@@ -5499,179 +5565,135 @@ const SyntaxHighlighter = ({ data }) => {
5499
5565
  };
5500
5566
 
5501
5567
  function SpanDetail() {
5502
- const { span } = useContext(TraceContext);
5503
- const isAiSpan = span?.name?.startsWith("ai.");
5504
- const aiSpanAttributes = Object.entries(span?.attributes || {}).filter(([key]) => allowedAiSpanAttributes.includes(key)).reduce((acc, [key, value]) => {
5505
- return {
5506
- ...acc,
5507
- [key]: value
5508
- };
5509
- }, {});
5510
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 pb-20", children: [
5511
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-6 pt-[1.56rem]", children: [
5512
- /* @__PURE__ */ jsx("span", { className: "rounded bg-[#314431] p-0.5", children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "21", height: "20", viewBox: "0 0 21 20", fill: "none", children: /* @__PURE__ */ jsx(
5513
- "path",
5514
- {
5515
- fillRule: "evenodd",
5516
- clipRule: "evenodd",
5517
- d: "M9.3726 2.10787C9.99493 1.48554 11.0066 1.48705 11.6274 2.10787L13.1306 3.61106C13.7529 4.23339 13.7514 5.24504 13.1306 5.86586L11.6274 7.36906C11.0051 7.99138 9.99342 7.98988 9.3726 7.36906L7.86941 5.86586C7.24708 5.24354 7.24858 4.23188 7.86941 3.61106L9.3726 2.10787ZM4.11141 7.36906C4.73374 6.74673 5.74539 6.74824 6.36621 7.36906L7.86941 8.87225C8.49173 9.49458 8.49023 10.5062 7.8694 11.127L6.36621 12.6302C5.74388 13.2526 4.73223 13.2511 4.11141 12.6302L2.60822 11.127C1.98589 10.5047 1.9874 9.49307 2.60822 8.87225L4.11141 7.36906ZM14.6338 7.36906C15.2561 6.74673 16.2678 6.74824 16.8886 7.36906L18.3918 8.87225C19.0141 9.49458 19.0126 10.5062 18.3918 11.127L16.8886 12.6302C16.2663 13.2526 15.2546 13.2511 14.6338 12.6302L13.1306 11.127C12.5083 10.5047 12.5098 9.49307 13.1306 8.87225L14.6338 7.36906ZM9.3726 12.6302C9.99493 12.0079 11.0066 12.0094 11.6274 12.6302L13.1306 14.1334C13.7529 14.7558 13.7514 15.7674 13.1306 16.3882L11.6274 17.8914C11.0051 18.5138 9.99342 18.5123 9.3726 17.8914L7.86941 16.3882C7.24708 15.7659 7.24859 14.7543 7.86941 14.1334L9.3726 12.6302Z",
5518
- fill: "white"
5519
- }
5520
- ) }) }),
5521
- /* @__PURE__ */ jsx("h3", { className: "text-[0.9rem] font-medium", children: span?.name })
5568
+ const { span, setSpan, trace } = useContext(TraceContext);
5569
+ if (!span || !trace) return null;
5570
+ const prevSpan = () => {
5571
+ const currentIndex = trace.findIndex((t) => t.id === span.id);
5572
+ if (currentIndex !== -1 && currentIndex < trace.length - 1) {
5573
+ setSpan(trace[currentIndex + 1]);
5574
+ }
5575
+ };
5576
+ const nextSpan = () => {
5577
+ const currentIndex = trace.findIndex((t) => t.id === span.id);
5578
+ if (currentIndex !== -1 && currentIndex > 0) {
5579
+ setSpan(trace[currentIndex - 1]);
5580
+ }
5581
+ };
5582
+ const SpanIcon = spanIconMap[getSpanVariant(span)];
5583
+ const variantClass = spanVariantClasses[getSpanVariant(span)];
5584
+ return /* @__PURE__ */ jsxs("aside", { children: [
5585
+ /* @__PURE__ */ jsxs(Header, { children: [
5586
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
5587
+ /* @__PURE__ */ jsx(Button, { className: "bg-transparent border-none", onClick: prevSpan, children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronUp, {}) }) }),
5588
+ /* @__PURE__ */ jsx(Button, { className: "bg-transparent border-none", onClick: nextSpan, children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronDown, {}) }) })
5589
+ ] }),
5590
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5", as: "h2", children: [
5591
+ "Span ",
5592
+ /* @__PURE__ */ jsx("span", { className: "ml-2 text-icon3", children: span.id.substring(0, 5) })
5593
+ ] }) })
5522
5594
  ] }),
5523
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-1 px-6", children: [
5524
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5525
- /* @__PURE__ */ jsx("span", { className: "text-xs text-mastra-el-3", children: "Duration" }),
5526
- /* @__PURE__ */ jsxs("span", { className: "font-mono text-xs", children: [
5527
- " ",
5528
- span?.duration ? formatDuration(span?.duration) : "",
5529
- "ms"
5530
- ] })
5595
+ /* @__PURE__ */ jsxs("div", { className: "p-5", children: [
5596
+ /* @__PURE__ */ jsxs(Txt, { variant: "header-md", as: "h3", className: "text-icon-6 flex items-center gap-4 pb-3", children: [
5597
+ /* @__PURE__ */ jsx(Icon, { size: "lg", className: "bg-surface4 p-1 rounded-md", children: /* @__PURE__ */ jsx(SpanIcon, { className: variantClass }) }),
5598
+ span.name
5531
5599
  ] }),
5532
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5533
- /* @__PURE__ */ jsx("span", { className: "text-xs text-mastra-el-3", children: "Time" }),
5534
- /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: span?.startTime ? formatOtelTimestamp(span?.startTime) : "" })
5600
+ /* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2 items-center", children: /* @__PURE__ */ jsxs(Badge$1, { icon: /* @__PURE__ */ jsx(LatencyIcon, {}), children: [
5601
+ formatDuration(span.duration),
5602
+ "ms"
5603
+ ] }) }),
5604
+ /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
5605
+ /* @__PURE__ */ jsxs("dl", { className: "grid grid-cols-2 justify-between gap-2", children: [
5606
+ /* @__PURE__ */ jsx("dt", { className: "font-medium text-ui-md text-icon3", children: "ID" }),
5607
+ /* @__PURE__ */ jsx("dd", { className: "text-ui-md text-icon6", children: span.id }),
5608
+ /* @__PURE__ */ jsx("dt", { className: "font-medium text-ui-md text-icon3", children: "Created at" }),
5609
+ /* @__PURE__ */ jsx("dd", { className: "text-ui-md text-icon6", children: span.startTime ? formatOtelTimestamp(span.startTime) : "" })
5535
5610
  ] }),
5536
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5537
- /* @__PURE__ */ jsx("span", { className: "text-xs text-mastra-el-3", children: "Status" }),
5538
- /* @__PURE__ */ jsx("span", { className: cn("font-mono text-xs", span?.status?.code == 0 ? "text-[#6CD063]" : "text-[#FF4500]"), children: span?.status?.code == 0 ? "OK" : "ERROR" })
5539
- ] })
5540
- ] }),
5541
- span?.status?.code !== 0 ? /* @__PURE__ */ jsx("div", { className: "border-t-[0.5px] px-6 pt-4", children: span && span?.events?.length > 0 && /* @__PURE__ */ jsx(Events, { span }) }) : null,
5542
- /* @__PURE__ */ jsx("div", { className: "border-t-[0.5px] px-6 pt-4", children: span && /* @__PURE__ */ jsx(Attributes, { span: { ...span, attributes: isAiSpan ? aiSpanAttributes : span?.attributes } }) }),
5543
- span?.status?.code === 0 ? /* @__PURE__ */ jsx("div", { className: "border-t-[0.5px] px-6 pt-4", children: span && span?.events?.length > 0 && /* @__PURE__ */ jsx(Events, { span }) }) : null
5611
+ span.attributes && /* @__PURE__ */ jsx(Attributes, { attributes: span.attributes }),
5612
+ span.events?.length > 0 && /* @__PURE__ */ jsx(Events, { span })
5613
+ ] })
5544
5614
  ] });
5545
5615
  }
5616
+ function Attributes({ attributes }) {
5617
+ if (!attributes) return null;
5618
+ const entries = Object.entries(attributes);
5619
+ if (entries.length === 0) return null;
5620
+ const keysToHide = ["http.request_id", "componentName"];
5621
+ return /* @__PURE__ */ jsx("div", { children: entries.filter(([key]) => !keysToHide.includes(key)).map(([key, val]) => {
5622
+ return /* @__PURE__ */ jsxs("div", { children: [
5623
+ /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
5624
+ /* @__PURE__ */ jsx(Txt, { as: "h4", variant: "ui-md", className: "text-icon3 pb-2", children: transformKey(key) }),
5625
+ /* @__PURE__ */ jsx(AttributeValue, { value: val })
5626
+ ] }, key);
5627
+ }) });
5628
+ }
5629
+ const AttributeValue = ({ value }) => {
5630
+ if (!value)
5631
+ return /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-md", className: "text-icon6", children: "N/A" });
5632
+ if (typeof value === "number" || typeof value === "boolean") {
5633
+ return /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-md", className: "text-icon6", children: String(value) });
5634
+ }
5635
+ if (typeof value === "object") {
5636
+ return /* @__PURE__ */ jsx(SyntaxHighlighter, { data: value });
5637
+ }
5638
+ try {
5639
+ return /* @__PURE__ */ jsx(SyntaxHighlighter, { data: JSON.parse(value) });
5640
+ } catch {
5641
+ return /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-md", className: "text-icon6", children: String(value) });
5642
+ }
5643
+ };
5546
5644
  function Events({ span }) {
5547
5645
  if (!span.events) return null;
5548
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-2", children: [
5549
- /* @__PURE__ */ jsx("p", { className: "text-lg", children: "Events" }),
5646
+ return /* @__PURE__ */ jsxs("div", { children: [
5647
+ /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
5648
+ /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-md", className: "text-icon6 pb-2", children: "Events" }),
5550
5649
  span.events.map((event) => {
5551
- const eventAttributes = event?.attributes?.map((att) => ({ [att?.key]: att?.value }));
5552
- return /* @__PURE__ */ jsxs(
5553
- "div",
5554
- {
5555
- className: cn("flex flex-col gap-2 border-b-[0.5px] last:border-b-0 pt-4 pb-2 first:pb-4"),
5556
- children: [
5557
- /* @__PURE__ */ jsx("p", { className: "text-xs text-mastra-el-3", children: "Name" }),
5558
- /* @__PURE__ */ jsx("p", { className: "font-mono text-xs", children: event.name }),
5559
- /* @__PURE__ */ jsx("p", { className: "text-xs text-mastra-el-3", children: "Time" }),
5560
- /* @__PURE__ */ jsx("p", { className: "font-mono text-xs", children: event.timeUnixNano ? formatOtelTimestamp2(Number(event.timeUnixNano)) : "" }),
5561
- event.attributes?.length > 0 ? /* @__PURE__ */ jsx(AttributesValues, { attributes: eventAttributes }) : null
5562
- ]
5563
- },
5564
- event.name
5565
- );
5650
+ const isLast = event === span.events[span.events.length - 1];
5651
+ return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
5652
+ /* @__PURE__ */ jsxs("div", { children: [
5653
+ /* @__PURE__ */ jsxs("dl", { className: "grid grid-cols-2 justify-between gap-2 pb-2", children: [
5654
+ /* @__PURE__ */ jsx("dt", { className: "font-medium text-ui-md text-icon3", children: "Name" }),
5655
+ /* @__PURE__ */ jsx("dd", { className: "text-ui-md text-icon6", children: event.name }),
5656
+ /* @__PURE__ */ jsx("dt", { className: "font-medium text-ui-md text-icon3", children: "Time" }),
5657
+ /* @__PURE__ */ jsx("dd", { className: "text-ui-md text-icon6", children: event.timeUnixNano ? formatOtelTimestamp2(Number(event.timeUnixNano)) : "N/A" })
5658
+ ] }),
5659
+ event.attributes?.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: event.attributes.filter((attribute) => attribute !== null).map((attribute) => /* @__PURE__ */ jsxs("li", { children: [
5660
+ /* @__PURE__ */ jsx(Txt, { as: "h4", variant: "ui-md", className: "text-icon3 pb-2", children: transformKey(attribute.key) }),
5661
+ /* @__PURE__ */ jsx(AttributeValue, { value: attribute.value })
5662
+ ] }, attribute.key)) }) : null
5663
+ ] }, event.name),
5664
+ !isLast && /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" })
5665
+ ] }, event.name);
5566
5666
  })
5567
5667
  ] });
5568
5668
  }
5569
- function Attributes({ span }) {
5570
- if (!span.attributes) return null;
5571
- return /* @__PURE__ */ jsx(AttributesValues, { attributes: span.attributes });
5572
- }
5573
- function AttributesValues({
5574
- attributes,
5575
- depth = 0,
5576
- keyName
5577
- }) {
5578
- if (attributes === null || attributes === void 0 || Array.isArray(attributes) && attributes.length === 0 || typeof attributes === "object" && attributes !== null && Object.keys(attributes).length === 0) {
5579
- return /* @__PURE__ */ jsx("span", { className: "text-sm overflow-x-scroll", children: "N/A" });
5580
- }
5581
- if (typeof attributes === "string") {
5582
- try {
5583
- const attr = JSON.parse(attributes);
5584
- if (typeof attr === "object" || Array.isArray(attr)) {
5585
- return /* @__PURE__ */ jsx(SyntaxHighlighter, { data: attr });
5586
- }
5587
- } catch {
5588
- const val = attributes ? cleanString(attributes.toString()) : "N/A";
5589
- if (keyName === "Input" && val === "[Not Serializable]") {
5590
- return /* @__PURE__ */ jsx("span", { className: "text-sm overflow-x-scroll", children: "No input" });
5591
- }
5592
- return /* @__PURE__ */ jsx("span", { className: "text-sm overflow-x-scroll", children: attributes ? cleanString(attributes.toString()) : "N/A" });
5593
- }
5594
- }
5595
- const processedValue = attributes;
5596
- if (Array.isArray(processedValue)) {
5597
- if (processedValue.length === 0) return null;
5598
- return /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx("div", { className: "mt-1 gap-3", children: processedValue.map((item, index) => /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsx(AttributesValues, { attributes: item, depth: depth + 1 }, index) }, index)) }) });
5599
- }
5600
- if (typeof processedValue === "object") {
5601
- const entries = Object.entries(processedValue);
5602
- if (entries.length === 0) return null;
5603
- return /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx("div", { className: "mt-1", children: entries.map(([key, val]) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 p-2 pl-0", children: [
5604
- /* @__PURE__ */ jsx("span", { className: "text-sm capitalize text-mastra-el-3", children: transformKey(key) }),
5605
- /* @__PURE__ */ jsx(AttributesValues, { attributes: val, depth: depth + 1, keyName: transformKey(key) })
5606
- ] }, key)) }) });
5607
- }
5608
- if (typeof processedValue === "boolean")
5609
- return /* @__PURE__ */ jsx("span", { className: "font-mono text-sm", children: processedValue.toString() || "N/A" });
5610
- if (typeof processedValue === "number") return /* @__PURE__ */ jsx("span", { className: "font-mono text-sm", children: processedValue.toString() });
5611
- if (typeof processedValue === "string")
5612
- return /* @__PURE__ */ jsx("span", { className: "font-mono text-sm", children: processedValue ? cleanString(processedValue.toString()) : "N/A" });
5613
- return /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: String(processedValue) });
5614
- }
5615
5669
 
5616
- const TracesSidebar = ({ className, onResize, width, children }) => {
5617
- const { openDetail, isOpen: open } = useContext(TraceContext);
5618
- return /* @__PURE__ */ jsxs(
5670
+ const TracesSidebar = ({ onResize }) => {
5671
+ return /* @__PURE__ */ jsx(
5619
5672
  MastraResizablePanel,
5620
5673
  {
5621
- className: cn(
5622
- "absolute top-0 bottom-0 right-0 h-full z-20 overflow-x-scroll border-l-[0.5px] bg-mastra-bg-1 bg-[#121212]",
5623
- className
5624
- ),
5625
- defaultWidth: open ? 50 : 30,
5626
- minimumWidth: open ? 50 : 30,
5627
- maximumWidth: open ? 90 : 50,
5674
+ className: "h-full",
5675
+ defaultWidth: 70,
5676
+ minimumWidth: 50,
5677
+ maximumWidth: 70,
5628
5678
  setCurrentWidth: onResize,
5629
- children: [
5630
- open && /* @__PURE__ */ jsx(
5631
- "div",
5632
- {
5633
- className: "h-full overflow-x-scroll px-0 absolute left-0 top-0 min-w-[50%] bg-mastra-bg-1 bg-[#121212]",
5634
- style: { width: `${width}%` },
5635
- children: /* @__PURE__ */ jsx(TraceDetails, {})
5636
- }
5637
- ),
5638
- /* @__PURE__ */ jsx(
5639
- MastraResizablePanel,
5640
- {
5641
- defaultWidth: 50,
5642
- minimumWidth: 30,
5643
- maximumWidth: 80,
5644
- className: cn("h-full overflow-y-hidden border-l-[0.5px] right-0 top-0 z-20 bg-mastra-bg-1 bg-[#121212]", {
5645
- absolute: open,
5646
- "unset-position": !open
5647
- }),
5648
- disabled: !open,
5649
- children: /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-scroll", children: !openDetail ? children : /* @__PURE__ */ jsx(SpanDetail, {}) })
5650
- }
5651
- )
5652
- ]
5679
+ children: /* @__PURE__ */ jsxs("div", { className: "h-full grid grid-cols-2", children: [
5680
+ /* @__PURE__ */ jsx("div", { className: "overflow-x-scroll w-full h-[calc(100%-40px)]", children: /* @__PURE__ */ jsx(TraceDetails, {}) }),
5681
+ /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-40px)] overflow-x-scroll w-full border-l border-border1", children: /* @__PURE__ */ jsx(SpanDetail, {}) })
5682
+ ] })
5653
5683
  }
5654
5684
  );
5655
5685
  };
5656
5686
 
5657
- function AgentTraces({ agentName, baseUrl, sidebarChild }) {
5658
- return /* @__PURE__ */ jsx(TraceProvider, { children: /* @__PURE__ */ jsx(AgentTracesInner, { agentName, baseUrl, sidebarChild }) });
5687
+ function AgentTraces({ agentName, baseUrl }) {
5688
+ return /* @__PURE__ */ jsx(TraceProvider, { children: /* @__PURE__ */ jsx(AgentTracesInner, { agentName, baseUrl }) });
5659
5689
  }
5660
- function AgentTracesInner({ agentName, baseUrl, sidebarChild }) {
5661
- const [sidebarWidth, setSidebarWidth] = useState(30);
5690
+ function AgentTracesInner({ agentName, baseUrl }) {
5691
+ const [sidebarWidth, setSidebarWidth] = useState(100);
5662
5692
  const { traces, firstCallLoading, error } = useTraces(agentName, baseUrl);
5663
5693
  const { isOpen: open } = useContext(TraceContext);
5664
- return /* @__PURE__ */ jsxs("main", { className: "h-full relative overflow-hidden flex flex-row", children: [
5665
- /* @__PURE__ */ jsx("div", { className: "flex-1 block mr-[30%]", children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
5666
- /* @__PURE__ */ jsx(
5667
- TracesSidebar,
5668
- {
5669
- className: cn(open ? "grid grid-cols-2 w-[60%]" : "min-w-[325px]"),
5670
- width: 100 - sidebarWidth,
5671
- onResize: setSidebarWidth,
5672
- children: sidebarChild
5673
- }
5674
- )
5694
+ return /* @__PURE__ */ jsxs("main", { className: "h-full relative overflow-hidden flex", children: [
5695
+ /* @__PURE__ */ jsx("div", { className: clsx("h-full", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
5696
+ open && /* @__PURE__ */ jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
5675
5697
  ] });
5676
5698
  }
5677
5699
 
@@ -5698,9 +5720,7 @@ function MastraNetworkRuntimeProvider({
5698
5720
  }
5699
5721
  }
5700
5722
  }, [initialMessages, threadId, memory, messages]);
5701
- const mastra = new MastraClient({
5702
- baseUrl: baseUrl || ""
5703
- });
5723
+ const mastra = createMastraClient(baseUrl);
5704
5724
  console.log("MastraClient initialized");
5705
5725
  console.log(messages, "###");
5706
5726
  const network = mastra.getNetwork(agentId);
@@ -6089,24 +6109,16 @@ const NetworkChat = ({ agentId, memory }) => {
6089
6109
  return /* @__PURE__ */ jsx(MastraNetworkRuntimeProvider, { agentId, memory, children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsx(Thread, { ToolFallback }) }) });
6090
6110
  };
6091
6111
 
6092
- function WorkflowTraces({ workflowName, baseUrl, sidebarChild }) {
6093
- return /* @__PURE__ */ jsx(TraceProvider, { children: /* @__PURE__ */ jsx(WorkflowTracesInner, { workflowName, baseUrl, sidebarChild }) });
6112
+ function WorkflowTraces({ workflowName, baseUrl }) {
6113
+ return /* @__PURE__ */ jsx(TraceProvider, { children: /* @__PURE__ */ jsx(WorkflowTracesInner, { workflowName, baseUrl }) });
6094
6114
  }
6095
- function WorkflowTracesInner({ workflowName, baseUrl, sidebarChild }) {
6096
- const [sidebarWidth, setSidebarWidth] = useState(30);
6115
+ function WorkflowTracesInner({ workflowName, baseUrl }) {
6116
+ const [sidebarWidth, setSidebarWidth] = useState(100);
6097
6117
  const { traces, error, firstCallLoading } = useTraces(workflowName, baseUrl, true);
6098
6118
  const { isOpen: open } = useContext(TraceContext);
6099
- return /* @__PURE__ */ jsxs("main", { className: "h-full relative overflow-hidden flex flex-row", children: [
6100
- /* @__PURE__ */ jsx("div", { className: "flex-1 block mr-[30%]", children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
6101
- /* @__PURE__ */ jsx(
6102
- TracesSidebar,
6103
- {
6104
- className: cn(open ? "grid grid-cols-2 w-[60%]" : "min-w-[325px]"),
6105
- width: 100 - sidebarWidth,
6106
- onResize: setSidebarWidth,
6107
- children: sidebarChild
6108
- }
6109
- )
6119
+ return /* @__PURE__ */ jsxs("main", { className: "h-full relative overflow-hidden flex", children: [
6120
+ /* @__PURE__ */ jsx("div", { className: clsx("h-full", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
6121
+ open && /* @__PURE__ */ jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
6110
6122
  ] });
6111
6123
  }
6112
6124
 
@@ -6148,9 +6160,7 @@ const sanitizeVNexWorkflowWatchResult = (record) => {
6148
6160
  const useWorkflow = (workflowId, baseUrl) => {
6149
6161
  const [workflow, setWorkflow] = useState(null);
6150
6162
  const [isLoading, setIsLoading] = useState(true);
6151
- const client = new MastraClient({
6152
- baseUrl: baseUrl || ""
6153
- });
6163
+ const client = createMastraClient(baseUrl);
6154
6164
  useEffect(() => {
6155
6165
  const fetchWorkflow = async () => {
6156
6166
  setIsLoading(true);
@@ -6195,9 +6205,7 @@ const useWorkflow = (workflowId, baseUrl) => {
6195
6205
  const useVNextWorkflow = (workflowId, baseUrl) => {
6196
6206
  const [vNextWorkflow, setVNextWorkflow] = useState(null);
6197
6207
  const [isLoading, setIsLoading] = useState(true);
6198
- const client = new MastraClient({
6199
- baseUrl: baseUrl || ""
6200
- });
6208
+ const client = createMastraClient(baseUrl);
6201
6209
  useEffect(() => {
6202
6210
  const fetchWorkflow = async () => {
6203
6211
  setIsLoading(true);
@@ -6222,9 +6230,7 @@ const useVNextWorkflow = (workflowId, baseUrl) => {
6222
6230
  return { vNextWorkflow, isLoading };
6223
6231
  };
6224
6232
  const useExecuteWorkflow = (baseUrl) => {
6225
- const client = new MastraClient({
6226
- baseUrl: baseUrl || ""
6227
- });
6233
+ const client = createMastraClient(baseUrl);
6228
6234
  const createWorkflowRun = async ({ workflowId, prevRunId }) => {
6229
6235
  try {
6230
6236
  const workflow = client.getWorkflow(workflowId);
@@ -6322,12 +6328,9 @@ const useWatchWorkflow = (baseUrl) => {
6322
6328
  const watchWorkflow = async ({ workflowId, runId }) => {
6323
6329
  try {
6324
6330
  setIsWatchingWorkflow(true);
6325
- const client = new MastraClient({
6326
- baseUrl
6327
- });
6331
+ const client = createMastraClient(baseUrl);
6328
6332
  const workflow = client.getWorkflow(workflowId);
6329
6333
  await workflow.watch({ runId }, (record) => {
6330
- console.log("record in use-workflows==", record);
6331
6334
  try {
6332
6335
  debouncedSetWatchResult(record);
6333
6336
  } catch (err) {
@@ -6351,12 +6354,9 @@ const useWatchWorkflow = (baseUrl) => {
6351
6354
  const watchVNextWorkflow = async ({ workflowId, runId }) => {
6352
6355
  try {
6353
6356
  setIsWatchingVNextWorkflow(true);
6354
- const client = new MastraClient({
6355
- baseUrl
6356
- });
6357
+ const client = createMastraClient(baseUrl);
6357
6358
  const workflow = client.getVNextWorkflow(workflowId);
6358
6359
  await workflow.watch({ runId }, (record) => {
6359
- console.log("record in use-workflows===", record);
6360
6360
  try {
6361
6361
  debouncedSetVNextWatchResult(record);
6362
6362
  } catch (err) {
@@ -6393,9 +6393,7 @@ const useResumeWorkflow = (baseUrl) => {
6393
6393
  }) => {
6394
6394
  try {
6395
6395
  setIsResumingWorkflow(true);
6396
- const client = new MastraClient({
6397
- baseUrl: baseUrl || ""
6398
- });
6396
+ const client = createMastraClient(baseUrl);
6399
6397
  const response = await client.getWorkflow(workflowId).resume({ stepId, runId, context });
6400
6398
  return response;
6401
6399
  } catch (error) {
@@ -6414,9 +6412,7 @@ const useResumeWorkflow = (baseUrl) => {
6414
6412
  }) => {
6415
6413
  try {
6416
6414
  setIsResumingVNextWorkflow(true);
6417
- const client = new MastraClient({
6418
- baseUrl: baseUrl || ""
6419
- });
6415
+ const client = createMastraClient(baseUrl);
6420
6416
  const response = await client.getVNextWorkflow(workflowId).resume({ step, runId, resumeData, runtimeContext });
6421
6417
  return response;
6422
6418
  } catch (error) {
@@ -7507,12 +7503,12 @@ const ErrorMessage = ({ error }) => /* @__PURE__ */ jsxs(Alert, { variant: "dest
7507
7503
 
7508
7504
  const SubmitButton = ({ children }) => /* @__PURE__ */ jsx(Button$1, { type: "submit", children });
7509
7505
 
7510
- const StringField = ({ inputProps, error, id }) => {
7506
+ const StringField = ({ inputProps, error, field, id }) => {
7511
7507
  const { key, ...props } = inputProps;
7512
- return /* @__PURE__ */ jsx(Input, { id, className: error ? "border-destructive" : "", ...props });
7508
+ return /* @__PURE__ */ jsx(Input, { id, className: error ? "border-destructive" : "", ...props, defaultValue: field.default });
7513
7509
  };
7514
7510
 
7515
- const NumberField = ({ inputProps, error, id }) => {
7511
+ const NumberField = ({ inputProps, error, field, id }) => {
7516
7512
  const { key, ...props } = inputProps;
7517
7513
  return /* @__PURE__ */ jsx(
7518
7514
  Input,
@@ -7521,6 +7517,7 @@ const NumberField = ({ inputProps, error, id }) => {
7521
7517
  type: "number",
7522
7518
  className: error ? "border-destructive" : "",
7523
7519
  ...props,
7520
+ defaultValue: field.default,
7524
7521
  onChange: (e) => {
7525
7522
  const value = e.target.value;
7526
7523
  if (value !== "" && !isNaN(Number(value))) {
@@ -7555,7 +7552,7 @@ const Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
7555
7552
  ));
7556
7553
  Checkbox.displayName = CheckboxPrimitive.Root.displayName;
7557
7554
 
7558
- const BooleanField = ({ field, label, id, inputProps }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
7555
+ const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
7559
7556
  /* @__PURE__ */ jsx(
7560
7557
  Checkbox,
7561
7558
  {
@@ -7563,13 +7560,13 @@ const BooleanField = ({ field, label, id, inputProps }) => /* @__PURE__ */ jsxs(
7563
7560
  onCheckedChange: (checked) => {
7564
7561
  const event = {
7565
7562
  target: {
7566
- name: field.key,
7563
+ name: inputProps.name,
7567
7564
  value: checked
7568
7565
  }
7569
7566
  };
7570
7567
  inputProps.onChange(event);
7571
7568
  },
7572
- checked: inputProps.value
7569
+ defaultChecked: field.default
7573
7570
  }
7574
7571
  ),
7575
7572
  /* @__PURE__ */ jsxs(Label, { htmlFor: id, children: [
@@ -7806,9 +7803,17 @@ const DefaultButton = React.forwardRef(
7806
7803
  );
7807
7804
  DefaultButton.displayName = "DefaultButton";
7808
7805
 
7809
- const DateField = ({ inputProps, error, id }) => {
7806
+ const DateField = ({ inputProps, field, error, id }) => {
7810
7807
  const { key, ...props } = inputProps;
7811
7808
  const [value, setValue] = useState(null);
7809
+ useEffect(() => {
7810
+ if (field.default) {
7811
+ const date = new Date(field.default);
7812
+ if (isValid(date)) {
7813
+ setValue(date);
7814
+ }
7815
+ }
7816
+ }, [field]);
7812
7817
  return /* @__PURE__ */ jsx(
7813
7818
  DatePicker,
7814
7819
  {
@@ -7888,16 +7893,16 @@ const SelectItem = React.forwardRef(({ className, children, ...props }, ref) =>
7888
7893
  ));
7889
7894
  SelectItem.displayName = SelectPrimitive.Item.displayName;
7890
7895
 
7891
- const SelectField = ({ field, inputProps, error, id }) => {
7896
+ const SelectField = ({ field, inputProps, error, id, value }) => {
7892
7897
  const { key, ...props } = inputProps;
7893
7898
  return /* @__PURE__ */ jsxs(
7894
7899
  Select,
7895
7900
  {
7896
7901
  ...props,
7897
- onValueChange: (value) => {
7902
+ onValueChange: (value2) => {
7898
7903
  const syntheticEvent = {
7899
7904
  target: {
7900
- value,
7905
+ value: value2,
7901
7906
  name: inputProps.name
7902
7907
  }
7903
7908
  };
@@ -7944,10 +7949,10 @@ const ArrayElementWrapper = ({ children, onRemove }) => {
7944
7949
  ] });
7945
7950
  };
7946
7951
 
7947
- const RecordField = ({ inputProps, error, id }) => {
7948
- const { key, value = {}, onChange, ...props } = inputProps;
7952
+ const RecordField = ({ inputProps, field, error, id }) => {
7953
+ const { key, onChange, ...props } = inputProps;
7949
7954
  const [pairs, setPairs] = React.useState(
7950
- () => Object.entries(value).map(([key2, val]) => ({
7955
+ () => Object.entries(field.default || {}).map(([key2, val]) => ({
7951
7956
  id: key2 || v4(),
7952
7957
  key: key2,
7953
7958
  value: val
@@ -7975,8 +7980,8 @@ const RecordField = ({ inputProps, error, id }) => {
7975
7980
  },
7976
7981
  [onChange, inputProps.name]
7977
7982
  );
7978
- const handleChange = (id2, field, newValue) => {
7979
- setPairs((prev) => prev.map((pair) => pair.id === id2 ? { ...pair, [field]: newValue } : pair));
7983
+ const handleChange = (id2, field2, newValue) => {
7984
+ setPairs((prev) => prev.map((pair) => pair.id === id2 ? { ...pair, [field2]: newValue } : pair));
7980
7985
  };
7981
7986
  const handleBlur = () => {
7982
7987
  updateForm(pairs);
@@ -8161,7 +8166,7 @@ function DynamicForm({
8161
8166
  onSubmit: async (values) => {
8162
8167
  await onSubmit(values["​"]);
8163
8168
  },
8164
- defaultValues,
8169
+ defaultValues: defaultValues ? { "​": defaultValues } : void 0,
8165
8170
  formProps: {
8166
8171
  className: "space-y-4 p-4"
8167
8172
  },
@@ -8644,7 +8649,7 @@ function VNextWorkflowTrigger({
8644
8649
  ] }),
8645
8650
  isSuspendedSteps && suspendedSteps?.map((step) => {
8646
8651
  const stepDefinition = vNextWorkflow.steps[step.stepId];
8647
- const stepSchema = stepDefinition?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(stepDefinition.inputSchema))) : z.record(z.string(), z.any());
8652
+ const stepSchema = stepDefinition?.resumeSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(stepDefinition.resumeSchema))) : z.record(z.string(), z.any());
8648
8653
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-4", children: [
8649
8654
  /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "text-mastra-el-3", size: "xs", children: step.stepId }),
8650
8655
  step.suspendPayload && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
@@ -8766,30 +8771,6 @@ const DataTable = ({
8766
8771
  ] });
8767
8772
  };
8768
8773
 
8769
- const sizeClasses = {
8770
- md: "h-button-md gap-md",
8771
- lg: "h-button-lg gap-lg"
8772
- };
8773
- const variantClasses = {
8774
- default: "bg-surface2 hover:bg-surface4 text-icon3 hover:text-icon6",
8775
- light: "bg-surface3 hover:bg-surface5 text-icon6"
8776
- };
8777
- const Button = ({ className, as, size = "md", variant = "default", ...props }) => {
8778
- const Component = as || "button";
8779
- return /* @__PURE__ */ jsx(
8780
- Component,
8781
- {
8782
- className: clsx(
8783
- "bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
8784
- variantClasses[variant],
8785
- sizeClasses[size],
8786
- className
8787
- ),
8788
- ...props
8789
- }
8790
- );
8791
- };
8792
-
8793
8774
  const Breadcrumb = ({ children, label }) => {
8794
8775
  return /* @__PURE__ */ jsx("nav", { "aria-label": label, children: /* @__PURE__ */ jsx("ol", { className: "gap-sm flex items-center", children }) });
8795
8776
  };
@@ -8808,27 +8789,6 @@ const Crumb = ({ className, as, isCurrent, ...props }) => {
8808
8789
  ] });
8809
8790
  };
8810
8791
 
8811
- const Header = ({ children, border = true }) => {
8812
- return /* @__PURE__ */ jsx(
8813
- "header",
8814
- {
8815
- className: clsx("h-header-default z-50 flex w-full items-center gap-[18px] bg-transparent px-5", {
8816
- "border-b-sm border-border1": border
8817
- }),
8818
- children
8819
- }
8820
- );
8821
- };
8822
- const HeaderTitle = ({ children }) => {
8823
- return /* @__PURE__ */ jsx(Txt, { as: "h1", variant: "ui-lg", className: "font-medium text-white", children });
8824
- };
8825
- const HeaderAction = ({ children }) => {
8826
- return /* @__PURE__ */ jsx("div", { className: "ml-auto", children });
8827
- };
8828
- const HeaderGroup = ({ children }) => {
8829
- return /* @__PURE__ */ jsx("div", { className: "gap-lg flex items-center", children });
8830
- };
8831
-
8832
8792
  const DarkLogo = (props) => /* @__PURE__ */ jsxs("svg", { width: "100", height: "100", viewBox: "0 0 100 100", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
8833
8793
  /* @__PURE__ */ jsx(
8834
8794
  "path",
@@ -8886,5 +8846,5 @@ const DarkLogo = (props) => /* @__PURE__ */ jsxs("svg", { width: "100", height:
8886
8846
  )
8887
8847
  ] });
8888
8848
 
8889
- export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, 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, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LogsIcon, MastraResizablePanel, MemoryIcon, NetworkChat, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ToolsIcon, TraceIcon, TsIcon, Txt, TxtCell, UnitCell, VNextWorkflowGraph, VNextWorkflowTrigger, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger };
8849
+ export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, 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, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LogsIcon, MastraResizablePanel, MemoryIcon, NetworkChat, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ToolsIcon, TraceIcon, TsIcon, Txt, TxtCell, UnitCell, VNextWorkflowGraph, VNextWorkflowTrigger, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger };
8890
8850
  //# sourceMappingURL=index.es.js.map