@mastra/playground-ui 5.1.2-alpha.0 → 5.1.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -5373,11 +5373,10 @@ function EvalTable({ evals, isCIMode = false }) {
5373
5373
  const TraceContext = createContext({});
5374
5374
  function TraceProvider({
5375
5375
  children,
5376
- initialTraces
5376
+ initialTraces: traces = []
5377
5377
  }) {
5378
5378
  const [open, setOpen] = useState(false);
5379
5379
  const [trace, setTrace] = useState(null);
5380
- const [traces, setTraces] = useState(initialTraces || []);
5381
5380
  const [currentTraceIndex, setCurrentTraceIndex] = useState(0);
5382
5381
  const [span, setSpan] = useState(null);
5383
5382
  const nextTrace = () => {
@@ -5414,7 +5413,6 @@ function TraceProvider({
5414
5413
  trace,
5415
5414
  setTrace,
5416
5415
  traces,
5417
- setTraces,
5418
5416
  currentTraceIndex,
5419
5417
  setCurrentTraceIndex,
5420
5418
  nextTrace,
@@ -5539,9 +5537,6 @@ const toSigFigs = (num, sigFigs) => {
5539
5537
  return Number(num.toPrecision(sigFigs));
5540
5538
  };
5541
5539
 
5542
- const TracesTableSkeleton = ({ colsCount }) => {
5543
- return /* @__PURE__ */ jsx(Tbody, { children: /* @__PURE__ */ jsx(Row, { children: Array.from({ length: colsCount }).map((_, index) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "w-1/2" }) }, index)) }) });
5544
- };
5545
5540
  const TracesTableEmpty = ({ colsCount }) => {
5546
5541
  return /* @__PURE__ */ jsx(Tbody, { children: /* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(Cell, { colSpan: colsCount, className: "text-center py-4", children: /* @__PURE__ */ jsx(Txt, { children: "No traces found" }) }) }) });
5547
5542
  };
@@ -5562,7 +5557,7 @@ const TraceRow = ({ trace, index, isActive }) => {
5562
5557
  /* @__PURE__ */ jsx(Cell, { children: hasFailure ? /* @__PURE__ */ jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsx(X, {}), children: "Failed" }) : /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(Check, {}), variant: "success", children: "Success" }) })
5563
5558
  ] });
5564
5559
  };
5565
- const TracesTable = ({ traces, isLoading, error }) => {
5560
+ const TracesTable = ({ traces, error }) => {
5566
5561
  const hasNoTraces = !traces || traces.length === 0;
5567
5562
  const { currentTraceIndex } = useContext(TraceContext);
5568
5563
  const colsCount = 4;
@@ -5574,7 +5569,7 @@ const TracesTable = ({ traces, isLoading, error }) => {
5574
5569
  /* @__PURE__ */ jsx(Th, { width: 120, children: "Spans" }),
5575
5570
  /* @__PURE__ */ jsx(Th, { width: 120, children: "Status" })
5576
5571
  ] }),
5577
- isLoading ? /* @__PURE__ */ jsx(TracesTableSkeleton, { colsCount }) : error ? /* @__PURE__ */ jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsx(TraceRow, { trace, index, isActive: index === currentTraceIndex }, trace.traceId)) }) })
5572
+ error ? /* @__PURE__ */ jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsx(TraceRow, { trace, index, isActive: index === currentTraceIndex }, trace.traceId)) }) })
5578
5573
  ] });
5579
5574
  };
5580
5575
 
@@ -6182,14 +6177,14 @@ const TracesSidebar = ({ onResize }) => {
6182
6177
  );
6183
6178
  };
6184
6179
 
6185
- function AgentTraces({ className, traces, isLoading, error }) {
6186
- return /* @__PURE__ */ jsx(AgentTracesInner, { className, traces, isLoading, error });
6180
+ function AgentTraces({ className, traces, error }) {
6181
+ return /* @__PURE__ */ jsx(TraceProvider, { initialTraces: traces || [], children: /* @__PURE__ */ jsx(AgentTracesInner, { className, traces, error }) });
6187
6182
  }
6188
- function AgentTracesInner({ className, traces, isLoading, error }) {
6183
+ function AgentTracesInner({ className, traces, error }) {
6189
6184
  const [sidebarWidth, setSidebarWidth] = useState(100);
6190
6185
  const { isOpen: open } = useContext(TraceContext);
6191
6186
  return /* @__PURE__ */ jsxs("div", { className: clsx("h-full relative overflow-hidden flex", className), children: [
6192
- /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading, error }) }),
6187
+ /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsx(TracesTable, { traces, error }) }),
6193
6188
  open && /* @__PURE__ */ jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
6194
6189
  ] });
6195
6190
  }
@@ -6641,10 +6636,10 @@ const NetworkChat = ({ agentId, memory }) => {
6641
6636
  return /* @__PURE__ */ jsx(MastraNetworkRuntimeProvider, { agentId, memory, modelSettings, children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsx(Thread, { ToolFallback }) }) });
6642
6637
  };
6643
6638
 
6644
- function WorkflowTraces({ traces, isLoading, error, runId, stepName }) {
6645
- return /* @__PURE__ */ jsx(WorkflowTracesInner, { traces, isLoading, error, runId, stepName });
6639
+ function WorkflowTraces({ traces, error, runId, stepName }) {
6640
+ return /* @__PURE__ */ jsx(TraceProvider, { initialTraces: traces || [], children: /* @__PURE__ */ jsx(WorkflowTracesInner, { traces, error, runId, stepName }) });
6646
6641
  }
6647
- function WorkflowTracesInner({ traces, isLoading, error, runId, stepName }) {
6642
+ function WorkflowTracesInner({ traces, error, runId, stepName }) {
6648
6643
  const hasRunRef = useRef(false);
6649
6644
  const [sidebarWidth, setSidebarWidth] = useState(100);
6650
6645
  const { isOpen: open, setTrace, setIsOpen, setSpan } = useContext(TraceContext);
@@ -6661,7 +6656,7 @@ function WorkflowTracesInner({ traces, isLoading, error, runId, stepName }) {
6661
6656
  hasRunRef.current = true;
6662
6657
  }, [runId, traces, setTrace]);
6663
6658
  return /* @__PURE__ */ jsxs("main", { className: "h-full relative overflow-hidden flex", children: [
6664
- /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading, error }) }),
6659
+ /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsx(TracesTable, { traces, error }) }),
6665
6660
  open && /* @__PURE__ */ jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
6666
6661
  ] });
6667
6662
  }
@@ -10099,7 +10094,6 @@ function usePolling({
10099
10094
 
10100
10095
  const useTraces = (componentName, baseUrl, isWorkflow = false) => {
10101
10096
  const [traces, setTraces] = useState([]);
10102
- const { setTraces: setTraceContextTraces } = useContext(TraceContext);
10103
10097
  const client = useMemo(() => createMastraClient(baseUrl), [baseUrl]);
10104
10098
  const fetchFn = useCallback(async () => {
10105
10099
  try {
@@ -10117,15 +10111,11 @@ const useTraces = (componentName, baseUrl, isWorkflow = false) => {
10117
10111
  throw error2;
10118
10112
  }
10119
10113
  }, [client, componentName, isWorkflow]);
10120
- const onSuccess = useCallback(
10121
- (newTraces) => {
10122
- if (newTraces.length > 0) {
10123
- setTraces(() => newTraces);
10124
- setTraceContextTraces(() => newTraces);
10125
- }
10126
- },
10127
- [setTraceContextTraces]
10128
- );
10114
+ const onSuccess = useCallback((newTraces) => {
10115
+ if (newTraces.length > 0) {
10116
+ setTraces(() => newTraces);
10117
+ }
10118
+ }, []);
10129
10119
  const onError = useCallback((error2) => {
10130
10120
  console.log(`error, onError`, error2);
10131
10121
  toast.error(error2.message);
@@ -10144,5 +10134,5 @@ const useTraces = (componentName, baseUrl, isWorkflow = false) => {
10144
10134
  return { traces, firstCallLoading, error };
10145
10135
  };
10146
10136
 
10147
- export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentNetworkCoinIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyState, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolsIcon, TraceContext, TraceIcon, TraceProvider, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, useCurrentRun, usePlaygroundStore, usePolling, useSpeechRecognition, useTraces };
10137
+ export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentNetworkCoinIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyState, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolsIcon, TraceIcon, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, useCurrentRun, usePlaygroundStore, usePolling, useSpeechRecognition, useTraces };
10148
10138
  //# sourceMappingURL=index.es.js.map