@mastra/playground-ui 5.1.13-alpha.0 → 5.1.13-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/dist/index.cjs.js CHANGED
@@ -7758,7 +7758,11 @@ const LinkComponentProvider = ({ children, Link }) => {
7758
7758
  return /* @__PURE__ */ jsxRuntime.jsx(LinkComponentContext.Provider, { value: { Link }, children });
7759
7759
  };
7760
7760
  const useLinkComponent = () => {
7761
- return React.useContext(LinkComponentContext);
7761
+ const ctx = React.useContext(LinkComponentContext);
7762
+ if (!ctx) {
7763
+ throw new Error("useLinkComponent must be used within a LinkComponentProvider");
7764
+ }
7765
+ return ctx;
7762
7766
  };
7763
7767
 
7764
7768
  const providerMapToIcon = {
@@ -7784,7 +7788,7 @@ const NameCell = ({ row }) => {
7784
7788
  }
7785
7789
  );
7786
7790
  };
7787
- const columns = [
7791
+ const columns$2 = [
7788
7792
  {
7789
7793
  header: "Name",
7790
7794
  accessorKey: "name",
@@ -7821,24 +7825,27 @@ const columns = [
7821
7825
  ];
7822
7826
 
7823
7827
  function AgentsTable({ agents, isLoading, onClickRow }) {
7824
- const _agents = agents || {};
7825
- const projectData = Object.keys(_agents).map((key) => {
7826
- const agent = _agents[key];
7827
- return {
7828
- id: key,
7829
- name: agent.name,
7830
- instructions: agent.instructions,
7831
- provider: agent.provider,
7832
- branch: void 0,
7833
- executedAt: void 0,
7834
- repoUrl: void 0,
7835
- tools: agent.tools,
7836
- modelId: agent.modelId
7837
- };
7838
- });
7828
+ const projectData = React.useMemo(
7829
+ () => Object.keys(agents).map((key) => {
7830
+ const agent = agents[key];
7831
+ return {
7832
+ id: key,
7833
+ name: agent.name,
7834
+ instructions: agent.instructions,
7835
+ provider: agent.provider,
7836
+ branch: void 0,
7837
+ executedAt: void 0,
7838
+ repoUrl: void 0,
7839
+ tools: agent.tools,
7840
+ modelId: agent.modelId,
7841
+ link: `/agents/${key}/chat/new`
7842
+ };
7843
+ }),
7844
+ [agents]
7845
+ );
7839
7846
  const table = reactTable.useReactTable({
7840
7847
  data: projectData,
7841
- columns,
7848
+ columns: columns$2,
7842
7849
  getCoreRowModel: reactTable.getCoreRowModel()
7843
7850
  });
7844
7851
  if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(AgentsTableSkeleton, {});
@@ -7888,6 +7895,83 @@ const EmptyAgentsTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className
7888
7895
  }
7889
7896
  ) });
7890
7897
 
7898
+ const RuntimeContext = () => {
7899
+ const { runtimeContext, setRuntimeContext } = usePlaygroundStore();
7900
+ const [runtimeContextValue, setRuntimeContextValue] = React.useState("");
7901
+ const theme = useCodemirrorTheme();
7902
+ const { handleCopy } = useCopyToClipboard({ text: runtimeContextValue });
7903
+ const runtimeContextStr = JSON.stringify(runtimeContext);
7904
+ React.useEffect(() => {
7905
+ const run = async () => {
7906
+ if (!isValidJson(runtimeContextStr)) {
7907
+ sonner.toast.error("Invalid JSON");
7908
+ return;
7909
+ }
7910
+ const formatted = await formatJSON(runtimeContextStr);
7911
+ setRuntimeContextValue(formatted);
7912
+ };
7913
+ run();
7914
+ }, [runtimeContextStr]);
7915
+ const handleSaveRuntimeContext = () => {
7916
+ try {
7917
+ const parsedContext = JSON.parse(runtimeContextValue);
7918
+ setRuntimeContext(parsedContext);
7919
+ sonner.toast.success("Runtime context saved successfully");
7920
+ } catch (error) {
7921
+ console.error("error", error);
7922
+ sonner.toast.error("Invalid JSON");
7923
+ }
7924
+ };
7925
+ const buttonClass = "text-icon3 hover:text-icon6";
7926
+ const formatRuntimeContext = async () => {
7927
+ if (!isValidJson(runtimeContextValue)) {
7928
+ sonner.toast.error("Invalid JSON");
7929
+ return;
7930
+ }
7931
+ const formatted = await formatJSON(runtimeContextValue);
7932
+ setRuntimeContextValue(formatted);
7933
+ };
7934
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
7935
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between pb-2", children: [
7936
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", variant: "ui-md", className: "text-icon3", children: "Runtime Context (JSON)" }),
7937
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
7938
+ /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
7939
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: formatRuntimeContext, className: buttonClass, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Braces, {}) }) }) }),
7940
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Format the Runtime Context JSON" })
7941
+ ] }),
7942
+ /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
7943
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: handleCopy, className: buttonClass, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) }) }) }),
7944
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: "Copy Runtime Context" })
7945
+ ] })
7946
+ ] })
7947
+ ] }),
7948
+ /* @__PURE__ */ jsxRuntime.jsx(
7949
+ CodeMirror,
7950
+ {
7951
+ value: runtimeContextValue,
7952
+ onChange: setRuntimeContextValue,
7953
+ theme,
7954
+ extensions: [langJson.jsonLanguage],
7955
+ className: "h-[400px] overflow-y-scroll bg-surface3 rounded-lg overflow-hidden p-3"
7956
+ }
7957
+ ),
7958
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleSaveRuntimeContext, children: "Save" }) })
7959
+ ] });
7960
+ };
7961
+ const RuntimeContextWrapper = ({ children }) => {
7962
+ const { Link } = useLinkComponent();
7963
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-3xl p-5 overflow-y-scroll h-full", children: [
7964
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg p-4 pb-5 bg-surface4 shadow-md space-y-3 border border-border1 mb-5", children: [
7965
+ /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-lg", className: "text-icon3", children: "Mastra provides runtime context, which is a system based on dependency injection that enables you to configure your agents and tools with runtime variables. If you find yourself creating several different agents that do very similar things, runtime context allows you to combine them into one agent." }),
7966
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { as: Link, to: "https://mastra.ai/en/docs/agents/runtime-variables", target: "_blank", children: [
7967
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, {}) }),
7968
+ "See documentation"
7969
+ ] })
7970
+ ] }),
7971
+ children
7972
+ ] });
7973
+ };
7974
+
7891
7975
  const convertMessage$1 = (message) => {
7892
7976
  return message;
7893
7977
  };
@@ -11022,6 +11106,309 @@ const VNextNetworkChat = ({
11022
11106
  ) }, threadId) }, threadId);
11023
11107
  };
11024
11108
 
11109
+ const columns$1 = [
11110
+ {
11111
+ id: "name",
11112
+ header: "Name",
11113
+ cell: ({ row }) => {
11114
+ const { Link } = useLinkComponent();
11115
+ return /* @__PURE__ */ jsxRuntime.jsx(
11116
+ EntryCell,
11117
+ {
11118
+ icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}),
11119
+ name: /* @__PURE__ */ jsxRuntime.jsx(
11120
+ Link,
11121
+ {
11122
+ className: "w-full space-y-0",
11123
+ href: `/networks${row.original.isVNext ? "/v-next" : ""}/${row.original.id}/chat`,
11124
+ children: row.original.name
11125
+ }
11126
+ ),
11127
+ description: row.original.instructions
11128
+ }
11129
+ );
11130
+ },
11131
+ meta: {
11132
+ width: "auto"
11133
+ }
11134
+ },
11135
+ {
11136
+ id: "agents",
11137
+ header: "Agents",
11138
+ cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Users, {}), children: row.original.agentsSize }) })
11139
+ },
11140
+ {
11141
+ id: "workflows",
11142
+ header: "Workflows",
11143
+ cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, {}), children: row.original.workflowsSize }) })
11144
+ },
11145
+ {
11146
+ id: "tools",
11147
+ header: "Tools",
11148
+ cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, {}), children: row.original.toolsSize }) })
11149
+ },
11150
+ {
11151
+ id: "model",
11152
+ header: "Routing Models",
11153
+ cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsxs(Cell, { children: [
11154
+ /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Brain, {}), children: row.original.routingModel }),
11155
+ row.original.isVNext ? /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { className: "!text-accent1 ml-2", children: "vNext" }) : null
11156
+ ] })
11157
+ }
11158
+ ];
11159
+
11160
+ const NetworkTable = ({ legacyNetworks, networks, isLoading, onClickRow }) => {
11161
+ const allNetworks = React.useMemo(
11162
+ () => [
11163
+ ...legacyNetworks?.map((network) => ({
11164
+ ...network,
11165
+ routingModel: network.routingModel.modelId,
11166
+ agentsSize: network.agents.length,
11167
+ isVNext: false
11168
+ })) ?? [],
11169
+ ...networks?.map((network) => ({
11170
+ ...network,
11171
+ routingModel: network.routingModel.modelId,
11172
+ agentsSize: network.agents.length,
11173
+ workflowsSize: network.workflows.length,
11174
+ toolsSize: network.tools.length,
11175
+ isVNext: true
11176
+ })) ?? []
11177
+ ],
11178
+ [networks, legacyNetworks]
11179
+ );
11180
+ const table = reactTable.useReactTable({
11181
+ data: allNetworks,
11182
+ columns: columns$1,
11183
+ getCoreRowModel: reactTable.getCoreRowModel()
11184
+ });
11185
+ if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(NetworkTableSkeleton, {});
11186
+ const ths = table.getHeaderGroups()[0];
11187
+ const rows = table.getRowModel().rows.concat();
11188
+ if (rows.length === 0) {
11189
+ return /* @__PURE__ */ jsxRuntime.jsx(NetworkTableEmpty, {});
11190
+ }
11191
+ return /* @__PURE__ */ jsxRuntime.jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
11192
+ /* @__PURE__ */ jsxRuntime.jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
11193
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => onClickRow(row.original.id, row.original.isVNext || false), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
11194
+ ] }) });
11195
+ };
11196
+ const NetworkTableEmpty = () => {
11197
+ return /* @__PURE__ */ jsxRuntime.jsx(
11198
+ EmptyState,
11199
+ {
11200
+ iconSlot: /* @__PURE__ */ jsxRuntime.jsx(AgentNetworkCoinIcon, {}),
11201
+ titleSlot: "Configure Agent Networks",
11202
+ descriptionSlot: "Mastra agent networks are not configured yet. You can find more information in the documentation.",
11203
+ actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
11204
+ Button,
11205
+ {
11206
+ size: "lg",
11207
+ className: "w-full",
11208
+ variant: "light",
11209
+ as: "a",
11210
+ href: "https://mastra.ai/en/reference/networks/agent-network",
11211
+ target: "_blank",
11212
+ children: [
11213
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.NetworkIcon, {}) }),
11214
+ "Docs"
11215
+ ]
11216
+ }
11217
+ )
11218
+ }
11219
+ );
11220
+ };
11221
+ const NetworkTableSkeleton = () => {
11222
+ return /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
11223
+ /* @__PURE__ */ jsxRuntime.jsxs(Thead, { children: [
11224
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Name" }),
11225
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Agents" }),
11226
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Workflows" }),
11227
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Tools" }),
11228
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Routing Models" })
11229
+ ] }),
11230
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsxs(Row, { children: [
11231
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
11232
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
11233
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
11234
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
11235
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 160, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) })
11236
+ ] }, index)) })
11237
+ ] });
11238
+ };
11239
+
11240
+ const Entity = ({ children, className, onClick }) => {
11241
+ return /* @__PURE__ */ jsxRuntime.jsx(
11242
+ "div",
11243
+ {
11244
+ tabIndex: onClick ? 0 : void 0,
11245
+ onKeyDown: (e) => {
11246
+ if (!onClick) return;
11247
+ if (e.key === "Enter" || e.key === " ") {
11248
+ e.preventDefault();
11249
+ onClick?.();
11250
+ }
11251
+ },
11252
+ className: clsx(
11253
+ "flex gap-3 group/entity bg-surface3 rounded-lg border-sm border-border1 py-3 px-4",
11254
+ onClick && "cursor-pointer hover:bg-surface4 transition-all",
11255
+ className
11256
+ ),
11257
+ onClick,
11258
+ children
11259
+ }
11260
+ );
11261
+ };
11262
+ const EntityIcon = ({ children, className }) => {
11263
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: clsx("text-icon3 mt-1", className), children });
11264
+ };
11265
+ const EntityName = ({ children, className }) => {
11266
+ return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-lg", className: clsx("text-icon6 font-medium", className), children });
11267
+ };
11268
+ const EntityDescription = ({ children, className }) => {
11269
+ return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: clsx("text-icon3", className), children });
11270
+ };
11271
+ const EntityContent = ({ children, className }) => {
11272
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
11273
+ };
11274
+
11275
+ const ToolList = ({ tools, agents, isLoading }) => {
11276
+ const toolsWithAgents = React.useMemo(() => prepareAgents(tools, agents), [tools, agents]);
11277
+ if (isLoading)
11278
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-5xl w-full mx-auto px-4 pt-8", children: /* @__PURE__ */ jsxRuntime.jsx(ToolListSkeleton, {}) });
11279
+ return /* @__PURE__ */ jsxRuntime.jsx(ToolListInner, { toolsWithAgents });
11280
+ };
11281
+ const ToolListInner = ({ toolsWithAgents }) => {
11282
+ const [filteredTools, setFilteredTools] = React.useState(toolsWithAgents);
11283
+ const [value, setValue] = React.useState("");
11284
+ if (filteredTools.length === 0 && !value) return /* @__PURE__ */ jsxRuntime.jsx(ToolListEmpty, {});
11285
+ const handleSearch = (e) => {
11286
+ const value2 = e.target.value;
11287
+ setValue(value2);
11288
+ React.startTransition(() => {
11289
+ setFilteredTools(
11290
+ toolsWithAgents.filter(
11291
+ (tool) => tool.id.toLowerCase().includes(value2.toLowerCase()) || tool.description.toLowerCase().includes(value2.toLowerCase()) || tool.agents.some(
11292
+ (agent) => agent.name.toLowerCase().includes(value2.toLowerCase()) || agent.id.toLowerCase().includes(value2.toLowerCase())
11293
+ )
11294
+ )
11295
+ );
11296
+ });
11297
+ };
11298
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11299
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-5xl w-full mx-auto px-4 pt-8", children: [
11300
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 flex items-center gap-2 rounded-lg bg-surface5 focus-within:ring-2 focus-within:ring-accent3", children: [
11301
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, {}) }),
11302
+ /* @__PURE__ */ jsxRuntime.jsx(
11303
+ "input",
11304
+ {
11305
+ type: "text",
11306
+ placeholder: "Search for a tool",
11307
+ className: "w-full py-2 bg-transparent text-icon3 focus:text-icon6 placeholder:text-icon3 outline-none",
11308
+ value,
11309
+ onChange: handleSearch
11310
+ }
11311
+ )
11312
+ ] }),
11313
+ filteredTools.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", className: "text-icon3 py-2", children: "No tools found matching your search." })
11314
+ ] }),
11315
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid md:grid-cols-2 xl:grid-cols-3 gap-4 max-w-5xl mx-auto py-8", children: filteredTools.map((tool) => /* @__PURE__ */ jsxRuntime.jsx(ToolEntity, { tool }, tool.id)) })
11316
+ ] });
11317
+ };
11318
+ const ToolEntity = ({ tool }) => {
11319
+ const linkRef = React.useRef(null);
11320
+ const { Link } = useLinkComponent();
11321
+ return /* @__PURE__ */ jsxRuntime.jsxs(Entity, { onClick: () => linkRef.current?.click(), children: [
11322
+ /* @__PURE__ */ jsxRuntime.jsx(EntityIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, { className: "group-hover/entity:text-[#ECB047]" }) }),
11323
+ /* @__PURE__ */ jsxRuntime.jsxs(EntityContent, { children: [
11324
+ /* @__PURE__ */ jsxRuntime.jsx(EntityName, { children: /* @__PURE__ */ jsxRuntime.jsx(
11325
+ Link,
11326
+ {
11327
+ ref: linkRef,
11328
+ href: tool.agents.length > 0 ? `/tools/${tool.agents[0].id}/${tool.id}` : `/tools/all/${tool.id}`,
11329
+ children: tool.id
11330
+ }
11331
+ ) }),
11332
+ /* @__PURE__ */ jsxRuntime.jsx(EntityDescription, { children: tool.description }),
11333
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex flex-wrap gap-2 pt-4", children: tool.agents.map((agent) => {
11334
+ return /* @__PURE__ */ jsxRuntime.jsx(
11335
+ Link,
11336
+ {
11337
+ href: `/agents/${agent.id}/chat`,
11338
+ onClick: (e) => e.stopPropagation(),
11339
+ className: "group/link",
11340
+ children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, { className: "group-hover/link:text-accent3" }), className: "bg-surface5 ", children: agent.name })
11341
+ },
11342
+ agent.id
11343
+ );
11344
+ }) })
11345
+ ] })
11346
+ ] });
11347
+ };
11348
+ const ToolListSkeleton = () => {
11349
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11350
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-5xl w-full mx-auto px-4 pt-8", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-10 w-full" }) }),
11351
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid md:grid-cols-2 xl:grid-cols-3 gap-4 max-w-5xl mx-auto py-8", children: [
11352
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-40 w-full" }),
11353
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-40 w-full" }),
11354
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-40 w-full" })
11355
+ ] })
11356
+ ] });
11357
+ };
11358
+ const ToolListEmpty = () => {
11359
+ return /* @__PURE__ */ jsxRuntime.jsx(
11360
+ EmptyState,
11361
+ {
11362
+ iconSlot: /* @__PURE__ */ jsxRuntime.jsx(ToolCoinIcon, {}),
11363
+ titleSlot: "Configure Tools",
11364
+ descriptionSlot: "Mastra tools are not configured yet. You can find more information in the documentation.",
11365
+ actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
11366
+ Button,
11367
+ {
11368
+ size: "lg",
11369
+ className: "w-full",
11370
+ variant: "light",
11371
+ as: "a",
11372
+ href: "https://mastra.ai/en/docs/agents/using-tools-and-mcp",
11373
+ target: "_blank",
11374
+ children: [
11375
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, {}) }),
11376
+ "Docs"
11377
+ ]
11378
+ }
11379
+ )
11380
+ }
11381
+ );
11382
+ };
11383
+ const prepareAgents = (tools, agents) => {
11384
+ const toolsWithAgents = /* @__PURE__ */ new Map();
11385
+ const agentsKeys = Object.keys(agents);
11386
+ for (const k of agentsKeys) {
11387
+ const agent = agents[k];
11388
+ const agentToolsDict = agent.tools;
11389
+ const agentToolsKeys = Object.keys(agentToolsDict);
11390
+ for (const key of agentToolsKeys) {
11391
+ const tool = agentToolsDict[key];
11392
+ if (!toolsWithAgents.has(tool.id)) {
11393
+ toolsWithAgents.set(tool.id, {
11394
+ ...tool,
11395
+ agents: []
11396
+ });
11397
+ }
11398
+ toolsWithAgents.get(tool.id).agents.push({ id: k, name: agent.name });
11399
+ }
11400
+ }
11401
+ for (const [_, tool] of Object.entries(tools)) {
11402
+ if (!toolsWithAgents.has(tool.id)) {
11403
+ toolsWithAgents.set(tool.id, {
11404
+ ...tool,
11405
+ agents: []
11406
+ });
11407
+ }
11408
+ }
11409
+ return Array.from(toolsWithAgents.values());
11410
+ };
11411
+
11025
11412
  function WorkflowTraces({ traces, error, runId, stepName }) {
11026
11413
  return /* @__PURE__ */ jsxRuntime.jsx(TraceProvider, { initialTraces: traces || [], children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowTracesInner, { traces, error, runId, stepName }) });
11027
11414
  }
@@ -12525,6 +12912,115 @@ const WorkflowRuns = ({ workflowId, runId, isLoading, runs, onPressRun }) => {
12525
12912
  ) }, run.runId)) });
12526
12913
  };
12527
12914
 
12915
+ const columns = [
12916
+ {
12917
+ id: "name",
12918
+ header: "Name",
12919
+ cell: ({ row }) => {
12920
+ const { Link } = useLinkComponent();
12921
+ return /* @__PURE__ */ jsxRuntime.jsx(
12922
+ EntryCell,
12923
+ {
12924
+ icon: /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, {}),
12925
+ name: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: row.original.link, children: row.original.name }),
12926
+ description: void 0,
12927
+ meta: void 0
12928
+ }
12929
+ );
12930
+ },
12931
+ meta: {
12932
+ width: "auto"
12933
+ }
12934
+ },
12935
+ {
12936
+ id: "stepsCount",
12937
+ header: "Steps",
12938
+ size: 300,
12939
+ cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end items-center gap-2", children: [
12940
+ /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Footprints, {}), className: "!h-button-md", children: [
12941
+ row.original.stepsCount,
12942
+ " step",
12943
+ row.original.stepsCount > 1 ? "s" : ""
12944
+ ] }),
12945
+ row.original.isLegacy ? /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { className: "!text-foreground/80 !h-button-md", children: "Legacy" }) : null
12946
+ ] }) })
12947
+ }
12948
+ ];
12949
+
12950
+ function WorkflowTable({ workflows, legacyWorkflows, isLoading, onClickRow }) {
12951
+ const workflowData = React.useMemo(() => {
12952
+ const _workflowsData = Object.keys(workflows ?? {}).map((key) => {
12953
+ const workflow = workflows?.[key];
12954
+ return {
12955
+ id: key,
12956
+ name: workflow?.name || "N/A",
12957
+ stepsCount: Object.keys(workflow?.steps ?? {})?.length,
12958
+ isLegacy: false,
12959
+ link: `/workflows/${key}/graph`
12960
+ };
12961
+ });
12962
+ const legacyWorkflowsData = Object.keys(legacyWorkflows ?? {}).map((key) => {
12963
+ const workflow = legacyWorkflows?.[key];
12964
+ return {
12965
+ id: key,
12966
+ name: workflow?.name || "N/A",
12967
+ stepsCount: Object.keys(workflow?.steps ?? {})?.length,
12968
+ isLegacy: true,
12969
+ link: `/workflows/legacy/${key}/graph`
12970
+ };
12971
+ });
12972
+ return [..._workflowsData, ...legacyWorkflowsData];
12973
+ }, [workflows, legacyWorkflows]);
12974
+ const table = reactTable.useReactTable({
12975
+ data: workflowData,
12976
+ columns,
12977
+ getCoreRowModel: reactTable.getCoreRowModel()
12978
+ });
12979
+ if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(WorkflowTableSkeleton, {});
12980
+ const ths = table.getHeaderGroups()[0];
12981
+ const rows = table.getRowModel().rows.concat();
12982
+ if (rows.length === 0) {
12983
+ return /* @__PURE__ */ jsxRuntime.jsx(EmptyWorkflowsTable, {});
12984
+ }
12985
+ return /* @__PURE__ */ jsxRuntime.jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
12986
+ /* @__PURE__ */ jsxRuntime.jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
12987
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => onClickRow(row.original.id), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
12988
+ ] }) });
12989
+ }
12990
+ const WorkflowTableSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
12991
+ /* @__PURE__ */ jsxRuntime.jsxs(Thead, { children: [
12992
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Name" }),
12993
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 300, children: "Steps" })
12994
+ ] }),
12995
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsxs(Row, { children: [
12996
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
12997
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { width: 300, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) })
12998
+ ] }, index)) })
12999
+ ] });
13000
+ const EmptyWorkflowsTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
13001
+ EmptyState,
13002
+ {
13003
+ iconSlot: /* @__PURE__ */ jsxRuntime.jsx(WorkflowCoinIcon, {}),
13004
+ titleSlot: "Configure Workflows",
13005
+ descriptionSlot: "Mastra workflows are not configured yet. You can find more information in the documentation.",
13006
+ actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
13007
+ Button,
13008
+ {
13009
+ size: "lg",
13010
+ className: "w-full",
13011
+ variant: "light",
13012
+ as: "a",
13013
+ href: "https://mastra.ai/en/docs/workflows/overview",
13014
+ target: "_blank",
13015
+ children: [
13016
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, {}) }),
13017
+ "Docs"
13018
+ ]
13019
+ }
13020
+ )
13021
+ }
13022
+ ) });
13023
+
12528
13024
  const DataTable = ({
12529
13025
  columns,
12530
13026
  data,
@@ -12779,41 +13275,6 @@ const DarkLogo = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "100
12779
13275
  )
12780
13276
  ] });
12781
13277
 
12782
- const Entity = ({ children, className, onClick }) => {
12783
- return /* @__PURE__ */ jsxRuntime.jsx(
12784
- "div",
12785
- {
12786
- tabIndex: onClick ? 0 : void 0,
12787
- onKeyDown: (e) => {
12788
- if (!onClick) return;
12789
- if (e.key === "Enter" || e.key === " ") {
12790
- e.preventDefault();
12791
- onClick?.();
12792
- }
12793
- },
12794
- className: clsx(
12795
- "flex gap-3 group/entity bg-surface3 rounded-lg border-sm border-border1 py-3 px-4",
12796
- onClick && "cursor-pointer hover:bg-surface4 transition-all",
12797
- className
12798
- ),
12799
- onClick,
12800
- children
12801
- }
12802
- );
12803
- };
12804
- const EntityIcon = ({ children, className }) => {
12805
- return /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: clsx("text-icon3 mt-1", className), children });
12806
- };
12807
- const EntityName = ({ children, className }) => {
12808
- return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-lg", className: clsx("text-icon6 font-medium", className), children });
12809
- };
12810
- const EntityDescription = ({ children, className }) => {
12811
- return /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: clsx("text-icon3", className), children });
12812
- };
12813
- const EntityContent = ({ children, className }) => {
12814
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
12815
- };
12816
-
12817
13278
  function usePolling({
12818
13279
  fetchFn,
12819
13280
  interval = 3e3,
@@ -12955,6 +13416,7 @@ exports.DocsIcon = DocsIcon;
12955
13416
  exports.DynamicForm = DynamicForm;
12956
13417
  exports.EmptyAgentsTable = EmptyAgentsTable;
12957
13418
  exports.EmptyState = EmptyState;
13419
+ exports.EmptyWorkflowsTable = EmptyWorkflowsTable;
12958
13420
  exports.Entity = Entity;
12959
13421
  exports.EntityContent = EntityContent;
12960
13422
  exports.EntityDescription = EntityDescription;
@@ -12992,12 +13454,17 @@ exports.MemoryIcon = MemoryIcon;
12992
13454
  exports.NetworkChat = NetworkChat;
12993
13455
  exports.NetworkContext = NetworkContext;
12994
13456
  exports.NetworkProvider = NetworkProvider;
13457
+ exports.NetworkTable = NetworkTable;
13458
+ exports.NetworkTableEmpty = NetworkTableEmpty;
13459
+ exports.NetworkTableSkeleton = NetworkTableSkeleton;
12995
13460
  exports.OpenAIIcon = OpenAIIcon;
12996
13461
  exports.PromptIcon = PromptIcon;
12997
13462
  exports.RadioGroup = RadioGroup;
12998
13463
  exports.RadioGroupItem = RadioGroupItem;
12999
13464
  exports.RepoIcon = RepoIcon;
13000
13465
  exports.Row = Row;
13466
+ exports.RuntimeContext = RuntimeContext;
13467
+ exports.RuntimeContextWrapper = RuntimeContextWrapper;
13001
13468
  exports.ScoreIcon = ScoreIcon;
13002
13469
  exports.SettingsIcon = SettingsIcon;
13003
13470
  exports.SlashIcon = SlashIcon;
@@ -13011,6 +13478,9 @@ exports.ThreadLink = ThreadLink;
13011
13478
  exports.ThreadList = ThreadList;
13012
13479
  exports.Threads = Threads;
13013
13480
  exports.ToolCoinIcon = ToolCoinIcon;
13481
+ exports.ToolList = ToolList;
13482
+ exports.ToolListEmpty = ToolListEmpty;
13483
+ exports.ToolListSkeleton = ToolListSkeleton;
13014
13484
  exports.ToolsIcon = ToolsIcon;
13015
13485
  exports.TraceIcon = TraceIcon;
13016
13486
  exports.TsIcon = TsIcon;
@@ -13025,6 +13495,8 @@ exports.WorkflowIcon = WorkflowIcon;
13025
13495
  exports.WorkflowRunContext = WorkflowRunContext;
13026
13496
  exports.WorkflowRunProvider = WorkflowRunProvider;
13027
13497
  exports.WorkflowRuns = WorkflowRuns;
13498
+ exports.WorkflowTable = WorkflowTable;
13499
+ exports.WorkflowTableSkeleton = WorkflowTableSkeleton;
13028
13500
  exports.WorkflowTraces = WorkflowTraces;
13029
13501
  exports.WorkflowTrigger = WorkflowTrigger;
13030
13502
  exports.WorkingMemoryContext = WorkingMemoryContext;