@mastra/playground-ui 6.9.1 → 6.9.2-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,16 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 6.9.2-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix scorer filtering for SpanScoring, add error and info message for user ([#10164](https://github.com/mastra-ai/mastra/pull/10164))
8
+
9
+ - Updated dependencies [[`eebb7bb`](https://github.com/mastra-ai/mastra/commit/eebb7bb407c57342a3be3a2efbe68c696589feeb), [`c6e6d07`](https://github.com/mastra-ai/mastra/commit/c6e6d071ecf346a80dceab410af2c567c7e66a57), [`0e6df8f`](https://github.com/mastra-ai/mastra/commit/0e6df8f66340992cb1b319834657deb17368de52), [`6295fd7`](https://github.com/mastra-ai/mastra/commit/6295fd783d49075d5bf2c18ff9486e94d36aaa56), [`d813cf7`](https://github.com/mastra-ai/mastra/commit/d813cf7251695d85cc60469058384ffa74974484)]:
10
+ - @mastra/core@0.24.2-alpha.0
11
+ - @mastra/client-js@0.16.11-alpha.0
12
+ - @mastra/react@0.0.17-alpha.0
13
+
3
14
  ## 6.9.1
4
15
 
5
16
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -13495,10 +13495,18 @@ function getShortId(id) {
13495
13495
  return id.slice(0, 8);
13496
13496
  }
13497
13497
 
13498
- function Notification({ children, className, isVisible, autoDismiss = true, dismissTime = 5e3 }) {
13498
+ function Notification({
13499
+ children,
13500
+ className,
13501
+ isVisible,
13502
+ autoDismiss = true,
13503
+ dismissTime = 5e3,
13504
+ dismissible = true,
13505
+ type = "info"
13506
+ }) {
13499
13507
  const [localIsVisible, setLocalIsVisible] = React.useState(isVisible);
13500
13508
  React.useEffect(() => {
13501
- if (autoDismiss && isVisible) {
13509
+ if (dismissible && autoDismiss && isVisible) {
13502
13510
  const timer = setTimeout(() => {
13503
13511
  setLocalIsVisible(false);
13504
13512
  }, dismissTime);
@@ -13513,13 +13521,27 @@ function Notification({ children, className, isVisible, autoDismiss = true, dism
13513
13521
  "div",
13514
13522
  {
13515
13523
  className: cn(
13516
- "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",
13517
- "[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-50",
13524
+ "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",
13525
+ {
13526
+ "bg-red-900/10 border border-red-900": type === "error"
13527
+ },
13518
13528
  className
13519
13529
  ),
13520
13530
  children: [
13521
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-[0.5rem] items-center", children }),
13522
- /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onClick: () => setLocalIsVisible(false), children: [
13531
+ /* @__PURE__ */ jsxRuntime.jsx(
13532
+ "div",
13533
+ {
13534
+ className: cn(
13535
+ "flex gap-[0.5rem] items-start",
13536
+ "[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-70 [&>svg]:translate-y-[0.2em]",
13537
+ {
13538
+ "[&>svg]:text-red-400": type === "error"
13539
+ }
13540
+ ),
13541
+ children
13542
+ }
13543
+ ),
13544
+ dismissible && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onClick: () => setLocalIsVisible(false), children: [
13523
13545
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
13524
13546
  /* @__PURE__ */ jsxRuntime.jsx(VisuallyHidden.VisuallyHidden, { children: "Dismiss" })
13525
13547
  ] })
@@ -19171,7 +19193,15 @@ function SpanTabs({
19171
19193
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleGaugeIcon, {}),
19172
19194
  " Scoring"
19173
19195
  ] }) }),
19174
- /* @__PURE__ */ jsxRuntime.jsx(SpanScoring, { traceId: trace?.traceId, spanId: span?.spanId, entityType })
19196
+ /* @__PURE__ */ jsxRuntime.jsx(
19197
+ SpanScoring,
19198
+ {
19199
+ traceId: trace?.traceId,
19200
+ isTopLevelSpan: span?.parentSpanId === null,
19201
+ spanId: span?.spanId,
19202
+ entityType
19203
+ }
19204
+ )
19175
19205
  ] }),
19176
19206
  /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
19177
19207
  /* @__PURE__ */ jsxRuntime.jsx(Section.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(Section.Heading, { children: [
@@ -19768,8 +19798,8 @@ const useTriggerScorer = () => {
19768
19798
  });
19769
19799
  };
19770
19800
 
19771
- const SpanScoring = ({ traceId, spanId, entityType }) => {
19772
- const { data: scorers = {}, isLoading } = useScorers();
19801
+ const SpanScoring = ({ traceId, spanId, entityType, isTopLevelSpan }) => {
19802
+ const { data: scorers = {}, isLoading, error } = useScorers();
19773
19803
  const [selectedScorer, setSelectedScorer] = React.useState(null);
19774
19804
  const { mutate: triggerScorer, isPending, isSuccess } = useTriggerScorer();
19775
19805
  const [notificationIsVisible, setNotificationIsVisible] = React.useState(false);
@@ -19785,7 +19815,7 @@ const SpanScoring = ({ traceId, spanId, entityType }) => {
19785
19815
  isRegistered: scorer.isRegistered,
19786
19816
  type: scorer.scorer.config.type
19787
19817
  })).filter((scorer) => scorer.isRegistered);
19788
- if (entityType !== "Agent" || spanId) {
19818
+ if (entityType !== "Agent" || !isTopLevelSpan) {
19789
19819
  scorerList = scorerList.filter((scorer) => scorer.type !== "agent");
19790
19820
  }
19791
19821
  const isWaiting = isPending || isLoading;
@@ -19804,6 +19834,19 @@ const SpanScoring = ({ traceId, spanId, entityType }) => {
19804
19834
  setNotificationIsVisible(false);
19805
19835
  };
19806
19836
  const selectedScorerDescription = scorerList.find((s) => s.name === selectedScorer)?.description || "";
19837
+ if (error) {
19838
+ return /* @__PURE__ */ jsxRuntime.jsxs(Notification, { isVisible: true, autoDismiss: false, type: "error", children: [
19839
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, {}),
19840
+ " ",
19841
+ error?.message ? error.message : "Failed to load scorers."
19842
+ ] });
19843
+ }
19844
+ if (scorerList.length === 0) {
19845
+ return /* @__PURE__ */ jsxRuntime.jsxs(Notification, { isVisible: true, dismissible: false, children: [
19846
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, {}),
19847
+ " No eligible scorers have been defined to run."
19848
+ ] });
19849
+ }
19807
19850
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
19808
19851
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[3fr_1fr] gap-[1rem] items-start", children: [
19809
19852
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-[0.5rem]", children: [