@mastra/playground-ui 19.0.1-alpha.1 → 19.0.1-alpha.2

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,21 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 19.0.1-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - dependencies updates: ([#14584](https://github.com/mastra-ai/mastra/pull/14584))
8
+ - Updated dependency [`@assistant-ui/react@^0.12.19` ↗︎](https://www.npmjs.com/package/@assistant-ui/react/v/0.12.19) (from `^0.12.17`, in `dependencies`)
9
+ - Updated dependency [`@assistant-ui/react-markdown@^0.12.6` ↗︎](https://www.npmjs.com/package/@assistant-ui/react-markdown/v/0.12.6) (from `^0.12.5`, in `dependencies`)
10
+ - Updated dependency [`@assistant-ui/react-syntax-highlighter@^0.12.7` ↗︎](https://www.npmjs.com/package/@assistant-ui/react-syntax-highlighter/v/0.12.7) (from `^0.12.6`, in `dependencies`)
11
+
12
+ - Added 'Create Agent' and 'Edit Agent' buttons to the playground, gated behind the MASTRA_EXPERIMENTAL_UI environment variable. When enabled, a 'Create Agent' button appears on the agents list page and an 'Edit' button appears on the agent detail header for stored agents. ([#14694](https://github.com/mastra-ai/mastra/pull/14694))
13
+
14
+ - Updated dependencies [[`404fea1`](https://github.com/mastra-ai/mastra/commit/404fea13042181f0b0c73a101392ac87c79ceae2), [`ebf5047`](https://github.com/mastra-ai/mastra/commit/ebf5047e825c38a1a356f10b214c1d4260dfcd8d), [`675f15b`](https://github.com/mastra-ai/mastra/commit/675f15b7eaeea649158d228ea635be40480c584d), [`b174c63`](https://github.com/mastra-ai/mastra/commit/b174c63a093108d4e53b9bc89a078d9f66202b3f), [`eef7cb2`](https://github.com/mastra-ai/mastra/commit/eef7cb2abe7ef15951e2fdf792a5095c6c643333), [`197daf0`](https://github.com/mastra-ai/mastra/commit/197daf03a33e4650bd90391eef0ec7d0392a6c9c), [`86e3263`](https://github.com/mastra-ai/mastra/commit/86e326363edd12be5a5b25ccce4a39f66f7c9f50), [`e8a5b0b`](https://github.com/mastra-ai/mastra/commit/e8a5b0b9bc94d12dee4150095512ca27a288d778)]:
15
+ - @mastra/core@1.17.0-alpha.2
16
+ - @mastra/client-js@1.10.1-alpha.2
17
+ - @mastra/react@0.2.18-alpha.2
18
+
3
19
  ## 19.0.1-alpha.1
4
20
 
5
21
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -18079,6 +18079,11 @@ const AgentSettings = ({ agentId }) => {
18079
18079
  ] });
18080
18080
  };
18081
18081
 
18082
+ const useCanCreateAgent = () => {
18083
+ const canCreateAgent = typeof window !== "undefined" && window.MASTRA_EXPERIMENTAL_UI === "true";
18084
+ return { canCreateAgent };
18085
+ };
18086
+
18082
18087
  const resolveInstructionPart = (part) => {
18083
18088
  if (typeof part === "string") {
18084
18089
  return part.trim();
@@ -18264,29 +18269,41 @@ const AgentsTableSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs(Table, { child
18264
18269
  /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) })
18265
18270
  ] }, index)) })
18266
18271
  ] });
18267
- const EmptyAgentsTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
18268
- EmptyState$1,
18269
- {
18270
- iconSlot: /* @__PURE__ */ jsxRuntime.jsx(AgentCoinIcon, {}),
18271
- titleSlot: "No Agents Yet",
18272
- descriptionSlot: "Configure agents in code to get started.",
18273
- actionSlot: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col sm:flex-row gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs(
18274
- Button,
18275
- {
18276
- size: "lg",
18277
- variant: "outline",
18278
- as: "a",
18279
- href: "https://mastra.ai/docs/agents/overview",
18280
- target: "_blank",
18281
- rel: "noopener noreferrer",
18282
- children: [
18283
- /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BookOpen, {}) }),
18284
- "Documentation"
18285
- ]
18286
- }
18287
- ) })
18288
- }
18289
- ) });
18272
+ const EmptyAgentsTable = () => {
18273
+ const { canCreateAgent } = useCanCreateAgent();
18274
+ const { Link: FrameworkLink, paths } = useLinkComponent();
18275
+ const createAgentPath = paths.cmsAgentCreateLink();
18276
+ const showCreateCta = canCreateAgent && Boolean(createAgentPath);
18277
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
18278
+ EmptyState$1,
18279
+ {
18280
+ iconSlot: /* @__PURE__ */ jsxRuntime.jsx(AgentCoinIcon, {}),
18281
+ titleSlot: "No Agents Yet",
18282
+ descriptionSlot: showCreateCta ? "Create your first agent or configure agents in code." : "Configure agents in code to get started.",
18283
+ actionSlot: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row gap-2", children: [
18284
+ showCreateCta && /* @__PURE__ */ jsxRuntime.jsxs(Button, { size: "lg", variant: "primary", as: FrameworkLink, to: createAgentPath, children: [
18285
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {}) }),
18286
+ "Create an agent"
18287
+ ] }),
18288
+ /* @__PURE__ */ jsxRuntime.jsxs(
18289
+ Button,
18290
+ {
18291
+ size: "lg",
18292
+ variant: "outline",
18293
+ as: "a",
18294
+ href: "https://mastra.ai/docs/agents/overview",
18295
+ target: "_blank",
18296
+ rel: "noopener noreferrer",
18297
+ children: [
18298
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BookOpen, {}) }),
18299
+ "Documentation"
18300
+ ]
18301
+ }
18302
+ )
18303
+ ] })
18304
+ }
18305
+ ) });
18306
+ };
18290
18307
 
18291
18308
  const RequestContext = () => {
18292
18309
  const { requestContext, setRequestContext } = usePlaygroundStore();
@@ -22079,13 +22096,22 @@ const AgentMetadataCombinedProcessorList = ({
22079
22096
  const AgentEntityHeader = ({ agentId }) => {
22080
22097
  const { data: agent, isLoading } = useAgent(agentId);
22081
22098
  const { handleCopy } = useCopyToClipboard$1({ text: agentId });
22099
+ const { canCreateAgent } = useCanCreateAgent();
22100
+ const { Link: FrameworkLink, paths } = useLinkComponent();
22082
22101
  const sessionUrl = `${window.location.origin}/agents/${agentId}/session`;
22083
22102
  const { handleCopy: handleShareLink, isCopied: isShareCopied } = useCopyToClipboard$1({
22084
22103
  text: sessionUrl,
22085
22104
  copyMessage: "Session URL copied to clipboard!"
22086
22105
  });
22087
22106
  const agentName = agent?.name || "";
22107
+ const isStoredAgent = agent?.source === "stored";
22108
+ const editPath = paths.cmsAgentEditLink(agentId);
22109
+ const showEditButton = canCreateAgent && isStoredAgent && Boolean(editPath);
22088
22110
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(EntityHeader, { icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}), title: agentName, isLoading, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-3", children: [
22111
+ showEditButton && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", as: FrameworkLink, to: editPath, children: [
22112
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, {}) }),
22113
+ "Edit"
22114
+ ] }),
22089
22115
  /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
22090
22116
  /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: handleCopy, className: "h-badge-default shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}), variant: "default", children: agentId }) }) }),
22091
22117
  /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Copy Agent ID for use in code" })
@@ -52977,6 +53003,7 @@ exports.useAllModels = useAllModels;
52977
53003
  exports.useAuthCapabilities = useAuthCapabilities;
52978
53004
  exports.useAvgScoreKpiMetrics = useAvgScoreKpiMetrics;
52979
53005
  exports.useCSVParser = useCSVParser;
53006
+ exports.useCanCreateAgent = useCanCreateAgent;
52980
53007
  exports.useCloneThread = useCloneThread;
52981
53008
  exports.useCodemirrorTheme = useCodemirrorTheme$1;
52982
53009
  exports.useCompareAgentVersions = useCompareAgentVersions;