@mastra/playground-ui 6.3.1-alpha.0 → 6.3.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/{colors-DLwJ7rFA.cjs → colors-B_l6leHd.cjs} +2 -2
  3. package/dist/{colors-DLwJ7rFA.cjs.map → colors-B_l6leHd.cjs.map} +1 -1
  4. package/dist/{colors-DrbbnW3f.js → colors-Br49332d.js} +2 -2
  5. package/dist/{colors-DrbbnW3f.js.map → colors-Br49332d.js.map} +1 -1
  6. package/dist/index.cjs.js +583 -528
  7. package/dist/index.cjs.js.map +1 -1
  8. package/dist/index.es.js +579 -519
  9. package/dist/index.es.js.map +1 -1
  10. package/dist/src/components/assistant-ui/tools/badges/workflow-badge.d.ts +3 -2
  11. package/dist/src/components/threads.d.ts +2 -1
  12. package/dist/src/components/ui/searchbar.d.ts +3 -0
  13. package/dist/src/domains/agents/components/agent-table/agent-table.d.ts +0 -2
  14. package/dist/src/domains/agents/components/agent-table/columns.d.ts +1 -4
  15. package/dist/src/domains/agents/components/agent-table/types.d.ts +2 -11
  16. package/dist/src/domains/mcps/components/mcp-table/columns.d.ts +3 -0
  17. package/dist/src/domains/mcps/components/mcp-table/mcp-table.d.ts +6 -0
  18. package/dist/src/domains/mcps/components/mcp-table/types.d.ts +2 -0
  19. package/dist/src/domains/mcps/hooks/useMCPServerTools.d.ts +3 -0
  20. package/dist/src/domains/mcps/index.d.ts +2 -0
  21. package/dist/src/domains/scores/components/scorers-table/scorers-table.d.ts +0 -2
  22. package/dist/src/domains/scores/components/scorers-table/types.d.ts +2 -3
  23. package/dist/src/domains/tools/components/tool-table/columns.d.ts +3 -0
  24. package/dist/src/domains/tools/components/tool-table/tool-table.d.ts +7 -0
  25. package/dist/src/domains/tools/components/tool-table/types.d.ts +2 -0
  26. package/dist/src/domains/tools/index.d.ts +1 -1
  27. package/dist/src/domains/tools/utils/prepareToolsTable.d.ts +7 -0
  28. package/dist/src/domains/workflows/components/workflow-table/types.d.ts +2 -4
  29. package/dist/src/domains/workflows/components/workflow-table/workflow-table.d.ts +1 -3
  30. package/dist/src/domains/workflows/context/workflow-run-context.d.ts +6 -4
  31. package/dist/src/domains/workflows/index.d.ts +1 -1
  32. package/dist/src/domains/workflows/runs/workflow-run-details.d.ts +12 -0
  33. package/dist/src/domains/workflows/runs/workflow-run-list.d.ts +5 -0
  34. package/dist/src/domains/workflows/utils.d.ts +2 -4
  35. package/dist/src/domains/workflows/workflow/workflow-trigger.d.ts +3 -2
  36. package/dist/src/ds/components/Table/Cells.d.ts +1 -1
  37. package/dist/src/index.d.ts +2 -0
  38. package/dist/src/lib/framework.d.ts +2 -0
  39. package/dist/tokens.cjs.js +1 -1
  40. package/dist/tokens.es.js +1 -1
  41. package/package.json +7 -7
  42. package/dist/src/domains/tools/components/tool-list.d.ts +0 -9
  43. package/dist/src/domains/workflows/runs/workflow-runs.d.ts +0 -11
package/dist/index.es.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useMessagePart, useMessage, MessagePrimitive, ActionBarPrimitive, useAttachment, AttachmentPrimitive, useComposerRuntime, ComposerPrimitive, useComposer, ThreadPrimitive, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechSynthesisAdapter, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
3
- import { CheckIcon as CheckIcon$1, CopyIcon, AlertCircle, Check, Copy, ChevronUpIcon, X, Share2, Braces, Loader2, Network, ChevronDown, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleCheck, CircleX, Minus, Plus, Maximize, Workflow, AlertCircleIcon, ChevronDownIcon, CirclePause, CalendarIcon, Brackets, PlusIcon, TrashIcon, Circle, StopCircle, ChevronLeftIcon, BrainIcon, AudioLinesIcon, StopCircleIcon, FileText, CircleXIcon, Link, CloudUpload, Mic, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, SaveIcon, RefreshCw, ExternalLink, InfoIcon as InfoIcon$1, TriangleAlertIcon, ChevronRightIcon, ArrowLeftIcon, ArrowRightIcon, XIcon, ChevronsRightIcon, ArrowUpIcon, ArrowDownIcon, AlignLeftIcon, AlignJustifyIcon, CircleAlertIcon, GaugeIcon, HashIcon, TriangleAlert, Info, GripVertical, AlertTriangleIcon, SearchIcon, NetworkIcon, WorkflowIcon as WorkflowIcon$1, PackageIcon, GitBranchIcon, PackageOpenIcon, OctagonXIcon, FrownIcon, ChevronUp, ChevronsLeftRight, TimerIcon, ChevronsLeftRightIcon, ChevronFirstIcon, ChevronLastIcon, ListTreeIcon, ArrowRightToLineIcon, CoinsIcon, EyeIcon, ChevronsLeftRightEllipsisIcon, PanelTopIcon, PanelLeftIcon } from 'lucide-react';
3
+ import { CheckIcon as CheckIcon$1, CopyIcon, AlertCircle, Check, Copy, ChevronUpIcon, X, Share2, Braces, Loader2, Network, ChevronDown, PauseIcon, HourglassIcon, CircleDashed, Footprints, CircleCheck, CircleX, Minus, Plus, Maximize, Workflow, AlertCircleIcon, ChevronDownIcon, CirclePause, CalendarIcon, Brackets, PlusIcon, TrashIcon, Circle, StopCircle, SearchIcon, BrainIcon, TriangleAlert, AudioLinesIcon, StopCircleIcon, FileText, CircleXIcon, Link, CloudUpload, Mic, ArrowUp, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, SaveIcon, RefreshCw, ExternalLink, InfoIcon as InfoIcon$1, TriangleAlertIcon, ChevronRightIcon, ArrowLeftIcon, ArrowRightIcon, XIcon, ChevronsRightIcon, ArrowUpIcon, ArrowDownIcon, AlignLeftIcon, AlignJustifyIcon, CircleAlertIcon, GaugeIcon, HashIcon, Info, GripVertical, AlertTriangleIcon, NetworkIcon, WorkflowIcon as WorkflowIcon$1, PackageIcon, GitBranchIcon, PackageOpenIcon, OctagonXIcon, FrownIcon, ChevronUp, ChevronsLeftRight, TimerIcon, ChevronsLeftRightIcon, ChevronFirstIcon, ChevronLastIcon, ListTreeIcon, ArrowRightToLineIcon, CoinsIcon, EyeIcon, ChevronsLeftRightEllipsisIcon, PanelTopIcon, PanelLeftIcon, CircleSlash, Clock as Clock$1 } from 'lucide-react';
4
4
  import * as React from 'react';
5
- import React__default, { forwardRef, memo, useState, useEffect, useRef, useCallback, useMemo, createContext, useContext, Fragment as Fragment$1, isValidElement, useId, startTransition } from 'react';
5
+ import React__default, { forwardRef, memo, useState, useEffect, useRef, useCallback, useMemo, createContext, useContext, Fragment as Fragment$1, useId, isValidElement } from 'react';
6
6
  import { Slot } from '@radix-ui/react-slot';
7
7
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
8
8
  import { TooltipProvider as TooltipProvider$1 } from '@radix-ui/react-tooltip';
@@ -24,7 +24,7 @@ import Dagre from '@dagrejs/dagre';
24
24
  import { Highlight, themes } from 'prism-react-renderer';
25
25
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
26
26
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
27
- import { I as IconColors } from './colors-DrbbnW3f.js';
27
+ import { I as IconColors } from './colors-Br49332d.js';
28
28
  import prettier from 'prettier';
29
29
  import prettierPluginBabel from 'prettier/plugins/babel';
30
30
  import prettierPluginEstree from 'prettier/plugins/estree';
@@ -37,7 +37,7 @@ import { create } from 'zustand';
37
37
  import { persist } from 'zustand/middleware';
38
38
  import { AutoForm as AutoForm$1, buildZodFieldConfig } from '@autoform/react';
39
39
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
40
- import { format, isValid, formatDate, formatDistanceToNow } from 'date-fns';
40
+ import { format, isValid, formatDistanceToNow, formatDate } from 'date-fns';
41
41
  import { useDebouncedCallback } from 'use-debounce';
42
42
  import { DayPicker } from 'react-day-picker';
43
43
  import * as PopoverPrimitive from '@radix-ui/react-popover';
@@ -47,7 +47,7 @@ import * as LabelPrimitive from '@radix-ui/react-label';
47
47
  import { ZodProvider, getFieldConfigInZodStack, getDefaultValueInZodStack } from '@autoform/zod/v4';
48
48
  import { z as z$1 } from 'zod/v3';
49
49
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
50
- import { useMastraClient, useChat, toAssistantUIMessage } from '@mastra/react';
50
+ import { useMastraClient, mapWorkflowStreamChunkToWatchResult, useChat, toAssistantUIMessage } from '@mastra/react';
51
51
  import { useQuery, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
52
52
  import './index.css';export * from '@tanstack/react-query';
53
53
  import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
@@ -4323,7 +4323,7 @@ const Badge$1 = ({ icon, variant = "default", className, children, ...props }) =
4323
4323
  "div",
4324
4324
  {
4325
4325
  className: clsx(
4326
- "bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md",
4326
+ "font-mono bg-surface4 text-ui-sm gap-md h-badge-default inline-flex items-center rounded-md shrink-0",
4327
4327
  icon ? "pl-md pr-1.5" : "px-1.5",
4328
4328
  icon || variant === "default" ? "text-icon5" : variantClasses$3[variant],
4329
4329
  className
@@ -4515,8 +4515,7 @@ const ToolBadge = ({ toolName, args, result, networkMetadata, toolOutput }) => {
4515
4515
  );
4516
4516
  };
4517
4517
 
4518
- function convertWorkflowRunStateToWatchResult(runState) {
4519
- const runId = runState.runId;
4518
+ function convertWorkflowRunStateToStreamResult(runState) {
4520
4519
  const steps = {};
4521
4520
  const context = runState.context || {};
4522
4521
  Object.entries(context).forEach(([stepId, stepResult]) => {
@@ -4535,190 +4534,26 @@ function convertWorkflowRunStateToWatchResult(runState) {
4535
4534
  };
4536
4535
  }
4537
4536
  });
4538
- const status = determineWorkflowStatus(steps);
4539
- return {
4540
- type: "watch",
4541
- payload: {
4542
- workflowState: {
4543
- status,
4544
- steps,
4545
- result: runState.value,
4546
- payload: context.input,
4547
- error: void 0
4537
+ const suspendedStepIds = Object.entries(steps).flatMap(
4538
+ ([stepId, stepResult]) => {
4539
+ if (stepResult?.status === "suspended") {
4540
+ const nestedPath = stepResult?.suspendPayload?.__workflow_meta?.path;
4541
+ return nestedPath ? [[stepId, ...nestedPath]] : [[stepId]];
4548
4542
  }
4549
- },
4550
- eventTimestamp: new Date(runState.timestamp),
4551
- runId
4543
+ return [];
4544
+ }
4545
+ );
4546
+ const suspendedStep = suspendedStepIds?.[0]?.[0];
4547
+ const suspendPayload = suspendedStep ? steps[suspendedStep]?.suspendPayload : void 0;
4548
+ return {
4549
+ input: context.input,
4550
+ steps,
4551
+ status: runState.status,
4552
+ ...runState.status === "success" ? { result: runState.result } : {},
4553
+ ...runState.status === "failed" ? { error: runState.error } : {},
4554
+ ...runState.status === "suspended" ? { suspended: suspendedStepIds, suspendPayload } : {}
4552
4555
  };
4553
4556
  }
4554
- function determineWorkflowStatus(steps) {
4555
- const stepStatuses = Object.values(steps).map((step) => step.status);
4556
- if (stepStatuses.includes("failed")) {
4557
- return "failed";
4558
- }
4559
- if (stepStatuses.includes("suspended")) {
4560
- return "suspended";
4561
- }
4562
- if (stepStatuses.every((status) => status === "success")) {
4563
- return "success";
4564
- }
4565
- return "running";
4566
- }
4567
- const mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
4568
- if (chunk.type === "workflow-start") {
4569
- return {
4570
- ...prev,
4571
- runId: chunk.runId,
4572
- eventTimestamp: /* @__PURE__ */ new Date(),
4573
- payload: {
4574
- ...prev?.payload || {},
4575
- workflowState: {
4576
- ...prev?.payload?.workflowState,
4577
- status: "running",
4578
- steps: prev?.runId === chunk.runId ? prev?.payload?.workflowState?.steps ?? {} : {}
4579
- }
4580
- }
4581
- };
4582
- }
4583
- if (chunk.type === "workflow-step-start") {
4584
- const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
4585
- return {
4586
- ...prev,
4587
- runId: chunk.runId,
4588
- payload: {
4589
- ...prev.payload,
4590
- currentStep: {
4591
- id: chunk.payload.id,
4592
- ...chunk.payload
4593
- },
4594
- workflowState: {
4595
- ...prev?.payload?.workflowState,
4596
- steps: {
4597
- ...prev?.payload?.workflowState?.steps,
4598
- [chunk.payload.id]: {
4599
- ...current || {},
4600
- ...chunk.payload
4601
- }
4602
- }
4603
- }
4604
- },
4605
- eventTimestamp: /* @__PURE__ */ new Date()
4606
- };
4607
- }
4608
- if (chunk.type === "workflow-step-suspended") {
4609
- const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
4610
- return {
4611
- ...prev,
4612
- runId: chunk.runId,
4613
- payload: {
4614
- ...prev?.payload,
4615
- currentStep: {
4616
- id: chunk.payload.id,
4617
- ...prev?.payload?.currentStep,
4618
- ...chunk.payload
4619
- },
4620
- workflowState: {
4621
- ...prev?.payload?.workflowState,
4622
- status: "suspended",
4623
- steps: {
4624
- ...prev?.payload?.workflowState?.steps,
4625
- [chunk.payload.id]: {
4626
- ...current || {},
4627
- ...chunk.payload
4628
- }
4629
- }
4630
- }
4631
- },
4632
- eventTimestamp: /* @__PURE__ */ new Date()
4633
- };
4634
- }
4635
- if (chunk.type === "workflow-step-waiting") {
4636
- const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
4637
- return {
4638
- ...prev,
4639
- runId: chunk.runId,
4640
- payload: {
4641
- ...prev?.payload,
4642
- currentStep: {
4643
- id: chunk.payload.id,
4644
- ...prev?.payload?.currentStep || {},
4645
- ...chunk.payload
4646
- },
4647
- workflowState: {
4648
- ...prev?.payload?.workflowState,
4649
- status: "waiting",
4650
- steps: {
4651
- ...prev?.payload?.workflowState?.steps,
4652
- [chunk.payload.id]: {
4653
- ...current,
4654
- ...chunk.payload
4655
- }
4656
- }
4657
- }
4658
- },
4659
- eventTimestamp: /* @__PURE__ */ new Date()
4660
- };
4661
- }
4662
- if (chunk.type === "workflow-step-result") {
4663
- const status = chunk.payload.status;
4664
- const current = prev?.payload?.workflowState?.steps?.[chunk.payload.id] || {};
4665
- const next = {
4666
- ...prev,
4667
- runId: chunk.runId,
4668
- payload: {
4669
- ...prev?.payload,
4670
- currentStep: {
4671
- id: chunk.payload.id,
4672
- ...prev?.payload?.currentStep || {},
4673
- ...chunk.payload
4674
- },
4675
- workflowState: {
4676
- ...prev?.payload?.workflowState,
4677
- status,
4678
- steps: {
4679
- ...prev?.payload?.workflowState?.steps,
4680
- [chunk.payload.id]: {
4681
- ...current,
4682
- ...chunk.payload
4683
- }
4684
- }
4685
- }
4686
- },
4687
- eventTimestamp: /* @__PURE__ */ new Date()
4688
- };
4689
- return next;
4690
- }
4691
- if (chunk.type === "workflow-canceled") {
4692
- return {
4693
- ...prev,
4694
- runId: chunk.runId,
4695
- payload: {
4696
- ...prev?.payload,
4697
- workflowState: {
4698
- ...prev?.payload?.workflowState,
4699
- status: "canceled"
4700
- }
4701
- },
4702
- eventTimestamp: /* @__PURE__ */ new Date()
4703
- };
4704
- }
4705
- if (chunk.type === "workflow-finish") {
4706
- return {
4707
- ...prev,
4708
- runId: chunk.runId,
4709
- payload: {
4710
- ...prev?.payload,
4711
- currentStep: void 0,
4712
- workflowState: {
4713
- ...prev?.payload?.workflowState,
4714
- status: chunk.payload.workflowStatus
4715
- }
4716
- },
4717
- eventTimestamp: /* @__PURE__ */ new Date()
4718
- };
4719
- }
4720
- return prev;
4721
- };
4722
4557
 
4723
4558
  const WorkflowRunContext = createContext({});
4724
4559
  function WorkflowRunProvider({
@@ -4726,17 +4561,19 @@ function WorkflowRunProvider({
4726
4561
  snapshot
4727
4562
  }) {
4728
4563
  const [result, setResult] = useState(
4729
- () => snapshot ? convertWorkflowRunStateToWatchResult(snapshot) : null
4564
+ () => snapshot ? convertWorkflowRunStateToStreamResult(snapshot) : null
4730
4565
  );
4731
4566
  const [payload, setPayload] = useState(() => snapshot?.context?.input ?? null);
4567
+ const [runId, setRunId] = useState(() => snapshot?.runId ?? "");
4732
4568
  const clearData = () => {
4733
4569
  setResult(null);
4734
4570
  setPayload(null);
4735
4571
  };
4736
4572
  useEffect(() => {
4737
4573
  if (snapshot?.runId) {
4738
- setResult(convertWorkflowRunStateToWatchResult(snapshot));
4574
+ setResult(convertWorkflowRunStateToStreamResult(snapshot));
4739
4575
  setPayload(snapshot.context?.input);
4576
+ setRunId(snapshot.runId);
4740
4577
  }
4741
4578
  }, [snapshot]);
4742
4579
  return /* @__PURE__ */ jsx(
@@ -4748,7 +4585,9 @@ function WorkflowRunProvider({
4748
4585
  payload,
4749
4586
  setPayload,
4750
4587
  clearData,
4751
- snapshot
4588
+ snapshot,
4589
+ runId,
4590
+ setRunId
4752
4591
  },
4753
4592
  children
4754
4593
  }
@@ -5239,22 +5078,22 @@ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
5239
5078
 
5240
5079
  const useCurrentRun = () => {
5241
5080
  const context = useContext(WorkflowRunContext);
5242
- const workflowCurrentSteps = context.result?.payload?.workflowState?.steps ?? {};
5081
+ const workflowCurrentSteps = context.result?.steps ?? {};
5243
5082
  const steps = Object.entries(workflowCurrentSteps).reduce((acc, [key, value]) => {
5244
5083
  return {
5245
5084
  ...acc,
5246
5085
  [key]: {
5247
- error: value.error,
5086
+ error: "error" in value ? value.error : void 0,
5248
5087
  startedAt: value.startedAt,
5249
- endedAt: value.endedAt,
5088
+ endedAt: "endedAt" in value ? value.endedAt : void 0,
5250
5089
  status: value.status,
5251
- output: value.output,
5090
+ output: "output" in value ? value.output : void 0,
5252
5091
  input: value.payload,
5253
- resumeData: value.resumePayload
5092
+ resumeData: "resumePayload" in value ? value.resumePayload : void 0
5254
5093
  }
5255
5094
  };
5256
5095
  }, {});
5257
- return { steps, runId: context.result?.runId };
5096
+ return { steps, runId: context.runId };
5258
5097
  };
5259
5098
 
5260
5099
  const sizeClasses = {
@@ -7181,7 +7020,7 @@ function WorkflowTrigger({
7181
7020
  cancelWorkflowRun
7182
7021
  }) {
7183
7022
  const { runtimeContext } = usePlaygroundStore();
7184
- const { result, setResult, payload, setPayload } = useContext(WorkflowRunContext);
7023
+ const { result, setResult, payload, setPayload, setRunId: setContextRunId } = useContext(WorkflowRunContext);
7185
7024
  const [isRunning, setIsRunning] = useState(false);
7186
7025
  const [innerRunId, setInnerRunId] = useState("");
7187
7026
  const [cancelResponse, setCancelResponse] = useState(null);
@@ -7195,6 +7034,7 @@ function WorkflowTrigger({
7195
7034
  const { runId } = await createWorkflowRun({ workflowId });
7196
7035
  setRunId?.(runId);
7197
7036
  setInnerRunId(runId);
7037
+ setContextRunId(runId);
7198
7038
  streamWorkflow({ workflowId, runId, inputData: data, runtimeContext });
7199
7039
  } catch (err) {
7200
7040
  setIsRunning(false);
@@ -7219,9 +7059,9 @@ function WorkflowTrigger({
7219
7059
  setCancelResponse(response);
7220
7060
  };
7221
7061
  const streamResultToUse = result ?? streamResult;
7222
- const suspendedSteps = Object.entries(streamResultToUse?.payload?.workflowState?.steps || {}).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
7062
+ const suspendedSteps = Object.entries(streamResultToUse?.steps || {}).filter(([_, { status }]) => status === "suspended").map(([stepId, { payload: payload2 }]) => ({
7223
7063
  stepId,
7224
- runId: streamResultToUse?.runId ?? "",
7064
+ runId: innerRunId,
7225
7065
  suspendPayload: payload2,
7226
7066
  isLoading: false
7227
7067
  }));
@@ -7229,6 +7069,7 @@ function WorkflowTrigger({
7229
7069
  if (paramsRunId && observeWorkflowStream) {
7230
7070
  observeWorkflowStream({ workflowId, runId: paramsRunId });
7231
7071
  setInnerRunId(paramsRunId);
7072
+ setContextRunId(paramsRunId);
7232
7073
  }
7233
7074
  }, [paramsRunId]);
7234
7075
  useEffect(() => {
@@ -7248,7 +7089,7 @@ function WorkflowTrigger({
7248
7089
  if (!workflow) return null;
7249
7090
  const isSuspendedSteps = suspendedSteps.length > 0;
7250
7091
  const zodInputSchema = triggerSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(triggerSchema))) : null;
7251
- const workflowActivePaths = streamResultToUse?.payload?.workflowState?.steps ?? {};
7092
+ const workflowActivePaths = streamResultToUse?.steps ?? {};
7252
7093
  const hasWorkflowActivePaths = Object.values(workflowActivePaths).length > 0;
7253
7094
  const doneStatuses = ["success", "failed", "canceled"];
7254
7095
  return /* @__PURE__ */ jsxs("div", { className: "h-full pt-3 pb-12", children: [
@@ -7312,14 +7153,14 @@ function WorkflowTrigger({
7312
7153
  )
7313
7154
  ] }, step.stepId);
7314
7155
  }),
7315
- result?.runId && /* @__PURE__ */ jsxs(
7156
+ result?.status === "running" && /* @__PURE__ */ jsxs(
7316
7157
  Button$1,
7317
7158
  {
7318
7159
  variant: "light",
7319
7160
  className: "w-full",
7320
7161
  size: "lg",
7321
7162
  onClick: handleCancelWorkflowRun,
7322
- disabled: !!cancelResponse?.message || isCancellingWorkflowRun || result?.payload?.workflowState?.status && doneStatuses.includes(result?.payload?.workflowState?.status),
7163
+ disabled: !!cancelResponse?.message || isCancellingWorkflowRun || result?.status && doneStatuses.includes(result?.status),
7323
7164
  children: [
7324
7165
  isCancellingWorkflowRun ? /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) }) : /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(StopCircle, {}) }),
7325
7166
  cancelResponse?.message || "Cancel Workflow Run"
@@ -7330,8 +7171,13 @@ function WorkflowTrigger({
7330
7171
  /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
7331
7172
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
7332
7173
  /* @__PURE__ */ jsx(Text, { variant: "secondary", className: "px-4 text-mastra-el-3", size: "xs", children: "Status" }),
7333
- /* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths).filter(([key, _]) => key !== "input" && !key.endsWith(".input")).map(([stepId, { status, output }]) => {
7334
- return /* @__PURE__ */ jsx(WorkflowStatus, { stepId, status, result: output ?? {} }, stepId);
7174
+ /* @__PURE__ */ jsx("div", { className: "px-4 flex flex-col gap-4", children: Object.entries(workflowActivePaths).filter(([key, _]) => key !== "input" && !key.endsWith(".input")).map(([stepId, step]) => {
7175
+ const { status } = step;
7176
+ let output = {};
7177
+ if (step.status === "success") {
7178
+ output = step.output;
7179
+ }
7180
+ return /* @__PURE__ */ jsx(WorkflowStatus, { stepId, status, result: output }, stepId);
7335
7181
  }) })
7336
7182
  ] })
7337
7183
  ] })
@@ -7359,16 +7205,15 @@ const useWorkflowRuns = (workflowId, { enabled = true } = {}) => {
7359
7205
  queryKey: ["workflow-runs", workflowId],
7360
7206
  queryFn: () => client.getWorkflow(workflowId).runs({ limit: 50 }),
7361
7207
  enabled,
7208
+ refetchInterval: 5e3,
7362
7209
  gcTime: 0,
7363
7210
  staleTime: 0
7364
7211
  });
7365
7212
  };
7366
7213
 
7367
- const WorkflowRuns = ({
7214
+ const WorkflowRunDetail = ({
7368
7215
  workflowId,
7369
7216
  runId,
7370
- onPressRun,
7371
- onPressBackToRuns,
7372
7217
  observeWorkflowStream,
7373
7218
  ...triggerProps
7374
7219
  }) => {
@@ -7382,43 +7227,23 @@ const WorkflowRuns = ({
7382
7227
  }
7383
7228
  const run = actualRuns.find((run2) => run2.runId === runId);
7384
7229
  const runSnapshot = run?.snapshot;
7385
- const runResult = runSnapshot && typeof runSnapshot === "object" ? convertWorkflowRunStateToWatchResult(runSnapshot) : null;
7386
- const runStatus = runResult?.payload?.workflowState?.status;
7230
+ const runResult = runSnapshot && typeof runSnapshot === "object" ? convertWorkflowRunStateToStreamResult(runSnapshot) : null;
7231
+ const runStatus = runResult?.status;
7387
7232
  if (runId) {
7388
- return /* @__PURE__ */ jsxs("div", { className: "h-full grid grid-rows-[1fr_auto]", children: [
7389
- /* @__PURE__ */ jsx("div", { className: "px-5 space-y-2", children: /* @__PURE__ */ jsxs(Button$1, { onClick: onPressBackToRuns, variant: "light", children: [
7390
- /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ChevronLeftIcon, {}) }),
7391
- "Back to runs"
7392
- ] }) }),
7393
- /* @__PURE__ */ jsx(
7394
- WorkflowTrigger,
7395
- {
7396
- ...triggerProps,
7397
- streamResult: isObjectEmpty(triggerProps.streamResult ?? {}) ? runResult : triggerProps.streamResult,
7398
- paramsRunId: runId,
7399
- workflowId,
7400
- observeWorkflowStream: () => {
7401
- if (runStatus !== "success" && runStatus !== "failed" && runStatus !== "canceled") {
7402
- observeWorkflowStream?.({ workflowId, runId });
7403
- }
7233
+ return /* @__PURE__ */ jsx("div", { className: "h-full grid grid-rows-[1fr_auto]", children: /* @__PURE__ */ jsx(
7234
+ WorkflowTrigger,
7235
+ {
7236
+ ...triggerProps,
7237
+ paramsRunId: runId,
7238
+ workflowId,
7239
+ observeWorkflowStream: () => {
7240
+ if (runStatus !== "success" && runStatus !== "failed" && runStatus !== "canceled") {
7241
+ observeWorkflowStream?.({ workflowId, runId, storeRunResult: runResult });
7404
7242
  }
7405
7243
  }
7406
- )
7407
- ] });
7244
+ }
7245
+ ) });
7408
7246
  }
7409
- return /* @__PURE__ */ jsx("ol", { className: "pb-10", children: actualRuns.map((run2) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
7410
- "button",
7411
- {
7412
- onClick: () => onPressRun({ workflowId, runId: run2.runId }),
7413
- className: clsx("px-3 py-2 border-b-sm border-border1 block w-full hover:bg-surface4 text-left", {
7414
- "bg-surface4": run2.runId === runId
7415
- }),
7416
- children: [
7417
- /* @__PURE__ */ jsx(Txt, { variant: "ui-lg", className: "font-medium text-icon6 truncate", as: "p", children: run2.runId }),
7418
- /* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "font-medium text-icon3 truncate", as: "p", children: typeof run2?.snapshot === "string" ? "" : run2?.snapshot?.timestamp ? formatDate(run2?.snapshot?.timestamp, "MMM d, yyyy h:mm a") : "" })
7419
- ]
7420
- }
7421
- ) }, run2.runId)) });
7422
7247
  };
7423
7248
 
7424
7249
  const EmptyState = ({
@@ -7473,7 +7298,7 @@ const Row = forwardRef(
7473
7298
  "tr",
7474
7299
  {
7475
7300
  className: clsx(
7476
- "border-b-sm border-border1 hover:bg-surface3 focus:bg-surface3 -outline-offset-2 last:border-b-0",
7301
+ "border-b-sm border-border1 hover:bg-surface3 focus:bg-surface3 -outline-offset-2",
7477
7302
  selected && "bg-surface4",
7478
7303
  onClick && "cursor-pointer",
7479
7304
  className
@@ -7526,7 +7351,7 @@ const DateTimeCell = ({ dateTime, ...props }) => {
7526
7351
  };
7527
7352
  const EntryCell = ({ name, description, icon, meta, ...props }) => {
7528
7353
  return /* @__PURE__ */ jsx(Cell, { ...props, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[14px]", children: [
7529
- /* @__PURE__ */ jsx(Icon, { size: "lg", className: "text-icon5", children: icon }),
7354
+ icon && /* @__PURE__ */ jsx(Icon, { size: "lg", className: "text-icon5", children: icon }),
7530
7355
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0", children: [
7531
7356
  /* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-md", className: "text-icon6 font-medium !leading-tight", children: name }),
7532
7357
  description && /* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-xs", className: "text-icon3 w-full max-w-[300px] truncate !leading-tight", children: description })
@@ -7696,7 +7521,9 @@ const LinkComponentContext = createContext({
7696
7521
  networkNewThreadLink: () => "",
7697
7522
  networkThreadLink: () => "",
7698
7523
  scorerLink: () => "",
7699
- toolLink: () => ""
7524
+ toolLink: () => "",
7525
+ mcpServerLink: () => "",
7526
+ workflowRunLink: () => ""
7700
7527
  }
7701
7528
  });
7702
7529
  const LinkComponentProvider = ({ children, Link, navigate, paths }) => {
@@ -7710,17 +7537,16 @@ const useLinkComponent = () => {
7710
7537
  return ctx;
7711
7538
  };
7712
7539
 
7713
- const columns$2 = [
7540
+ const columns$4 = [
7714
7541
  {
7715
7542
  id: "name",
7716
7543
  header: "Name",
7717
7544
  cell: ({ row }) => {
7718
- const { Link } = useLinkComponent();
7545
+ const { Link, paths } = useLinkComponent();
7719
7546
  return /* @__PURE__ */ jsx(
7720
7547
  EntryCell,
7721
7548
  {
7722
- icon: /* @__PURE__ */ jsx(WorkflowIcon, {}),
7723
- name: /* @__PURE__ */ jsx(Link, { href: row.original.link, children: row.original.name }),
7549
+ name: /* @__PURE__ */ jsx(Link, { href: paths.workflowLink(row.original.id), children: row.original.name }),
7724
7550
  description: void 0,
7725
7551
  meta: void 0
7726
7552
  }
@@ -7734,43 +7560,111 @@ const columns$2 = [
7734
7560
  id: "stepsCount",
7735
7561
  header: "Steps",
7736
7562
  size: 300,
7737
- cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx("div", { className: "flex justify-end items-center gap-2", children: /* @__PURE__ */ jsxs(Badge$1, { icon: /* @__PURE__ */ jsx(Footprints, {}), className: "!h-button-md", children: [
7738
- row.original.stepsCount,
7739
- " step",
7740
- row.original.stepsCount > 1 ? "s" : ""
7741
- ] }) }) })
7563
+ cell: ({ row }) => {
7564
+ const workflow = row.original;
7565
+ const stepsCount = Object.keys(workflow.steps ?? {}).length;
7566
+ return /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx("div", { className: "flex justify-end items-center gap-2", children: /* @__PURE__ */ jsxs(Badge$1, { icon: /* @__PURE__ */ jsx(Footprints, {}), className: "!h-button-md", children: [
7567
+ stepsCount,
7568
+ " step",
7569
+ stepsCount > 1 ? "s" : ""
7570
+ ] }) }) });
7571
+ }
7742
7572
  }
7743
7573
  ];
7744
7574
 
7575
+ const themeClasses = {
7576
+ light: "bg-gray-100 border-gray-300 text-gray-700",
7577
+ dark: "bg-surface4 border-border1 text-icon6"
7578
+ };
7579
+ const Kbd = ({ children, theme = "dark" }) => {
7580
+ const themeClass = themeClasses[theme];
7581
+ return /* @__PURE__ */ jsx("kbd", { className: clsx("border-sm rounded-md px-1 py-0.5 font-mono", themeClass), children });
7582
+ };
7583
+
7584
+ const Searchbar = ({ onSearch, label, placeholder }) => {
7585
+ const id = useId();
7586
+ const inputRef = useRef(null);
7587
+ useEffect(() => {
7588
+ const input = inputRef.current;
7589
+ if (!input) return;
7590
+ const handleKeyDown = (event) => {
7591
+ if (event.key.toLowerCase() === "f" && event.shiftKey && (event.ctrlKey || event.metaKey)) {
7592
+ event.preventDefault();
7593
+ input.focus();
7594
+ }
7595
+ };
7596
+ window.addEventListener("keydown", handleKeyDown);
7597
+ return () => {
7598
+ window.removeEventListener("keydown", handleKeyDown);
7599
+ };
7600
+ }, []);
7601
+ const handleSubmit = (e) => {
7602
+ e.preventDefault();
7603
+ const formData = new FormData(e.target);
7604
+ const search = formData.get(id);
7605
+ onSearch(search);
7606
+ };
7607
+ return /* @__PURE__ */ jsxs(
7608
+ "form",
7609
+ {
7610
+ onSubmit: handleSubmit,
7611
+ 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",
7612
+ children: [
7613
+ /* @__PURE__ */ jsx(SearchIcon, { className: "text-icon3 h-4 w-4" }),
7614
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
7615
+ /* @__PURE__ */ jsx("label", { htmlFor: id, className: "sr-only", children: label }),
7616
+ /* @__PURE__ */ jsx(
7617
+ "input",
7618
+ {
7619
+ id,
7620
+ type: "text",
7621
+ placeholder,
7622
+ className: "bg-surface2 text-ui-md placeholder:text-icon-3 block h-8 w-full px-2 outline-none",
7623
+ name: id,
7624
+ ref: inputRef
7625
+ }
7626
+ )
7627
+ ] }),
7628
+ /* @__PURE__ */ jsx("button", { type: "submit", className: "text-ui-sm text-icon3 flex flex-row items-center gap-1", children: /* @__PURE__ */ jsx(Kbd, { children: "↵ Enter" }) })
7629
+ ]
7630
+ }
7631
+ );
7632
+ };
7633
+ const SearchbarWrapper = ({ children }) => {
7634
+ return /* @__PURE__ */ jsx("div", { className: "px-4 py-2 border-b-sm border-border1", children });
7635
+ };
7636
+
7745
7637
  function WorkflowTable({ workflows, isLoading }) {
7638
+ const [search, setSearch] = useState("");
7746
7639
  const { navigate, paths } = useLinkComponent();
7747
7640
  const workflowData = useMemo(() => {
7748
7641
  const _workflowsData = Object.keys(workflows ?? {}).map((key) => {
7749
- const workflow = workflows?.[key];
7642
+ const workflow = workflows[key];
7750
7643
  return {
7751
7644
  id: key,
7752
- name: workflow?.name || "N/A",
7753
- stepsCount: Object.keys(workflow?.steps ?? {})?.length,
7754
- link: paths.workflowLink(key)
7645
+ ...workflow
7755
7646
  };
7756
7647
  });
7757
7648
  return _workflowsData;
7758
7649
  }, [workflows]);
7759
7650
  const table = useReactTable({
7760
7651
  data: workflowData,
7761
- columns: columns$2,
7652
+ columns: columns$4,
7762
7653
  getCoreRowModel: getCoreRowModel()
7763
7654
  });
7764
- if (isLoading) return /* @__PURE__ */ jsx(WorkflowTableSkeleton, {});
7765
7655
  const ths = table.getHeaderGroups()[0];
7766
7656
  const rows = table.getRowModel().rows.concat();
7767
- if (rows.length === 0) {
7657
+ if (rows.length === 0 && !isLoading) {
7768
7658
  return /* @__PURE__ */ jsx(EmptyWorkflowsTable, {});
7769
7659
  }
7770
- return /* @__PURE__ */ jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxs(Table$1, { children: [
7771
- /* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
7772
- /* @__PURE__ */ jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsx(Row, { onClick: () => navigate(row.original.link), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
7773
- ] }) });
7660
+ const filteredRows = rows.filter((row) => row.original.name.toLowerCase().includes(search.toLowerCase()));
7661
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
7662
+ /* @__PURE__ */ jsx(SearchbarWrapper, { children: /* @__PURE__ */ jsx(Searchbar, { onSearch: setSearch, label: "Search workflows", placeholder: "Search workflows" }) }),
7663
+ isLoading ? /* @__PURE__ */ jsx(WorkflowTableSkeleton, {}) : /* @__PURE__ */ jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxs(Table$1, { children: [
7664
+ /* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
7665
+ /* @__PURE__ */ jsx(Tbody, { children: filteredRows.map((row) => /* @__PURE__ */ jsx(Row, { onClick: () => navigate(paths.workflowLink(row.original.id)), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
7666
+ ] }) })
7667
+ ] });
7774
7668
  }
7775
7669
  const WorkflowTableSkeleton = () => /* @__PURE__ */ jsxs(Table$1, { children: [
7776
7670
  /* @__PURE__ */ jsxs(Thead, { children: [
@@ -8391,7 +8285,7 @@ const MistralIcon = (props) => /* @__PURE__ */ jsxs(
8391
8285
  );
8392
8286
 
8393
8287
  const NetlifyIcon = (props) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "128", height: "113", viewBox: "0 0 128 113", children: [
8394
- /* @__PURE__ */ jsxs("g", { "clip-path": "url(#clip0_236_138)", ...props, children: [
8288
+ /* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_236_138)", ...props, children: [
8395
8289
  /* @__PURE__ */ jsx(
8396
8290
  "path",
8397
8291
  {
@@ -8515,23 +8409,32 @@ const ProviderLogo = ({ providerId, className = "", size = 20 }) => {
8515
8409
  );
8516
8410
  };
8517
8411
 
8412
+ const statusClasses = {
8413
+ warning: "bg-yellow-900/20 border-sm border-yellow-200 text-yellow-200 rounded-lg px-4 py-2 flex gap-4 items-center",
8414
+ default: ""
8415
+ };
8518
8416
  const AssistantMessage = ({ ToolFallback: ToolFallbackCustom, hasModelList }) => {
8519
8417
  const data = useMessage();
8520
8418
  const messageId = data.id;
8521
8419
  const isToolCallAndOrReasoning = data.content.every(({ type }) => type === "tool-call" || type === "reasoning");
8522
8420
  const modelMetadata = data.metadata?.custom?.modelMetadata;
8421
+ const messageStatus = data.metadata?.custom?.status;
8422
+ const statusClass = statusClasses[messageStatus || "default"];
8523
8423
  const showModelUsed = hasModelList && modelMetadata;
8524
8424
  return /* @__PURE__ */ jsxs(MessagePrimitive.Root, { className: "max-w-full", "data-message-id": messageId, children: [
8525
- /* @__PURE__ */ jsx("div", { className: "text-icon6 text-ui-lg leading-ui-lg", children: /* @__PURE__ */ jsx(
8526
- MessagePrimitive.Parts,
8527
- {
8528
- components: {
8529
- Text: ErrorAwareText,
8530
- tools: { Fallback: ToolFallbackCustom || ToolFallback },
8531
- Reasoning
8425
+ /* @__PURE__ */ jsxs("div", { className: clsx("text-icon6 text-ui-lg leading-ui-lg", statusClass), children: [
8426
+ messageStatus === "warning" && /* @__PURE__ */ jsx(Icon, { size: "lg", children: /* @__PURE__ */ jsx(TriangleAlert, {}) }),
8427
+ /* @__PURE__ */ jsx(
8428
+ MessagePrimitive.Parts,
8429
+ {
8430
+ components: {
8431
+ Text: ErrorAwareText,
8432
+ tools: { Fallback: ToolFallbackCustom || ToolFallback },
8433
+ Reasoning
8434
+ }
8532
8435
  }
8533
- }
8534
- ) }),
8436
+ )
8437
+ ] }),
8535
8438
  !isToolCallAndOrReasoning && /* @__PURE__ */ jsxs("div", { className: cn("h-6 pt-4 flex gap-2 items-center", { "pb-1": showModelUsed }), children: [
8536
8439
  showModelUsed && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
8537
8440
  /* @__PURE__ */ jsx(ProviderLogo, { providerId: modelMetadata.modelProvider, size: 14 }),
@@ -9612,6 +9515,25 @@ const handleNetworkMessageFromMemory = (content) => {
9612
9515
 
9613
9516
  const handleStreamChunk = ({ chunk, conversation }) => {
9614
9517
  switch (chunk.type) {
9518
+ case "tripwire": {
9519
+ return [
9520
+ ...conversation,
9521
+ {
9522
+ role: "assistant",
9523
+ metadata: {
9524
+ custom: {
9525
+ status: "warning"
9526
+ }
9527
+ },
9528
+ content: [
9529
+ {
9530
+ type: "text",
9531
+ text: chunk.payload.tripwireReason
9532
+ }
9533
+ ]
9534
+ }
9535
+ ];
9536
+ }
9615
9537
  case "start": {
9616
9538
  const newMessage = {
9617
9539
  role: "assistant",
@@ -10328,8 +10250,16 @@ function MastraRuntimeProvider({
10328
10250
  threadId,
10329
10251
  modelSettings: modelSettingsArgs,
10330
10252
  signal: controller.signal,
10331
- onFinish: (messages2) => {
10332
- return messages2.map((message2) => toAssistantUIMessage(message2));
10253
+ onFinish: ({ messages: messages2, tripwireReason }) => {
10254
+ const next = messages2.length > 0 ? messages2.map((message2) => toAssistantUIMessage(message2)) : [];
10255
+ if (tripwireReason) {
10256
+ next.push({
10257
+ role: "assistant",
10258
+ content: [{ type: "text", text: tripwireReason }],
10259
+ metadata: { custom: { status: "warning" } }
10260
+ });
10261
+ }
10262
+ return next;
10333
10263
  }
10334
10264
  });
10335
10265
  return;
@@ -11520,27 +11450,25 @@ const AgentSettings = ({ modelVersion, hasMemory = false, hasSubAgents = false }
11520
11450
  ] });
11521
11451
  };
11522
11452
 
11523
- const NameCell$1 = ({ row }) => {
11524
- const { Link } = useLinkComponent();
11453
+ const NameCell$3 = ({ row }) => {
11454
+ const { Link, paths } = useLinkComponent();
11525
11455
  return /* @__PURE__ */ jsx(
11526
11456
  EntryCell,
11527
11457
  {
11528
- icon: /* @__PURE__ */ jsx(AgentIcon, {}),
11529
- name: /* @__PURE__ */ jsx(Link, { className: "w-full space-y-0", href: row.original.link, children: row.original.name }),
11458
+ name: /* @__PURE__ */ jsx(Link, { className: "w-full space-y-0", href: paths.agentLink(row.original.id), children: row.original.name }),
11530
11459
  description: row.original.instructions
11531
11460
  }
11532
11461
  );
11533
11462
  };
11534
- const columns$1 = [
11463
+ const columns$3 = [
11535
11464
  {
11536
11465
  header: "Name",
11537
11466
  accessorKey: "name",
11538
- cell: NameCell$1
11467
+ cell: NameCell$3
11539
11468
  },
11540
11469
  {
11541
11470
  header: "Model",
11542
11471
  accessorKey: "model",
11543
- size: 300,
11544
11472
  cell: ({ row }) => {
11545
11473
  return /* @__PURE__ */ jsxs(Cell, { children: [
11546
11474
  /* @__PURE__ */ jsx(
@@ -11571,67 +11499,76 @@ const columns$1 = [
11571
11499
  }
11572
11500
  },
11573
11501
  {
11574
- size: 160,
11575
- header: "Tools",
11576
- accessorKey: "tools",
11502
+ header: "Attached entities",
11503
+ accessorKey: "attachedEntities",
11577
11504
  cell: ({ row }) => {
11578
- const toolsCount = row.original.tools ? Object.keys(row.original.tools).length : 0;
11579
- return /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsxs(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(ApiIcon, {}), children: [
11580
- toolsCount,
11581
- " tool",
11582
- toolsCount > 1 ? "s" : ""
11505
+ const agent = row.original;
11506
+ const agentsCount = Object.keys(agent.agents || {}).length;
11507
+ const toolsCount = Object.keys(agent.tools || {}).length;
11508
+ const workflowsCount = Object.keys(agent.workflows || {}).length;
11509
+ return /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsxs("span", { className: "flex flex-row gap-2 w-full items-center", children: [
11510
+ /* @__PURE__ */ jsxs(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(AgentIcon, { className: "text-accent1" }), children: [
11511
+ agentsCount,
11512
+ " agent",
11513
+ agentsCount > 1 ? "s" : ""
11514
+ ] }),
11515
+ /* @__PURE__ */ jsxs(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(ToolsIcon, { className: "text-accent6" }), children: [
11516
+ toolsCount,
11517
+ " tool",
11518
+ toolsCount > 1 ? "s" : ""
11519
+ ] }),
11520
+ /* @__PURE__ */ jsxs(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(WorkflowIcon, { className: "text-accent3" }), children: [
11521
+ workflowsCount,
11522
+ " workflow",
11523
+ workflowsCount > 1 ? "s" : ""
11524
+ ] })
11583
11525
  ] }) });
11584
11526
  }
11585
11527
  }
11586
11528
  ];
11587
11529
 
11588
11530
  function AgentsTable({ agents, isLoading }) {
11531
+ const [search, setSearch] = useState("");
11589
11532
  const { navigate, paths } = useLinkComponent();
11590
11533
  const projectData = useMemo(
11591
11534
  () => Object.keys(agents).map((key) => {
11592
11535
  const agent = agents[key];
11593
11536
  return {
11594
11537
  id: key,
11595
- name: agent.name,
11596
- instructions: agent.instructions,
11597
- provider: agent.provider,
11598
- branch: void 0,
11599
- executedAt: void 0,
11600
- repoUrl: void 0,
11601
- tools: agent.tools,
11602
- modelId: agent.modelId,
11603
- link: paths.agentLink(key),
11604
- modelList: agent.modelList
11538
+ ...agent
11605
11539
  };
11606
11540
  }),
11607
11541
  [agents]
11608
11542
  );
11609
11543
  const table = useReactTable({
11610
11544
  data: projectData,
11611
- columns: columns$1,
11545
+ columns: columns$3,
11612
11546
  getCoreRowModel: getCoreRowModel()
11613
11547
  });
11614
- if (isLoading) return /* @__PURE__ */ jsx(AgentsTableSkeleton, {});
11615
11548
  const ths = table.getHeaderGroups()[0];
11616
11549
  const rows = table.getRowModel().rows.concat();
11617
- if (rows.length === 0) {
11550
+ if (rows.length === 0 && !isLoading) {
11618
11551
  return /* @__PURE__ */ jsx(EmptyAgentsTable, {});
11619
11552
  }
11620
- return /* @__PURE__ */ jsx(ScrollableContainer, { children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Table$1, { children: [
11621
- /* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
11622
- /* @__PURE__ */ jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsx(Row, { onClick: () => navigate(row.original.link), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
11623
- ] }) }) });
11553
+ const filteredRows = rows.filter((row) => row.original.name.toLowerCase().includes(search.toLowerCase()));
11554
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
11555
+ /* @__PURE__ */ jsx(SearchbarWrapper, { children: /* @__PURE__ */ jsx(Searchbar, { onSearch: setSearch, label: "Search agents", placeholder: "Search agents" }) }),
11556
+ isLoading ? /* @__PURE__ */ jsx(AgentsTableSkeleton, {}) : /* @__PURE__ */ jsx(ScrollableContainer, { children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Table$1, { children: [
11557
+ /* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsx(Th, { style: { width: header.column.getSize() ?? "auto" }, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
11558
+ /* @__PURE__ */ jsx(Tbody, { children: filteredRows.map((row) => /* @__PURE__ */ jsx(Row, { onClick: () => navigate(paths.agentLink(row.original.id)), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
11559
+ ] }) }) })
11560
+ ] });
11624
11561
  }
11625
11562
  const AgentsTableSkeleton = () => /* @__PURE__ */ jsxs(Table$1, { children: [
11626
11563
  /* @__PURE__ */ jsxs(Thead, { children: [
11627
11564
  /* @__PURE__ */ jsx(Th, { children: "Name" }),
11628
- /* @__PURE__ */ jsx(Th, { width: 160, children: "Model" }),
11629
- /* @__PURE__ */ jsx(Th, { width: 160, children: "Tools" })
11565
+ /* @__PURE__ */ jsx(Th, { children: "Model" }),
11566
+ /* @__PURE__ */ jsx(Th, { children: "Attached entities" })
11630
11567
  ] }),
11631
11568
  /* @__PURE__ */ jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxs(Row, { children: [
11632
11569
  /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
11633
- /* @__PURE__ */ jsx(Cell, { width: 160, children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
11634
- /* @__PURE__ */ jsx(Cell, { width: 160, children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) })
11570
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
11571
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) })
11635
11572
  ] }, index)) })
11636
11573
  ] });
11637
11574
  const EmptyAgentsTable = () => /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx(
@@ -13318,53 +13255,56 @@ const useScorers = () => {
13318
13255
  });
13319
13256
  };
13320
13257
 
13321
- const NameCell = ({ row }) => {
13322
- const { Link } = useLinkComponent();
13258
+ const NameCell$2 = ({ row }) => {
13259
+ const { Link, paths } = useLinkComponent();
13260
+ const scorer = row.original;
13323
13261
  return /* @__PURE__ */ jsx(
13324
13262
  EntryCell,
13325
13263
  {
13326
- icon: /* @__PURE__ */ jsx(GaugeIcon, {}),
13327
- name: /* @__PURE__ */ jsx(Link, { className: "w-full space-y-0", href: row.original.id, children: row.original.name }),
13328
- description: row.original.description
13264
+ name: /* @__PURE__ */ jsx(Link, { className: "w-full space-y-0", href: paths.scorerLink(scorer.id), children: scorer.scorer.config.name }),
13265
+ description: scorer.scorer.config.description
13329
13266
  }
13330
13267
  );
13331
13268
  };
13332
- const columns = [
13269
+ const columns$2 = [
13333
13270
  {
13334
13271
  header: "Name",
13335
13272
  accessorKey: "name",
13336
- cell: NameCell
13273
+ cell: NameCell$2
13337
13274
  }
13338
13275
  ];
13339
13276
 
13340
13277
  function ScorersTable({ scorers, isLoading }) {
13341
13278
  const { navigate, paths } = useLinkComponent();
13279
+ const [search, setSearch] = useState("");
13342
13280
  const scorersData = useMemo(
13343
13281
  () => Object.keys(scorers).map((key) => {
13344
13282
  const scorer = scorers[key];
13345
13283
  return {
13346
- id: key,
13347
- name: scorer.scorer.config.name,
13348
- description: scorer.scorer.config.description
13284
+ ...scorer,
13285
+ id: key
13349
13286
  };
13350
13287
  }),
13351
13288
  [scorers]
13352
13289
  );
13353
13290
  const table = useReactTable({
13354
13291
  data: scorersData,
13355
- columns,
13292
+ columns: columns$2,
13356
13293
  getCoreRowModel: getCoreRowModel()
13357
13294
  });
13358
- if (isLoading) return /* @__PURE__ */ jsx(ScorersTableSkeleton, {});
13359
13295
  const ths = table.getHeaderGroups()[0];
13360
13296
  const rows = table.getRowModel().rows.concat();
13361
- if (rows.length === 0) {
13297
+ if (rows.length === 0 && !isLoading) {
13362
13298
  return /* @__PURE__ */ jsx(EmptyScorersTable, {});
13363
13299
  }
13364
- return /* @__PURE__ */ jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxs(Table$1, { children: [
13365
- /* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
13366
- /* @__PURE__ */ jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsx(Row, { onClick: () => navigate(paths.scorerLink(row.original.id)), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
13367
- ] }) });
13300
+ const filteredRows = rows.filter((row) => row.original.scorer.config.name.toLowerCase().includes(search.toLowerCase()));
13301
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
13302
+ /* @__PURE__ */ jsx(SearchbarWrapper, { children: /* @__PURE__ */ jsx(Searchbar, { onSearch: setSearch, label: "Search scorers", placeholder: "Search scorers" }) }),
13303
+ isLoading ? /* @__PURE__ */ jsx(ScorersTableSkeleton, {}) : /* @__PURE__ */ jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxs(Table$1, { children: [
13304
+ /* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsx(Th, { style: { width: header.index === 0 ? "auto" : header.column.getSize() }, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
13305
+ /* @__PURE__ */ jsx(Tbody, { children: filteredRows.map((row) => /* @__PURE__ */ jsx(Row, { onClick: () => navigate(paths.scorerLink(row.original.id)), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
13306
+ ] }) })
13307
+ ] });
13368
13308
  }
13369
13309
  const ScorersTableSkeleton = () => /* @__PURE__ */ jsxs(Table$1, { children: [
13370
13310
  /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsx(Th, { children: "Name" }) }),
@@ -13461,7 +13401,7 @@ const AgentMetadataModelSwitcher = ({
13461
13401
  };
13462
13402
  fetchProviders();
13463
13403
  }, [apiUrl]);
13464
- const currentModelProvider = selectedProvider;
13404
+ const currentModelProvider = cleanProviderId(selectedProvider);
13465
13405
  const allModels = useMemo(() => {
13466
13406
  return providers.flatMap(
13467
13407
  (provider) => provider.models.map((model) => ({
@@ -13530,7 +13470,7 @@ const AgentMetadataModelSwitcher = ({
13530
13470
  }
13531
13471
  };
13532
13472
  const handleProviderSelect = async (provider) => {
13533
- setSelectedProvider(provider.id);
13473
+ setSelectedProvider(cleanProviderId(provider.id));
13534
13474
  setProviderSearch("");
13535
13475
  setIsSearchingProvider(false);
13536
13476
  setShowProviderSuggestions(false);
@@ -13555,7 +13495,7 @@ const AgentMetadataModelSwitcher = ({
13555
13495
  const providerChanged = currentModelProvider && currentModelProvider !== defaultProvider;
13556
13496
  const modelEmpty = !selectedModel || selectedModel === "";
13557
13497
  if (providerChanged && modelEmpty) {
13558
- setSelectedProvider(defaultProvider);
13498
+ setSelectedProvider(cleanProviderId(defaultProvider));
13559
13499
  setSelectedModel(defaultModel);
13560
13500
  if (defaultProvider && defaultModel) {
13561
13501
  updateModel({
@@ -14263,13 +14203,14 @@ const ThreadLink = ({ children, as: Component = "a", href, className, prefetch,
14263
14203
  const ThreadList = ({ children }) => {
14264
14204
  return /* @__PURE__ */ jsx("ol", { children });
14265
14205
  };
14266
- const ThreadItem = ({ children, isActive }) => {
14206
+ const ThreadItem = ({ children, isActive, className }) => {
14267
14207
  return /* @__PURE__ */ jsx(
14268
14208
  "li",
14269
14209
  {
14270
14210
  className: clsx(
14271
14211
  "border-b-sm border-border1 hover:bg-surface3 group flex h-[54px] items-center justify-between gap-2 px-3 py-2",
14272
- isActive && "bg-surface4"
14212
+ isActive && "bg-surface4",
14213
+ className
14273
14214
  ),
14274
14215
  children
14275
14216
  }
@@ -14366,7 +14307,7 @@ const ChatThreads = ({ threads, isLoading, threadId, onDelete, resourceId, resou
14366
14307
  /* @__PURE__ */ jsx(Icon, { className: "bg-surface4 rounded-lg", size: "lg", children: /* @__PURE__ */ jsx(Plus, {}) }),
14367
14308
  "New Chat"
14368
14309
  ] }) }) }),
14369
- threads.length === 0 && /* @__PURE__ */ 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!" }),
14310
+ threads.length === 0 && /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "text-icon3 py-3 px-5", children: "Your conversations will appear here once you start chatting!" }),
14370
14311
  threads.map((thread) => {
14371
14312
  const isActive = thread.id === threadId;
14372
14313
  const threadLink = resourceType === "agent" ? paths.agentThreadLink(resourceId, thread.id) : paths.networkThreadLink(resourceId, thread.id);
@@ -14438,190 +14379,39 @@ const formatDay = (date) => {
14438
14379
  return new Date(date).toLocaleString("en-us", options).replace(",", " at");
14439
14380
  };
14440
14381
 
14441
- const themeClasses = {
14442
- light: "bg-gray-100 border-gray-300 text-gray-700",
14443
- dark: "bg-surface4 border-border1 text-icon6"
14444
- };
14445
- const Kbd = ({ children, theme = "dark" }) => {
14446
- const themeClass = themeClasses[theme];
14447
- return /* @__PURE__ */ jsx("kbd", { className: clsx("border-sm rounded-md px-1 py-0.5 font-mono", themeClass), children });
14448
- };
14449
-
14450
- const Searchbar = ({ onSearch, label, placeholder }) => {
14451
- const id = useId();
14452
- const inputRef = useRef(null);
14453
- useEffect(() => {
14454
- const input = inputRef.current;
14455
- if (!input) return;
14456
- const handleKeyDown = (event) => {
14457
- if (event.key.toLowerCase() === "f" && event.shiftKey && (event.ctrlKey || event.metaKey)) {
14458
- event.preventDefault();
14459
- input.focus();
14460
- }
14461
- };
14462
- window.addEventListener("keydown", handleKeyDown);
14463
- return () => {
14464
- window.removeEventListener("keydown", handleKeyDown);
14465
- };
14466
- }, []);
14467
- const handleSubmit = (e) => {
14468
- e.preventDefault();
14469
- const formData = new FormData(e.target);
14470
- const search = formData.get(id);
14471
- onSearch(search);
14472
- };
14473
- return /* @__PURE__ */ jsxs(
14474
- "form",
14475
- {
14476
- onSubmit: handleSubmit,
14477
- className: "border-sm border-icon-3 flex h-8 w-full items-center gap-2 overflow-hidden rounded-lg pl-2 pr-1",
14478
- children: [
14479
- /* @__PURE__ */ jsx(SearchIcon, { className: "text-icon3 h-4 w-4" }),
14480
- /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
14481
- /* @__PURE__ */ jsx("label", { htmlFor: id, className: "sr-only", children: label }),
14482
- /* @__PURE__ */ jsx(
14483
- "input",
14484
- {
14485
- id,
14486
- type: "text",
14487
- placeholder,
14488
- className: "bg-surface2 text-ui-md placeholder:text-icon-3 block h-8 w-full px-2 -outline-offset-2",
14489
- name: id,
14490
- ref: inputRef
14491
- }
14492
- )
14493
- ] }),
14494
- /* @__PURE__ */ jsx("button", { type: "submit", className: "text-ui-sm text-icon3 flex flex-row items-center gap-1", children: /* @__PURE__ */ jsx(Kbd, { children: "Enter" }) })
14495
- ]
14496
- }
14497
- );
14498
- };
14499
-
14500
- const Entity = ({ children, className, onClick }) => {
14501
- return /* @__PURE__ */ jsx(
14502
- "div",
14503
- {
14504
- tabIndex: onClick ? 0 : void 0,
14505
- onKeyDown: (e) => {
14506
- if (!onClick) return;
14507
- if (e.key === "Enter" || e.key === " ") {
14508
- e.preventDefault();
14509
- onClick?.();
14510
- }
14511
- },
14512
- className: clsx(
14513
- "flex gap-3 group/entity bg-surface3 rounded-lg border-sm border-border1 py-3 px-4",
14514
- onClick && "cursor-pointer hover:bg-surface4 transition-all",
14515
- className
14516
- ),
14517
- onClick,
14518
- children
14519
- }
14520
- );
14521
- };
14522
- const EntityIcon = ({ children, className }) => {
14523
- return /* @__PURE__ */ jsx(Icon, { size: "lg", className: clsx("text-icon3 mt-1", className), children });
14524
- };
14525
- const EntityName = ({ children, className }) => {
14526
- return /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-lg", className: clsx("text-icon6 font-medium", className), children });
14527
- };
14528
- const EntityDescription = ({ children, className }) => {
14529
- return /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: clsx("text-icon3", className), children });
14530
- };
14531
- const EntityContent = ({ children, className }) => {
14532
- return /* @__PURE__ */ jsx("div", { className, children });
14533
- };
14534
-
14535
- const ToolList = ({ tools, agents, isLoading }) => {
14536
- const toolsWithAgents = useMemo(() => prepareAgents(tools, agents), [tools, agents]);
14537
- if (isLoading)
14538
- return /* @__PURE__ */ jsx("div", { className: "max-w-5xl w-full mx-auto px-4 pt-8", children: /* @__PURE__ */ jsx(ToolListSkeleton, {}) });
14539
- return /* @__PURE__ */ jsx(ToolListInner, { toolsWithAgents });
14540
- };
14541
- const ToolListInner = ({ toolsWithAgents }) => {
14542
- const [filteredTools, setFilteredTools] = useState(toolsWithAgents);
14543
- const [value, setValue] = useState("");
14544
- if (filteredTools.length === 0 && !value) return /* @__PURE__ */ jsx(ToolListEmpty, {});
14545
- const handleSearch = (value2) => {
14546
- setValue(value2);
14547
- startTransition(() => {
14548
- setFilteredTools(
14549
- toolsWithAgents.filter(
14550
- (tool) => tool.id.toLowerCase().includes(value2.toLowerCase()) || tool.description.toLowerCase().includes(value2.toLowerCase()) || tool.agents.some(
14551
- (agent) => agent.name.toLowerCase().includes(value2.toLowerCase()) || agent.id.toLowerCase().includes(value2.toLowerCase())
14552
- )
14553
- )
14554
- );
14555
- });
14556
- };
14557
- return /* @__PURE__ */ jsxs("div", { children: [
14558
- /* @__PURE__ */ jsxs("div", { className: "max-w-5xl w-full mx-auto px-4 pt-8", children: [
14559
- /* @__PURE__ */ jsx(Searchbar, { onSearch: handleSearch, label: "Search for a tool", placeholder: "Search for a tool" }),
14560
- filteredTools.length === 0 && /* @__PURE__ */ jsx(Txt, { as: "p", className: "text-icon3 py-2", children: "No tools found matching your search." })
14561
- ] }),
14562
- /* @__PURE__ */ 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__ */ jsx(ToolEntity, { tool }, tool.id)) })
14563
- ] });
14564
- };
14565
- const ToolEntity = ({ tool }) => {
14566
- const linkRef = useRef(null);
14382
+ const NameCell$1 = ({ row }) => {
14567
14383
  const { Link, paths } = useLinkComponent();
14568
- const toolLink = tool.agents.length > 0 ? paths.agentToolLink(tool.agents[0].id, tool.id) : paths.toolLink(tool.id);
14569
- return /* @__PURE__ */ jsxs(Entity, { onClick: () => linkRef.current?.click(), children: [
14570
- /* @__PURE__ */ jsx(EntityIcon, { children: /* @__PURE__ */ jsx(ToolsIcon, { className: "group-hover/entity:text-[#ECB047]" }) }),
14571
- /* @__PURE__ */ jsxs(EntityContent, { children: [
14572
- /* @__PURE__ */ jsx(EntityName, { children: /* @__PURE__ */ jsx(Link, { ref: linkRef, href: toolLink, children: tool.id }) }),
14573
- /* @__PURE__ */ jsx(EntityDescription, { children: tool.description }),
14574
- /* @__PURE__ */ jsx("div", { className: "inline-flex flex-wrap gap-2 pt-4", children: tool.agents.map((agent) => {
14575
- return /* @__PURE__ */ jsx(
14576
- Link,
14577
- {
14578
- href: paths.agentToolLink(agent.id, tool.id),
14579
- onClick: (e) => e.stopPropagation(),
14580
- className: "group/link",
14581
- children: /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(AgentIcon, { className: "group-hover/link:text-accent3" }), className: "bg-surface5 ", children: agent.name })
14582
- },
14583
- agent.id
14584
- );
14585
- }) })
14586
- ] })
14587
- ] });
14588
- };
14589
- const ToolListSkeleton = () => {
14590
- return /* @__PURE__ */ jsxs("div", { children: [
14591
- /* @__PURE__ */ jsx("div", { className: "max-w-5xl w-full mx-auto px-4 pt-8", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }) }),
14592
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 xl:grid-cols-3 gap-4 max-w-5xl mx-auto py-8", children: [
14593
- /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" }),
14594
- /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" }),
14595
- /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" })
14596
- ] })
14597
- ] });
14598
- };
14599
- const ToolListEmpty = () => {
14384
+ const tool = row.original;
14600
14385
  return /* @__PURE__ */ jsx(
14601
- EmptyState,
14386
+ EntryCell,
14602
14387
  {
14603
- iconSlot: /* @__PURE__ */ jsx(ToolCoinIcon, {}),
14604
- titleSlot: "Configure Tools",
14605
- descriptionSlot: "Mastra tools are not configured yet. You can find more information in the documentation.",
14606
- actionSlot: /* @__PURE__ */ jsxs(
14607
- Button$1,
14608
- {
14609
- size: "lg",
14610
- className: "w-full",
14611
- variant: "light",
14612
- as: "a",
14613
- href: "https://mastra.ai/en/docs/agents/using-tools-and-mcp",
14614
- target: "_blank",
14615
- children: [
14616
- /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ToolsIcon, {}) }),
14617
- "Docs"
14618
- ]
14619
- }
14620
- )
14388
+ name: /* @__PURE__ */ jsx(Link, { className: "w-full space-y-0", href: paths.toolLink(tool.id), children: tool.id }),
14389
+ description: tool.description
14621
14390
  }
14622
14391
  );
14623
14392
  };
14624
- const prepareAgents = (tools, agents) => {
14393
+ const columns$1 = [
14394
+ {
14395
+ header: "Name",
14396
+ accessorKey: "name",
14397
+ cell: NameCell$1
14398
+ },
14399
+ {
14400
+ header: "Attached entities",
14401
+ accessorKey: "attachedEntities",
14402
+ cell: ({ row }) => {
14403
+ const tool = row.original;
14404
+ const agentsCount = tool.agents.length;
14405
+ return /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsxs(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(AgentIcon, { className: "text-accent1" }), children: [
14406
+ agentsCount,
14407
+ " agent",
14408
+ agentsCount > 1 ? "s" : ""
14409
+ ] }) });
14410
+ }
14411
+ }
14412
+ ];
14413
+
14414
+ const prepareToolsTable = (tools, agents) => {
14625
14415
  const toolsWithAgents = /* @__PURE__ */ new Map();
14626
14416
  const agentsKeys = Object.keys(agents);
14627
14417
  for (const k of agentsKeys) {
@@ -14636,7 +14426,7 @@ const prepareAgents = (tools, agents) => {
14636
14426
  agents: []
14637
14427
  });
14638
14428
  }
14639
- toolsWithAgents.get(tool.id).agents.push({ id: k, name: agent.name });
14429
+ toolsWithAgents.get(tool.id).agents.push({ ...agent, id: k });
14640
14430
  }
14641
14431
  }
14642
14432
  for (const [_, tool] of Object.entries(tools)) {
@@ -14650,6 +14440,67 @@ const prepareAgents = (tools, agents) => {
14650
14440
  return Array.from(toolsWithAgents.values());
14651
14441
  };
14652
14442
 
14443
+ function ToolTable({ tools, agents, isLoading }) {
14444
+ const [search, setSearch] = useState("");
14445
+ const { navigate, paths } = useLinkComponent();
14446
+ const toolData = useMemo(() => prepareToolsTable(tools, agents), [tools, agents]);
14447
+ const table = useReactTable({
14448
+ data: toolData,
14449
+ columns: columns$1,
14450
+ getCoreRowModel: getCoreRowModel()
14451
+ });
14452
+ const ths = table.getHeaderGroups()[0];
14453
+ const rows = table.getRowModel().rows.concat();
14454
+ if (rows.length === 0 && !isLoading) {
14455
+ return /* @__PURE__ */ jsx(EmptyToolsTable, {});
14456
+ }
14457
+ const filteredRows = rows.filter((row) => row.original.id.toLowerCase().includes(search.toLowerCase()));
14458
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
14459
+ /* @__PURE__ */ jsx(SearchbarWrapper, { children: /* @__PURE__ */ jsx(Searchbar, { onSearch: setSearch, label: "Search tools", placeholder: "Search tools" }) }),
14460
+ isLoading ? /* @__PURE__ */ jsx(ToolTableSkeleton, {}) : /* @__PURE__ */ jsx(ScrollableContainer, { children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Table$1, { children: [
14461
+ /* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsx(Th, { style: { width: header.column.getSize() ?? "auto" }, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
14462
+ /* @__PURE__ */ jsx(Tbody, { children: filteredRows.map((row) => {
14463
+ const firstAgent = row.original.agents[0];
14464
+ const link = firstAgent ? paths.agentToolLink(firstAgent.id, row.original.id) : paths.toolLink(row.original.id);
14465
+ return /* @__PURE__ */ jsx(Row, { onClick: () => navigate(link), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id);
14466
+ }) })
14467
+ ] }) }) })
14468
+ ] });
14469
+ }
14470
+ const ToolTableSkeleton = () => /* @__PURE__ */ jsxs(Table$1, { children: [
14471
+ /* @__PURE__ */ jsxs(Thead, { children: [
14472
+ /* @__PURE__ */ jsx(Th, { children: "Name" }),
14473
+ /* @__PURE__ */ jsx(Th, { children: "Used by" })
14474
+ ] }),
14475
+ /* @__PURE__ */ jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxs(Row, { children: [
14476
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
14477
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) })
14478
+ ] }, index)) })
14479
+ ] });
14480
+ const EmptyToolsTable = () => /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx(
14481
+ EmptyState,
14482
+ {
14483
+ iconSlot: /* @__PURE__ */ jsx(ToolCoinIcon, {}),
14484
+ titleSlot: "Configure Tools",
14485
+ descriptionSlot: "Mastra tools are not configured yet. You can find more information in the documentation.",
14486
+ actionSlot: /* @__PURE__ */ jsxs(
14487
+ Button$1,
14488
+ {
14489
+ size: "lg",
14490
+ className: "w-full",
14491
+ variant: "light",
14492
+ as: "a",
14493
+ href: "https://mastra.ai/en/docs/agents/using-tools-and-mcp",
14494
+ target: "_blank",
14495
+ children: [
14496
+ /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ToolsIcon, {}) }),
14497
+ "Docs"
14498
+ ]
14499
+ }
14500
+ )
14501
+ }
14502
+ ) });
14503
+
14653
14504
  function TemplatesTools({
14654
14505
  tagOptions,
14655
14506
  selectedTag,
@@ -15741,10 +15592,10 @@ const Header = ({ children, border = true }) => {
15741
15592
  );
15742
15593
  };
15743
15594
  const HeaderTitle = ({ children }) => {
15744
- return /* @__PURE__ */ jsx(Txt, { as: "h1", variant: "ui-lg", className: "font-medium text-white", children });
15595
+ return /* @__PURE__ */ jsx(Txt, { as: "h1", variant: "ui-lg", className: "font-medium text-white flex items-center gap-2", children });
15745
15596
  };
15746
15597
  const HeaderAction = ({ children }) => {
15747
- return /* @__PURE__ */ jsx("div", { className: "ml-auto", children });
15598
+ return /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center gap-2", children });
15748
15599
  };
15749
15600
  const HeaderGroup = ({ children }) => {
15750
15601
  return /* @__PURE__ */ jsx("div", { className: "gap-lg flex items-center", children });
@@ -17290,7 +17141,11 @@ const Crumb = ({ className, as, isCurrent, ...props }) => {
17290
17141
  Root,
17291
17142
  {
17292
17143
  "aria-current": isCurrent ? "page" : void 0,
17293
- className: clsx("text-ui-lg leading-ui-lg font-medium", isCurrent ? "text-white" : "text-icon3", className),
17144
+ className: clsx(
17145
+ "text-ui-lg leading-ui-lg font-medium flex items-center gap-2",
17146
+ isCurrent ? "text-white" : "text-icon3",
17147
+ className
17148
+ ),
17294
17149
  ...props
17295
17150
  }
17296
17151
  ) }),
@@ -17355,6 +17210,41 @@ const DarkLogo = (props) => /* @__PURE__ */ jsxs("svg", { width: "100", height:
17355
17210
  )
17356
17211
  ] });
17357
17212
 
17213
+ const Entity = ({ children, className, onClick }) => {
17214
+ return /* @__PURE__ */ jsx(
17215
+ "div",
17216
+ {
17217
+ tabIndex: onClick ? 0 : void 0,
17218
+ onKeyDown: (e) => {
17219
+ if (!onClick) return;
17220
+ if (e.key === "Enter" || e.key === " ") {
17221
+ e.preventDefault();
17222
+ onClick?.();
17223
+ }
17224
+ },
17225
+ className: clsx(
17226
+ "flex gap-3 group/entity bg-surface3 rounded-lg border-sm border-border1 py-3 px-4",
17227
+ onClick && "cursor-pointer hover:bg-surface4 transition-all",
17228
+ className
17229
+ ),
17230
+ onClick,
17231
+ children
17232
+ }
17233
+ );
17234
+ };
17235
+ const EntityIcon = ({ children, className }) => {
17236
+ return /* @__PURE__ */ jsx(Icon, { size: "lg", className: clsx("text-icon3 mt-1", className), children });
17237
+ };
17238
+ const EntityName = ({ children, className }) => {
17239
+ return /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-lg", className: clsx("text-icon6 font-medium", className), children });
17240
+ };
17241
+ const EntityDescription = ({ children, className }) => {
17242
+ return /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: clsx("text-icon3", className), children });
17243
+ };
17244
+ const EntityContent = ({ children, className }) => {
17245
+ return /* @__PURE__ */ jsx("div", { className, children });
17246
+ };
17247
+
17358
17248
  function usePolling({
17359
17249
  fetchFn,
17360
17250
  interval = 3e3,
@@ -17762,5 +17652,175 @@ const parseError = (error) => {
17762
17652
  }
17763
17653
  };
17764
17654
 
17765
- export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentsTable, AgentsTableSkeleton, AiIcon, Alert, AlertDescription, AlertDialog, AlertTitle, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, Cell, ChatThreads, CheckIcon, ChevronIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, CommitIcon, CrossIcon, Crumb, DarkLogo, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyAgentsTable, EmptyScorersTable, EmptyState, EmptyWorkflowsTable, Entity, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityMainHeader, EntityName, Entry, EntryCell, EntryList, EntryListItem, EntryListPageHeader, EntryListStatusCell, EntryListTextCell, EntryListToolbar, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, FormActions, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LinkComponentProvider, LogsIcon, MainContentContent, MainContentLayout, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, ModelResetProvider, OpenAIIcon, PageHeader, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupField, RadioGroupItem, RepoIcon, Row, RuntimeContext, RuntimeContextWrapper, ScoreDialog, ScoreIcon, ScorersTable, ScorersTableSkeleton, ScoresTools, SearchField, Searchbar, SelectField, SettingsIcon, SideDialog, SideDialogCodeSection, SideDialogContent, SideDialogFooter, SideDialogFooterGroup, SideDialogHeader, SideDialogHeading, SideDialogKeyValueList, SideDialogSection, SideDialogTop, SlashIcon, SliderField, Tab, TabContent, TabList, Table$1 as Table, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, TextareaField, Th, Thead, ThreadDeleteButton, ThreadInputProvider, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolFallback, ToolList, ToolListEmpty, ToolListSkeleton, ToolsIcon, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineLegend, TraceTimelineSpan, TracesTools, TracesView, TracesViewSkeleton, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowRuns, WorkflowTable, WorkflowTableSkeleton, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, allowedAiSpanAttributes, cleanString, convertWorkflowRunStateToWatchResult, formatDuration, formatHierarchicalSpans, formatOtelTimestamp, formatOtelTimestamp2, getColumnTemplate, getShortId, getSpanTypeUi, mapWorkflowStreamChunkToWatchResult, parseError, providerMapToIcon, spanTypePrefixes, transformKey, useAgentSettings, useCurrentRun, useInView, useLinkComponent, useModelReset, usePlaygroundStore, usePolling, useScorer, useScorers, useScoresByEntityId, useScoresByScorerId, useSpeechRecognition, useThreadInput, useWorkflow, useWorkflowRuns, useWorkingMemory };
17655
+ const useMCPServerTools = (selectedServer) => {
17656
+ const client = useMastraClient();
17657
+ return useQuery({
17658
+ queryKey: ["mcpserver-tools", selectedServer?.id],
17659
+ queryFn: async () => {
17660
+ const response = await client.getMcpServerTools(selectedServer?.id);
17661
+ const fetchedToolsArray = response.tools;
17662
+ const transformedTools = {};
17663
+ fetchedToolsArray.forEach((sdkToolInfo) => {
17664
+ transformedTools[sdkToolInfo.id] = sdkToolInfo;
17665
+ });
17666
+ return transformedTools;
17667
+ },
17668
+ retry: false,
17669
+ refetchOnWindowFocus: false
17670
+ });
17671
+ };
17672
+
17673
+ const NameCell = ({ row }) => {
17674
+ const client = useMastraClient();
17675
+ const mcp = row.original;
17676
+ const { Link, paths } = useLinkComponent();
17677
+ const effectiveBaseUrl = client.options.baseUrl || "http://localhost:4111";
17678
+ const sseUrl = `${effectiveBaseUrl}/api/mcp/${mcp.id}/sse`;
17679
+ return /* @__PURE__ */ jsx(
17680
+ EntryCell,
17681
+ {
17682
+ name: /* @__PURE__ */ jsx(Link, { className: "w-full space-y-0", href: paths.mcpServerLink(row.original.id), children: row.original.name }),
17683
+ description: sseUrl
17684
+ }
17685
+ );
17686
+ };
17687
+ const columns = [
17688
+ {
17689
+ header: "Name",
17690
+ accessorKey: "name",
17691
+ cell: NameCell
17692
+ },
17693
+ {
17694
+ header: "Attached tools",
17695
+ accessorKey: "attachedTools",
17696
+ cell: ({ row }) => {
17697
+ const mcpServer = row.original;
17698
+ const { data: tools, isLoading } = useMCPServerTools(mcpServer);
17699
+ if (isLoading)
17700
+ return /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" }) });
17701
+ const toolsCount = Object.keys(tools || {}).length;
17702
+ const agentToolsCount = Object.keys(tools || {}).filter((tool) => tools?.[tool]?.toolType === "agent").length;
17703
+ const workflowToolsCount = Object.keys(tools || {}).filter((tool) => tools?.[tool]?.toolType === "workflow").length;
17704
+ return /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsxs("span", { className: "flex flex-row gap-2 w-full items-center", children: [
17705
+ /* @__PURE__ */ jsxs(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(AgentIcon, { className: "text-accent1" }), children: [
17706
+ agentToolsCount,
17707
+ " agent",
17708
+ agentToolsCount > 1 ? "s" : ""
17709
+ ] }),
17710
+ /* @__PURE__ */ jsxs(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(ToolsIcon, { className: "text-accent6" }), children: [
17711
+ toolsCount,
17712
+ " tool",
17713
+ toolsCount > 1 ? "s" : ""
17714
+ ] }),
17715
+ /* @__PURE__ */ jsxs(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(WorkflowIcon, { className: "text-accent3" }), children: [
17716
+ workflowToolsCount,
17717
+ " workflow",
17718
+ workflowToolsCount > 1 ? "s" : ""
17719
+ ] })
17720
+ ] }) });
17721
+ }
17722
+ }
17723
+ ];
17724
+
17725
+ function MCPTable({ mcpServers, isLoading }) {
17726
+ const { navigate, paths } = useLinkComponent();
17727
+ const [search, setSearch] = useState("");
17728
+ const table = useReactTable({
17729
+ data: mcpServers,
17730
+ columns,
17731
+ getCoreRowModel: getCoreRowModel()
17732
+ });
17733
+ const ths = table.getHeaderGroups()[0];
17734
+ const rows = table.getRowModel().rows.concat();
17735
+ if (rows.length === 0 && !isLoading) {
17736
+ return /* @__PURE__ */ jsx(EmptyMCPTable, {});
17737
+ }
17738
+ const filteredRows = rows.filter((row) => row.original.name.toLowerCase().includes(search.toLowerCase()));
17739
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
17740
+ /* @__PURE__ */ jsx(SearchbarWrapper, { children: /* @__PURE__ */ jsx(Searchbar, { onSearch: setSearch, label: "Search MCP servers", placeholder: "Search MCP servers" }) }),
17741
+ isLoading ? /* @__PURE__ */ jsx(MCPTableSkeleton, {}) : /* @__PURE__ */ jsx(ScrollableContainer, { children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Table$1, { children: [
17742
+ /* @__PURE__ */ jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsx(Th, { style: { width: header.column.getSize() ?? "auto" }, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
17743
+ /* @__PURE__ */ jsx(Tbody, { children: filteredRows.map((row) => /* @__PURE__ */ jsx(Row, { onClick: () => navigate(paths.mcpServerLink(row.original.id)), children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(React__default.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) })
17744
+ ] }) }) })
17745
+ ] });
17746
+ }
17747
+ const MCPTableSkeleton = () => /* @__PURE__ */ jsxs(Table$1, { children: [
17748
+ /* @__PURE__ */ jsxs(Thead, { children: [
17749
+ /* @__PURE__ */ jsx(Th, { children: "Name" }),
17750
+ /* @__PURE__ */ jsx(Th, { children: "Model" }),
17751
+ /* @__PURE__ */ jsx(Th, { children: "Attached entities" })
17752
+ ] }),
17753
+ /* @__PURE__ */ jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxs(Row, { children: [
17754
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
17755
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) }),
17756
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" }) })
17757
+ ] }, index)) })
17758
+ ] });
17759
+ const EmptyMCPTable = () => /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx(
17760
+ EmptyState,
17761
+ {
17762
+ iconSlot: /* @__PURE__ */ jsx(McpCoinIcon, {}),
17763
+ titleSlot: "Configure MCP servers",
17764
+ descriptionSlot: "MCP servers are not configured yet. You can find more information in the documentation.",
17765
+ actionSlot: /* @__PURE__ */ jsxs(
17766
+ Button$1,
17767
+ {
17768
+ size: "lg",
17769
+ className: "w-full",
17770
+ variant: "light",
17771
+ as: "a",
17772
+ href: "https://mastra.ai/en/docs/getting-started/mcp-docs-server",
17773
+ target: "_blank",
17774
+ children: [
17775
+ /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(McpServerIcon, {}) }),
17776
+ "Docs"
17777
+ ]
17778
+ }
17779
+ )
17780
+ }
17781
+ ) });
17782
+
17783
+ const WorkflowRunList = ({ workflowId, runId }) => {
17784
+ const { Link, paths } = useLinkComponent();
17785
+ const { isLoading, data: runs } = useWorkflowRuns(workflowId);
17786
+ const actualRuns = runs?.runs || [];
17787
+ if (isLoading) {
17788
+ return /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[600px]" }) });
17789
+ }
17790
+ return /* @__PURE__ */ jsx("div", { className: "overflow-y-auto h-full w-full", children: /* @__PURE__ */ jsx(Threads, { children: /* @__PURE__ */ jsxs(ThreadList, { children: [
17791
+ /* @__PURE__ */ jsx(ThreadItem, { children: /* @__PURE__ */ jsx(ThreadLink, { as: Link, to: paths.workflowLink(workflowId), children: /* @__PURE__ */ jsxs("span", { className: "text-accent1 flex items-center gap-4", children: [
17792
+ /* @__PURE__ */ jsx(Icon, { className: "bg-surface4 rounded-lg", size: "lg", children: /* @__PURE__ */ jsx(Plus, {}) }),
17793
+ "New workflow run"
17794
+ ] }) }) }),
17795
+ actualRuns.length === 0 && /* @__PURE__ */ jsx(Txt, { variant: "ui-md", className: "text-icon3 py-3 px-5", children: "Your run history will appear here once you run the workflow" }),
17796
+ actualRuns.map((run) => /* @__PURE__ */ jsx(ThreadItem, { isActive: run.runId === runId, className: "h-auto", children: /* @__PURE__ */ jsxs(ThreadLink, { as: Link, to: paths.workflowRunLink(workflowId, run.runId), children: [
17797
+ typeof run?.snapshot === "object" && /* @__PURE__ */ jsx("div", { className: "pb-1", children: /* @__PURE__ */ jsx(WorkflowRunStatusBadge, { status: run.snapshot.status }) }),
17798
+ /* @__PURE__ */ jsx("span", { className: "truncate max-w-[14rem] text-muted-foreground", children: run.runId }),
17799
+ /* @__PURE__ */ jsx("span", { children: typeof run?.snapshot === "string" ? "" : run?.snapshot?.timestamp ? formatDate(run?.snapshot?.timestamp, "MMM d, yyyy h:mm a") : "" })
17800
+ ] }) }, run.runId))
17801
+ ] }) }) });
17802
+ };
17803
+ const WorkflowRunStatusBadge = ({ status }) => {
17804
+ if (status === "running") {
17805
+ return /* @__PURE__ */ jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(Spinner, {}), children: status });
17806
+ }
17807
+ if (status === "failed") {
17808
+ return /* @__PURE__ */ jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(X, { className: "text-accent2" }), children: status });
17809
+ }
17810
+ if (status === "canceled") {
17811
+ return /* @__PURE__ */ jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(CircleSlash, { className: "text-icon3" }), children: status });
17812
+ }
17813
+ if (status === "pending" || status === "waiting") {
17814
+ return /* @__PURE__ */ jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(Clock$1, { className: "text-icon3" }), children: status });
17815
+ }
17816
+ if (status === "suspended") {
17817
+ return /* @__PURE__ */ jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(CirclePause, { className: "text-accent3" }), children: status });
17818
+ }
17819
+ if (status === "success") {
17820
+ return /* @__PURE__ */ jsx(Badge$1, { variant: "default", icon: /* @__PURE__ */ jsx(Check, { className: "text-accent1" }), children: status });
17821
+ }
17822
+ return /* @__PURE__ */ jsx(Badge$1, { variant: "default", children: status });
17823
+ };
17824
+
17825
+ export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentsTable, AiIcon, Alert, AlertDescription, AlertDialog, AlertTitle, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, Cell, ChatThreads, CheckIcon, ChevronIcon, Collapsible, CollapsibleContent, CollapsibleTrigger, CommitIcon, CrossIcon, Crumb, DarkLogo, DateTimeCell, DateTimePicker, DateTimePickerContent, DbIcon, DebugIcon, DefaultTrigger, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyState, Entity, EntityContent, EntityDescription, EntityHeader, EntityIcon, EntityMainHeader, EntityName, Entry, EntryCell, EntryList, EntryListItem, EntryListPageHeader, EntryListStatusCell, EntryListTextCell, EntryListToolbar, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, FormActions, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LinkComponentProvider, LogsIcon, MCPTable, MainContentContent, MainContentLayout, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, ModelResetProvider, OpenAIIcon, PageHeader, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupField, RadioGroupItem, RepoIcon, Row, RuntimeContext, RuntimeContextWrapper, ScoreDialog, ScoreIcon, ScorersTable, ScoresTools, SearchField, Searchbar, SearchbarWrapper, SelectField, SettingsIcon, SideDialog, SideDialogCodeSection, SideDialogContent, SideDialogFooter, SideDialogFooterGroup, SideDialogHeader, SideDialogHeading, SideDialogKeyValueList, SideDialogSection, SideDialogTop, SlashIcon, SliderField, Tab, TabContent, TabList, Table$1 as Table, Tbody, TemplateFailure, TemplateForm, TemplateInfo, TemplateInstallation, TemplateSuccess, TemplatesList, TemplatesTools, TextAndIcon, TextareaField, Th, Thead, ThreadDeleteButton, ThreadInputProvider, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolFallback, ToolTable, ToolsIcon, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineLegend, TraceTimelineSpan, TracesTools, TracesView, TracesViewSkeleton, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunDetail, WorkflowRunList, WorkflowRunProvider, WorkflowTable, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, allowedAiSpanAttributes, cleanString, convertWorkflowRunStateToStreamResult, formatDuration, formatHierarchicalSpans, formatOtelTimestamp, formatOtelTimestamp2, getColumnTemplate, getShortId, getSpanTypeUi, parseError, providerMapToIcon, spanTypePrefixes, transformKey, useAgentSettings, useCurrentRun, useInView, useLinkComponent, useMCPServerTools, useModelReset, usePlaygroundStore, usePolling, useScorer, useScorers, useScoresByEntityId, useScoresByScorerId, useSpeechRecognition, useThreadInput, useWorkflow, useWorkflowRuns, useWorkingMemory };
17766
17826
  //# sourceMappingURL=index.es.js.map