@mastra/playground-ui 6.9.1 → 6.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -13461,10 +13461,18 @@ function getShortId(id) {
13461
13461
  return id.slice(0, 8);
13462
13462
  }
13463
13463
 
13464
- function Notification({ children, className, isVisible, autoDismiss = true, dismissTime = 5e3 }) {
13464
+ function Notification({
13465
+ children,
13466
+ className,
13467
+ isVisible,
13468
+ autoDismiss = true,
13469
+ dismissTime = 5e3,
13470
+ dismissible = true,
13471
+ type = "info"
13472
+ }) {
13465
13473
  const [localIsVisible, setLocalIsVisible] = useState(isVisible);
13466
13474
  useEffect(() => {
13467
- if (autoDismiss && isVisible) {
13475
+ if (dismissible && autoDismiss && isVisible) {
13468
13476
  const timer = setTimeout(() => {
13469
13477
  setLocalIsVisible(false);
13470
13478
  }, dismissTime);
@@ -13479,13 +13487,27 @@ function Notification({ children, className, isVisible, autoDismiss = true, dism
13479
13487
  "div",
13480
13488
  {
13481
13489
  className: cn(
13482
- "grid grid-cols-[1fr_auto] gap-[0.5rem] rounded-l bg-white/5 p-[1.5rem] py-[1rem] text-[0.875rem] text-icon3 items-center",
13483
- "[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-50",
13490
+ "grid grid-cols-[1fr_auto] gap-[0.5rem] rounded-lg bg-white/5 p-[1.5rem] py-[1rem] text-[0.875rem] text-icon3 items-center",
13491
+ {
13492
+ "bg-red-900/10 border border-red-900": type === "error"
13493
+ },
13484
13494
  className
13485
13495
  ),
13486
13496
  children: [
13487
- /* @__PURE__ */ jsx("div", { className: "flex gap-[0.5rem] items-center", children }),
13488
- /* @__PURE__ */ jsxs(Button, { variant: "ghost", onClick: () => setLocalIsVisible(false), children: [
13497
+ /* @__PURE__ */ jsx(
13498
+ "div",
13499
+ {
13500
+ className: cn(
13501
+ "flex gap-[0.5rem] items-start",
13502
+ "[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-70 [&>svg]:translate-y-[0.2em]",
13503
+ {
13504
+ "[&>svg]:text-red-400": type === "error"
13505
+ }
13506
+ ),
13507
+ children
13508
+ }
13509
+ ),
13510
+ dismissible && /* @__PURE__ */ jsxs(Button, { variant: "ghost", onClick: () => setLocalIsVisible(false), children: [
13489
13511
  /* @__PURE__ */ jsx(XIcon, {}),
13490
13512
  /* @__PURE__ */ jsx(VisuallyHidden$1, { children: "Dismiss" })
13491
13513
  ] })
@@ -19137,7 +19159,15 @@ function SpanTabs({
19137
19159
  /* @__PURE__ */ jsx(CircleGaugeIcon, {}),
19138
19160
  " Scoring"
19139
19161
  ] }) }),
19140
- /* @__PURE__ */ jsx(SpanScoring, { traceId: trace?.traceId, spanId: span?.spanId, entityType })
19162
+ /* @__PURE__ */ jsx(
19163
+ SpanScoring,
19164
+ {
19165
+ traceId: trace?.traceId,
19166
+ isTopLevelSpan: span?.parentSpanId === null,
19167
+ spanId: span?.spanId,
19168
+ entityType
19169
+ }
19170
+ )
19141
19171
  ] }),
19142
19172
  /* @__PURE__ */ jsxs(Section, { children: [
19143
19173
  /* @__PURE__ */ jsx(Section.Header, { children: /* @__PURE__ */ jsxs(Section.Heading, { children: [
@@ -19734,8 +19764,8 @@ const useTriggerScorer = () => {
19734
19764
  });
19735
19765
  };
19736
19766
 
19737
- const SpanScoring = ({ traceId, spanId, entityType }) => {
19738
- const { data: scorers = {}, isLoading } = useScorers();
19767
+ const SpanScoring = ({ traceId, spanId, entityType, isTopLevelSpan }) => {
19768
+ const { data: scorers = {}, isLoading, error } = useScorers();
19739
19769
  const [selectedScorer, setSelectedScorer] = useState(null);
19740
19770
  const { mutate: triggerScorer, isPending, isSuccess } = useTriggerScorer();
19741
19771
  const [notificationIsVisible, setNotificationIsVisible] = useState(false);
@@ -19751,7 +19781,7 @@ const SpanScoring = ({ traceId, spanId, entityType }) => {
19751
19781
  isRegistered: scorer.isRegistered,
19752
19782
  type: scorer.scorer.config.type
19753
19783
  })).filter((scorer) => scorer.isRegistered);
19754
- if (entityType !== "Agent" || spanId) {
19784
+ if (entityType !== "Agent" || !isTopLevelSpan) {
19755
19785
  scorerList = scorerList.filter((scorer) => scorer.type !== "agent");
19756
19786
  }
19757
19787
  const isWaiting = isPending || isLoading;
@@ -19770,6 +19800,19 @@ const SpanScoring = ({ traceId, spanId, entityType }) => {
19770
19800
  setNotificationIsVisible(false);
19771
19801
  };
19772
19802
  const selectedScorerDescription = scorerList.find((s) => s.name === selectedScorer)?.description || "";
19803
+ if (error) {
19804
+ return /* @__PURE__ */ jsxs(Notification, { isVisible: true, autoDismiss: false, type: "error", children: [
19805
+ /* @__PURE__ */ jsx(InfoIcon$1, {}),
19806
+ " ",
19807
+ error?.message ? error.message : "Failed to load scorers."
19808
+ ] });
19809
+ }
19810
+ if (scorerList.length === 0) {
19811
+ return /* @__PURE__ */ jsxs(Notification, { isVisible: true, dismissible: false, children: [
19812
+ /* @__PURE__ */ jsx(InfoIcon$1, {}),
19813
+ " No eligible scorers have been defined to run."
19814
+ ] });
19815
+ }
19773
19816
  return /* @__PURE__ */ jsxs("div", { children: [
19774
19817
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[3fr_1fr] gap-[1rem] items-start", children: [
19775
19818
  /* @__PURE__ */ jsxs("div", { className: "grid gap-[0.5rem]", children: [