@mastra/playground-ui 7.0.0-beta.19 → 7.0.0-beta.20

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 (54) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/dist/index.cjs.js +536 -847
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.es.js +534 -842
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/src/components/assistant-ui/tooltip-icon-button.d.ts +2 -7
  7. package/dist/src/components/ui/combobox.d.ts +2 -2
  8. package/dist/src/components/ui/elements/buttons/index.d.ts +0 -1
  9. package/dist/src/components/ui/elements/tabs/index.d.ts +4 -1
  10. package/dist/src/components/ui/elements/tabs/tabs-root.d.ts +1 -1
  11. package/dist/src/components/ui/elements/tabs/tabs-tab.d.ts +2 -1
  12. package/dist/src/components/ui/input.d.ts +1 -1
  13. package/dist/src/components/ui/text.d.ts +2 -2
  14. package/dist/src/domains/memory/hooks/use-memory.d.ts +5 -0
  15. package/dist/src/domains/scores/hooks/use-trace-span-scores.d.ts +3 -3
  16. package/dist/src/domains/templates/template-form.d.ts +2 -1
  17. package/dist/src/domains/workflows/hooks/use-workflows-actions.d.ts +1 -0
  18. package/dist/src/domains/workflows/workflow/workflow-trigger.d.ts +2 -1
  19. package/dist/src/ds/components/Avatar/Avatar.d.ts +5 -3
  20. package/dist/src/ds/components/Button/Button.d.ts +6 -2
  21. package/dist/src/ds/components/CodeEditor/code-editor.d.ts +12 -0
  22. package/dist/src/ds/components/CodeEditor/index.d.ts +1 -0
  23. package/dist/src/ds/tokens/sizes.d.ts +3 -1
  24. package/dist/src/hooks/use-workflow-runs.d.ts +1 -1
  25. package/dist/src/index.d.ts +0 -2
  26. package/dist/tokens.cjs.js +3 -1
  27. package/dist/tokens.cjs.js.map +1 -1
  28. package/dist/tokens.es.js +3 -1
  29. package/dist/tokens.es.js.map +1 -1
  30. package/package.json +13 -25
  31. package/dist/src/components/assistant-ui/syntax-highlighter.d.ts +0 -1
  32. package/dist/src/components/syntax-highlighter.d.ts +0 -5
  33. package/dist/src/components/ui/avatar.d.ts +0 -6
  34. package/dist/src/components/ui/badge.d.ts +0 -9
  35. package/dist/src/components/ui/button.d.ts +0 -16
  36. package/dist/src/components/ui/calendar.d.ts +0 -8
  37. package/dist/src/components/ui/card.d.ts +0 -8
  38. package/dist/src/components/ui/command.d.ts +0 -78
  39. package/dist/src/components/ui/date-picker.d.ts +0 -23
  40. package/dist/src/components/ui/elements/buttons/button.d.ts +0 -8
  41. package/dist/src/components/ui/elements/tabs/tabs.d.ts +0 -24
  42. package/dist/src/components/ui/form.d.ts +0 -23
  43. package/dist/src/components/ui/playground-tabs.d.ts +0 -25
  44. package/dist/src/components/ui/syntax-highlighter.d.ts +0 -7
  45. package/dist/src/components/ui/table.d.ts +0 -10
  46. package/dist/src/components/ui/tabs.d.ts +0 -7
  47. package/dist/src/components/ui/textarea.d.ts +0 -5
  48. package/dist/src/ds/components/TraceTree/Span.d.ts +0 -32
  49. package/dist/src/ds/components/TraceTree/Spans.d.ts +0 -5
  50. package/dist/src/ds/components/TraceTree/Time.d.ts +0 -8
  51. package/dist/src/ds/components/TraceTree/Trace.d.ts +0 -13
  52. package/dist/src/ds/components/TraceTree/TraceTree.d.ts +0 -5
  53. package/dist/src/ds/components/TraceTree/index.d.ts +0 -1
  54. package/dist/src/ds/components/types.d.ts +0 -4
package/dist/index.cjs.js CHANGED
@@ -6,15 +6,14 @@ require('./index.css');const jsxRuntime = require('react/jsx-runtime');
6
6
  const react = require('@assistant-ui/react');
7
7
  const lucideReact = require('lucide-react');
8
8
  const React = require('react');
9
- const reactSlot = require('@radix-ui/react-slot');
10
9
  const TooltipPrimitive = require('@radix-ui/react-tooltip');
11
- const AvatarPrimitive = require('@radix-ui/react-avatar');
12
10
  const reactMarkdown = require('@assistant-ui/react-markdown');
13
11
  require('@assistant-ui/react-markdown/styles/dot.css');
14
12
  const remarkGfm = require('remark-gfm');
15
- const reactSyntaxHighlighter = require('@assistant-ui/react-syntax-highlighter');
16
13
  const prism = require('react-syntax-highlighter/dist/cjs/styles/prism');
14
+ const reactSyntaxHighlighter = require('@assistant-ui/react-syntax-highlighter');
17
15
  const langJson = require('@codemirror/lang-json');
16
+ const view = require('@codemirror/view');
18
17
  const highlight$1 = require('@lezer/highlight');
19
18
  const codemirrorThemeDracula = require('@uiw/codemirror-theme-dracula');
20
19
  const CodeMirror = require('@uiw/react-codemirror');
@@ -31,11 +30,9 @@ const Dagre = require('@dagrejs/dagre');
31
30
  const prismReactRenderer = require('prism-react-renderer');
32
31
  const CollapsiblePrimitive = require('@radix-ui/react-collapsible');
33
32
  const ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
34
- const view = require('@codemirror/view');
35
33
  const langJavascript = require('@codemirror/lang-javascript');
36
34
  const CheckboxPrimitive = require('@radix-ui/react-checkbox');
37
35
  const dateFns = require('date-fns');
38
- const useDebounce = require('use-debounce');
39
36
  const reactDayPicker = require('react-day-picker');
40
37
  const PopoverPrimitive = require('@radix-ui/react-popover');
41
38
  const SelectPrimitive = require('@radix-ui/react-select');
@@ -57,6 +54,7 @@ const superjson = require('superjson');
57
54
  const SliderPrimitive = require('@radix-ui/react-slider');
58
55
  const reactCodeBlock = require('react-code-block');
59
56
  const reactTable = require('@tanstack/react-table');
57
+ const useDebounce = require('use-debounce');
60
58
  const colors = require('./colors-B_l6leHd.cjs');
61
59
  const ui = require('@mastra/ai-sdk/ui');
62
60
  const Markdown = require('react-markdown');
@@ -72,7 +70,7 @@ const langMarkdown = require('@codemirror/lang-markdown');
72
70
  const languageData = require('@codemirror/language-data');
73
71
  const codemirrorThemeGithub = require('@uiw/codemirror-theme-github');
74
72
  const AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
75
- const TabsPrimitive = require('@radix-ui/react-tabs');
73
+ const RadixTabs = require('@radix-ui/react-tabs');
76
74
  const reactResizablePanels = require('react-resizable-panels');
77
75
  const semver = require('semver');
78
76
 
@@ -95,7 +93,6 @@ function _interopNamespaceDefault(e) {
95
93
 
96
94
  const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
97
95
  const TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TooltipPrimitive);
98
- const AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(AvatarPrimitive);
99
96
  const DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
100
97
  const CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(CollapsiblePrimitive);
101
98
  const ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(ScrollAreaPrimitive);
@@ -109,50 +106,51 @@ const VisuallyHidden__namespace = /*#__PURE__*/_interopNamespaceDefault(Visually
109
106
  const HoverCard__namespace = /*#__PURE__*/_interopNamespaceDefault(HoverCard);
110
107
  const SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespaceDefault(SwitchPrimitives);
111
108
  const AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(AlertDialogPrimitive);
112
- const TabsPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TabsPrimitive);
109
+ const RadixTabs__namespace = /*#__PURE__*/_interopNamespaceDefault(RadixTabs);
113
110
 
114
111
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
115
112
 
116
- const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
117
- const cx = clsx;
118
- const cva = (base, config)=>(props)=>{
119
- var _config_compoundVariants;
120
- if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
121
- const { variants, defaultVariants } = config;
122
- const getVariantClassNames = Object.keys(variants).map((variant)=>{
123
- const variantProp = props === null || props === void 0 ? void 0 : props[variant];
124
- const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
125
- if (variantProp === null) return null;
126
- const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
127
- return variants[variant][variantKey];
128
- });
129
- const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
130
- let [key, value] = param;
131
- if (value === undefined) {
132
- return acc;
133
- }
134
- acc[key] = value;
135
- return acc;
136
- }, {});
137
- const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{
138
- let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
139
- return Object.entries(compoundVariantOptions).every((param)=>{
140
- let [key, value] = param;
141
- return Array.isArray(value) ? value.includes({
142
- ...defaultVariants,
143
- ...propsWithoutUndefined
144
- }[key]) : ({
145
- ...defaultVariants,
146
- ...propsWithoutUndefined
147
- })[key] === value;
148
- }) ? [
149
- ...acc,
150
- cvClass,
151
- cvClassName
152
- ] : acc;
153
- }, []);
154
- return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
155
- };
113
+ const sizeClasses$1 = {
114
+ md: "h-button-md gap-md",
115
+ lg: "h-button-lg gap-lg"
116
+ };
117
+ const variantClasses$2 = {
118
+ default: "bg-surface2 hover:bg-surface4 text-icon3 hover:text-icon6 disabled:opacity-50",
119
+ light: "bg-surface3 hover:bg-surface5 text-icon6 disabled:opacity-50",
120
+ outline: "bg-transparent hover:bg-surface2 text-icon3 hover:text-icon6 disabled:opacity-50",
121
+ ghost: "bg-transparent border-transparent hover:bg-surface2 text-icon3 hover:text-icon6 disabled:opacity-50"
122
+ };
123
+ function buttonVariants(options) {
124
+ const variant = options?.variant || "default";
125
+ const size = options?.size || "md";
126
+ return clsx(
127
+ "bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
128
+ variantClasses$2[variant],
129
+ sizeClasses$1[size]
130
+ );
131
+ }
132
+ const Button = React.forwardRef(
133
+ ({ className, as, size = "md", variant = "default", ...props }, ref) => {
134
+ const Component = as || "button";
135
+ return /* @__PURE__ */ jsxRuntime.jsx(
136
+ Component,
137
+ {
138
+ ref,
139
+ className: clsx(
140
+ "bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
141
+ variantClasses$2[variant],
142
+ sizeClasses$1[size],
143
+ className,
144
+ {
145
+ "cursor-not-allowed": props.disabled
146
+ }
147
+ ),
148
+ ...props
149
+ }
150
+ );
151
+ }
152
+ );
153
+ Button.displayName = "Button";
156
154
 
157
155
  const CLASS_PART_SEPARATOR = '-';
158
156
  const createClassGroupUtils = config => {
@@ -3113,39 +3111,6 @@ function cn(...inputs) {
3113
3111
  return twMerge(clsx(inputs));
3114
3112
  }
3115
3113
 
3116
- const buttonVariants = cva(
3117
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
3118
- {
3119
- variants: {
3120
- variant: {
3121
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
3122
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
3123
- outline: "border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground",
3124
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
3125
- ghost: "hover:bg-accent hover:text-accent-foreground",
3126
- link: "text-primary underline-offset-4 hover:underline"
3127
- },
3128
- size: {
3129
- default: "h-9 px-4 py-2",
3130
- sm: "h-8 rounded-md px-3 text-xs",
3131
- lg: "h-10 rounded-md px-8",
3132
- icon: "h-9 w-9"
3133
- }
3134
- },
3135
- defaultVariants: {
3136
- variant: "default",
3137
- size: "default"
3138
- }
3139
- }
3140
- );
3141
- const Button$2 = React__namespace.forwardRef(
3142
- ({ className, variant, size, asChild = false, ...props }, ref) => {
3143
- const Comp = asChild ? reactSlot.Slot : "button";
3144
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
3145
- }
3146
- );
3147
- Button$2.displayName = "Button";
3148
-
3149
3114
  const TooltipProvider = TooltipPrimitive__namespace.Provider;
3150
3115
  const Tooltip = TooltipPrimitive__namespace.Root;
3151
3116
  const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
@@ -3166,46 +3131,43 @@ TooltipContent.displayName = TooltipPrimitive__namespace.Content.displayName;
3166
3131
  const TooltipIconButton = React.forwardRef(
3167
3132
  ({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
3168
3133
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
3169
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
3170
- Button$2,
3171
- {
3172
- variant: "ghost",
3173
- size: "icon",
3174
- ...rest,
3175
- className: cn("size-6 p-1", className),
3176
- ref,
3177
- "aria-label": tooltip,
3178
- children
3179
- }
3180
- ) }),
3134
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { ...rest, className: cn("size-6 p-1", className), ref, "aria-label": tooltip, children }) }),
3181
3135
  /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side, children: tooltip })
3182
3136
  ] }) });
3183
3137
  }
3184
3138
  );
3185
3139
  TooltipIconButton.displayName = "TooltipIconButton";
3186
3140
 
3187
- const Avatar = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3188
- AvatarPrimitive__namespace.Root,
3189
- {
3190
- ref,
3191
- className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
3192
- ...props
3193
- }
3194
- ));
3195
- Avatar.displayName = AvatarPrimitive__namespace.Root.displayName;
3196
- const AvatarImage = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(AvatarPrimitive__namespace.Image, { ref, className: cn("aspect-square h-full w-full", className), ...props }));
3197
- AvatarImage.displayName = AvatarPrimitive__namespace.Image.displayName;
3198
- const AvatarFallback = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3199
- AvatarPrimitive__namespace.Fallback,
3200
- {
3201
- ref,
3202
- className: cn("flex h-full w-full items-center justify-center rounded-full bg-muted", className),
3203
- ...props
3204
- }
3205
- ));
3206
- AvatarFallback.displayName = AvatarPrimitive__namespace.Fallback.displayName;
3141
+ const variants = {
3142
+ "header-md": "text-header-md leading-header-md",
3143
+ "ui-lg": "text-ui-lg leading-ui-lg",
3144
+ "ui-md": "text-ui-md leading-ui-md",
3145
+ "ui-sm": "text-ui-sm leading-ui-sm",
3146
+ "ui-xs": "text-ui-xs leading-ui-xs"
3147
+ };
3148
+ const fonts = {
3149
+ mono: "font-mono"
3150
+ };
3151
+ const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
3152
+ return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
3153
+ };
3207
3154
 
3208
- const SyntaxHighlighter$3 = reactSyntaxHighlighter.makePrismAsyncLightSyntaxHighlighter({
3155
+ const sizeClasses = {
3156
+ sm: "h-avatar-sm w-avatar-sm",
3157
+ md: "h-avatar-md w-avatar-md",
3158
+ lg: "h-avatar-lg w-avatar-lg"
3159
+ };
3160
+ const Avatar = ({ src, name, size = "sm" }) => {
3161
+ return /* @__PURE__ */ jsxRuntime.jsx(
3162
+ "div",
3163
+ {
3164
+ className: `${sizeClasses[size]} border-sm border-border1 bg-surface-3 shrink-0 overflow-hidden rounded-full flex items-center justify-center`,
3165
+ 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", children: name[0].toUpperCase() })
3166
+ }
3167
+ );
3168
+ };
3169
+
3170
+ const SyntaxHighlighter = reactSyntaxHighlighter.makePrismAsyncLightSyntaxHighlighter({
3209
3171
  style: prism.coldarkDark,
3210
3172
  customStyle: {
3211
3173
  margin: 0,
@@ -3463,7 +3425,7 @@ const defaultComponents = reactMarkdown.unstable_memoizeMarkdownComponents({
3463
3425
  );
3464
3426
  },
3465
3427
  CodeHeader,
3466
- SyntaxHighlighter: SyntaxHighlighter$3,
3428
+ SyntaxHighlighter,
3467
3429
  img: ImageWithFallback
3468
3430
  });
3469
3431
 
@@ -4264,21 +4226,7 @@ const AgentNetworkCoinIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", {
4264
4226
  ) }) })
4265
4227
  ] });
4266
4228
 
4267
- const variants = {
4268
- "header-md": "text-header-md leading-header-md",
4269
- "ui-lg": "text-ui-lg leading-ui-lg",
4270
- "ui-md": "text-ui-md leading-ui-md",
4271
- "ui-sm": "text-ui-sm leading-ui-sm",
4272
- "ui-xs": "text-ui-xs leading-ui-xs"
4273
- };
4274
- const fonts = {
4275
- mono: "font-mono"
4276
- };
4277
- const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) => {
4278
- return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
4279
- };
4280
-
4281
- const variantClasses$2 = {
4229
+ const variantClasses$1 = {
4282
4230
  warning: "bg-yellow-900/20 border-sm border-yellow-200 text-yellow-200",
4283
4231
  destructive: "bg-red-900/20 border-sm border-red-200 text-red-200",
4284
4232
  info: "bg-blue-900/20 border-sm border-blue-200 text-blue-200"
@@ -4290,7 +4238,7 @@ const variantIcons = {
4290
4238
  };
4291
4239
  const Alert$1 = ({ children, variant = "destructive" }) => {
4292
4240
  const Ico = variantIcons[variant];
4293
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx(variantClasses$2[variant], "p-2 rounded-md"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
4241
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx(variantClasses$1[variant], "p-2 rounded-md"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
4294
4242
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "mt-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(Ico, {}) }),
4295
4243
  /* @__PURE__ */ jsxRuntime.jsx("div", { children })
4296
4244
  ] }) });
@@ -4302,8 +4250,34 @@ const AlertDescription$1 = ({ children, as: As = "p" }) => {
4302
4250
  return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: As, variant: "ui-sm", children });
4303
4251
  };
4304
4252
 
4253
+ const variantClasses = {
4254
+ default: "text-icon3",
4255
+ success: "text-accent1",
4256
+ error: "text-accent2",
4257
+ info: "text-accent3"
4258
+ };
4259
+ const Badge = ({ icon, variant = "default", className, children, ...props }) => {
4260
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4261
+ "div",
4262
+ {
4263
+ className: clsx(
4264
+ "font-mono bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md shrink-0",
4265
+ icon ? "pl-md pr-1.5" : "px-1.5",
4266
+ icon || variant === "default" ? "text-icon5" : variantClasses[variant],
4267
+ className
4268
+ ),
4269
+ ...props,
4270
+ children: [
4271
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: variantClasses[variant], children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon }) }),
4272
+ children
4273
+ ]
4274
+ }
4275
+ );
4276
+ };
4277
+
4305
4278
  const ErrorAwareText = () => {
4306
4279
  const part = react.useAssistantState(({ part: part2 }) => part2);
4280
+ const [collapsedCompletionCheck, setCollapsedCompletionCheck] = React.useState(false);
4307
4281
  const text = part.text || "";
4308
4282
  const metadata = part.metadata || {};
4309
4283
  if (metadata?.status === "tripwire") {
@@ -4321,6 +4295,21 @@ const ErrorAwareText = () => {
4321
4295
  /* @__PURE__ */ jsxRuntime.jsx(AlertDescription$1, { as: "p", children: text })
4322
4296
  ] });
4323
4297
  }
4298
+ if (metadata?.mode === "network" && metadata?.completionResult) {
4299
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2 space-y-2", children: [
4300
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { onClick: () => setCollapsedCompletionCheck((s) => !s), className: "flex items-center gap-2", children: [
4301
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: cn("transition-all", collapsedCompletionCheck ? "rotate-90" : "rotate-180") }) }),
4302
+ /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "info", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircleIcon, {}), children: [
4303
+ collapsedCompletionCheck ? "Show" : "Hide",
4304
+ " completion check"
4305
+ ] })
4306
+ ] }),
4307
+ !collapsedCompletionCheck && /* @__PURE__ */ jsxRuntime.jsxs(Alert$1, { variant: "info", children: [
4308
+ /* @__PURE__ */ jsxRuntime.jsx(AlertTitle$1, { as: "h5", children: metadata.completionResult?.passed ? "Complete" : "Not Complete" }),
4309
+ /* @__PURE__ */ jsxRuntime.jsx(MarkdownText, {})
4310
+ ] })
4311
+ ] });
4312
+ }
4324
4313
  try {
4325
4314
  const trimmedText = text.trim();
4326
4315
  if (trimmedText.startsWith("__ERROR__:")) {
@@ -4391,32 +4380,37 @@ function CopyButton({
4391
4380
  ] });
4392
4381
  }
4393
4382
 
4394
- const useCodemirrorTheme$2 = () => {
4395
- return React.useMemo(
4396
- () => codemirrorThemeDracula.draculaInit({
4383
+ const useCodemirrorTheme$1 = () => {
4384
+ return React.useMemo(() => {
4385
+ const baseTheme = codemirrorThemeDracula.draculaInit({
4397
4386
  settings: {
4398
4387
  fontFamily: "var(--geist-mono)",
4399
4388
  fontSize: "0.8rem",
4400
4389
  lineHighlight: "transparent",
4401
4390
  gutterBackground: "transparent",
4402
- background: "transparent",
4403
- gutterForeground: "#939393"
4391
+ gutterForeground: "#939393",
4392
+ background: "transparent"
4404
4393
  },
4405
4394
  styles: [{ tag: [highlight$1.tags.className, highlight$1.tags.propertyName] }]
4406
- }),
4407
- []
4408
- );
4395
+ });
4396
+ const customLineNumberTheme = view.EditorView.theme({
4397
+ ".cm-editor": {
4398
+ colorScheme: "dark",
4399
+ backgroundColor: "transparent"
4400
+ },
4401
+ ".cm-lineNumbers .cm-gutterElement": {
4402
+ color: "#939393"
4403
+ }
4404
+ });
4405
+ return [baseTheme, customLineNumberTheme];
4406
+ }, []);
4409
4407
  };
4410
- const SyntaxHighlighter$2 = ({
4411
- data,
4412
- className,
4413
- ...props
4414
- }) => {
4415
- const formattedCode = JSON.stringify(data, null, 2);
4416
- const theme = useCodemirrorTheme$2();
4408
+ const CodeEditor = ({ data, value, onChange, showCopyButton = true, className, ...props }) => {
4409
+ const theme = useCodemirrorTheme$1();
4410
+ const formattedCode = data ? JSON.stringify(data, null, 2) : value ?? "";
4417
4411
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("rounded-md bg-surface4 p-1 font-mono relative", className), ...props, children: [
4418
- /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: formattedCode, className: "absolute top-2 right-2 z-20" }),
4419
- /* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { value: formattedCode, theme, extensions: [langJson.jsonLanguage] })
4412
+ showCopyButton && /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: formattedCode, className: "absolute top-2 right-2 z-20" }),
4413
+ /* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { value: formattedCode, theme, extensions: [langJson.jsonLanguage], onChange })
4420
4414
  ] });
4421
4415
  };
4422
4416
  async function highlight(code, language) {
@@ -4433,31 +4427,6 @@ async function highlight(code, language) {
4433
4427
  return tokens;
4434
4428
  }
4435
4429
 
4436
- const variantClasses$1 = {
4437
- default: "text-icon3",
4438
- success: "text-accent1",
4439
- error: "text-accent2",
4440
- info: "text-accent3"
4441
- };
4442
- const Badge = ({ icon, variant = "default", className, children, ...props }) => {
4443
- return /* @__PURE__ */ jsxRuntime.jsxs(
4444
- "div",
4445
- {
4446
- className: clsx(
4447
- "font-mono bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md shrink-0",
4448
- icon ? "pl-md pr-1.5" : "px-1.5",
4449
- icon || variant === "default" ? "text-icon5" : variantClasses$1[variant],
4450
- className
4451
- ),
4452
- ...props,
4453
- children: [
4454
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: variantClasses$1[variant], children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon }) }),
4455
- children
4456
- ]
4457
- }
4458
- );
4459
- };
4460
-
4461
4430
  const BadgeWrapper = ({
4462
4431
  children,
4463
4432
  initialCollapsed = true,
@@ -4547,7 +4516,7 @@ const NetworkChoiceMetadata = ({ selectionReason, open, onOpenChange, input }) =
4547
4516
  let inputSlot = null;
4548
4517
  if (input) {
4549
4518
  try {
4550
- inputSlot = typeof input === "object" ? /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: input }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: JSON.parse(input) });
4519
+ inputSlot = typeof input === "object" ? /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: input }) : /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: JSON.parse(input) });
4551
4520
  } catch {
4552
4521
  inputSlot = /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap", children: input });
4553
4522
  }
@@ -4588,33 +4557,6 @@ const NetworkChoiceMetadataDialogTrigger = ({
4588
4557
  ] });
4589
4558
  };
4590
4559
 
4591
- const sizeClasses = {
4592
- md: "h-button-md gap-md",
4593
- lg: "h-button-lg gap-lg"
4594
- };
4595
- const variantClasses = {
4596
- default: "bg-surface2 hover:bg-surface4 text-icon3 hover:text-icon6 disabled:opacity-50",
4597
- light: "bg-surface3 hover:bg-surface5 text-icon6 disabled:opacity-50"
4598
- };
4599
- const Button$1 = ({ className, as, size = "md", variant = "default", ...props }) => {
4600
- const Component = as || "button";
4601
- return /* @__PURE__ */ jsxRuntime.jsx(
4602
- Component,
4603
- {
4604
- className: clsx(
4605
- "bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border",
4606
- variantClasses[variant],
4607
- sizeClasses[size],
4608
- className,
4609
- {
4610
- "cursor-not-allowed": props.disabled
4611
- }
4612
- ),
4613
- ...props
4614
- }
4615
- );
4616
- };
4617
-
4618
4560
  const ToolCallContext = React.createContext(void 0);
4619
4561
  function ToolCallProvider({
4620
4562
  children,
@@ -4647,7 +4589,7 @@ const ToolApprovalButtons = ({ toolCalled, toolCallId, toolApprovalMetadata }) =
4647
4589
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Approval required" }),
4648
4590
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 items-center", children: [
4649
4591
  /* @__PURE__ */ jsxRuntime.jsxs(
4650
- Button$1,
4592
+ Button,
4651
4593
  {
4652
4594
  onClick: handleApprove,
4653
4595
  disabled: isRunning || !!toolCallApprovalStatus,
@@ -4659,7 +4601,7 @@ const ToolApprovalButtons = ({ toolCalled, toolCallId, toolApprovalMetadata }) =
4659
4601
  }
4660
4602
  ),
4661
4603
  /* @__PURE__ */ jsxRuntime.jsxs(
4662
- Button$1,
4604
+ Button,
4663
4605
  {
4664
4606
  onClick: handleDecline,
4665
4607
  disabled: isRunning || !!toolCallApprovalStatus,
@@ -4689,12 +4631,12 @@ const ToolBadge = ({
4689
4631
  let argSlot = null;
4690
4632
  try {
4691
4633
  const { __mastraMetadata: _, ...formattedArgs } = typeof args === "object" ? args : JSON.parse(args);
4692
- argSlot = /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: formattedArgs, "data-testid": "tool-args" });
4634
+ argSlot = /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: formattedArgs, "data-testid": "tool-args" });
4693
4635
  } catch {
4694
4636
  argSlot = /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto", children: args });
4695
4637
  }
4696
- let resultSlot = typeof result === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto", children: result }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: result, "data-testid": "tool-result" });
4697
- let suspendPayloadSlot = typeof suspendPayload === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto", children: suspendPayload }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: suspendPayload, "data-testid": "tool-suspend-payload" });
4638
+ let resultSlot = typeof result === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto", children: result }) : /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: result, "data-testid": "tool-result" });
4639
+ let suspendPayloadSlot = typeof suspendPayload === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto", children: suspendPayload }) : /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: suspendPayload, "data-testid": "tool-suspend-payload" });
4698
4640
  const selectionReason = metadata?.mode === "network" ? metadata.selectionReason : void 0;
4699
4641
  const agentNetworkInput = metadata?.mode === "network" ? metadata.agentInput : void 0;
4700
4642
  const toolCalled = result || toolOutput.length > 0;
@@ -4727,7 +4669,7 @@ const ToolBadge = ({
4727
4669
  ] }),
4728
4670
  toolOutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4729
4671
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool output" }),
4730
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-40 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: toolOutput, "data-testid": "tool-output" }) })
4672
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-40 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: toolOutput, "data-testid": "tool-output" }) })
4731
4673
  ] }),
4732
4674
  /* @__PURE__ */ jsxRuntime.jsx(
4733
4675
  ToolApprovalButtons,
@@ -5145,6 +5087,7 @@ const useStreamWorkflow = ({ debugMode }) => {
5145
5087
  workflowId,
5146
5088
  runId,
5147
5089
  inputData,
5090
+ initialState,
5148
5091
  requestContext: playgroundRequestContext,
5149
5092
  perStep
5150
5093
  }) => {
@@ -5160,8 +5103,9 @@ const useStreamWorkflow = ({ debugMode }) => {
5160
5103
  });
5161
5104
  const workflow = client.getWorkflow(workflowId);
5162
5105
  const run = await workflow.createRun({ runId });
5163
- const stream = await run.streamVNext({
5106
+ const stream = await run.stream({
5164
5107
  inputData,
5108
+ initialState,
5165
5109
  requestContext: requestContext$1,
5166
5110
  closeOnSuspend: true,
5167
5111
  tracingOptions: settings?.tracingOptions,
@@ -5224,7 +5168,7 @@ const useStreamWorkflow = ({ debugMode }) => {
5224
5168
  }
5225
5169
  const workflow = client.getWorkflow(workflowId);
5226
5170
  const run = await workflow.createRun({ runId });
5227
- const stream = await run.observeStreamVNext();
5171
+ const stream = await run.observeStream();
5228
5172
  if (!stream) {
5229
5173
  return handleStreamError(new Error("No stream returned"), "No stream returned", setIsStreaming);
5230
5174
  }
@@ -5284,7 +5228,7 @@ const useStreamWorkflow = ({ debugMode }) => {
5284
5228
  requestContext$1.set(key, value);
5285
5229
  });
5286
5230
  const run = await workflow.createRun({ runId });
5287
- const stream = await run.resumeStreamVNext({
5231
+ const stream = await run.resumeStream({
5288
5232
  step,
5289
5233
  resumeData,
5290
5234
  requestContext: requestContext$1,
@@ -5511,11 +5455,11 @@ const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
5511
5455
  }, [isEndOfListInView, query.hasNextPage, query.isFetchingNextPage]);
5512
5456
  return { ...query, setEndOfListElement };
5513
5457
  };
5514
- const useWorkflowRunExecutionResult = (workflowId, runId, refetchInterval) => {
5458
+ const useWorkflowRun = (workflowId, runId, refetchInterval) => {
5515
5459
  const client = react$1.useMastraClient();
5516
5460
  return reactQuery.useQuery({
5517
- queryKey: ["workflow-run-execution-result", workflowId, runId],
5518
- queryFn: () => client.getWorkflow(workflowId).runExecutionResult(runId),
5461
+ queryKey: ["workflow-run", workflowId, runId],
5462
+ queryFn: () => client.getWorkflow(workflowId).runById(runId),
5519
5463
  enabled: Boolean(workflowId && runId),
5520
5464
  gcTime: 0,
5521
5465
  staleTime: 0,
@@ -5605,7 +5549,7 @@ function WorkflowRunProvider({
5605
5549
  const [isRunning, setIsRunning] = React.useState(false);
5606
5550
  const [debugMode, setDebugMode] = React.useState(false);
5607
5551
  const refetchExecResultInterval = isRunning ? void 0 : ["success", "failed", "canceled", "bailed"].includes(result?.status ?? "") ? void 0 : 5e3;
5608
- const { isLoading: isLoadingRunExecutionResult, data: runExecutionResult } = useWorkflowRunExecutionResult(
5552
+ const { isLoading: isLoadingRunExecutionResult, data: runExecutionResult } = useWorkflowRun(
5609
5553
  workflowId,
5610
5554
  initialRunId ?? "",
5611
5555
  refetchExecResultInterval
@@ -5620,7 +5564,8 @@ function WorkflowRunProvider({
5620
5564
  result: runExecutionResult?.result,
5621
5565
  error: runExecutionResult?.error,
5622
5566
  runId: initialRunId,
5623
- serializedStepGraph: runExecutionResult?.serializedStepGraph
5567
+ serializedStepGraph: runExecutionResult?.serializedStepGraph,
5568
+ value: runExecutionResult?.initialState
5624
5569
  } : void 0;
5625
5570
  }, [runExecutionResult, initialRunId]);
5626
5571
  const { data: workflow, isLoading, error } = useWorkflow(workflowId);
@@ -5645,7 +5590,14 @@ function WorkflowRunProvider({
5645
5590
  React.useEffect(() => {
5646
5591
  if (runSnapshot?.runId) {
5647
5592
  setResult(convertWorkflowRunStateToStreamResult(runSnapshot));
5648
- setPayload(runSnapshot.context?.input);
5593
+ if (runSnapshot.value && Object.keys(runSnapshot.value).length > 0) {
5594
+ setPayload({
5595
+ initialState: runSnapshot.value,
5596
+ inputData: runSnapshot.context?.input
5597
+ });
5598
+ } else {
5599
+ setPayload(runSnapshot.context?.input);
5600
+ }
5649
5601
  setRunId(runSnapshot.runId);
5650
5602
  }
5651
5603
  }, [runSnapshot]);
@@ -6096,6 +6048,47 @@ const constructNodesAndEdges = ({
6096
6048
  return { nodes: layoutedNodes, edges: layoutedEdges };
6097
6049
  };
6098
6050
 
6051
+ const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
6052
+ const cx = clsx;
6053
+ const cva = (base, config)=>(props)=>{
6054
+ var _config_compoundVariants;
6055
+ if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
6056
+ const { variants, defaultVariants } = config;
6057
+ const getVariantClassNames = Object.keys(variants).map((variant)=>{
6058
+ const variantProp = props === null || props === void 0 ? void 0 : props[variant];
6059
+ const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
6060
+ if (variantProp === null) return null;
6061
+ const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
6062
+ return variants[variant][variantKey];
6063
+ });
6064
+ const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
6065
+ let [key, value] = param;
6066
+ if (value === undefined) {
6067
+ return acc;
6068
+ }
6069
+ acc[key] = value;
6070
+ return acc;
6071
+ }, {});
6072
+ const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{
6073
+ let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
6074
+ return Object.entries(compoundVariantOptions).every((param)=>{
6075
+ let [key, value] = param;
6076
+ return Array.isArray(value) ? value.includes({
6077
+ ...defaultVariants,
6078
+ ...propsWithoutUndefined
6079
+ }[key]) : ({
6080
+ ...defaultVariants,
6081
+ ...propsWithoutUndefined
6082
+ })[key] === value;
6083
+ }) ? [
6084
+ ...acc,
6085
+ cvClass,
6086
+ cvClassName
6087
+ ] : acc;
6088
+ }, []);
6089
+ return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
6090
+ };
6091
+
6099
6092
  const textVariants = cva("block", {
6100
6093
  variants: {
6101
6094
  variant: {
@@ -6319,39 +6312,6 @@ const useCurrentRun = () => {
6319
6312
  return { steps, runId: context.runId };
6320
6313
  };
6321
6314
 
6322
- const useCodemirrorTheme$1 = () => {
6323
- return React.useMemo(() => {
6324
- const baseTheme = codemirrorThemeDracula.draculaInit({
6325
- settings: {
6326
- fontFamily: "var(--geist-mono)",
6327
- fontSize: "0.8rem",
6328
- lineHighlight: "transparent",
6329
- gutterBackground: "transparent",
6330
- gutterForeground: "#939393",
6331
- background: "transparent"
6332
- },
6333
- styles: [{ tag: [highlight$1.tags.className, highlight$1.tags.propertyName] }]
6334
- });
6335
- const customLineNumberTheme = view.EditorView.theme({
6336
- ".cm-editor": {
6337
- colorScheme: "dark",
6338
- // ensures color scheme
6339
- backgroundColor: "transparent"
6340
- },
6341
- ".cm-lineNumbers .cm-gutterElement": {
6342
- color: "#939393"
6343
- // ← custom line number color
6344
- }
6345
- });
6346
- return [baseTheme, customLineNumberTheme];
6347
- }, []);
6348
- };
6349
- const SyntaxHighlighter$1 = ({ data }) => {
6350
- const formattedCode = JSON.stringify(data, null, 2);
6351
- const theme = useCodemirrorTheme$1();
6352
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md bg-[#1a1a1a] p-1 font-mono", children: /* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { value: formattedCode, theme, extensions: [langJson.jsonLanguage] }) });
6353
- };
6354
-
6355
6315
  const CodeDialogContent = ({
6356
6316
  data,
6357
6317
  language = "auto"
@@ -6442,7 +6402,7 @@ const ErrorMessage = ({ error }) => /* @__PURE__ */ jsxRuntime.jsxs(Alert, { var
6442
6402
  /* @__PURE__ */ jsxRuntime.jsx(AlertTitle, { children: error })
6443
6403
  ] });
6444
6404
 
6445
- const SubmitButton = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Button$2, { type: "submit", children });
6405
+ const SubmitButton = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", children });
6446
6406
 
6447
6407
  const inputVariants = cva(
6448
6408
  "flex w-full text-icon6 rounded-lg border bg-transparent shadow-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50",
@@ -6554,62 +6514,44 @@ const BooleanField = ({ field, label, id, inputProps, value }) => /* @__PURE__ *
6554
6514
  ] })
6555
6515
  ] });
6556
6516
 
6557
- function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
6517
+ function DatePicker({ className, classNames, showOutsideDays = true, ...props }) {
6558
6518
  return /* @__PURE__ */ jsxRuntime.jsx(
6559
6519
  reactDayPicker.DayPicker,
6560
6520
  {
6561
6521
  showOutsideDays,
6562
6522
  className: cn("p-3", className),
6563
6523
  classNames: {
6564
- months: "flex flex-col space-y-4 sm:space-y-0",
6565
- month: "space-y-4",
6566
- // month_caption: 'flex justify-center pt-1 relative items-center',
6567
- caption_label: "text-sm text-text font-medium",
6568
- nav: "space-x-1 flex items-center",
6524
+ months: "flex flex-col space-y-4 sm:space-y-0 ",
6525
+ month: "space-y-4 text-[0.75rem] ",
6526
+ caption: "flex justify-between pt-1 items-center pl-2",
6527
+ caption_label: "text-text font-medium ",
6528
+ nav: "flex items-center",
6569
6529
  nav_button_previous: cn(
6570
- buttonVariants({ variant: "outline" }),
6571
- "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
6572
- "absolute left-4 top-[56px] z-10"
6573
- ),
6574
- nav_button_next: cn(
6575
- buttonVariants({ variant: "outline" }),
6576
- "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
6577
- "absolute right-4 top-[56px] z-10"
6530
+ "flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
6578
6531
  ),
6532
+ nav_button_next: cn("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),
6579
6533
  dropdown_month: "w-full border-collapse space-y-1",
6580
6534
  weeknumber: "flex",
6581
6535
  day: cn(
6582
- buttonVariants({ variant: "ghost" }),
6583
- "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
6536
+ "relative p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
6584
6537
  props.mode === "range" ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" : "[&:has([aria-selected])]:rounded-md",
6585
6538
  "h-8 w-8 p-0 hover:bg-lightGray-7/50 font-normal aria-selected:opacity-100"
6586
6539
  ),
6587
6540
  day_range_start: "day-range-start",
6588
6541
  day_range_end: "day-range-end",
6589
- day_selected: "!bg-primary !text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
6590
- day_today: "bg-lightGray-7/50 text-accent-foreground",
6542
+ day_selected: "!bg-primary/50 !text-primary-foreground hover:bg-primary rounded-md hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
6543
+ day_today: "bg-primary/10 text-accent-foreground",
6591
6544
  day_outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
6592
6545
  day_disabled: "text-muted-foreground opacity-50",
6593
6546
  day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
6594
6547
  day_hidden: "invisible",
6548
+ head_cell: "text-[0.625rem] text-muted-foreground",
6595
6549
  ...classNames
6596
6550
  },
6597
- components: {
6598
- // IconDropdown: ({ }) => (
6599
- // <CalendarIcon
6600
- // className={cn('h-4 w-4', {
6601
- // 'rotate-180': orientation === 'up',
6602
- // 'rotate-90': orientation === 'left',
6603
- // '-rotate-90': orientation === 'right',
6604
- // })}
6605
- // />
6606
- // ),
6607
- },
6608
6551
  ...props
6609
6552
  }
6610
6553
  );
6611
6554
  }
6612
- Calendar.displayName = "Calendar";
6613
6555
 
6614
6556
  const Popover = PopoverPrimitive__namespace.Root;
6615
6557
  const PopoverTrigger = PopoverPrimitive__namespace.Trigger;
@@ -6629,163 +6571,10 @@ const PopoverContent = React__namespace.forwardRef(({ className, align = "center
6629
6571
  ) }));
6630
6572
  PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
6631
6573
 
6632
- const DatePicker$1 = ({
6633
- value,
6634
- setValue,
6635
- children,
6636
- className,
6637
- placeholder,
6638
- ...props
6639
- }) => {
6640
- const [openPopover, setOpenPopover] = React__namespace.useState(false);
6641
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: openPopover, onOpenChange: setOpenPopover, children: [
6642
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: children ? children : /* @__PURE__ */ jsxRuntime.jsx(
6643
- DefaultButton,
6644
- {
6645
- value,
6646
- placeholder,
6647
- className,
6648
- "data-testid": "datepicker-button"
6649
- }
6650
- ) }),
6651
- /* @__PURE__ */ jsxRuntime.jsx(
6652
- PopoverContent,
6653
- {
6654
- className: "backdrop-blur-4xl w-auto p-0 bg-[#171717]",
6655
- align: "start",
6656
- "data-testid": "datepicker-calendar",
6657
- children: /* @__PURE__ */ jsxRuntime.jsx(
6658
- DatePickerOnly,
6659
- {
6660
- value,
6661
- setValue,
6662
- clearable: props.clearable,
6663
- setOpenPopover,
6664
- ...props
6665
- }
6666
- )
6667
- }
6668
- )
6669
- ] });
6670
- };
6671
- const DatePickerOnly = ({
6672
- value,
6673
- setValue,
6674
- setOpenPopover,
6675
- clearable,
6676
- placeholder,
6677
- className,
6678
- ...props
6679
- }) => {
6680
- const [inputValue, setInputValue] = React__namespace.useState(value ? dateFns.format(value, "PP") : "");
6681
- const [selected, setSelected] = React__namespace.useState(value ? new Date(value) : void 0);
6682
- const debouncedDateUpdate = useDebounce.useDebouncedCallback((date) => {
6683
- if (dateFns.isValid(date)) {
6684
- setSelected(date);
6685
- setValue?.(date);
6686
- setOpenPopover?.(false);
6687
- }
6688
- }, 2e3);
6689
- const handleInputChange = (e) => {
6690
- setInputValue(e.currentTarget.value);
6691
- const date = new Date(e.target.value);
6692
- debouncedDateUpdate(date);
6693
- };
6694
- const handleDaySelect = (date) => {
6695
- setSelected(date);
6696
- setValue?.(date);
6697
- setOpenPopover?.(false);
6698
- if (date) {
6699
- setInputValue(dateFns.format(date, "PP"));
6700
- } else {
6701
- setInputValue("");
6702
- }
6703
- };
6704
- const handleMonthSelect = (date) => {
6705
- setSelected(date);
6706
- if (date) {
6707
- setInputValue(dateFns.format(date, "PP"));
6708
- } else {
6709
- setInputValue("");
6710
- }
6711
- };
6712
- return /* @__PURE__ */ jsxRuntime.jsxs(
6713
- "div",
6714
- {
6715
- "aria-label": "Choose date",
6716
- className: "relative mt-2 flex flex-col gap-2",
6717
- onKeyDown: (e) => {
6718
- e.stopPropagation();
6719
- if (e.key === "Escape") {
6720
- setOpenPopover?.(false);
6721
- }
6722
- },
6723
- children: [
6724
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full px-3", children: /* @__PURE__ */ jsxRuntime.jsx(
6725
- Input,
6726
- {
6727
- type: "text",
6728
- value: inputValue,
6729
- onChange: handleInputChange,
6730
- placeholder,
6731
- className
6732
- }
6733
- ) }),
6734
- /* @__PURE__ */ jsxRuntime.jsx(
6735
- Calendar,
6736
- {
6737
- mode: "single",
6738
- month: selected,
6739
- selected,
6740
- onMonthChange: handleMonthSelect,
6741
- onSelect: handleDaySelect,
6742
- ...props
6743
- }
6744
- ),
6745
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 pb-2", children: clearable && /* @__PURE__ */ jsxRuntime.jsx(
6746
- Button$2,
6747
- {
6748
- variant: "outline",
6749
- tabIndex: 0,
6750
- className: "w-full !opacity-50 duration-200 hover:!opacity-100",
6751
- onClick: () => {
6752
- setValue(null);
6753
- setSelected(void 0);
6754
- setInputValue("");
6755
- setOpenPopover?.(false);
6756
- },
6757
- children: "Clear"
6758
- }
6759
- ) })
6760
- ]
6761
- }
6762
- );
6763
- };
6764
- const DefaultButton = React__namespace.forwardRef(
6765
- ({ value, placeholder, className, ...props }, ref) => {
6766
- return /* @__PURE__ */ jsxRuntime.jsxs(
6767
- Button$2,
6768
- {
6769
- ref,
6770
- variant: "outline",
6771
- className: cn(
6772
- "bg-neutral-825 border-neutral-775 w-full justify-start whitespace-nowrap rounded-md border px-2 py-0 text-left flex items-center gap-1",
6773
- className
6774
- ),
6775
- ...props,
6776
- children: [
6777
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "h-4 w-4" }),
6778
- value ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white", children: dateFns.format(value, "PPP") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray", children: placeholder ?? "Pick a date" })
6779
- ]
6780
- }
6781
- );
6782
- }
6783
- );
6784
- DefaultButton.displayName = "DefaultButton";
6785
-
6786
6574
  const DateField = ({ inputProps, field, error, id }) => {
6787
6575
  const { key, ...props } = inputProps;
6788
- const [value, setValue] = React.useState(null);
6576
+ const [value, setValue] = React.useState(void 0);
6577
+ const [open, setOpen] = React.useState(false);
6789
6578
  React.useEffect(() => {
6790
6579
  if (field.default) {
6791
6580
  const date = new Date(field.default);
@@ -6794,24 +6583,32 @@ const DateField = ({ inputProps, field, error, id }) => {
6794
6583
  }
6795
6584
  }
6796
6585
  }, [field]);
6797
- return /* @__PURE__ */ jsxRuntime.jsx(
6798
- DatePicker$1,
6799
- {
6800
- id,
6801
- className: error ? "border-destructive" : "",
6802
- value,
6803
- setValue: (date) => {
6804
- const newDate = date ? new Date(date).toISOString() : date;
6805
- if (newDate) {
6806
- props.onChange({
6807
- target: { value: newDate?.toString(), name: inputProps.name }
6808
- });
6809
- setValue(new Date(newDate));
6810
- }
6811
- },
6812
- clearable: true
6586
+ const handleSelect = (date) => {
6587
+ setValue(date);
6588
+ if (date) {
6589
+ props.onChange({
6590
+ target: { value: date.toISOString(), name: inputProps.name }
6591
+ });
6813
6592
  }
6814
- );
6593
+ setOpen(false);
6594
+ };
6595
+ const handleClear = () => {
6596
+ setValue(void 0);
6597
+ props.onChange({
6598
+ target: { value: "", name: inputProps.name }
6599
+ });
6600
+ setOpen(false);
6601
+ };
6602
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
6603
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { id, variant: "light", size: "lg", className: cn("w-full", error ? "border-destructive" : ""), children: [
6604
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "h-4 w-4" }),
6605
+ value ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white", children: dateFns.format(value, "PPP") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray", children: "Pick a date" })
6606
+ ] }) }),
6607
+ /* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { className: "w-auto p-0 bg-surface4", align: "start", children: [
6608
+ /* @__PURE__ */ jsxRuntime.jsx(DatePicker, { mode: "single", selected: value, onSelect: handleSelect, month: value, onMonthChange: setValue }),
6609
+ value && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3 pt-0", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "light", size: "lg", className: "w-full", onClick: handleClear, children: "Clear" }) })
6610
+ ] })
6611
+ ] });
6815
6612
  };
6816
6613
 
6817
6614
  const Select$1 = SelectPrimitive__namespace.Root;
@@ -6906,7 +6703,7 @@ const ObjectWrapper = ({ label, children }) => {
6906
6703
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Braces, {}) }),
6907
6704
  label
6908
6705
  ] }),
6909
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: () => setIsOpen(!isOpen), type: "button", className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: cn("transition-all", isOpen ? "rotate-180" : "rotate-0") }) }) })
6706
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsOpen(!isOpen), type: "button", className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: cn("transition-all", isOpen ? "rotate-180" : "rotate-0") }) }) })
6910
6707
  ] }),
6911
6708
  isOpen && /* @__PURE__ */ jsxRuntime.jsx(
6912
6709
  "div",
@@ -6945,7 +6742,7 @@ const ArrayWrapper = ({ label, children, onAddItem }) => {
6945
6742
  const ArrayElementWrapper = ({ children, onRemove }) => {
6946
6743
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pl-4 border-l border-border1", children: [
6947
6744
  children,
6948
- /* @__PURE__ */ jsxRuntime.jsxs(Button$1, { onClick: onRemove, type: "button", children: [
6745
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: onRemove, type: "button", children: [
6949
6746
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrashIcon, {}) }),
6950
6747
  "Delete"
6951
6748
  ] })
@@ -7004,17 +6801,7 @@ const RecordField = ({ inputProps, field, error, id }) => {
7004
6801
  };
7005
6802
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
7006
6803
  pairs.map((pair) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative space-y-2 rounded-lg border p-4", children: [
7007
- /* @__PURE__ */ jsxRuntime.jsx(
7008
- Button$2,
7009
- {
7010
- type: "button",
7011
- variant: "ghost",
7012
- size: "icon",
7013
- className: "absolute right-2 top-2",
7014
- onClick: () => removePair(pair.id),
7015
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrashIcon, { className: "h-4 w-4" })
7016
- }
7017
- ),
6804
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", className: "absolute right-2 top-2", onClick: () => removePair(pair.id), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrashIcon, { className: "h-4 w-4" }) }),
7018
6805
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 pt-6", children: [
7019
6806
  /* @__PURE__ */ jsxRuntime.jsx(
7020
6807
  Input,
@@ -7036,7 +6823,7 @@ const RecordField = ({ inputProps, field, error, id }) => {
7036
6823
  )
7037
6824
  ] })
7038
6825
  ] }, pair.id)),
7039
- /* @__PURE__ */ jsxRuntime.jsxs(Button$2, { type: "button", variant: "outline", size: "sm", className: "w-full", onClick: addPair, children: [
6826
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { type: "button", className: "w-full", onClick: addPair, children: [
7040
6827
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "mr-2 h-4 w-4" }),
7041
6828
  "Add Key-Value Pair"
7042
6829
  ] })
@@ -7581,7 +7368,7 @@ function DynamicForm({
7581
7368
  noValidate: true
7582
7369
  },
7583
7370
  uiComponents: {
7584
- SubmitButton: ({ children: children2 }) => onSubmit ? /* @__PURE__ */ jsxRuntime.jsx(Button$1, { variant: "light", className: "w-full", size: "lg", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : submitButtonLabel || children2 }) : null
7371
+ SubmitButton: ({ children: children2 }) => onSubmit ? /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "light", className: "w-full", size: "lg", disabled: isSubmitLoading, children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) }) : submitButtonLabel || children2 }) : null
7585
7372
  },
7586
7373
  formComponents: {
7587
7374
  Label: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-normal", children: value })
@@ -7706,14 +7493,14 @@ const JSONInput = ({
7706
7493
  ] }),
7707
7494
  /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-disc list-inside", children: errors.map((error, idx) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-ui-sm text-accent2", children: error }, idx)) })
7708
7495
  ] }),
7709
- /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter, { data: inputData, onChange: setInputData }),
7496
+ /* @__PURE__ */ jsxRuntime.jsx(JsonEditor, { data: inputData, onChange: setInputData }),
7710
7497
  children,
7711
- withoutSubmit ? null : /* @__PURE__ */ jsxRuntime.jsx(Button$1, { variant: "light", onClick: handleSubmit, className: "w-full", size: "lg", children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) : submitButtonLabel })
7498
+ withoutSubmit ? null : /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "light", onClick: handleSubmit, className: "w-full", size: "lg", children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) : submitButtonLabel })
7712
7499
  ] });
7713
7500
  };
7714
- const SyntaxHighlighter = ({ data, onChange }) => {
7715
- const theme = useCodemirrorTheme$2();
7716
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md bg-[#1a1a1a] p-1 font-mono", children: [
7501
+ const JsonEditor = ({ data, onChange }) => {
7502
+ const theme = useCodemirrorTheme$1();
7503
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md bg-surface4 p-1 font-mono relative", children: [
7717
7504
  /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: data, className: "absolute top-2 right-2 z-10" }),
7718
7505
  /* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { value: data, theme, extensions: [langJson.jsonLanguage], onChange })
7719
7506
  ] });
@@ -7899,12 +7686,18 @@ const WorkflowTimeTravelForm = ({
7899
7686
  }
7900
7687
  try {
7901
7688
  const parsed = superjson.parse(stepDefinition.inputSchema);
7902
- return { schema: resolveSerializedZodOutput(jsonToZod.jsonSchemaToZod(parsed)), schemaError: null };
7689
+ const zodStateSchema = workflow?.stateSchema ? resolveSerializedZodOutput(jsonToZod.jsonSchemaToZod(superjson.parse(workflow.stateSchema))) : null;
7690
+ const zodStepSchema = resolveSerializedZodOutput(jsonToZod.jsonSchemaToZod(parsed));
7691
+ const schemaToUse = zodStateSchema ? z.z.object({
7692
+ inputData: zodStepSchema,
7693
+ initialState: zodStateSchema.optional()
7694
+ }) : zodStepSchema;
7695
+ return { schema: schemaToUse, schemaError: null };
7903
7696
  } catch (err) {
7904
7697
  console.error("Failed to parse step schema", err);
7905
7698
  return { schema: z.z.record(z.z.string(), z.z.any()) };
7906
7699
  }
7907
- }, [stepDefinition?.inputSchema]);
7700
+ }, [stepDefinition?.inputSchema, workflow?.stateSchema]);
7908
7701
  const handleSubmit = async (data) => {
7909
7702
  setFormError(null);
7910
7703
  setIsSubmitting(true);
@@ -7912,11 +7705,14 @@ const WorkflowTimeTravelForm = ({
7912
7705
  const parsedResume = resumeData.trim() ? JSON.parse(resumeData) : {};
7913
7706
  const parsedContext = contextValue.trim() ? JSON.parse(contextValue) : {};
7914
7707
  const parsedNestedContext = nestedContextValue.trim() ? JSON.parse(nestedContextValue) : {};
7708
+ const { initialState, inputData: dataInputData } = data ?? {};
7709
+ const inputData2 = workflow?.stateSchema ? dataInputData : data;
7915
7710
  const payload = {
7916
7711
  runId: prevRunId,
7917
7712
  workflowId,
7918
7713
  step: stepKey,
7919
- inputData: data,
7714
+ inputData: inputData2,
7715
+ initialState,
7920
7716
  resumeData: Object.keys(parsedResume)?.length > 0 ? parsedResume : void 0,
7921
7717
  context: Object.keys(parsedContext)?.length > 0 ? parsedContext : void 0,
7922
7718
  nestedStepsContext: Object.keys(parsedNestedContext)?.length > 0 ? parsedNestedContext : void 0,
@@ -8135,9 +7931,9 @@ const WorkflowStepActionBar = ({
8135
7931
  status === "running" && "bg-accent6Dark"
8136
7932
  ),
8137
7933
  children: [
8138
- onShowNestedGraph && /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: handleNestedGraphClick, className: cn(isNestedGraphOpen && activeButtonClass), children: "View nested graph" }),
7934
+ onShowNestedGraph && /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleNestedGraphClick, className: cn(isNestedGraphOpen && activeButtonClass), children: "View nested graph" }),
8139
7935
  showTimeTravel && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8140
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: () => setIsTimeTravelOpen(true), children: "Time travel" }),
7936
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsTimeTravelOpen(true), children: "Time travel" }),
8141
7937
  /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isTimeTravelOpen, onOpenChange: setIsTimeTravelOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
8142
7938
  /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
8143
7939
  "Time travel to ",
@@ -8148,7 +7944,7 @@ const WorkflowStepActionBar = ({
8148
7944
  ] }),
8149
7945
  showDebugMode && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8150
7946
  /* @__PURE__ */ jsxRuntime.jsx(
8151
- Button$1,
7947
+ Button,
8152
7948
  {
8153
7949
  onClick: () => {
8154
7950
  if (mapConfig) {
@@ -8177,7 +7973,7 @@ const WorkflowStepActionBar = ({
8177
7973
  ) })
8178
7974
  ] }) }),
8179
7975
  /* @__PURE__ */ jsxRuntime.jsx(
8180
- Button$1,
7976
+ Button,
8181
7977
  {
8182
7978
  onClick: () => {
8183
7979
  if (mapConfig) {
@@ -8206,9 +8002,9 @@ const WorkflowStepActionBar = ({
8206
8002
  ) })
8207
8003
  ] }) })
8208
8004
  ] }),
8209
- mapConfig && /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: handleMapConfigClick, className: cn(isMapConfigOpen && activeButtonClass), children: "Map config" }),
8005
+ mapConfig && /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleMapConfigClick, className: cn(isMapConfigOpen && activeButtonClass), children: "Map config" }),
8210
8006
  input && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8211
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: () => setIsInputOpen(true), children: "Input" }),
8007
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsInputOpen(true), children: "Input" }),
8212
8008
  /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isInputOpen, onOpenChange: setIsInputOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
8213
8009
  /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
8214
8010
  stepName,
@@ -8218,7 +8014,7 @@ const WorkflowStepActionBar = ({
8218
8014
  ] }) })
8219
8015
  ] }),
8220
8016
  resumeData && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8221
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: () => setIsResumeDataOpen(true), children: "Resume data" }),
8017
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsResumeDataOpen(true), children: "Resume data" }),
8222
8018
  /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isResumeDataOpen, onOpenChange: setIsResumeDataOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
8223
8019
  /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
8224
8020
  stepName,
@@ -8228,7 +8024,7 @@ const WorkflowStepActionBar = ({
8228
8024
  ] }) })
8229
8025
  ] }),
8230
8026
  (output ?? suspendOutput) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8231
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: () => setIsOutputOpen(true), children: "Output" }),
8027
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsOutputOpen(true), children: "Output" }),
8232
8028
  /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isOutputOpen, onOpenChange: setIsOutputOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
8233
8029
  /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
8234
8030
  stepName,
@@ -8238,7 +8034,7 @@ const WorkflowStepActionBar = ({
8238
8034
  ] }) })
8239
8035
  ] }),
8240
8036
  error && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8241
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: () => setIsErrorOpen(true), children: "Error" }),
8037
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsErrorOpen(true), children: "Error" }),
8242
8038
  /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isErrorOpen, onOpenChange: setIsErrorOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
8243
8039
  /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
8244
8040
  stepName,
@@ -8248,7 +8044,7 @@ const WorkflowStepActionBar = ({
8248
8044
  ] }) })
8249
8045
  ] }),
8250
8046
  tripwire && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8251
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: () => setIsTripwireOpen(true), className: "text-amber-400 hover:text-amber-300", children: "Tripwire" }),
8047
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsTripwireOpen(true), className: "text-amber-400 hover:text-amber-300", children: "Tripwire" }),
8252
8048
  /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isTripwireOpen, onOpenChange: setIsTripwireOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: dialogContentClass, children: [
8253
8049
  /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: dialogTitleClass, children: [
8254
8050
  stepName,
@@ -8723,7 +8519,7 @@ const ZoomSlider = React.forwardRef(({ className, ...props }) => {
8723
8519
  const { zoom } = react$2.useViewport();
8724
8520
  const { zoomTo, zoomIn, zoomOut, fitView } = react$2.useReactFlow();
8725
8521
  return /* @__PURE__ */ jsxRuntime.jsxs(react$2.Panel, { className: cn("flex gap-1 rounded-md bg-primary-foreground p-1 text-foreground", className), ...props, children: [
8726
- /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "ghost", size: "icon", onClick: () => zoomOut({ duration: 300 }), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minus, { className: "h-4 w-4" }) }),
8522
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => zoomOut({ duration: 300 }), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minus, { className: "h-4 w-4" }) }),
8727
8523
  /* @__PURE__ */ jsxRuntime.jsx(
8728
8524
  Slider,
8729
8525
  {
@@ -8737,12 +8533,12 @@ const ZoomSlider = React.forwardRef(({ className, ...props }) => {
8737
8533
  }
8738
8534
  }
8739
8535
  ),
8740
- /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "ghost", size: "icon", onClick: () => zoomIn({ duration: 300 }), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }) }),
8741
- /* @__PURE__ */ jsxRuntime.jsxs(Button$2, { className: "min-w-20 tabular-nums", variant: "ghost", onClick: () => zoomTo(1, { duration: 300 }), children: [
8536
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => zoomIn({ duration: 300 }), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" }) }),
8537
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { className: "min-w-20 tabular-nums", onClick: () => zoomTo(1, { duration: 300 }), children: [
8742
8538
  (100 * zoom).toFixed(0),
8743
8539
  "%"
8744
8540
  ] }),
8745
- /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "ghost", size: "icon", onClick: () => fitView({ duration: 300, maxZoom: 1 }), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize, { className: "h-4 w-4" }) })
8541
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => fitView({ duration: 300, maxZoom: 1 }), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize, { className: "h-4 w-4" }) })
8746
8542
  ] });
8747
8543
  });
8748
8544
  ZoomSlider.displayName = "ZoomSlider";
@@ -8913,10 +8709,7 @@ const WorkflowStatus = ({ stepId, status, result, tripwire }) => {
8913
8709
  onToggleExpand: () => setIsTripwireExpanded(!isTripwireExpanded),
8914
8710
  hasMetadata: hasTripwireMetadata
8915
8711
  }
8916
- ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md bg-surface4 p-1 font-mono relative", children: [
8917
- /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: JSON.stringify(result, null, 2), className: "absolute top-2 right-2 z-10" }),
8918
- /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$1, { data: result })
8919
- ] })
8712
+ ) : /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: result })
8920
8713
  }
8921
8714
  );
8922
8715
  };
@@ -8992,6 +8785,7 @@ function WorkflowTrigger({
8992
8785
  const [innerRunId, setInnerRunId] = React.useState("");
8993
8786
  const [cancelResponse, setCancelResponse] = React.useState(null);
8994
8787
  const triggerSchema = workflow?.inputSchema;
8788
+ const stateSchema = workflow?.stateSchema;
8995
8789
  const handleExecuteWorkflow = async (data) => {
8996
8790
  try {
8997
8791
  if (!workflow) return;
@@ -9002,7 +8796,9 @@ function WorkflowTrigger({
9002
8796
  setRunId?.(run.runId);
9003
8797
  setInnerRunId(run.runId);
9004
8798
  setContextRunId(run.runId);
9005
- streamWorkflow({ workflowId, runId: run.runId, inputData: data, requestContext });
8799
+ const { initialState, inputData: dataInputData } = data ?? {};
8800
+ const inputData = stateSchema ? dataInputData : data;
8801
+ streamWorkflow({ workflowId, runId: run.runId, inputData, initialState, requestContext });
9006
8802
  } catch (err) {
9007
8803
  setIsRunning(false);
9008
8804
  sonner.toast.error("Error executing workflow");
@@ -9056,6 +8852,11 @@ function WorkflowTrigger({
9056
8852
  if (!workflow) return null;
9057
8853
  const isSuspendedSteps = suspendedSteps.length > 0;
9058
8854
  const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonToZod.jsonSchemaToZod(superjson.parse(triggerSchema))) : null;
8855
+ const zodStateSchema = stateSchema ? resolveSerializedZodOutput(jsonToZod.jsonSchemaToZod(superjson.parse(stateSchema))) : null;
8856
+ const zodSchemaToUse = zodStateSchema ? z.z.object({
8857
+ inputData: zodInputSchema,
8858
+ initialState: zodStateSchema
8859
+ }) : zodInputSchema;
9059
8860
  const workflowActivePaths = streamResultToUse?.steps ?? {};
9060
8861
  const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
9061
8862
  const doneStatuses = ["success", "failed", "canceled", "tripwire"];
@@ -9065,10 +8866,10 @@ function WorkflowTrigger({
9065
8866
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin text-icon6" }) }),
9066
8867
  /* @__PURE__ */ jsxRuntime.jsx(Txt, { children: "Resuming workflow" })
9067
8868
  ] }),
9068
- !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodInputSchema ? /* @__PURE__ */ jsxRuntime.jsx(
8869
+ !isSuspendedSteps && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: zodSchemaToUse ? /* @__PURE__ */ jsxRuntime.jsx(
9069
8870
  WorkflowInputData,
9070
8871
  {
9071
- schema: zodInputSchema,
8872
+ schema: zodSchemaToUse,
9072
8873
  defaultValues: payload,
9073
8874
  isSubmitLoading: isStreamingWorkflow,
9074
8875
  submitButtonLabel: "Run",
@@ -9079,7 +8880,7 @@ function WorkflowTrigger({
9079
8880
  withoutSubmit: !!paramsRunId
9080
8881
  }
9081
8882
  ) : !!paramsRunId ? null : /* @__PURE__ */ jsxRuntime.jsx(
9082
- Button$1,
8883
+ Button,
9083
8884
  {
9084
8885
  className: "w-full",
9085
8886
  variant: "light",
@@ -9121,7 +8922,7 @@ function WorkflowTrigger({
9121
8922
  ] }, step.stepId);
9122
8923
  }),
9123
8924
  result?.status === "running" && /* @__PURE__ */ jsxRuntime.jsxs(
9124
- Button$1,
8925
+ Button,
9125
8926
  {
9126
8927
  variant: "light",
9127
8928
  className: "w-full",
@@ -9179,13 +8980,13 @@ function WorkflowTrigger({
9179
8980
  const WorkflowJsonDialog = ({ result }) => {
9180
8981
  const [open, setOpen] = React.useState(false);
9181
8982
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9182
- /* @__PURE__ */ jsxRuntime.jsxs(Button$1, { variant: "light", onClick: () => setOpen(true), className: "w-full", size: "lg", children: [
8983
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "light", onClick: () => setOpen(true), className: "w-full", size: "lg", children: [
9183
8984
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Braces, { className: "text-icon3" }) }),
9184
8985
  "Open Workflow Execution (JSON)"
9185
8986
  ] }),
9186
8987
  /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntime.jsx(DialogPortal, { children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-w-6xl max-h-[90vh] overflow-y-auto overflow-x-hidden bg-surface2", children: [
9187
8988
  /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Workflow Execution (JSON)" }),
9188
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full overflow-x-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: result, className: "p-4" }) })
8989
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full overflow-x-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: result, className: "p-4" }) })
9189
8990
  ] }) }) })
9190
8991
  ] });
9191
8992
  };
@@ -9647,7 +9448,7 @@ const EmptyWorkflowsTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { classN
9647
9448
  titleSlot: "Configure Workflows",
9648
9449
  descriptionSlot: "Mastra workflows are not configured yet. You can find more information in the documentation.",
9649
9450
  actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
9650
- Button$1,
9451
+ Button,
9651
9452
  {
9652
9453
  size: "lg",
9653
9454
  className: "w-full",
@@ -9674,38 +9475,7 @@ const EntityHeader = ({ icon, title, isLoading, children }) => {
9674
9475
  ] });
9675
9476
  };
9676
9477
 
9677
- const Tabs$1 = TabsPrimitive__namespace.Root;
9678
- const TabsList = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
9679
- TabsPrimitive__namespace.List,
9680
- {
9681
- ref,
9682
- className: clsx("bg-muted text-muted-foreground inline-flex items-center bg-transparent", className),
9683
- ...props
9684
- }
9685
- ));
9686
- TabsList.displayName = TabsPrimitive__namespace.List.displayName;
9687
- const TabsTrigger = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
9688
- TabsPrimitive__namespace.Trigger,
9689
- {
9690
- ref,
9691
- className: cn(
9692
- "-outline-offset-2 data-[state=active]:bg-background data-[state=active]:text-foreground whitespace-nowrap text-ui-lg text-icon3 -mb-[0.5px] inline-flex items-center justify-center border-b-2 border-transparent p-3 font-medium disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-b-2 data-[state=active]:border-white data-[state=active]:shadow",
9693
- className
9694
- ),
9695
- ...props
9696
- }
9697
- ));
9698
- TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
9699
- const TabsContent = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Content, { ref, className: cn("mt-2 -outline-offset-2", className), ...props }));
9700
- TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
9701
-
9702
- const PlaygroundTabs = ({
9703
- children,
9704
- defaultTab,
9705
- value,
9706
- onValueChange,
9707
- className
9708
- }) => {
9478
+ const Tabs = ({ children, defaultTab, value, onValueChange, className }) => {
9709
9479
  const [internalTab, setInternalTab] = React.useState(defaultTab);
9710
9480
  const isControlled = value !== void 0 && onValueChange !== void 0;
9711
9481
  const currentTab = isControlled ? value : internalTab;
@@ -9717,17 +9487,41 @@ const PlaygroundTabs = ({
9717
9487
  setInternalTab(typedValue);
9718
9488
  }
9719
9489
  };
9720
- return /* @__PURE__ */ jsxRuntime.jsx(Tabs$1, { value: currentTab, onValueChange: handleTabChange, className: cn("h-full overflow-x-auto", className), children });
9490
+ return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Root, { value: currentTab, onValueChange: handleTabChange, className: cn("overflow-y-auto", className), children });
9721
9491
  };
9722
- const TabList$1 = ({ children, className }) => {
9723
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full overflow-x-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx(TabsList, { className: "border-b border-border1 flex min-w-full shrink-0", children }) });
9492
+
9493
+ const TabList = ({ children, variant = "default", className }) => {
9494
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full overflow-x-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx(
9495
+ RadixTabs__namespace.List,
9496
+ {
9497
+ className: cn(
9498
+ "flex items-center",
9499
+ {
9500
+ // variant: default
9501
+ "text-[0.9375rem]": variant === "default",
9502
+ "[&>button]:py-[0.5rem] [&>button]:px-[1.5rem] [&>button]:font-normal [&>button]:text-icon3 [&>button]:flex-1 [&>button]:border-b [&>button]:border-border1": variant === "default",
9503
+ "[&>button[data-state=active]]:text-icon5 [&>button[data-state=active]]:transition-colors [&>button[data-state=active]]:duration-200 [&>button[data-state=active]]:border-icon3": variant === "default",
9504
+ // variant: buttons
9505
+ "border border-border1 flex justify-stretch rounded-md overflow-hidden text-[0.875rem] min-h-[2.5rem]": variant === "buttons",
9506
+ "[&>button]:flex-1 [&>button]:py-[0.5rem] [&>button]:px-[1rem] [&>button]:text-icon3": variant === "buttons",
9507
+ "[&>button[data-state=active]]:text-icon5 [&>button[data-state=active]]:bg-[#222]": variant === "buttons"
9508
+ },
9509
+ className
9510
+ ),
9511
+ children
9512
+ }
9513
+ ) });
9724
9514
  };
9725
- const Tab$1 = ({ children, value, onClick, onClose }) => {
9515
+
9516
+ const Tab = ({ children, value, onClick, onClose, className }) => {
9726
9517
  return /* @__PURE__ */ jsxRuntime.jsxs(
9727
- TabsTrigger,
9518
+ RadixTabs__namespace.Trigger,
9728
9519
  {
9729
9520
  value,
9730
- className: "text-xs p-3 text-mastra-el-3 data-[state=active]:text-mastra-el-5 data-[state=active]:border-b-2 whitespace-nowrap flex-shrink-0 flex items-center gap-1.5",
9521
+ className: cn(
9522
+ "text-xs p-3 text-mastra-el-3 data-[state=active]:text-mastra-el-5 data-[state=active]:border-b-2 whitespace-nowrap flex-shrink-0 flex items-center justify-center gap-1.5",
9523
+ className
9524
+ ),
9731
9525
  onClick,
9732
9526
  children: [
9733
9527
  children,
@@ -9747,8 +9541,19 @@ const Tab$1 = ({ children, value, onClick, onClose }) => {
9747
9541
  }
9748
9542
  );
9749
9543
  };
9750
- const TabContent$1 = ({ children, value }) => {
9751
- return /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value, className: "h-full overflow-auto flex flex-col", children });
9544
+
9545
+ const TabContent = ({ children, value, className }) => {
9546
+ return /* @__PURE__ */ jsxRuntime.jsx(
9547
+ RadixTabs__namespace.Content,
9548
+ {
9549
+ value,
9550
+ className: cn(
9551
+ "grid py-3 overflow-y-auto ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:none",
9552
+ className
9553
+ ),
9554
+ children
9555
+ }
9556
+ );
9752
9557
  };
9753
9558
 
9754
9559
  const WorkflowRunOptions = () => {
@@ -9986,12 +9791,12 @@ function WorkflowInformation({ workflowId, initialRunId }) {
9986
9791
  ] }),
9987
9792
  workflow?.isProcessorWorkflow && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cpu, { className: "h-3 w-3" }), className: "bg-violet-500/20 text-violet-400", children: "Processor" })
9988
9793
  ] }) }),
9989
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-auto border-t-sm border-border1 flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsxs(PlaygroundTabs, { defaultTab: "current-run", value: tab, onValueChange: handleTabChange, className: "h-full", children: [
9990
- /* @__PURE__ */ jsxRuntime.jsxs(TabList$1, { children: [
9991
- /* @__PURE__ */ jsxRuntime.jsx(Tab$1, { value: "current-run", children: "Current Run" }),
9992
- /* @__PURE__ */ jsxRuntime.jsx(Tab$1, { value: "run-options", children: "Run Options" }),
9794
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-auto border-t-sm border-border1 flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsxs(Tabs, { defaultTab: "current-run", value: tab, onValueChange: handleTabChange, className: "h-full", children: [
9795
+ /* @__PURE__ */ jsxRuntime.jsxs(TabList, { children: [
9796
+ /* @__PURE__ */ jsxRuntime.jsx(Tab, { value: "current-run", children: "Current Run" }),
9797
+ /* @__PURE__ */ jsxRuntime.jsx(Tab, { value: "run-options", children: "Run Options" }),
9993
9798
  stepDetail && nodeDetailTabName && /* @__PURE__ */ jsxRuntime.jsxs(
9994
- Tab$1,
9799
+ Tab,
9995
9800
  {
9996
9801
  value: "node-details",
9997
9802
  onClose: () => {
@@ -10005,7 +9810,7 @@ function WorkflowInformation({ workflowId, initialRunId }) {
10005
9810
  }
10006
9811
  )
10007
9812
  ] }),
10008
- /* @__PURE__ */ jsxRuntime.jsx(TabContent$1, { value: "current-run", children: workflowId ? initialRunId ? /* @__PURE__ */ jsxRuntime.jsx(
9813
+ /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "current-run", children: workflowId ? initialRunId ? /* @__PURE__ */ jsxRuntime.jsx(
10009
9814
  WorkflowRunDetail,
10010
9815
  {
10011
9816
  workflowId,
@@ -10038,8 +9843,8 @@ function WorkflowInformation({ workflowId, initialRunId }) {
10038
9843
  cancelWorkflowRun
10039
9844
  }
10040
9845
  ) : null }),
10041
- /* @__PURE__ */ jsxRuntime.jsx(TabContent$1, { value: "run-options", children: /* @__PURE__ */ jsxRuntime.jsx(TracingRunOptions, {}) }),
10042
- stepDetail && /* @__PURE__ */ jsxRuntime.jsx(TabContent$1, { value: "node-details", children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowStepDetailContent, {}) })
9846
+ /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "run-options", children: /* @__PURE__ */ jsxRuntime.jsx(TracingRunOptions, {}) }),
9847
+ stepDetail && /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "node-details", children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowStepDetailContent, {}) })
10043
9848
  ] }) })
10044
9849
  ] });
10045
9850
  }
@@ -10128,15 +9933,14 @@ function Combobox({
10128
9933
  }, [highlightedIndex]);
10129
9934
  return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
10130
9935
  /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
10131
- Button$2,
9936
+ Button,
10132
9937
  {
10133
9938
  ref: triggerRef,
10134
- variant,
10135
9939
  role: "combobox",
10136
9940
  "aria-expanded": open,
9941
+ variant,
10137
9942
  className: cn("w-full justify-between", className),
10138
9943
  disabled,
10139
- size: "sm",
10140
9944
  children: [
10141
9945
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-ui-lg", children: selectedOption ? selectedOption.label : placeholder }),
10142
9946
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
@@ -10237,8 +10041,7 @@ function WorkflowCombobox({
10237
10041
  searchPlaceholder,
10238
10042
  emptyText,
10239
10043
  className,
10240
- disabled: disabled || isLoading || isError,
10241
- variant: "ghost"
10044
+ disabled: disabled || isLoading || isError
10242
10045
  }
10243
10046
  );
10244
10047
  }
@@ -10345,7 +10148,7 @@ const CollapsiblePanel = ({ collapsedSize, children, direction, ...props }) => {
10345
10148
  }
10346
10149
  },
10347
10150
  children: collapsed ? /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
10348
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: expand, className: "!h-48 border-none", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: direction === "left" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, {}) }) }) }) }),
10151
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: expand, className: "!h-48 border-none", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: direction === "left" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, {}) }) }) }) }),
10349
10152
  /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Expand" })
10350
10153
  ] }) : children
10351
10154
  }
@@ -10429,7 +10232,7 @@ const WorkflowBadge = ({
10429
10232
  const snapshot = typeof run?.snapshot === "object" ? run?.snapshot : void 0;
10430
10233
  const selectionReason = metadata?.mode === "network" ? metadata.selectionReason : void 0;
10431
10234
  const agentNetworkInput = metadata?.mode === "network" ? metadata.agentInput : void 0;
10432
- let suspendPayloadSlot = typeof suspendPayload === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto", children: suspendPayload }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$1, { data: suspendPayload, "data-testid": "tool-suspend-payload" });
10235
+ let suspendPayloadSlot = typeof suspendPayload === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto", children: suspendPayload }) : /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: suspendPayload, "data-testid": "tool-suspend-payload" });
10433
10236
  if (isWorkflowLoading || !workflow) return /* @__PURE__ */ jsxRuntime.jsx(LoadingBadge, {});
10434
10237
  return /* @__PURE__ */ jsxRuntime.jsxs(
10435
10238
  BadgeWrapper,
@@ -10461,8 +10264,8 @@ const WorkflowBadgeExtended = ({ workflowId, workflow, runId }) => {
10461
10264
  const { Link } = useLinkComponent();
10462
10265
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10463
10266
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 pb-2", children: [
10464
- /* @__PURE__ */ jsxRuntime.jsx(Button$1, { as: Link, href: `/workflows/${workflowId}/graph`, children: "Go to workflow" }),
10465
- runId && /* @__PURE__ */ jsxRuntime.jsx(Button$1, { as: Link, href: `/workflows/${workflowId}/graph/${runId}`, children: "See run" })
10267
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { as: Link, href: `/workflows/${workflowId}/graph`, children: "Go to workflow" }),
10268
+ runId && /* @__PURE__ */ jsxRuntime.jsx(Button, { as: Link, href: `/workflows/${workflowId}/graph/${runId}`, children: "See run" })
10466
10269
  ] }),
10467
10270
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md overflow-hidden h-[60vh] w-full", children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowGraph, { workflowId, workflow }) })
10468
10271
  ] });
@@ -10557,11 +10360,14 @@ const AgentBadgeWrapper = ({
10557
10360
  toolCallId,
10558
10361
  toolApprovalMetadata
10559
10362
  }) => {
10560
- const { data } = useAgentMessages({
10363
+ const { data, isLoading } = useAgentMessages({
10561
10364
  threadId: result?.subAgentThreadId,
10562
10365
  agentId,
10563
10366
  memory: true
10564
10367
  });
10368
+ if (isLoading) {
10369
+ return /* @__PURE__ */ jsxRuntime.jsx(LoadingBadge, {});
10370
+ }
10565
10371
  const convertedMessages = data?.messages ? ui.toAISdkV5Messages(data.messages) : [];
10566
10372
  const childMessages = result?.childMessages ?? react$1.resolveToChildMessages(convertedMessages);
10567
10373
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -11098,7 +10904,9 @@ const ProviderLogo = ({ providerId, className = "", size = 20 }) => {
11098
10904
  const AssistantMessage = ({ hasModelList }) => {
11099
10905
  const data = react.useMessage();
11100
10906
  const messageId = data.id;
11101
- const isToolCallAndOrReasoning = data.content.every(({ type }) => type === "tool-call" || type === "reasoning");
10907
+ const isNotAssistantTextResponse = data.content.every(
10908
+ ({ type, metadata }) => type === "tool-call" || type === "reasoning" || type === "text" && metadata?.mode === "network" && metadata?.completionResult
10909
+ );
11102
10910
  const modelMetadata = data.metadata?.custom?.modelMetadata;
11103
10911
  const showModelUsed = hasModelList && modelMetadata;
11104
10912
  return /* @__PURE__ */ jsxRuntime.jsxs(react.MessagePrimitive.Root, { className: "max-w-full", "data-message-id": messageId, children: [
@@ -11112,7 +10920,7 @@ const AssistantMessage = ({ hasModelList }) => {
11112
10920
  }
11113
10921
  }
11114
10922
  ) }),
11115
- !isToolCallAndOrReasoning && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("h-6 pt-4 flex gap-2 items-center", { "pb-1": showModelUsed }), children: [
10923
+ !isNotAssistantTextResponse && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("h-6 pt-4 flex gap-2 items-center", { "pb-1": showModelUsed }), children: [
11116
10924
  showModelUsed && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
11117
10925
  /* @__PURE__ */ jsxRuntime.jsx(ProviderLogo, { providerId: modelMetadata.modelProvider, size: 14 }),
11118
10926
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-ui-xs leading-ui-xs", children: [
@@ -11626,7 +11434,7 @@ const AttachFileDialog = ({ onOpenChange, open }) => {
11626
11434
  }
11627
11435
  )
11628
11436
  ] }),
11629
- /* @__PURE__ */ jsxRuntime.jsxs(Button$1, { type: "submit", className: "!h-8", variant: "light", children: [
11437
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { type: "submit", className: "!h-8", variant: "light", children: [
11630
11438
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link, {}) }),
11631
11439
  "Add"
11632
11440
  ] })
@@ -11690,18 +11498,8 @@ const ThreadWrapper = ({ children }) => {
11690
11498
  return /* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.Root, { className: "grid grid-rows-[1fr_auto] h-full overflow-y-auto", "data-testid": "thread-wrapper", children });
11691
11499
  };
11692
11500
  const ThreadWelcome = ({ agentName }) => {
11693
- const safeAgentName = agentName ?? "";
11694
- const words = safeAgentName.split(" ") ?? [];
11695
- let initials = "A";
11696
- if (words.length === 2) {
11697
- initials = `${words[0][0]}${words[1][0]}`;
11698
- } else if (safeAgentName.length > 0) {
11699
- initials = `${safeAgentName[0]}`;
11700
- } else {
11701
- initials = "A";
11702
- }
11703
11501
  return /* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.Empty, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-grow flex-col items-center justify-center", children: [
11704
- /* @__PURE__ */ jsxRuntime.jsx(Avatar, { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: initials }) }),
11502
+ /* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: agentName || "Agent", size: "lg" }),
11705
11503
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
11706
11504
  ] }) });
11707
11505
  };
@@ -11751,7 +11549,6 @@ const SpeechInput = ({ agentId }) => {
11751
11549
  {
11752
11550
  type: "button",
11753
11551
  tooltip: isListening ? "Stop dictation" : "Start dictation",
11754
- variant: "ghost",
11755
11552
  className: "rounded-full",
11756
11553
  onClick: () => isListening ? stop() : start(),
11757
11554
  children: isListening ? /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
@@ -11766,7 +11563,6 @@ const ComposerAction = () => {
11766
11563
  {
11767
11564
  type: "button",
11768
11565
  tooltip: "Add attachment",
11769
- variant: "ghost",
11770
11566
  className: "rounded-full",
11771
11567
  onClick: () => setIsAddAttachmentDialogOpen(true),
11772
11568
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
@@ -11789,8 +11585,8 @@ const EditComposer = () => {
11789
11585
  return /* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { children: [
11790
11586
  /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, {}),
11791
11587
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11792
- /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "ghost", children: "Cancel" }) }),
11793
- /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { children: "Send" }) })
11588
+ /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border h-button-md gap-md hover:bg-surface4 text-icon3 hover:text-icon6", children: "Cancel" }) }),
11589
+ /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "bg-surface2 border-sm border-border1 px-lg text-ui-md inline-flex items-center justify-center rounded-md border h-button-md gap-md hover:bg-surface4 text-icon3 hover:text-icon6", children: "Send" }) })
11794
11590
  ] })
11795
11591
  ] });
11796
11592
  };
@@ -13153,6 +12949,27 @@ const useMemorySearch = ({
13153
12949
  }
13154
12950
  });
13155
12951
  };
12952
+ const useCloneThread = () => {
12953
+ const client = react$1.useMastraClient();
12954
+ const queryClient = reactQuery.useQueryClient();
12955
+ const { requestContext } = usePlaygroundStore();
12956
+ return reactQuery.useMutation({
12957
+ mutationFn: async ({ threadId, agentId, title }) => {
12958
+ const thread = client.getMemoryThread({ threadId, agentId });
12959
+ return thread.clone({ title, requestContext });
12960
+ },
12961
+ onSuccess: (_, variables) => {
12962
+ const { agentId } = variables;
12963
+ if (agentId) {
12964
+ queryClient.invalidateQueries({ queryKey: ["memory", "threads", agentId, agentId] });
12965
+ }
12966
+ sonner.toast.success("Thread cloned successfully");
12967
+ },
12968
+ onError: () => {
12969
+ sonner.toast.error("Failed to clone thread");
12970
+ }
12971
+ });
12972
+ };
13156
12973
 
13157
12974
  const NetworkCheckbox = ({ hasMemory, hasSubAgents }) => {
13158
12975
  const isNetworkAvailable = hasMemory && hasSubAgents;
@@ -13294,7 +13111,7 @@ const AgentSettings = ({ agentId }) => {
13294
13111
  ] })
13295
13112
  ] }),
13296
13113
  /* @__PURE__ */ jsxRuntime.jsx("section", { className: "py-7", children: /* @__PURE__ */ jsxRuntime.jsx(AgentAdvancedSettings, {}) }),
13297
- /* @__PURE__ */ jsxRuntime.jsxs(Button$1, { onClick: () => resetAll(), variant: "light", className: "w-full", size: "lg", children: [
13114
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: () => resetAll(), variant: "light", className: "w-full", size: "lg", children: [
13298
13115
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, {}) }),
13299
13116
  "Reset"
13300
13117
  ] })
@@ -13420,7 +13237,7 @@ const EmptyAgentsTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className
13420
13237
  titleSlot: "Configure Agents",
13421
13238
  descriptionSlot: "Mastra agents are not configured yet. You can find more information in the documentation.",
13422
13239
  actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
13423
- Button$1,
13240
+ Button,
13424
13241
  {
13425
13242
  size: "lg",
13426
13243
  className: "w-full",
@@ -13497,7 +13314,7 @@ const RequestContext = () => {
13497
13314
  className: "h-[400px] overflow-y-scroll bg-surface3 rounded-lg overflow-hidden p-3"
13498
13315
  }
13499
13316
  ),
13500
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: handleSaveRequestContext, children: "Save" }) })
13317
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleSaveRequestContext, children: "Save" }) })
13501
13318
  ] }) });
13502
13319
  };
13503
13320
  const RequestContextWrapper = ({ children }) => {
@@ -13505,7 +13322,7 @@ const RequestContextWrapper = ({ children }) => {
13505
13322
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-3xl p-5 overflow-y-scroll h-full", children: [
13506
13323
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg p-4 pb-5 bg-surface4 shadow-md space-y-3 border border-border1 mb-5", children: [
13507
13324
  /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-lg", className: "text-icon3", children: "Mastra provides request context, which is a system based on dependency injection that enables you to configure your agents and tools with runtime variables. If you find yourself creating several different agents that do very similar things, request context allows you to combine them into one agent." }),
13508
- /* @__PURE__ */ jsxRuntime.jsxs(Button$1, { as: Link, to: "https://mastra.ai/en/docs/agents/runtime-variables", target: "_blank", children: [
13325
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { as: Link, to: "https://mastra.ai/en/docs/agents/runtime-variables", target: "_blank", children: [
13509
13326
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, {}) }),
13510
13327
  "See documentation"
13511
13328
  ] })
@@ -14055,49 +13872,6 @@ function SideDialogRoot({
14055
13872
  ] }) });
14056
13873
  }
14057
13874
 
14058
- const Button = React.forwardRef(
14059
- ({ className, variant = "outline", isFaded, ...props }, ref) => {
14060
- return /* @__PURE__ */ jsxRuntime.jsx(
14061
- "button",
14062
- {
14063
- ref,
14064
- className: cn(
14065
- "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",
14066
- "[&:not(:disabled):hover]:border-[rgba(255,255,255,0.25)] [&:not(:disabled):hover]:text-[rgba(255,255,255,0.9)]",
14067
- "[&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:mx-[-0.3em] [&>svg]:opacity-70 [&>svg]:shrink-0",
14068
- "focus:outline-none focus:shadow-[inset_0_0_0_1px_rgba(24,251,111,0.75)]",
14069
- className,
14070
- {
14071
- "cursor-not-allowed opacity-50": props.disabled,
14072
- "bg-ui-primaryBtnBg text-ui-primaryBtnText hover:bg-surface6 leading-[0] font-semibold": variant === "primary",
14073
- "min-h-[2rem]": variant === "ghost",
14074
- "min-h-[2.5rem]": variant !== "ghost",
14075
- "border-[rgba(255,255,255,0.15)]": variant === "outline",
14076
- "opacity-40": isFaded
14077
- }
14078
- ),
14079
- ...props
14080
- }
14081
- );
14082
- }
14083
- );
14084
- Button.displayName = "Button";
14085
-
14086
- const CombinedButtons = ({ className, children }) => {
14087
- return /* @__PURE__ */ jsxRuntime.jsx(
14088
- "div",
14089
- {
14090
- className: cn(
14091
- "flex items-center text-[0.75rem] border border-border1 rounded-lg overflow-hidden",
14092
- "[&>button]:border-0 [&>button:not(:first-child)]:border-l [&>button:not(:first-child)]:border-border1",
14093
- "[&>button]:rounded-none [&>button:first-child]:rounded-l-lg [&>button:last-child]:rounded-r-lg",
14094
- className
14095
- ),
14096
- children
14097
- }
14098
- );
14099
- };
14100
-
14101
13875
  function ButtonsGroup({ children, className }) {
14102
13876
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(`flex gap-2 items-center`, "[&>button]:flex-grow", className), children });
14103
13877
  }
@@ -14170,7 +13944,7 @@ function SideDialogCodeSection({ codeStr = "", title, icon, simplified = false }
14170
13944
  ] }),
14171
13945
  /* @__PURE__ */ jsxRuntime.jsxs(ButtonsGroup, { children: [
14172
13946
  /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: codeStr || "No content" }),
14173
- hasMultilineText && /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setShowAsMultilineText(!showAsMultilineText), children: showAsMultilineText ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignLeftIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignJustifyIcon, {}) })
13947
+ hasMultilineText && /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setShowAsMultilineText(!showAsMultilineText), children: showAsMultilineText ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignLeftIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignJustifyIcon, {}) })
14174
13948
  ] })
14175
13949
  ] }),
14176
13950
  codeStr && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-black/20 p-[1rem] overflow-hidden rounded-xl border border-white/10 text-icon4 text-[0.875rem] break-all", children: simplified ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon4 font-mono break-all px-[0.5rem]", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-wrap", children: codeStr }) }) : /* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { extensions: [langJson.json(), CodeMirror.EditorView.lineWrapping], theme, value: finalCodeStr }) })
@@ -14245,11 +14019,11 @@ function SideDialogNav({ onNext, onPrevious, className }) {
14245
14019
  className
14246
14020
  ),
14247
14021
  children: (onNext || onPrevious) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex gap-[1rem] items-baseline"), children: [
14248
- /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: handleOnPrevious, disabled: !onPrevious, variant: "ghost", children: [
14022
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: handleOnPrevious, disabled: !onPrevious, children: [
14249
14023
  "Previous",
14250
14024
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpIcon, {})
14251
14025
  ] }),
14252
- /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: handleOnNext, disabled: !onNext, variant: "ghost", children: [
14026
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: handleOnNext, disabled: !onNext, children: [
14253
14027
  "Next",
14254
14028
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDownIcon, {})
14255
14029
  ] })
@@ -14300,45 +14074,6 @@ function PageHeader({ title, description, icon, className }) {
14300
14074
  ] });
14301
14075
  }
14302
14076
 
14303
- function DatePicker({ className, classNames, showOutsideDays = true, ...props }) {
14304
- return /* @__PURE__ */ jsxRuntime.jsx(
14305
- reactDayPicker.DayPicker,
14306
- {
14307
- showOutsideDays,
14308
- className: cn("p-3", className),
14309
- classNames: {
14310
- months: "flex flex-col space-y-4 sm:space-y-0 ",
14311
- month: "space-y-4 text-[0.75rem] ",
14312
- caption: "flex justify-between pt-1 items-center pl-2",
14313
- caption_label: "text-text font-medium ",
14314
- nav: "flex items-center",
14315
- nav_button_previous: cn(
14316
- "flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
14317
- ),
14318
- nav_button_next: cn("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),
14319
- dropdown_month: "w-full border-collapse space-y-1",
14320
- weeknumber: "flex",
14321
- day: cn(
14322
- "relative p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
14323
- props.mode === "range" ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" : "[&:has([aria-selected])]:rounded-md",
14324
- "h-8 w-8 p-0 hover:bg-lightGray-7/50 font-normal aria-selected:opacity-100"
14325
- ),
14326
- day_range_start: "day-range-start",
14327
- day_range_end: "day-range-end",
14328
- day_selected: "!bg-primary/50 !text-primary-foreground hover:bg-primary rounded-md hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
14329
- day_today: "bg-primary/10 text-accent-foreground",
14330
- day_outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
14331
- day_disabled: "text-muted-foreground opacity-50",
14332
- day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
14333
- day_hidden: "invisible",
14334
- head_cell: "text-[0.625rem] text-muted-foreground",
14335
- ...classNames
14336
- },
14337
- ...props
14338
- }
14339
- );
14340
- }
14341
-
14342
14077
  function Select({ name, onChange, defaultValue, value, options, placeholder }) {
14343
14078
  return /* @__PURE__ */ jsxRuntime.jsxs(Select$1, { name, onValueChange: onChange, value, children: [
14344
14079
  /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: placeholder || "Select..." }) }),
@@ -14619,7 +14354,8 @@ const DateTimePickerContent = ({
14619
14354
  /* @__PURE__ */ jsxRuntime.jsx(
14620
14355
  Button,
14621
14356
  {
14622
- variant: "primary",
14357
+ variant: "light",
14358
+ size: "lg",
14623
14359
  tabIndex: 0,
14624
14360
  onClick: () => {
14625
14361
  dateInputValueIsValid ? handleApply() : handleCancel();
@@ -14627,7 +14363,7 @@ const DateTimePickerContent = ({
14627
14363
  children: newValueDefined ? `Apply` : `Cancel`
14628
14364
  }
14629
14365
  ),
14630
- newValueDefined && /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", tabIndex: 0, onClick: handleClear, children: "Clear" })
14366
+ newValueDefined && /* @__PURE__ */ jsxRuntime.jsx(Button, { tabIndex: 0, onClick: handleClear, children: "Clear" })
14631
14367
  ] })
14632
14368
  ]
14633
14369
  }
@@ -14635,7 +14371,7 @@ const DateTimePickerContent = ({
14635
14371
  };
14636
14372
  const DefaultTrigger = React__namespace.forwardRef(
14637
14373
  ({ value, placeholder, className, ...props }, ref) => {
14638
- return /* @__PURE__ */ jsxRuntime.jsxs(Button, { ref, variant: "outline", className: cn("justify-start", className), ...props, children: [
14374
+ return /* @__PURE__ */ jsxRuntime.jsxs(Button, { ref, className: cn("justify-start", className), variant: "light", size: "lg", ...props, children: [
14639
14375
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "h-4 w-4" }),
14640
14376
  value ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white", children: dateFns.format(value, "PP p") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray", children: placeholder ?? "Pick a date" })
14641
14377
  ] });
@@ -14707,7 +14443,7 @@ function Notification({
14707
14443
  children
14708
14444
  }
14709
14445
  ),
14710
- dismissible && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onClick: () => setLocalIsVisible(false), children: [
14446
+ dismissible && /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: () => setLocalIsVisible(false), children: [
14711
14447
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
14712
14448
  /* @__PURE__ */ jsxRuntime.jsx(VisuallyHidden.VisuallyHidden, { children: "Dismiss" })
14713
14449
  ] })
@@ -15187,9 +14923,9 @@ function ScoresTools({ onEntityChange, onReset, selectedEntity, entityOptions, i
15187
14923
  disabled: isLoading
15188
14924
  }
15189
14925
  ),
15190
- /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "primary", onClick: onReset, disabled: isLoading, children: [
15191
- "Reset ",
15192
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {})
14926
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "light", size: "lg", className: "min-w-32", onClick: onReset, disabled: isLoading, children: [
14927
+ "Reset",
14928
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}) })
15193
14929
  ] })
15194
14930
  ] });
15195
14931
  }
@@ -15276,8 +15012,7 @@ function ScorerCombobox({
15276
15012
  searchPlaceholder,
15277
15013
  emptyText,
15278
15014
  className,
15279
- disabled: disabled || isLoading || isError,
15280
- variant: "ghost"
15015
+ disabled: disabled || isLoading || isError
15281
15016
  }
15282
15017
  );
15283
15018
  }
@@ -15346,7 +15081,7 @@ const EmptyScorersTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { classNam
15346
15081
  titleSlot: "Configure Scorers",
15347
15082
  descriptionSlot: "Mastra scorers are not configured yet. You can find more information in the documentation.",
15348
15083
  actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
15349
- Button$1,
15084
+ Button,
15350
15085
  {
15351
15086
  size: "lg",
15352
15087
  className: "w-full",
@@ -15900,7 +15635,7 @@ const AgentMetadataModelSwitcher = ({
15900
15635
  }
15901
15636
  ),
15902
15637
  /* @__PURE__ */ jsxRuntime.jsx(
15903
- Button$1,
15638
+ Button,
15904
15639
  {
15905
15640
  variant: "light",
15906
15641
  size: "md",
@@ -16077,7 +15812,7 @@ const PromptEnhancer = ({ agentId }) => {
16077
15812
  isDirty && /* @__PURE__ */ jsxRuntime.jsxs(Alert$1, { variant: "info", children: [
16078
15813
  /* @__PURE__ */ jsxRuntime.jsx(AlertTitle$1, { as: "h5", children: "Experiment mode" }),
16079
15814
  /* @__PURE__ */ jsxRuntime.jsx(AlertDescription$1, { as: "p", children: "You're editing this agent's instructions. Changes are saved locally in your browser but won't update the agent's code." }),
16080
- /* @__PURE__ */ jsxRuntime.jsxs(Button$1, { variant: "light", onClick: resetPrompt, children: [
15815
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "light", onClick: resetPrompt, children: [
16081
15816
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCcwIcon, {}) }),
16082
15817
  "Reset"
16083
15818
  ] })
@@ -16151,7 +15886,7 @@ const PromptEnhancerTextarea = ({ agentId }) => {
16151
15886
  ),
16152
15887
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end items-center gap-2", children: [
16153
15888
  showWarning && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-yellow-200", children: "No model with a configured API key found." }),
16154
- /* @__PURE__ */ jsxRuntime.jsxs(Button$1, { variant: "light", type: "submit", disabled: isDisabled, children: [
15889
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "light", type: "submit", disabled: isDisabled, children: [
16155
15890
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: isPending ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCcwIcon, {}) }),
16156
15891
  "Enhance prompt"
16157
15892
  ] })
@@ -16420,7 +16155,7 @@ const ThreadItem = ({ children, isActive, className }) => {
16420
16155
  };
16421
16156
  const ThreadDeleteButton = ({ onClick }) => {
16422
16157
  return /* @__PURE__ */ jsxRuntime.jsx(
16423
- Button$1,
16158
+ Button,
16424
16159
  {
16425
16160
  className: "shrink-0 border-none bg-transparent opacity-0 transition-all group-focus-within:opacity-100 group-hover:opacity-100",
16426
16161
  onClick,
@@ -16622,8 +16357,7 @@ function AgentCombobox({
16622
16357
  searchPlaceholder,
16623
16358
  emptyText,
16624
16359
  className,
16625
- disabled: disabled || isLoading || isError,
16626
- variant: "ghost"
16360
+ disabled: disabled || isLoading || isError
16627
16361
  }
16628
16362
  );
16629
16363
  }
@@ -16863,9 +16597,12 @@ function CodeDisplay({
16863
16597
 
16864
16598
  const AgentWorkingMemory = ({ agentId }) => {
16865
16599
  const { threadExists, workingMemoryData, workingMemorySource, isLoading, isUpdating, updateWorkingMemory } = useWorkingMemory();
16866
- const { data } = useMemoryConfig(agentId);
16600
+ const { data, isLoading: isConfigLoading } = useMemoryConfig(agentId);
16867
16601
  const config = data?.config;
16868
16602
  const isWorkingMemoryEnabled = Boolean(config?.workingMemory?.enabled);
16603
+ if (isLoading || isConfigLoading) {
16604
+ return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-32 w-full" });
16605
+ }
16869
16606
  const { isCopied, handleCopy } = useCopyToClipboard({
16870
16607
  text: workingMemoryData ?? "",
16871
16608
  copyMessage: "Working memory copied!"
@@ -16875,9 +16612,6 @@ const AgentWorkingMemory = ({ agentId }) => {
16875
16612
  React.useEffect(() => {
16876
16613
  setEditValue(workingMemoryData ?? "");
16877
16614
  }, [workingMemoryData]);
16878
- if (isLoading) {
16879
- return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-32 w-full" });
16880
- }
16881
16615
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 p-4", children: [
16882
16616
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
16883
16617
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
@@ -16927,24 +16661,12 @@ const AgentWorkingMemory = ({ agentId }) => {
16927
16661
  }
16928
16662
  ),
16929
16663
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-2", children: !isEditing ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !threadExists ? /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
16930
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { tabIndex: 0, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "secondary", size: "sm", disabled: true, className: "text-xs pointer-events-none", children: "Edit Working Memory" }) }) }),
16664
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { tabIndex: 0, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: true, className: "text-xs pointer-events-none", children: "Edit Working Memory" }) }) }),
16931
16665
  /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Working memory will be available after the agent calls updateWorkingMemory" }) })
16932
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
16933
- Button$2,
16934
- {
16935
- variant: "secondary",
16936
- size: "sm",
16937
- onClick: () => setIsEditing(true),
16938
- disabled: isUpdating,
16939
- className: "text-xs",
16940
- children: "Edit Working Memory"
16941
- }
16942
- ) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16666
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setIsEditing(true), disabled: isUpdating, className: "text-xs", children: "Edit Working Memory" }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16943
16667
  /* @__PURE__ */ jsxRuntime.jsx(
16944
- Button$2,
16668
+ Button,
16945
16669
  {
16946
- variant: "default",
16947
- size: "sm",
16948
16670
  onClick: async () => {
16949
16671
  try {
16950
16672
  await updateWorkingMemory(editValue);
@@ -16960,10 +16682,8 @@ const AgentWorkingMemory = ({ agentId }) => {
16960
16682
  }
16961
16683
  ),
16962
16684
  /* @__PURE__ */ jsxRuntime.jsx(
16963
- Button$2,
16685
+ Button,
16964
16686
  {
16965
- variant: "secondary",
16966
- size: "sm",
16967
16687
  onClick: () => {
16968
16688
  setEditValue(workingMemoryData ?? "");
16969
16689
  setIsEditing(false);
@@ -17281,16 +17001,7 @@ const MemorySearch = ({
17281
17001
  className: "pl-10 pr-10 bg-surface3 border-border1"
17282
17002
  }
17283
17003
  ),
17284
- query && /* @__PURE__ */ jsxRuntime.jsx(
17285
- Button$2,
17286
- {
17287
- onClick: clearSearch,
17288
- variant: "ghost",
17289
- size: "sm",
17290
- className: "absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0",
17291
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
17292
- }
17293
- )
17004
+ query && /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: clearSearch, className: "absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }) })
17294
17005
  ] }),
17295
17006
  (isOpen || query && (isSearching || results.length === 0)) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 flex-1 bg-surface3 border border-border1 rounded-lg shadow-lg overflow-y-auto", children: error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-red-500", children: error }) }) : isSearching && results.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3", children: "Searching..." }) }) : results.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon3", children: [
17296
17007
  'No results found for "',
@@ -17363,7 +17074,7 @@ const MemorySearch = ({
17363
17074
  function AgentMemory({ agentId, threadId }) {
17364
17075
  const { threadInput: chatInputValue } = useThreadInput();
17365
17076
  const { paths, navigate } = useLinkComponent();
17366
- const { data } = useMemoryConfig(agentId);
17077
+ const { data, isLoading: isConfigLoading } = useMemoryConfig(agentId);
17367
17078
  const config = data?.config;
17368
17079
  const isSemanticRecallEnabled = Boolean(config?.semanticRecall);
17369
17080
  const { mutateAsync: searchMemory, data: searchMemoryData } = useMemorySearch({
@@ -17372,6 +17083,14 @@ function AgentMemory({ agentId, threadId }) {
17372
17083
  // In playground, agentId is the resourceId
17373
17084
  threadId
17374
17085
  });
17086
+ const { mutateAsync: cloneThread, isPending: isCloning } = useCloneThread();
17087
+ const handleCloneThread = React.useCallback(async () => {
17088
+ if (!threadId || !agentId) return;
17089
+ const result = await cloneThread({ threadId, agentId });
17090
+ if (result?.thread?.id) {
17091
+ navigate(paths.agentThreadLink(agentId, result.thread.id));
17092
+ }
17093
+ }, [threadId, agentId, cloneThread, navigate, paths]);
17375
17094
  const handleResultClick = React.useCallback(
17376
17095
  (messageId, resultThreadId) => {
17377
17096
  if (resultThreadId && resultThreadId !== threadId) {
@@ -17390,7 +17109,24 @@ function AgentMemory({ agentId, threadId }) {
17390
17109
  [agentId, threadId, navigate]
17391
17110
  );
17392
17111
  const searchScope = searchMemoryData?.searchScope;
17112
+ if (isConfigLoading) {
17113
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full p-4 gap-4", children: [
17114
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-12 w-full" }),
17115
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-32 w-full" }),
17116
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-48 w-full" })
17117
+ ] });
17118
+ }
17393
17119
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full", children: [
17120
+ threadId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 border-b border-border1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
17121
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
17122
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-medium text-icon5", children: "Clone Thread" }),
17123
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-icon3 mt-1", children: "Create a copy of this conversation" })
17124
+ ] }),
17125
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: handleCloneThread, disabled: isCloning, children: [
17126
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "w-4 h-4 mr-2" }),
17127
+ isCloning ? "Cloning..." : "Clone"
17128
+ ] })
17129
+ ] }) }),
17394
17130
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 border-b border-border1", children: [
17395
17131
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
17396
17132
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-medium text-icon5", children: "Semantic Recall" }),
@@ -17440,21 +17176,21 @@ function AgentMemory({ agentId, threadId }) {
17440
17176
  }
17441
17177
 
17442
17178
  function AgentInformation({ agentId, threadId }) {
17443
- const { data: memory } = useMemory(agentId);
17444
- const hasMemory = Boolean(memory?.result);
17179
+ const { data: memory, isLoading: isMemoryLoading } = useMemory(agentId);
17180
+ const hasMemory = !isMemoryLoading && Boolean(memory?.result);
17445
17181
  return /* @__PURE__ */ jsxRuntime.jsxs(AgentInformationLayout, { agentId, children: [
17446
17182
  /* @__PURE__ */ jsxRuntime.jsx(AgentEntityHeader, { agentId }),
17447
17183
  /* @__PURE__ */ jsxRuntime.jsxs(AgentInformationTabLayout, { agentId, children: [
17448
- /* @__PURE__ */ jsxRuntime.jsxs(TabList$1, { children: [
17449
- /* @__PURE__ */ jsxRuntime.jsx(Tab$1, { value: "overview", children: "Overview" }),
17450
- /* @__PURE__ */ jsxRuntime.jsx(Tab$1, { value: "model-settings", children: "Model Settings" }),
17451
- hasMemory && /* @__PURE__ */ jsxRuntime.jsx(Tab$1, { value: "memory", children: "Memory" }),
17452
- /* @__PURE__ */ jsxRuntime.jsx(Tab$1, { value: "tracing-options", children: "Tracing Options" })
17184
+ /* @__PURE__ */ jsxRuntime.jsxs(TabList, { children: [
17185
+ /* @__PURE__ */ jsxRuntime.jsx(Tab, { value: "overview", children: "Overview" }),
17186
+ /* @__PURE__ */ jsxRuntime.jsx(Tab, { value: "model-settings", children: "Model Settings" }),
17187
+ hasMemory && /* @__PURE__ */ jsxRuntime.jsx(Tab, { value: "memory", children: "Memory" }),
17188
+ /* @__PURE__ */ jsxRuntime.jsx(Tab, { value: "tracing-options", children: "Tracing Options" })
17453
17189
  ] }),
17454
- /* @__PURE__ */ jsxRuntime.jsx(TabContent$1, { value: "overview", children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadata, { agentId }) }),
17455
- /* @__PURE__ */ jsxRuntime.jsx(TabContent$1, { value: "model-settings", children: /* @__PURE__ */ jsxRuntime.jsx(AgentSettings, { agentId }) }),
17456
- hasMemory && /* @__PURE__ */ jsxRuntime.jsx(TabContent$1, { value: "memory", children: /* @__PURE__ */ jsxRuntime.jsx(AgentMemory, { agentId, threadId }) }),
17457
- /* @__PURE__ */ jsxRuntime.jsx(TabContent$1, { value: "tracing-options", children: /* @__PURE__ */ jsxRuntime.jsx(TracingRunOptions, {}) })
17190
+ /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "overview", children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadata, { agentId }) }),
17191
+ /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "model-settings", children: /* @__PURE__ */ jsxRuntime.jsx(AgentSettings, { agentId }) }),
17192
+ hasMemory && /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "memory", children: /* @__PURE__ */ jsxRuntime.jsx(AgentMemory, { agentId, threadId }) }),
17193
+ /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "tracing-options", children: /* @__PURE__ */ jsxRuntime.jsx(TracingRunOptions, {}) })
17458
17194
  ] })
17459
17195
  ] });
17460
17196
  }
@@ -17508,7 +17244,7 @@ const AgentInformationTabLayout = ({ children, agentId }) => {
17508
17244
  isMemoryLoading,
17509
17245
  hasMemory
17510
17246
  });
17511
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden border-t-sm border-border1 flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx(PlaygroundTabs, { defaultTab: "overview", value: selectedTab, onValueChange: handleTabChange, children }) });
17247
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden border-t-sm border-border1 flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx(Tabs, { defaultTab: "overview", value: selectedTab, onValueChange: handleTabChange, children }) });
17512
17248
  };
17513
17249
 
17514
17250
  const AgentLayout = ({ agentId, children, leftSlot, rightSlot }) => {
@@ -17670,7 +17406,7 @@ const EmptyToolsTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className:
17670
17406
  titleSlot: "Configure Tools",
17671
17407
  descriptionSlot: "Mastra tools are not configured yet. You can find more information in the documentation.",
17672
17408
  actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
17673
- Button$1,
17409
+ Button,
17674
17410
  {
17675
17411
  size: "lg",
17676
17412
  className: "w-full",
@@ -17762,7 +17498,13 @@ const ToolPanel = ({ toolId }) => {
17762
17498
  });
17763
17499
  };
17764
17500
  const zodInputSchema = tool?.inputSchema ? resolveSerializedZodOutput(jsonToZod.jsonSchemaToZod(superjson.parse(tool?.inputSchema))) : z.z.object({});
17765
- if (isLoading || error) return null;
17501
+ if (isLoading) {
17502
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6", children: [
17503
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-48 mb-4" }),
17504
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-32 w-full" })
17505
+ ] });
17506
+ }
17507
+ if (error) return null;
17766
17508
  if (!tool)
17767
17509
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-12 text-center px-6", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "header-md", className: "text-icon3", children: "Tool not found" }) });
17768
17510
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -17838,8 +17580,7 @@ function ToolCombobox({
17838
17580
  searchPlaceholder,
17839
17581
  emptyText,
17840
17582
  className,
17841
- disabled: disabled || isLoadingTools || isLoadingAgents || isErrorTools || isErrorAgents,
17842
- variant: "ghost"
17583
+ disabled: disabled || isLoadingTools || isLoadingAgents || isErrorTools || isErrorAgents
17843
17584
  }
17844
17585
  );
17845
17586
  }
@@ -18127,6 +17868,7 @@ function TemplateForm({
18127
17868
  handleInstallTemplate,
18128
17869
  handleVariableChange,
18129
17870
  isLoadingEnvVars,
17871
+ isInstalling,
18130
17872
  defaultModelProvider,
18131
17873
  defaultModelId,
18132
17874
  onModelUpdate
@@ -18214,7 +17956,7 @@ function TemplateForm({
18214
17956
  )
18215
17957
  ] })
18216
17958
  ] }),
18217
- selectedProvider && !isLoadingEnvVars && /* @__PURE__ */ jsxRuntime.jsxs(
17959
+ selectedProvider && !isLoadingEnvVars && /* @__PURE__ */ jsxRuntime.jsx(
18218
17960
  Button,
18219
17961
  {
18220
17962
  className: cn(
@@ -18222,11 +17964,14 @@ function TemplateForm({
18222
17964
  "[&>svg]:w-[1.1em] [&_svg]:h-[1.1em] [&_svg]:text-icon5"
18223
17965
  ),
18224
17966
  onClick: handleInstallTemplate,
18225
- disabled: !selectedProvider || !defaultModelProvider || !defaultModelId || errors.length > 0,
18226
- children: [
17967
+ disabled: !selectedProvider || !defaultModelProvider || !defaultModelId || errors.length > 0 || isInstalling,
17968
+ children: isInstalling ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17969
+ /* @__PURE__ */ jsxRuntime.jsx(Spinner, { className: "w-4 h-4" }),
17970
+ " Installing..."
17971
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18227
17972
  "Install ",
18228
17973
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRightIcon, {})
18229
- ]
17974
+ ] })
18230
17975
  }
18231
17976
  )
18232
17977
  ] }) });
@@ -19037,6 +18782,21 @@ function TraceTimeline({
19037
18782
  ) });
19038
18783
  }
19039
18784
 
18785
+ const CombinedButtons = ({ className, children }) => {
18786
+ return /* @__PURE__ */ jsxRuntime.jsx(
18787
+ "div",
18788
+ {
18789
+ className: cn(
18790
+ "flex items-center text-[0.75rem] border border-border1 rounded-lg overflow-hidden",
18791
+ "[&>button]:border-0 [&>button:not(:first-child)]:border-l [&>button:not(:first-child)]:border-border1",
18792
+ "[&>button]:rounded-none [&>button:first-child]:rounded-l-lg [&>button:last-child]:rounded-r-lg",
18793
+ className
18794
+ ),
18795
+ children
18796
+ }
18797
+ );
18798
+ };
18799
+
19040
18800
  function TraceTimelineTools({
19041
18801
  spans = [],
19042
18802
  fadedTypes,
@@ -19084,10 +18844,10 @@ function TraceTimelineTools({
19084
18844
  Button,
19085
18845
  {
19086
18846
  onClick: () => handleToggle(item),
19087
- isFaded,
18847
+ className: isFaded ? "opacity-40" : "",
19088
18848
  style: { color: !isFaded ? spanUI?.color : void 0, backgroundColor: spanUI?.bgColor },
19089
18849
  children: [
19090
- spanUI?.icon && spanUI.icon,
18850
+ spanUI?.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: spanUI.icon }),
19091
18851
  spanUI?.label
19092
18852
  ]
19093
18853
  }
@@ -19097,15 +18857,15 @@ function TraceTimelineTools({
19097
18857
  Button,
19098
18858
  {
19099
18859
  onClick: () => handleToggle("other"),
19100
- isFaded: fadedTypes?.includes("other"),
18860
+ className: fadedTypes?.includes("other") ? "opacity-40" : "",
19101
18861
  style: { color: !fadedTypes?.includes("other") ? void 0 : void 0, backgroundColor: void 0 },
19102
18862
  children: [
19103
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleDashedIcon, {}),
18863
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleDashedIcon, {}) }),
19104
18864
  "Other"
19105
18865
  ]
19106
18866
  }
19107
18867
  ),
19108
- /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onLegendReset, disabled: fadedTypes?.length === 0, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}) })
18868
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onLegendReset, disabled: fadedTypes?.length === 0, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}) }) })
19109
18869
  ] })
19110
18870
  ] });
19111
18871
  }
@@ -19195,82 +18955,6 @@ function getSpanInfo({ span }) {
19195
18955
  return baseInfo;
19196
18956
  }
19197
18957
 
19198
- const TabsRoot = ({
19199
- children,
19200
- defaultTab,
19201
- value,
19202
- onValueChange,
19203
- className
19204
- }) => {
19205
- const [internalTab, setInternalTab] = React.useState(defaultTab);
19206
- const isControlled = value !== void 0 && onValueChange !== void 0;
19207
- const currentTab = isControlled ? value : internalTab;
19208
- const handleTabChange = (newValue) => {
19209
- const typedValue = newValue;
19210
- if (isControlled) {
19211
- onValueChange(typedValue);
19212
- } else {
19213
- setInternalTab(typedValue);
19214
- }
19215
- };
19216
- return /* @__PURE__ */ jsxRuntime.jsx(
19217
- TabsPrimitive__namespace.Root,
19218
- {
19219
- value: currentTab,
19220
- onValueChange: handleTabChange,
19221
- className: cn("grid gap-8 overflow-y-auto", className),
19222
- children
19223
- }
19224
- );
19225
- };
19226
-
19227
- const TabList = ({ children, variant = "default", className }) => {
19228
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full overflow-x-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx(
19229
- TabsPrimitive__namespace.List,
19230
- {
19231
- className: cn(
19232
- "flex items-center",
19233
- {
19234
- // variant: default
19235
- "text-[0.9375rem]": variant === "default",
19236
- "[&>button]:py-[0.5rem] [&>button]:px-[1.5rem] [&>button]:font-normal [&>button]:text-icon3 [&>button]:flex-1 [&>button]:border-b [&>button]:border-border1": variant === "default",
19237
- "[&>button[data-state=active]]:text-icon5 [&>button[data-state=active]]:transition-colors [&>button[data-state=active]]:duration-200 [&>button[data-state=active]]:border-icon3": variant === "default",
19238
- // variant: buttons
19239
- "border border-border1 flex justify-stretch rounded-md overflow-hidden text-[0.875rem] min-h-[2.5rem]": variant === "buttons",
19240
- "[&>button]:flex-1 [&>button]:py-[0.5rem] [&>button]:px-[1rem] [&>button]:text-icon3": variant === "buttons",
19241
- "[&>button[data-state=active]]:text-icon5 [&>button[data-state=active]]:bg-[#222]": variant === "buttons"
19242
- },
19243
- className
19244
- ),
19245
- children
19246
- }
19247
- ) });
19248
- };
19249
-
19250
- const Tab = ({ children, value, onClick, className }) => {
19251
- return /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Trigger, { value, className: cn("hover:text-icon5", className), onClick, children });
19252
- };
19253
-
19254
- const TabContent = ({ children, value, className }) => {
19255
- return /* @__PURE__ */ jsxRuntime.jsx(
19256
- TabsPrimitive__namespace.Content,
19257
- {
19258
- value,
19259
- className: cn(
19260
- "grid overflow-y-auto ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:none",
19261
- className
19262
- ),
19263
- children
19264
- }
19265
- );
19266
- };
19267
-
19268
- const Tabs = Object.assign(TabsRoot, {
19269
- List: TabList,
19270
- Tab,
19271
- Content: TabContent
19272
- });
19273
-
19274
18958
  function isTokenDetailsObject(value) {
19275
18959
  return typeof value === "object" && value !== null;
19276
18960
  }
@@ -19573,19 +19257,19 @@ function SpanTabs({
19573
19257
  entityType = "Workflow";
19574
19258
  }
19575
19259
  return /* @__PURE__ */ jsxRuntime.jsxs(Tabs, { defaultTab: defaultActiveTab, children: [
19576
- /* @__PURE__ */ jsxRuntime.jsxs(Tabs.List, { children: [
19577
- /* @__PURE__ */ jsxRuntime.jsx(Tabs.Tab, { value: "details", children: "Details" }),
19578
- /* @__PURE__ */ jsxRuntime.jsxs(Tabs.Tab, { value: "scores", children: [
19260
+ /* @__PURE__ */ jsxRuntime.jsxs(TabList, { children: [
19261
+ /* @__PURE__ */ jsxRuntime.jsx(Tab, { value: "details", children: "Details" }),
19262
+ /* @__PURE__ */ jsxRuntime.jsxs(Tab, { value: "scores", children: [
19579
19263
  "Scoring ",
19580
19264
  spanScoresData?.pagination && `(${spanScoresData.pagination.total || 0})`
19581
19265
  ] })
19582
19266
  ] }),
19583
- /* @__PURE__ */ jsxRuntime.jsx(Tabs.Content, { value: "details", children: /* @__PURE__ */ jsxRuntime.jsxs(Sections, { children: [
19267
+ /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "details", children: /* @__PURE__ */ jsxRuntime.jsxs(Sections, { children: [
19584
19268
  span?.attributes?.usage ? /* @__PURE__ */ jsxRuntime.jsx(TraceSpanUsage, { spanUsage: span.attributes.usage }) : null,
19585
19269
  /* @__PURE__ */ jsxRuntime.jsx(KeyValueList, { data: spanInfo, LinkComponent: Link }),
19586
19270
  /* @__PURE__ */ jsxRuntime.jsx(SpanDetails, { span })
19587
19271
  ] }) }),
19588
- /* @__PURE__ */ jsxRuntime.jsx(Tabs.Content, { value: "scores", children: /* @__PURE__ */ jsxRuntime.jsxs(Sections, { children: [
19272
+ /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "scores", children: /* @__PURE__ */ jsxRuntime.jsxs(Sections, { children: [
19589
19273
  /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
19590
19274
  /* @__PURE__ */ jsxRuntime.jsx(Section.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(Section.Heading, { children: [
19591
19275
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleGaugeIcon, {}),
@@ -19899,9 +19583,8 @@ function TraceDialog({
19899
19583
  ] }) }),
19900
19584
  /* @__PURE__ */ jsxRuntime.jsxs(ButtonsGroup, { className: "w-full", children: [
19901
19585
  /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: handleToScoring, children: [
19902
- "Scoring ",
19903
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleGaugeIcon, {}),
19904
- " "
19586
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleGaugeIcon, {}) }),
19587
+ "Scoring"
19905
19588
  ] }),
19906
19589
  spanScoresData?.scores?.[0] && /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: handleToLastScore, children: [
19907
19590
  "Last score: ",
@@ -20048,7 +19731,7 @@ function TracesTools({
20048
19731
  disabled: isLoading
20049
19732
  }
20050
19733
  ),
20051
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex gap-[1rem] items-center flex-wrap mr-auto"), children: [
19734
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex gap-[1rem] items-center flex-wrap"), children: [
20052
19735
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("shrink-0 text-[0.875rem] text-icon3"), children: "Filter by Date & time range" }),
20053
19736
  /* @__PURE__ */ jsxRuntime.jsx(
20054
19737
  DateTimePicker,
@@ -20057,7 +19740,7 @@ function TracesTools({
20057
19740
  value: selectedDateFrom,
20058
19741
  maxValue: selectedDateTo,
20059
19742
  onValueChange: (date) => onDateChange?.(date, "from"),
20060
- className: "min-w-[13rem]",
19743
+ className: "min-w-32",
20061
19744
  defaultTimeStrValue: "12:00 AM",
20062
19745
  disabled: isLoading
20063
19746
  }
@@ -20069,15 +19752,15 @@ function TracesTools({
20069
19752
  value: selectedDateTo,
20070
19753
  minValue: selectedDateFrom,
20071
19754
  onValueChange: (date) => onDateChange?.(date, "to"),
20072
- className: "min-w-[13rem]",
19755
+ className: "min-w-32",
20073
19756
  defaultTimeStrValue: "11:59 PM",
20074
19757
  disabled: isLoading
20075
19758
  }
20076
- )
20077
- ] }),
20078
- /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "primary", onClick: onReset, disabled: isLoading, children: [
20079
- "Reset ",
20080
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {})
19759
+ ),
19760
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "light", size: "lg", className: "min-w-32", onClick: onReset, disabled: isLoading, children: [
19761
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}) }),
19762
+ "Reset"
19763
+ ] })
20081
19764
  ] })
20082
19765
  ] });
20083
19766
  }
@@ -20676,7 +20359,7 @@ const EmptyMCPTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
20676
20359
  titleSlot: "Configure MCP servers",
20677
20360
  descriptionSlot: "MCP servers are not configured yet. You can find more information in the documentation.",
20678
20361
  actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
20679
- Button$1,
20362
+ Button,
20680
20363
  {
20681
20364
  size: "lg",
20682
20365
  className: "w-full",
@@ -20740,7 +20423,13 @@ const MCPToolPanel = ({ toolId, serverId }) => {
20740
20423
  if (!tool) return;
20741
20424
  return await executeTool(data);
20742
20425
  };
20743
- if (isLoading || error) return null;
20426
+ if (isLoading) {
20427
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6", children: [
20428
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-48 mb-4" }),
20429
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-32 w-full" })
20430
+ ] });
20431
+ }
20432
+ if (error) return null;
20744
20433
  if (!tool)
20745
20434
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-12 text-center px-6", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "header-md", className: "text-icon3", children: "Tool not found" }) });
20746
20435
  let zodInputSchema;
@@ -20890,8 +20579,7 @@ function MCPServerCombobox({
20890
20579
  searchPlaceholder,
20891
20580
  emptyText,
20892
20581
  className,
20893
- disabled: disabled || isLoading || isError,
20894
- variant: "ghost"
20582
+ disabled: disabled || isLoading || isError
20895
20583
  }
20896
20584
  );
20897
20585
  }
@@ -20924,13 +20612,16 @@ const useStudioConfig = () => {
20924
20612
  };
20925
20613
  const LOCAL_STORAGE_KEY = "mastra-studio-config";
20926
20614
  const StudioConfigProvider = ({ children, endpoint = "http://localhost:4111" }) => {
20927
- const { data: instanceStatus } = useMastraInstanceStatus(endpoint);
20615
+ const { data: instanceStatus, isLoading: isStatusLoading, error } = useMastraInstanceStatus(endpoint);
20928
20616
  const [config, setConfig] = React.useState({
20929
20617
  baseUrl: "",
20930
20618
  headers: {},
20931
20619
  isLoading: true
20932
20620
  });
20933
20621
  React.useLayoutEffect(() => {
20622
+ if (error && !isStatusLoading) {
20623
+ return setConfig({ baseUrl: "", headers: {}, isLoading: false });
20624
+ }
20934
20625
  if (!instanceStatus?.status) return;
20935
20626
  const storedConfig = localStorage.getItem(LOCAL_STORAGE_KEY);
20936
20627
  if (storedConfig) {
@@ -20943,7 +20634,7 @@ const StudioConfigProvider = ({ children, endpoint = "http://localhost:4111" })
20943
20634
  return setConfig((prev) => ({ ...prev, baseUrl: endpoint, isLoading: false }));
20944
20635
  }
20945
20636
  return setConfig({ baseUrl: "", headers: {}, isLoading: false });
20946
- }, [instanceStatus, endpoint]);
20637
+ }, [instanceStatus, endpoint, isStatusLoading, error]);
20947
20638
  const doSetConfig = (partialNewConfig) => {
20948
20639
  setConfig((prev) => {
20949
20640
  const nextConfig = { ...prev, ...partialNewConfig };
@@ -20960,7 +20651,7 @@ const HeaderListForm = ({ headers, onAddHeader, onRemoveHeader }) => {
20960
20651
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface4 rounded-lg p-4 border-sm border-border2 space-y-4", children: [
20961
20652
  headers.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-4", children: headers.map((header, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(HeaderListFormItem, { index, header, onRemove: () => onRemoveHeader(index) }) }, index)) }),
20962
20653
  /* @__PURE__ */ jsxRuntime.jsxs(
20963
- Button$1,
20654
+ Button,
20964
20655
  {
20965
20656
  type: "button",
20966
20657
  variant: "light",
@@ -21003,7 +20694,7 @@ const HeaderListFormItem = ({ index, header, onRemove }) => {
21003
20694
  }
21004
20695
  ),
21005
20696
  /* @__PURE__ */ jsxRuntime.jsx(
21006
- Button$1,
20697
+ Button,
21007
20698
  {
21008
20699
  type: "button",
21009
20700
  variant: "light",
@@ -21053,7 +20744,7 @@ const StudioConfigForm = ({ initialConfig }) => {
21053
20744
  }
21054
20745
  ),
21055
20746
  /* @__PURE__ */ jsxRuntime.jsx(HeaderListForm, { headers, onAddHeader: handleAddHeader, onRemoveHeader: handleRemoveHeader }),
21056
- /* @__PURE__ */ jsxRuntime.jsxs(Button$1, { type: "submit", variant: "light", className: "w-full", size: "lg", children: [
20747
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { type: "submit", variant: "light", className: "w-full", size: "lg", children: [
21057
20748
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link2, {}) }),
21058
20749
  "Set Configuration"
21059
20750
  ] })
@@ -21393,7 +21084,7 @@ exports.ApiIcon = ApiIcon;
21393
21084
  exports.Badge = Badge;
21394
21085
  exports.BranchIcon = BranchIcon;
21395
21086
  exports.Breadcrumb = Breadcrumb;
21396
- exports.Button = Button$1;
21087
+ exports.Button = Button;
21397
21088
  exports.ButtonsGroup = ButtonsGroup;
21398
21089
  exports.Cell = Cell;
21399
21090
  exports.ChatThreads = ChatThreads;
@@ -21467,7 +21158,6 @@ exports.OpenAIIcon = OpenAIIcon;
21467
21158
  exports.PageHeader = PageHeader;
21468
21159
  exports.PlaygroundConfigGuard = PlaygroundConfigGuard;
21469
21160
  exports.PlaygroundQueryClient = PlaygroundQueryClient;
21470
- exports.PlaygroundTabs = PlaygroundTabs;
21471
21161
  exports.PromptIcon = PromptIcon;
21472
21162
  exports.RadioGroup = RadioGroup;
21473
21163
  exports.RadioGroupItem = RadioGroupItem;
@@ -21496,9 +21186,6 @@ exports.SpanTabs = SpanTabs;
21496
21186
  exports.StudioConfigContext = StudioConfigContext;
21497
21187
  exports.StudioConfigForm = StudioConfigForm;
21498
21188
  exports.StudioConfigProvider = StudioConfigProvider;
21499
- exports.Tab = Tab$1;
21500
- exports.TabContent = TabContent$1;
21501
- exports.TabList = TabList$1;
21502
21189
  exports.Table = Table;
21503
21190
  exports.Tbody = Tbody;
21504
21191
  exports.TemplateFailure = TemplateFailure;
@@ -21558,6 +21245,7 @@ exports.WorkflowTable = WorkflowTable;
21558
21245
  exports.WorkflowTrigger = WorkflowTrigger;
21559
21246
  exports.WorkingMemoryContext = WorkingMemoryContext;
21560
21247
  exports.WorkingMemoryProvider = WorkingMemoryProvider;
21248
+ exports.buttonVariants = buttonVariants;
21561
21249
  exports.convertWorkflowRunStateToStreamResult = convertWorkflowRunStateToStreamResult;
21562
21250
  exports.extractPrompt = extractPrompt;
21563
21251
  exports.formatHierarchicalSpans = formatHierarchicalSpans;
@@ -21581,6 +21269,7 @@ exports.useAgentPromptExperiment = useAgentPromptExperiment;
21581
21269
  exports.useAgentSettings = useAgentSettings;
21582
21270
  exports.useAgents = useAgents;
21583
21271
  exports.useCancelWorkflowRun = useCancelWorkflowRun;
21272
+ exports.useCloneThread = useCloneThread;
21584
21273
  exports.useCurrentRun = useCurrentRun;
21585
21274
  exports.useDeleteThread = useDeleteThread;
21586
21275
  exports.useDeleteWorkflowRun = useDeleteWorkflowRun;
@@ -21617,7 +21306,7 @@ exports.useTracingSettings = useTracingSettings;
21617
21306
  exports.useUpdateAgentModel = useUpdateAgentModel;
21618
21307
  exports.useUpdateModelInModelList = useUpdateModelInModelList;
21619
21308
  exports.useWorkflow = useWorkflow;
21620
- exports.useWorkflowRunExecutionResult = useWorkflowRunExecutionResult;
21309
+ exports.useWorkflowRun = useWorkflowRun;
21621
21310
  exports.useWorkflowRuns = useWorkflowRuns;
21622
21311
  exports.useWorkflowStepDetail = useWorkflowStepDetail;
21623
21312
  exports.useWorkflows = useWorkflows;