@mastra/playground-ui 6.2.1 → 6.2.2-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,47 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 6.2.2-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - dependencies updates: ([#8034](https://github.com/mastra-ai/mastra/pull/8034))
8
+ - Updated dependency [`zod@^4.1.9` ↗︎](https://www.npmjs.com/package/zod/v/4.1.9) (from `^4.1.8`, in `dependencies`)
9
+
10
+ - dependencies updates: ([#8050](https://github.com/mastra-ai/mastra/pull/8050))
11
+ - Updated dependency [`@xyflow/react@^12.8.5` ↗︎](https://www.npmjs.com/package/@xyflow/react/v/12.8.5) (from `^12.8.4`, in `dependencies`)
12
+
13
+ - Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
14
+
15
+ - Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55)]:
16
+ - @mastra/core@0.18.0-alpha.2
17
+ - @mastra/client-js@0.13.2-alpha.2
18
+
19
+ ## 6.2.2-alpha.1
20
+
21
+ ### Patch Changes
22
+
23
+ - dependencies updates: ([#8019](https://github.com/mastra-ai/mastra/pull/8019))
24
+ - Updated dependency [`motion@^12.23.13` ↗︎](https://www.npmjs.com/package/motion/v/12.23.13) (from `^12.23.12`, in `dependencies`)
25
+
26
+ - show the tool-output stream in the playground for streamVNext ([#7983](https://github.com/mastra-ai/mastra/pull/7983))
27
+
28
+ - Updated dependencies [[`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb)]:
29
+ - @mastra/core@0.17.2-alpha.1
30
+ - @mastra/client-js@0.13.2-alpha.1
31
+
32
+ ## 6.2.2-alpha.0
33
+
34
+ ### Patch Changes
35
+
36
+ - dependencies updates: ([#7980](https://github.com/mastra-ai/mastra/pull/7980))
37
+ - Updated dependency [`zod@^4.1.8` ↗︎](https://www.npmjs.com/package/zod/v/4.1.8) (from `^4.1.5`, in `dependencies`)
38
+
39
+ - Get rid off swr one for all ([#7931](https://github.com/mastra-ai/mastra/pull/7931))
40
+
41
+ - Updated dependencies [[`a61f23f`](https://github.com/mastra-ai/mastra/commit/a61f23fbbca4b88b763d94f1d784c47895ed72d7), [`d1dc606`](https://github.com/mastra-ai/mastra/commit/d1dc6067b0557a71190b68d56ee15b48c26d2411), [`d3bd4d4`](https://github.com/mastra-ai/mastra/commit/d3bd4d482a685bbb67bfa89be91c90dca3fa71ad)]:
42
+ - @mastra/client-js@0.13.2-alpha.0
43
+ - @mastra/core@0.17.2-alpha.0
44
+
3
45
  ## 6.2.1
4
46
 
5
47
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -4321,7 +4321,10 @@ const useCodemirrorTheme$2 = () => {
4321
4321
  []
4322
4322
  );
4323
4323
  };
4324
- const SyntaxHighlighter$2 = ({ data, className }) => {
4324
+ const SyntaxHighlighter$2 = ({
4325
+ data,
4326
+ className
4327
+ }) => {
4325
4328
  const formattedCode = JSON.stringify(data, null, 2);
4326
4329
  const theme = useCodemirrorTheme$2();
4327
4330
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("rounded-md bg-surface4 p-1 font-mono relative", className), children: [
@@ -4494,7 +4497,7 @@ const NetworkChoiceMetadataDialogTrigger = ({
4494
4497
  ] });
4495
4498
  };
4496
4499
 
4497
- const ToolBadge = ({ toolName, args, result, networkMetadata }) => {
4500
+ const ToolBadge = ({ toolName, args, result, networkMetadata, toolOutput }) => {
4498
4501
  let argSlot = null;
4499
4502
  try {
4500
4503
  const { __mastraMetadata: _, ...formattedArgs } = typeof args === "object" ? args : JSON.parse(args);
@@ -4502,7 +4505,7 @@ const ToolBadge = ({ toolName, args, result, networkMetadata }) => {
4502
4505
  } catch {
4503
4506
  argSlot = /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap", children: args });
4504
4507
  }
4505
- let resultSlot = typeof result === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap", children: result }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: result });
4508
+ let resultSlot = typeof result === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap bg-surface4 p-4 rounded-md", children: result }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: result });
4506
4509
  return /* @__PURE__ */ jsxRuntime.jsx(
4507
4510
  BadgeWrapper,
4508
4511
  {
@@ -4520,9 +4523,13 @@ const ToolBadge = ({ toolName, args, result, networkMetadata }) => {
4520
4523
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool arguments" }),
4521
4524
  argSlot
4522
4525
  ] }),
4523
- result !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4526
+ resultSlot !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4524
4527
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool result" }),
4525
4528
  resultSlot
4529
+ ] }),
4530
+ toolOutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4531
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool output" }),
4532
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-40 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: toolOutput }) })
4526
4533
  ] })
4527
4534
  ] })
4528
4535
  }
@@ -8495,10 +8502,24 @@ const ScrollableContainer = ({
8495
8502
  const LinkComponentContext = React.createContext({
8496
8503
  Link: React.forwardRef(() => null),
8497
8504
  navigate: () => {
8505
+ },
8506
+ paths: {
8507
+ agentLink: () => "",
8508
+ agentsLink: () => "",
8509
+ agentToolLink: () => "",
8510
+ agentThreadLink: () => "",
8511
+ agentNewThreadLink: () => "",
8512
+ workflowsLink: () => "",
8513
+ workflowLink: () => "",
8514
+ networkLink: () => "",
8515
+ networkNewThreadLink: () => "",
8516
+ networkThreadLink: () => "",
8517
+ scorerLink: () => "",
8518
+ toolLink: () => ""
8498
8519
  }
8499
8520
  });
8500
- const LinkComponentProvider = ({ children, Link, navigate }) => {
8501
- return /* @__PURE__ */ jsxRuntime.jsx(LinkComponentContext.Provider, { value: { Link, navigate }, children });
8521
+ const LinkComponentProvider = ({ children, Link, navigate, paths }) => {
8522
+ return /* @__PURE__ */ jsxRuntime.jsx(LinkComponentContext.Provider, { value: { Link, navigate, paths }, children });
8502
8523
  };
8503
8524
  const useLinkComponent = () => {
8504
8525
  const ctx = React.useContext(LinkComponentContext);
@@ -8543,8 +8564,8 @@ const columns$3 = [
8543
8564
  }
8544
8565
  ];
8545
8566
 
8546
- function WorkflowTable({ workflows, legacyWorkflows, isLoading, computeLink }) {
8547
- const { navigate } = useLinkComponent();
8567
+ function WorkflowTable({ workflows, legacyWorkflows, isLoading }) {
8568
+ const { navigate, paths } = useLinkComponent();
8548
8569
  const workflowData = React.useMemo(() => {
8549
8570
  const _workflowsData = Object.keys(workflows ?? {}).map((key) => {
8550
8571
  const workflow = workflows?.[key];
@@ -8553,7 +8574,7 @@ function WorkflowTable({ workflows, legacyWorkflows, isLoading, computeLink }) {
8553
8574
  name: workflow?.name || "N/A",
8554
8575
  stepsCount: Object.keys(workflow?.steps ?? {})?.length,
8555
8576
  isLegacy: false,
8556
- link: computeLink(key)
8577
+ link: paths.workflowLink(key)
8557
8578
  };
8558
8579
  });
8559
8580
  const legacyWorkflowsData = Object.keys(legacyWorkflows ?? {}).map((key) => {
@@ -8563,7 +8584,7 @@ function WorkflowTable({ workflows, legacyWorkflows, isLoading, computeLink }) {
8563
8584
  name: workflow?.name || "N/A",
8564
8585
  stepsCount: Object.keys(workflow?.steps ?? {})?.length,
8565
8586
  isLegacy: true,
8566
- link: computeLink(key)
8587
+ link: paths.workflowLink(key)
8567
8588
  };
8568
8589
  });
8569
8590
  return [..._workflowsData, ...legacyWorkflowsData];
@@ -8748,6 +8769,7 @@ const ToolFallbackInner = ({ toolName, result, args }) => {
8748
8769
  toolName,
8749
8770
  args,
8750
8771
  result,
8772
+ toolOutput: args?.__mastraMetadata?.toolOutput || [],
8751
8773
  networkMetadata: args?.__mastraMetadata?.networkMetadata
8752
8774
  }
8753
8775
  );
@@ -9896,6 +9918,34 @@ const handleStreamChunk = async ({
9896
9918
  case "tool-output": {
9897
9919
  if (chunk.payload.output?.type.startsWith("workflow-")) {
9898
9920
  handleWorkflowChunk({ workflowChunk: chunk.payload.output, setMessages, entityName: chunk.payload.toolName });
9921
+ } else {
9922
+ setMessages((currentConversation) => {
9923
+ const lastMessage = currentConversation[currentConversation.length - 1];
9924
+ if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
9925
+ const updatedContent = lastMessage.content.map((part) => {
9926
+ if (typeof part === "object" && part.type === "tool-call" && part.toolCallId === chunk.payload.toolCallId) {
9927
+ const existingToolOutput = part.args?.__mastraMetadata?.toolOutput || [];
9928
+ return {
9929
+ ...part,
9930
+ args: {
9931
+ ...part.args,
9932
+ __mastraMetadata: {
9933
+ ...part.args?.__mastraMetadata,
9934
+ toolOutput: [...existingToolOutput, chunk?.payload?.output]
9935
+ }
9936
+ }
9937
+ };
9938
+ }
9939
+ return part;
9940
+ });
9941
+ const updatedMessage = {
9942
+ ...lastMessage,
9943
+ content: updatedContent
9944
+ };
9945
+ return [...currentConversation.slice(0, -1), updatedMessage];
9946
+ }
9947
+ return currentConversation;
9948
+ });
9899
9949
  }
9900
9950
  break;
9901
9951
  }
@@ -12275,8 +12325,8 @@ const columns$2 = [
12275
12325
  }
12276
12326
  ];
12277
12327
 
12278
- function AgentsTable({ agents, isLoading, computeLink }) {
12279
- const { navigate } = useLinkComponent();
12328
+ function AgentsTable({ agents, isLoading }) {
12329
+ const { navigate, paths } = useLinkComponent();
12280
12330
  const projectData = React.useMemo(
12281
12331
  () => Object.keys(agents).map((key) => {
12282
12332
  const agent = agents[key];
@@ -12290,7 +12340,7 @@ function AgentsTable({ agents, isLoading, computeLink }) {
12290
12340
  repoUrl: void 0,
12291
12341
  tools: agent.tools,
12292
12342
  modelId: agent.modelId,
12293
- link: computeLink(key)
12343
+ link: paths.agentLink(key)
12294
12344
  };
12295
12345
  }),
12296
12346
  [agents]
@@ -14028,8 +14078,8 @@ const columns$1 = [
14028
14078
  }
14029
14079
  ];
14030
14080
 
14031
- function ScorersTable({ scorers, isLoading, computeScorerLink }) {
14032
- const { navigate } = useLinkComponent();
14081
+ function ScorersTable({ scorers, isLoading }) {
14082
+ const { navigate, paths } = useLinkComponent();
14033
14083
  const scorersData = React.useMemo(
14034
14084
  () => Object.keys(scorers).map((key) => {
14035
14085
  const scorer = scorers[key];
@@ -14054,7 +14104,7 @@ function ScorersTable({ scorers, isLoading, computeScorerLink }) {
14054
14104
  }
14055
14105
  return /* @__PURE__ */ jsxRuntime.jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(Table$1, { children: [
14056
14106
  /* @__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)) }),
14057
- /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => navigate(computeScorerLink(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)) })
14107
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => navigate(paths.scorerLink(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)) })
14058
14108
  ] }) });
14059
14109
  }
14060
14110
  const ScorersTableSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs(Table$1, { children: [
@@ -14339,21 +14389,18 @@ const AgentMetadataModelSwitcher = ({
14339
14389
  ] }) });
14340
14390
  };
14341
14391
 
14342
- const AgentMetadataNetworkList = ({ agents, computeAgentLink }) => {
14343
- const { Link } = useLinkComponent();
14392
+ const AgentMetadataNetworkList = ({ agents }) => {
14393
+ const { Link, paths } = useLinkComponent();
14344
14394
  if (agents.length === 0) {
14345
- return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListEmpty, { children: "No tools" });
14395
+ return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListEmpty, { children: "No agents" });
14346
14396
  }
14347
- return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: agents.map((agent) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: computeAgentLink(agent), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "success", icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}), children: agent.name }) }) }, agent.id)) });
14397
+ return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: agents.map((agent) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: paths.agentLink(agent.id), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "success", icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}), children: agent.name }) }) }, agent.id)) });
14348
14398
  };
14349
14399
  const AgentMetadata = ({
14400
+ agentId,
14350
14401
  agent,
14351
14402
  promptSlot,
14352
14403
  hasMemoryEnabled,
14353
- computeAgentLink,
14354
- computeToolLink,
14355
- computeWorkflowLink,
14356
- computeScorerLink,
14357
14404
  updateModel,
14358
14405
  modelProviders
14359
14406
  }) => {
@@ -14407,7 +14454,7 @@ const AgentMetadata = ({
14407
14454
  link: "https://mastra.ai/en/docs/agents/overview",
14408
14455
  title: "Agents documentation"
14409
14456
  },
14410
- children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataNetworkList, { agents: networkAgents, computeAgentLink })
14457
+ children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataNetworkList, { agents: networkAgents })
14411
14458
  }
14412
14459
  ),
14413
14460
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -14418,7 +14465,7 @@ const AgentMetadata = ({
14418
14465
  link: "https://mastra.ai/en/docs/agents/using-tools-and-mcp",
14419
14466
  title: "Using Tools and MCP documentation"
14420
14467
  },
14421
- children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataToolList, { tools, computeToolLink })
14468
+ children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataToolList, { tools, agentId })
14422
14469
  }
14423
14470
  ),
14424
14471
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -14429,29 +14476,29 @@ const AgentMetadata = ({
14429
14476
  link: "https://mastra.ai/en/docs/workflows/overview",
14430
14477
  title: "Workflows documentation"
14431
14478
  },
14432
- children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataWorkflowList, { workflows, computeWorkflowLink })
14479
+ children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataWorkflowList, { workflows })
14433
14480
  }
14434
14481
  ),
14435
- /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "Scorers", children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataScorerList, { entityId: agent.name, entityType: "AGENT", computeScorerLink }) }),
14482
+ /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "Scorers", children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataScorerList, { entityId: agent.name, entityType: "AGENT" }) }),
14436
14483
  /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "System Prompt", children: promptSlot })
14437
14484
  ] });
14438
14485
  };
14439
- const AgentMetadataToolList = ({ tools, computeToolLink }) => {
14440
- const { Link } = useLinkComponent();
14486
+ const AgentMetadataToolList = ({ tools, agentId }) => {
14487
+ const { Link, paths } = useLinkComponent();
14441
14488
  if (tools.length === 0) {
14442
14489
  return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListEmpty, { children: "No tools" });
14443
14490
  }
14444
- return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: tools.map((tool) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: computeToolLink(tool), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, { className: "text-[#ECB047]" }), children: tool.id }) }) }, tool.id)) });
14491
+ return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: tools.map((tool) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: paths.agentToolLink(agentId, tool.id), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, { className: "text-[#ECB047]" }), children: tool.id }) }) }, tool.id)) });
14445
14492
  };
14446
- const AgentMetadataWorkflowList = ({ workflows, computeWorkflowLink }) => {
14447
- const { Link } = useLinkComponent();
14493
+ const AgentMetadataWorkflowList = ({ workflows }) => {
14494
+ const { Link, paths } = useLinkComponent();
14448
14495
  if (workflows.length === 0) {
14449
14496
  return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListEmpty, { children: "No workflows" });
14450
14497
  }
14451
- return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: workflows.map((workflow) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: computeWorkflowLink(workflow.id, workflow), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, { className: "text-accent3" }), children: workflow.name }) }) }, workflow.id)) });
14498
+ return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: workflows.map((workflow) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: paths.workflowLink(workflow.id), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, { className: "text-accent3" }), children: workflow.name }) }) }, workflow.id)) });
14452
14499
  };
14453
- const AgentMetadataScorerList = ({ entityId, entityType, computeScorerLink }) => {
14454
- const { Link } = useLinkComponent();
14500
+ const AgentMetadataScorerList = ({ entityId, entityType }) => {
14501
+ const { Link, paths } = useLinkComponent();
14455
14502
  const { scorers, isLoading } = useScorers();
14456
14503
  const scorerList = Object.keys(scorers).filter((scorerKey) => {
14457
14504
  const scorer = scorers[scorerKey];
@@ -14466,7 +14513,7 @@ const AgentMetadataScorerList = ({ entityId, entityType, computeScorerLink }) =>
14466
14513
  if (scorerList.length === 0) {
14467
14514
  return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListEmpty, { children: "No Scorers" });
14468
14515
  }
14469
- return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: scorerList.map((scorer) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: computeScorerLink(scorer.id), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GaugeIcon, { className: "text-icon3" }), children: scorer.scorer.config.name }) }) }, scorer.id)) });
14516
+ return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: scorerList.map((scorer) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: paths.scorerLink(scorer.id), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GaugeIcon, { className: "text-icon3" }), children: scorer.scorer.config.name }) }) }, scorer.id)) });
14470
14517
  };
14471
14518
 
14472
14519
  const AgentMetadataPrompt = ({ prompt }) => {
@@ -14599,31 +14646,26 @@ AlertDialog.Description = AlertDialogDescription;
14599
14646
  AlertDialog.Action = AlertDialogAction;
14600
14647
  AlertDialog.Cancel = AlertDialogCancel;
14601
14648
 
14602
- const ChatThreads = ({
14603
- computeNewThreadLink,
14604
- computeThreadLink,
14605
- threads,
14606
- isLoading,
14607
- threadId,
14608
- onDelete
14609
- }) => {
14610
- const { Link } = useLinkComponent();
14649
+ const ChatThreads = ({ threads, isLoading, threadId, onDelete, resourceId, resourceType }) => {
14650
+ const { Link, paths } = useLinkComponent();
14611
14651
  const [deleteId, setDeleteId] = React.useState(null);
14612
14652
  if (isLoading) {
14613
14653
  return /* @__PURE__ */ jsxRuntime.jsx(ChatThreadSkeleton, {});
14614
14654
  }
14615
14655
  const reverseThreads = [...threads].reverse();
14656
+ const newThreadLink = resourceType === "agent" ? paths.agentNewThreadLink(resourceId) : paths.networkNewThreadLink(resourceId);
14616
14657
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-y-auto h-full w-full", children: [
14617
14658
  /* @__PURE__ */ jsxRuntime.jsx(Threads, { children: /* @__PURE__ */ jsxRuntime.jsxs(ThreadList, { children: [
14618
- /* @__PURE__ */ jsxRuntime.jsx(ThreadItem, { children: /* @__PURE__ */ jsxRuntime.jsx(ThreadLink, { as: Link, to: computeNewThreadLink(), children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-accent1 flex items-center gap-4", children: [
14659
+ /* @__PURE__ */ jsxRuntime.jsx(ThreadItem, { children: /* @__PURE__ */ jsxRuntime.jsx(ThreadLink, { as: Link, to: newThreadLink, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-accent1 flex items-center gap-4", children: [
14619
14660
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "bg-surface4 rounded-lg", size: "lg", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {}) }),
14620
14661
  "New Chat"
14621
14662
  ] }) }) }),
14622
14663
  reverseThreads.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon3 py-3 px-5 max-w-[12rem]", children: "Your conversations will appear here once you start chatting!" }),
14623
14664
  reverseThreads.map((thread) => {
14624
14665
  const isActive = thread.id === threadId;
14666
+ const threadLink = resourceType === "agent" ? paths.agentThreadLink(resourceId, thread.id) : paths.networkThreadLink(resourceId, thread.id);
14625
14667
  return /* @__PURE__ */ jsxRuntime.jsxs(ThreadItem, { isActive, children: [
14626
- /* @__PURE__ */ jsxRuntime.jsxs(ThreadLink, { as: Link, to: computeThreadLink(thread.id), children: [
14668
+ /* @__PURE__ */ jsxRuntime.jsxs(ThreadLink, { as: Link, to: threadLink, children: [
14627
14669
  /* @__PURE__ */ jsxRuntime.jsx(ThreadTitle, { title: thread.title }),
14628
14670
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatDay(thread.createdAt) })
14629
14671
  ] }),
@@ -15673,8 +15715,8 @@ const columns = [
15673
15715
  }
15674
15716
  ];
15675
15717
 
15676
- const NetworkTable = ({ networks, isLoading, computeLink }) => {
15677
- const { navigate } = useLinkComponent();
15718
+ const NetworkTable = ({ networks, isLoading }) => {
15719
+ const { navigate, paths } = useLinkComponent();
15678
15720
  const allNetworks = React.useMemo(
15679
15721
  () => [
15680
15722
  ...networks?.map((network) => ({
@@ -15700,7 +15742,7 @@ const NetworkTable = ({ networks, isLoading, computeLink }) => {
15700
15742
  }
15701
15743
  return /* @__PURE__ */ jsxRuntime.jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(Table$1, { children: [
15702
15744
  /* @__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)) }),
15703
- /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => navigate(computeLink(row.original.id)), className: "cursor-pointer", children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
15745
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { onClick: () => navigate(paths.networkLink(row.original.id)), className: "cursor-pointer", children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
15704
15746
  ] }) });
15705
15747
  };
15706
15748
  const NetworkTableEmpty = () => {
@@ -15841,17 +15883,13 @@ const EntityContent = ({ children, className }) => {
15841
15883
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
15842
15884
  };
15843
15885
 
15844
- const ToolList = ({ tools, agents, isLoading, computeLink, computeAgentLink }) => {
15886
+ const ToolList = ({ tools, agents, isLoading }) => {
15845
15887
  const toolsWithAgents = React.useMemo(() => prepareAgents(tools, agents), [tools, agents]);
15846
15888
  if (isLoading)
15847
15889
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-5xl w-full mx-auto px-4 pt-8", children: /* @__PURE__ */ jsxRuntime.jsx(ToolListSkeleton, {}) });
15848
- return /* @__PURE__ */ jsxRuntime.jsx(ToolListInner, { toolsWithAgents, computeLink, computeAgentLink });
15890
+ return /* @__PURE__ */ jsxRuntime.jsx(ToolListInner, { toolsWithAgents });
15849
15891
  };
15850
- const ToolListInner = ({
15851
- toolsWithAgents,
15852
- computeLink,
15853
- computeAgentLink
15854
- }) => {
15892
+ const ToolListInner = ({ toolsWithAgents }) => {
15855
15893
  const [filteredTools, setFilteredTools] = React.useState(toolsWithAgents);
15856
15894
  const [value, setValue] = React.useState("");
15857
15895
  if (filteredTools.length === 0 && !value) return /* @__PURE__ */ jsxRuntime.jsx(ToolListEmpty, {});
@@ -15872,22 +15910,22 @@ const ToolListInner = ({
15872
15910
  /* @__PURE__ */ jsxRuntime.jsx(Searchbar, { onSearch: handleSearch, label: "Search for a tool", placeholder: "Search for a tool" }),
15873
15911
  filteredTools.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "p", className: "text-icon3 py-2", children: "No tools found matching your search." })
15874
15912
  ] }),
15875
- /* @__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, computeLink, computeAgentLink }, tool.id)) })
15913
+ /* @__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)) })
15876
15914
  ] });
15877
15915
  };
15878
- const ToolEntity = ({ tool, computeLink, computeAgentLink }) => {
15916
+ const ToolEntity = ({ tool }) => {
15879
15917
  const linkRef = React.useRef(null);
15880
- const { Link } = useLinkComponent();
15918
+ const { Link, paths } = useLinkComponent();
15881
15919
  return /* @__PURE__ */ jsxRuntime.jsxs(Entity, { onClick: () => linkRef.current?.click(), children: [
15882
15920
  /* @__PURE__ */ jsxRuntime.jsx(EntityIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, { className: "group-hover/entity:text-[#ECB047]" }) }),
15883
15921
  /* @__PURE__ */ jsxRuntime.jsxs(EntityContent, { children: [
15884
- /* @__PURE__ */ jsxRuntime.jsx(EntityName, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { ref: linkRef, href: computeLink(tool.id, tool.agents[0]?.id), children: tool.id }) }),
15922
+ /* @__PURE__ */ jsxRuntime.jsx(EntityName, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { ref: linkRef, href: paths.toolLink(tool.id), children: tool.id }) }),
15885
15923
  /* @__PURE__ */ jsxRuntime.jsx(EntityDescription, { children: tool.description }),
15886
15924
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex flex-wrap gap-2 pt-4", children: tool.agents.map((agent) => {
15887
15925
  return /* @__PURE__ */ jsxRuntime.jsx(
15888
15926
  Link,
15889
15927
  {
15890
- href: computeAgentLink(tool.id, agent.id),
15928
+ href: paths.agentToolLink(agent.id, tool.id),
15891
15929
  onClick: (e) => e.stopPropagation(),
15892
15930
  className: "group/link",
15893
15931
  children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, { className: "group-hover/link:text-accent3" }), className: "bg-surface5 ", children: agent.name })
@@ -17869,14 +17907,15 @@ function TraceSpanUsage({ traceUsage, traceSpans = [], spanUsage, className }) {
17869
17907
  );
17870
17908
  }
17871
17909
 
17872
- function getTraceInfo(trace, computeAgentsLink, computeWorkflowsLink) {
17910
+ function useTraceInfo(trace) {
17911
+ const { paths } = useLinkComponent();
17873
17912
  if (!trace) {
17874
17913
  return [];
17875
17914
  }
17876
- const agentsLink = computeAgentsLink ? computeAgentsLink() : "/agents";
17877
- const workflowsLink = computeWorkflowsLink ? computeWorkflowsLink() : "/workflows";
17878
- const agentLink = computeAgentsLink ? `${agentsLink}/${trace?.metadata?.resourceId}` : `/agents/${trace?.metadata?.resourceId}`;
17879
- const workflowLink = computeWorkflowsLink ? `${workflowsLink}/${trace?.metadata?.resourceId}` : `/workflows/${trace?.metadata?.resourceId}`;
17915
+ const agentsLink = paths.agentsLink();
17916
+ const workflowsLink = paths.workflowsLink();
17917
+ const agentLink = paths.agentLink(trace?.metadata?.resourceId);
17918
+ const workflowLink = paths.workflowLink(trace?.metadata?.resourceId);
17880
17919
  return [
17881
17920
  {
17882
17921
  key: "entityId",
@@ -18025,15 +18064,14 @@ function TraceDialog({
18025
18064
  onClose,
18026
18065
  onNext,
18027
18066
  onPrevious,
18028
- isLoadingSpans,
18029
- computeAgentsLink,
18030
- computeWorkflowsLink
18067
+ isLoadingSpans
18031
18068
  }) {
18032
18069
  const { Link } = useLinkComponent();
18033
18070
  const [dialogIsOpen, setDialogIsOpen] = React.useState(false);
18034
18071
  const [selectedSpanId, setSelectedSpanId] = React.useState(void 0);
18035
18072
  const [combinedView, setCombinedView] = React.useState(false);
18036
18073
  const selectedSpan = traceSpans.find((span) => span.spanId === selectedSpanId);
18074
+ const traceInfo = useTraceInfo(traceDetails);
18037
18075
  const hierarchicalSpans = React.useMemo(() => {
18038
18076
  return formatHierarchicalSpans(traceSpans);
18039
18077
  }, [traceSpans]);
@@ -18077,7 +18115,6 @@ function TraceDialog({
18077
18115
  const currentIndex = flatSpans.findIndex((span) => span.id === selectedSpanId);
18078
18116
  return currentIndex > 0;
18079
18117
  };
18080
- const traceInfo = getTraceInfo(traceDetails, computeAgentsLink, computeWorkflowsLink);
18081
18118
  const selectedSpanInfo = getSpanInfo({ span: selectedSpan, withTraceId: !combinedView, withSpanId: combinedView });
18082
18119
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18083
18120
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -18300,7 +18337,7 @@ function MainContentContent({
18300
18337
  "items-start content-start": !isCentered && !isDivided && !hasLeftServiceColumn,
18301
18338
  "grid place-items-center": isCentered,
18302
18339
  "grid-cols-[1fr_1fr]": isDivided && !hasLeftServiceColumn,
18303
- "grid-cols-[auto_1fr_1fr]": isDivided && hasLeftServiceColumn,
18340
+ "grid-cols-[12rem_1fr_1fr]": isDivided && hasLeftServiceColumn,
18304
18341
  "grid-cols-[auto_1fr]": !isDivided && hasLeftServiceColumn
18305
18342
  },
18306
18343
  className