@mastra/playground-ui 5.1.20 → 5.1.21-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/index.cjs.js +379 -83
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +378 -82
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/src/components/ui/elements/buttons/button.d.ts +12 -0
  6. package/dist/src/components/ui/elements/buttons/button.stories.d.ts +13 -0
  7. package/dist/src/components/ui/elements/buttons/index.d.ts +1 -0
  8. package/dist/src/components/ui/elements/entry-list/entry-list-cell.d.ts +3 -0
  9. package/dist/src/components/ui/elements/entry-list/entry-list-item.d.ts +8 -0
  10. package/dist/src/components/ui/elements/entry-list/entry-list-page-header.d.ts +8 -0
  11. package/dist/src/components/ui/elements/entry-list/entry-list-toolbar.d.ts +6 -0
  12. package/dist/src/components/ui/elements/entry-list/entry-list.d.ts +15 -0
  13. package/dist/src/components/ui/elements/entry-list/index.d.ts +6 -0
  14. package/dist/src/components/ui/elements/entry-list/shared.d.ts +6 -0
  15. package/dist/src/components/ui/elements/form-fields/form-actions.d.ts +12 -0
  16. package/dist/src/components/ui/elements/form-fields/index.d.ts +7 -0
  17. package/dist/src/components/ui/elements/form-fields/input-field.d.ts +14 -0
  18. package/dist/src/components/ui/elements/form-fields/input-field.stories.d.ts +15 -0
  19. package/dist/src/components/ui/elements/form-fields/radio-group-field.d.ts +21 -0
  20. package/dist/src/components/ui/elements/form-fields/search-field.d.ts +2 -0
  21. package/dist/src/components/ui/elements/form-fields/select-field.d.ts +19 -0
  22. package/dist/src/components/ui/elements/form-fields/select-field.stories.d.ts +13 -0
  23. package/dist/src/components/ui/elements/form-fields/slider-field.d.ts +15 -0
  24. package/dist/src/components/ui/elements/form-fields/textarea-field.d.ts +11 -0
  25. package/dist/src/components/ui/elements/headers/entity-main-header.d.ts +11 -0
  26. package/dist/src/components/ui/elements/headers/index.d.ts +1 -0
  27. package/dist/src/components/ui/elements/index.d.ts +2 -0
  28. package/dist/src/components/ui/elements/key-value-list/index.d.ts +1 -0
  29. package/dist/src/components/ui/elements/key-value-list/key-value-list.d.ts +24 -0
  30. package/dist/src/components/ui/elements/key-value-list/key-value-list.stories.d.ts +12 -0
  31. package/dist/src/components/ui/elements/select/index.d.ts +1 -0
  32. package/dist/src/components/ui/elements/select/select.d.ts +10 -0
  33. package/dist/src/components/ui/elements/side-dialog/index.d.ts +5 -0
  34. package/dist/src/components/ui/elements/side-dialog/side-dialog-content.d.ts +21 -0
  35. package/dist/src/components/ui/elements/side-dialog/side-dialog-footer.d.ts +10 -0
  36. package/dist/src/components/ui/elements/side-dialog/side-dialog-header.d.ts +5 -0
  37. package/dist/src/components/ui/elements/side-dialog/side-dialog-top.d.ts +7 -0
  38. package/dist/src/components/ui/elements/side-dialog/side-dialog.d.ts +10 -0
  39. package/dist/src/components/ui/elements/tabs/index.d.ts +1 -0
  40. package/dist/src/components/ui/elements/tabs/tabs.d.ts +40 -0
  41. package/dist/src/domains/agents/components/agent-metadata/agent-metadata-model-switcher.d.ts +11 -0
  42. package/dist/src/domains/agents/components/agent-metadata/agent-metadata.d.ts +4 -1
  43. package/dist/src/domains/agents/components/agent-metadata/models.d.ts +5 -0
  44. package/package.json +12 -5
package/dist/index.es.js CHANGED
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import React__default, { createContext, useContext, forwardRef, memo, useState, useEffect, useRef, useCallback, useMemo, Suspense, Fragment as Fragment$1, startTransition } from 'react';
4
4
  import { MastraClient } from '@mastra/client-js';
5
5
  import { useMessage, MessagePrimitive, ActionBarPrimitive, useAttachment, AttachmentPrimitive, useComposerRuntime, ComposerPrimitive, ThreadPrimitive, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechSynthesisAdapter, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
6
- import { CheckIcon as CheckIcon$1, CopyIcon, Check, Copy, ChevronUpIcon, BrainIcon, AudioLinesIcon, StopCircleIcon, X, FileText, CircleXIcon, Mic, PlusIcon, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, Circle, ChevronDown, Braces, SaveIcon, RefreshCw, ExternalLink, InfoIcon as InfoIcon$1, GaugeIcon, Plus, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Loader2, Network, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleCheck, CircleX, Minus, Maximize, Workflow, AlertCircleIcon, Users, Brain, NetworkIcon, SearchIcon, AlertCircle, CalendarIcon, Brackets, TrashIcon, CirclePause, StopCircle, ChevronUp } from 'lucide-react';
6
+ import { CheckIcon as CheckIcon$1, CopyIcon, Check, Copy, ChevronUpIcon, BrainIcon, AudioLinesIcon, StopCircleIcon, X, FileText, CircleXIcon, Mic, PlusIcon, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, Circle, ChevronDown, Braces, SaveIcon, RefreshCw, ExternalLink, InfoIcon as InfoIcon$1, GaugeIcon, CircleCheck, EditIcon, Plus, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Loader2, Network, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleX, Minus, Maximize, Workflow, AlertCircleIcon, Users, Brain, NetworkIcon, SearchIcon, AlertCircle, CalendarIcon, Brackets, TrashIcon, CirclePause, StopCircle, ChevronUp } from 'lucide-react';
7
7
  import { Slot } from '@radix-ui/react-slot';
8
8
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
9
9
  import { TooltipProvider as TooltipProvider$1 } from '@radix-ui/react-tooltip';
@@ -35,6 +35,8 @@ import prettierPluginBabel from 'prettier/plugins/babel';
35
35
  import prettierPluginEstree from 'prettier/plugins/estree';
36
36
  import { C as Colors } from './colors-DrbbnW3f.js';
37
37
  import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
38
+ import * as SelectPrimitive from '@radix-ui/react-select';
39
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
38
40
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
39
41
  import { processDataStream } from '@ai-sdk/ui-utils';
40
42
  import Markdown from 'react-markdown';
@@ -52,8 +54,6 @@ import z$1, { z, ZodObject } from 'zod';
52
54
  import { AutoForm as AutoForm$1, buildZodFieldConfig } from '@autoform/react';
53
55
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
54
56
  import { DayPicker } from 'react-day-picker';
55
- import * as PopoverPrimitive from '@radix-ui/react-popover';
56
- import * as SelectPrimitive from '@radix-ui/react-select';
57
57
  import { ZodProvider, getFieldConfigInZodStack, getDefaultValueInZodStack } from '@autoform/zod';
58
58
  import { CodeBlock as CodeBlock$1 } from 'react-code-block';
59
59
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -7790,20 +7790,365 @@ const ScorerEntity = ({ scorer }) => {
7790
7790
  ] });
7791
7791
  };
7792
7792
 
7793
+ const openaiModels = [
7794
+ "o1",
7795
+ "o1-2024-12-17",
7796
+ "o3-mini",
7797
+ "o3-mini-2025-01-31",
7798
+ "o3",
7799
+ "o3-2025-04-16",
7800
+ "o4-mini",
7801
+ "o4-mini-2025-04-16",
7802
+ "codex-mini-latest",
7803
+ "computer-use-preview",
7804
+ "gpt-4.1",
7805
+ "gpt-4.1-2025-04-14",
7806
+ "gpt-4.1-mini",
7807
+ "gpt-4.1-mini-2025-04-14",
7808
+ "gpt-4.1-nano",
7809
+ "gpt-4.1-nano-2025-04-14",
7810
+ "gpt-4o",
7811
+ "gpt-4o-2024-05-13",
7812
+ "gpt-4o-2024-08-06",
7813
+ "gpt-4o-2024-11-20",
7814
+ "gpt-4o-audio-preview",
7815
+ "gpt-4o-audio-preview-2024-10-01",
7816
+ "gpt-4o-audio-preview-2024-12-17",
7817
+ "gpt-4o-search-preview",
7818
+ "gpt-4o-search-preview-2025-03-11",
7819
+ "gpt-4o-mini-search-preview",
7820
+ "gpt-4o-mini-search-preview-2025-03-11",
7821
+ "gpt-4o-mini",
7822
+ "gpt-4o-mini-2024-07-18",
7823
+ "gpt-4-turbo",
7824
+ "gpt-4-turbo-2024-04-09",
7825
+ "gpt-4-turbo-preview",
7826
+ "gpt-4-0125-preview",
7827
+ "gpt-4-1106-preview",
7828
+ "gpt-4",
7829
+ "gpt-4-0613",
7830
+ "gpt-4.5-preview",
7831
+ "gpt-4.5-preview-2025-02-27",
7832
+ "gpt-3.5-turbo-0125",
7833
+ "gpt-3.5-turbo",
7834
+ "gpt-3.5-turbo-1106",
7835
+ "chatgpt-4o-latest",
7836
+ "gpt-5",
7837
+ "gpt-5-2025-08-07",
7838
+ "gpt-5-mini",
7839
+ "gpt-5-mini-2025-08-07",
7840
+ "gpt-5-nano",
7841
+ "gpt-5-nano-2025-08-07",
7842
+ "gpt-5-chat-latest"
7843
+ ];
7844
+ const anthropicModels = [
7845
+ "claude-opus-4-20250514",
7846
+ "claude-sonnet-4-20250514",
7847
+ "claude-3-7-sonnet-20250219",
7848
+ "claude-3-5-sonnet-latest",
7849
+ "claude-3-5-sonnet-20241022",
7850
+ "claude-3-5-sonnet-20240620",
7851
+ "claude-3-5-haiku-latest",
7852
+ "claude-3-5-haiku-20241022",
7853
+ "claude-3-opus-latest",
7854
+ "claude-3-opus-20240229",
7855
+ "claude-3-sonnet-20240229",
7856
+ "claude-3-haiku-20240307"
7857
+ ];
7858
+ const googleModels = [
7859
+ "gemini-1.5-flash",
7860
+ "gemini-1.5-flash-latest",
7861
+ "gemini-1.5-flash-001",
7862
+ "gemini-1.5-flash-002",
7863
+ "gemini-1.5-flash-8b",
7864
+ "gemini-1.5-flash-8b-latest",
7865
+ "gemini-1.5-flash-8b-001",
7866
+ "gemini-1.5-pro",
7867
+ "gemini-1.5-pro-latest",
7868
+ "gemini-1.5-pro-001",
7869
+ "gemini-1.5-pro-002",
7870
+ "gemini-2.0-flash",
7871
+ "gemini-2.0-flash-001",
7872
+ "gemini-2.0-flash-live-001",
7873
+ "gemini-2.0-flash-lite",
7874
+ "gemini-2.0-pro-exp-02-05",
7875
+ "gemini-2.0-flash-thinking-exp-01-21",
7876
+ "gemini-2.0-flash-exp",
7877
+ "gemini-2.5-pro",
7878
+ "gemini-2.5-flash",
7879
+ "gemini-2.5-flash-lite",
7880
+ "gemini-2.5-pro-exp-03-25",
7881
+ "gemini-2.5-flash-preview-04-17",
7882
+ "gemini-exp-1206",
7883
+ "gemma-3-12b-it",
7884
+ "gemma-3-27b-it"
7885
+ ];
7886
+ const xAIModels = [
7887
+ "grok-4",
7888
+ "grok-4-0709",
7889
+ "grok-4-latest",
7890
+ "grok-3",
7891
+ "grok-3-latest",
7892
+ "grok-3-fast",
7893
+ "grok-3-fast-latest",
7894
+ "grok-3-mini",
7895
+ "grok-3-mini-latest",
7896
+ "grok-3-mini-fast",
7897
+ "grok-3-mini-fast-latest",
7898
+ "grok-2-vision-1212",
7899
+ "grok-2-vision",
7900
+ "grok-2-vision-latest",
7901
+ "grok-2-image-1212",
7902
+ "grok-2-image",
7903
+ "grok-2-image-latest",
7904
+ "grok-2-1212",
7905
+ "grok-2",
7906
+ "grok-2-latest",
7907
+ "grok-vision-beta",
7908
+ "grok-beta"
7909
+ ];
7910
+ const groqModels = [
7911
+ "gemma2-9b-it",
7912
+ "llama-3.1-8b-instant",
7913
+ "llama-3.3-70b-versatile",
7914
+ "meta-llama/llama-guard-4-12b",
7915
+ "openai/gpt-oss-120b",
7916
+ "openai/gpt-oss-20b",
7917
+ "deepseek-r1-distill-llama-70b",
7918
+ "meta-llama/llama-4-maverick-17b-128e-instruct",
7919
+ "meta-llama/llama-4-scout-17b-16e-instruct",
7920
+ "meta-llama/llama-prompt-guard-2-22m",
7921
+ "meta-llama/llama-prompt-guard-2-86m",
7922
+ "mistral-saba-24b",
7923
+ "moonshotai/kimi-k2-instruct",
7924
+ "qwen/qwen3-32b",
7925
+ "llama-guard-3-8b",
7926
+ "llama3-70b-8192",
7927
+ "llama3-8b-8192",
7928
+ "mixtral-8x7b-32768",
7929
+ "qwen-qwq-32b",
7930
+ "qwen-2.5-32b",
7931
+ "deepseek-r1-distill-qwen-32b"
7932
+ ];
7933
+
7934
+ const Select = SelectPrimitive.Root;
7935
+ const SelectValue = SelectPrimitive.Value;
7936
+ const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
7937
+ SelectPrimitive.Trigger,
7938
+ {
7939
+ ref,
7940
+ className: cn(
7941
+ "flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
7942
+ className
7943
+ ),
7944
+ ...props,
7945
+ children: [
7946
+ children,
7947
+ /* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) })
7948
+ ]
7949
+ }
7950
+ ));
7951
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
7952
+ const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(
7953
+ SelectPrimitive.Content,
7954
+ {
7955
+ ref,
7956
+ className: cn(
7957
+ "relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
7958
+ position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
7959
+ className
7960
+ ),
7961
+ position,
7962
+ ...props,
7963
+ children: /* @__PURE__ */ jsx(
7964
+ SelectPrimitive.Viewport,
7965
+ {
7966
+ className: cn(
7967
+ "p-1",
7968
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
7969
+ ),
7970
+ children
7971
+ }
7972
+ )
7973
+ }
7974
+ ) }));
7975
+ SelectContent.displayName = SelectPrimitive.Content.displayName;
7976
+ const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
7977
+ SelectPrimitive.Item,
7978
+ {
7979
+ ref,
7980
+ className: cn(
7981
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-mastra-el-5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
7982
+ className
7983
+ ),
7984
+ ...props,
7985
+ children: [
7986
+ /* @__PURE__ */ jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
7987
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
7988
+ ]
7989
+ }
7990
+ ));
7991
+ SelectItem.displayName = SelectPrimitive.Item.displayName;
7992
+
7993
+ const Popover = PopoverPrimitive.Root;
7994
+ const PopoverTrigger = PopoverPrimitive.Trigger;
7995
+ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
7996
+ PopoverPrimitive.Content,
7997
+ {
7998
+ ref,
7999
+ align,
8000
+ sideOffset,
8001
+ className: cn(
8002
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
8003
+ className
8004
+ ),
8005
+ ...props
8006
+ }
8007
+ ) }));
8008
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
8009
+
8010
+ const Models = {
8011
+ openai: {
8012
+ models: openaiModels?.map((model) => ({ provider: "openai", model, icon: "openai.chat" })),
8013
+ icon: "openai.chat"
8014
+ },
8015
+ anthropic: {
8016
+ models: anthropicModels?.map((model) => ({ provider: "anthropic", model, icon: "anthropic.chat" })),
8017
+ icon: "anthropic.chat"
8018
+ },
8019
+ google: {
8020
+ models: googleModels?.map((model) => ({ provider: "google", model, icon: "GOOGLE" })),
8021
+ icon: "GOOGLE"
8022
+ },
8023
+ xAi: {
8024
+ models: xAIModels?.map((model) => ({ provider: "xai", model, icon: "X_GROK" })),
8025
+ icon: "X_GROK"
8026
+ },
8027
+ groq: {
8028
+ models: groqModels?.map((model) => ({ provider: "groq", model, icon: "GROQ" })),
8029
+ icon: "GROQ"
8030
+ }
8031
+ };
8032
+ const AgentMetadataModelSwitcher = ({
8033
+ defaultProvider,
8034
+ defaultModel,
8035
+ updateModel,
8036
+ closeEditor,
8037
+ modelProviders
8038
+ }) => {
8039
+ const [selectedModel, setSelectedModel] = useState(defaultModel);
8040
+ const [showSuggestions, setShowSuggestions] = useState(false);
8041
+ const [selectedProvider, setSelectedProvider] = useState(() => {
8042
+ if (defaultProvider) {
8043
+ const providerOnly = defaultProvider.split(".")[0];
8044
+ return providerOnly;
8045
+ }
8046
+ return "";
8047
+ });
8048
+ const [loading, setLoading] = useState(false);
8049
+ const modelsList = Object.entries(Models).filter(([provider]) => modelProviders.includes(provider));
8050
+ const allModels = modelsList.flatMap(([_, { models }]) => models);
8051
+ const providersList = modelsList.map(([provider, { icon }]) => ({ provider, icon }));
8052
+ const model = allModels.find((model2) => model2.model === selectedModel);
8053
+ const handleSave = async () => {
8054
+ setLoading(true);
8055
+ const providerToUse = model?.provider ?? selectedProvider;
8056
+ await updateModel({ provider: providerToUse, modelId: selectedModel });
8057
+ setLoading(false);
8058
+ closeEditor();
8059
+ };
8060
+ const filteredModels = allModels.filter((model2) => model2.model.includes(selectedModel));
8061
+ return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8062
+ /* @__PURE__ */ jsxs(
8063
+ Select,
8064
+ {
8065
+ value: model?.provider ?? selectedProvider,
8066
+ onValueChange: setSelectedProvider,
8067
+ disabled: !!model?.provider,
8068
+ children: [
8069
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "max-w-[150px]", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select provider" }) }),
8070
+ /* @__PURE__ */ jsx(SelectContent, { children: providersList.map((provider) => /* @__PURE__ */ jsx(SelectItem, { value: provider.provider, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8071
+ /* @__PURE__ */ jsx(Icon, { children: providerMapToIcon[provider.icon] }),
8072
+ provider.provider
8073
+ ] }) }, provider.provider)) })
8074
+ ]
8075
+ }
8076
+ ),
8077
+ /* @__PURE__ */ jsxs(Popover, { open: showSuggestions, children: [
8078
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
8079
+ Input,
8080
+ {
8081
+ id: "model-input",
8082
+ list: "model-suggestions",
8083
+ className: "flex-1",
8084
+ type: "text",
8085
+ value: selectedModel,
8086
+ onChange: (e) => {
8087
+ setSelectedModel(e.target.value);
8088
+ setShowSuggestions(true);
8089
+ },
8090
+ placeholder: "Enter model name or select from suggestions..."
8091
+ }
8092
+ ) }),
8093
+ filteredModels.length > 0 && /* @__PURE__ */ jsx(
8094
+ PopoverContent,
8095
+ {
8096
+ onOpenAutoFocus: (e) => e.preventDefault(),
8097
+ className: "flex flex-col gap-2 w-[var(--radix-popover-trigger-width)] max-h-[calc(var(--radix-popover-content-available-height)-50px)] overflow-y-auto",
8098
+ children: filteredModels.map((model2) => /* @__PURE__ */ jsxs(
8099
+ "div",
8100
+ {
8101
+ className: "flex items-center gap-2 cursor-pointer hover:bg-surface5 p-2",
8102
+ onClick: () => {
8103
+ setSelectedModel(model2.model);
8104
+ setShowSuggestions(false);
8105
+ },
8106
+ children: [
8107
+ /* @__PURE__ */ jsx(Icon, { children: providerMapToIcon[model2.icon] }),
8108
+ model2.model
8109
+ ]
8110
+ },
8111
+ model2.provider + model2.model
8112
+ ))
8113
+ }
8114
+ )
8115
+ ] }),
8116
+ /* @__PURE__ */ jsxs(Tooltip, { children: [
8117
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("button", { onClick: handleSave, className: "text-icon3 hover:text-icon6", children: /* @__PURE__ */ jsx(Icon, { children: loading ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(CircleCheck, {}) }) }) }),
8118
+ /* @__PURE__ */ jsx(TooltipContent, { children: loading ? "Saving..." : "Save new model" })
8119
+ ] })
8120
+ ] }) });
8121
+ };
8122
+
7793
8123
  const AgentMetadata = ({
7794
8124
  agent,
7795
8125
  promptSlot,
7796
8126
  hasMemoryEnabled,
7797
8127
  computeToolLink,
7798
- computeWorkflowLink
8128
+ computeWorkflowLink,
8129
+ updateModel,
8130
+ modelProviders
7799
8131
  }) => {
8132
+ const [isEditingModel, setIsEditingModel] = useState(false);
7800
8133
  const providerIcon = providerMapToIcon[agent.provider || "openai.chat"];
7801
8134
  const agentTools = agent.tools ?? {};
7802
8135
  const tools = Object.keys(agentTools).map((key) => agentTools[key]);
7803
8136
  const agentWorkflows = agent.workflows ?? {};
7804
8137
  const workflows = Object.keys(agentWorkflows).map((key) => agentWorkflows[key]);
7805
8138
  return /* @__PURE__ */ jsxs(AgentMetadataWrapper, { children: [
7806
- /* @__PURE__ */ jsx(AgentMetadataSection, { title: "Model", children: /* @__PURE__ */ jsx(Badge$1, { icon: providerIcon, className: "font-medium", children: agent.modelId || "N/A" }) }),
8139
+ /* @__PURE__ */ jsx(AgentMetadataSection, { title: "Model", children: isEditingModel ? /* @__PURE__ */ jsx(
8140
+ AgentMetadataModelSwitcher,
8141
+ {
8142
+ defaultProvider: agent.provider,
8143
+ defaultModel: agent.modelId,
8144
+ updateModel,
8145
+ closeEditor: () => setIsEditingModel(false),
8146
+ modelProviders
8147
+ }
8148
+ ) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8149
+ /* @__PURE__ */ jsx(Badge$1, { icon: providerIcon, className: "font-medium", children: agent.modelId || "N/A" }),
8150
+ /* @__PURE__ */ jsx("button", { onClick: () => setIsEditingModel(true), className: "text-icon3 hover:text-icon6", children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(EditIcon, {}) }) })
8151
+ ] }) }),
7807
8152
  /* @__PURE__ */ jsx(
7808
8153
  AgentMetadataSection,
7809
8154
  {
@@ -11874,23 +12219,6 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
11874
12219
  }
11875
12220
  Calendar.displayName = "Calendar";
11876
12221
 
11877
- const Popover = PopoverPrimitive.Root;
11878
- const PopoverTrigger = PopoverPrimitive.Trigger;
11879
- const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
11880
- PopoverPrimitive.Content,
11881
- {
11882
- ref,
11883
- align,
11884
- sideOffset,
11885
- className: cn(
11886
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
11887
- className
11888
- ),
11889
- ...props
11890
- }
11891
- ) }));
11892
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
11893
-
11894
12222
  const DatePicker = ({
11895
12223
  value,
11896
12224
  setValue,
@@ -12076,65 +12404,6 @@ const DateField = ({ inputProps, field, error, id }) => {
12076
12404
  );
12077
12405
  };
12078
12406
 
12079
- const Select = SelectPrimitive.Root;
12080
- const SelectValue = SelectPrimitive.Value;
12081
- const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
12082
- SelectPrimitive.Trigger,
12083
- {
12084
- ref,
12085
- className: cn(
12086
- "flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
12087
- className
12088
- ),
12089
- ...props,
12090
- children: [
12091
- children,
12092
- /* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) })
12093
- ]
12094
- }
12095
- ));
12096
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
12097
- const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(
12098
- SelectPrimitive.Content,
12099
- {
12100
- ref,
12101
- className: cn(
12102
- "relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
12103
- position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
12104
- className
12105
- ),
12106
- position,
12107
- ...props,
12108
- children: /* @__PURE__ */ jsx(
12109
- SelectPrimitive.Viewport,
12110
- {
12111
- className: cn(
12112
- "p-1",
12113
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
12114
- ),
12115
- children
12116
- }
12117
- )
12118
- }
12119
- ) }));
12120
- SelectContent.displayName = SelectPrimitive.Content.displayName;
12121
- const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
12122
- SelectPrimitive.Item,
12123
- {
12124
- ref,
12125
- className: cn(
12126
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-mastra-el-5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
12127
- className
12128
- ),
12129
- ...props,
12130
- children: [
12131
- /* @__PURE__ */ jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
12132
- /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
12133
- ]
12134
- }
12135
- ));
12136
- SelectItem.displayName = SelectPrimitive.Item.displayName;
12137
-
12138
12407
  const SelectField = ({ field, inputProps, error, id, value }) => {
12139
12408
  const { key, ...props } = inputProps;
12140
12409
  return /* @__PURE__ */ jsxs(
@@ -12352,11 +12621,38 @@ function inferFieldType(schema, fieldConfig) {
12352
12621
  return "string";
12353
12622
  }
12354
12623
 
12624
+ function extractNumberConstraints(schema) {
12625
+ const constraints = {};
12626
+ let baseSchema = getBaseSchema(schema);
12627
+ if (baseSchema._def && baseSchema._def.checks) {
12628
+ for (const check of baseSchema._def.checks) {
12629
+ if (check.kind === "min" && check.inclusive) {
12630
+ constraints.min = check.value;
12631
+ } else if (check.kind === "max" && check.inclusive) {
12632
+ constraints.max = check.value;
12633
+ } else if (check.kind === "multipleOf") {
12634
+ constraints.step = check.value;
12635
+ }
12636
+ }
12637
+ }
12638
+ return constraints;
12639
+ }
12355
12640
  function parseField(key, schema) {
12356
12641
  const baseSchema = getBaseSchema(schema);
12357
- const fieldConfig = getFieldConfigInZodStack(schema);
12642
+ let fieldConfig = getFieldConfigInZodStack(schema);
12358
12643
  const type = inferFieldType(baseSchema, fieldConfig);
12359
12644
  const defaultValue = getDefaultValueInZodStack(schema);
12645
+ if (type === "number" && baseSchema instanceof z.ZodNumber) {
12646
+ const constraints = extractNumberConstraints(schema);
12647
+ if (Object.keys(constraints).length > 0) {
12648
+ if (!fieldConfig) {
12649
+ fieldConfig = {};
12650
+ }
12651
+ if (typeof fieldConfig === "object") {
12652
+ fieldConfig.inputProps = { ...fieldConfig?.inputProps, ...constraints };
12653
+ }
12654
+ }
12655
+ }
12360
12656
  const options = baseSchema._def?.values;
12361
12657
  let optionValues = [];
12362
12658
  if (options) {