@mastra/playground-ui 7.0.0-beta.0 → 7.0.0-beta.1

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/index.cjs.js +330 -598
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.es.js +334 -592
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/src/components/syntax-highlighter.d.ts +2 -1
  7. package/dist/src/components/ui/elements/form-fields/index.d.ts +0 -4
  8. package/dist/src/components/ui/elements/headers/index.d.ts +0 -1
  9. package/dist/src/components/ui/elements/main-sidebar/main-sidebar.d.ts +1 -1
  10. package/dist/src/components/ui/input.d.ts +1 -1
  11. package/dist/src/components/ui/syntax-highlighter.d.ts +1 -1
  12. package/dist/src/components/ui/textarea.d.ts +1 -1
  13. package/dist/src/domains/agents/context/index.d.ts +0 -1
  14. package/dist/src/domains/agents/context/model-reset-context.d.ts +0 -4
  15. package/dist/src/domains/scores/hooks/use-scorers.d.ts +2 -6
  16. package/dist/src/domains/scores/index.d.ts +1 -1
  17. package/dist/src/domains/tools/components/ToolExecutor.d.ts +1 -1
  18. package/dist/src/domains/workflows/workflow/workflow-default-node.d.ts +4 -0
  19. package/dist/src/domains/workflows/workflow/workflow-nested-node.d.ts +4 -0
  20. package/dist/src/domains/workflows/workflow/workflow-node-badges.d.ts +55 -0
  21. package/dist/src/domains/workflows/workflow/workflow-step-action-bar.d.ts +2 -1
  22. package/dist/src/ds/components/Table/Cells.d.ts +0 -3
  23. package/dist/src/index.d.ts +1 -2
  24. package/package.json +11 -9
  25. package/dist/src/components/assistant-ui/thread-list.d.ts +0 -2
  26. package/dist/src/components/assistant-ui/tools/tool-approval.d.ts +0 -8
  27. package/dist/src/components/icons/agent-icon.d.ts +0 -3
  28. package/dist/src/components/icons/automation-icon.d.ts +0 -3
  29. package/dist/src/components/ui/copyable-content.d.ts +0 -7
  30. package/dist/src/components/ui/dropdown-menu.d.ts +0 -42
  31. package/dist/src/components/ui/elements/entry-list/entry-list-toolbar.d.ts +0 -6
  32. package/dist/src/components/ui/elements/form-fields/form-actions.d.ts +0 -12
  33. package/dist/src/components/ui/elements/form-fields/radio-group-field.d.ts +0 -21
  34. package/dist/src/components/ui/elements/form-fields/slider-field.d.ts +0 -15
  35. package/dist/src/components/ui/elements/form-fields/textarea-field.d.ts +0 -11
  36. package/dist/src/components/ui/elements/headers/entity-main-header.d.ts +0 -11
  37. package/dist/src/components/ui/elements/side-dialog/side-dialog-footer.d.ts +0 -10
  38. package/dist/src/components/ui/formatted-date.d.ts +0 -3
  39. package/dist/src/components/ui/resizable.d.ts +0 -23
  40. package/dist/src/components/ui/score-indicator.d.ts +0 -3
  41. package/dist/src/components/ui/toggle.d.ts +0 -12
  42. package/dist/src/domains/agents/components/agent-metadata/connection-dot.d.ts +0 -6
  43. package/dist/src/domains/agents/components/agent-metadata/models.d.ts +0 -5
  44. package/dist/src/domains/agents/components/agent-metadata/provider-status-indicator.d.ts +0 -7
  45. package/dist/src/domains/resizable-panel.d.ts +0 -11
  46. package/dist/src/domains/scores/components/score-table.d.ts +0 -11
  47. package/dist/src/domains/tools/components/tool-table/types.d.ts +0 -2
  48. package/dist/src/domains/workflows/workflow/workflow-result.d.ts +0 -5
  49. package/dist/src/hooks/use-resize-column.d.ts +0 -12
  50. package/dist/src/lib/mastra-client.d.ts +0 -2
  51. package/dist/src/lib/pagination/types.d.ts +0 -11
  52. package/dist/src/lib/polls.d.ts +0 -36
package/dist/index.cjs.js CHANGED
@@ -26,6 +26,7 @@ const Dagre = require('@dagrejs/dagre');
26
26
  const prismReactRenderer = require('prism-react-renderer');
27
27
  const CollapsiblePrimitive = require('@radix-ui/react-collapsible');
28
28
  const ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
29
+ const view = require('@codemirror/view');
29
30
  const SliderPrimitive = require('@radix-ui/react-slider');
30
31
  const jsonSchemaToZod = require('json-schema-to-zod');
31
32
  const superjson = require('superjson');
@@ -4759,6 +4760,26 @@ const lodashTitleCase = (str) => {
4759
4760
  return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
4760
4761
  };
4761
4762
 
4763
+ const formatMappingLabel = (stepId, prevStepIds, nextStepIds) => {
4764
+ if (!stepId.startsWith("mapping_")) {
4765
+ return stepId;
4766
+ }
4767
+ const capitalizeWords = (str) => {
4768
+ return str.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
4769
+ };
4770
+ const formatStepName = (id) => {
4771
+ const cleaned = id.replace(/Step$/, "").replace(/[-_]/g, " ").trim();
4772
+ return capitalizeWords(cleaned);
4773
+ };
4774
+ const formatMultipleSteps = (ids, isTarget) => {
4775
+ if (ids.length === 0) return isTarget ? "End" : "Start";
4776
+ if (ids.length === 1) return formatStepName(ids[0]);
4777
+ return `${ids.length} Steps`;
4778
+ };
4779
+ const fromLabel = formatMultipleSteps(prevStepIds, false);
4780
+ const toLabel = formatMultipleSteps(nextStepIds, true);
4781
+ return `${fromLabel} → ${toLabel} Map`;
4782
+ };
4762
4783
  const getLayoutedElements = (nodes, edges) => {
4763
4784
  const g = new Dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
4764
4785
  g.setGraph({ rankdir: "TB" });
@@ -4855,12 +4876,15 @@ const getStepNodeAndEdge = ({
4855
4876
  position: { x: xIndex * 300, y: (yIndex + (condition ? 1 : 0)) * 100 },
4856
4877
  type: hasGraph ? "nested-node" : "default-node",
4857
4878
  data: {
4858
- label: stepFlow.step.id,
4879
+ label: formatMappingLabel(stepFlow.step.id, prevStepIds, nextStepIds),
4880
+ stepId: stepFlow.step.id,
4859
4881
  description: stepFlow.step.description,
4860
4882
  withoutTopHandle: condition ? false : !prevNodeIds.length,
4861
4883
  withoutBottomHandle: !nextNodeIds.length,
4862
4884
  stepGraph: hasGraph ? stepFlow.step.serializedStepFlow : void 0,
4863
- mapConfig: stepFlow.step.mapConfig
4885
+ mapConfig: stepFlow.step.mapConfig,
4886
+ canSuspend: stepFlow.step.canSuspend,
4887
+ isForEach: stepFlow.type === "foreach"
4864
4888
  }
4865
4889
  }
4866
4890
  ];
@@ -4978,7 +5002,8 @@ const getStepNodeAndEdge = ({
4978
5002
  description: _step.description,
4979
5003
  withoutTopHandle: !prevNodeIds.length,
4980
5004
  withoutBottomHandle: false,
4981
- stepGraph: hasGraph ? _step.serializedStepFlow : void 0
5005
+ stepGraph: hasGraph ? _step.serializedStepFlow : void 0,
5006
+ canSuspend: _step.canSuspend
4982
5007
  }
4983
5008
  },
4984
5009
  {
@@ -5040,7 +5065,14 @@ const getStepNodeAndEdge = ({
5040
5065
  nextStepFlow,
5041
5066
  allPrevNodeIds
5042
5067
  });
5043
- nodes.push(..._nodes);
5068
+ const markedNodes = _nodes.map((node) => ({
5069
+ ...node,
5070
+ data: {
5071
+ ...node.data,
5072
+ isParallel: true
5073
+ }
5074
+ }));
5075
+ nodes.push(...markedNodes);
5044
5076
  edges.push(..._edges);
5045
5077
  nextPrevStepIds.push(..._nextPrevStepIds);
5046
5078
  });
@@ -5156,6 +5188,90 @@ const CollapsibleTrigger = (props) => {
5156
5188
  };
5157
5189
  const CollapsibleContent = CollapsiblePrimitive__namespace.CollapsibleContent;
5158
5190
 
5191
+ const BADGE_COLORS = {
5192
+ sleep: "#A855F7",
5193
+ // Purple
5194
+ forEach: "#F97316",
5195
+ // Orange
5196
+ map: "#F97316",
5197
+ // Orange
5198
+ parallel: "#3B82F6",
5199
+ // Blue
5200
+ suspend: "#EC4899",
5201
+ // Pink
5202
+ after: "#14B8A6",
5203
+ // Teal
5204
+ workflow: "#8B5CF6",
5205
+ // Purple
5206
+ // Condition colors
5207
+ when: "#ECB047",
5208
+ // Orange
5209
+ dountil: "#8B5CF6",
5210
+ // Purple
5211
+ dowhile: "#06B6D4",
5212
+ // Cyan
5213
+ until: "#F59E0B",
5214
+ // Amber
5215
+ while: "#10B981",
5216
+ // Green
5217
+ if: "#3B82F6",
5218
+ // Blue
5219
+ else: "#6B7280"
5220
+ // Gray
5221
+ };
5222
+ const BADGE_ICONS = {
5223
+ sleep: lucideReact.Timer,
5224
+ sleepUntil: lucideReact.CalendarClock,
5225
+ forEach: lucideReact.List,
5226
+ map: lucideReact.List,
5227
+ parallel: lucideReact.Workflow,
5228
+ suspend: lucideReact.PlayCircle,
5229
+ after: lucideReact.Clock,
5230
+ workflow: lucideReact.Layers,
5231
+ // Condition icons
5232
+ when: lucideReact.Network,
5233
+ dountil: lucideReact.Repeat1,
5234
+ dowhile: lucideReact.Repeat,
5235
+ until: lucideReact.Timer,
5236
+ while: lucideReact.RefreshCw,
5237
+ if: lucideReact.GitBranch,
5238
+ else: lucideReact.CornerDownRight
5239
+ };
5240
+ const getConditionIconAndColor = (type) => {
5241
+ switch (type) {
5242
+ case "when":
5243
+ return { icon: BADGE_ICONS.when, color: BADGE_COLORS.when };
5244
+ case "dountil":
5245
+ return { icon: BADGE_ICONS.dountil, color: BADGE_COLORS.dountil };
5246
+ case "dowhile":
5247
+ return { icon: BADGE_ICONS.dowhile, color: BADGE_COLORS.dowhile };
5248
+ case "until":
5249
+ return { icon: BADGE_ICONS.until, color: BADGE_COLORS.until };
5250
+ case "while":
5251
+ return { icon: BADGE_ICONS.while, color: BADGE_COLORS.while };
5252
+ case "if":
5253
+ return { icon: BADGE_ICONS.if, color: BADGE_COLORS.if };
5254
+ case "else":
5255
+ return { icon: BADGE_ICONS.else, color: BADGE_COLORS.else };
5256
+ default:
5257
+ return { icon: void 0, color: void 0 };
5258
+ }
5259
+ };
5260
+ const getNodeBadgeInfo = (data) => {
5261
+ const isSleepNode = Boolean(data.duration || data.date);
5262
+ const isForEachNode = Boolean(data.isForEach);
5263
+ const isMapNode = Boolean(data.mapConfig && !data.isForEach);
5264
+ const isNestedWorkflow = Boolean(data.stepGraph);
5265
+ const hasSpecialBadge = isSleepNode || data.canSuspend || data.isParallel || isForEachNode || isMapNode || isNestedWorkflow;
5266
+ return {
5267
+ isSleepNode,
5268
+ isForEachNode,
5269
+ isMapNode,
5270
+ isNestedWorkflow,
5271
+ hasSpecialBadge
5272
+ };
5273
+ };
5274
+
5159
5275
  const useAutoscroll = (ref, { enabled = true }) => {
5160
5276
  const shouldScrollRef = React.useRef(enabled);
5161
5277
  React.useEffect(() => {
@@ -5252,8 +5368,8 @@ const useCurrentRun = () => {
5252
5368
  };
5253
5369
 
5254
5370
  const useCodemirrorTheme$1 = () => {
5255
- return React.useMemo(
5256
- () => codemirrorThemeDracula.draculaInit({
5371
+ return React.useMemo(() => {
5372
+ const baseTheme = codemirrorThemeDracula.draculaInit({
5257
5373
  settings: {
5258
5374
  fontFamily: "var(--geist-mono)",
5259
5375
  fontSize: "0.8rem",
@@ -5263,9 +5379,20 @@ const useCodemirrorTheme$1 = () => {
5263
5379
  background: "transparent"
5264
5380
  },
5265
5381
  styles: [{ tag: [highlight$1.tags.className, highlight$1.tags.propertyName] }]
5266
- }),
5267
- []
5268
- );
5382
+ });
5383
+ const customLineNumberTheme = view.EditorView.theme({
5384
+ ".cm-editor": {
5385
+ colorScheme: "dark",
5386
+ // ensures color scheme
5387
+ backgroundColor: "transparent"
5388
+ },
5389
+ ".cm-lineNumbers .cm-gutterElement": {
5390
+ color: "#939393"
5391
+ // ← custom line number color
5392
+ }
5393
+ });
5394
+ return [baseTheme, customLineNumberTheme];
5395
+ }, []);
5269
5396
  };
5270
5397
  const SyntaxHighlighter$1 = ({ data }) => {
5271
5398
  const formattedCode = JSON.stringify(data, null, 2);
@@ -5302,6 +5429,7 @@ const WorkflowStepActionBar = ({
5302
5429
  error,
5303
5430
  mapConfig,
5304
5431
  stepName,
5432
+ stepId,
5305
5433
  onShowNestedGraph,
5306
5434
  status
5307
5435
  }) => {
@@ -5328,10 +5456,13 @@ const WorkflowStepActionBar = ({
5328
5456
  mapConfig && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5329
5457
  /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: () => setIsMapConfigOpen(true), children: "Map config" }),
5330
5458
  /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isMapConfigOpen, onOpenChange: setIsMapConfigOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
5331
- /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
5332
- stepName,
5333
- " map config"
5334
- ] }),
5459
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: dialogTitleClass, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
5460
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5461
+ stepName,
5462
+ " Map Config"
5463
+ ] }),
5464
+ stepId && stepId !== stepName && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-icon3 font-normal", children: stepId })
5465
+ ] }) }),
5335
5466
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(CodeDialogContent, { data: mapConfig }) })
5336
5467
  ] }) })
5337
5468
  ] }),
@@ -5389,6 +5520,7 @@ function WorkflowConditionNode({ data }) {
5389
5520
  const { steps } = useCurrentRun();
5390
5521
  const previousStep = steps[previousStepId];
5391
5522
  const nextStep = steps[nextStepId];
5523
+ const { icon: IconComponent, color } = getConditionIconAndColor(type);
5392
5524
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5393
5525
  !withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "target", position: react$1.Position.Top, style: { visibility: "hidden" } }),
5394
5526
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5415,7 +5547,13 @@ function WorkflowConditionNode({ data }) {
5415
5547
  },
5416
5548
  children: [
5417
5549
  /* @__PURE__ */ jsxRuntime.jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full px-3 py-2", children: [
5418
- /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: type === "when" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Network, { className: "text-[#ECB047]" }) : null, children: type?.toUpperCase() }),
5550
+ /* @__PURE__ */ jsxRuntime.jsx(
5551
+ Badge,
5552
+ {
5553
+ icon: IconComponent ? /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "text-current", ...color ? { style: { color } } : {} }) : null,
5554
+ children: type?.toUpperCase()
5555
+ }
5556
+ ),
5419
5557
  isCollapsible && /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(
5420
5558
  lucideReact.ChevronDown,
5421
5559
  {
@@ -5426,6 +5564,21 @@ function WorkflowConditionNode({ data }) {
5426
5564
  ) })
5427
5565
  ] }),
5428
5566
  type === "else" ? null : /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent, { className: "flex flex-col gap-2 pb-2", children: conditions.map((condition, index) => {
5567
+ const conjType = condition.conj || type;
5568
+ const { icon: ConjIconComponent, color: conjColor } = getConditionIconAndColor(conjType);
5569
+ const conjBadge = index === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
5570
+ Badge,
5571
+ {
5572
+ icon: ConjIconComponent ? /* @__PURE__ */ jsxRuntime.jsx(
5573
+ ConjIconComponent,
5574
+ {
5575
+ className: "text-current",
5576
+ ...conjColor ? { style: { color: conjColor } } : {}
5577
+ }
5578
+ ) : null,
5579
+ children: condition.conj?.toLocaleUpperCase() || "WHEN"
5580
+ }
5581
+ );
5429
5582
  return condition.fnString ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3", children: [
5430
5583
  /* @__PURE__ */ jsxRuntime.jsx(prismReactRenderer.Highlight, { theme: prismReactRenderer.themes.oneDark, code: String(condition.fnString).trim(), language: "javascript", children: ({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ jsxRuntime.jsx(
5431
5584
  "pre",
@@ -5471,7 +5624,7 @@ function WorkflowConditionNode({ data }) {
5471
5624
  ) })
5472
5625
  ] }) })
5473
5626
  ] }, `${condition.fnString}-${index}`) : /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: condition.ref?.step ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
5474
- index === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Network, { className: "text-[#ECB047]" }), children: condition.conj?.toLocaleUpperCase() || "WHEN" }),
5627
+ conjBadge,
5475
5628
  /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: "xs", className: " text-mastra-el-3 flex-1", children: [
5476
5629
  condition.ref.step.id || condition.ref.step,
5477
5630
  "'s ",
@@ -5521,9 +5674,29 @@ const Clock = ({ startedAt, endedAt }) => {
5521
5674
 
5522
5675
  function WorkflowDefaultNode({ data, parentWorkflowName }) {
5523
5676
  const { steps, runId } = useCurrentRun();
5524
- const { label, description, withoutTopHandle, withoutBottomHandle, mapConfig, duration, date } = data;
5525
- const fullLabel = parentWorkflowName ? `${parentWorkflowName}.${label}` : label;
5526
- const step = steps[fullLabel];
5677
+ const {
5678
+ label,
5679
+ stepId,
5680
+ description,
5681
+ withoutTopHandle,
5682
+ withoutBottomHandle,
5683
+ mapConfig,
5684
+ duration,
5685
+ date,
5686
+ isParallel,
5687
+ canSuspend,
5688
+ isForEach
5689
+ } = data;
5690
+ const stepKey = parentWorkflowName ? `${parentWorkflowName}.${stepId || label}` : stepId || label;
5691
+ const step = steps[stepKey];
5692
+ const { isSleepNode, isForEachNode, isMapNode, hasSpecialBadge } = getNodeBadgeInfo({
5693
+ duration,
5694
+ date,
5695
+ isForEach,
5696
+ mapConfig,
5697
+ canSuspend,
5698
+ isParallel
5699
+ });
5527
5700
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5528
5701
  !withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "target", position: react$1.Position.Top, style: { visibility: "hidden" } }),
5529
5702
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5533,7 +5706,8 @@ function WorkflowDefaultNode({ data, parentWorkflowName }) {
5533
5706
  "data-workflow-step-status": step?.status ?? "idle",
5534
5707
  "data-testid": "workflow-default-node",
5535
5708
  className: cn(
5536
- "bg-surface3 rounded-lg w-[274px] border-sm border-border1 pt-2",
5709
+ "bg-surface3 rounded-lg w-[274px] border-sm border-border1",
5710
+ hasSpecialBadge ? "pt-0" : "pt-2",
5537
5711
  step?.status === "success" && "bg-accent1Darker",
5538
5712
  step?.status === "failed" && "bg-accent2Darker",
5539
5713
  step?.status === "suspended" && "bg-accent3Darker",
@@ -5541,6 +5715,19 @@ function WorkflowDefaultNode({ data, parentWorkflowName }) {
5541
5715
  step?.status === "running" && "bg-accent6Darker"
5542
5716
  ),
5543
5717
  children: [
5718
+ hasSpecialBadge && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 pt-2 pb-1 flex gap-1.5 flex-wrap", children: [
5719
+ isSleepNode && /* @__PURE__ */ jsxRuntime.jsx(
5720
+ Badge,
5721
+ {
5722
+ icon: date ? /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.sleepUntil, { className: "text-current", style: { color: BADGE_COLORS.sleep } }) : /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.sleep, { className: "text-current", style: { color: BADGE_COLORS.sleep } }),
5723
+ children: date ? "SLEEP UNTIL" : "SLEEP"
5724
+ }
5725
+ ),
5726
+ canSuspend && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.suspend, { className: "text-current", style: { color: BADGE_COLORS.suspend } }), children: "SUSPEND/RESUME" }),
5727
+ isParallel && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.parallel, { className: "text-current", style: { color: BADGE_COLORS.parallel } }), children: "PARALLEL" }),
5728
+ isForEachNode && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.forEach, { className: "text-current", style: { color: BADGE_COLORS.forEach } }), children: "FOREACH" }),
5729
+ isMapNode && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.map, { className: "text-current", style: { color: BADGE_COLORS.map } }), children: "MAP" })
5730
+ ] }),
5544
5731
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2 px-3", !description && "pb-2"), children: [
5545
5732
  /* @__PURE__ */ jsxRuntime.jsxs(Icon, { children: [
5546
5733
  step?.status === "failed" && /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }),
@@ -5572,6 +5759,7 @@ function WorkflowDefaultNode({ data, parentWorkflowName }) {
5572
5759
  WorkflowStepActionBar,
5573
5760
  {
5574
5761
  stepName: label,
5762
+ stepId,
5575
5763
  input: step?.input,
5576
5764
  resumeData: step?.resumeData,
5577
5765
  output: step?.output,
@@ -5599,23 +5787,15 @@ function WorkflowAfterNode({ data }) {
5599
5787
  children: [
5600
5788
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "target", position: react$1.Position.Top, style: { visibility: "hidden" } }),
5601
5789
  /* @__PURE__ */ jsxRuntime.jsxs(CollapsibleTrigger, { className: "flex items-center justify-between w-full", children: [
5602
- /* @__PURE__ */ jsxRuntime.jsx(
5603
- Text,
5604
- {
5605
- size: "xs",
5606
- weight: "medium",
5607
- className: "text-mastra-el-3 bg-mastra-bg-11 my-auto block rounded-[0.125rem] px-2 py-1 text-[10px] w-fit",
5608
- children: "AFTER"
5609
- }
5610
- ),
5611
- /* @__PURE__ */ jsxRuntime.jsx(
5790
+ /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.after, { className: "text-current", style: { color: BADGE_COLORS.after } }), children: "AFTER" }),
5791
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(
5612
5792
  lucideReact.ChevronDown,
5613
5793
  {
5614
- className: cn("w-4 h-4 transition-transform", {
5794
+ className: cn("transition-transform text-icon3", {
5615
5795
  "transform rotate-180": open
5616
5796
  })
5617
5797
  }
5618
- )
5798
+ ) })
5619
5799
  ] }),
5620
5800
  /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent, { className: "flex flex-col gap-2", children: steps.map((step) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm bg-mastra-bg-9 flex items-center gap-[6px] rounded-sm p-2", children: [
5621
5801
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Footprints, { className: "text-current w-4 h-4" }),
@@ -5821,9 +6001,28 @@ function WorkflowNestedGraphProvider({ children }) {
5821
6001
  function WorkflowNestedNode({ data, parentWorkflowName }) {
5822
6002
  const { steps } = useCurrentRun();
5823
6003
  const { showNestedGraph } = React.useContext(WorkflowNestedGraphContext);
5824
- const { label, description, withoutTopHandle, withoutBottomHandle, stepGraph, mapConfig } = data;
6004
+ const {
6005
+ label,
6006
+ stepId,
6007
+ description,
6008
+ withoutTopHandle,
6009
+ withoutBottomHandle,
6010
+ stepGraph,
6011
+ mapConfig,
6012
+ isParallel,
6013
+ canSuspend,
6014
+ isForEach
6015
+ } = data;
5825
6016
  const fullLabel = parentWorkflowName ? `${parentWorkflowName}.${label}` : label;
5826
- const step = steps[fullLabel];
6017
+ const stepKey = parentWorkflowName ? `${parentWorkflowName}.${stepId || label}` : stepId || label;
6018
+ const step = steps[stepKey];
6019
+ const { isForEachNode, isMapNode, isNestedWorkflow, hasSpecialBadge } = getNodeBadgeInfo({
6020
+ isForEach,
6021
+ mapConfig,
6022
+ canSuspend,
6023
+ isParallel,
6024
+ stepGraph
6025
+ });
5827
6026
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5828
6027
  !withoutTopHandle && /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "target", position: react$1.Position.Top, style: { visibility: "hidden" } }),
5829
6028
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5833,7 +6032,8 @@ function WorkflowNestedNode({ data, parentWorkflowName }) {
5833
6032
  "data-workflow-node": true,
5834
6033
  "data-workflow-step-status": step?.status,
5835
6034
  className: cn(
5836
- "bg-surface3 rounded-lg w-[274px] border-sm border-border1 pt-2",
6035
+ "bg-surface3 rounded-lg w-[274px] border-sm border-border1",
6036
+ hasSpecialBadge ? "pt-0" : "pt-2",
5837
6037
  step?.status === "success" && "bg-accent1Darker",
5838
6038
  step?.status === "failed" && "bg-accent2Darker",
5839
6039
  step?.status === "suspended" && "bg-accent3Darker",
@@ -5841,6 +6041,13 @@ function WorkflowNestedNode({ data, parentWorkflowName }) {
5841
6041
  step?.status === "running" && "bg-accent6Darker"
5842
6042
  ),
5843
6043
  children: [
6044
+ hasSpecialBadge && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 pt-2 pb-1 flex gap-1.5 flex-wrap", children: [
6045
+ canSuspend && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.suspend, { className: "text-current", style: { color: BADGE_COLORS.suspend } }), children: "SUSPEND/RESUME" }),
6046
+ isParallel && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.parallel, { className: "text-current", style: { color: BADGE_COLORS.parallel } }), children: "PARALLEL" }),
6047
+ isNestedWorkflow && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.workflow, { className: "text-current", style: { color: BADGE_COLORS.workflow } }), children: "WORKFLOW" }),
6048
+ isForEachNode && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.forEach, { className: "text-current", style: { color: BADGE_COLORS.forEach } }), children: "FOREACH" }),
6049
+ isMapNode && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(BADGE_ICONS.map, { className: "text-current", style: { color: BADGE_COLORS.map } }), children: "MAP" })
6050
+ ] }),
5844
6051
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2 px-3", !description && "pb-2"), children: [
5845
6052
  /* @__PURE__ */ jsxRuntime.jsxs(Icon, { children: [
5846
6053
  step?.status === "failed" && /* @__PURE__ */ jsxRuntime.jsx(CrossIcon, { className: "text-accent2" }),
@@ -5861,6 +6068,7 @@ function WorkflowNestedNode({ data, parentWorkflowName }) {
5861
6068
  WorkflowStepActionBar,
5862
6069
  {
5863
6070
  stepName: label,
6071
+ stepId,
5864
6072
  input: step?.input,
5865
6073
  resumeData: step?.resumeData,
5866
6074
  output: step?.output,
@@ -7583,12 +7791,6 @@ const Cell = ({ className, children, ...props }) => {
7583
7791
  const TxtCell = ({ className, children }) => {
7584
7792
  return /* @__PURE__ */ jsxRuntime.jsx(Cell, { className, children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-md", className: "w-full truncate", children }) });
7585
7793
  };
7586
- const UnitCell = ({ className, children, unit }) => {
7587
- return /* @__PURE__ */ jsxRuntime.jsx(Cell, { className, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center", children: [
7588
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-md", className: "shrink-0", children }),
7589
- /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "span", variant: "ui-sm", className: "text-icon3 w-full truncate", children: unit })
7590
- ] }) });
7591
- };
7592
7794
  const DateTimeCell = ({ dateTime, ...props }) => {
7593
7795
  const { day, time } = formatDateCell(dateTime);
7594
7796
  return /* @__PURE__ */ jsxRuntime.jsx(Cell, { ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0", children: [
@@ -10474,32 +10676,6 @@ const useAgentSettings = () => {
10474
10676
  return React.useContext(AgentSettingsContext);
10475
10677
  };
10476
10678
 
10477
- const ModelResetContext = React.createContext(null);
10478
- function ModelResetProvider({ children }) {
10479
- const resetFnRef = React.useRef(null);
10480
- const registerResetFn = React.useCallback((fn) => {
10481
- resetFnRef.current = fn;
10482
- }, []);
10483
- const triggerReset = React.useCallback(() => {
10484
- if (resetFnRef.current) {
10485
- resetFnRef.current();
10486
- }
10487
- }, []);
10488
- return /* @__PURE__ */ jsxRuntime.jsx(ModelResetContext.Provider, { value: { registerResetFn, triggerReset }, children });
10489
- }
10490
- function useModelReset() {
10491
- const context = React.useContext(ModelResetContext);
10492
- if (!context) {
10493
- return {
10494
- registerResetFn: () => {
10495
- },
10496
- triggerReset: () => {
10497
- }
10498
- };
10499
- }
10500
- return context;
10501
- }
10502
-
10503
10679
  const resolveInstructionPart = (part) => {
10504
10680
  if (typeof part === "string") {
10505
10681
  return part.trim();
@@ -11860,104 +12036,6 @@ function InputField({
11860
12036
  );
11861
12037
  }
11862
12038
 
11863
- function TextareaField({
11864
- value,
11865
- label,
11866
- helpText,
11867
- className,
11868
- testId,
11869
- type,
11870
- disabled,
11871
- ...props
11872
- }) {
11873
- return /* @__PURE__ */ jsxRuntime.jsxs(
11874
- "div",
11875
- {
11876
- className: cn(
11877
- "grid gap-[.5rem] grid-rows-[auto_1fr]",
11878
- {
11879
- "grid-rows-[auto_1fr_auto]": helpText
11880
- },
11881
- className
11882
- ),
11883
- children: [
11884
- label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: cn("text-[0.8125rem] text-icon3 flex justify-between items-center"), children: label }),
11885
- /* @__PURE__ */ jsxRuntime.jsx(
11886
- "textarea",
11887
- {
11888
- className: cn(
11889
- "flex w-full items-center leading-[1.6] text-[0.875rem] text-[rgba(255,255,255,0.7)] border border-[rgba(255,255,255,0.15)] rounded-lg bg-transparent py-[0.5rem] px-[0.75rem] min-h-[6rem]",
11890
- "focus:outline-none focus:shadow-[inset_0_0_0_1px_#18fb6f]",
11891
- { "cursor-not-allowed opacity-50": disabled }
11892
- ),
11893
- "data-testid": testId,
11894
- ...props,
11895
- children: value
11896
- }
11897
- ),
11898
- helpText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-icon3 text-[0.75rem]", children: helpText })
11899
- ]
11900
- }
11901
- );
11902
- }
11903
-
11904
- const Button = React.forwardRef(
11905
- ({ className, variant = "outline", ...props }, ref) => {
11906
- return /* @__PURE__ */ jsxRuntime.jsx(
11907
- "button",
11908
- {
11909
- ref,
11910
- className: cn(
11911
- "text-[.875rem] inline-flex items-center justify-center rounded-lg px-[1rem] gap-[.75rem] leading-0 border bg-transparent text-[rgba(255,255,255,0.7)] whitespace-nowrap",
11912
- "[&:not(:disabled):hover]:border-[rgba(255,255,255,0.25)] [&:not(:disabled):hover]:text-[rgba(255,255,255,0.9)]",
11913
- "[&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:mx-[-0.3em] [&>svg]:opacity-70 [&>svg]:shrink-0",
11914
- "focus:outline-none focus:shadow-[inset_0_0_0_1px_rgba(24,251,111,0.75)]",
11915
- className,
11916
- {
11917
- "cursor-not-allowed opacity-50": props.disabled,
11918
- "bg-ui-primaryBtnBg text-ui-primaryBtnText hover:bg-surface6 leading-[0] font-semibold": variant === "primary",
11919
- "min-h-[2rem]": variant === "ghost",
11920
- "min-h-[2.5rem]": variant !== "ghost",
11921
- "border-[rgba(255,255,255,0.15)]": variant === "outline"
11922
- }
11923
- ),
11924
- ...props
11925
- }
11926
- );
11927
- }
11928
- );
11929
- Button.displayName = "Button";
11930
-
11931
- function FormActions({
11932
- children,
11933
- onSubmit,
11934
- onCancel,
11935
- className,
11936
- submitLabel,
11937
- cancelLabel,
11938
- isSubmitting,
11939
- variant = "toLeft"
11940
- }) {
11941
- if (!children && (!onSubmit || !onCancel)) {
11942
- console.warn("FormActions requires either children or onSubmit and onCancel props");
11943
- return null;
11944
- }
11945
- return /* @__PURE__ */ jsxRuntime.jsx(
11946
- "div",
11947
- {
11948
- className: cn(
11949
- "flex gap-[1rem] items-center justify-start",
11950
- { "justify-end": variant === "toRight", "grid w-full grid-cols-[1fr_auto]": variant === "stretch" },
11951
- className
11952
- ),
11953
- children: children ? children : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11954
- /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onSubmit, className: "min-w-[12rem]", disabled: isSubmitting, variant: "primary", children: submitLabel || "Submit" }),
11955
- /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onCancel, children: cancelLabel || "Cancel" })
11956
- ] })
11957
- }
11958
- );
11959
- }
11960
-
11961
12039
  function SelectField({
11962
12040
  name,
11963
12041
  value,
@@ -12006,158 +12084,6 @@ function SelectField({
12006
12084
  );
12007
12085
  }
12008
12086
 
12009
- function SliderField({
12010
- name,
12011
- value,
12012
- label,
12013
- className,
12014
- testId,
12015
- required,
12016
- disabled,
12017
- helpMsg,
12018
- errorMsg,
12019
- onChange,
12020
- ...props
12021
- }) {
12022
- return /* @__PURE__ */ jsxRuntime.jsxs(
12023
- "div",
12024
- {
12025
- className: cn(
12026
- "grid gap-[.5rem] grid-rows-[auto_1fr]",
12027
- {
12028
- "grid-rows-[auto_1fr_auto]": helpMsg
12029
- },
12030
- className
12031
- ),
12032
- children: [
12033
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: cn("text-[0.8125rem] text-icon3 flex justify-between items-center"), children: [
12034
- label,
12035
- required && /* @__PURE__ */ jsxRuntime.jsx("i", { className: "text-icon2", children: "(required)" })
12036
- ] }),
12037
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("grid w-full items-center gap-[1rem] grid-cols-[1fr_auto]"), children: [
12038
- /* @__PURE__ */ jsxRuntime.jsxs(
12039
- SliderPrimitive__namespace.Root,
12040
- {
12041
- name,
12042
- className: cn("relative flex w-full touch-none select-none items-center ", className),
12043
- value,
12044
- disabled,
12045
- ...props,
12046
- children: [
12047
- /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Track, { className: "relative h-[4px] w-full grow overflow-hidden rounded-full bg-gray-600", children: /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Range, { className: "absolute h-full bg-gray-400" }) }),
12048
- /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Thumb, { className: "block h-4 w-4 rounded-full bg-gray-400 shadow transition-colors focus:outline-none focus:bg-[#18fb6f] disabled:pointer-events-none disabled:opacity-50" })
12049
- ]
12050
- }
12051
- ),
12052
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-icon4 text-[0.875rem] flex justify-end", children: value })
12053
- ] }),
12054
- helpMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-icon3 text-[0.75rem]", children: helpMsg }),
12055
- errorMsg && /* @__PURE__ */ jsxRuntime.jsxs(
12056
- "p",
12057
- {
12058
- className: cn(
12059
- "text-[0.75rem] text-red-500 flex items-center gap-[.5rem]",
12060
- "[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-70"
12061
- ),
12062
- children: [
12063
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TriangleAlertIcon, {}),
12064
- " ",
12065
- errorMsg
12066
- ]
12067
- }
12068
- )
12069
- ]
12070
- }
12071
- );
12072
- }
12073
-
12074
- function RadioGroupField({
12075
- name,
12076
- value,
12077
- label,
12078
- className,
12079
- testId,
12080
- required,
12081
- disabled,
12082
- helpMsg,
12083
- errorMsg,
12084
- onChange,
12085
- options = [],
12086
- layout = "vertical",
12087
- onValueChange,
12088
- ...props
12089
- }) {
12090
- const Wrapper = layout === "horizontal" ? "div" : "fieldset";
12091
- return /* @__PURE__ */ jsxRuntime.jsxs(
12092
- Wrapper,
12093
- {
12094
- className: cn(
12095
- "w-full",
12096
- {
12097
- "flex items-center gap-[2rem]": layout === "horizontal"
12098
- },
12099
- className
12100
- ),
12101
- role: layout === "horizontal" ? "radiogroup" : void 0,
12102
- "aria-labelledby": layout === "horizontal" ? void 0 : `${name}-legend`,
12103
- children: [
12104
- /* @__PURE__ */ jsxRuntime.jsx("legend", { id: `${name}-legend`, className: cn("text-[0.8125rem] text-icon3"), children: label }),
12105
- /* @__PURE__ */ jsxRuntime.jsxs(
12106
- "div",
12107
- {
12108
- className: cn("grid gap-[2.5rem]", {
12109
- "mt-[0.5rem]": layout === "vertical",
12110
- "grid-rows-[1fr_auto]": helpMsg
12111
- }),
12112
- children: [
12113
- /* @__PURE__ */ jsxRuntime.jsx(
12114
- RadioGroupPrimitive__namespace.Root,
12115
- {
12116
- value,
12117
- onValueChange,
12118
- ...props,
12119
- className: cn({
12120
- "grid gap-[0.5rem]": layout === "vertical",
12121
- "flex gap-[1rem]": layout === "horizontal"
12122
- }),
12123
- children: options.map((option) => {
12124
- return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-[0.5rem] text-[0.875rem] text-icon4 ", children: [
12125
- /* @__PURE__ */ jsxRuntime.jsx(
12126
- RadioGroupPrimitive__namespace.Item,
12127
- {
12128
- className: "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ",
12129
- value: option.value,
12130
- children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-2.5 w-2.5 fill-current text-current" }) })
12131
- }
12132
- ),
12133
- option.label
12134
- ] }, option.value);
12135
- })
12136
- }
12137
- ),
12138
- helpMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-icon3 text-[0.75rem]", children: helpMsg }),
12139
- errorMsg && /* @__PURE__ */ jsxRuntime.jsxs(
12140
- "p",
12141
- {
12142
- className: cn(
12143
- "text-[0.75rem] text-red-500 flex items-center gap-[.5rem]",
12144
- "[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-70"
12145
- ),
12146
- children: [
12147
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TriangleAlertIcon, {}),
12148
- " ",
12149
- errorMsg
12150
- ]
12151
- }
12152
- )
12153
- ]
12154
- }
12155
- )
12156
- ]
12157
- }
12158
- );
12159
- }
12160
-
12161
12087
  function KeyValueList({ data, LinkComponent, className, labelsAreHidden, isLoading }) {
12162
12088
  const { Link } = useLinkComponent();
12163
12089
  const LabelWrapper = ({ children }) => {
@@ -12517,6 +12443,33 @@ function SideDialogRoot({
12517
12443
  ] }) });
12518
12444
  }
12519
12445
 
12446
+ const Button = React.forwardRef(
12447
+ ({ className, variant = "outline", ...props }, ref) => {
12448
+ return /* @__PURE__ */ jsxRuntime.jsx(
12449
+ "button",
12450
+ {
12451
+ ref,
12452
+ className: cn(
12453
+ "text-[.875rem] inline-flex items-center justify-center rounded-lg px-[1rem] gap-[.75rem] leading-0 border bg-transparent text-[rgba(255,255,255,0.7)] whitespace-nowrap",
12454
+ "[&:not(:disabled):hover]:border-[rgba(255,255,255,0.25)] [&:not(:disabled):hover]:text-[rgba(255,255,255,0.9)]",
12455
+ "[&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:mx-[-0.3em] [&>svg]:opacity-70 [&>svg]:shrink-0",
12456
+ "focus:outline-none focus:shadow-[inset_0_0_0_1px_rgba(24,251,111,0.75)]",
12457
+ className,
12458
+ {
12459
+ "cursor-not-allowed opacity-50": props.disabled,
12460
+ "bg-ui-primaryBtnBg text-ui-primaryBtnText hover:bg-surface6 leading-[0] font-semibold": variant === "primary",
12461
+ "min-h-[2rem]": variant === "ghost",
12462
+ "min-h-[2.5rem]": variant !== "ghost",
12463
+ "border-[rgba(255,255,255,0.15)]": variant === "outline"
12464
+ }
12465
+ ),
12466
+ ...props
12467
+ }
12468
+ );
12469
+ }
12470
+ );
12471
+ Button.displayName = "Button";
12472
+
12520
12473
  function MainContentLayout({
12521
12474
  children,
12522
12475
  className,
@@ -12745,39 +12698,6 @@ const SideDialog = Object.assign(SideDialogRoot, {
12745
12698
  Nav: SideDialogNav
12746
12699
  });
12747
12700
 
12748
- function EntityMainHeader({
12749
- title,
12750
- description,
12751
- icon,
12752
- children,
12753
- isLoading,
12754
- className,
12755
- placement = "page"
12756
- }) {
12757
- return /* @__PURE__ */ jsxRuntime.jsxs(
12758
- "header",
12759
- {
12760
- className: cn(
12761
- "grid gap-[.5rem]",
12762
- "[&>h1]:text-icon6 [&>h1]:text-[1.25rem] [&>h1]:font-normal [&>h1]:flex [&>h1]:items-center [&>h1]:gap-[0.5rem]",
12763
- "[&_svg]:w-[1.4rem] [&_svg]:h-[1.4rem] [&_svg]:text-icon3",
12764
- "[&>p]:text-icon4 [&>p]:text-[0.875rem] [&>p]:m-0",
12765
- { "pt-[2rem] pb-[2rem]": placement === "page" },
12766
- { "pt-[1.5em] pb-[1rem]": placement === "sidebar" },
12767
- className
12768
- ),
12769
- children: [
12770
- /* @__PURE__ */ jsxRuntime.jsxs("h1", { children: [
12771
- icon && icon,
12772
- " ",
12773
- title
12774
- ] }),
12775
- description && /* @__PURE__ */ jsxRuntime.jsx("p", { children: description })
12776
- ]
12777
- }
12778
- );
12779
- }
12780
-
12781
12701
  function PageHeader({ title, description, icon, className }) {
12782
12702
  const titleIsLoading = title === "loading";
12783
12703
  const descriptionIsLoading = description === "loading";
@@ -13221,11 +13141,23 @@ function MainSidebarNavSeparator({ className }) {
13221
13141
  function MainSidebarRoot({ children, className }) {
13222
13142
  const { state, toggleSidebar } = useMainSidebar();
13223
13143
  const isCollapsed = state === "collapsed";
13144
+ React.useEffect(() => {
13145
+ const handleKeyDown = (event) => {
13146
+ if (event.ctrlKey && event.key === "b") {
13147
+ event.preventDefault();
13148
+ toggleSidebar();
13149
+ }
13150
+ };
13151
+ document.addEventListener("keydown", handleKeyDown);
13152
+ return () => {
13153
+ document.removeEventListener("keydown", handleKeyDown);
13154
+ };
13155
+ }, [toggleSidebar]);
13224
13156
  return /* @__PURE__ */ jsxRuntime.jsxs(
13225
13157
  "div",
13226
13158
  {
13227
13159
  className: cn(
13228
- "flex flex-col h-full px-[1rem] pb-[1rem] relative overflow-y-auto",
13160
+ "flex flex-col h-full px-[1rem] relative overflow-y-auto",
13229
13161
  {
13230
13162
  "lg:min-w-[13rem] xl:min-w-[14rem] 2xl:min-w-[15rem] 3xl:min-w-[16rem] 4xl:min-w-[17rem]": !isCollapsed
13231
13163
  },
@@ -13233,30 +13165,41 @@ function MainSidebarRoot({ children, className }) {
13233
13165
  ),
13234
13166
  children: [
13235
13167
  children,
13236
- /* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavSeparator, {}),
13237
- /* @__PURE__ */ jsxRuntime.jsx(
13238
- "button",
13239
- {
13240
- onClick: toggleSidebar,
13241
- className: cn(
13242
- "inline-flex w-auto items-center text-icon3 h-[2rem] px-[0.75rem] rounded-md",
13243
- "hover:bg-surface4",
13244
- "[&_svg]:w-[1rem] [&_svg]:h-[1rem] [&_svg]:text-icon3",
13245
- {
13246
- "ml-auto": !isCollapsed
13247
- }
13248
- ),
13249
- "aria-label": "Toggle sidebar",
13250
- children: /* @__PURE__ */ jsxRuntime.jsx(
13251
- lucideReact.PanelRightIcon,
13168
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface1 grid sticky bottom-0 pb-[.75rem] ", children: [
13169
+ /* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavSeparator, {}),
13170
+ /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
13171
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
13172
+ "button",
13252
13173
  {
13253
- className: cn({
13254
- "rotate-180": isCollapsed
13255
- })
13174
+ onClick: toggleSidebar,
13175
+ className: cn(
13176
+ "inline-flex w-auto items-center text-icon3 h-[2rem] px-[0.75rem] rounded-md ml-auto",
13177
+ "hover:bg-surface4",
13178
+ "[&_svg]:w-[1rem] [&_svg]:h-[1rem] [&_svg]:text-icon3",
13179
+ {
13180
+ "ml-auto": !isCollapsed
13181
+ }
13182
+ ),
13183
+ "aria-label": "Toggle sidebar",
13184
+ children: /* @__PURE__ */ jsxRuntime.jsx(
13185
+ lucideReact.PanelRightIcon,
13186
+ {
13187
+ className: cn({
13188
+ "rotate-180": isCollapsed
13189
+ })
13190
+ }
13191
+ )
13256
13192
  }
13257
- )
13258
- }
13259
- ),
13193
+ ) }),
13194
+ /* @__PURE__ */ jsxRuntime.jsxs(TooltipContent, { children: [
13195
+ "Toggle Sidebar",
13196
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 [&>svg]:w-[1em] [&>svg]:h-[1em]", children: [
13197
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.KeyboardIcon, {}),
13198
+ " Ctrl+B"
13199
+ ] })
13200
+ ] })
13201
+ ] })
13202
+ ] }),
13260
13203
  /* @__PURE__ */ jsxRuntime.jsx(
13261
13204
  "button",
13262
13205
  {
@@ -13660,31 +13603,6 @@ function ScoresTools({ onEntityChange, onReset, selectedEntity, entityOptions, i
13660
13603
  ] });
13661
13604
  }
13662
13605
 
13663
- const useScoresByEntityId = (entityId, entityType, page = 0) => {
13664
- const client = react$3.useMastraClient();
13665
- const [scores, setScores] = React.useState(null);
13666
- const [isLoading, setIsLoading] = React.useState(true);
13667
- React.useEffect(() => {
13668
- const fetchScores = async () => {
13669
- setIsLoading(true);
13670
- try {
13671
- const res = await client.listScoresByEntityId({
13672
- entityId,
13673
- entityType,
13674
- page: page || 0,
13675
- perPage: 10
13676
- });
13677
- setScores(res);
13678
- setIsLoading(false);
13679
- } catch (error) {
13680
- setScores(null);
13681
- setIsLoading(false);
13682
- }
13683
- };
13684
- fetchScores();
13685
- }, [entityId, entityType, page]);
13686
- return { scores, isLoading };
13687
- };
13688
13606
  const useScoresByScorerId = ({ scorerId, page = 0, entityId, entityType }) => {
13689
13607
  const client = react$3.useMastraClient();
13690
13608
  return reactQuery.useQuery({
@@ -13869,6 +13787,20 @@ const useTraceSpanScores = ({ traceId = "", spanId = "", page }) => {
13869
13787
  });
13870
13788
  };
13871
13789
 
13790
+ const ModelResetContext = React.createContext(null);
13791
+ function useModelReset() {
13792
+ const context = React.useContext(ModelResetContext);
13793
+ if (!context) {
13794
+ return {
13795
+ registerResetFn: () => {
13796
+ },
13797
+ triggerReset: () => {
13798
+ }
13799
+ };
13800
+ }
13801
+ return context;
13802
+ }
13803
+
13872
13804
  const useAgentsModelProviders = () => {
13873
13805
  const client = react$3.useMastraClient();
13874
13806
  return reactQuery.useQuery({
@@ -18452,89 +18384,6 @@ const SpanScoring = ({ traceId, spanId, entityType }) => {
18452
18384
  ] });
18453
18385
  };
18454
18386
 
18455
- const useResizeColumn = ({
18456
- defaultWidth,
18457
- minimumWidth,
18458
- maximumWidth,
18459
- setCurrentWidth
18460
- }) => {
18461
- const [isDragging, setIsDragging] = React.useState(false);
18462
- const [sidebarWidth, setSidebarWidth] = React.useState(defaultWidth);
18463
- const containerRef = React.useRef(null);
18464
- const dragStartXRef = React.useRef(0);
18465
- const initialWidthRef = React.useRef(0);
18466
- const handleMouseDown = (e) => {
18467
- e.preventDefault();
18468
- setIsDragging(true);
18469
- dragStartXRef.current = e.clientX;
18470
- initialWidthRef.current = sidebarWidth;
18471
- };
18472
- React.useEffect(() => {
18473
- setSidebarWidth(defaultWidth);
18474
- setCurrentWidth?.(defaultWidth);
18475
- }, [defaultWidth]);
18476
- React.useEffect(() => {
18477
- const handleMouseMove = (e) => {
18478
- if (!isDragging || !containerRef.current) return;
18479
- const containerWidth = containerRef.current.offsetWidth;
18480
- const deltaX = dragStartXRef.current - e.clientX;
18481
- const deltaPercentage = deltaX / containerWidth * 100;
18482
- const newWidth = Math.min(Math.max(initialWidthRef.current + deltaPercentage, minimumWidth), maximumWidth);
18483
- setSidebarWidth(newWidth);
18484
- setCurrentWidth?.(newWidth);
18485
- };
18486
- const handleMouseUp = () => {
18487
- setIsDragging(false);
18488
- };
18489
- if (isDragging) {
18490
- window.addEventListener("mousemove", handleMouseMove);
18491
- window.addEventListener("mouseup", handleMouseUp);
18492
- }
18493
- return () => {
18494
- window.removeEventListener("mousemove", handleMouseMove);
18495
- window.removeEventListener("mouseup", handleMouseUp);
18496
- };
18497
- }, [isDragging]);
18498
- return { sidebarWidth, isDragging, handleMouseDown, containerRef };
18499
- };
18500
-
18501
- const MastraResizablePanel = ({
18502
- children,
18503
- defaultWidth,
18504
- minimumWidth,
18505
- maximumWidth,
18506
- className,
18507
- disabled = false,
18508
- setCurrentWidth,
18509
- dividerPosition = "left"
18510
- }) => {
18511
- const { sidebarWidth, isDragging, handleMouseDown, containerRef } = useResizeColumn({
18512
- defaultWidth: disabled ? 100 : defaultWidth,
18513
- minimumWidth,
18514
- maximumWidth,
18515
- setCurrentWidth
18516
- });
18517
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("w-full h-full relative", className), ref: containerRef, style: { width: `${sidebarWidth}%` }, children: [
18518
- !disabled && dividerPosition === "left" ? /* @__PURE__ */ jsxRuntime.jsx(
18519
- "div",
18520
- {
18521
- className: `w-px bg-border1 h-full cursor-col-resize hover:w-1.5 hover:bg-mastra-border-2 hover:bg-[#424242] active:bg-mastra-border-3 active:bg-[#3e3e3e] transition-colors absolute inset-y-0 z-10
18522
- ${isDragging ? "bg-border2 w-1.5 cursor- col-resize" : ""}`,
18523
- onMouseDown: handleMouseDown
18524
- }
18525
- ) : null,
18526
- children,
18527
- !disabled && dividerPosition === "right" ? /* @__PURE__ */ jsxRuntime.jsx(
18528
- "div",
18529
- {
18530
- className: `w-px bg-border1 h-full cursor-col-resize hover:w-1.5 hover:bg-border2 active:bg-border3 transition-colors absolute inset-y-0 z-10
18531
- ${isDragging ? "bg-border2 w-1.5 cursor- col-resize" : ""}`,
18532
- onMouseDown: handleMouseDown
18533
- }
18534
- ) : null
18535
- ] });
18536
- };
18537
-
18538
18387
  const Breadcrumb = ({ children, label }) => {
18539
18388
  return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": label, children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "gap-sm flex items-center", children }) });
18540
18389
  };
@@ -18624,113 +18473,6 @@ const EntityContent = ({ children, className }) => {
18624
18473
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
18625
18474
  };
18626
18475
 
18627
- function usePolling({
18628
- fetchFn,
18629
- interval = 3e3,
18630
- enabled = false,
18631
- onSuccess,
18632
- onError,
18633
- shouldContinue = () => true,
18634
- restartPolling = false
18635
- }) {
18636
- const [isPolling, setIsPolling] = React.useState(enabled);
18637
- const [error, setError] = React.useState(null);
18638
- const [data, setData] = React.useState(null);
18639
- const [isLoading, setIsLoading] = React.useState(false);
18640
- const [firstCallLoading, setFirstCallLoading] = React.useState(false);
18641
- const timeoutRef = React.useRef(null);
18642
- const mountedRef = React.useRef(true);
18643
- const [restart, setRestart] = React.useState(restartPolling);
18644
- const cleanup = React.useCallback(() => {
18645
- console.log("cleanup");
18646
- if (timeoutRef.current) {
18647
- clearTimeout(timeoutRef.current);
18648
- timeoutRef.current = null;
18649
- }
18650
- }, []);
18651
- const stopPolling = React.useCallback(() => {
18652
- console.log("stopPolling");
18653
- setIsPolling(false);
18654
- cleanup();
18655
- }, [cleanup]);
18656
- const startPolling = React.useCallback(() => {
18657
- console.log("startPolling");
18658
- setIsPolling(true);
18659
- setError(null);
18660
- }, []);
18661
- const executePoll = React.useCallback(
18662
- async (refetch2 = true) => {
18663
- if (!mountedRef.current) return;
18664
- setIsLoading(true);
18665
- try {
18666
- const result = await fetchFn();
18667
- setData(result);
18668
- setError(null);
18669
- onSuccess?.(result);
18670
- if (shouldContinue(result) && refetch2) {
18671
- timeoutRef.current = setTimeout(executePoll, interval);
18672
- } else {
18673
- stopPolling();
18674
- }
18675
- } catch (err) {
18676
- if (!mountedRef.current) return;
18677
- setError(err);
18678
- onError?.(err);
18679
- stopPolling();
18680
- } finally {
18681
- if (mountedRef.current) {
18682
- setFirstCallLoading(false);
18683
- setIsLoading(false);
18684
- }
18685
- }
18686
- },
18687
- [fetchFn, interval, onSuccess, onError, shouldContinue, stopPolling]
18688
- );
18689
- const refetch = React.useCallback(
18690
- (withPolling = false) => {
18691
- console.log("refetch", { withPolling });
18692
- if (withPolling) {
18693
- setIsPolling(true);
18694
- } else {
18695
- executePoll(false);
18696
- }
18697
- setError(null);
18698
- },
18699
- [executePoll]
18700
- );
18701
- React.useEffect(() => {
18702
- mountedRef.current = true;
18703
- if (enabled && isPolling) {
18704
- executePoll(true);
18705
- }
18706
- return () => {
18707
- console.log("cleanup poll");
18708
- mountedRef.current = false;
18709
- cleanup();
18710
- };
18711
- }, [enabled, isPolling, executePoll, cleanup]);
18712
- React.useEffect(() => {
18713
- setRestart(restartPolling);
18714
- }, [restartPolling]);
18715
- React.useEffect(() => {
18716
- if (restart && !isPolling) {
18717
- setIsPolling(true);
18718
- executePoll();
18719
- setRestart(false);
18720
- }
18721
- }, [restart]);
18722
- return {
18723
- isPolling,
18724
- isLoading,
18725
- error,
18726
- data,
18727
- startPolling,
18728
- stopPolling,
18729
- firstCallLoading,
18730
- refetch
18731
- };
18732
- }
18733
-
18734
18476
  const PlaygroundQueryClient = ({ children }) => {
18735
18477
  const queryClient = new reactQuery.QueryClient();
18736
18478
  return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children });
@@ -19270,7 +19012,6 @@ exports.EntityContent = EntityContent;
19270
19012
  exports.EntityDescription = EntityDescription;
19271
19013
  exports.EntityHeader = EntityHeader;
19272
19014
  exports.EntityIcon = EntityIcon;
19273
- exports.EntityMainHeader = EntityMainHeader;
19274
19015
  exports.EntityName = EntityName;
19275
19016
  exports.Entry = Entry;
19276
19017
  exports.EntryCell = EntryCell;
@@ -19279,7 +19020,6 @@ exports.EntryListSkeleton = EntryListSkeleton;
19279
19020
  exports.EnvIcon = EnvIcon;
19280
19021
  exports.FiltersIcon = FiltersIcon;
19281
19022
  exports.FolderIcon = FolderIcon;
19282
- exports.FormActions = FormActions;
19283
19023
  exports.GithubCoinIcon = GithubCoinIcon;
19284
19024
  exports.GithubIcon = GithubIcon;
19285
19025
  exports.GoogleIcon = GoogleIcon;
@@ -19306,12 +19046,10 @@ exports.MainContentContent = MainContentContent;
19306
19046
  exports.MainContentLayout = MainContentLayout;
19307
19047
  exports.MainSidebar = MainSidebar;
19308
19048
  exports.MainSidebarProvider = MainSidebarProvider;
19309
- exports.MastraResizablePanel = MastraResizablePanel;
19310
19049
  exports.McpCoinIcon = McpCoinIcon;
19311
19050
  exports.McpServerIcon = McpServerIcon;
19312
19051
  exports.MemoryIcon = MemoryIcon;
19313
19052
  exports.MemorySearch = MemorySearch;
19314
- exports.ModelResetProvider = ModelResetProvider;
19315
19053
  exports.Notification = Notification;
19316
19054
  exports.OpenAIIcon = OpenAIIcon;
19317
19055
  exports.PageHeader = PageHeader;
@@ -19319,7 +19057,6 @@ exports.PlaygroundQueryClient = PlaygroundQueryClient;
19319
19057
  exports.PlaygroundTabs = PlaygroundTabs;
19320
19058
  exports.PromptIcon = PromptIcon;
19321
19059
  exports.RadioGroup = RadioGroup;
19322
- exports.RadioGroupField = RadioGroupField;
19323
19060
  exports.RadioGroupItem = RadioGroupItem;
19324
19061
  exports.RepoIcon = RepoIcon;
19325
19062
  exports.RequestContext = RequestContext;
@@ -19338,8 +19075,8 @@ exports.Sections = Sections;
19338
19075
  exports.SelectField = SelectField;
19339
19076
  exports.SettingsIcon = SettingsIcon;
19340
19077
  exports.SideDialog = SideDialog;
19078
+ exports.Skeleton = Skeleton;
19341
19079
  exports.SlashIcon = SlashIcon;
19342
- exports.SliderField = SliderField;
19343
19080
  exports.SpanScoreList = SpanScoreList;
19344
19081
  exports.SpanScoring = SpanScoring;
19345
19082
  exports.SpanTabs = SpanTabs;
@@ -19356,7 +19093,6 @@ exports.TemplateSuccess = TemplateSuccess;
19356
19093
  exports.TemplatesList = TemplatesList;
19357
19094
  exports.TemplatesTools = TemplatesTools;
19358
19095
  exports.TextAndIcon = TextAndIcon;
19359
- exports.TextareaField = TextareaField;
19360
19096
  exports.Th = Th;
19361
19097
  exports.Thead = Thead;
19362
19098
  exports.ThreadDeleteButton = ThreadDeleteButton;
@@ -19387,7 +19123,6 @@ exports.TracesTools = TracesTools;
19387
19123
  exports.TsIcon = TsIcon;
19388
19124
  exports.Txt = Txt;
19389
19125
  exports.TxtCell = TxtCell;
19390
- exports.UnitCell = UnitCell;
19391
19126
  exports.VariablesIcon = VariablesIcon;
19392
19127
  exports.WorkflowCoinIcon = WorkflowCoinIcon;
19393
19128
  exports.WorkflowCombobox = WorkflowCombobox;
@@ -19437,14 +19172,11 @@ exports.useMainSidebar = useMainSidebar;
19437
19172
  exports.useMemory = useMemory;
19438
19173
  exports.useMemoryConfig = useMemoryConfig;
19439
19174
  exports.useMemorySearch = useMemorySearch;
19440
- exports.useModelReset = useModelReset;
19441
19175
  exports.usePlaygroundStore = usePlaygroundStore;
19442
- exports.usePolling = usePolling;
19443
19176
  exports.useReorderModelList = useReorderModelList;
19444
19177
  exports.useResetAgentModel = useResetAgentModel;
19445
19178
  exports.useScorer = useScorer;
19446
19179
  exports.useScorers = useScorers;
19447
- exports.useScoresByEntityId = useScoresByEntityId;
19448
19180
  exports.useScoresByScorerId = useScoresByScorerId;
19449
19181
  exports.useSpeechRecognition = useSpeechRecognition;
19450
19182
  exports.useStreamWorkflow = useStreamWorkflow;