@mastra/playground-ui 6.2.3-alpha.0 → 6.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  require('./index.css');const jsxRuntime = require('react/jsx-runtime');
6
- const React = require('react');
7
- const clientJs = require('@mastra/client-js');
8
- const react$2 = require('@assistant-ui/react');
6
+ const react$3 = require('@assistant-ui/react');
9
7
  const lucideReact = require('lucide-react');
8
+ const React = require('react');
10
9
  const reactSlot = require('@radix-ui/react-slot');
11
10
  const TooltipPrimitive = require('@radix-ui/react-tooltip');
12
11
  const AvatarPrimitive = require('@radix-ui/react-avatar');
@@ -50,13 +49,14 @@ const LabelPrimitive = require('@radix-ui/react-label');
50
49
  const v4 = require('@autoform/zod/v4');
51
50
  const v3 = require('zod/v3');
52
51
  const RadioGroupPrimitive = require('@radix-ui/react-radio-group');
52
+ const react$2 = require('@mastra/react');
53
53
  const reactQuery = require('@tanstack/react-query');
54
54
  const reactTable = require('@tanstack/react-table');
55
55
  const Markdown = require('react-markdown');
56
56
  const shallow = require('zustand/shallow');
57
57
  const di = require('@mastra/core/di');
58
- const reactHooks = require('@mastra/react-hooks');
59
- const react$3 = require('motion/react');
58
+ const clientJs = require('@mastra/client-js');
59
+ const react$4 = require('motion/react');
60
60
  const TabsPrimitive = require('@radix-ui/react-tabs');
61
61
  const VisuallyHidden = require('@radix-ui/react-visually-hidden');
62
62
  const HoverCard = require('@radix-ui/react-hover-card');
@@ -103,31 +103,6 @@ const SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespaceDefault(Switch
103
103
  const AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(AlertDialogPrimitive);
104
104
  const DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DropdownMenuPrimitive);
105
105
 
106
- const createMastraClient = (baseUrl, mastraClientHeaders = {}) => {
107
- return new clientJs.MastraClient({
108
- baseUrl: baseUrl || "",
109
- // only add the header if the baseUrl is not provided i.e it's a local dev environment
110
- headers: !baseUrl ? { ...mastraClientHeaders, "x-mastra-dev-playground": "true" } : mastraClientHeaders
111
- });
112
- };
113
-
114
- const MastraClientContext = React.createContext(void 0);
115
- const MastraClientProvider = ({
116
- children,
117
- baseUrl,
118
- headers
119
- }) => {
120
- const client = createMastraClient(baseUrl, headers);
121
- return /* @__PURE__ */ jsxRuntime.jsx(MastraClientContext.Provider, { value: { client }, children });
122
- };
123
- const useMastraClient = () => {
124
- const context = React.useContext(MastraClientContext);
125
- if (context === void 0) {
126
- throw new Error("useMastraClient must be used within a MastraClientProvider");
127
- }
128
- return context.client;
129
- };
130
-
131
106
  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}
132
107
 
133
108
  const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
@@ -7356,7 +7331,7 @@ const WorkflowJsonDialog = ({ result }) => {
7356
7331
  };
7357
7332
 
7358
7333
  const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
7359
- const client = useMastraClient();
7334
+ const client = react$2.useMastraClient();
7360
7335
  return reactQuery.useQuery({
7361
7336
  queryKey: ["workflow-runs", workflowId],
7362
7337
  queryFn: () => client.getWorkflow(workflowId).runs({ limit: 50 }),
@@ -7821,7 +7796,7 @@ const useWorkflowStream = (workflowFullState) => {
7821
7796
  };
7822
7797
 
7823
7798
  const useWorkflow = (workflowId) => {
7824
- const client = useMastraClient();
7799
+ const client = react$2.useMastraClient();
7825
7800
  const { runtimeContext } = usePlaygroundStore();
7826
7801
  return reactQuery.useQuery({
7827
7802
  queryKey: ["workflow", workflowId],
@@ -7938,13 +7913,15 @@ const Reasoning = ({ text }) => {
7938
7913
  ] });
7939
7914
  };
7940
7915
 
7941
- const AssistantMessage = ({ ToolFallback: ToolFallbackCustom }) => {
7942
- const data = react$2.useMessage();
7916
+ const AssistantMessage = ({ ToolFallback: ToolFallbackCustom, hasModelList }) => {
7917
+ const data = react$3.useMessage();
7943
7918
  const messageId = data.id;
7944
7919
  const isToolCallAndOrReasoning = data.content.every(({ type }) => type === "tool-call" || type === "reasoning");
7945
- return /* @__PURE__ */ jsxRuntime.jsxs(react$2.MessagePrimitive.Root, { className: "max-w-full", "data-message-id": messageId, children: [
7920
+ const modelMetadata = data.metadata?.custom?.modelMetadata;
7921
+ const showModelUsed = hasModelList && modelMetadata;
7922
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$3.MessagePrimitive.Root, { className: "max-w-full", "data-message-id": messageId, children: [
7946
7923
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
7947
- react$2.MessagePrimitive.Parts,
7924
+ react$3.MessagePrimitive.Parts,
7948
7925
  {
7949
7926
  components: {
7950
7927
  Text: MarkdownText,
@@ -7953,23 +7930,33 @@ const AssistantMessage = ({ ToolFallback: ToolFallbackCustom }) => {
7953
7930
  }
7954
7931
  }
7955
7932
  ) }),
7956
- !isToolCallAndOrReasoning && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar$1, {}) })
7933
+ !isToolCallAndOrReasoning && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("h-6 pt-1 flex gap-2 items-center", { "pb-1": showModelUsed }), children: [
7934
+ showModelUsed && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7935
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BrainIcon, { className: "size-4" }),
7936
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-ui-sm leading-ui-sm text-icon6", children: [
7937
+ modelMetadata.modelProvider,
7938
+ "/",
7939
+ modelMetadata.modelId
7940
+ ] })
7941
+ ] }),
7942
+ /* @__PURE__ */ jsxRuntime.jsx(AssistantActionBar$1, {})
7943
+ ] })
7957
7944
  ] });
7958
7945
  };
7959
7946
  const AssistantActionBar$1 = () => {
7960
7947
  return /* @__PURE__ */ jsxRuntime.jsxs(
7961
- react$2.ActionBarPrimitive.Root,
7948
+ react$3.ActionBarPrimitive.Root,
7962
7949
  {
7963
7950
  hideWhenRunning: true,
7964
7951
  autohide: "always",
7965
7952
  autohideFloat: "single-branch",
7966
7953
  className: "flex gap-1 items-center transition-all relative",
7967
7954
  children: [
7968
- /* @__PURE__ */ jsxRuntime.jsx(react$2.MessagePrimitive.If, { speaking: false, children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ActionBarPrimitive.Speak, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Read aloud", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AudioLinesIcon, {}) }) }) }),
7969
- /* @__PURE__ */ jsxRuntime.jsx(react$2.MessagePrimitive.If, { speaking: true, children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ActionBarPrimitive.StopSpeaking, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Stop", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.StopCircleIcon, {}) }) }) }),
7970
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipIconButton, { tooltip: "Copy", className: "bg-transparent text-icon3 hover:text-icon6", children: [
7971
- /* @__PURE__ */ jsxRuntime.jsx(react$2.MessagePrimitive.If, { copied: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, {}) }),
7972
- /* @__PURE__ */ jsxRuntime.jsx(react$2.MessagePrimitive.If, { copied: false, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) })
7955
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.MessagePrimitive.If, { speaking: false, children: /* @__PURE__ */ jsxRuntime.jsx(react$3.ActionBarPrimitive.Speak, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Read aloud", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AudioLinesIcon, {}) }) }) }),
7956
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.MessagePrimitive.If, { speaking: true, children: /* @__PURE__ */ jsxRuntime.jsx(react$3.ActionBarPrimitive.StopSpeaking, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Stop", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.StopCircleIcon, {}) }) }) }),
7957
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipIconButton, { tooltip: "Copy", className: "bg-transparent text-icon3 hover:text-icon6", children: [
7958
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.MessagePrimitive.If, { copied: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, {}) }),
7959
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.MessagePrimitive.If, { copied: false, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) })
7973
7960
  ] }) })
7974
7961
  ]
7975
7962
  }
@@ -7993,7 +7980,7 @@ const useFileSrc = (file) => {
7993
7980
  };
7994
7981
 
7995
7982
  const useAttachmentSrc = () => {
7996
- const { file, src } = react$2.useAttachment(
7983
+ const { file, src } = react$3.useAttachment(
7997
7984
  shallow.useShallow((a) => {
7998
7985
  if (a.file) {
7999
7986
  const isURL = a.file.name.startsWith("https://");
@@ -8053,11 +8040,11 @@ const TxtPreviewDialog = ({ data, open, onOpenChange }) => {
8053
8040
  };
8054
8041
 
8055
8042
  const InMessageContextWrapper = () => {
8056
- return /* @__PURE__ */ jsxRuntime.jsx(react$2.AttachmentPrimitive.Root, { className: "pt-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsxRuntime.jsx(InMessageAttachmentWrapper, {}) }) });
8043
+ return /* @__PURE__ */ jsxRuntime.jsx(react$3.AttachmentPrimitive.Root, { className: "pt-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsxRuntime.jsx(InMessageAttachmentWrapper, {}) }) });
8057
8044
  };
8058
8045
  const InMessageAttachmentWrapper = () => {
8059
8046
  const src = useAttachmentSrc();
8060
- const attachment = react$2.useAttachment((a) => a);
8047
+ const attachment = react$3.useAttachment((a) => a);
8061
8048
  const isUrl = attachment?.name?.startsWith("https://");
8062
8049
  if (attachment.type === "image") {
8063
8050
  const actualSrc = isUrl ? attachment?.name : src;
@@ -8066,7 +8053,7 @@ const InMessageAttachmentWrapper = () => {
8066
8053
  {
8067
8054
  type: "image",
8068
8055
  contentType: void 0,
8069
- nameSlot: /* @__PURE__ */ jsxRuntime.jsx(react$2.AttachmentPrimitive.Name, {}),
8056
+ nameSlot: /* @__PURE__ */ jsxRuntime.jsx(react$3.AttachmentPrimitive.Name, {}),
8070
8057
  src: actualSrc,
8071
8058
  data: void 0
8072
8059
  }
@@ -8079,7 +8066,7 @@ const InMessageAttachmentWrapper = () => {
8079
8066
  {
8080
8067
  type: "document",
8081
8068
  contentType: attachment.contentType,
8082
- nameSlot: /* @__PURE__ */ jsxRuntime.jsx(react$2.AttachmentPrimitive.Name, {}),
8069
+ nameSlot: /* @__PURE__ */ jsxRuntime.jsx(react$3.AttachmentPrimitive.Name, {}),
8083
8070
  src: isUrl ? attachment?.name : src,
8084
8071
  data: `data:application/pdf;base64,${pdfText}`
8085
8072
  }
@@ -8090,7 +8077,7 @@ const InMessageAttachmentWrapper = () => {
8090
8077
  {
8091
8078
  type: attachment.type,
8092
8079
  contentType: attachment.contentType,
8093
- nameSlot: /* @__PURE__ */ jsxRuntime.jsx(react$2.AttachmentPrimitive.Name, {}),
8080
+ nameSlot: /* @__PURE__ */ jsxRuntime.jsx(react$3.AttachmentPrimitive.Name, {}),
8094
8081
  src,
8095
8082
  data: attachment.content?.[0]?.text
8096
8083
  }
@@ -8103,14 +8090,14 @@ const InMessageAttachment = ({ type, contentType, nameSlot, src, data }) => {
8103
8090
  ] }) });
8104
8091
  };
8105
8092
  const UserMessageAttachments = () => {
8106
- return /* @__PURE__ */ jsxRuntime.jsx(react$2.MessagePrimitive.Attachments, { components: { Attachment: InMessageContextWrapper } });
8093
+ return /* @__PURE__ */ jsxRuntime.jsx(react$3.MessagePrimitive.Attachments, { components: { Attachment: InMessageContextWrapper } });
8107
8094
  };
8108
8095
  const UserMessage = () => {
8109
- const message = react$2.useMessage();
8096
+ const message = react$3.useMessage();
8110
8097
  const messageId = message?.id;
8111
- return /* @__PURE__ */ jsxRuntime.jsxs(react$2.MessagePrimitive.Root, { className: "w-full flex items-end pb-4 flex-col", "data-message-id": messageId, children: [
8098
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$3.MessagePrimitive.Root, { className: "w-full flex items-end pb-4 flex-col", "data-message-id": messageId, children: [
8112
8099
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsxRuntime.jsx(
8113
- react$2.MessagePrimitive.Parts,
8100
+ react$3.MessagePrimitive.Parts,
8114
8101
  {
8115
8102
  components: {
8116
8103
  File: (p) => {
@@ -8175,7 +8162,7 @@ const useSpeechRecognition = ({
8175
8162
  language = "en-US",
8176
8163
  agentId
8177
8164
  }) => {
8178
- const client = useMastraClient();
8165
+ const client = react$2.useMastraClient();
8179
8166
  const [agent, setAgent] = React.useState(null);
8180
8167
  const { runtimeContext } = usePlaygroundStore();
8181
8168
  React.useEffect(() => {
@@ -8299,7 +8286,7 @@ const useMastraSpeechToText = ({ agent }) => {
8299
8286
  };
8300
8287
 
8301
8288
  const useHasAttachments = () => {
8302
- const composer = react$2.useComposerRuntime();
8289
+ const composer = react$3.useComposerRuntime();
8303
8290
  const [hasAttachments, setHasAttachments] = React.useState(false);
8304
8291
  React.useEffect(() => {
8305
8292
  composer.subscribe(() => {
@@ -8368,22 +8355,22 @@ const ComposerPdfAttachment = ({ document }) => {
8368
8355
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full w-full", children: state.isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { className: "animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(PdfEntry, { data: state.text, url: isUrl ? document.file?.name : void 0 }) });
8369
8356
  };
8370
8357
  const AttachmentThumbnail = () => {
8371
- const isImage = react$2.useAttachment((a) => a.type === "image");
8372
- const document = react$2.useAttachment((a) => a.type === "document" ? a : void 0);
8358
+ const isImage = react$3.useAttachment((a) => a.type === "image");
8359
+ const document = react$3.useAttachment((a) => a.type === "document" ? a : void 0);
8373
8360
  const src = useAttachmentSrc();
8374
- const canRemove = react$2.useAttachment((a) => a.source !== "message");
8361
+ const canRemove = react$3.useAttachment((a) => a.source !== "message");
8375
8362
  const isUrl = document?.file?.name.startsWith("https://");
8376
8363
  const actualSrc = isUrl ? document?.file?.name : src;
8377
8364
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
8378
8365
  /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
8379
- /* @__PURE__ */ jsxRuntime.jsx(react$2.AttachmentPrimitive.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden size-16 rounded-lg bg-surface3 border-sm border-border1 ", children: isImage ? /* @__PURE__ */ jsxRuntime.jsx(ImageEntry, { src: actualSrc ?? "" }) : document?.contentType === "application/pdf" ? /* @__PURE__ */ jsxRuntime.jsx(ComposerPdfAttachment, { document }) : document ? /* @__PURE__ */ jsxRuntime.jsx(ComposerTxtAttachment, { document }) : null }) }) }),
8380
- /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsxRuntime.jsx(react$2.AttachmentPrimitive.Name, {}) })
8366
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.AttachmentPrimitive.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden size-16 rounded-lg bg-surface3 border-sm border-border1 ", children: isImage ? /* @__PURE__ */ jsxRuntime.jsx(ImageEntry, { src: actualSrc ?? "" }) : document?.contentType === "application/pdf" ? /* @__PURE__ */ jsxRuntime.jsx(ComposerPdfAttachment, { document }) : document ? /* @__PURE__ */ jsxRuntime.jsx(ComposerTxtAttachment, { document }) : null }) }) }),
8367
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsxRuntime.jsx(react$3.AttachmentPrimitive.Name, {}) })
8381
8368
  ] }) }),
8382
8369
  canRemove && /* @__PURE__ */ jsxRuntime.jsx(AttachmentRemove, {})
8383
8370
  ] }) });
8384
8371
  };
8385
8372
  const AttachmentRemove = () => {
8386
- return /* @__PURE__ */ jsxRuntime.jsx(react$2.AttachmentPrimitive.Remove, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
8373
+ return /* @__PURE__ */ jsxRuntime.jsx(react$3.AttachmentPrimitive.Remove, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
8387
8374
  TooltipIconButton,
8388
8375
  {
8389
8376
  tooltip: "Remove file",
@@ -8396,15 +8383,15 @@ const AttachmentRemove = () => {
8396
8383
  const ComposerAttachments = () => {
8397
8384
  const hasAttachments = useHasAttachments();
8398
8385
  if (!hasAttachments) return null;
8399
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-row items-center gap-4 pb-2", children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Attachments, { components: { Attachment: AttachmentThumbnail } }) });
8386
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-row items-center gap-4 pb-2", children: /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Attachments, { components: { Attachment: AttachmentThumbnail } }) });
8400
8387
  };
8401
8388
 
8402
8389
  const useComposerAddAttachment = ({
8403
8390
  multiple = true,
8404
8391
  onChange
8405
8392
  } = {}) => {
8406
- const disabled = react$2.useComposer((c) => !c.isEditing);
8407
- const composerRuntime = react$2.useComposerRuntime();
8393
+ const disabled = react$3.useComposer((c) => !c.isEditing);
8394
+ const composerRuntime = react$3.useComposerRuntime();
8408
8395
  const callback = React.useCallback(() => {
8409
8396
  const input = document.createElement("input");
8410
8397
  input.type = "file";
@@ -8471,7 +8458,7 @@ const getFileContentType = async (url) => {
8471
8458
  };
8472
8459
 
8473
8460
  const AttachFileDialog = ({ onOpenChange, open }) => {
8474
- const composerRuntime = react$2.useComposerRuntime();
8461
+ const composerRuntime = react$3.useComposerRuntime();
8475
8462
  const addFilInputAttachment = useComposerAddAttachment({
8476
8463
  onChange: () => onOpenChange(false)
8477
8464
  });
@@ -8539,17 +8526,17 @@ const useThreadInput = () => {
8539
8526
  return React.useContext(ThreadInputContext);
8540
8527
  };
8541
8528
 
8542
- const Thread = ({ ToolFallback, agentName, agentId, hasMemory }) => {
8529
+ const Thread = ({ ToolFallback, agentName, agentId, hasMemory, hasModelList }) => {
8543
8530
  const areaRef = React.useRef(null);
8544
8531
  useAutoscroll(areaRef, { enabled: true });
8545
8532
  const WrappedAssistantMessage = (props) => {
8546
- return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback });
8533
+ return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback, hasModelList });
8547
8534
  };
8548
8535
  return /* @__PURE__ */ jsxRuntime.jsxs(ThreadWrapper$1, { children: [
8549
- /* @__PURE__ */ jsxRuntime.jsxs(react$2.ThreadPrimitive.Viewport, { ref: areaRef, autoScroll: false, className: "overflow-y-scroll scroll-smooth h-full", children: [
8536
+ /* @__PURE__ */ jsxRuntime.jsxs(react$3.ThreadPrimitive.Viewport, { ref: areaRef, autoScroll: false, className: "overflow-y-scroll scroll-smooth h-full", children: [
8550
8537
  /* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome$1, { agentName }),
8551
8538
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[568px] w-full mx-auto px-4 pb-7", children: /* @__PURE__ */ jsxRuntime.jsx(
8552
- react$2.ThreadPrimitive.Messages,
8539
+ react$3.ThreadPrimitive.Messages,
8553
8540
  {
8554
8541
  components: {
8555
8542
  UserMessage,
@@ -8558,13 +8545,13 @@ const Thread = ({ ToolFallback, agentName, agentId, hasMemory }) => {
8558
8545
  }
8559
8546
  }
8560
8547
  ) }),
8561
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
8548
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
8562
8549
  ] }),
8563
8550
  /* @__PURE__ */ jsxRuntime.jsx(Composer$1, { hasMemory, agentId })
8564
8551
  ] });
8565
8552
  };
8566
8553
  const ThreadWrapper$1 = ({ children }) => {
8567
- return /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.Root, { className: "grid grid-rows-[1fr_auto] h-full overflow-y-auto", children });
8554
+ return /* @__PURE__ */ jsxRuntime.jsx(react$3.ThreadPrimitive.Root, { className: "grid grid-rows-[1fr_auto] h-full overflow-y-auto", children });
8568
8555
  };
8569
8556
  const ThreadWelcome$1 = ({ agentName }) => {
8570
8557
  const safeAgentName = agentName ?? "";
@@ -8577,7 +8564,7 @@ const ThreadWelcome$1 = ({ agentName }) => {
8577
8564
  } else {
8578
8565
  initials = "A";
8579
8566
  }
8580
- return /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.Empty, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-grow flex-col items-center justify-center", children: [
8567
+ return /* @__PURE__ */ jsxRuntime.jsx(react$3.ThreadPrimitive.Empty, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-grow flex-col items-center justify-center", children: [
8581
8568
  /* @__PURE__ */ jsxRuntime.jsx(Avatar, { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: initials }) }),
8582
8569
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
8583
8570
  ] }) });
@@ -8585,10 +8572,10 @@ const ThreadWelcome$1 = ({ agentName }) => {
8585
8572
  const Composer$1 = ({ hasMemory, agentId }) => {
8586
8573
  const { setThreadInput } = useThreadInput();
8587
8574
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-4", children: [
8588
- /* @__PURE__ */ jsxRuntime.jsxs(react$2.ComposerPrimitive.Root, { children: [
8575
+ /* @__PURE__ */ jsxRuntime.jsxs(react$3.ComposerPrimitive.Root, { children: [
8589
8576
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[568px] w-full mx-auto pb-2", children: /* @__PURE__ */ jsxRuntime.jsx(ComposerAttachments, {}) }),
8590
8577
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface3 rounded-lg border-sm border-border1 py-4 mt-auto max-w-[568px] w-full mx-auto px-4 focus-within:outline focus-within:outline-accent1 -outline-offset-2", children: [
8591
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
8578
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
8592
8579
  "textarea",
8593
8580
  {
8594
8581
  className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none outline-none",
@@ -8612,7 +8599,7 @@ const Composer$1 = ({ hasMemory, agentId }) => {
8612
8599
  ] });
8613
8600
  };
8614
8601
  const SpeechInput$1 = ({ agentId }) => {
8615
- const composerRuntime = react$2.useComposerRuntime();
8602
+ const composerRuntime = react$3.useComposerRuntime();
8616
8603
  const { start, stop, isListening, transcript } = useSpeechRecognition({ agentId });
8617
8604
  React.useEffect(() => {
8618
8605
  if (!transcript) return;
@@ -8645,7 +8632,7 @@ const ComposerAction$1 = () => {
8645
8632
  }
8646
8633
  ),
8647
8634
  /* @__PURE__ */ jsxRuntime.jsx(AttachFileDialog, { open: isAddAttachmentDialogOpen, onOpenChange: setIsAddAttachmentDialogOpen }),
8648
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
8635
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
8649
8636
  TooltipIconButton,
8650
8637
  {
8651
8638
  tooltip: "Send",
@@ -8654,15 +8641,15 @@ const ComposerAction$1 = () => {
8654
8641
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
8655
8642
  }
8656
8643
  ) }) }),
8657
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon$1, {}) }) }) })
8644
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon$1, {}) }) }) })
8658
8645
  ] });
8659
8646
  };
8660
8647
  const EditComposer$1 = () => {
8661
- return /* @__PURE__ */ jsxRuntime.jsxs(react$2.ComposerPrimitive.Root, { children: [
8662
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Input, {}),
8648
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$3.ComposerPrimitive.Root, { children: [
8649
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Input, {}),
8663
8650
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
8664
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "ghost", children: "Cancel" }) }),
8665
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { children: "Send" }) })
8651
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "ghost", children: "Cancel" }) }),
8652
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { children: "Send" }) })
8666
8653
  ] })
8667
8654
  ] });
8668
8655
  };
@@ -8678,7 +8665,7 @@ function parseJsonString(jsonString) {
8678
8665
  }
8679
8666
  }
8680
8667
  function useAgentWorkingMemory(agentId, threadId, resourceId) {
8681
- const client = useMastraClient();
8668
+ const client = react$2.useMastraClient();
8682
8669
  const [threadExists, setThreadExists] = React.useState(false);
8683
8670
  const [workingMemoryData, setWorkingMemoryData] = React.useState(null);
8684
8671
  const [workingMemorySource, setWorkingMemorySource] = React.useState("thread");
@@ -8896,7 +8883,7 @@ class PDFAttachmentAdapter {
8896
8883
  const useAdapters = (agentId) => {
8897
8884
  const [isReady, setIsReady] = React.useState(false);
8898
8885
  const [speechAdapter, setSpeechAdapter] = React.useState(void 0);
8899
- const baseClient = useMastraClient();
8886
+ const baseClient = react$2.useMastraClient();
8900
8887
  const { runtimeContext } = usePlaygroundStore();
8901
8888
  React.useEffect(() => {
8902
8889
  const check = async () => {
@@ -8906,7 +8893,7 @@ const useAdapters = (agentId) => {
8906
8893
  setSpeechAdapter(new VoiceAttachmentAdapter(agent));
8907
8894
  setIsReady(true);
8908
8895
  } catch {
8909
- setSpeechAdapter(new react$2.WebSpeechSynthesisAdapter());
8896
+ setSpeechAdapter(new react$3.WebSpeechSynthesisAdapter());
8910
8897
  setIsReady(true);
8911
8898
  }
8912
8899
  };
@@ -8915,9 +8902,9 @@ const useAdapters = (agentId) => {
8915
8902
  return {
8916
8903
  isReady,
8917
8904
  adapters: {
8918
- attachments: new react$2.CompositeAttachmentAdapter([
8919
- new react$2.SimpleImageAttachmentAdapter(),
8920
- new react$2.SimpleTextAttachmentAdapter(),
8905
+ attachments: new react$3.CompositeAttachmentAdapter([
8906
+ new react$3.SimpleImageAttachmentAdapter(),
8907
+ new react$3.SimpleTextAttachmentAdapter(),
8921
8908
  new PDFAttachmentAdapter()
8922
8909
  ]),
8923
8910
  speech: speechAdapter
@@ -8926,14 +8913,14 @@ const useAdapters = (agentId) => {
8926
8913
  };
8927
8914
 
8928
8915
  const handleNetworkMessageFromMemory = (content) => {
8929
- if (content.resourceType === "workflow") {
8916
+ if (content.primitiveType === "workflow") {
8930
8917
  return {
8931
8918
  role: "assistant",
8932
8919
  content: [
8933
8920
  {
8934
8921
  type: "tool-call",
8935
8922
  toolCallId: content.finalResult.runId,
8936
- toolName: content.resourceId,
8923
+ toolName: content.primitiveId,
8937
8924
  result: { runId: content.finalResult.runId },
8938
8925
  args: {
8939
8926
  __mastraMetadata: {
@@ -8948,7 +8935,7 @@ const handleNetworkMessageFromMemory = (content) => {
8948
8935
  ]
8949
8936
  };
8950
8937
  }
8951
- if (content.resourceType === "agent") {
8938
+ if (content.primitiveType === "agent") {
8952
8939
  const badgeMessages = [];
8953
8940
  let toolCalls = {};
8954
8941
  const messages = content.finalResult.messages.slice(1);
@@ -8986,7 +8973,7 @@ const handleNetworkMessageFromMemory = (content) => {
8986
8973
  {
8987
8974
  type: "tool-call",
8988
8975
  toolCallId: content.finalResult.runId,
8989
- toolName: content.resourceId,
8976
+ toolName: content.primitiveId,
8990
8977
  result: { runId: content.finalResult.runId },
8991
8978
  args: {
8992
8979
  __mastraMetadata: {
@@ -9002,14 +8989,14 @@ const handleNetworkMessageFromMemory = (content) => {
9002
8989
  ]
9003
8990
  };
9004
8991
  }
9005
- if (content.resourceType === "tool") {
8992
+ if (content.primitiveType === "tool") {
9006
8993
  return {
9007
8994
  role: "assistant",
9008
8995
  content: [
9009
8996
  {
9010
8997
  type: "tool-call",
9011
8998
  toolCallId: content.finalResult.toolCallId,
9012
- toolName: content.resourceId,
8999
+ toolName: content.primitiveId,
9013
9000
  result: content.finalResult.result,
9014
9001
  args: {
9015
9002
  ...content?.input,
@@ -9029,34 +9016,45 @@ const handleNetworkMessageFromMemory = (content) => {
9029
9016
 
9030
9017
  const handleStreamChunk = ({ chunk, conversation }) => {
9031
9018
  switch (chunk.type) {
9032
- default:
9033
- return [...conversation];
9034
- case "text-start": {
9019
+ case "start": {
9035
9020
  const newMessage = {
9036
9021
  role: "assistant",
9037
- content: [{ type: "text", text: "" }]
9022
+ content: []
9038
9023
  };
9039
9024
  return [...conversation, newMessage];
9040
9025
  }
9026
+ case "text-start":
9041
9027
  case "text-delta": {
9042
9028
  const lastMessage = conversation[conversation.length - 1];
9043
- if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
9044
- const updatedContent = lastMessage.content.map((part) => {
9045
- if (typeof part === "object" && part.type === "text") {
9046
- return {
9047
- ...part,
9048
- text: part.text + chunk.payload.text
9049
- };
9029
+ if (!lastMessage) return conversation;
9030
+ if (lastMessage.role === "assistant" && typeof lastMessage.content !== `string` && (!lastMessage.content || lastMessage.content.length === 0 || lastMessage.content[lastMessage.content.length - 1]?.type !== `text`)) {
9031
+ return [
9032
+ ...conversation.slice(0, -1),
9033
+ {
9034
+ ...lastMessage,
9035
+ content: [...lastMessage.content || [], { type: "text", text: "" }]
9050
9036
  }
9051
- return part;
9052
- });
9053
- const updatedMessage = {
9054
- ...lastMessage,
9055
- content: updatedContent
9056
- };
9057
- return [...conversation.slice(0, -1), updatedMessage];
9037
+ ];
9058
9038
  }
9059
- return [...conversation];
9039
+ if (chunk.type === `text-start`) return conversation;
9040
+ if (typeof lastMessage.content === `string`) {
9041
+ return [
9042
+ ...conversation.slice(0, -1),
9043
+ {
9044
+ ...lastMessage,
9045
+ content: lastMessage.content + chunk.payload.text
9046
+ }
9047
+ ];
9048
+ }
9049
+ const lastPart = lastMessage.content?.[lastMessage.content.length - 1];
9050
+ if (!lastPart || lastPart.type !== `text`) return conversation;
9051
+ return [
9052
+ ...conversation.slice(0, -1),
9053
+ {
9054
+ ...lastMessage,
9055
+ content: [...lastMessage.content.slice(0, -1), { ...lastPart, text: lastPart.text + chunk.payload.text }]
9056
+ }
9057
+ ];
9060
9058
  }
9061
9059
  case "tool-output": {
9062
9060
  if (chunk.payload.output?.type.startsWith("workflow-")) {
@@ -9175,7 +9173,19 @@ const handleStreamChunk = ({ chunk, conversation }) => {
9175
9173
  return [...conversation];
9176
9174
  }
9177
9175
  case "finish": {
9176
+ const lastMessage = conversation[conversation.length - 1];
9178
9177
  handleFinishReason$1(chunk.payload.stepResult.reason);
9178
+ if (lastMessage && lastMessage.role === "assistant") {
9179
+ const updatedMessage = {
9180
+ ...lastMessage,
9181
+ metadata: {
9182
+ custom: {
9183
+ modelMetadata: chunk.payload.metadata.modelMetadata
9184
+ }
9185
+ }
9186
+ };
9187
+ return [...conversation.slice(0, -1), updatedMessage];
9188
+ }
9179
9189
  return [...conversation];
9180
9190
  }
9181
9191
  case "reasoning-delta": {
@@ -9207,6 +9217,8 @@ const handleStreamChunk = ({ chunk, conversation }) => {
9207
9217
  };
9208
9218
  return [...conversation, newMessage];
9209
9219
  }
9220
+ default:
9221
+ return [...conversation];
9210
9222
  }
9211
9223
  };
9212
9224
  const handleFinishReason$1 = (finishReason) => {
@@ -9561,7 +9573,7 @@ function MastraRuntimeProvider({
9561
9573
  network,
9562
9574
  cancelRun,
9563
9575
  isRunning: isRunningStreamVNext
9564
- } = reactHooks.useMastraChat({
9576
+ } = react$2.useChat({
9565
9577
  agentId,
9566
9578
  initializeMessages: () => memory ? initializeMessageState(initialMessages || []) : []
9567
9579
  });
@@ -9598,7 +9610,7 @@ function MastraRuntimeProvider({
9598
9610
  instructions,
9599
9611
  providerOptions
9600
9612
  };
9601
- const baseClient = useMastraClient();
9613
+ const baseClient = react$2.useMastraClient();
9602
9614
  const onNew = async (message) => {
9603
9615
  if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
9604
9616
  const attachments = await convertToAIAttachments(message.attachments);
@@ -9686,7 +9698,17 @@ function MastraRuntimeProvider({
9686
9698
  },
9687
9699
  { role: "assistant", content: [] }
9688
9700
  );
9689
- setMessages((currentConversation) => [...currentConversation, latestMessage]);
9701
+ setMessages((currentConversation) => [
9702
+ ...currentConversation,
9703
+ {
9704
+ ...latestMessage,
9705
+ metadata: {
9706
+ custom: {
9707
+ modelMetadata: generatedResponse.response.modelMetadata
9708
+ }
9709
+ }
9710
+ }
9711
+ ]);
9690
9712
  if (generatedResponse.finishReason) {
9691
9713
  handleFinishReason(generatedResponse.finishReason);
9692
9714
  }
@@ -9753,7 +9775,7 @@ function MastraRuntimeProvider({
9753
9775
  if (!currentEntityId) return conversation;
9754
9776
  return handleWorkflowChunk({ workflowChunk, conversation, entityName: currentEntityId });
9755
9777
  } else if (chunk.type === "workflow-execution-start" || chunk.type === "agent-execution-start") {
9756
- currentEntityId = chunk.payload?.args?.resourceId;
9778
+ currentEntityId = chunk.payload?.args?.primitiveId;
9757
9779
  const runId = chunk.payload.runId;
9758
9780
  if (!currentEntityId || !runId) return conversation;
9759
9781
  return createRootToolAssistantMessage({
@@ -10131,7 +10153,7 @@ function MastraRuntimeProvider({
10131
10153
  }
10132
10154
  };
10133
10155
  const { adapters, isReady } = useAdapters(agentId);
10134
- const runtime = react$2.useExternalStoreRuntime({
10156
+ const runtime = react$3.useExternalStoreRuntime({
10135
10157
  isRunning: isRunning || isRunningStreamVNext,
10136
10158
  messages,
10137
10159
  convertMessage: convertMessage$1,
@@ -10140,7 +10162,7 @@ function MastraRuntimeProvider({
10140
10162
  adapters: isReady ? adapters : void 0
10141
10163
  });
10142
10164
  if (!isReady) return null;
10143
- return /* @__PURE__ */ jsxRuntime.jsxs(react$2.AssistantRuntimeProvider, { runtime, children: [
10165
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$3.AssistantRuntimeProvider, { runtime, children: [
10144
10166
  " ",
10145
10167
  children,
10146
10168
  " "
@@ -10214,7 +10236,8 @@ const AgentChat = ({
10214
10236
  initialMessages,
10215
10237
  memory,
10216
10238
  refreshThreadList,
10217
- modelVersion
10239
+ modelVersion,
10240
+ modelList
10218
10241
  }) => {
10219
10242
  const { settings } = useAgentSettings();
10220
10243
  const { runtimeContext } = usePlaygroundStore();
@@ -10230,7 +10253,7 @@ const AgentChat = ({
10230
10253
  refreshThreadList,
10231
10254
  settings,
10232
10255
  runtimeContext,
10233
- children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "", hasMemory: memory, agentId })
10256
+ children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "", hasMemory: memory, agentId, hasModelList: Boolean(modelList) })
10234
10257
  }
10235
10258
  );
10236
10259
  };
@@ -10484,7 +10507,7 @@ function EvalTable({ evals, isCIMode = false, onRefresh }) {
10484
10507
  ] }) }),
10485
10508
  /* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "w-48 text-mastra-el-3", children: "Evaluations" })
10486
10509
  ] }) }),
10487
- /* @__PURE__ */ jsxRuntime.jsx(TableBody, { className: "border-b border-gray-6 relative", children: /* @__PURE__ */ jsxRuntime.jsx(react$3.AnimatePresence, { mode: "wait", presenceAffectsLayout: false, children: groupEvals(evals).length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
10510
+ /* @__PURE__ */ jsxRuntime.jsx(TableBody, { className: "border-b border-gray-6 relative", children: /* @__PURE__ */ jsxRuntime.jsx(react$4.AnimatePresence, { mode: "wait", presenceAffectsLayout: false, children: groupEvals(evals).length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
10488
10511
  /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "h-12 w-16" }),
10489
10512
  /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: 4, className: "h-32 px-4 text-center text-mastra-el-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
10490
10513
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "size-5" }),
@@ -13099,7 +13122,7 @@ function ScoresTools({ onEntityChange, onReset, selectedEntity, entityOptions, i
13099
13122
  }
13100
13123
 
13101
13124
  const useScoresByEntityId = (entityId, entityType, page = 0) => {
13102
- const client = useMastraClient();
13125
+ const client = react$2.useMastraClient();
13103
13126
  const [scores, setScores] = React.useState(null);
13104
13127
  const [isLoading, setIsLoading] = React.useState(true);
13105
13128
  React.useEffect(() => {
@@ -13124,7 +13147,7 @@ const useScoresByEntityId = (entityId, entityType, page = 0) => {
13124
13147
  return { scores, isLoading };
13125
13148
  };
13126
13149
  const useScoresByScorerId = ({ scorerId, page = 0, entityId, entityType }) => {
13127
- const client = useMastraClient();
13150
+ const client = react$2.useMastraClient();
13128
13151
  return reactQuery.useQuery({
13129
13152
  queryKey: ["scores", scorerId, page, entityId, entityType],
13130
13153
  queryFn: () => client.getScoresByScorerId({ scorerId, page, entityId, entityType, perPage: 10 }),
@@ -13132,7 +13155,7 @@ const useScoresByScorerId = ({ scorerId, page = 0, entityId, entityType }) => {
13132
13155
  });
13133
13156
  };
13134
13157
  const useScorer = (scorerId) => {
13135
- const client = useMastraClient();
13158
+ const client = react$2.useMastraClient();
13136
13159
  const [scorer, setScorer] = React.useState(null);
13137
13160
  const [isLoading, setIsLoading] = React.useState(true);
13138
13161
  React.useEffect(() => {
@@ -13154,7 +13177,7 @@ const useScorer = (scorerId) => {
13154
13177
  return { scorer, isLoading };
13155
13178
  };
13156
13179
  const useScorers = () => {
13157
- const client = useMastraClient();
13180
+ const client = react$2.useMastraClient();
13158
13181
  return reactQuery.useQuery({
13159
13182
  queryKey: ["scorers"],
13160
13183
  queryFn: () => client.getScorers(),
@@ -13837,7 +13860,7 @@ const AgentMetadataScorerList = ({ entityId, entityType }) => {
13837
13860
  const scorerList = Object.keys(scorers).filter((scorerKey) => {
13838
13861
  const scorer = scorers[scorerKey];
13839
13862
  if (entityType === "AGENT") {
13840
- return scorer.agentNames.includes(entityId);
13863
+ return scorer.agentNames?.includes?.(entityId);
13841
13864
  }
13842
13865
  return scorer.workflowIds.includes(entityId);
13843
13866
  }).map((scorerKey) => ({ ...scorers[scorerKey], id: scorerKey }));
@@ -14166,7 +14189,7 @@ const LabelMappings = {
14166
14189
  const StepDropdown = () => {
14167
14190
  const [isExpanded, setIsExpanded] = React.useState(false);
14168
14191
  const { state } = useVNextNetworkChat();
14169
- const message = react$2.useMessage();
14192
+ const message = react$3.useMessage();
14170
14193
  const id = message?.metadata?.custom?.id;
14171
14194
  if (!id) return /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Something is wrong" });
14172
14195
  const currentState = state[id];
@@ -14304,7 +14327,7 @@ const StepClock = ({ step }) => {
14304
14327
  const NextAssistantMessage = ({
14305
14328
  ToolFallback: ToolFallbackCustom
14306
14329
  }) => {
14307
- const data = react$2.useMessage();
14330
+ const data = react$3.useMessage();
14308
14331
  const isSolelyToolCall = data.content.length === 1 && data.content[0].type === "tool-call";
14309
14332
  const content = data.content[0];
14310
14333
  if (!content) {
@@ -14314,9 +14337,9 @@ const NextAssistantMessage = ({
14314
14337
  if (textContent === "start") {
14315
14338
  return /* @__PURE__ */ jsxRuntime.jsx(StepDropdown, {});
14316
14339
  }
14317
- return /* @__PURE__ */ jsxRuntime.jsxs(react$2.MessagePrimitive.Root, { className: "max-w-full", children: [
14340
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$3.MessagePrimitive.Root, { className: "max-w-full", children: [
14318
14341
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
14319
- react$2.MessagePrimitive.Parts,
14342
+ react$3.MessagePrimitive.Parts,
14320
14343
  {
14321
14344
  components: {
14322
14345
  Text: MarkdownText,
@@ -14329,15 +14352,15 @@ const NextAssistantMessage = ({
14329
14352
  };
14330
14353
  const AssistantActionBar = () => {
14331
14354
  return /* @__PURE__ */ jsxRuntime.jsx(
14332
- react$2.ActionBarPrimitive.Root,
14355
+ react$3.ActionBarPrimitive.Root,
14333
14356
  {
14334
14357
  hideWhenRunning: true,
14335
14358
  autohide: "always",
14336
14359
  autohideFloat: "single-branch",
14337
14360
  className: "flex gap-1 items-center transition-all",
14338
- children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipIconButton, { tooltip: "Copy", className: "bg-transparent text-icon3 hover:text-icon6", children: [
14339
- /* @__PURE__ */ jsxRuntime.jsx(react$2.MessagePrimitive.If, { copied: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, {}) }),
14340
- /* @__PURE__ */ jsxRuntime.jsx(react$2.MessagePrimitive.If, { copied: false, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) })
14361
+ children: /* @__PURE__ */ jsxRuntime.jsx(react$3.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipIconButton, { tooltip: "Copy", className: "bg-transparent text-icon3 hover:text-icon6", children: [
14362
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.MessagePrimitive.If, { copied: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, {}) }),
14363
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.MessagePrimitive.If, { copied: false, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) })
14341
14364
  ] }) })
14342
14365
  }
14343
14366
  );
@@ -14350,11 +14373,11 @@ const NetworkThread = ({ ToolFallback, networkName, hasMemory }) => {
14350
14373
  return /* @__PURE__ */ jsxRuntime.jsx(NextAssistantMessage, { ...props, ToolFallback });
14351
14374
  };
14352
14375
  return /* @__PURE__ */ jsxRuntime.jsxs(ThreadWrapper, { children: [
14353
- /* @__PURE__ */ jsxRuntime.jsxs(react$2.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
14376
+ /* @__PURE__ */ jsxRuntime.jsxs(react$3.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
14354
14377
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
14355
14378
  /* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { networkName }),
14356
14379
  /* @__PURE__ */ jsxRuntime.jsx(
14357
- react$2.ThreadPrimitive.Messages,
14380
+ react$3.ThreadPrimitive.Messages,
14358
14381
  {
14359
14382
  components: {
14360
14383
  UserMessage,
@@ -14364,7 +14387,7 @@ const NetworkThread = ({ ToolFallback, networkName, hasMemory }) => {
14364
14387
  }
14365
14388
  )
14366
14389
  ] }),
14367
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
14390
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
14368
14391
  ] }),
14369
14392
  /* @__PURE__ */ jsxRuntime.jsx(Composer, { hasMemory })
14370
14393
  ] });
@@ -14372,7 +14395,7 @@ const NetworkThread = ({ ToolFallback, networkName, hasMemory }) => {
14372
14395
  const ThreadWrapper = ({ children }) => {
14373
14396
  const hasAttachments = useHasAttachments();
14374
14397
  return /* @__PURE__ */ jsxRuntime.jsx(
14375
- react$2.ThreadPrimitive.Root,
14398
+ react$3.ThreadPrimitive.Root,
14376
14399
  {
14377
14400
  className: clsx(
14378
14401
  "max-w-[568px] w-full mx-auto px-4",
@@ -14393,17 +14416,17 @@ const ThreadWelcome = ({ networkName }) => {
14393
14416
  } else {
14394
14417
  initials = "A";
14395
14418
  }
14396
- return /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.Empty, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-grow flex-col items-center justify-center", children: [
14419
+ return /* @__PURE__ */ jsxRuntime.jsx(react$3.ThreadPrimitive.Empty, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-grow flex-col items-center justify-center", children: [
14397
14420
  /* @__PURE__ */ jsxRuntime.jsx(Avatar, { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: initials }) }),
14398
14421
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
14399
14422
  ] }) });
14400
14423
  };
14401
14424
  const Composer = ({ hasMemory }) => {
14402
14425
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
14403
- /* @__PURE__ */ jsxRuntime.jsxs(react$2.ComposerPrimitive.Root, { children: [
14426
+ /* @__PURE__ */ jsxRuntime.jsxs(react$3.ComposerPrimitive.Root, { children: [
14404
14427
  /* @__PURE__ */ jsxRuntime.jsx(ComposerAttachments, {}),
14405
14428
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
14406
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
14429
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
14407
14430
  "textarea",
14408
14431
  {
14409
14432
  className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent resize-none",
@@ -14426,7 +14449,7 @@ const Composer = ({ hasMemory }) => {
14426
14449
  ] });
14427
14450
  };
14428
14451
  const SpeechInput = () => {
14429
- const composerRuntime = react$2.useComposerRuntime();
14452
+ const composerRuntime = react$3.useComposerRuntime();
14430
14453
  const { start, stop, isListening, transcript } = useSpeechRecognition({});
14431
14454
  React.useEffect(() => {
14432
14455
  if (!transcript) return;
@@ -14446,8 +14469,8 @@ const SpeechInput = () => {
14446
14469
  };
14447
14470
  const ComposerAction = () => {
14448
14471
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14449
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.AddAttachment, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Add attachment", variant: "ghost", className: "rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" }) }) }),
14450
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
14472
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.AddAttachment, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Add attachment", variant: "ghost", className: "rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" }) }) }),
14473
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
14451
14474
  TooltipIconButton,
14452
14475
  {
14453
14476
  tooltip: "Send",
@@ -14456,15 +14479,15 @@ const ComposerAction = () => {
14456
14479
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
14457
14480
  }
14458
14481
  ) }) }),
14459
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon, {}) }) }) })
14482
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ThreadPrimitive.If, { running: true, children: /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Cancel", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon, {}) }) }) })
14460
14483
  ] });
14461
14484
  };
14462
14485
  const EditComposer = () => {
14463
- return /* @__PURE__ */ jsxRuntime.jsxs(react$2.ComposerPrimitive.Root, { children: [
14464
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Input, {}),
14486
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$3.ComposerPrimitive.Root, { children: [
14487
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Input, {}),
14465
14488
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
14466
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "ghost", children: "Cancel" }) }),
14467
- /* @__PURE__ */ jsxRuntime.jsx(react$2.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { children: "Send" }) })
14489
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { variant: "ghost", children: "Cancel" }) }),
14490
+ /* @__PURE__ */ jsxRuntime.jsx(react$3.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button$2, { children: "Send" }) })
14468
14491
  ] })
14469
14492
  ] });
14470
14493
  };
@@ -14782,7 +14805,7 @@ ${formatted}\`\`\``;
14782
14805
  }
14783
14806
  }
14784
14807
  }, [initialMessages, threadId, memory, messages]);
14785
- const mastra = useMastraClient();
14808
+ const mastra = react$2.useMastraClient();
14786
14809
  const network = mastra.getVNextNetwork(networkId);
14787
14810
  const onNew = async (message) => {
14788
14811
  runIdRef.current = void 0;
@@ -14956,13 +14979,13 @@ ${formatted}\`\`\``;
14956
14979
  setIsRunning(false);
14957
14980
  }
14958
14981
  };
14959
- const runtime = react$2.useExternalStoreRuntime({
14982
+ const runtime = react$3.useExternalStoreRuntime({
14960
14983
  isRunning,
14961
14984
  messages,
14962
14985
  convertMessage,
14963
14986
  onNew
14964
14987
  });
14965
- return /* @__PURE__ */ jsxRuntime.jsxs(react$2.AssistantRuntimeProvider, { runtime, children: [
14988
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$3.AssistantRuntimeProvider, { runtime, children: [
14966
14989
  " ",
14967
14990
  children,
14968
14991
  " "
@@ -17513,7 +17536,7 @@ Dropdown.SubTrigger = DropdownMenuSubTrigger;
17513
17536
  Dropdown.RadioGroup = DropdownMenuRadioGroup;
17514
17537
 
17515
17538
  const useTriggerScorer = (onScorerTriggered) => {
17516
- const client = useMastraClient();
17539
+ const client = react$2.useMastraClient();
17517
17540
  return reactQuery.useMutation({
17518
17541
  mutationFn: async ({ scorerName, traceId, spanId }) => {
17519
17542
  const response = await client.score({
@@ -18540,7 +18563,6 @@ exports.LinkComponentProvider = LinkComponentProvider;
18540
18563
  exports.LogsIcon = LogsIcon;
18541
18564
  exports.MainContentContent = MainContentContent;
18542
18565
  exports.MainContentLayout = MainContentLayout;
18543
- exports.MastraClientProvider = MastraClientProvider;
18544
18566
  exports.MastraResizablePanel = MastraResizablePanel;
18545
18567
  exports.McpCoinIcon = McpCoinIcon;
18546
18568
  exports.McpServerIcon = McpServerIcon;
@@ -18607,6 +18629,7 @@ exports.ThreadLink = ThreadLink;
18607
18629
  exports.ThreadList = ThreadList;
18608
18630
  exports.Threads = Threads;
18609
18631
  exports.ToolCoinIcon = ToolCoinIcon;
18632
+ exports.ToolFallback = ToolFallback;
18610
18633
  exports.ToolList = ToolList;
18611
18634
  exports.ToolListEmpty = ToolListEmpty;
18612
18635
  exports.ToolListSkeleton = ToolListSkeleton;
@@ -18655,7 +18678,6 @@ exports.useAgentSettings = useAgentSettings;
18655
18678
  exports.useCurrentRun = useCurrentRun;
18656
18679
  exports.useInView = useInView;
18657
18680
  exports.useLinkComponent = useLinkComponent;
18658
- exports.useMastraClient = useMastraClient;
18659
18681
  exports.usePlaygroundStore = usePlaygroundStore;
18660
18682
  exports.usePolling = usePolling;
18661
18683
  exports.useScorer = useScorer;