@mastra/playground-ui 24.0.2 → 24.1.0-alpha.0

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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 24.1.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Removed `<Alert>` in favor of `<Notice>`. The two components had significant visual and behavioral overlap; `<Notice>` is now the single banner primitive and supports every previous `<Alert>` use case. ([#15791](https://github.com/mastra-ai/mastra/pull/15791))
8
+
9
+ `<Notice>` is also redesigned with a flatter API: `title` and `icon` are now props, each variant ships a default icon, an optional `action` prop renders a button aligned to the title, and a new `note` variant has been added alongside `warning`, `destructive`, `info`, and `success`. Theme tokens (`notice-warning`, `notice-destructive`, `notice-info`, `notice-success`, `notice-note`) replace the previous hardcoded colors.
10
+
11
+ **Migration**
12
+
13
+ ```tsx
14
+ // Before
15
+ <Alert variant="warning">
16
+ <AlertTitle>Provider not connected</AlertTitle>
17
+ <AlertDescription as="p">Set the API key environment variable.</AlertDescription>
18
+ </Alert>
19
+
20
+ // After
21
+ <Notice variant="warning" title="Provider not connected">
22
+ <Notice.Message>Set the API key environment variable.</Notice.Message>
23
+ </Notice>
24
+ ```
25
+
26
+ ### Patch Changes
27
+
28
+ - Removed the "Avg Score" KPI card from the Metrics dashboard and the avg-score summary from the Scores card. ([#15967](https://github.com/mastra-ai/mastra/pull/15967))
29
+
3
30
  ## 24.0.2
4
31
 
5
32
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -3394,7 +3394,7 @@ const sizeClasses$6 = {
3394
3394
  default: `${formElementSizes.default} text-ui-md px-[.85em] `,
3395
3395
  lg: `${formElementSizes.lg} text-ui-lg px-[1em] `
3396
3396
  };
3397
- const variantClasses$4 = {
3397
+ const variantClasses$2 = {
3398
3398
  default: "bg-surface3 border-2 border-border1 hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral5",
3399
3399
  primary: "bg-surface4 border-2 border-border2 hover:text-neutral6 hover:bg-surface5 active:bg-surface6 text-neutral6",
3400
3400
  cta: "bg-accent1/50 hover:bg-accent1/80 text-neutral5 font-semibold",
@@ -3421,7 +3421,7 @@ function resolveVariant(variant) {
3421
3421
  function buttonVariants(options) {
3422
3422
  const variant = resolveVariant(options?.variant || "default");
3423
3423
  const size = options?.size || "default";
3424
- return cn(sharedStyles, sizeClasses$6[size], variantClasses$4[variant], options?.iconOnly && "[&>svg]:opacity-75");
3424
+ return cn(sharedStyles, sizeClasses$6[size], variantClasses$2[variant], options?.iconOnly && "[&>svg]:opacity-75");
3425
3425
  }
3426
3426
  function flattenChildren(children) {
3427
3427
  const result = [];
@@ -3604,6 +3604,190 @@ const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) =
3604
3604
  return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: cn(variants[variant], font && fonts[font], className), ...props });
3605
3605
  };
3606
3606
 
3607
+ const sizeClasses$5 = {
3608
+ sm: "h-avatar-sm w-avatar-sm",
3609
+ md: "h-avatar-md w-avatar-md",
3610
+ lg: "h-avatar-lg w-avatar-lg"
3611
+ };
3612
+ const Avatar = ({ src, name, size = "sm", interactive = false }) => {
3613
+ return /* @__PURE__ */ jsxRuntime.jsx(
3614
+ "div",
3615
+ {
3616
+ className: cn(
3617
+ sizeClasses$5[size],
3618
+ "border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",
3619
+ transitions.all,
3620
+ interactive && "cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"
3621
+ ),
3622
+ children: src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-md", className: "text-center text-neutral4", children: name[0].toUpperCase() })
3623
+ }
3624
+ );
3625
+ };
3626
+
3627
+ const variantClasses$1 = {
3628
+ default: "text-neutral3 bg-surface4",
3629
+ success: "text-accent1 bg-accent1Dark",
3630
+ error: "text-accent2 bg-accent2Dark",
3631
+ info: "text-accent5 bg-accent5Dark",
3632
+ warning: "text-accent6 bg-accent6Dark"
3633
+ };
3634
+ const iconClasses = {
3635
+ default: "text-neutral3",
3636
+ success: "text-accent1",
3637
+ error: "text-accent2",
3638
+ info: "text-accent5",
3639
+ warning: "text-accent6"
3640
+ };
3641
+ const Badge = ({ icon, variant = "default", className, children, ...props }) => {
3642
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3643
+ "div",
3644
+ {
3645
+ className: cn(
3646
+ "font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",
3647
+ transitions.colors,
3648
+ icon ? "pl-2 pr-2.5" : "px-2.5",
3649
+ variant === "default" && icon ? "bg-surface4 text-neutral5" : variantClasses$1[variant],
3650
+ className
3651
+ ),
3652
+ ...props,
3653
+ children: [
3654
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: iconClasses[variant], children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon }) }),
3655
+ children
3656
+ ]
3657
+ }
3658
+ );
3659
+ };
3660
+
3661
+ const SlashIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z", fill: "currentColor" }) });
3662
+
3663
+ const Breadcrumb = ({ children, label }) => {
3664
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": label, children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "gap-0.5 flex items-center", children }) });
3665
+ };
3666
+ const Crumb = ({ className, as, isCurrent, action, ...props }) => {
3667
+ const Root = as || "span";
3668
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3669
+ /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex h-full shrink-0 items-center gap-1", children: [
3670
+ /* @__PURE__ */ jsxRuntime.jsx(
3671
+ Root,
3672
+ {
3673
+ "aria-current": isCurrent ? "page" : void 0,
3674
+ className: cn(
3675
+ "text-ui-md leading-ui-md flex items-center gap-2",
3676
+ transitions.colors,
3677
+ isCurrent ? "text-white" : "text-neutral3 hover:text-neutral5",
3678
+ className
3679
+ ),
3680
+ ...props
3681
+ }
3682
+ ),
3683
+ action
3684
+ ] }),
3685
+ !isCurrent && /* @__PURE__ */ jsxRuntime.jsx("li", { role: "separator", className: "flex h-full items-center", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: cn("text-neutral2", transitions.colors), children: /* @__PURE__ */ jsxRuntime.jsx(SlashIcon, {}) }) })
3686
+ ] });
3687
+ };
3688
+
3689
+ function flattenSchemaToVariables(schema, maxDepth = 5) {
3690
+ if (!schema?.properties) {
3691
+ return [];
3692
+ }
3693
+ const results = [];
3694
+ function processProperty(property, path, depth) {
3695
+ if (depth > maxDepth) {
3696
+ return;
3697
+ }
3698
+ const type = Array.isArray(property.type) ? property.type.join(" | ") : property.type;
3699
+ results.push({
3700
+ path,
3701
+ label: path,
3702
+ description: property.description ?? property.title,
3703
+ type
3704
+ });
3705
+ if (property.properties) {
3706
+ for (const [key, nestedProperty] of Object.entries(property.properties)) {
3707
+ processProperty(nestedProperty, `${path}.${key}`, depth + 1);
3708
+ }
3709
+ }
3710
+ if (property.items?.properties) {
3711
+ for (const [key, itemProperty] of Object.entries(property.items.properties)) {
3712
+ processProperty(itemProperty, `${path}[].${key}`, depth + 1);
3713
+ }
3714
+ }
3715
+ }
3716
+ for (const [key, property] of Object.entries(schema.properties)) {
3717
+ processProperty(property, key, 1);
3718
+ }
3719
+ return results;
3720
+ }
3721
+
3722
+ function createVariableAutocomplete(schema) {
3723
+ const variables = flattenSchemaToVariables(schema);
3724
+ return autocomplete.autocompletion({
3725
+ override: [createVariableCompletionSource(variables)],
3726
+ defaultKeymap: true,
3727
+ closeOnBlur: true,
3728
+ icons: false
3729
+ });
3730
+ }
3731
+ function createVariableCompletionSource(variables) {
3732
+ return (context) => {
3733
+ const beforeCursor = context.state.sliceDoc(Math.max(0, context.pos - 50), context.pos);
3734
+ const match = beforeCursor.match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);
3735
+ if (!match) {
3736
+ return null;
3737
+ }
3738
+ const prefix = match[1] ?? "";
3739
+ const startPos = context.pos - prefix.length;
3740
+ const filteredVariables = prefix ? variables.filter((v) => v.path.toLowerCase().startsWith(prefix.toLowerCase())) : variables;
3741
+ if (filteredVariables.length === 0) {
3742
+ return null;
3743
+ }
3744
+ const completions = filteredVariables.map((variable) => ({
3745
+ label: variable.path,
3746
+ displayLabel: variable.path,
3747
+ detail: variable.type,
3748
+ info: variable.description,
3749
+ apply: (view, completion, from, to) => {
3750
+ const afterCursor = view.state.sliceDoc(to, to + 2);
3751
+ const hasClosingBraces = afterCursor === "}}";
3752
+ const insertText = hasClosingBraces ? completion.label : `${completion.label}}}`;
3753
+ view.dispatch({
3754
+ changes: { from, to, insert: insertText },
3755
+ selection: { anchor: from + insertText.length }
3756
+ });
3757
+ }
3758
+ }));
3759
+ return {
3760
+ from: startPos,
3761
+ options: completions,
3762
+ validFor: /^[a-zA-Z0-9_.\[\]]*$/
3763
+ };
3764
+ };
3765
+ }
3766
+
3767
+ const VARIABLE_PATTERN = /\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g;
3768
+ const variableDecoration = view.Decoration.mark({
3769
+ class: "cm-variable-highlight"
3770
+ });
3771
+ const variableMatcher = new view.MatchDecorator({
3772
+ regexp: VARIABLE_PATTERN,
3773
+ decoration: () => variableDecoration
3774
+ });
3775
+ const variableHighlightPlugin = view.ViewPlugin.fromClass(
3776
+ class {
3777
+ decorations;
3778
+ constructor(view) {
3779
+ this.decorations = variableMatcher.createDeco(view);
3780
+ }
3781
+ update(update) {
3782
+ this.decorations = variableMatcher.updateDeco(update, this.decorations);
3783
+ }
3784
+ },
3785
+ {
3786
+ decorations: (v) => v.decorations
3787
+ }
3788
+ );
3789
+ const variableHighlight = variableHighlightPlugin;
3790
+
3607
3791
  const AgentIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
3608
3792
  /* @__PURE__ */ jsxRuntime.jsx(
3609
3793
  "path",
@@ -4070,8 +4254,6 @@ const SettingsIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "
4070
4254
  }
4071
4255
  ) });
4072
4256
 
4073
- const SlashIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z", fill: "currentColor" }) });
4074
-
4075
4257
  const ToolsIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
4076
4258
  "path",
4077
4259
  {
@@ -4763,224 +4945,6 @@ const XGroqIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4763
4945
  }
4764
4946
  );
4765
4947
 
4766
- const variantClasses$3 = {
4767
- warning: "bg-accent6Darker border-accent6/30 text-accent6",
4768
- destructive: "bg-accent2Darker border-accent2/30 text-accent2",
4769
- info: "bg-accent5Darker border-accent5/30 text-accent5"
4770
- };
4771
- const variantIcons = {
4772
- warning: lucideReact.TriangleAlert,
4773
- destructive: lucideReact.AlertCircle,
4774
- info: lucideReact.InfoIcon
4775
- };
4776
- const Alert = ({ children, variant = "destructive", className }) => {
4777
- const Ico = variantIcons[variant];
4778
- return /* @__PURE__ */ jsxRuntime.jsx(
4779
- "div",
4780
- {
4781
- className: cn(
4782
- variantClasses$3[variant],
4783
- "p-3 rounded-md border shadow-sm",
4784
- transitions.all,
4785
- "animate-in fade-in-0 slide-in-from-top-2 duration-200",
4786
- className
4787
- ),
4788
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
4789
- /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "mt-0.5 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(Ico, {}) }),
4790
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-neutral4", children })
4791
- ] })
4792
- }
4793
- );
4794
- };
4795
- const AlertTitle = ({ children, as: As = "h5" }) => {
4796
- return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: As, variant: "ui-md", className: "font-semibold", children });
4797
- };
4798
- const AlertDescription = ({ children, as: As = "p" }) => {
4799
- return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: As, variant: "ui-sm", children });
4800
- };
4801
-
4802
- const sizeClasses$5 = {
4803
- sm: "h-avatar-sm w-avatar-sm",
4804
- md: "h-avatar-md w-avatar-md",
4805
- lg: "h-avatar-lg w-avatar-lg"
4806
- };
4807
- const Avatar = ({ src, name, size = "sm", interactive = false }) => {
4808
- return /* @__PURE__ */ jsxRuntime.jsx(
4809
- "div",
4810
- {
4811
- className: cn(
4812
- sizeClasses$5[size],
4813
- "border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",
4814
- transitions.all,
4815
- interactive && "cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"
4816
- ),
4817
- children: src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-md", className: "text-center text-neutral4", children: name[0].toUpperCase() })
4818
- }
4819
- );
4820
- };
4821
-
4822
- const variantClasses$2 = {
4823
- default: "text-neutral3 bg-surface4",
4824
- success: "text-accent1 bg-accent1Dark",
4825
- error: "text-accent2 bg-accent2Dark",
4826
- info: "text-accent5 bg-accent5Dark",
4827
- warning: "text-accent6 bg-accent6Dark"
4828
- };
4829
- const iconClasses = {
4830
- default: "text-neutral3",
4831
- success: "text-accent1",
4832
- error: "text-accent2",
4833
- info: "text-accent5",
4834
- warning: "text-accent6"
4835
- };
4836
- const Badge = ({ icon, variant = "default", className, children, ...props }) => {
4837
- return /* @__PURE__ */ jsxRuntime.jsxs(
4838
- "div",
4839
- {
4840
- className: cn(
4841
- "font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",
4842
- transitions.colors,
4843
- icon ? "pl-2 pr-2.5" : "px-2.5",
4844
- variant === "default" && icon ? "bg-surface4 text-neutral5" : variantClasses$2[variant],
4845
- className
4846
- ),
4847
- ...props,
4848
- children: [
4849
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: iconClasses[variant], children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon }) }),
4850
- children
4851
- ]
4852
- }
4853
- );
4854
- };
4855
-
4856
- const Breadcrumb = ({ children, label }) => {
4857
- return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": label, children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "gap-0.5 flex items-center", children }) });
4858
- };
4859
- const Crumb = ({ className, as, isCurrent, action, ...props }) => {
4860
- const Root = as || "span";
4861
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4862
- /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex h-full shrink-0 items-center gap-1", children: [
4863
- /* @__PURE__ */ jsxRuntime.jsx(
4864
- Root,
4865
- {
4866
- "aria-current": isCurrent ? "page" : void 0,
4867
- className: cn(
4868
- "text-ui-md leading-ui-md flex items-center gap-2",
4869
- transitions.colors,
4870
- isCurrent ? "text-white" : "text-neutral3 hover:text-neutral5",
4871
- className
4872
- ),
4873
- ...props
4874
- }
4875
- ),
4876
- action
4877
- ] }),
4878
- !isCurrent && /* @__PURE__ */ jsxRuntime.jsx("li", { role: "separator", className: "flex h-full items-center", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: cn("text-neutral2", transitions.colors), children: /* @__PURE__ */ jsxRuntime.jsx(SlashIcon, {}) }) })
4879
- ] });
4880
- };
4881
-
4882
- function flattenSchemaToVariables(schema, maxDepth = 5) {
4883
- if (!schema?.properties) {
4884
- return [];
4885
- }
4886
- const results = [];
4887
- function processProperty(property, path, depth) {
4888
- if (depth > maxDepth) {
4889
- return;
4890
- }
4891
- const type = Array.isArray(property.type) ? property.type.join(" | ") : property.type;
4892
- results.push({
4893
- path,
4894
- label: path,
4895
- description: property.description ?? property.title,
4896
- type
4897
- });
4898
- if (property.properties) {
4899
- for (const [key, nestedProperty] of Object.entries(property.properties)) {
4900
- processProperty(nestedProperty, `${path}.${key}`, depth + 1);
4901
- }
4902
- }
4903
- if (property.items?.properties) {
4904
- for (const [key, itemProperty] of Object.entries(property.items.properties)) {
4905
- processProperty(itemProperty, `${path}[].${key}`, depth + 1);
4906
- }
4907
- }
4908
- }
4909
- for (const [key, property] of Object.entries(schema.properties)) {
4910
- processProperty(property, key, 1);
4911
- }
4912
- return results;
4913
- }
4914
-
4915
- function createVariableAutocomplete(schema) {
4916
- const variables = flattenSchemaToVariables(schema);
4917
- return autocomplete.autocompletion({
4918
- override: [createVariableCompletionSource(variables)],
4919
- defaultKeymap: true,
4920
- closeOnBlur: true,
4921
- icons: false
4922
- });
4923
- }
4924
- function createVariableCompletionSource(variables) {
4925
- return (context) => {
4926
- const beforeCursor = context.state.sliceDoc(Math.max(0, context.pos - 50), context.pos);
4927
- const match = beforeCursor.match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);
4928
- if (!match) {
4929
- return null;
4930
- }
4931
- const prefix = match[1] ?? "";
4932
- const startPos = context.pos - prefix.length;
4933
- const filteredVariables = prefix ? variables.filter((v) => v.path.toLowerCase().startsWith(prefix.toLowerCase())) : variables;
4934
- if (filteredVariables.length === 0) {
4935
- return null;
4936
- }
4937
- const completions = filteredVariables.map((variable) => ({
4938
- label: variable.path,
4939
- displayLabel: variable.path,
4940
- detail: variable.type,
4941
- info: variable.description,
4942
- apply: (view, completion, from, to) => {
4943
- const afterCursor = view.state.sliceDoc(to, to + 2);
4944
- const hasClosingBraces = afterCursor === "}}";
4945
- const insertText = hasClosingBraces ? completion.label : `${completion.label}}}`;
4946
- view.dispatch({
4947
- changes: { from, to, insert: insertText },
4948
- selection: { anchor: from + insertText.length }
4949
- });
4950
- }
4951
- }));
4952
- return {
4953
- from: startPos,
4954
- options: completions,
4955
- validFor: /^[a-zA-Z0-9_.\[\]]*$/
4956
- };
4957
- };
4958
- }
4959
-
4960
- const VARIABLE_PATTERN = /\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g;
4961
- const variableDecoration = view.Decoration.mark({
4962
- class: "cm-variable-highlight"
4963
- });
4964
- const variableMatcher = new view.MatchDecorator({
4965
- regexp: VARIABLE_PATTERN,
4966
- decoration: () => variableDecoration
4967
- });
4968
- const variableHighlightPlugin = view.ViewPlugin.fromClass(
4969
- class {
4970
- decorations;
4971
- constructor(view) {
4972
- this.decorations = variableMatcher.createDeco(view);
4973
- }
4974
- update(update) {
4975
- this.decorations = variableMatcher.updateDeco(update, this.decorations);
4976
- }
4977
- },
4978
- {
4979
- decorations: (v) => v.decorations
4980
- }
4981
- );
4982
- const variableHighlight = variableHighlightPlugin;
4983
-
4984
4948
  const defaultOptions = {
4985
4949
  duration: 5e3,
4986
4950
  cancel: {
@@ -7164,7 +7128,7 @@ const iconSizeMap = {
7164
7128
  lg: "lg",
7165
7129
  default: "default"
7166
7130
  };
7167
- const variantClasses$1 = {
7131
+ const variantClasses = {
7168
7132
  default: "bg-surface2 hover:bg-surface4 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",
7169
7133
  light: "bg-surface3 hover:bg-surface5 text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",
7170
7134
  outline: "bg-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",
@@ -7184,7 +7148,7 @@ const IconButton = React.forwardRef(
7184
7148
  className: cn(
7185
7149
  baseButtonStyles,
7186
7150
  formElementFocus,
7187
- variantClasses$1[variant],
7151
+ variantClasses[variant],
7188
7152
  sizeClasses$3[size],
7189
7153
  disabled && "active:scale-100",
7190
7154
  className
@@ -11512,48 +11476,64 @@ function getToPreviousItemFn({ entries, id, update }) {
11512
11476
  }
11513
11477
 
11514
11478
  function NoticeButton(props) {
11515
- return /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "md", variant: "ghost", ...props });
11516
- }
11517
-
11518
- function NoticeColumn({ children, className }) {
11519
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("grid gap-1 ", className), children });
11479
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "self-start", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", variant: "ghost", ...props }) });
11520
11480
  }
11521
11481
 
11522
11482
  function NoticeMessage({ children, className }) {
11523
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1 text-sm ", className), children });
11483
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("text-ui-md leading-ui-md", className), children });
11524
11484
  }
11525
11485
 
11526
- const variantClasses = {
11527
- warning: "bg-[#352f26] ",
11528
- destructive: "bg-accent2/20",
11529
- info: "bg-accent5/20",
11530
- success: "bg-accent1/15"
11486
+ const variantConfig = {
11487
+ success: {
11488
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LightbulbIcon, {}),
11489
+ classes: "bg-notice-success/20 border-notice-success/20 text-notice-success-fg"
11490
+ },
11491
+ destructive: {
11492
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.OctagonAlertIcon, {}),
11493
+ classes: "bg-notice-destructive/20 border-notice-destructive/20 text-notice-destructive-fg"
11494
+ },
11495
+ warning: {
11496
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TriangleAlertIcon, {}),
11497
+ classes: "bg-notice-warning/20 border-notice-warning/20 text-notice-warning-fg"
11498
+ },
11499
+ info: {
11500
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, {}),
11501
+ classes: "bg-notice-info/20 border-notice-info/20 text-notice-info-fg"
11502
+ },
11503
+ note: {
11504
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileTextIcon, {}),
11505
+ classes: "bg-notice-note border-border1 text-notice-note-fg"
11506
+ }
11531
11507
  };
11532
- function NoticeRoot({ children, variant, className }) {
11533
- return /* @__PURE__ */ jsxRuntime.jsx(
11508
+ function NoticeRoot({ variant, title, icon, action, children, className }) {
11509
+ const { icon: defaultIcon, classes } = variantConfig[variant];
11510
+ return /* @__PURE__ */ jsxRuntime.jsxs(
11534
11511
  "div",
11535
11512
  {
11536
11513
  className: cn(
11537
- "flex items-center gap-3 px-4 pr-3 py-3 rounded-lg text-neutral4/80",
11514
+ "relative @container flex flex-col gap-4 rounded-2xl border p-3",
11538
11515
  "animate-in fade-in-0 slide-in-from-top-2 duration-200",
11539
- "[>svg]:w-[1em] [&>dvg]:h-[1em] [&>svg]:opacity-50 [&>svg]:text-neutral4",
11540
- variantClasses[variant],
11516
+ classes,
11541
11517
  className
11542
11518
  ),
11543
- children
11519
+ children: [
11520
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-4 items-center gap-2 [&>svg]:size-4", children: [
11521
+ icon ?? defaultIcon,
11522
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-sm font-medium uppercase tracking-wide leading-none", children: title })
11523
+ ] }),
11524
+ action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-2 top-2 hidden @md:block", children: action }),
11525
+ (children || action) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-5", children: [
11526
+ children,
11527
+ action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "self-start @md:hidden", children: action })
11528
+ ] })
11529
+ ]
11544
11530
  }
11545
11531
  );
11546
11532
  }
11547
11533
 
11548
- function NoticeTitle({ children, className }) {
11549
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1 text-sm font-semibold", className), children });
11550
- }
11551
-
11552
11534
  const Notice = Object.assign(NoticeRoot, {
11553
11535
  Message: NoticeMessage,
11554
- Button: NoticeButton,
11555
- Title: NoticeTitle,
11556
- Column: NoticeColumn
11536
+ Button: NoticeButton
11557
11537
  });
11558
11538
 
11559
11539
  const TreeContext = React__namespace.createContext(null);
@@ -15493,16 +15473,7 @@ function ScoresCardView({ data, isLoading, isError }) {
15493
15473
  }));
15494
15474
  }, [data?.scorerNames]);
15495
15475
  return /* @__PURE__ */ jsxRuntime.jsxs(MetricsCard, { children: [
15496
- /* @__PURE__ */ jsxRuntime.jsxs(MetricsCard.TopBar, { children: [
15497
- /* @__PURE__ */ jsxRuntime.jsx(MetricsCard.TitleAndDescription, { title: "Scores", description: "Evaluation scorer performance." }),
15498
- hasData && /* @__PURE__ */ jsxRuntime.jsx(
15499
- MetricsCard.Summary,
15500
- {
15501
- value: data?.avgScore != null ? `avg ${data.avgScore}` : "—",
15502
- label: "Across all scorers"
15503
- }
15504
- )
15505
- ] }),
15476
+ /* @__PURE__ */ jsxRuntime.jsx(MetricsCard.TopBar, { children: /* @__PURE__ */ jsxRuntime.jsx(MetricsCard.TitleAndDescription, { title: "Scores", description: "Evaluation scorer performance." }) }),
15506
15477
  isLoading ? /* @__PURE__ */ jsxRuntime.jsx(MetricsCard.Loading, {}) : isError ? /* @__PURE__ */ jsxRuntime.jsx(MetricsCard.Error, { message: "Failed to load scores data" }) : /* @__PURE__ */ jsxRuntime.jsx(MetricsCard.Content, { children: !hasData ? /* @__PURE__ */ jsxRuntime.jsx(MetricsCard.NoData, { message: "No scores data yet" }) : /* @__PURE__ */ jsxRuntime.jsxs(Tabs, { defaultTab: "over-time", className: "overflow-visible", children: [
15507
15478
  /* @__PURE__ */ jsxRuntime.jsxs(TabList, { children: [
15508
15479
  /* @__PURE__ */ jsxRuntime.jsx(Tab, { value: "over-time", children: "Over Time" }),
@@ -15665,41 +15636,6 @@ function useAgentRunsKpiMetrics() {
15665
15636
  });
15666
15637
  }
15667
15638
 
15668
- function useAvgScoreKpiMetrics() {
15669
- const client = react.useMastraClient();
15670
- const { datePreset, customRange, timestamp } = useMetricsFilters();
15671
- return reactQuery.useQuery({
15672
- queryKey: ["metrics", "avg-score-kpi", datePreset, customRange],
15673
- queryFn: async () => {
15674
- const scorersMap = await client.listScorers();
15675
- const scorerIds = Object.keys(scorersMap ?? {});
15676
- if (scorerIds.length === 0) {
15677
- return { value: null, previousValue: null, changePercent: null };
15678
- }
15679
- const filters = {
15680
- timestamp: { start: timestamp.start, end: timestamp.end }
15681
- };
15682
- const results = await Promise.all(
15683
- scorerIds.map(async (scorerId) => {
15684
- const [avg2, count] = await Promise.all([
15685
- client.getScoreAggregate({ scorerId, aggregation: "avg", filters }),
15686
- client.getScoreAggregate({ scorerId, aggregation: "count", filters })
15687
- ]);
15688
- return { avg: avg2.value ?? 0, count: count.value ?? 0 };
15689
- })
15690
- );
15691
- const withData = results.filter((r) => r.count > 0);
15692
- if (withData.length === 0) {
15693
- return { value: null, previousValue: null, changePercent: null };
15694
- }
15695
- const totalCount = withData.reduce((sum, r) => sum + r.count, 0);
15696
- const weightedSum = withData.reduce((sum, r) => sum + r.avg * r.count, 0);
15697
- const avg = weightedSum / totalCount;
15698
- return { value: Math.round(avg * 100) / 100, previousValue: null, changePercent: null };
15699
- }
15700
- });
15701
- }
15702
-
15703
15639
  function useModelCostKpiMetrics() {
15704
15640
  const client = react.useMastraClient();
15705
15641
  const { datePreset, customRange, timestamp } = useMetricsFilters();
@@ -17035,10 +16971,7 @@ function SpanDataPanelContent({
17035
16971
  const durationMs = span.startedAt && span.endedAt ? new Date(span.endedAt).getTime() - new Date(span.startedAt).getTime() : null;
17036
16972
  const usage = span.attributes?.usage;
17037
16973
  const detailsBody = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17038
- isTokenLimitExceeded(span) && /* @__PURE__ */ jsxRuntime.jsxs(Alert, { variant: "warning", className: "mb-3", children: [
17039
- /* @__PURE__ */ jsxRuntime.jsx(AlertTitle, { children: "Token Limit Exceeded" }),
17040
- /* @__PURE__ */ jsxRuntime.jsx(AlertDescription, { as: "p", children: getTokenLimitMessage(span) })
17041
- ] }),
16974
+ isTokenLimitExceeded(span) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-3", children: /* @__PURE__ */ jsxRuntime.jsx(Notice, { variant: "warning", title: "Token Limit Exceeded", children: /* @__PURE__ */ jsxRuntime.jsx(Notice.Message, { children: getTokenLimitMessage(span) }) }) }),
17042
16975
  usage && /* @__PURE__ */ jsxRuntime.jsx(SpanTokenUsage, { usage, className: "mb-3" }),
17043
16976
  /* @__PURE__ */ jsxRuntime.jsxs(DataKeysAndValues, { children: [
17044
16977
  span.parentSpanId == null && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -19300,10 +19233,7 @@ exports.AgentCoinIcon = AgentCoinIcon;
19300
19233
  exports.AgentIcon = AgentIcon;
19301
19234
  exports.AgentNetworkCoinIcon = AgentNetworkCoinIcon;
19302
19235
  exports.AiIcon = AiIcon;
19303
- exports.Alert = Alert;
19304
- exports.AlertDescription = AlertDescription;
19305
19236
  exports.AlertDialog = AlertDialog;
19306
- exports.AlertTitle = AlertTitle;
19307
19237
  exports.AmazonIcon = AmazonIcon;
19308
19238
  exports.AnthropicChatIcon = AnthropicChatIcon;
19309
19239
  exports.AnthropicMessagesIcon = AnthropicMessagesIcon;
@@ -19719,7 +19649,6 @@ exports.transitions = transitions;
19719
19649
  exports.truncateString = truncateString;
19720
19650
  exports.useAgentRunsKpiMetrics = useAgentRunsKpiMetrics;
19721
19651
  exports.useAutoscroll = useAutoscroll;
19722
- exports.useAvgScoreKpiMetrics = useAvgScoreKpiMetrics;
19723
19652
  exports.useCodemirrorTheme = useCodemirrorTheme$3;
19724
19653
  exports.useCopyToClipboard = useCopyToClipboard;
19725
19654
  exports.useEntityNames = useEntityNames;