@mastra/playground-ui 7.0.0-beta.13 → 7.0.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 7.0.0-beta.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Change searchbar to search on input with debounce instead of on Enter key press ([#11138](https://github.com/mastra-ai/mastra/pull/11138))
8
+
9
+ - Add support for AI SDK v6 (LanguageModelV3) ([#11191](https://github.com/mastra-ai/mastra/pull/11191))
10
+
11
+ Agents can now use `LanguageModelV3` models from AI SDK v6 beta providers like `@ai-sdk/openai@^3.0.0-beta`.
12
+
13
+ **New features:**
14
+ - Usage normalization: V3's nested usage format is normalized to Mastra's flat format with `reasoningTokens`, `cachedInputTokens`, and raw data preserved in a `raw` field
15
+
16
+ **Backward compatible:** All existing V1 and V2 models continue to work unchanged.
17
+
18
+ - Updated dependencies [[`4f94ed8`](https://github.com/mastra-ai/mastra/commit/4f94ed8177abfde3ec536e3574883e075423350c), [`ac3cc23`](https://github.com/mastra-ai/mastra/commit/ac3cc2397d1966bc0fc2736a223abc449d3c7719), [`a86f4df`](https://github.com/mastra-ai/mastra/commit/a86f4df0407311e0d2ea49b9a541f0938810d6a9), [`029540c`](https://github.com/mastra-ai/mastra/commit/029540ca1e582fc2dd8d288ecd4a9b0f31a954ef), [`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`01b20fe`](https://github.com/mastra-ai/mastra/commit/01b20fefb7c67c2b7d79417598ef4e60256d1225), [`0dbf199`](https://github.com/mastra-ai/mastra/commit/0dbf199110f22192ce5c95b1c8148d4872b4d119), [`b7b0930`](https://github.com/mastra-ai/mastra/commit/b7b0930dbe72eade8d3882992f2f2db53220e4eb), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7)]:
19
+ - @mastra/core@1.0.0-beta.14
20
+ - @mastra/ai-sdk@1.0.0-beta.10
21
+ - @mastra/client-js@1.0.0-beta.14
22
+ - @mastra/react@0.1.0-beta.14
23
+
3
24
  ## 7.0.0-beta.13
4
25
 
5
26
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -9363,18 +9363,17 @@ const columns$4 = [
9363
9363
  }
9364
9364
  ];
9365
9365
 
9366
- const themeClasses = {
9367
- light: "bg-gray-100 border-gray-300 text-gray-700",
9368
- dark: "bg-surface4 border-border1 text-icon6"
9369
- };
9370
- const Kbd = ({ children, theme = "dark" }) => {
9371
- const themeClass = themeClasses[theme];
9372
- return /* @__PURE__ */ jsxRuntime.jsx("kbd", { className: clsx("border-sm rounded-md px-1 py-0.5 font-mono", themeClass), children });
9373
- };
9374
-
9375
- const Searchbar = ({ onSearch, label, placeholder }) => {
9366
+ const Searchbar = ({ onSearch, label, placeholder, debounceMs = 300 }) => {
9376
9367
  const id = React.useId();
9377
9368
  const inputRef = React.useRef(null);
9369
+ const debouncedSearch = useDebounce.useDebouncedCallback((value) => {
9370
+ onSearch(value);
9371
+ }, debounceMs);
9372
+ React.useEffect(() => {
9373
+ return () => {
9374
+ debouncedSearch.cancel();
9375
+ };
9376
+ }, [debouncedSearch]);
9378
9377
  React.useEffect(() => {
9379
9378
  const input = inputRef.current;
9380
9379
  if (!input) return;
@@ -9389,37 +9388,27 @@ const Searchbar = ({ onSearch, label, placeholder }) => {
9389
9388
  window.removeEventListener("keydown", handleKeyDown);
9390
9389
  };
9391
9390
  }, []);
9392
- const handleSubmit = (e) => {
9393
- e.preventDefault();
9394
- const formData = new FormData(e.target);
9395
- const search = formData.get(id);
9396
- onSearch(search);
9391
+ const handleChange = (e) => {
9392
+ debouncedSearch(e.target.value);
9397
9393
  };
9398
- return /* @__PURE__ */ jsxRuntime.jsxs(
9399
- "form",
9400
- {
9401
- onSubmit: handleSubmit,
9402
- className: "focus-within:outline focus-within:outline-accent1 -outline-offset-2 border-sm border-icon-3 flex h-8 w-full items-center gap-2 overflow-hidden rounded-lg pl-2 pr-1",
9403
- children: [
9404
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "text-icon3 h-4 w-4" }),
9405
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
9406
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "sr-only", children: label }),
9407
- /* @__PURE__ */ jsxRuntime.jsx(
9408
- "input",
9409
- {
9410
- id,
9411
- type: "text",
9412
- placeholder,
9413
- className: "bg-surface2 text-ui-md placeholder:text-icon-3 block h-8 w-full px-2 outline-none",
9414
- name: id,
9415
- ref: inputRef
9416
- }
9417
- )
9418
- ] }),
9419
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", className: "text-ui-sm text-icon3 flex flex-row items-center gap-1", children: /* @__PURE__ */ jsxRuntime.jsx(Kbd, { children: "↵ Enter" }) })
9420
- ]
9421
- }
9422
- );
9394
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "focus-within:outline focus-within:outline-accent1 -outline-offset-2 border-sm border-icon-3 flex h-8 w-full items-center gap-2 overflow-hidden rounded-lg pl-2 pr-1", children: [
9395
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "text-icon3 h-4 w-4" }),
9396
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
9397
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "sr-only", children: label }),
9398
+ /* @__PURE__ */ jsxRuntime.jsx(
9399
+ "input",
9400
+ {
9401
+ id,
9402
+ type: "text",
9403
+ placeholder,
9404
+ className: "bg-surface2 text-ui-md placeholder:text-icon-3 block h-8 w-full px-2 outline-none",
9405
+ name: id,
9406
+ ref: inputRef,
9407
+ onChange: handleChange
9408
+ }
9409
+ )
9410
+ ] })
9411
+ ] });
9423
9412
  };
9424
9413
  const SearchbarWrapper = ({ children }) => {
9425
9414
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-2 border-b-sm border-border1", children });
@@ -12018,12 +12007,12 @@ function MastraRuntimeProvider({
12018
12007
  requireToolApproval
12019
12008
  };
12020
12009
  const baseClient = react$1.useMastraClient();
12021
- const isVNext = modelVersion === "v2";
12010
+ const isSupportedModel = modelVersion === "v2" || modelVersion === "v3";
12022
12011
  const onNew = async (message) => {
12023
12012
  if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
12024
12013
  const attachments = await convertToAIAttachments(message.attachments);
12025
12014
  const input = message.content[0].text;
12026
- if (!isVNext) {
12015
+ if (!isSupportedModel) {
12027
12016
  setLegacyMessages((s) => [...s, { role: "user", content: input, attachments: message.attachments }]);
12028
12017
  }
12029
12018
  const controller = new AbortController();
@@ -12034,7 +12023,7 @@ function MastraRuntimeProvider({
12034
12023
  });
12035
12024
  const agent = clientWithAbort.getAgent(agentId);
12036
12025
  try {
12037
- if (isVNext) {
12026
+ if (isSupportedModel) {
12038
12027
  if (chatWithNetwork) {
12039
12028
  await sendMessage({
12040
12029
  message: input,
@@ -12377,7 +12366,7 @@ function MastraRuntimeProvider({
12377
12366
  if (error.name === "AbortError") {
12378
12367
  return;
12379
12368
  }
12380
- if (isVNext) {
12369
+ if (isSupportedModel) {
12381
12370
  setMessages((currentConversation) => [
12382
12371
  ...currentConversation,
12383
12372
  { role: "assistant", parts: [{ type: "text", text: `${error}` }] }
@@ -12404,7 +12393,7 @@ function MastraRuntimeProvider({
12404
12393
  const vnextmessages = messages.map(react$1.toAssistantUIMessage);
12405
12394
  const runtime = react.useExternalStoreRuntime({
12406
12395
  isRunning: isLegacyRunning || isRunningStream,
12407
- messages: isVNext ? vnextmessages : legacyMessages,
12396
+ messages: isSupportedModel ? vnextmessages : legacyMessages,
12408
12397
  convertMessage: (x) => x,
12409
12398
  onNew,
12410
12399
  onCancel,
@@ -12854,8 +12843,9 @@ const AgentSettings = ({ agentId }) => {
12854
12843
  const hasMemory = Boolean(memory?.result);
12855
12844
  const hasSubAgents = Boolean(Object.keys(agent.agents || {}).length > 0);
12856
12845
  const modelVersion = agent.modelVersion;
12846
+ const isSupportedModel = modelVersion === "v2" || modelVersion === "v3";
12857
12847
  let radioValue;
12858
- if (modelVersion === "v2") {
12848
+ if (isSupportedModel) {
12859
12849
  if (settings?.modelSettings?.chatWithNetwork) {
12860
12850
  radioValue = "network";
12861
12851
  } else {
@@ -12882,23 +12872,23 @@ const AgentSettings = ({ agentId }) => {
12882
12872
  }),
12883
12873
  className: "flex flex-row gap-4",
12884
12874
  children: [
12885
- modelVersion !== "v2" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12875
+ !isSupportedModel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12886
12876
  /* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "generateLegacy", id: "generateLegacy", className: "text-icon6" }),
12887
12877
  /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "generateLegacy", children: "Generate (Legacy)" })
12888
12878
  ] }),
12889
- modelVersion === "v2" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12879
+ isSupportedModel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12890
12880
  /* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "generate", id: "generate", className: "text-icon6" }),
12891
12881
  /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "generate", children: "Generate" })
12892
12882
  ] }),
12893
- modelVersion !== "v2" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12883
+ !isSupportedModel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12894
12884
  /* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "streamLegacy", id: "streamLegacy", className: "text-icon6" }),
12895
12885
  /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "streamLegacy", children: "Stream (Legacy)" })
12896
12886
  ] }),
12897
- modelVersion === "v2" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12887
+ isSupportedModel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
12898
12888
  /* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "stream", id: "stream", className: "text-icon6" }),
12899
12889
  /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-icon6 text-ui-md", htmlFor: "stream", children: "Stream" })
12900
12890
  ] }),
12901
- modelVersion === "v2" && /* @__PURE__ */ jsxRuntime.jsx(NetworkCheckbox, { hasMemory, hasSubAgents })
12891
+ isSupportedModel && /* @__PURE__ */ jsxRuntime.jsx(NetworkCheckbox, { hasMemory, hasSubAgents })
12902
12892
  ]
12903
12893
  }
12904
12894
  ) }),
@@ -15973,7 +15963,7 @@ const AgentMetadata = ({ agentId }) => {
15973
15963
  AgentMetadataSection,
15974
15964
  {
15975
15965
  title: "Model",
15976
- hint: agent.modelVersion === "v2" ? void 0 : {
15966
+ hint: agent.modelVersion === "v2" || agent.modelVersion === "v3" ? void 0 : {
15977
15967
  link: "https://mastra.ai/guides/migrations/vnext-to-standard-apis",
15978
15968
  title: "You are using a legacy v1 model",
15979
15969
  icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangleIcon, { fontSize: 14, className: "mb-0.5" })
@@ -20120,6 +20110,15 @@ const PlaygroundQueryClient = ({ children, options }) => {
20120
20110
  return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children });
20121
20111
  };
20122
20112
 
20113
+ const themeClasses = {
20114
+ light: "bg-gray-100 border-gray-300 text-gray-700",
20115
+ dark: "bg-surface4 border-border1 text-icon6"
20116
+ };
20117
+ const Kbd = ({ children, theme = "dark" }) => {
20118
+ const themeClass = themeClasses[theme];
20119
+ return /* @__PURE__ */ jsxRuntime.jsx("kbd", { className: clsx("border-sm rounded-md px-1 py-0.5 font-mono", themeClass), children });
20120
+ };
20121
+
20123
20122
  const errorFallback = "Something went wrong while fetching the data.";
20124
20123
  const parseError = (error) => {
20125
20124
  try {