@mastra/playground-ui 19.0.0-alpha.2 → 19.0.0-alpha.3
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/CHANGELOG.md +49 -0
- package/dist/index.cjs.js +1230 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1208 -19
- package/dist/index.es.js.map +1 -1
- package/dist/src/domains/agents/components/agent-metadata/agent-metadata.d.ts +1 -0
- package/dist/src/domains/metrics/components/date-range-selector.d.ts +1 -0
- package/dist/src/domains/metrics/components/index.d.ts +28 -0
- package/dist/src/domains/metrics/components/latency-card.d.ts +1 -0
- package/dist/src/domains/metrics/components/metrics-dashboard.d.ts +1 -0
- package/dist/src/domains/metrics/components/metrics-kpi-cards.d.ts +4 -0
- package/dist/src/domains/metrics/components/metrics-utils.d.ts +14 -0
- package/dist/src/domains/metrics/components/model-usage-cost-card.d.ts +1 -0
- package/dist/src/domains/metrics/components/scores-card.d.ts +1 -0
- package/dist/src/domains/metrics/components/token-usage-by-agent-card.d.ts +1 -0
- package/dist/src/domains/metrics/components/traces-volume-card.d.ts +1 -0
- package/dist/src/domains/metrics/hooks/use-agent-runs-kpi-metrics.d.ts +10 -0
- package/dist/src/domains/metrics/hooks/use-avg-score-kpi-metrics.d.ts +10 -0
- package/dist/src/domains/metrics/hooks/use-latency-metrics.d.ts +11 -0
- package/dist/src/domains/metrics/hooks/use-metrics-filters.d.ts +9 -0
- package/dist/src/domains/metrics/hooks/use-metrics.d.ts +56 -0
- package/dist/src/domains/metrics/hooks/use-model-usage-cost-metrics.d.ts +8 -0
- package/dist/src/domains/metrics/hooks/use-scores-metrics.d.ts +22 -0
- package/dist/src/domains/metrics/hooks/use-token-usage-by-agent-metrics.d.ts +7 -0
- package/dist/src/domains/metrics/hooks/use-total-tokens-kpi-metrics.d.ts +6 -0
- package/dist/src/domains/metrics/hooks/use-trace-volume-metrics.d.ts +10 -0
- package/dist/src/domains/metrics/index.d.ts +1 -0
- package/dist/src/domains/workspace/hooks/use-workspace-skills.d.ts +5 -1
- package/dist/src/domains/workspace/types.d.ts +1 -1
- package/dist/src/ds/components/DashboardCard/dashboard-card.d.ts +6 -0
- package/dist/src/ds/components/DashboardCard/dashboard-card.stories.d.ts +8 -0
- package/dist/src/ds/components/DashboardCard/index.d.ts +1 -0
- package/dist/src/ds/components/EntityList/entity-list-no-match.d.ts +5 -0
- package/dist/src/ds/components/EntityList/entity-list.d.ts +2 -0
- package/dist/src/ds/components/HorizontalBars/horizontal-bars.d.ts +15 -0
- package/dist/src/ds/components/HorizontalBars/horizontal-bars.stories.d.ts +7 -0
- package/dist/src/ds/components/HorizontalBars/index.d.ts +1 -0
- package/dist/src/ds/components/MetricsCard/index.d.ts +2 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-content.d.ts +5 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-description.d.ts +4 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-error.d.ts +4 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-loading.d.ts +3 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-no-data.d.ts +4 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-root.d.ts +5 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-summary.d.ts +5 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-title-and-description.d.ts +15 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-title.d.ts +4 -0
- package/dist/src/ds/components/MetricsCard/metrics-card-top-bar.d.ts +5 -0
- package/dist/src/ds/components/MetricsCard/metrics-card.d.ts +31 -0
- package/dist/src/ds/components/MetricsCard/metrics-card.stories.d.ts +11 -0
- package/dist/src/ds/components/MetricsDataTable/index.d.ts +1 -0
- package/dist/src/ds/components/MetricsDataTable/metrics-data-table.d.ts +13 -0
- package/dist/src/ds/components/MetricsDataTable/metrics-data-table.stories.d.ts +16 -0
- package/dist/src/ds/components/MetricsFlexGrid/index.d.ts +1 -0
- package/dist/src/ds/components/MetricsFlexGrid/metrics-flex-grid.d.ts +5 -0
- package/dist/src/ds/components/MetricsFlexGrid/metrics-flex-grid.stories.d.ts +7 -0
- package/dist/src/ds/components/MetricsKpiCard/index.d.ts +1 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card-change.d.ts +6 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card-error.d.ts +4 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card-label.d.ts +4 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card-loading.d.ts +3 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card-no-change.d.ts +4 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card-no-data.d.ts +4 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card-root.d.ts +5 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card-value.d.ts +4 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card.d.ts +17 -0
- package/dist/src/ds/components/MetricsKpiCard/metrics-kpi-card.stories.d.ts +10 -0
- package/dist/src/ds/components/MetricsLineChart/index.d.ts +2 -0
- package/dist/src/ds/components/MetricsLineChart/metrics-line-chart-tooltip.d.ts +10 -0
- package/dist/src/ds/components/MetricsLineChart/metrics-line-chart.d.ts +15 -0
- package/dist/src/ds/components/Tabs/tabs-list.d.ts +2 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/lib/framework.d.ts +3 -3
- package/package.json +11 -10
package/dist/index.es.js
CHANGED
|
@@ -8,7 +8,7 @@ import { useMastraClient, resolveToChildMessages, useCreateWorkflowRun, useStrea
|
|
|
8
8
|
import { useQuery, useQueryClient, useMutation, useInfiniteQuery, useQueries, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
9
9
|
import './index.css';export * from '@tanstack/react-query';
|
|
10
10
|
import { useComposer, useComposerRuntime, useAttachment, ComposerPrimitive, AttachmentPrimitive, useAuiState, useAssistantState, useMessage, MessagePrimitive, ActionBarPrimitive, ThreadPrimitive, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechSynthesisAdapter, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
|
|
11
|
-
import { X, Wand2, Link, CloudUpload, FileText, CircleXIcon, ChevronUpIcon, CircleCheck, CircleX, CircleAlert, Info, CheckIcon as CheckIcon$1, CopyIcon, Share2, Check, FolderTree, HardDrive, Loader2, Brain, ChevronDown, ChevronRight, Unplug, XCircle, CloudCog, TerminalSquare, Clock as Clock$1, PlayCircle, Workflow, Layers, List, CalendarClock, Timer, CornerDownRight, GitBranch, RefreshCw, Repeat, Repeat1, Network, Footprints, Circle, TrashIcon, Brackets, PlusIcon, TriangleAlertIcon, CalendarIcon, CircleAlertIcon, InfoIcon as InfoIcon$1, AlertCircle, TriangleAlert, Braces, ChevronDownIcon, Plus, EyeOffIcon, EyeIcon, ShieldAlert, PauseIcon, HourglassIcon, CircleDashed, Minus, Maximize, AlertCircleIcon, StopCircle, CirclePause, Tag, ShieldX, SearchIcon, ExternalLinkIcon, CircleSlashIcon, Cpu, ChevronsUpDown, Search, ArrowRight, ArrowLeft, CheckCircleIcon, BrainIcon, AudioLinesIcon, StopCircleIcon, DatabaseIcon, Save, Mic, ArrowUp, SaveIcon, BookOpen, ExternalLink, RotateCcw, GripVertical, ArrowLeftIcon, ArrowRightIcon, AlignLeftIcon, AlignJustifyIcon, ArrowUpIcon, ArrowDownIcon, ChevronsRightIcon, CalculatorIcon, ChevronRightIcon, GaugeIcon, ChevronsLeftRightEllipsisIcon, HashIcon, FileInputIcon, FileOutputIcon, ReceiptText, XIcon, Type, ToggleLeft, Hash, Ban, ListX, ChevronsLeft, ChevronsRight, ChevronLeft, Text, TextSearch, EqualNot, Equal, Component, Trash2, Ruler, Trash, MoveRight, Copy, Folder, Link2, RefreshCcwIcon, AlignLeft, Trash2Icon, FileTextIcon, BookmarkPlus, PenLine, LaptopMinimal, Plug, File as File$1, FolderOpen, Image, FileJson, FileCode, FolderPlus, Drill, Pencil, Eye, Wrench, MessageSquare, AlertTriangleIcon, BracesIcon, ArrowRightToLineIcon, CoinsIcon, CircleGaugeIcon, PanelTopIcon, ChevronsUpIcon, ChevronsDownIcon, CircleChevronUpIcon, CircleChevronDownIcon, FileIcon, TimerIcon, ChevronsLeftRightIcon, ChevronFirstIcon, ChevronLastIcon, CircleDashedIcon, ListTreeIcon, PanelLeftIcon, Award, ClipboardCheck, CheckCircle, FormInput, Sparkles, Play, CheckCircle2, FlaskConical, Database, ThumbsUp, ThumbsDown, FileInput, FileOutput, NetworkIcon, WorkflowIcon as WorkflowIcon$1, PackageIcon, GitBranchIcon, PackageOpenIcon, OctagonXIcon, FrownIcon, Upload, ClockIcon, BanIcon, MoveRightIcon, GitCompare, ChevronLeftIcon, TagIcon, FileCodeIcon, Calendar1Icon, HistoryIcon, History, EllipsisVerticalIcon, AmpersandIcon, GitCompareIcon, Download, FolderOutput, AlertTriangle, MoreVertical, PanelRightIcon, PlayIcon, OctagonAlertIcon, CrosshairIcon, TargetIcon, LayersIcon, EqualIcon, PenIcon, KeyboardIcon, CircleSlash, Cloud, Zap, FileCode2, Code, Server, Home, Package, Github } from 'lucide-react';
|
|
11
|
+
import { X, Wand2, Link, CloudUpload, FileText, CircleXIcon, ChevronUpIcon, CircleCheck, CircleX, CircleAlert, Info, CheckIcon as CheckIcon$1, CopyIcon, Share2, Check, FolderTree, HardDrive, Loader2, Brain, ChevronDown, ChevronRight, Unplug, XCircle, CloudCog, TerminalSquare, Clock as Clock$1, PlayCircle, Workflow, Layers, List, CalendarClock, Timer, CornerDownRight, GitBranch, RefreshCw, Repeat, Repeat1, Network, Footprints, Circle, TrashIcon, Brackets, PlusIcon, TriangleAlertIcon, CalendarIcon, CircleAlertIcon, InfoIcon as InfoIcon$1, AlertCircle, TriangleAlert, Braces, ChevronDownIcon, Plus, EyeOffIcon, EyeIcon, ShieldAlert, PauseIcon, HourglassIcon, CircleDashed, Minus, Maximize, AlertCircleIcon, StopCircle, CirclePause, Tag, ShieldX, SearchIcon, ExternalLinkIcon, CircleSlashIcon, Cpu, ChevronsUpDown, Search, ArrowRight, ArrowLeft, CheckCircleIcon, BrainIcon, AudioLinesIcon, StopCircleIcon, DatabaseIcon, Save, Mic, ArrowUp, SaveIcon, BookOpen, ExternalLink, RotateCcw, GripVertical, ArrowLeftIcon, ArrowRightIcon, AlignLeftIcon, AlignJustifyIcon, ArrowUpIcon, ArrowDownIcon, ChevronsRightIcon, CalculatorIcon, ChevronRightIcon, GaugeIcon, ChevronsLeftRightEllipsisIcon, HashIcon, FileInputIcon, FileOutputIcon, ReceiptText, XIcon, Type, ToggleLeft, Hash, Ban, ListX, ChevronsLeft, ChevronsRight, ChevronLeft, Text, TextSearch, EqualNot, Equal, Component, Trash2, Ruler, Trash, MoveRight, Copy, Folder, Link2, RefreshCcwIcon, AlignLeft, Trash2Icon, FileTextIcon, BookmarkPlus, PenLine, LaptopMinimal, Plug, File as File$1, FolderOpen, Image, FileJson, FileCode, FolderPlus, Drill, Pencil, Eye, Wrench, MessageSquare, AlertTriangleIcon, BracesIcon, ArrowRightToLineIcon, CoinsIcon, CircleGaugeIcon, PanelTopIcon, ChevronsUpIcon, ChevronsDownIcon, CircleChevronUpIcon, CircleChevronDownIcon, FileIcon, TimerIcon, ChevronsLeftRightIcon, ChevronFirstIcon, ChevronLastIcon, CircleDashedIcon, ListTreeIcon, PanelLeftIcon, Award, ClipboardCheck, CheckCircle, FormInput, Sparkles, Play, CheckCircle2, FlaskConical, Database, ThumbsUp, ThumbsDown, FileInput, FileOutput, NetworkIcon, WorkflowIcon as WorkflowIcon$1, PackageIcon, GitBranchIcon, PackageOpenIcon, OctagonXIcon, FrownIcon, TrendingUpIcon, TrendingDownIcon, Upload, ClockIcon, BanIcon, MoveRightIcon, GitCompare, ChevronLeftIcon, TagIcon, FileCodeIcon, Calendar1Icon, HistoryIcon, History, EllipsisVerticalIcon, AmpersandIcon, GitCompareIcon, Download, FolderOutput, AlertTriangle, MoreVertical, PanelRightIcon, PlayIcon, OctagonAlertIcon, CrosshairIcon, TargetIcon, LayersIcon, EqualIcon, PenIcon, KeyboardIcon, CircleSlash, Cloud, Zap, FileCode2, Code, Server, Home, Package, Github } from 'lucide-react';
|
|
12
12
|
import { S as Shadows, G as Glows, B as BorderColors, C as Colors, a as Sizes, F as FontSizes, L as LineHeights, b as BorderRadius, c as Spacings } from './spacings-ZtORQo9-.js';
|
|
13
13
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
14
14
|
import { TooltipProvider as TooltipProvider$1 } from '@radix-ui/react-tooltip';
|
|
@@ -39,7 +39,7 @@ import { z } from 'zod';
|
|
|
39
39
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
40
40
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
41
41
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
42
|
-
import { format, isValid, formatDate, isToday, isYesterday, isThisYear } from 'date-fns';
|
|
42
|
+
import { format, isValid, formatDate, isToday, isYesterday, differenceInDays, isThisYear } from 'date-fns';
|
|
43
43
|
import { useDebouncedCallback, useThrottledCallback, useDebounce } from 'use-debounce';
|
|
44
44
|
import * as VisuallyHidden from '@radix-ui/react-visually-hidden';
|
|
45
45
|
import { VisuallyHidden as VisuallyHidden$1 } from '@radix-ui/react-visually-hidden';
|
|
@@ -72,6 +72,7 @@ import semver from 'semver';
|
|
|
72
72
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
73
73
|
import { coreFeatures } from '@mastra/core/features';
|
|
74
74
|
import { EntityType } from '@mastra/core/observability';
|
|
75
|
+
import { ResponsiveContainer, LineChart, CartesianGrid, XAxis, YAxis, Tooltip as Tooltip$1, Line } from 'recharts';
|
|
75
76
|
import Papa from 'papaparse';
|
|
76
77
|
import { createPortal } from 'react-dom';
|
|
77
78
|
import { isToday as isToday$1 } from 'date-fns/isToday';
|
|
@@ -12579,6 +12580,10 @@ function EntityListDescriptionCell({ children, className }) {
|
|
|
12579
12580
|
return /* @__PURE__ */ jsx(EntityListCell, { className: cn("text-neutral2", className), children: /* @__PURE__ */ jsx("span", { className: "truncate", children }) });
|
|
12580
12581
|
}
|
|
12581
12582
|
|
|
12583
|
+
function EntityListNoMatch({ message = "Nothing matches your search", className }) {
|
|
12584
|
+
return /* @__PURE__ */ jsx("div", { className: cn("col-span-full flex flex-col items-center justify-center gap-2 py-12 text-neutral3", className), children: /* @__PURE__ */ jsx("p", { className: "text-ui-md", children: message }) });
|
|
12585
|
+
}
|
|
12586
|
+
|
|
12582
12587
|
function EntityListRoot({ children, columns, className }) {
|
|
12583
12588
|
return /* @__PURE__ */ jsx(
|
|
12584
12589
|
"div",
|
|
@@ -12690,7 +12695,8 @@ const EntityList = Object.assign(EntityListRoot, {
|
|
|
12690
12695
|
Cell: EntityListCell,
|
|
12691
12696
|
TextCell: EntityListTextCell,
|
|
12692
12697
|
NameCell: EntityListNameCell,
|
|
12693
|
-
DescriptionCell: EntityListDescriptionCell
|
|
12698
|
+
DescriptionCell: EntityListDescriptionCell,
|
|
12699
|
+
NoMatch: EntityListNoMatch
|
|
12694
12700
|
});
|
|
12695
12701
|
|
|
12696
12702
|
const widths$2 = ["75%", "50%", "65%", "90%", "60%", "80%"];
|
|
@@ -12764,6 +12770,7 @@ function WorkflowsList({ workflows, isLoading, error, search = "" }) {
|
|
|
12764
12770
|
/* @__PURE__ */ jsx(EntityList.TopCell, { children: "Description" }),
|
|
12765
12771
|
/* @__PURE__ */ jsx(EntityList.TopCell, { children: "Number of steps" })
|
|
12766
12772
|
] }),
|
|
12773
|
+
filteredData.length === 0 && search ? /* @__PURE__ */ jsx(EntityList.NoMatch, { message: "No Workflows match your search" }) : null,
|
|
12767
12774
|
filteredData.map((wf) => {
|
|
12768
12775
|
const name = truncateString(wf.name, 50);
|
|
12769
12776
|
const description = truncateString(wf.description ?? "", 200);
|
|
@@ -13000,7 +13007,7 @@ const Tabs = ({ children, defaultTab, value, onValueChange, className }) => {
|
|
|
13000
13007
|
return /* @__PURE__ */ jsx(RadixTabs.Root, { value: currentTab, onValueChange: handleTabChange, className: cn("overflow-y-auto", className), children });
|
|
13001
13008
|
};
|
|
13002
13009
|
|
|
13003
|
-
const TabList = ({ children, variant = "default", className }) => {
|
|
13010
|
+
const TabList = ({ children, variant = "default", alignment = "left", className }) => {
|
|
13004
13011
|
return /* @__PURE__ */ jsx("div", { className: cn("w-full overflow-x-auto", className), children: /* @__PURE__ */ jsx(
|
|
13005
13012
|
RadixTabs.List,
|
|
13006
13013
|
{
|
|
@@ -13009,7 +13016,8 @@ const TabList = ({ children, variant = "default", className }) => {
|
|
|
13009
13016
|
{
|
|
13010
13017
|
// variant: default
|
|
13011
13018
|
"text-ui-lg": variant === "default",
|
|
13012
|
-
"[&>button]:py-2 [&>button]:px-6 [&>button]:font-normal [&>button]:text-neutral3 [&>button]:
|
|
13019
|
+
"[&>button]:py-2 [&>button]:px-6 [&>button]:font-normal [&>button]:text-neutral3 [&>button]:border-b [&>button]:border-border1": variant === "default",
|
|
13020
|
+
"[&>button]:flex-1": variant === "default" && alignment === "full-width",
|
|
13013
13021
|
[`[&>button]:${transitions.colors} [&>button]:hover:text-neutral4`]: variant === "default",
|
|
13014
13022
|
"[&>button[data-state=active]]:text-neutral5 [&>button[data-state=active]]:border-white/50": variant === "default",
|
|
13015
13023
|
// variant: buttons
|
|
@@ -19957,6 +19965,7 @@ function ScorersList({ scorers, isLoading, error, search = "" }) {
|
|
|
19957
19965
|
/* @__PURE__ */ jsx(EntityList.TopCell, { className: "text-center", children: "Agents" }),
|
|
19958
19966
|
/* @__PURE__ */ jsx(EntityList.TopCell, { className: "text-center", children: "Workflows" })
|
|
19959
19967
|
] }),
|
|
19968
|
+
filteredData.length === 0 && search ? /* @__PURE__ */ jsx(EntityList.NoMatch, { message: "No Scorers match your search" }) : null,
|
|
19960
19969
|
filteredData.map((scorer) => {
|
|
19961
19970
|
const name = truncateString(scorer.scorer.config?.name ?? scorer.id, 50);
|
|
19962
19971
|
const description = truncateString(scorer.scorer.config?.description ?? "", 200);
|
|
@@ -21993,9 +22002,16 @@ const AgentMetadataSkillList = ({ skills, agentId, workspaceId }) => {
|
|
|
21993
22002
|
}
|
|
21994
22003
|
);
|
|
21995
22004
|
return /* @__PURE__ */ jsx(AgentMetadataListItem, { children: isActivated ? /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
21996
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22005
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22006
|
+
Link,
|
|
22007
|
+
{
|
|
22008
|
+
href: paths.agentSkillLink(agentId, skill.name, skill.path, workspaceId),
|
|
22009
|
+
"data-testid": "skill-badge",
|
|
22010
|
+
children: badge
|
|
22011
|
+
}
|
|
22012
|
+
) }),
|
|
21997
22013
|
/* @__PURE__ */ jsx(TooltipContent, { className: "bg-surface3 text-neutral6 border border-border1", children: "Active" })
|
|
21998
|
-
] }) }) : /* @__PURE__ */ jsx(Link, { href: paths.agentSkillLink(agentId, skill.name, workspaceId), "data-testid": "skill-badge", children: badge }) }, skill.
|
|
22014
|
+
] }) }) : /* @__PURE__ */ jsx(Link, { href: paths.agentSkillLink(agentId, skill.name, skill.path, workspaceId), "data-testid": "skill-badge", children: badge }) }, skill.path);
|
|
21999
22015
|
}) });
|
|
22000
22016
|
};
|
|
22001
22017
|
function formatWorkspaceToolName(toolName) {
|
|
@@ -25086,6 +25102,7 @@ function PromptsList({ promptBlocks, isLoading, error, search = "" }) {
|
|
|
25086
25102
|
/* @__PURE__ */ jsx(EntityList.TopCell, { className: "text-center", children: "Has Draft" }),
|
|
25087
25103
|
/* @__PURE__ */ jsx(EntityList.TopCell, { className: "text-center", children: "Is Published" })
|
|
25088
25104
|
] }),
|
|
25105
|
+
filteredData.length === 0 && search ? /* @__PURE__ */ jsx(EntityList.NoMatch, { message: "No Prompts match your search" }) : null,
|
|
25089
25106
|
filteredData.map((block) => {
|
|
25090
25107
|
const name = truncateString(block.name, 50);
|
|
25091
25108
|
const description = truncateString(block.description ?? "", 200);
|
|
@@ -30594,7 +30611,7 @@ const useWorkspaceSkills = (options) => {
|
|
|
30594
30611
|
const useWorkspaceSkill = (skillName, options) => {
|
|
30595
30612
|
const client = useMastraClient();
|
|
30596
30613
|
return useQuery({
|
|
30597
|
-
queryKey: ["workspace", "skills", skillName, options?.workspaceId],
|
|
30614
|
+
queryKey: ["workspace", "skills", skillName, options?.path, options?.workspaceId],
|
|
30598
30615
|
queryFn: async () => {
|
|
30599
30616
|
if (!isWorkspaceV1Supported(client)) {
|
|
30600
30617
|
throw new Error("Workspace v1 not supported by core or client");
|
|
@@ -30603,7 +30620,7 @@ const useWorkspaceSkill = (skillName, options) => {
|
|
|
30603
30620
|
throw new Error("workspaceId is required");
|
|
30604
30621
|
}
|
|
30605
30622
|
const workspace = client.getWorkspace(options.workspaceId);
|
|
30606
|
-
const skill = workspace.getSkill(skillName);
|
|
30623
|
+
const skill = workspace.getSkill(skillName, options?.path);
|
|
30607
30624
|
return skill.details();
|
|
30608
30625
|
},
|
|
30609
30626
|
enabled: options?.enabled !== false && !!skillName && !!options?.workspaceId && isWorkspaceV1Supported(client),
|
|
@@ -30613,7 +30630,7 @@ const useWorkspaceSkill = (skillName, options) => {
|
|
|
30613
30630
|
const useWorkspaceSkillReferences = (skillName, options) => {
|
|
30614
30631
|
const client = useMastraClient();
|
|
30615
30632
|
return useQuery({
|
|
30616
|
-
queryKey: ["workspace", "skills", skillName, "references", options?.workspaceId],
|
|
30633
|
+
queryKey: ["workspace", "skills", skillName, options?.path, "references", options?.workspaceId],
|
|
30617
30634
|
queryFn: async () => {
|
|
30618
30635
|
if (!isWorkspaceV1Supported(client)) {
|
|
30619
30636
|
throw new Error("Workspace v1 not supported by core or client");
|
|
@@ -30622,7 +30639,7 @@ const useWorkspaceSkillReferences = (skillName, options) => {
|
|
|
30622
30639
|
throw new Error("workspaceId is required");
|
|
30623
30640
|
}
|
|
30624
30641
|
const workspace = client.getWorkspace(options.workspaceId);
|
|
30625
|
-
const skill = workspace.getSkill(skillName);
|
|
30642
|
+
const skill = workspace.getSkill(skillName, options?.path);
|
|
30626
30643
|
return skill.listReferences();
|
|
30627
30644
|
},
|
|
30628
30645
|
enabled: options?.enabled !== false && !!skillName && !!options?.workspaceId && isWorkspaceV1Supported(client),
|
|
@@ -30632,7 +30649,7 @@ const useWorkspaceSkillReferences = (skillName, options) => {
|
|
|
30632
30649
|
const useWorkspaceSkillReference = (skillName, referencePath, options) => {
|
|
30633
30650
|
const client = useMastraClient();
|
|
30634
30651
|
return useQuery({
|
|
30635
|
-
queryKey: ["workspace", "skills", skillName, "references", referencePath, options?.workspaceId],
|
|
30652
|
+
queryKey: ["workspace", "skills", skillName, options?.path, "references", referencePath, options?.workspaceId],
|
|
30636
30653
|
queryFn: async () => {
|
|
30637
30654
|
if (!isWorkspaceV1Supported(client)) {
|
|
30638
30655
|
throw new Error("Workspace v1 not supported by core or client");
|
|
@@ -30641,7 +30658,7 @@ const useWorkspaceSkillReference = (skillName, referencePath, options) => {
|
|
|
30641
30658
|
throw new Error("workspaceId is required");
|
|
30642
30659
|
}
|
|
30643
30660
|
const workspace = client.getWorkspace(options.workspaceId);
|
|
30644
|
-
const skill = workspace.getSkill(skillName);
|
|
30661
|
+
const skill = workspace.getSkill(skillName, options?.path);
|
|
30645
30662
|
return skill.getReference(referencePath);
|
|
30646
30663
|
},
|
|
30647
30664
|
enabled: options?.enabled !== false && !!skillName && !!referencePath && !!options?.workspaceId && isWorkspaceV1Supported(client),
|
|
@@ -30663,7 +30680,7 @@ const useSearchWorkspaceSkills = () => {
|
|
|
30663
30680
|
const useAgentSkill = (agentId, skillName, options) => {
|
|
30664
30681
|
const client = useMastraClient();
|
|
30665
30682
|
return useQuery({
|
|
30666
|
-
queryKey: ["agents", agentId, "skills", skillName, options?.workspaceId],
|
|
30683
|
+
queryKey: ["agents", agentId, "skills", skillName, options?.path, options?.workspaceId],
|
|
30667
30684
|
queryFn: async () => {
|
|
30668
30685
|
if (!isWorkspaceV1Supported(client)) {
|
|
30669
30686
|
throw new Error("Workspace v1 not supported by core or client");
|
|
@@ -30672,7 +30689,7 @@ const useAgentSkill = (agentId, skillName, options) => {
|
|
|
30672
30689
|
throw new Error("workspaceId is required");
|
|
30673
30690
|
}
|
|
30674
30691
|
const workspace = client.getWorkspace(options.workspaceId);
|
|
30675
|
-
const skill = workspace.getSkill(skillName);
|
|
30692
|
+
const skill = workspace.getSkill(skillName, options?.path);
|
|
30676
30693
|
return skill.details();
|
|
30677
30694
|
},
|
|
30678
30695
|
enabled: options?.enabled !== false && !!agentId && !!skillName && !!options?.workspaceId && isWorkspaceV1Supported(client),
|
|
@@ -39280,6 +39297,7 @@ function AgentsList({ agents, isLoading, error, search = "" }) {
|
|
|
39280
39297
|
}
|
|
39281
39298
|
)
|
|
39282
39299
|
] }),
|
|
39300
|
+
filteredData.length === 0 && search ? /* @__PURE__ */ jsx(EntityList.NoMatch, { message: "No Agents match your search" }) : null,
|
|
39283
39301
|
filteredData.map((agent) => {
|
|
39284
39302
|
const name = truncateString(agent.name, 50);
|
|
39285
39303
|
const instructions = truncateString(extractPrompt(agent.instructions), 200);
|
|
@@ -39551,6 +39569,7 @@ function ProcessorsList({ processors, isLoading, error, search = "" }) {
|
|
|
39551
39569
|
),
|
|
39552
39570
|
/* @__PURE__ */ jsx(EntityList.TopCellSmart, { short: "Used by", long: "Used by Agents", className: "text-center" })
|
|
39553
39571
|
] }),
|
|
39572
|
+
filteredData.length === 0 && search ? /* @__PURE__ */ jsx(EntityList.NoMatch, { message: "No Processors match your search" }) : null,
|
|
39554
39573
|
filteredData.map((processor) => {
|
|
39555
39574
|
const name = truncateString(processor.name || processor.id, 50);
|
|
39556
39575
|
const description = truncateString(processor.description ?? "", 200);
|
|
@@ -40005,6 +40024,7 @@ function ToolsList({ tools, agents, isLoading, error, search = "" }) {
|
|
|
40005
40024
|
}
|
|
40006
40025
|
)
|
|
40007
40026
|
] }),
|
|
40027
|
+
filteredData.length === 0 && search ? /* @__PURE__ */ jsx(EntityList.NoMatch, { message: "No Tools match your search" }) : null,
|
|
40008
40028
|
filteredData.map((tool) => {
|
|
40009
40029
|
const name = truncateString(tool.id, 50);
|
|
40010
40030
|
const description = truncateString(tool.description ?? "", 200);
|
|
@@ -40827,6 +40847,1173 @@ function TemplateFailure({ errorMsg, validationErrors }) {
|
|
|
40827
40847
|
] });
|
|
40828
40848
|
}
|
|
40829
40849
|
|
|
40850
|
+
const DATE_PRESETS$1 = [
|
|
40851
|
+
{ label: "Last 24 hours", value: "24h" },
|
|
40852
|
+
{ label: "Last 3 days", value: "3d" },
|
|
40853
|
+
{ label: "Last 7 days", value: "7d" },
|
|
40854
|
+
{ label: "Last 14 days", value: "14d" },
|
|
40855
|
+
{ label: "Last 30 days", value: "30d" }
|
|
40856
|
+
];
|
|
40857
|
+
const VALID_PRESETS = new Set(DATE_PRESETS$1.map((p) => p.value));
|
|
40858
|
+
function isValidPreset(value) {
|
|
40859
|
+
return typeof value === "string" && (VALID_PRESETS.has(value) || value === "custom");
|
|
40860
|
+
}
|
|
40861
|
+
const PRESET_DAYS = {
|
|
40862
|
+
"24h": 1,
|
|
40863
|
+
"3d": 3,
|
|
40864
|
+
"7d": 7,
|
|
40865
|
+
"14d": 14,
|
|
40866
|
+
"30d": 30
|
|
40867
|
+
};
|
|
40868
|
+
const ENV_PCTS = {
|
|
40869
|
+
"Studio Cloud": 42,
|
|
40870
|
+
Production: 31,
|
|
40871
|
+
Staging: 18,
|
|
40872
|
+
Dev: 7,
|
|
40873
|
+
"CI / Preview": 2
|
|
40874
|
+
};
|
|
40875
|
+
function getMultiplier(preset, customRange, filterGroups) {
|
|
40876
|
+
let dateMul = 1;
|
|
40877
|
+
if (preset !== "custom") {
|
|
40878
|
+
dateMul = PRESET_DAYS[preset] ?? 1;
|
|
40879
|
+
} else if (customRange?.from && customRange?.to) {
|
|
40880
|
+
dateMul = Math.max(1, differenceInDays(customRange.to, customRange.from) + 1);
|
|
40881
|
+
}
|
|
40882
|
+
const envGroups = filterGroups.filter((g) => g.field === "Environment" && g.comparator === "is");
|
|
40883
|
+
const envPct = envGroups.length === 0 ? 100 : envGroups.flatMap((g) => g.values).reduce((s, v) => s + (ENV_PCTS[v] ?? 0), 0);
|
|
40884
|
+
return dateMul * (envPct / 100);
|
|
40885
|
+
}
|
|
40886
|
+
const MetricsContext = createContext({
|
|
40887
|
+
datePreset: "24h",
|
|
40888
|
+
setDatePreset: () => {
|
|
40889
|
+
},
|
|
40890
|
+
customRange: void 0,
|
|
40891
|
+
setCustomRange: () => {
|
|
40892
|
+
},
|
|
40893
|
+
dateRangeLabel: "Last 24 hours",
|
|
40894
|
+
filterGroups: [],
|
|
40895
|
+
setFilterGroups: () => {
|
|
40896
|
+
},
|
|
40897
|
+
multiplier: 1
|
|
40898
|
+
});
|
|
40899
|
+
function useMetrics() {
|
|
40900
|
+
return useContext(MetricsContext);
|
|
40901
|
+
}
|
|
40902
|
+
function getDateRangeLabel(preset, customRange) {
|
|
40903
|
+
if (preset !== "custom") {
|
|
40904
|
+
return DATE_PRESETS$1.find((p) => p.value === preset).label;
|
|
40905
|
+
}
|
|
40906
|
+
if (customRange?.from) {
|
|
40907
|
+
if (customRange.to) {
|
|
40908
|
+
return `${format(customRange.from, "MMM d, yyyy")} – ${format(customRange.to, "MMM d, yyyy")}`;
|
|
40909
|
+
}
|
|
40910
|
+
return format(customRange.from, "MMM d, yyyy");
|
|
40911
|
+
}
|
|
40912
|
+
return "Custom range";
|
|
40913
|
+
}
|
|
40914
|
+
function MetricsProvider({
|
|
40915
|
+
children,
|
|
40916
|
+
initialPreset,
|
|
40917
|
+
onPresetChange
|
|
40918
|
+
}) {
|
|
40919
|
+
const [datePreset, setDatePresetState] = useState(initialPreset ?? "24h");
|
|
40920
|
+
const [customRange, setCustomRange] = useState(void 0);
|
|
40921
|
+
const [filterGroups, setFilterGroups] = useState([]);
|
|
40922
|
+
const dateRangeLabel = getDateRangeLabel(datePreset, customRange);
|
|
40923
|
+
const multiplier = getMultiplier(datePreset, customRange, filterGroups);
|
|
40924
|
+
useEffect(() => {
|
|
40925
|
+
if (initialPreset && initialPreset !== datePreset) {
|
|
40926
|
+
setDatePresetState(initialPreset);
|
|
40927
|
+
}
|
|
40928
|
+
}, [initialPreset]);
|
|
40929
|
+
const setDatePreset = useCallback(
|
|
40930
|
+
(v) => {
|
|
40931
|
+
setDatePresetState(v);
|
|
40932
|
+
onPresetChange?.(v);
|
|
40933
|
+
},
|
|
40934
|
+
[onPresetChange]
|
|
40935
|
+
);
|
|
40936
|
+
return /* @__PURE__ */ jsx(
|
|
40937
|
+
MetricsContext.Provider,
|
|
40938
|
+
{
|
|
40939
|
+
value: {
|
|
40940
|
+
datePreset,
|
|
40941
|
+
setDatePreset,
|
|
40942
|
+
customRange,
|
|
40943
|
+
setCustomRange,
|
|
40944
|
+
dateRangeLabel,
|
|
40945
|
+
filterGroups,
|
|
40946
|
+
setFilterGroups,
|
|
40947
|
+
multiplier
|
|
40948
|
+
},
|
|
40949
|
+
children
|
|
40950
|
+
}
|
|
40951
|
+
);
|
|
40952
|
+
}
|
|
40953
|
+
|
|
40954
|
+
const PRESET_MS = {
|
|
40955
|
+
"24h": 24 * 60 * 60 * 1e3,
|
|
40956
|
+
"3d": 3 * 24 * 60 * 60 * 1e3,
|
|
40957
|
+
"7d": 7 * 24 * 60 * 60 * 1e3,
|
|
40958
|
+
"14d": 14 * 24 * 60 * 60 * 1e3,
|
|
40959
|
+
"30d": 30 * 24 * 60 * 60 * 1e3
|
|
40960
|
+
};
|
|
40961
|
+
function buildTimestamp(preset, customRange) {
|
|
40962
|
+
const now = /* @__PURE__ */ new Date();
|
|
40963
|
+
if (preset !== "custom") {
|
|
40964
|
+
const ms = PRESET_MS[preset] ?? PRESET_MS["24h"];
|
|
40965
|
+
return { start: new Date(now.getTime() - ms), end: now };
|
|
40966
|
+
}
|
|
40967
|
+
return {
|
|
40968
|
+
start: customRange?.from ?? new Date(now.getTime() - PRESET_MS["24h"]),
|
|
40969
|
+
end: customRange?.to ?? now
|
|
40970
|
+
};
|
|
40971
|
+
}
|
|
40972
|
+
function useMetricsFilters() {
|
|
40973
|
+
const { datePreset, customRange } = useMetrics();
|
|
40974
|
+
const timestamp = buildTimestamp(datePreset, customRange);
|
|
40975
|
+
return { datePreset, customRange, timestamp };
|
|
40976
|
+
}
|
|
40977
|
+
|
|
40978
|
+
async function fetchPercentiles(client, metricName, timestamp) {
|
|
40979
|
+
const res = await client.getMetricPercentiles({
|
|
40980
|
+
name: metricName,
|
|
40981
|
+
percentiles: [0.5, 0.95],
|
|
40982
|
+
interval: "1h",
|
|
40983
|
+
filters: { timestamp }
|
|
40984
|
+
});
|
|
40985
|
+
const p50Series = res.series.find((s) => s.percentile === 0.5);
|
|
40986
|
+
const p95Series = res.series.find((s) => s.percentile === 0.95);
|
|
40987
|
+
if (!p50Series || !p95Series) return [];
|
|
40988
|
+
const p95Map = new Map(p95Series.points.map((p) => [new Date(p.timestamp).getTime(), p.value]));
|
|
40989
|
+
return p50Series.points.map((p) => {
|
|
40990
|
+
const ts = new Date(p.timestamp);
|
|
40991
|
+
return {
|
|
40992
|
+
time: ts.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit", hour12: false }),
|
|
40993
|
+
p50: Math.round(p.value),
|
|
40994
|
+
p95: Math.round(p95Map.get(ts.getTime()) ?? 0)
|
|
40995
|
+
};
|
|
40996
|
+
});
|
|
40997
|
+
}
|
|
40998
|
+
function useLatencyMetrics() {
|
|
40999
|
+
const client = useMastraClient();
|
|
41000
|
+
const { datePreset, customRange, timestamp } = useMetricsFilters();
|
|
41001
|
+
return useQuery({
|
|
41002
|
+
queryKey: ["metrics", "latency", datePreset, customRange],
|
|
41003
|
+
queryFn: async () => {
|
|
41004
|
+
const [agentData, workflowData, toolData] = await Promise.all([
|
|
41005
|
+
fetchPercentiles(client, "mastra_agent_duration_ms", timestamp),
|
|
41006
|
+
fetchPercentiles(client, "mastra_workflow_duration_ms", timestamp),
|
|
41007
|
+
fetchPercentiles(client, "mastra_tool_duration_ms", timestamp)
|
|
41008
|
+
]);
|
|
41009
|
+
return { agentData, workflowData, toolData };
|
|
41010
|
+
}
|
|
41011
|
+
});
|
|
41012
|
+
}
|
|
41013
|
+
|
|
41014
|
+
function formatCompact(n) {
|
|
41015
|
+
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
41016
|
+
if (n >= 1e3) return `${(n / 1e3).toFixed(1)}K`;
|
|
41017
|
+
return n.toLocaleString();
|
|
41018
|
+
}
|
|
41019
|
+
const CHART_COLORS = {
|
|
41020
|
+
green: "#22c55e",
|
|
41021
|
+
orange: "#fb923c",
|
|
41022
|
+
pink: "#f472b6",
|
|
41023
|
+
purple: "#8b5cf6",
|
|
41024
|
+
blue: "#4f83f1",
|
|
41025
|
+
blueDark: "#2b5cd9",
|
|
41026
|
+
blueLight: "#6b8fe5",
|
|
41027
|
+
red: "#f87171",
|
|
41028
|
+
greenDark: "#15613a",
|
|
41029
|
+
redDark: "#991b1b",
|
|
41030
|
+
yellow: "#facc15"
|
|
41031
|
+
};
|
|
41032
|
+
|
|
41033
|
+
function MetricsCardContent({ children, className }) {
|
|
41034
|
+
return /* @__PURE__ */ jsx("div", { className: cn("overflow-x-auto ", className), children });
|
|
41035
|
+
}
|
|
41036
|
+
|
|
41037
|
+
function MetricsCardDescription({ children, className }) {
|
|
41038
|
+
return /* @__PURE__ */ jsx("p", { className: cn("text-ui-md text-neutral2 leading-tight mt-0.5", className), children });
|
|
41039
|
+
}
|
|
41040
|
+
|
|
41041
|
+
function MetricsCardError({
|
|
41042
|
+
message = "Failed to load data",
|
|
41043
|
+
className
|
|
41044
|
+
}) {
|
|
41045
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-3 items-center justify-center", className), children: /* @__PURE__ */ jsx("p", { className: "text-ui-sm text-accent2", children: message }) });
|
|
41046
|
+
}
|
|
41047
|
+
|
|
41048
|
+
function MetricsCardLoading({ className }) {
|
|
41049
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center", className), children: /* @__PURE__ */ jsx(Spinner, { size: "md", color: Colors.neutral1 }) });
|
|
41050
|
+
}
|
|
41051
|
+
|
|
41052
|
+
function MetricsCardNoData({ message = "No data yet", className }) {
|
|
41053
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center h-full", className), children: /* @__PURE__ */ jsx("p", { className: "text-neutral1 text-sm", children: message }) });
|
|
41054
|
+
}
|
|
41055
|
+
|
|
41056
|
+
function DashboardCard({ children, className }) {
|
|
41057
|
+
return /* @__PURE__ */ jsx("div", { className: cn("border border-border1 rounded-lg p-6 bg-surface2", className), children });
|
|
41058
|
+
}
|
|
41059
|
+
|
|
41060
|
+
function MetricsCardRoot({ children, className }) {
|
|
41061
|
+
return /* @__PURE__ */ jsx(
|
|
41062
|
+
DashboardCard,
|
|
41063
|
+
{
|
|
41064
|
+
className: cn(
|
|
41065
|
+
"flex-1 grid grid-rows-[4rem_20rem] gap-2 min-w-[20rem] md:min-w-[22rem] lg:min-w-[24rem] xl:min-w-[26rem] 2xl:min-w-[30rem] 3xl:min-w-[32rem]",
|
|
41066
|
+
className
|
|
41067
|
+
),
|
|
41068
|
+
children
|
|
41069
|
+
}
|
|
41070
|
+
);
|
|
41071
|
+
}
|
|
41072
|
+
|
|
41073
|
+
function MetricsCardSummary({ value, label, className }) {
|
|
41074
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("grid justify-end content-start text-right gap-1", className), children: [
|
|
41075
|
+
/* @__PURE__ */ jsx("span", { className: "text-ui-lg font-semibold text-neutral4 leading-none", children: value }),
|
|
41076
|
+
label && /* @__PURE__ */ jsx("span", { className: "text-ui-md text-neutral2", children: label })
|
|
41077
|
+
] });
|
|
41078
|
+
}
|
|
41079
|
+
|
|
41080
|
+
function MetricsCardTitle({ children, className }) {
|
|
41081
|
+
return /* @__PURE__ */ jsx("h3", { className: cn("text-ui-md font-normal text-neutral4", className), children });
|
|
41082
|
+
}
|
|
41083
|
+
|
|
41084
|
+
function MetricsCardTitleAndDescription(props) {
|
|
41085
|
+
if ("children" in props) {
|
|
41086
|
+
return /* @__PURE__ */ jsx("div", { className: props.className, children: props.children });
|
|
41087
|
+
}
|
|
41088
|
+
const { title, description } = props;
|
|
41089
|
+
return /* @__PURE__ */ jsxs("div", { className: props.className, children: [
|
|
41090
|
+
/* @__PURE__ */ jsx(MetricsCardTitle, { children: title }),
|
|
41091
|
+
description && /* @__PURE__ */ jsx(MetricsCardDescription, { children: description })
|
|
41092
|
+
] });
|
|
41093
|
+
}
|
|
41094
|
+
|
|
41095
|
+
function MetricsCardTopBar({ children, className }) {
|
|
41096
|
+
return /* @__PURE__ */ jsx("div", { className: cn("grid grid-cols-[1fr_auto] gap-4", className), children });
|
|
41097
|
+
}
|
|
41098
|
+
|
|
41099
|
+
function MetricsKpiCardChange({
|
|
41100
|
+
changePct,
|
|
41101
|
+
prevValue,
|
|
41102
|
+
lowerIsBetter,
|
|
41103
|
+
className
|
|
41104
|
+
}) {
|
|
41105
|
+
const isGood = lowerIsBetter ? changePct < 0 : changePct >= 0;
|
|
41106
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1 text-sm text-neutral1 flex-wrap", className), children: [
|
|
41107
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
41108
|
+
/* @__PURE__ */ jsx("span", { className: cn("[&>svg]:w-4 [&>svg]:h-4", isGood ? "text-green-600" : "text-red-600"), children: changePct >= 0 ? /* @__PURE__ */ jsx(TrendingUpIcon, {}) : /* @__PURE__ */ jsx(TrendingDownIcon, {}) }),
|
|
41109
|
+
/* @__PURE__ */ jsx(
|
|
41110
|
+
"span",
|
|
41111
|
+
{
|
|
41112
|
+
className: cn(isGood ? "text-green-600" : "text-red-600"),
|
|
41113
|
+
children: `${changePct >= 0 ? "+" : "-"}${Math.abs(changePct).toFixed(1)}%`
|
|
41114
|
+
}
|
|
41115
|
+
)
|
|
41116
|
+
] }),
|
|
41117
|
+
prevValue && /* @__PURE__ */ jsxs("div", { children: [
|
|
41118
|
+
"vs previous ",
|
|
41119
|
+
/* @__PURE__ */ jsx("b", { className: "text-neutral2 font-semibold", children: prevValue })
|
|
41120
|
+
] })
|
|
41121
|
+
] });
|
|
41122
|
+
}
|
|
41123
|
+
|
|
41124
|
+
function MetricsKpiCardError({
|
|
41125
|
+
message = "Failed to load data",
|
|
41126
|
+
className
|
|
41127
|
+
}) {
|
|
41128
|
+
return /* @__PURE__ */ jsx("span", { className: cn("text-ui-sm text-accent2", className), children: message });
|
|
41129
|
+
}
|
|
41130
|
+
|
|
41131
|
+
function MetricsKpiCardLabel({ children, className }) {
|
|
41132
|
+
return /* @__PURE__ */ jsx("span", { className: cn("text-ui-md text-neutral3 leading-relaxed", className), children });
|
|
41133
|
+
}
|
|
41134
|
+
|
|
41135
|
+
function MetricsKpiCardLoading({ className }) {
|
|
41136
|
+
return /* @__PURE__ */ jsx("span", { className: cn("text-sm", className), children: /* @__PURE__ */ jsx(Spinner, { size: "md", color: Colors.neutral1 }) });
|
|
41137
|
+
}
|
|
41138
|
+
|
|
41139
|
+
function MetricsKpiCardNoChange({
|
|
41140
|
+
message = "No previous value to compare",
|
|
41141
|
+
className
|
|
41142
|
+
}) {
|
|
41143
|
+
return /* @__PURE__ */ jsx("span", { className: cn("text-sm text-neutral1", className), children: message });
|
|
41144
|
+
}
|
|
41145
|
+
|
|
41146
|
+
function MetricsKpiCardNoData({ message = "No data yet", className }) {
|
|
41147
|
+
return /* @__PURE__ */ jsx("span", { className: cn("text-sm text-neutral1", className), children: message });
|
|
41148
|
+
}
|
|
41149
|
+
|
|
41150
|
+
function MetricsKpiCardRoot({ children, className }) {
|
|
41151
|
+
return /* @__PURE__ */ jsx(DashboardCard, { className: cn("flex-1 min-w-[15rem]", className), children: /* @__PURE__ */ jsx("div", { className: "grid gap-1", children }) });
|
|
41152
|
+
}
|
|
41153
|
+
|
|
41154
|
+
function MetricsKpiCardValue({ children, className }) {
|
|
41155
|
+
return /* @__PURE__ */ jsx("strong", { className: cn("text-header-lg text-neutral4 font-semibold", className), children });
|
|
41156
|
+
}
|
|
41157
|
+
|
|
41158
|
+
const MetricsKpiCard = Object.assign(MetricsKpiCardRoot, {
|
|
41159
|
+
Label: MetricsKpiCardLabel,
|
|
41160
|
+
Value: MetricsKpiCardValue,
|
|
41161
|
+
Change: MetricsKpiCardChange,
|
|
41162
|
+
NoChange: MetricsKpiCardNoChange,
|
|
41163
|
+
NoData: MetricsKpiCardNoData,
|
|
41164
|
+
Error: MetricsKpiCardError,
|
|
41165
|
+
Loading: MetricsKpiCardLoading
|
|
41166
|
+
});
|
|
41167
|
+
|
|
41168
|
+
const MetricsCard = Object.assign(MetricsCardRoot, {
|
|
41169
|
+
Root: MetricsCardRoot,
|
|
41170
|
+
Kpi: MetricsKpiCard,
|
|
41171
|
+
TopBar: MetricsCardTopBar,
|
|
41172
|
+
TitleAndDescription: MetricsCardTitleAndDescription,
|
|
41173
|
+
Title: MetricsCardTitle,
|
|
41174
|
+
Description: MetricsCardDescription,
|
|
41175
|
+
Summary: MetricsCardSummary,
|
|
41176
|
+
Loading: MetricsCardLoading,
|
|
41177
|
+
Error: MetricsCardError,
|
|
41178
|
+
Content: MetricsCardContent,
|
|
41179
|
+
NoData: MetricsCardNoData
|
|
41180
|
+
});
|
|
41181
|
+
|
|
41182
|
+
function MetricsLineChartTooltip({
|
|
41183
|
+
active,
|
|
41184
|
+
payload,
|
|
41185
|
+
label,
|
|
41186
|
+
suffix
|
|
41187
|
+
}) {
|
|
41188
|
+
if (!active || !payload?.length) return null;
|
|
41189
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border1 bg-surface2 px-3 py-2 text-xs shadow-lg", children: [
|
|
41190
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1 font-medium text-icon6", children: label }),
|
|
41191
|
+
payload.map((entry) => /* @__PURE__ */ jsxs("p", { className: "text-icon2", children: [
|
|
41192
|
+
/* @__PURE__ */ jsx("span", { className: "mr-2 inline-block size-2 rounded-full", style: { backgroundColor: entry.color } }),
|
|
41193
|
+
entry.name,
|
|
41194
|
+
":",
|
|
41195
|
+
" ",
|
|
41196
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono", children: [
|
|
41197
|
+
entry.value,
|
|
41198
|
+
suffix
|
|
41199
|
+
] })
|
|
41200
|
+
] }, entry.name))
|
|
41201
|
+
] });
|
|
41202
|
+
}
|
|
41203
|
+
|
|
41204
|
+
const LABEL_COLOR = "#a1a1aa";
|
|
41205
|
+
function MetricsLineChart({
|
|
41206
|
+
data,
|
|
41207
|
+
series,
|
|
41208
|
+
height = 210,
|
|
41209
|
+
yDomain
|
|
41210
|
+
}) {
|
|
41211
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
41212
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap w-full items-end gap-4 gap-y-1 mb-4", children: series.map((s) => {
|
|
41213
|
+
const aggregated = s.aggregate?.(data);
|
|
41214
|
+
return /* @__PURE__ */ jsxs("div", { className: "inline-flex items-baseline gap-2", children: [
|
|
41215
|
+
/* @__PURE__ */ jsx("div", { className: "size-2 shrink-0 rounded-full translate-y-[-1px]", style: { backgroundColor: s.color } }),
|
|
41216
|
+
/* @__PURE__ */ jsx("span", { className: "text-ui-sm text-neutral3 truncate max-w-24", children: s.label }),
|
|
41217
|
+
aggregated && /* @__PURE__ */ jsxs("span", { className: "text-ui-lg text-neutral4", children: [
|
|
41218
|
+
aggregated.value,
|
|
41219
|
+
aggregated.suffix && /* @__PURE__ */ jsxs("span", { className: "text-ui-sm text-neutral2", children: [
|
|
41220
|
+
" ",
|
|
41221
|
+
aggregated.suffix
|
|
41222
|
+
] })
|
|
41223
|
+
] })
|
|
41224
|
+
] }, s.dataKey);
|
|
41225
|
+
}) }),
|
|
41226
|
+
/* @__PURE__ */ jsx("div", { style: { height }, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(LineChart, { data, children: [
|
|
41227
|
+
/* @__PURE__ */ jsx(CartesianGrid, { stroke: "rgba(255,255,255,0.08)", vertical: false }),
|
|
41228
|
+
/* @__PURE__ */ jsx(
|
|
41229
|
+
XAxis,
|
|
41230
|
+
{
|
|
41231
|
+
dataKey: "time",
|
|
41232
|
+
tick: { fontSize: 10, fill: LABEL_COLOR, fontFamily: "var(--font-mono)" },
|
|
41233
|
+
tickLine: false,
|
|
41234
|
+
axisLine: false,
|
|
41235
|
+
interval: 5
|
|
41236
|
+
}
|
|
41237
|
+
),
|
|
41238
|
+
/* @__PURE__ */ jsx(
|
|
41239
|
+
YAxis,
|
|
41240
|
+
{
|
|
41241
|
+
tick: { fontSize: 10, fill: LABEL_COLOR, fontFamily: "var(--font-mono)" },
|
|
41242
|
+
tickLine: false,
|
|
41243
|
+
axisLine: false,
|
|
41244
|
+
width: 30,
|
|
41245
|
+
domain: yDomain
|
|
41246
|
+
}
|
|
41247
|
+
),
|
|
41248
|
+
/* @__PURE__ */ jsx(Tooltip$1, { content: /* @__PURE__ */ jsx(MetricsLineChartTooltip, {}) }),
|
|
41249
|
+
series.map((s) => /* @__PURE__ */ jsx(
|
|
41250
|
+
Line,
|
|
41251
|
+
{
|
|
41252
|
+
type: "linear",
|
|
41253
|
+
dataKey: s.dataKey,
|
|
41254
|
+
stroke: s.color,
|
|
41255
|
+
strokeWidth: 2,
|
|
41256
|
+
dot: false,
|
|
41257
|
+
name: s.label
|
|
41258
|
+
},
|
|
41259
|
+
s.dataKey
|
|
41260
|
+
))
|
|
41261
|
+
] }) }) })
|
|
41262
|
+
] });
|
|
41263
|
+
}
|
|
41264
|
+
|
|
41265
|
+
const latencySeries = [
|
|
41266
|
+
{
|
|
41267
|
+
dataKey: "p50",
|
|
41268
|
+
label: "p50",
|
|
41269
|
+
color: CHART_COLORS.blue,
|
|
41270
|
+
aggregate: (data) => ({
|
|
41271
|
+
value: data.length > 0 ? `${Math.round(data.reduce((s, d) => s + d.p50, 0) / data.length)}` : "0",
|
|
41272
|
+
suffix: "avg ms"
|
|
41273
|
+
})
|
|
41274
|
+
},
|
|
41275
|
+
{
|
|
41276
|
+
dataKey: "p95",
|
|
41277
|
+
label: "p95",
|
|
41278
|
+
color: CHART_COLORS.yellow,
|
|
41279
|
+
aggregate: (data) => ({
|
|
41280
|
+
value: data.length > 0 ? `${Math.round(data.reduce((s, d) => s + d.p95, 0) / data.length)}` : "0",
|
|
41281
|
+
suffix: "avg ms"
|
|
41282
|
+
})
|
|
41283
|
+
}
|
|
41284
|
+
];
|
|
41285
|
+
function LatencyChart({ data }) {
|
|
41286
|
+
if (data.length === 0) {
|
|
41287
|
+
return /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No latency data yet" });
|
|
41288
|
+
}
|
|
41289
|
+
return /* @__PURE__ */ jsx(MetricsLineChart, { data, series: latencySeries });
|
|
41290
|
+
}
|
|
41291
|
+
function LatencyCard() {
|
|
41292
|
+
const { data, isLoading, isError } = useLatencyMetrics();
|
|
41293
|
+
const hasData = !!data && (data.agentData.length > 0 || data.workflowData.length > 0 || data.toolData.length > 0);
|
|
41294
|
+
const avgP50 = data && data.agentData.length > 0 ? `${Math.round(data.agentData.reduce((s, d) => s + d.p50, 0) / data.agentData.length)}ms` : "—";
|
|
41295
|
+
return /* @__PURE__ */ jsxs(MetricsCard, { children: [
|
|
41296
|
+
/* @__PURE__ */ jsxs(MetricsCard.TopBar, { children: [
|
|
41297
|
+
/* @__PURE__ */ jsx(MetricsCard.TitleAndDescription, { title: "Latency", description: "Hourly p50 and p95 latency." }),
|
|
41298
|
+
hasData && /* @__PURE__ */ jsx(MetricsCard.Summary, { value: avgP50, label: "Avg p50" })
|
|
41299
|
+
] }),
|
|
41300
|
+
isLoading ? /* @__PURE__ */ jsx(MetricsCard.Loading, {}) : isError ? /* @__PURE__ */ jsx(MetricsCard.Error, { message: "Failed to load latency data" }) : /* @__PURE__ */ jsx(MetricsCard.Content, { children: !hasData ? /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No latency data yet" }) : /* @__PURE__ */ jsxs(Tabs, { defaultTab: "agents", className: "overflow-visible", children: [
|
|
41301
|
+
/* @__PURE__ */ jsxs(TabList, { children: [
|
|
41302
|
+
/* @__PURE__ */ jsx(Tab, { value: "agents", children: "Agents" }),
|
|
41303
|
+
/* @__PURE__ */ jsx(Tab, { value: "workflows", children: "Workflows" }),
|
|
41304
|
+
/* @__PURE__ */ jsx(Tab, { value: "tools", children: "Tools" })
|
|
41305
|
+
] }),
|
|
41306
|
+
/* @__PURE__ */ jsx(TabContent, { value: "agents", children: /* @__PURE__ */ jsx(LatencyChart, { data: data.agentData }) }),
|
|
41307
|
+
/* @__PURE__ */ jsx(TabContent, { value: "workflows", children: /* @__PURE__ */ jsx(LatencyChart, { data: data.workflowData }) }),
|
|
41308
|
+
/* @__PURE__ */ jsx(TabContent, { value: "tools", children: /* @__PURE__ */ jsx(LatencyChart, { data: data.toolData }) })
|
|
41309
|
+
] }) })
|
|
41310
|
+
] });
|
|
41311
|
+
}
|
|
41312
|
+
|
|
41313
|
+
function useAgentRunsKpiMetrics() {
|
|
41314
|
+
const client = useMastraClient();
|
|
41315
|
+
const { datePreset, customRange, timestamp } = useMetricsFilters();
|
|
41316
|
+
return useQuery({
|
|
41317
|
+
queryKey: ["metrics", "agent-runs-kpi", datePreset, customRange],
|
|
41318
|
+
queryFn: () => client.getMetricAggregate({
|
|
41319
|
+
name: ["mastra_agent_duration_ms"],
|
|
41320
|
+
aggregation: "count",
|
|
41321
|
+
filters: { timestamp },
|
|
41322
|
+
comparePeriod: "previous_period"
|
|
41323
|
+
})
|
|
41324
|
+
});
|
|
41325
|
+
}
|
|
41326
|
+
|
|
41327
|
+
function useAvgScoreKpiMetrics() {
|
|
41328
|
+
const client = useMastraClient();
|
|
41329
|
+
const { datePreset, customRange, timestamp } = useMetricsFilters();
|
|
41330
|
+
return useQuery({
|
|
41331
|
+
queryKey: ["metrics", "avg-score-kpi", datePreset, customRange],
|
|
41332
|
+
queryFn: async () => {
|
|
41333
|
+
const scorersMap = await client.listScorers();
|
|
41334
|
+
const scorerIds = Object.keys(scorersMap ?? {});
|
|
41335
|
+
if (scorerIds.length === 0) {
|
|
41336
|
+
return { value: null, previousValue: null, changePercent: null };
|
|
41337
|
+
}
|
|
41338
|
+
const allResults = await Promise.all(
|
|
41339
|
+
scorerIds.map((scorerId) => client.listScoresByScorerId({ scorerId, perPage: 100 }))
|
|
41340
|
+
);
|
|
41341
|
+
const startMs = timestamp.start.getTime();
|
|
41342
|
+
const endMs = timestamp.end.getTime();
|
|
41343
|
+
const allScoreValues = [];
|
|
41344
|
+
for (const result of allResults) {
|
|
41345
|
+
for (const s of result?.scores ?? []) {
|
|
41346
|
+
const ts = new Date(s.createdAt).getTime();
|
|
41347
|
+
if (ts >= startMs && ts <= endMs) {
|
|
41348
|
+
allScoreValues.push(s.score);
|
|
41349
|
+
}
|
|
41350
|
+
}
|
|
41351
|
+
}
|
|
41352
|
+
if (allScoreValues.length === 0) {
|
|
41353
|
+
return { value: null, previousValue: null, changePercent: null };
|
|
41354
|
+
}
|
|
41355
|
+
const avg = allScoreValues.reduce((sum, v) => sum + v, 0) / allScoreValues.length;
|
|
41356
|
+
return { value: Math.round(avg * 100) / 100, previousValue: null, changePercent: null };
|
|
41357
|
+
}
|
|
41358
|
+
});
|
|
41359
|
+
}
|
|
41360
|
+
|
|
41361
|
+
function useTotalTokensKpiMetrics() {
|
|
41362
|
+
const client = useMastraClient();
|
|
41363
|
+
const { datePreset, customRange, timestamp } = useMetricsFilters();
|
|
41364
|
+
return useQuery({
|
|
41365
|
+
queryKey: ["metrics", "total-tokens-kpi", datePreset, customRange],
|
|
41366
|
+
queryFn: async () => {
|
|
41367
|
+
const [input, output] = await Promise.all([
|
|
41368
|
+
client.getMetricAggregate({
|
|
41369
|
+
name: ["mastra_model_total_input_tokens"],
|
|
41370
|
+
aggregation: "sum",
|
|
41371
|
+
filters: { timestamp },
|
|
41372
|
+
comparePeriod: "previous_period"
|
|
41373
|
+
}),
|
|
41374
|
+
client.getMetricAggregate({
|
|
41375
|
+
name: ["mastra_model_total_output_tokens"],
|
|
41376
|
+
aggregation: "sum",
|
|
41377
|
+
filters: { timestamp },
|
|
41378
|
+
comparePeriod: "previous_period"
|
|
41379
|
+
})
|
|
41380
|
+
]);
|
|
41381
|
+
const hasCurrent = input.value != null || output.value != null;
|
|
41382
|
+
const hasPrevious = input.previousValue != null || output.previousValue != null;
|
|
41383
|
+
const value = (input.value ?? 0) + (output.value ?? 0);
|
|
41384
|
+
const previousValue = (input.previousValue ?? 0) + (output.previousValue ?? 0);
|
|
41385
|
+
const changePercent = hasPrevious && previousValue > 0 ? (value - previousValue) / previousValue * 100 : null;
|
|
41386
|
+
return {
|
|
41387
|
+
value: hasCurrent ? value : null,
|
|
41388
|
+
previousValue: hasPrevious ? previousValue : null,
|
|
41389
|
+
changePercent
|
|
41390
|
+
};
|
|
41391
|
+
}
|
|
41392
|
+
});
|
|
41393
|
+
}
|
|
41394
|
+
|
|
41395
|
+
function AgentRunsKpiCard() {
|
|
41396
|
+
const { data: agentRunsKpi, isLoading, isError } = useAgentRunsKpiMetrics();
|
|
41397
|
+
const hasData = agentRunsKpi?.value != null;
|
|
41398
|
+
return /* @__PURE__ */ jsxs(MetricsKpiCard, { children: [
|
|
41399
|
+
/* @__PURE__ */ jsx(MetricsKpiCard.Label, { children: "Total Agent Runs" }),
|
|
41400
|
+
/* @__PURE__ */ jsx(MetricsKpiCard.Value, { className: hasData ? void 0 : "invisible", children: hasData ? agentRunsKpi.value.toLocaleString() : "—" }),
|
|
41401
|
+
isError ? /* @__PURE__ */ jsx(MetricsKpiCard.Error, {}) : isLoading ? /* @__PURE__ */ jsx(MetricsKpiCard.Loading, {}) : hasData ? agentRunsKpi.changePercent != null ? /* @__PURE__ */ jsx(
|
|
41402
|
+
MetricsKpiCard.Change,
|
|
41403
|
+
{
|
|
41404
|
+
changePct: agentRunsKpi.changePercent,
|
|
41405
|
+
prevValue: agentRunsKpi.previousValue?.toLocaleString()
|
|
41406
|
+
}
|
|
41407
|
+
) : /* @__PURE__ */ jsx(MetricsKpiCard.NoChange, {}) : /* @__PURE__ */ jsx(MetricsKpiCard.NoData, {})
|
|
41408
|
+
] });
|
|
41409
|
+
}
|
|
41410
|
+
function TotalTokensKpiCard() {
|
|
41411
|
+
const { data: totalTokensKpi, isLoading, isError } = useTotalTokensKpiMetrics();
|
|
41412
|
+
const hasData = totalTokensKpi?.value != null;
|
|
41413
|
+
return /* @__PURE__ */ jsxs(MetricsKpiCard, { children: [
|
|
41414
|
+
/* @__PURE__ */ jsx(MetricsKpiCard.Label, { children: "Total Tokens" }),
|
|
41415
|
+
/* @__PURE__ */ jsx(MetricsKpiCard.Value, { className: hasData ? void 0 : "invisible", children: hasData ? formatCompact(totalTokensKpi.value) : "—" }),
|
|
41416
|
+
isError ? /* @__PURE__ */ jsx(MetricsKpiCard.Error, {}) : isLoading ? /* @__PURE__ */ jsx(MetricsKpiCard.Loading, {}) : hasData ? totalTokensKpi.changePercent != null ? /* @__PURE__ */ jsx(
|
|
41417
|
+
MetricsKpiCard.Change,
|
|
41418
|
+
{
|
|
41419
|
+
changePct: totalTokensKpi.changePercent,
|
|
41420
|
+
prevValue: totalTokensKpi.previousValue != null ? formatCompact(totalTokensKpi.previousValue) : void 0
|
|
41421
|
+
}
|
|
41422
|
+
) : /* @__PURE__ */ jsx(MetricsKpiCard.NoChange, {}) : /* @__PURE__ */ jsx(MetricsKpiCard.NoData, {})
|
|
41423
|
+
] });
|
|
41424
|
+
}
|
|
41425
|
+
function AvgScoreKpiCard() {
|
|
41426
|
+
const { data: avgScoreKpi, isLoading, isError } = useAvgScoreKpiMetrics();
|
|
41427
|
+
const hasData = avgScoreKpi?.value != null;
|
|
41428
|
+
return /* @__PURE__ */ jsxs(MetricsKpiCard, { children: [
|
|
41429
|
+
/* @__PURE__ */ jsx(MetricsKpiCard.Label, { children: "Avg Score" }),
|
|
41430
|
+
/* @__PURE__ */ jsx(MetricsKpiCard.Value, { className: hasData ? void 0 : "invisible", children: hasData ? String(avgScoreKpi.value) : "—" }),
|
|
41431
|
+
isError ? /* @__PURE__ */ jsx(MetricsKpiCard.Error, {}) : isLoading ? /* @__PURE__ */ jsx(MetricsKpiCard.Loading, {}) : hasData ? avgScoreKpi.changePercent != null ? /* @__PURE__ */ jsx(
|
|
41432
|
+
MetricsKpiCard.Change,
|
|
41433
|
+
{
|
|
41434
|
+
changePct: avgScoreKpi.changePercent,
|
|
41435
|
+
prevValue: avgScoreKpi.previousValue != null ? String(avgScoreKpi.previousValue) : void 0
|
|
41436
|
+
}
|
|
41437
|
+
) : /* @__PURE__ */ jsx(MetricsKpiCard.NoChange, {}) : /* @__PURE__ */ jsx(MetricsKpiCard.NoData, {})
|
|
41438
|
+
] });
|
|
41439
|
+
}
|
|
41440
|
+
|
|
41441
|
+
function useModelUsageCostMetrics() {
|
|
41442
|
+
const client = useMastraClient();
|
|
41443
|
+
const { datePreset, customRange, timestamp } = useMetricsFilters();
|
|
41444
|
+
return useQuery({
|
|
41445
|
+
queryKey: ["metrics", "model-usage-cost", datePreset, customRange],
|
|
41446
|
+
queryFn: async () => {
|
|
41447
|
+
const metrics = [
|
|
41448
|
+
"mastra_model_total_input_tokens",
|
|
41449
|
+
"mastra_model_total_output_tokens",
|
|
41450
|
+
"mastra_model_input_cache_read_tokens",
|
|
41451
|
+
"mastra_model_input_cache_write_tokens"
|
|
41452
|
+
];
|
|
41453
|
+
const [inputRes, outputRes, cacheReadRes, cacheWriteRes] = await Promise.all(
|
|
41454
|
+
metrics.map(
|
|
41455
|
+
(name) => client.getMetricBreakdown({
|
|
41456
|
+
name: [name],
|
|
41457
|
+
groupBy: ["model"],
|
|
41458
|
+
aggregation: "sum",
|
|
41459
|
+
filters: { timestamp }
|
|
41460
|
+
})
|
|
41461
|
+
)
|
|
41462
|
+
);
|
|
41463
|
+
const modelMap = /* @__PURE__ */ new Map();
|
|
41464
|
+
const ensureModel = (model) => {
|
|
41465
|
+
if (!modelMap.has(model)) {
|
|
41466
|
+
modelMap.set(model, { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 });
|
|
41467
|
+
}
|
|
41468
|
+
return modelMap.get(model);
|
|
41469
|
+
};
|
|
41470
|
+
for (const group of inputRes.groups) {
|
|
41471
|
+
const m = group.dimensions.model ?? "unknown";
|
|
41472
|
+
ensureModel(m).input = group.value;
|
|
41473
|
+
}
|
|
41474
|
+
for (const group of outputRes.groups) {
|
|
41475
|
+
const m = group.dimensions.model ?? "unknown";
|
|
41476
|
+
ensureModel(m).output = group.value;
|
|
41477
|
+
}
|
|
41478
|
+
for (const group of cacheReadRes.groups) {
|
|
41479
|
+
const m = group.dimensions.model ?? "unknown";
|
|
41480
|
+
ensureModel(m).cacheRead = group.value;
|
|
41481
|
+
}
|
|
41482
|
+
for (const group of cacheWriteRes.groups) {
|
|
41483
|
+
const m = group.dimensions.model ?? "unknown";
|
|
41484
|
+
ensureModel(m).cacheWrite = group.value;
|
|
41485
|
+
}
|
|
41486
|
+
return Array.from(modelMap.entries()).map(([model, vals]) => ({
|
|
41487
|
+
model,
|
|
41488
|
+
input: formatCompact(vals.input),
|
|
41489
|
+
output: formatCompact(vals.output),
|
|
41490
|
+
cacheRead: formatCompact(vals.cacheRead),
|
|
41491
|
+
cacheWrite: formatCompact(vals.cacheWrite)
|
|
41492
|
+
})).sort((a, b) => a.model.localeCompare(b.model));
|
|
41493
|
+
}
|
|
41494
|
+
});
|
|
41495
|
+
}
|
|
41496
|
+
|
|
41497
|
+
function MetricsDataTable({
|
|
41498
|
+
columns,
|
|
41499
|
+
data,
|
|
41500
|
+
className
|
|
41501
|
+
}) {
|
|
41502
|
+
if (columns.length === 0) return null;
|
|
41503
|
+
return /* @__PURE__ */ jsx(ScrollArea, { className: cn("w-full h-full", className), maxHeight: "20rem", children: /* @__PURE__ */ jsxs(
|
|
41504
|
+
"div",
|
|
41505
|
+
{
|
|
41506
|
+
className: "grid items-center",
|
|
41507
|
+
style: {
|
|
41508
|
+
gridTemplateColumns: `auto ${columns.slice(1).map(() => "1fr").join(" ")}`
|
|
41509
|
+
},
|
|
41510
|
+
children: [
|
|
41511
|
+
columns.map((col, i) => /* @__PURE__ */ jsx(
|
|
41512
|
+
"span",
|
|
41513
|
+
{
|
|
41514
|
+
className: cn(
|
|
41515
|
+
"h-9 py-1 flex items-center border-b border-surface5 uppercase whitespace-nowrap text-neutral2 tracking-widest text-ui-xs sticky top-0 z-10 bg-surface2",
|
|
41516
|
+
i === 0 ? "text-left sticky left-0 z-20 bg-surface2 pr-4 after:absolute after:right-1 after:top-1/2 after:-translate-y-1/2 after:h-3/5 after:w-px after:bg-surface5" : "px-4 text-right"
|
|
41517
|
+
),
|
|
41518
|
+
children: col.label
|
|
41519
|
+
},
|
|
41520
|
+
`${i}-${col.label}`
|
|
41521
|
+
)),
|
|
41522
|
+
data.map((row, rowIndex) => /* @__PURE__ */ jsx(Fragment$1, { children: columns.map((col, i) => /* @__PURE__ */ jsx(
|
|
41523
|
+
"span",
|
|
41524
|
+
{
|
|
41525
|
+
className: cn(
|
|
41526
|
+
"h-10 flex items-center text-ui-sm whitespace-nowrap border-t border-surface5",
|
|
41527
|
+
rowIndex === 0 && "border-t-transparent",
|
|
41528
|
+
i === 0 ? "text-left text-neutral3 sticky left-0 z-10 bg-surface2 pr-4 after:absolute after:right-1 after:top-1/2 after:-translate-y-1/2 after:h-3/5 after:w-px after:bg-surface5" : cn(
|
|
41529
|
+
"px-4 text-right tabular-nums",
|
|
41530
|
+
col.highlight ? "text-neutral4 font-semibold" : "text-neutral3"
|
|
41531
|
+
)
|
|
41532
|
+
),
|
|
41533
|
+
children: col.value(row)
|
|
41534
|
+
},
|
|
41535
|
+
`${row.key}-${i}`
|
|
41536
|
+
)) }, row.key))
|
|
41537
|
+
]
|
|
41538
|
+
}
|
|
41539
|
+
) });
|
|
41540
|
+
}
|
|
41541
|
+
|
|
41542
|
+
function ModelUsageCostCard() {
|
|
41543
|
+
const { data: rows, isLoading, isError } = useModelUsageCostMetrics();
|
|
41544
|
+
const hasData = !!rows && rows.length > 0;
|
|
41545
|
+
return /* @__PURE__ */ jsxs(MetricsCard, { children: [
|
|
41546
|
+
/* @__PURE__ */ jsx(MetricsCard.TopBar, { children: /* @__PURE__ */ jsx(MetricsCard.TitleAndDescription, { title: "Model Usage", description: "Token consumption by model." }) }),
|
|
41547
|
+
isLoading ? /* @__PURE__ */ jsx(MetricsCard.Loading, {}) : isError ? /* @__PURE__ */ jsx(MetricsCard.Error, { message: "Failed to load model usage data" }) : /* @__PURE__ */ jsx(MetricsCard.Content, { children: !hasData ? /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No model usage data yet" }) : /* @__PURE__ */ jsx(
|
|
41548
|
+
MetricsDataTable,
|
|
41549
|
+
{
|
|
41550
|
+
columns: [
|
|
41551
|
+
{ label: "Model", value: (row) => row.model },
|
|
41552
|
+
{ label: "Input", value: (row) => row.input },
|
|
41553
|
+
{ label: "Output", value: (row) => row.output },
|
|
41554
|
+
{ label: "Cache Read", value: (row) => row.cacheRead },
|
|
41555
|
+
{ label: "Cache Write", value: (row) => row.cacheWrite }
|
|
41556
|
+
// { label: 'Cost', value: () => '—', highlight: true },
|
|
41557
|
+
],
|
|
41558
|
+
data: rows.map((row) => ({ ...row, key: row.model }))
|
|
41559
|
+
}
|
|
41560
|
+
) })
|
|
41561
|
+
] });
|
|
41562
|
+
}
|
|
41563
|
+
|
|
41564
|
+
function useScoresMetrics() {
|
|
41565
|
+
const client = useMastraClient();
|
|
41566
|
+
const { datePreset, customRange, timestamp } = useMetricsFilters();
|
|
41567
|
+
return useQuery({
|
|
41568
|
+
queryKey: ["metrics", "scores-card", datePreset, customRange],
|
|
41569
|
+
queryFn: async () => {
|
|
41570
|
+
const scorersMap = await client.listScorers();
|
|
41571
|
+
const scorerIds = Object.keys(scorersMap ?? {});
|
|
41572
|
+
if (scorerIds.length === 0) {
|
|
41573
|
+
return { summaryData: [], overTimeData: [], scorerNames: [], avgScore: null };
|
|
41574
|
+
}
|
|
41575
|
+
const allResults = await Promise.all(
|
|
41576
|
+
// Limited to 100 most recent scores per scorer; pagination not yet implemented
|
|
41577
|
+
scorerIds.map((scorerId) => client.listScoresByScorerId({ scorerId, perPage: 100 }))
|
|
41578
|
+
);
|
|
41579
|
+
const startMs = timestamp.start.getTime();
|
|
41580
|
+
const endMs = timestamp.end.getTime();
|
|
41581
|
+
const allScores = [];
|
|
41582
|
+
for (let i = 0; i < scorerIds.length; i++) {
|
|
41583
|
+
const scores = allResults[i]?.scores ?? [];
|
|
41584
|
+
for (const s of scores) {
|
|
41585
|
+
const ts = new Date(s.createdAt).getTime();
|
|
41586
|
+
if (ts >= startMs && ts <= endMs) {
|
|
41587
|
+
allScores.push({
|
|
41588
|
+
scorerId: scorerIds[i],
|
|
41589
|
+
score: s.score,
|
|
41590
|
+
createdAt: s.createdAt
|
|
41591
|
+
});
|
|
41592
|
+
}
|
|
41593
|
+
}
|
|
41594
|
+
}
|
|
41595
|
+
if (allScores.length === 0) {
|
|
41596
|
+
return { summaryData: [], overTimeData: [], scorerNames: [], avgScore: null };
|
|
41597
|
+
}
|
|
41598
|
+
const byScorer = /* @__PURE__ */ new Map();
|
|
41599
|
+
for (const s of allScores) {
|
|
41600
|
+
if (!byScorer.has(s.scorerId)) byScorer.set(s.scorerId, []);
|
|
41601
|
+
byScorer.get(s.scorerId).push(s.score);
|
|
41602
|
+
}
|
|
41603
|
+
const summaryData = Array.from(byScorer.entries()).map(([scorer, vals]) => ({
|
|
41604
|
+
scorer,
|
|
41605
|
+
avg: vals.reduce((a, b) => a + b, 0) / vals.length,
|
|
41606
|
+
min: Math.min(...vals),
|
|
41607
|
+
max: Math.max(...vals),
|
|
41608
|
+
count: vals.length
|
|
41609
|
+
}));
|
|
41610
|
+
const scorerNames = summaryData.map((s) => s.scorer);
|
|
41611
|
+
const avgScore = summaryData.reduce((s, d) => s + d.avg, 0) / summaryData.length;
|
|
41612
|
+
const bucketMap = /* @__PURE__ */ new Map();
|
|
41613
|
+
for (const s of allScores) {
|
|
41614
|
+
const ts = new Date(s.createdAt);
|
|
41615
|
+
const bucket = Math.floor(ts.getTime() / 36e5) * 36e5;
|
|
41616
|
+
if (!bucketMap.has(bucket)) bucketMap.set(bucket, /* @__PURE__ */ new Map());
|
|
41617
|
+
const scorerMap = bucketMap.get(bucket);
|
|
41618
|
+
if (!scorerMap.has(s.scorerId)) scorerMap.set(s.scorerId, []);
|
|
41619
|
+
scorerMap.get(s.scorerId).push(s.score);
|
|
41620
|
+
}
|
|
41621
|
+
const overTimeData = Array.from(bucketMap.entries()).sort(([a], [b]) => a - b).map(([bucket, scorerMap]) => {
|
|
41622
|
+
const point = {
|
|
41623
|
+
time: new Date(bucket).toLocaleTimeString("en-US", {
|
|
41624
|
+
hour: "2-digit",
|
|
41625
|
+
minute: "2-digit",
|
|
41626
|
+
hour12: false
|
|
41627
|
+
})
|
|
41628
|
+
};
|
|
41629
|
+
for (const name of scorerNames) {
|
|
41630
|
+
const vals = scorerMap.get(name);
|
|
41631
|
+
if (vals && vals.length > 0) {
|
|
41632
|
+
point[name] = +(vals.reduce((a, b) => a + b, 0) / vals.length).toFixed(2);
|
|
41633
|
+
}
|
|
41634
|
+
}
|
|
41635
|
+
return point;
|
|
41636
|
+
});
|
|
41637
|
+
return {
|
|
41638
|
+
summaryData,
|
|
41639
|
+
overTimeData,
|
|
41640
|
+
scorerNames,
|
|
41641
|
+
avgScore: Math.round(avgScore * 100) / 100
|
|
41642
|
+
};
|
|
41643
|
+
}
|
|
41644
|
+
});
|
|
41645
|
+
}
|
|
41646
|
+
|
|
41647
|
+
const SERIES_COLORS = [
|
|
41648
|
+
CHART_COLORS.green,
|
|
41649
|
+
CHART_COLORS.blue,
|
|
41650
|
+
CHART_COLORS.purple,
|
|
41651
|
+
CHART_COLORS.orange,
|
|
41652
|
+
CHART_COLORS.pink,
|
|
41653
|
+
CHART_COLORS.yellow
|
|
41654
|
+
];
|
|
41655
|
+
function ScoresCard() {
|
|
41656
|
+
const { data, isLoading, isError } = useScoresMetrics();
|
|
41657
|
+
const hasData = !!data && data.summaryData.length > 0;
|
|
41658
|
+
const series = useMemo(() => {
|
|
41659
|
+
if (!data?.scorerNames) return [];
|
|
41660
|
+
return data.scorerNames.map((name, i) => ({
|
|
41661
|
+
dataKey: name,
|
|
41662
|
+
label: name,
|
|
41663
|
+
color: SERIES_COLORS[i % SERIES_COLORS.length],
|
|
41664
|
+
aggregate: (points) => ({
|
|
41665
|
+
value: points.length > 0 ? (points.reduce((s, d) => s + (d[name] ?? 0), 0) / points.length).toFixed(2) : "0",
|
|
41666
|
+
suffix: "avg"
|
|
41667
|
+
})
|
|
41668
|
+
}));
|
|
41669
|
+
}, [data?.scorerNames]);
|
|
41670
|
+
return /* @__PURE__ */ jsxs(MetricsCard, { children: [
|
|
41671
|
+
/* @__PURE__ */ jsxs(MetricsCard.TopBar, { children: [
|
|
41672
|
+
/* @__PURE__ */ jsx(MetricsCard.TitleAndDescription, { title: "Scores", description: "Evaluation scorer performance." }),
|
|
41673
|
+
hasData && /* @__PURE__ */ jsx(
|
|
41674
|
+
MetricsCard.Summary,
|
|
41675
|
+
{
|
|
41676
|
+
value: data?.avgScore != null ? `avg ${data.avgScore}` : "—",
|
|
41677
|
+
label: "Across all scorers"
|
|
41678
|
+
}
|
|
41679
|
+
)
|
|
41680
|
+
] }),
|
|
41681
|
+
isLoading ? /* @__PURE__ */ jsx(MetricsCard.Loading, {}) : isError ? /* @__PURE__ */ jsx(MetricsCard.Error, { message: "Failed to load scores data" }) : /* @__PURE__ */ jsx(MetricsCard.Content, { children: !hasData ? /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No scores data yet" }) : /* @__PURE__ */ jsxs(Tabs, { defaultTab: "over-time", className: "overflow-visible", children: [
|
|
41682
|
+
/* @__PURE__ */ jsxs(TabList, { children: [
|
|
41683
|
+
/* @__PURE__ */ jsx(Tab, { value: "over-time", children: "Over Time" }),
|
|
41684
|
+
/* @__PURE__ */ jsx(Tab, { value: "summary", children: "Summary" })
|
|
41685
|
+
] }),
|
|
41686
|
+
/* @__PURE__ */ jsx(TabContent, { value: "over-time", children: data.overTimeData.length > 0 ? /* @__PURE__ */ jsx(MetricsLineChart, { data: data.overTimeData, series, yDomain: [0, 1] }) : /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No time series data yet" }) }),
|
|
41687
|
+
/* @__PURE__ */ jsx(TabContent, { value: "summary", children: /* @__PURE__ */ jsx(
|
|
41688
|
+
MetricsDataTable,
|
|
41689
|
+
{
|
|
41690
|
+
columns: [
|
|
41691
|
+
{ label: "Scorer", value: (row) => row.scorer },
|
|
41692
|
+
{ label: "Avg", value: (row) => row.avg.toFixed(2), highlight: true },
|
|
41693
|
+
{ label: "Min", value: (row) => row.min.toFixed(2) },
|
|
41694
|
+
{ label: "Max", value: (row) => row.max.toFixed(2) },
|
|
41695
|
+
{ label: "Count", value: (row) => row.count.toLocaleString() }
|
|
41696
|
+
],
|
|
41697
|
+
data: data.summaryData.map((row) => ({ ...row, key: row.scorer }))
|
|
41698
|
+
}
|
|
41699
|
+
) })
|
|
41700
|
+
] }) })
|
|
41701
|
+
] });
|
|
41702
|
+
}
|
|
41703
|
+
|
|
41704
|
+
function useTokenUsageByAgentMetrics() {
|
|
41705
|
+
const client = useMastraClient();
|
|
41706
|
+
const { datePreset, customRange, timestamp } = useMetricsFilters();
|
|
41707
|
+
return useQuery({
|
|
41708
|
+
queryKey: ["metrics", "token-usage-by-agent", datePreset, customRange],
|
|
41709
|
+
queryFn: async () => {
|
|
41710
|
+
const [inputRes, outputRes] = await Promise.all([
|
|
41711
|
+
client.getMetricBreakdown({
|
|
41712
|
+
name: ["mastra_model_total_input_tokens"],
|
|
41713
|
+
groupBy: ["entityName"],
|
|
41714
|
+
aggregation: "sum",
|
|
41715
|
+
filters: { timestamp }
|
|
41716
|
+
}),
|
|
41717
|
+
client.getMetricBreakdown({
|
|
41718
|
+
name: ["mastra_model_total_output_tokens"],
|
|
41719
|
+
groupBy: ["entityName"],
|
|
41720
|
+
aggregation: "sum",
|
|
41721
|
+
filters: { timestamp }
|
|
41722
|
+
})
|
|
41723
|
+
]);
|
|
41724
|
+
const agentMap = /* @__PURE__ */ new Map();
|
|
41725
|
+
const ensure = (name) => {
|
|
41726
|
+
if (!agentMap.has(name)) {
|
|
41727
|
+
agentMap.set(name, { input: 0, output: 0 });
|
|
41728
|
+
}
|
|
41729
|
+
return agentMap.get(name);
|
|
41730
|
+
};
|
|
41731
|
+
for (const group of inputRes.groups) {
|
|
41732
|
+
const name = group.dimensions.entityName ?? "unknown";
|
|
41733
|
+
ensure(name).input = group.value;
|
|
41734
|
+
}
|
|
41735
|
+
for (const group of outputRes.groups) {
|
|
41736
|
+
const name = group.dimensions.entityName ?? "unknown";
|
|
41737
|
+
ensure(name).output = group.value;
|
|
41738
|
+
}
|
|
41739
|
+
return Array.from(agentMap.entries()).map(([name, vals]) => ({
|
|
41740
|
+
name,
|
|
41741
|
+
input: vals.input,
|
|
41742
|
+
output: vals.output,
|
|
41743
|
+
total: vals.input + vals.output
|
|
41744
|
+
})).sort((a, b) => b.total - a.total);
|
|
41745
|
+
}
|
|
41746
|
+
});
|
|
41747
|
+
}
|
|
41748
|
+
|
|
41749
|
+
function HorizontalBars({
|
|
41750
|
+
data,
|
|
41751
|
+
segments,
|
|
41752
|
+
maxVal,
|
|
41753
|
+
fmt,
|
|
41754
|
+
className
|
|
41755
|
+
}) {
|
|
41756
|
+
const sorted = [...data].sort((a, b) => {
|
|
41757
|
+
const totalB = b.values.reduce((s, v) => s + v, 0);
|
|
41758
|
+
const totalA = a.values.reduce((s, v) => s + v, 0);
|
|
41759
|
+
return totalB - totalA;
|
|
41760
|
+
});
|
|
41761
|
+
const isStacked = segments.length > 1;
|
|
41762
|
+
return /* @__PURE__ */ jsxs(ScrollArea, { className: cn("w-full h-full", className), children: [
|
|
41763
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-4 mt-2", children: [
|
|
41764
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center gap-4", children: segments.map((seg) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
41765
|
+
/* @__PURE__ */ jsx("div", { className: "size-2 rounded-full", style: { backgroundColor: seg.color } }),
|
|
41766
|
+
/* @__PURE__ */ jsx("span", { className: "text-ui-sm text-neutral3", children: seg.label })
|
|
41767
|
+
] }, seg.label)) }),
|
|
41768
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-ui-sm text-neutral2 pr-2", children: "Total" })
|
|
41769
|
+
] }),
|
|
41770
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-3.5", children: sorted.map((d) => {
|
|
41771
|
+
const total = d.values.reduce((s, v) => s + v, 0);
|
|
41772
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-14 h-6 ", children: [
|
|
41773
|
+
/* @__PURE__ */ jsxs("div", { className: "relative h-full flex-1 min-w-0", children: [
|
|
41774
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
41775
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
41776
|
+
"div",
|
|
41777
|
+
{
|
|
41778
|
+
className: "absolute inset-y-0 left-0 cursor-default",
|
|
41779
|
+
style: { width: `${maxVal > 0 ? total / maxVal * 100 : 0}%` },
|
|
41780
|
+
children: segments.map((seg, si) => {
|
|
41781
|
+
const val = d.values[si] ?? 0;
|
|
41782
|
+
const pct = total > 0 ? val / total * 100 : 0;
|
|
41783
|
+
const left = d.values.slice(0, si).reduce((s, v) => s + (total > 0 ? v / total * 100 : 0), 0);
|
|
41784
|
+
const isLastWithValue = d.values.slice(si + 1).every((v) => !v);
|
|
41785
|
+
if (isStacked) {
|
|
41786
|
+
return /* @__PURE__ */ jsx(
|
|
41787
|
+
"div",
|
|
41788
|
+
{
|
|
41789
|
+
className: cn(
|
|
41790
|
+
"absolute inset-y-0",
|
|
41791
|
+
si === 0 && "rounded-l",
|
|
41792
|
+
isLastWithValue && "rounded-r"
|
|
41793
|
+
),
|
|
41794
|
+
style: {
|
|
41795
|
+
left: `${left}%`,
|
|
41796
|
+
width: `${pct}%`,
|
|
41797
|
+
backgroundColor: seg.color
|
|
41798
|
+
}
|
|
41799
|
+
},
|
|
41800
|
+
seg.label
|
|
41801
|
+
);
|
|
41802
|
+
}
|
|
41803
|
+
return /* @__PURE__ */ jsx(
|
|
41804
|
+
"div",
|
|
41805
|
+
{
|
|
41806
|
+
className: "absolute inset-y-0 left-0 rounded",
|
|
41807
|
+
style: { width: `${pct}%`, backgroundColor: seg.color }
|
|
41808
|
+
},
|
|
41809
|
+
seg.label
|
|
41810
|
+
);
|
|
41811
|
+
})
|
|
41812
|
+
}
|
|
41813
|
+
) }),
|
|
41814
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "top", className: "font-mono", children: /* @__PURE__ */ jsx("div", { className: "grid gap-1", children: segments.map((seg, si) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
41815
|
+
/* @__PURE__ */ jsx("span", { children: seg.label }),
|
|
41816
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto pl-3", children: fmt(d.values[si] ?? 0) })
|
|
41817
|
+
] }, seg.label)) }) })
|
|
41818
|
+
] }),
|
|
41819
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 left-2.5 flex items-center text-ui-sm text-neutral4 truncate z-10 pointer-events-none", children: d.name })
|
|
41820
|
+
] }),
|
|
41821
|
+
/* @__PURE__ */ jsx("span", { className: "text-ui-md text-neutral4 tabular-nums shrink-0 pr-3", children: fmt(total) })
|
|
41822
|
+
] }, d.name);
|
|
41823
|
+
}) })
|
|
41824
|
+
] });
|
|
41825
|
+
}
|
|
41826
|
+
|
|
41827
|
+
function TokenUsageByAgentCard() {
|
|
41828
|
+
const { data, isLoading, isError } = useTokenUsageByAgentMetrics();
|
|
41829
|
+
const hasData = !!data && data.length > 0;
|
|
41830
|
+
const totalTokens = data?.reduce((s, d) => s + d.total, 0) ?? 0;
|
|
41831
|
+
return /* @__PURE__ */ jsxs(MetricsCard, { children: [
|
|
41832
|
+
/* @__PURE__ */ jsxs(MetricsCard.TopBar, { children: [
|
|
41833
|
+
/* @__PURE__ */ jsx(
|
|
41834
|
+
MetricsCard.TitleAndDescription,
|
|
41835
|
+
{
|
|
41836
|
+
title: "Token Usage by Agent",
|
|
41837
|
+
description: "Token consumption grouped by agent."
|
|
41838
|
+
}
|
|
41839
|
+
),
|
|
41840
|
+
hasData && /* @__PURE__ */ jsx(MetricsCard.Summary, { value: formatCompact(totalTokens), label: "Total tokens" })
|
|
41841
|
+
] }),
|
|
41842
|
+
isLoading ? /* @__PURE__ */ jsx(MetricsCard.Loading, {}) : isError ? /* @__PURE__ */ jsx(MetricsCard.Error, { message: "Failed to load token usage data" }) : /* @__PURE__ */ jsx(MetricsCard.Content, { children: !hasData ? /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No token usage data yet" }) : /* @__PURE__ */ jsxs(Tabs, { defaultTab: "tokens", className: "grid grid-rows-[auto_1fr] overflow-y-auto h-full", children: [
|
|
41843
|
+
/* @__PURE__ */ jsx(TabList, { children: /* @__PURE__ */ jsx(Tab, { value: "tokens", children: "Tokens" }) }),
|
|
41844
|
+
/* @__PURE__ */ jsx(TabContent, { value: "tokens", children: /* @__PURE__ */ jsx(
|
|
41845
|
+
HorizontalBars,
|
|
41846
|
+
{
|
|
41847
|
+
data: data.map((d) => ({ name: d.name, values: [d.input, d.output] })),
|
|
41848
|
+
segments: [
|
|
41849
|
+
{ label: "Input", color: CHART_COLORS.blueDark },
|
|
41850
|
+
{ label: "Output", color: CHART_COLORS.blue }
|
|
41851
|
+
],
|
|
41852
|
+
maxVal: Math.max(...data.map((d) => d.input + d.output)),
|
|
41853
|
+
fmt: formatCompact
|
|
41854
|
+
}
|
|
41855
|
+
) })
|
|
41856
|
+
] }) })
|
|
41857
|
+
] });
|
|
41858
|
+
}
|
|
41859
|
+
|
|
41860
|
+
async function fetchVolume(client, metricName, timestamp) {
|
|
41861
|
+
const res = await client.getMetricBreakdown({
|
|
41862
|
+
name: [metricName],
|
|
41863
|
+
groupBy: ["entityName", "status"],
|
|
41864
|
+
aggregation: "count",
|
|
41865
|
+
filters: { timestamp }
|
|
41866
|
+
});
|
|
41867
|
+
const map = /* @__PURE__ */ new Map();
|
|
41868
|
+
for (const group of res.groups) {
|
|
41869
|
+
const name = group.dimensions.entityName ?? "unknown";
|
|
41870
|
+
const status = group.dimensions.status ?? "ok";
|
|
41871
|
+
if (!map.has(name)) {
|
|
41872
|
+
map.set(name, { completed: 0, errors: 0 });
|
|
41873
|
+
}
|
|
41874
|
+
const entry = map.get(name);
|
|
41875
|
+
if (status === "error") {
|
|
41876
|
+
entry.errors += group.value;
|
|
41877
|
+
} else {
|
|
41878
|
+
entry.completed += group.value;
|
|
41879
|
+
}
|
|
41880
|
+
}
|
|
41881
|
+
return Array.from(map.entries()).map(([name, vals]) => ({ name, ...vals })).sort((a, b) => b.completed + b.errors - (a.completed + a.errors));
|
|
41882
|
+
}
|
|
41883
|
+
function useTraceVolumeMetrics() {
|
|
41884
|
+
const client = useMastraClient();
|
|
41885
|
+
const { datePreset, customRange, timestamp } = useMetricsFilters();
|
|
41886
|
+
return useQuery({
|
|
41887
|
+
queryKey: ["metrics", "trace-volume", datePreset, customRange],
|
|
41888
|
+
queryFn: async () => {
|
|
41889
|
+
const [agentData, workflowData, toolData] = await Promise.all([
|
|
41890
|
+
fetchVolume(client, "mastra_agent_duration_ms", timestamp),
|
|
41891
|
+
fetchVolume(client, "mastra_workflow_duration_ms", timestamp),
|
|
41892
|
+
fetchVolume(client, "mastra_tool_duration_ms", timestamp)
|
|
41893
|
+
]);
|
|
41894
|
+
return { agentData, workflowData, toolData };
|
|
41895
|
+
}
|
|
41896
|
+
});
|
|
41897
|
+
}
|
|
41898
|
+
|
|
41899
|
+
function VolumeBars({ data }) {
|
|
41900
|
+
return /* @__PURE__ */ jsx(
|
|
41901
|
+
HorizontalBars,
|
|
41902
|
+
{
|
|
41903
|
+
data: data.map((d) => ({ name: d.name, values: [d.completed, d.errors] })),
|
|
41904
|
+
segments: [
|
|
41905
|
+
{ label: "Completed", color: CHART_COLORS.blueDark },
|
|
41906
|
+
{ label: "Errors", color: CHART_COLORS.pink }
|
|
41907
|
+
],
|
|
41908
|
+
maxVal: Math.max(...data.map((d) => d.completed + d.errors)),
|
|
41909
|
+
fmt: formatCompact
|
|
41910
|
+
}
|
|
41911
|
+
);
|
|
41912
|
+
}
|
|
41913
|
+
function TracesVolumeCard() {
|
|
41914
|
+
const { data, isLoading, isError } = useTraceVolumeMetrics();
|
|
41915
|
+
const hasData = !!data && (data.agentData.length > 0 || data.workflowData.length > 0 || data.toolData.length > 0);
|
|
41916
|
+
const total = data ? [...data.agentData, ...data.workflowData, ...data.toolData].reduce((s, d) => s + d.completed + d.errors, 0) : 0;
|
|
41917
|
+
return /* @__PURE__ */ jsxs(MetricsCard, { children: [
|
|
41918
|
+
/* @__PURE__ */ jsxs(MetricsCard.TopBar, { children: [
|
|
41919
|
+
/* @__PURE__ */ jsx(MetricsCard.TitleAndDescription, { title: "Trace Volume", description: "Runs and call counts." }),
|
|
41920
|
+
hasData && /* @__PURE__ */ jsx(MetricsCard.Summary, { value: formatCompact(total), label: "Total runs" })
|
|
41921
|
+
] }),
|
|
41922
|
+
isLoading ? /* @__PURE__ */ jsx(MetricsCard.Loading, {}) : isError ? /* @__PURE__ */ jsx(MetricsCard.Error, { message: "Failed to load trace volume data" }) : /* @__PURE__ */ jsx(MetricsCard.Content, { children: !hasData ? /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No trace volume data yet" }) : /* @__PURE__ */ jsxs(Tabs, { defaultTab: "agents", className: "grid grid-rows-[auto_1fr] overflow-y-auto h-full", children: [
|
|
41923
|
+
/* @__PURE__ */ jsxs(TabList, { children: [
|
|
41924
|
+
/* @__PURE__ */ jsx(Tab, { value: "agents", children: "Agents" }),
|
|
41925
|
+
/* @__PURE__ */ jsx(Tab, { value: "workflows", children: "Workflows" }),
|
|
41926
|
+
/* @__PURE__ */ jsx(Tab, { value: "tools", children: "Tools" })
|
|
41927
|
+
] }),
|
|
41928
|
+
/* @__PURE__ */ jsx(TabContent, { value: "agents", children: data.agentData.length > 0 ? /* @__PURE__ */ jsx(VolumeBars, { data: data.agentData }) : /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No agent data yet" }) }),
|
|
41929
|
+
/* @__PURE__ */ jsx(TabContent, { value: "workflows", children: data.workflowData.length > 0 ? /* @__PURE__ */ jsx(VolumeBars, { data: data.workflowData }) : /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No workflow data yet" }) }),
|
|
41930
|
+
/* @__PURE__ */ jsx(TabContent, { value: "tools", children: data.toolData.length > 0 ? /* @__PURE__ */ jsx(VolumeBars, { data: data.toolData }) : /* @__PURE__ */ jsx(MetricsCard.NoData, { message: "No tool data yet" }) })
|
|
41931
|
+
] }) })
|
|
41932
|
+
] });
|
|
41933
|
+
}
|
|
41934
|
+
|
|
41935
|
+
function MetricsFlexGrid({ children, className }) {
|
|
41936
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-wrap gap-8", className), children });
|
|
41937
|
+
}
|
|
41938
|
+
|
|
41939
|
+
const ANALYTICS_OBSERVABILITY_TYPES = /* @__PURE__ */ new Set([
|
|
41940
|
+
// 'ObservabilityStorageClickhouse',
|
|
41941
|
+
// 'ObservabilityStorageDuckDB',
|
|
41942
|
+
"ObservabilityInMemory"
|
|
41943
|
+
]);
|
|
41944
|
+
function MetricsDashboard() {
|
|
41945
|
+
const { data, isLoading } = useMastraPackages();
|
|
41946
|
+
const observabilityType = data?.observabilityStorageType;
|
|
41947
|
+
const supportsMetrics = observabilityType ? ANALYTICS_OBSERVABILITY_TYPES.has(observabilityType) : false;
|
|
41948
|
+
const isInMemory = observabilityType === "ObservabilityInMemory";
|
|
41949
|
+
if (isLoading) {
|
|
41950
|
+
return null;
|
|
41951
|
+
}
|
|
41952
|
+
if (!supportsMetrics) {
|
|
41953
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
41954
|
+
EmptyState$1,
|
|
41955
|
+
{
|
|
41956
|
+
iconSlot: /* @__PURE__ */ jsx(CircleSlashIcon, {}),
|
|
41957
|
+
titleSlot: "Metrics are not available with your current storage",
|
|
41958
|
+
descriptionSlot: "Metrics currently require in-memory storage for observability. ClickHouse and DuckDB support is coming soon. Relational databases (PostgreSQL, LibSQL) do not support metrics collection. To enable metrics on an existing project, switch the observability storage in the Mastra configuration.",
|
|
41959
|
+
actionSlot: /* @__PURE__ */ jsxs(
|
|
41960
|
+
Button,
|
|
41961
|
+
{
|
|
41962
|
+
variant: "ghost",
|
|
41963
|
+
as: "a",
|
|
41964
|
+
href: "https://mastra.ai/en/docs/observability/metrics",
|
|
41965
|
+
target: "_blank",
|
|
41966
|
+
rel: "noopener noreferrer",
|
|
41967
|
+
children: [
|
|
41968
|
+
"Metrics Documentation ",
|
|
41969
|
+
/* @__PURE__ */ jsx(ExternalLinkIcon, {})
|
|
41970
|
+
]
|
|
41971
|
+
}
|
|
41972
|
+
)
|
|
41973
|
+
}
|
|
41974
|
+
) });
|
|
41975
|
+
}
|
|
41976
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid gap-8 content-start pb-10", children: [
|
|
41977
|
+
isInMemory && /* @__PURE__ */ jsxs(Alert, { variant: "info", children: [
|
|
41978
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Metrics are not persisted" }),
|
|
41979
|
+
/* @__PURE__ */ jsx(AlertDescription, { as: "p", children: "This project uses in-memory storage for observability. Metrics will be lost on every server restart. For persistent metrics, switch the observability storage to ClickHouse or DuckDB." })
|
|
41980
|
+
] }),
|
|
41981
|
+
/* @__PURE__ */ jsxs(MetricsFlexGrid, { children: [
|
|
41982
|
+
/* @__PURE__ */ jsx(AgentRunsKpiCard, {}),
|
|
41983
|
+
/* @__PURE__ */ jsx(TotalTokensKpiCard, {}),
|
|
41984
|
+
/* @__PURE__ */ jsx(AvgScoreKpiCard, {})
|
|
41985
|
+
] }),
|
|
41986
|
+
/* @__PURE__ */ jsxs(MetricsFlexGrid, { children: [
|
|
41987
|
+
/* @__PURE__ */ jsx(ModelUsageCostCard, {}),
|
|
41988
|
+
/* @__PURE__ */ jsx(TokenUsageByAgentCard, {}),
|
|
41989
|
+
/* @__PURE__ */ jsx(ScoresCard, {}),
|
|
41990
|
+
/* @__PURE__ */ jsx(TracesVolumeCard, {}),
|
|
41991
|
+
/* @__PURE__ */ jsx(LatencyCard, {})
|
|
41992
|
+
] })
|
|
41993
|
+
] });
|
|
41994
|
+
}
|
|
41995
|
+
|
|
41996
|
+
const DATE_PRESETS = [
|
|
41997
|
+
{ label: "Last 24 hours", value: "24h" },
|
|
41998
|
+
{ label: "Last 3 days", value: "3d" },
|
|
41999
|
+
{ label: "Last 7 days", value: "7d" },
|
|
42000
|
+
{ label: "Last 14 days", value: "14d" },
|
|
42001
|
+
{ label: "Last 30 days", value: "30d" }
|
|
42002
|
+
];
|
|
42003
|
+
function DateRangeSelector() {
|
|
42004
|
+
const { datePreset, setDatePreset } = useMetrics();
|
|
42005
|
+
return /* @__PURE__ */ jsx(
|
|
42006
|
+
SelectFieldBlock,
|
|
42007
|
+
{
|
|
42008
|
+
name: "date-range",
|
|
42009
|
+
labelIsHidden: true,
|
|
42010
|
+
value: datePreset,
|
|
42011
|
+
options: DATE_PRESETS,
|
|
42012
|
+
onValueChange: (value) => setDatePreset(value)
|
|
42013
|
+
}
|
|
42014
|
+
);
|
|
42015
|
+
}
|
|
42016
|
+
|
|
40830
42017
|
function groupTracesByThread(traces) {
|
|
40831
42018
|
const threadMap = /* @__PURE__ */ new Map();
|
|
40832
42019
|
const ungrouped = [];
|
|
@@ -42028,6 +43215,7 @@ function DatasetsList({ datasets, isLoading, error, search = "" }) {
|
|
|
42028
43215
|
/* @__PURE__ */ jsx(EntityList.TopCell, { className: "text-center", children: "Version" }),
|
|
42029
43216
|
/* @__PURE__ */ jsx(EntityList.TopCell, { className: "text-center", children: "Created" })
|
|
42030
43217
|
] }),
|
|
43218
|
+
filteredData.length === 0 && search ? /* @__PURE__ */ jsx(EntityList.NoMatch, { message: "No Datasets match your search" }) : null,
|
|
42031
43219
|
filteredData.map((ds) => {
|
|
42032
43220
|
const name = truncateString(ds.name, 50);
|
|
42033
43221
|
const description = truncateString(ds.description ?? "", 200);
|
|
@@ -49025,6 +50213,7 @@ function McpServersList({ mcpServers, isLoading, error, search = "" }) {
|
|
|
49025
50213
|
}
|
|
49026
50214
|
)
|
|
49027
50215
|
] }),
|
|
50216
|
+
filteredData.length === 0 && search ? /* @__PURE__ */ jsx(EntityList.NoMatch, { message: "No MCP Servers match your search" }) : null,
|
|
49028
50217
|
filteredData.map((server) => /* @__PURE__ */ jsx(McpServerRow, { server }, server.id))
|
|
49029
50218
|
] });
|
|
49030
50219
|
}
|
|
@@ -49938,7 +51127,7 @@ function SkillsTable({
|
|
|
49938
51127
|
/* @__PURE__ */ jsx(EntryList.Header, { columns: effectiveColumns }),
|
|
49939
51128
|
skills.length > 0 ? /* @__PURE__ */ jsx(EntryList.Entries, { children: skills.map((skill) => {
|
|
49940
51129
|
const entry = {
|
|
49941
|
-
id: skill.
|
|
51130
|
+
id: skill.path,
|
|
49942
51131
|
name: skill.name,
|
|
49943
51132
|
description: skill.description || "—"
|
|
49944
51133
|
};
|
|
@@ -49949,7 +51138,7 @@ function SkillsTable({
|
|
|
49949
51138
|
entry,
|
|
49950
51139
|
columns: effectiveColumns,
|
|
49951
51140
|
onClick: () => {
|
|
49952
|
-
const url = `${basePath}/${encodeURIComponent(skill.name)}`;
|
|
51141
|
+
const url = `${basePath}/${encodeURIComponent(skill.name)}?path=${encodeURIComponent(skill.path)}`;
|
|
49953
51142
|
navigate(url);
|
|
49954
51143
|
},
|
|
49955
51144
|
children: [
|
|
@@ -49984,7 +51173,7 @@ function SkillsTable({
|
|
|
49984
51173
|
] }) })
|
|
49985
51174
|
]
|
|
49986
51175
|
},
|
|
49987
|
-
skill.
|
|
51176
|
+
skill.path
|
|
49988
51177
|
);
|
|
49989
51178
|
}) }) : /* @__PURE__ */ jsx(
|
|
49990
51179
|
EntryList.Message,
|
|
@@ -51166,5 +52355,5 @@ const NavigationCommand = () => {
|
|
|
51166
52355
|
);
|
|
51167
52356
|
};
|
|
51168
52357
|
|
|
51169
|
-
export { AGENT_CMS_SECTIONS, ActionsMenu, ActivatedSkillsProvider, AddField, AddItemDialog, AddItemsToDatasetDialog, AddSkillDialog, AgentCMSBlock, AgentCMSBlocks, AgentCMSRefBlock, AgentChat, AgentCmsBottomBar, AgentCmsFormShell, AgentCmsSidebar, AgentCoinIcon, AgentCombobox, AgentEditFormProvider, AgentEditLayout, AgentEntityHeader, AgentIcon, AgentInformation, AgentInformationLayout, AgentInformationTabLayout, AgentLayout, AgentMemory, AgentMetadata, AgentMetadataCombinedProcessorList, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataSkillList, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWorkspaceToolsList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentPageTabs, AgentPlaygroundConfig, AgentPlaygroundEvaluate, AgentPlaygroundRequestContext, AgentPlaygroundReview, AgentPlaygroundTestChat, AgentPlaygroundVersionBar, AgentPlaygroundView, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentToolPanel, AgentTopBarControls, AgentTracesPanel, AgentVersionCombobox, AgentVersionPanel, AgentsCmsLayout, AgentsList, AgentsPage, AgentsSection, AgentsTable, AiIcon, Alert, AlertDescription, AlertDialog, AlertTitle, ApiIcon, AuthRequired, AuthStatus, AutoForm, Avatar, Badge, BranchIcon, Breadcrumb$1 as Breadcrumb, Button, ButtonWithTooltip, ButtonsGroup, CODE_AGENT_OVERRIDE_SECTIONS, CSVImportDialog, Cell, ChatThreads, CheckIcon, Checkbox, ChevronIcon, Chip, ChipsGroup, CodeDiff, CodeEditor, Collapsible, CollapsibleContent, CollapsibleTrigger, Column, Columns, CombinedButtons, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CommitIcon, ComposerModelSwitcher, ContentBlock, ContentBlocks, CopyButton, CreateDatasetDialog, CreateDatasetFromItemsDialog, CrossIcon, Crumb, DatasetCombobox, DatasetCompareVersionToolbar, DatasetCompareVersionsList, DatasetExperiments, DatasetExperimentsComparison, DatasetItemContent, DatasetItemHeader, DatasetItemVersionsPanel, DatasetItemsList, DatasetPageContent, DatasetVersionsPanel, DatasetsList, DatasetsTable, DatePicker, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeleteDatasetDialog, DeploymentIcon, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DisplayConditionsDialog, DividerIcon, DocsIcon, DuplicateDatasetDialog, DynamicForm, EditDatasetDialog, EditModeContent, ElementSelect, EmptyDatasetsTable, EmptyState$1 as EmptyState, Entity, EntityAccordionItem, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityList, EntityListPageLayout, EntityListSkeleton, EntityName, Entry, EntryCell, EntryList, EntryListSkeleton, EnvIcon, ErrorState, ExperimentPageContent, ExperimentPageHeader, ExperimentResultSpanPane, ExperimentResultTracePanel, ExperimentResultsPanel, ExperimentStats, ExperimentTriggerDialog, Field, FieldDescription, FieldList, FieldName, FieldNullable, FieldOptional, FieldRemove, FieldType, FileBrowser, FileViewer, FiltersIcon, FolderIcon, GenerationProvider, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, HoverPopover, Icon, InfoIcon, InformationPage, Input, InstructionBlocksPage, IntegrationToolsSection, ItemList, ItemListSkeleton, ItemPageToolbar, JSONImportDialog, JSONSchemaForm, JudgeIcon, Kbd, KeyValueList, LLMModels, LLMProviders, Label, LatencyIcon, LinkComponentProvider, ListSearch, LoginButton, LoginPage, LogoWithoutText, LogsIcon, MCPClientCreateContent, MCPClientEditLayout, MCPClientFormSidebar, MCPClientList, MCPClientToolPreview, MCPDetail, MCPServerCombobox, MCPTable, MCPToolPanel, MainContentContent, MainContentLayout, MainHeader, MainSidebar, MainSidebarProvider, MarkdownRenderer, MastraPackagesInfo, MastraVersionFooter, McpCoinIcon, McpServerIcon, McpServersList, MemoryIcon, MemoryPage, MemorySearch, MemorySection, MultiColumn, MultiCombobox, NavigationCommand, NestedFields, Notice, Notification, OPERATORS, OPERATOR_LABELS, ObservationalMemoryProvider, OpenAIIcon, PER_PAGE$2 as PER_PAGE, PageHeader, PermissionDenied, PlaygroundConfigGuard, PlaygroundModelProvider, PlaygroundQueryClient, Popover, PopoverContent, PopoverTrigger, ProcessStepList, ProcessStepListItem, ProcessStepProgressBar, ProcessorCombobox, ProcessorIcon, ProcessorPanel, ProcessorTable, ProcessorsList, PromptBlockCreateContent, PromptBlockEditMain, PromptBlockEditSidebar, PromptBlockPickerDialog, PromptBlockVersionCombobox, PromptBlocksTable, PromptIcon, PromptsList, ProviderLogo, RadioGroup, RadioGroupItem, ReferenceViewerDialog, RepoIcon, RequestContext, RequestContextSchemaForm, RequestContextWrapper, ReviewQueueProvider, Root, Row, RuleBuilder, RuleFieldSelect, RuleOperatorSelect, RuleRow, RuleValueInput, STORED_SCORER_TYPES, SchemaRequestContext, SchemaRequestContextProvider, ScoreAsItemDialog, ScoreDelta, ScoreDialog, ScorerCombobox, ScorerCreateContent, ScorerEditMain, ScorerEditSidebar, ScorerSelector, ScorerVersionCombobox, ScorersList, ScorersPage, ScorersSection, ScorersTable, ScoresList, ScoresTools, ScrollArea, ScrollBar, SearchSkillsPanel, SearchWorkspacePanel, Searchbar, SearchbarWrapper, Section, SectionHeader, Sections, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectTrigger, SelectValue, SettingsIcon, ShadcnAutoFormFieldComponents, SideDialog, Skeleton, SkillDetail, SkillIcon, SkillRemoveButton, SkillUpdateButton, SkillsNotConfigured, SkillsPage, SkillsTable, SlashIcon, Slider, SpanScoreList, SpanScoring, SpanTabs, Spinner, StudioConfigContext, StudioConfigForm, StudioConfigProvider, SubSectionHeader, Switch, Tab, TabContent, TabList, Table, Tabs, TargetSelector, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, Th, Thead, ThreadDeleteButton, ThreadInputProvider, ThreadItem, ThreadLink, ThreadList, Threads, TimePicker, ToolCoinIcon, ToolCombobox, ToolFallback, ToolIconMap, ToolInformation, ToolList, ToolPanel, ToolProviderDialog, ToolTable, ToolkitList, ToolsIcon, ToolsList, ToolsPage, ToolsSection, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TraceAsItemDialog, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineSpan, TraceTimelineTools, TracesList, TracesTools, TracingSettingsContext, TracingSettingsProvider, Tree, Truncate, TsIcon, Txt, TxtCell, UserAvatar, UserMenu, VARIABLE_PATTERN, VariablesIcon, VariablesPage, WorkflowCoinIcon, WorkflowCombobox, WorkflowGraph, WorkflowIcon, WorkflowInformation, WorkflowLayout, WorkflowRunContext, WorkflowRunDetail, WorkflowRunList, WorkflowRunProvider, WorkflowStepDetailContext, WorkflowStepDetailProvider, WorkflowTable, WorkflowTrigger, WorkflowsList, WorkflowsPage, WorkflowsSection, WorkingMemoryContext, WorkingMemoryProvider, WorkspaceNotConfigured, agentFormSchema, arrayToRecord, buildObservationalMemoryForApi, buttonVariants, cleanProviderId, cn, collectMCPClientIds, columns$6 as columns, comboboxStyles, computeAgentInitialValues, convertWorkflowRunStateToStreamResult, countLeafRules, createDefaultRule, createDefaultRuleGroup, createField, createInstructionBlock, createRefInstructionBlock, createVariableAutocomplete, exportItemsToCSV, exportItemsToJSON, extractPrompt, fieldConfig, fieldsToJSONSchema, findProviderById, flattenSchemaToVariables, formatHierarchicalSpans, getChildFieldOptions, getColumnTemplate, getFieldOptionAtPath, getFieldOptionsFromSchema, getItemListColumnTemplate, getMainContentContentClassName, getShortId, getSpanTypeUi, getStatusIcon, getToNextEntryFn, getToNextItemFn, getToPreviousEntryFn, getToPreviousItemFn, getWorkflowRunsNextPageParam, groupTracesByThread, highlight, inputVariants, is403ForbiddenError, isActive, isAuthenticated, isRule, isRuleGroup, isWorkspaceV1Supported, joinModelId, jsonSchemaToFields, makeAuthCapabilitiesRequest, makeLogoutRequest, makeSSOLoginRequest, mapAgentResponseToDataSource, mapInstructionBlocksFromApi, mapInstructionBlocksToApi, mapScorersToApi, normalizeIntegrationToolsToRecord, normalizeScorersFromApi, normalizeSkillsFromApi, normalizeToolsToRecord, normalizeWorkspaceFromApi, parseError, parseFieldPath, parseJSONCell, parseObservationalMemoryFromApi, parseRow, parseSkillSource, promptBlockFormSchema, providerMapToIcon, removeEmptyValues, resolveSerializedZodOutput, scorerFormSchema, scoresListColumns, selectUniqueRuns, shouldRetryQuery, spanTypePrefixes$1 as spanTypePrefixes, splitModelId, toast, traceScoresListColumns, tracesListColumns, transformIntegrationToolsForApi, useActivateAgentVersion, useActivatePromptBlockVersion, useActivateScorerVersion, useActivatedSkills, useAgent, useAgentCmsForm, useAgentCmsNavigation, useAgentEditForm, useAgentEditFormContext, useAgentExperiments, useAgentInformationTab, useAgentSettings, useAgentSkill, useAgentVersion, useAgentVersions, useAgents, useAllIntegrationTools, useAllModels, useAuthCapabilities, useCSVParser, useCloneThread, useCodemirrorTheme$1 as useCodemirrorTheme, useCompareAgentVersions, useCompareExperiments, useCompareScorerVersions, useCreateAgentVersion, useCreatePromptBlockVersion, useCreateScorerVersion, useCreateSkill, useCreateWorkspaceDirectory, useCredentialsLogin, useCredentialsSignUp, useCurrentRun, useCurrentUser, useDataset, useDatasetExperiment, useDatasetExperimentResults, useDatasetExperiments, useDatasetItem, useDatasetItemVersion, useDatasetItemVersions, useDatasetItems, useDatasetMutations, useDatasetVersions, useDatasets, useDeleteAgentVersion, useDeletePromptBlockVersion, useDeleteScorerVersion, useDeleteThread, useDeleteWorkflowRun, useDeleteWorkspaceFile, useExecuteAgentTool, useExecuteMCPTool, useExecuteProcessor, useExecuteTool, useExperimentalFeatures, useFilteredModels, useFilteredProviders, useGenerationTasks, useHasObservability, useInView, useIndexWorkspaceContent, useInstallSkill, useIsCmsAvailable, useItemSelection, useJSONParser, useJSONSchemaForm, useJSONSchemaFormField, useJSONSchemaFormNestedContext, useLLMProviders, useLinkComponent, useLogout, useMCPServerTool, useMCPServerTools, useMCPServerToolsById, useMCPServers, useMainSidebar, useMastraPackages, useMastraPlatform, useMaybeSidebar, useMemory, useMemoryConfig, useMemorySearch, useMemoryWithOMStatus, useMergedRequestContext, useNavigationCommand, useObservationalMemory, useObservationalMemoryContext, useOptionalAgentEditFormContext, usePackageUpdates, usePermissions, usePlaygroundModel, usePlaygroundStore, usePopularSkillsSh, useProcessor, useProcessors, usePromptBlockEditForm, usePromptBlockVersion, usePromptBlockVersions, useProviderTools, useRemoveSkill, useReorderModelList, useRequestContextPresets, useResetAgentModel, useRestoreAgentVersion, useRestorePromptBlockVersion, useRestoreScorerVersion, useReviewQueue, useSSOLogin, useSchemaRequestContext, useScorer, useScorerEditForm, useScorerVersion, useScorerVersions, useScorers, useScoresByExperimentId, useScoresByScorerId, useSearchSkillsSh, useSearchWorkspace, useSearchWorkspaceSkills, useSkillPreview, useSpeechRecognition, useStoredAgent, useStoredAgentMutations, useStoredAgents, useStoredPromptBlock, useStoredPromptBlockMutations, useStoredPromptBlocks, useStoredScorer, useStoredScorerMutations, useStoredSkills, useStudioConfig, useTableKeyboardNavigation, useThread, useThreadInput, useThreads, useTool, useToolProviders, useToolkits, useTools, useTraceSpanScores, useTracingSettings, useTryConnectMcp, useUpdateAgentModel, useUpdateModelInModelList, useUpdateSkills, useWorkflow, useWorkflowRun, useWorkflowRuns, useWorkflowStepDetail, useWorkflows, useWorkingMemory, useWorkspaceFile, useWorkspaceFileStat, useWorkspaceFiles, useWorkspaceInfo, useWorkspaceSkill, useWorkspaceSkillReference, useWorkspaceSkillReferences, useWorkspaceSkills, useWorkspaces, useWriteWorkspaceFile, useWriteWorkspaceFileFromFile, validateCsvRows, validateJSONData, validateMappedData, variableHighlight };
|
|
52358
|
+
export { AGENT_CMS_SECTIONS, ActionsMenu, ActivatedSkillsProvider, AddField, AddItemDialog, AddItemsToDatasetDialog, AddSkillDialog, AgentCMSBlock, AgentCMSBlocks, AgentCMSRefBlock, AgentChat, AgentCmsBottomBar, AgentCmsFormShell, AgentCmsSidebar, AgentCoinIcon, AgentCombobox, AgentEditFormProvider, AgentEditLayout, AgentEntityHeader, AgentIcon, AgentInformation, AgentInformationLayout, AgentInformationTabLayout, AgentLayout, AgentMemory, AgentMetadata, AgentMetadataCombinedProcessorList, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataSkillList, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWorkspaceToolsList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentPageTabs, AgentPlaygroundConfig, AgentPlaygroundEvaluate, AgentPlaygroundRequestContext, AgentPlaygroundReview, AgentPlaygroundTestChat, AgentPlaygroundVersionBar, AgentPlaygroundView, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentToolPanel, AgentTopBarControls, AgentTracesPanel, AgentVersionCombobox, AgentVersionPanel, AgentsCmsLayout, AgentsList, AgentsPage, AgentsSection, AgentsTable, AiIcon, Alert, AlertDescription, AlertDialog, AlertTitle, ApiIcon, AuthRequired, AuthStatus, AutoForm, Avatar, Badge, BranchIcon, Breadcrumb$1 as Breadcrumb, Button, ButtonWithTooltip, ButtonsGroup, CHART_COLORS, CODE_AGENT_OVERRIDE_SECTIONS, CSVImportDialog, Cell, ChatThreads, CheckIcon, Checkbox, ChevronIcon, Chip, ChipsGroup, CodeDiff, CodeEditor, Collapsible, CollapsibleContent, CollapsibleTrigger, Column, Columns, CombinedButtons, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CommitIcon, ComposerModelSwitcher, ContentBlock, ContentBlocks, CopyButton, CreateDatasetDialog, CreateDatasetFromItemsDialog, CrossIcon, Crumb, DatasetCombobox, DatasetCompareVersionToolbar, DatasetCompareVersionsList, DatasetExperiments, DatasetExperimentsComparison, DatasetItemContent, DatasetItemHeader, DatasetItemVersionsPanel, DatasetItemsList, DatasetPageContent, DatasetVersionsPanel, DatasetsList, DatasetsTable, DatePicker, DateRangeSelector, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeleteDatasetDialog, DeploymentIcon, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DisplayConditionsDialog, DividerIcon, DocsIcon, DuplicateDatasetDialog, DynamicForm, EditDatasetDialog, EditModeContent, ElementSelect, EmptyDatasetsTable, EmptyState$1 as EmptyState, Entity, EntityAccordionItem, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityList, EntityListPageLayout, EntityListSkeleton, EntityName, Entry, EntryCell, EntryList, EntryListSkeleton, EnvIcon, ErrorState, ExperimentPageContent, ExperimentPageHeader, ExperimentResultSpanPane, ExperimentResultTracePanel, ExperimentResultsPanel, ExperimentStats, ExperimentTriggerDialog, Field, FieldDescription, FieldList, FieldName, FieldNullable, FieldOptional, FieldRemove, FieldType, FileBrowser, FileViewer, FiltersIcon, FolderIcon, GenerationProvider, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, HorizontalBars, HoverPopover, Icon, InfoIcon, InformationPage, Input, InstructionBlocksPage, IntegrationToolsSection, ItemList, ItemListSkeleton, ItemPageToolbar, JSONImportDialog, JSONSchemaForm, JudgeIcon, Kbd, KeyValueList, LLMModels, LLMProviders, Label, LatencyCard, LatencyIcon, LinkComponentProvider, ListSearch, LoginButton, LoginPage, LogoWithoutText, LogsIcon, MCPClientCreateContent, MCPClientEditLayout, MCPClientFormSidebar, MCPClientList, MCPClientToolPreview, MCPDetail, MCPServerCombobox, MCPTable, MCPToolPanel, MainContentContent, MainContentLayout, MainHeader, MainSidebar, MainSidebarProvider, MarkdownRenderer, MastraPackagesInfo, MastraVersionFooter, McpCoinIcon, McpServerIcon, McpServersList, MemoryIcon, MemoryPage, MemorySearch, MemorySection, MetricsCard, MetricsDashboard, MetricsDataTable, MetricsKpiCard, MetricsProvider, ModelUsageCostCard, MultiColumn, MultiCombobox, NavigationCommand, NestedFields, Notice, Notification, OPERATORS, OPERATOR_LABELS, ObservationalMemoryProvider, OpenAIIcon, PER_PAGE$2 as PER_PAGE, PageHeader, PermissionDenied, PlaygroundConfigGuard, PlaygroundModelProvider, PlaygroundQueryClient, Popover, PopoverContent, PopoverTrigger, ProcessStepList, ProcessStepListItem, ProcessStepProgressBar, ProcessorCombobox, ProcessorIcon, ProcessorPanel, ProcessorTable, ProcessorsList, PromptBlockCreateContent, PromptBlockEditMain, PromptBlockEditSidebar, PromptBlockPickerDialog, PromptBlockVersionCombobox, PromptBlocksTable, PromptIcon, PromptsList, ProviderLogo, RadioGroup, RadioGroupItem, ReferenceViewerDialog, RepoIcon, RequestContext, RequestContextSchemaForm, RequestContextWrapper, ReviewQueueProvider, Root, Row, RuleBuilder, RuleFieldSelect, RuleOperatorSelect, RuleRow, RuleValueInput, STORED_SCORER_TYPES, SchemaRequestContext, SchemaRequestContextProvider, ScoreAsItemDialog, ScoreDelta, ScoreDialog, ScorerCombobox, ScorerCreateContent, ScorerEditMain, ScorerEditSidebar, ScorerSelector, ScorerVersionCombobox, ScorersList, ScorersPage, ScorersSection, ScorersTable, ScoresCard, ScoresList, ScoresTools, ScrollArea, ScrollBar, SearchSkillsPanel, SearchWorkspacePanel, Searchbar, SearchbarWrapper, Section, SectionHeader, Sections, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectTrigger, SelectValue, SettingsIcon, ShadcnAutoFormFieldComponents, SideDialog, Skeleton, SkillDetail, SkillIcon, SkillRemoveButton, SkillUpdateButton, SkillsNotConfigured, SkillsPage, SkillsTable, SlashIcon, Slider, SpanScoreList, SpanScoring, SpanTabs, Spinner, StudioConfigContext, StudioConfigForm, StudioConfigProvider, SubSectionHeader, Switch, Tab, TabContent, TabList, Table, Tabs, TargetSelector, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, Th, Thead, ThreadDeleteButton, ThreadInputProvider, ThreadItem, ThreadLink, ThreadList, Threads, TimePicker, TokenUsageByAgentCard, ToolCoinIcon, ToolCombobox, ToolFallback, ToolIconMap, ToolInformation, ToolList, ToolPanel, ToolProviderDialog, ToolTable, ToolkitList, ToolsIcon, ToolsList, ToolsPage, ToolsSection, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TraceAsItemDialog, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineSpan, TraceTimelineTools, TracesList, TracesTools, TracesVolumeCard, TracingSettingsContext, TracingSettingsProvider, Tree, Truncate, TsIcon, Txt, TxtCell, UserAvatar, UserMenu, VARIABLE_PATTERN, VariablesIcon, VariablesPage, WorkflowCoinIcon, WorkflowCombobox, WorkflowGraph, WorkflowIcon, WorkflowInformation, WorkflowLayout, WorkflowRunContext, WorkflowRunDetail, WorkflowRunList, WorkflowRunProvider, WorkflowStepDetailContext, WorkflowStepDetailProvider, WorkflowTable, WorkflowTrigger, WorkflowsList, WorkflowsPage, WorkflowsSection, WorkingMemoryContext, WorkingMemoryProvider, WorkspaceNotConfigured, agentFormSchema, arrayToRecord, buildObservationalMemoryForApi, buttonVariants, cleanProviderId, cn, collectMCPClientIds, columns$6 as columns, comboboxStyles, computeAgentInitialValues, convertWorkflowRunStateToStreamResult, countLeafRules, createDefaultRule, createDefaultRuleGroup, createField, createInstructionBlock, createRefInstructionBlock, createVariableAutocomplete, exportItemsToCSV, exportItemsToJSON, extractPrompt, fieldConfig, fieldsToJSONSchema, findProviderById, flattenSchemaToVariables, formatCompact, formatHierarchicalSpans, getChildFieldOptions, getColumnTemplate, getFieldOptionAtPath, getFieldOptionsFromSchema, getItemListColumnTemplate, getMainContentContentClassName, getShortId, getSpanTypeUi, getStatusIcon, getToNextEntryFn, getToNextItemFn, getToPreviousEntryFn, getToPreviousItemFn, getWorkflowRunsNextPageParam, groupTracesByThread, highlight, inputVariants, is403ForbiddenError, isActive, isAuthenticated, isRule, isRuleGroup, isValidPreset, isWorkspaceV1Supported, joinModelId, jsonSchemaToFields, makeAuthCapabilitiesRequest, makeLogoutRequest, makeSSOLoginRequest, mapAgentResponseToDataSource, mapInstructionBlocksFromApi, mapInstructionBlocksToApi, mapScorersToApi, normalizeIntegrationToolsToRecord, normalizeScorersFromApi, normalizeSkillsFromApi, normalizeToolsToRecord, normalizeWorkspaceFromApi, parseError, parseFieldPath, parseJSONCell, parseObservationalMemoryFromApi, parseRow, parseSkillSource, promptBlockFormSchema, providerMapToIcon, removeEmptyValues, resolveSerializedZodOutput, scorerFormSchema, scoresListColumns, selectUniqueRuns, shouldRetryQuery, spanTypePrefixes$1 as spanTypePrefixes, splitModelId, toast, traceScoresListColumns, tracesListColumns, transformIntegrationToolsForApi, useActivateAgentVersion, useActivatePromptBlockVersion, useActivateScorerVersion, useActivatedSkills, useAgent, useAgentCmsForm, useAgentCmsNavigation, useAgentEditForm, useAgentEditFormContext, useAgentExperiments, useAgentInformationTab, useAgentRunsKpiMetrics, useAgentSettings, useAgentSkill, useAgentVersion, useAgentVersions, useAgents, useAllIntegrationTools, useAllModels, useAuthCapabilities, useAvgScoreKpiMetrics, useCSVParser, useCloneThread, useCodemirrorTheme$1 as useCodemirrorTheme, useCompareAgentVersions, useCompareExperiments, useCompareScorerVersions, useCreateAgentVersion, useCreatePromptBlockVersion, useCreateScorerVersion, useCreateSkill, useCreateWorkspaceDirectory, useCredentialsLogin, useCredentialsSignUp, useCurrentRun, useCurrentUser, useDataset, useDatasetExperiment, useDatasetExperimentResults, useDatasetExperiments, useDatasetItem, useDatasetItemVersion, useDatasetItemVersions, useDatasetItems, useDatasetMutations, useDatasetVersions, useDatasets, useDeleteAgentVersion, useDeletePromptBlockVersion, useDeleteScorerVersion, useDeleteThread, useDeleteWorkflowRun, useDeleteWorkspaceFile, useExecuteAgentTool, useExecuteMCPTool, useExecuteProcessor, useExecuteTool, useExperimentalFeatures, useFilteredModels, useFilteredProviders, useGenerationTasks, useHasObservability, useInView, useIndexWorkspaceContent, useInstallSkill, useIsCmsAvailable, useItemSelection, useJSONParser, useJSONSchemaForm, useJSONSchemaFormField, useJSONSchemaFormNestedContext, useLLMProviders, useLatencyMetrics, useLinkComponent, useLogout, useMCPServerTool, useMCPServerTools, useMCPServerToolsById, useMCPServers, useMainSidebar, useMastraPackages, useMastraPlatform, useMaybeSidebar, useMemory, useMemoryConfig, useMemorySearch, useMemoryWithOMStatus, useMergedRequestContext, useMetrics, useMetricsFilters, useModelUsageCostMetrics, useNavigationCommand, useObservationalMemory, useObservationalMemoryContext, useOptionalAgentEditFormContext, usePackageUpdates, usePermissions, usePlaygroundModel, usePlaygroundStore, usePopularSkillsSh, useProcessor, useProcessors, usePromptBlockEditForm, usePromptBlockVersion, usePromptBlockVersions, useProviderTools, useRemoveSkill, useReorderModelList, useRequestContextPresets, useResetAgentModel, useRestoreAgentVersion, useRestorePromptBlockVersion, useRestoreScorerVersion, useReviewQueue, useSSOLogin, useSchemaRequestContext, useScorer, useScorerEditForm, useScorerVersion, useScorerVersions, useScorers, useScoresByExperimentId, useScoresByScorerId, useScoresMetrics, useSearchSkillsSh, useSearchWorkspace, useSearchWorkspaceSkills, useSkillPreview, useSpeechRecognition, useStoredAgent, useStoredAgentMutations, useStoredAgents, useStoredPromptBlock, useStoredPromptBlockMutations, useStoredPromptBlocks, useStoredScorer, useStoredScorerMutations, useStoredSkills, useStudioConfig, useTableKeyboardNavigation, useThread, useThreadInput, useThreads, useTokenUsageByAgentMetrics, useTool, useToolProviders, useToolkits, useTools, useTotalTokensKpiMetrics, useTraceSpanScores, useTraceVolumeMetrics, useTracingSettings, useTryConnectMcp, useUpdateAgentModel, useUpdateModelInModelList, useUpdateSkills, useWorkflow, useWorkflowRun, useWorkflowRuns, useWorkflowStepDetail, useWorkflows, useWorkingMemory, useWorkspaceFile, useWorkspaceFileStat, useWorkspaceFiles, useWorkspaceInfo, useWorkspaceSkill, useWorkspaceSkillReference, useWorkspaceSkillReferences, useWorkspaceSkills, useWorkspaces, useWriteWorkspaceFile, useWriteWorkspaceFileFromFile, validateCsvRows, validateJSONData, validateMappedData, variableHighlight };
|
|
51170
52359
|
//# sourceMappingURL=index.es.js.map
|