@mastra/playground-ui 5.1.2-alpha.4 → 5.1.2-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -6025,42 +6025,6 @@ function transformKey(key) {
6025
6025
  const newKey = key.split(".").join(" ").split("_").join(" ").replaceAll("ai", "AI");
6026
6026
  return newKey.substring(0, 1).toUpperCase() + newKey.substring(1);
6027
6027
  }
6028
- const refineTraces = (traces, isWorkflow = false) => {
6029
- const listOfSpanIds = /* @__PURE__ */ new Set();
6030
- const newName = (name) => {
6031
- if (name?.startsWith("workflow.") && isWorkflow) {
6032
- return name?.split(".")?.slice(2)?.join(".");
6033
- }
6034
- if (name?.startsWith("agent.") && !isWorkflow) {
6035
- return name?.split(".")?.slice(1)?.join(".");
6036
- }
6037
- return name;
6038
- };
6039
- const groupedTraces = traces?.reduce((acc, curr) => {
6040
- const newCurr = { ...curr, name: newName(curr.name), duration: curr.endTime - curr.startTime };
6041
- listOfSpanIds.add(curr.id);
6042
- return { ...acc, [curr.traceId]: [...acc[curr.traceId] || [], newCurr] };
6043
- }, {});
6044
- const tracesData = Object.entries(groupedTraces).map(([key, value]) => {
6045
- const parentSpan = value.find((span) => !span.parentSpanId || !listOfSpanIds.has(span.parentSpanId));
6046
- const enrichedSpans = value.map((span) => ({
6047
- ...span,
6048
- parentSpanId: parentSpan?.id === span.id ? null : span?.parentSpanId
6049
- }));
6050
- const failedStatus = value.find((span) => span.status.code !== 0)?.status;
6051
- const runId = value?.[0]?.attributes?.runId;
6052
- return {
6053
- traceId: key,
6054
- serviceName: parentSpan?.name || key,
6055
- duration: parentSpan?.duration || value.reduce((acc, curr) => acc + curr.duration, 0),
6056
- status: failedStatus || parentSpan?.status || value[0].status,
6057
- started: value[0].startTime,
6058
- trace: enrichedSpans,
6059
- runId: runId ? String(runId) : void 0
6060
- };
6061
- });
6062
- return tracesData;
6063
- };
6064
6028
 
6065
6029
  function SpanDetail() {
6066
6030
  const { span, setSpan, trace, setIsOpen } = useContext(TraceContext);
@@ -9794,7 +9758,7 @@ const DataTable = ({
9794
9758
  const rows = table.getRowModel().rows;
9795
9759
  return /* @__PURE__ */ jsxs("div", { children: [
9796
9760
  /* @__PURE__ */ jsxs(Table, { children: [
9797
- /* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => {
9761
+ /* @__PURE__ */ jsx(Thead, { className: "sticky top-0 bg-surface2", children: ths.headers.map((header) => {
9798
9762
  const size = header.column.getSize();
9799
9763
  const meta = header.column.columnDef.meta;
9800
9764
  return /* @__PURE__ */ jsx(Th, { style: { width: meta?.width || size || "auto" }, children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id);
@@ -10102,47 +10066,5 @@ function usePolling({
10102
10066
  };
10103
10067
  }
10104
10068
 
10105
- const useTraces = (componentName, isWorkflow = false) => {
10106
- const [traces, setTraces] = useState([]);
10107
- const client = useMemo(() => useMastraClient(), []);
10108
- const fetchFn = useCallback(async () => {
10109
- try {
10110
- const res = await client.getTelemetry({
10111
- attribute: {
10112
- componentName
10113
- }
10114
- });
10115
- if (!res.traces) {
10116
- throw new Error("Error fetching traces");
10117
- }
10118
- const refinedTraces = refineTraces(res?.traces || [], isWorkflow);
10119
- return refinedTraces;
10120
- } catch (error2) {
10121
- throw error2;
10122
- }
10123
- }, [client, componentName, isWorkflow]);
10124
- const onSuccess = useCallback((newTraces) => {
10125
- if (newTraces.length > 0) {
10126
- setTraces(() => newTraces);
10127
- }
10128
- }, []);
10129
- const onError = useCallback((error2) => {
10130
- console.log(`error, onError`, error2);
10131
- toast.error(error2.message);
10132
- }, []);
10133
- const shouldContinue = useCallback(() => {
10134
- return true;
10135
- }, []);
10136
- const { firstCallLoading, error } = usePolling({
10137
- fetchFn,
10138
- interval: 3e3,
10139
- onSuccess,
10140
- onError,
10141
- shouldContinue,
10142
- enabled: true
10143
- });
10144
- return { traces, firstCallLoading, error };
10145
- };
10146
-
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, MastraClientProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolsIcon, TraceIcon, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, useCurrentRun, useMastraClient, usePlaygroundStore, usePolling, useSpeechRecognition, useTraces };
10069
+ export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentNetworkCoinIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyState, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraClientProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolsIcon, TraceIcon, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, useCurrentRun, useMastraClient, usePlaygroundStore, usePolling, useSpeechRecognition };
10148
10070
  //# sourceMappingURL=index.es.js.map