@mastra/playground-ui 6.1.3-alpha.1 → 6.1.4-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,33 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 6.1.4-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - fix minor playground stuff for observability ([#7765](https://github.com/mastra-ai/mastra/pull/7765))
8
+
9
+ - Handle zod intersections in dynamic form ([#7768](https://github.com/mastra-ai/mastra/pull/7768))
10
+
11
+ - Playground ui -pass runtimeContext to client SDK get methods ([#7767](https://github.com/mastra-ai/mastra/pull/7767))
12
+
13
+ - Updated dependencies [[`5802bf5`](https://github.com/mastra-ai/mastra/commit/5802bf57f6182e4b67c28d7d91abed349a8d14f3), [`5bda53a`](https://github.com/mastra-ai/mastra/commit/5bda53a9747bfa7d876d754fc92c83a06e503f62), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`f0ab020`](https://github.com/mastra-ai/mastra/commit/f0ab02034532a4afb71a1ef4fe243f9a8dffde84), [`cdc63c0`](https://github.com/mastra-ai/mastra/commit/cdc63c0d2725ee0191aa7f5287ccf83629019748), [`e6e37a0`](https://github.com/mastra-ai/mastra/commit/e6e37a05ec2b6de4f34ee77bb2dd08edfae4ae4a), [`1a1fbe6`](https://github.com/mastra-ai/mastra/commit/1a1fbe66efb7d94abc373ed0dd9676adb8122454), [`36f39c0`](https://github.com/mastra-ai/mastra/commit/36f39c00dc794952dc3c11aab91c2fa8bca74b11)]:
14
+ - @mastra/core@0.16.4-alpha.0
15
+ - @mastra/client-js@0.12.4-alpha.0
16
+
17
+ ## 6.1.3
18
+
19
+ ### Patch Changes
20
+
21
+ - AN packages ([#7711](https://github.com/mastra-ai/mastra/pull/7711))
22
+
23
+ - Client SDK Agents, Mastra server - support runtimeContext with GET requests ([#7734](https://github.com/mastra-ai/mastra/pull/7734))
24
+
25
+ - fix playground UI issue about dynmic workflow exec in agent thread ([#7665](https://github.com/mastra-ai/mastra/pull/7665))
26
+
27
+ - Updated dependencies [[`b4379f7`](https://github.com/mastra-ai/mastra/commit/b4379f703fd74474f253420e8c3a684f2c4b2f8e), [`2a6585f`](https://github.com/mastra-ai/mastra/commit/2a6585f7cb71f023f805d521d1c3c95fb9a3aa59), [`3d26e83`](https://github.com/mastra-ai/mastra/commit/3d26e8353a945719028f087cc6ac4b06f0ce27d2), [`dd9119b`](https://github.com/mastra-ai/mastra/commit/dd9119b175a8f389082f75c12750e51f96d65dca), [`d34aaa1`](https://github.com/mastra-ai/mastra/commit/d34aaa1da5d3c5f991740f59e2fe6d28d3e2dd91), [`56e55d1`](https://github.com/mastra-ai/mastra/commit/56e55d1e9eb63e7d9e41aa46e012aae471256812), [`ce1e580`](https://github.com/mastra-ai/mastra/commit/ce1e580f6391e94a0c6816a9c5db0a21566a262f), [`b2babfa`](https://github.com/mastra-ai/mastra/commit/b2babfa9e75b22f2759179e71d8473f6dc5421ed), [`d8c3ba5`](https://github.com/mastra-ai/mastra/commit/d8c3ba516f4173282d293f7e64769cfc8738d360), [`a566c4e`](https://github.com/mastra-ai/mastra/commit/a566c4e92d86c1671707c54359b1d33934f7cc13), [`0666082`](https://github.com/mastra-ai/mastra/commit/06660820230dcb1fa7c1d51c8254107afd68cd67), [`af333aa`](https://github.com/mastra-ai/mastra/commit/af333aa30fe6d1b127024b03a64736c46eddeca2), [`4c81b65`](https://github.com/mastra-ai/mastra/commit/4c81b65a28d128560bdf63bc9b8a1bddd4884812), [`3863c52`](https://github.com/mastra-ai/mastra/commit/3863c52d44b4e5779968b802d977e87adf939d8e), [`6424c7e`](https://github.com/mastra-ai/mastra/commit/6424c7ec38b6921d66212431db1e0958f441b2a7), [`db94750`](https://github.com/mastra-ai/mastra/commit/db94750a41fd29b43eb1f7ce8e97ba8b9978c91b), [`a66a371`](https://github.com/mastra-ai/mastra/commit/a66a3716b00553d7f01842be9deb34f720b10fab), [`779d469`](https://github.com/mastra-ai/mastra/commit/779d469366bb9f7fcb6d1638fdabb9f3acc49218), [`69fc3cd`](https://github.com/mastra-ai/mastra/commit/69fc3cd0fd814901785bdcf49bf536ab1e7fd975)]:
28
+ - @mastra/core@0.16.3
29
+ - @mastra/client-js@0.12.3
30
+
3
31
  ## 6.1.3-alpha.1
4
32
 
5
33
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -22,6 +22,8 @@ const CodeMirror = require('@uiw/react-codemirror');
22
22
  const sonner = require('sonner');
23
23
  const DialogPrimitive = require('@radix-ui/react-dialog');
24
24
  const useDebounce = require('use-debounce');
25
+ const zustand = require('zustand');
26
+ const middleware = require('zustand/middleware');
25
27
  const reactQuery = require('@tanstack/react-query');
26
28
  const react = require('@xyflow/react');
27
29
  require('@xyflow/react/dist/style.css');
@@ -48,8 +50,6 @@ const v4 = require('@autoform/zod/v4');
48
50
  const v3 = require('zod/v3');
49
51
  const reactCodeBlock = require('react-code-block');
50
52
  const SliderPrimitive = require('@radix-ui/react-slider');
51
- const zustand = require('zustand');
52
- const middleware = require('zustand/middleware');
53
53
  const RadioGroupPrimitive = require('@radix-ui/react-radio-group');
54
54
  const reactTable = require('@tanstack/react-table');
55
55
  const shallow = require('zustand/shallow');
@@ -4547,11 +4547,24 @@ function Skeleton({ className, ...props }) {
4547
4547
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("animate-pulse rounded-md bg-muted/50", className), ...props });
4548
4548
  }
4549
4549
 
4550
+ const usePlaygroundStore = zustand.create()(
4551
+ middleware.persist(
4552
+ (set) => ({
4553
+ runtimeContext: {},
4554
+ setRuntimeContext: (runtimeContext) => set({ runtimeContext })
4555
+ }),
4556
+ {
4557
+ name: "mastra-playground-store"
4558
+ }
4559
+ )
4560
+ );
4561
+
4550
4562
  const useWorkflow = (workflowId) => {
4551
4563
  const client = useMastraClient();
4564
+ const { runtimeContext } = usePlaygroundStore();
4552
4565
  return reactQuery.useQuery({
4553
4566
  queryKey: ["workflow", workflowId],
4554
- queryFn: () => client.getWorkflow(workflowId).details(),
4567
+ queryFn: () => client.getWorkflow(workflowId).details(runtimeContext),
4555
4568
  retry: false,
4556
4569
  refetchOnWindowFocus: false
4557
4570
  });
@@ -4569,7 +4582,8 @@ const useLegacyWorkflow = (workflowId) => {
4569
4582
  setIsLoading(false);
4570
4583
  return;
4571
4584
  }
4572
- const res = await client.getLegacyWorkflow(workflowId).details();
4585
+ const { runtimeContext } = usePlaygroundStore.getState();
4586
+ const res = await client.getLegacyWorkflow(workflowId).details(runtimeContext);
4573
4587
  if (!res) {
4574
4588
  setLegacyWorkflow(null);
4575
4589
  console.error("Error fetching legacy workflow");
@@ -4580,7 +4594,7 @@ const useLegacyWorkflow = (workflowId) => {
4580
4594
  const stepsWithWorkflow = await Promise.all(
4581
4595
  Object.values(steps)?.map(async (step) => {
4582
4596
  if (!step.workflowId) return step;
4583
- const wFlow = await client.getLegacyWorkflow(step.workflowId).details();
4597
+ const wFlow = await client.getLegacyWorkflow(step.workflowId).details(runtimeContext);
4584
4598
  if (!wFlow) return step;
4585
4599
  return { ...step, stepGraph: wFlow.stepGraph, stepSubscriberGraph: wFlow.stepSubscriberGraph };
4586
4600
  })
@@ -7174,6 +7188,7 @@ function inferFieldType(schema, fieldConfig) {
7174
7188
  return fieldConfig.fieldType;
7175
7189
  }
7176
7190
  if (schema instanceof z.z.ZodObject) return "object";
7191
+ if (schema instanceof z.z.ZodIntersection) return "object";
7177
7192
  if (schema instanceof z.z.ZodNumber) return "number";
7178
7193
  if (schema instanceof z.z.ZodBoolean) return "boolean";
7179
7194
  if (schema instanceof z.z.ZodString) {
@@ -7210,6 +7225,15 @@ function parseField(key, schema) {
7210
7225
  if (baseSchema instanceof v3.z.ZodObject || baseSchema instanceof z.z.ZodObject) {
7211
7226
  subSchema = Object.entries(baseSchema.shape).map(([key2, field]) => parseField(key2, field));
7212
7227
  }
7228
+ if (baseSchema instanceof v3.z.ZodIntersection || baseSchema instanceof z.z.ZodIntersection) {
7229
+ const subSchemaLeft = Object.entries(baseSchema._def.left.shape).map(
7230
+ ([key2, field]) => parseField(key2, field)
7231
+ );
7232
+ const subSchemaRight = Object.entries(baseSchema._def.right.shape).map(
7233
+ ([key2, field]) => parseField(key2, field)
7234
+ );
7235
+ subSchema = [...subSchemaLeft, ...subSchemaRight];
7236
+ }
7213
7237
  if (baseSchema instanceof v3.z.ZodArray || baseSchema instanceof z.z.ZodArray) {
7214
7238
  subSchema = [parseField("0", baseSchema._zod.def.element)];
7215
7239
  }
@@ -7257,6 +7281,9 @@ function isEmptyZodObject(schema) {
7257
7281
  if (schema instanceof z.ZodObject) {
7258
7282
  return Object.keys(schema.shape).length === 0;
7259
7283
  }
7284
+ if (schema instanceof z.ZodIntersection) {
7285
+ return isEmptyZodObject(schema._def.left) || isEmptyZodObject(schema._def.right);
7286
+ }
7260
7287
  return false;
7261
7288
  }
7262
7289
  function DynamicForm({
@@ -7863,18 +7890,6 @@ function WorkflowGraph({ workflowId, onShowTrace, workflow, isLoading, onSendEve
7863
7890
  );
7864
7891
  }
7865
7892
 
7866
- const usePlaygroundStore = zustand.create()(
7867
- middleware.persist(
7868
- (set) => ({
7869
- runtimeContext: {},
7870
- setRuntimeContext: (runtimeContext) => set({ runtimeContext })
7871
- }),
7872
- {
7873
- name: "mastra-playground-store"
7874
- }
7875
- )
7876
- );
7877
-
7878
7893
  const WorkflowStatus = ({ stepId, status, result }) => {
7879
7894
  return /* @__PURE__ */ jsxRuntime.jsx(
7880
7895
  WorkflowCard,
@@ -15324,9 +15339,11 @@ function RelationWrapper({ description, children }) {
15324
15339
  }
15325
15340
 
15326
15341
  function EntryListTextCell({ children, isLoading }) {
15327
- const randomWidth = React.useMemo(() => {
15328
- return Math.floor(Math.random() * (90 - 50 + 1)) + 50;
15342
+ const [randomWidth, setRandomWidth] = React.useState(void 0);
15343
+ React.useEffect(() => {
15344
+ setRandomWidth(Math.floor(Math.random() * (90 - 50 + 1)) + 50);
15329
15345
  }, []);
15346
+ if (!randomWidth) return null;
15330
15347
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon4 text-[0.875rem] truncate ", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
15331
15348
  "div",
15332
15349
  {
@@ -15462,9 +15479,10 @@ function EntryList({
15462
15479
  onClick: isLoading ? void 0 : onItemClick,
15463
15480
  columns,
15464
15481
  isLoading,
15465
- children: (columns || []).map((col) => {
15482
+ children: (columns || []).map((col, index) => {
15466
15483
  const isValidReactElement = React.isValidElement(item?.[col.name]);
15467
- return isValidReactElement ? item?.[col.name] : /* @__PURE__ */ jsxRuntime.jsx(EntryListTextCell, { isLoading, children: item?.[col.name] }, col.name);
15484
+ const key = `${index}-${item.id}`;
15485
+ return isValidReactElement ? /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: item?.[col.name] }, key) : /* @__PURE__ */ jsxRuntime.jsx(EntryListTextCell, { isLoading, children: item?.[col.name] }, key);
15468
15486
  })
15469
15487
  },
15470
15488
  item.id
@@ -18031,10 +18049,14 @@ function TraceSpanUsage({ traceUsage, traceSpans = [], spanUsage, className }) {
18031
18049
  );
18032
18050
  }
18033
18051
 
18034
- function getTraceInfo(trace) {
18052
+ function getTraceInfo(trace, computeAgentsLink, computeWorkflowsLink) {
18035
18053
  if (!trace) {
18036
18054
  return [];
18037
18055
  }
18056
+ const agentsLink = computeAgentsLink ? computeAgentsLink() : "/agents";
18057
+ const workflowsLink = computeWorkflowsLink ? computeWorkflowsLink() : "/workflows";
18058
+ const agentLink = computeAgentsLink ? `${agentsLink}/${trace?.metadata?.resourceId}` : `/agents/${trace?.metadata?.resourceId}`;
18059
+ const workflowLink = computeWorkflowsLink ? `${workflowsLink}/${trace?.metadata?.resourceId}` : `/workflows/${trace?.metadata?.resourceId}`;
18038
18060
  return [
18039
18061
  {
18040
18062
  key: "entityId",
@@ -18043,7 +18065,7 @@ function getTraceInfo(trace) {
18043
18065
  {
18044
18066
  id: trace?.metadata?.resourceId,
18045
18067
  name: trace?.attributes?.agentId || trace?.attributes?.workflowId || "-",
18046
- path: trace?.attributes?.agentId ? `/agents/${trace?.metadata?.resourceId}` : trace?.attributes?.workflowId ? `/workflows/${trace?.metadata?.resourceId}` : void 0
18068
+ path: trace?.attributes?.agentId ? agentLink : trace?.attributes?.workflowId ? workflowLink : void 0
18047
18069
  }
18048
18070
  ]
18049
18071
  },
@@ -18054,7 +18076,7 @@ function getTraceInfo(trace) {
18054
18076
  {
18055
18077
  id: trace?.attributes?.agentId || trace?.attributes?.workflowId,
18056
18078
  name: trace?.attributes?.agentId ? "Agent" : trace?.attributes?.workflowId ? "Workflow" : "-",
18057
- path: trace?.attributes?.agentId ? `/agents` : trace?.attributes?.workflowId ? `/workflows` : void 0
18079
+ path: trace?.attributes?.agentId ? agentsLink : trace?.attributes?.workflowId ? workflowsLink : void 0
18058
18080
  }
18059
18081
  ]
18060
18082
  },
@@ -18190,7 +18212,9 @@ function TraceDialog({
18190
18212
  onClose,
18191
18213
  onNext,
18192
18214
  onPrevious,
18193
- isLoadingSpans
18215
+ isLoadingSpans,
18216
+ computeAgentsLink,
18217
+ computeWorkflowsLink
18194
18218
  }) {
18195
18219
  const { Link } = useLinkComponent();
18196
18220
  const [dialogIsOpen, setDialogIsOpen] = React.useState(false);
@@ -18240,7 +18264,7 @@ function TraceDialog({
18240
18264
  const currentIndex = flatSpans.findIndex((span) => span.id === selectedSpanId);
18241
18265
  return currentIndex > 0;
18242
18266
  };
18243
- const traceInfo = getTraceInfo(traceDetails);
18267
+ const traceInfo = getTraceInfo(traceDetails, computeAgentsLink, computeWorkflowsLink);
18244
18268
  const selectedSpanInfo = getSpanInfo({ span: selectedSpan, withTraceId: !combinedView, withSpanId: combinedView });
18245
18269
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18246
18270
  /* @__PURE__ */ jsxRuntime.jsxs(