@mastra/playground-ui 6.7.1 → 6.7.2-alpha.0
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 +15 -0
- package/dist/index.cjs.js +639 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +634 -40
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/ui/autoform/components/CustomArrayField.d.ts +6 -0
- package/dist/src/components/ui/autoform/components/CustomAutoFormField.d.ts +6 -0
- package/dist/src/components/ui/autoform/components/CustomObjectField.d.ts +6 -0
- package/dist/src/components/ui/autoform/components/DiscriminatedUnionField.d.ts +2 -0
- package/dist/src/components/ui/autoform/components/UnionField.d.ts +2 -0
- package/dist/src/components/ui/autoform/utils.d.ts +1 -0
- package/dist/src/components/ui/autoform/zodProvider/default-values.d.ts +3 -0
- package/dist/src/components/ui/autoform/zodProvider/index.d.ts +1 -0
- package/dist/src/components/ui/code-mirror-block.d.ts +2 -0
- package/dist/src/components/ui/copy-button.d.ts +4 -1
- package/dist/src/components/ui/elements/main-sidebar/main-sidebar-nav-link.d.ts +1 -0
- package/dist/src/domains/agents/components/AgentToolPanel.d.ts +5 -0
- package/dist/src/domains/agents/index.d.ts +1 -0
- package/dist/src/domains/mcps/components/MCPDetail.d.ts +12 -0
- package/dist/src/domains/mcps/components/MCPToolPanel.d.ts +5 -0
- package/dist/src/domains/mcps/hooks/index.d.ts +3 -0
- package/dist/src/domains/mcps/hooks/use-mcp-server-tool.d.ts +2 -0
- package/dist/src/domains/mcps/hooks/use-mcp-servers.d.ts +1 -0
- package/dist/src/domains/mcps/index.d.ts +3 -1
- package/dist/src/domains/tools/components/ToolExecutor.d.ts +14 -0
- package/dist/src/domains/tools/components/ToolIcon.d.ts +5 -0
- package/dist/src/domains/tools/components/ToolInformation.d.ts +7 -0
- package/dist/src/domains/tools/components/ToolPanel.d.ts +4 -0
- package/dist/src/domains/tools/components/index.d.ts +4 -0
- package/dist/src/domains/tools/hooks/index.d.ts +1 -0
- package/dist/src/domains/tools/hooks/use-all-tools.d.ts +2 -0
- package/dist/src/domains/tools/index.d.ts +1 -0
- package/dist/src/lib/framework.d.ts +1 -0
- package/package.json +6 -6
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, TriangleAlert,
|
|
3
|
+
import { CheckIcon as CheckIcon$1, CopyIcon, AlertCircle, TriangleAlert, ChevronUpIcon, X, Share2, Check, 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, AudioLinesIcon, StopCircleIcon, FileText, CircleXIcon, Link, CloudUpload, Mic, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, SaveIcon, RefreshCw, ExternalLink, InfoIcon as InfoIcon$1, TriangleAlertIcon, ChevronRightIcon, ArrowLeftIcon, ArrowRightIcon, ChevronsRightIcon, AlignLeftIcon, AlignJustifyIcon, ArrowUpIcon, ArrowDownIcon, CircleAlertIcon, XIcon, PanelRightIcon, GaugeIcon, EyeIcon, ChevronsLeftRightEllipsisIcon, CalculatorIcon, HashIcon, FileInputIcon, FileOutputIcon, ReceiptText, Info, RotateCcw, GripVertical, AlertTriangleIcon, NetworkIcon, WorkflowIcon as WorkflowIcon$1, PackageIcon, GitBranchIcon, PackageOpenIcon, OctagonXIcon, FrownIcon, ChevronUp, ChevronsLeftRight, TimerIcon, ChevronsLeftRightIcon, ChevronFirstIcon, ChevronLastIcon, ArrowRightToLineIcon, CoinsIcon, BracesIcon, CircleGaugeIcon, PanelTopIcon, ListTreeIcon, PanelLeftIcon, CircleSlash, Clock as Clock$1 } from 'lucide-react';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { forwardRef, memo, useState, useEffect, useRef, useCallback, useMemo, createContext, useContext, Fragment as Fragment$1, useId } from 'react';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -24,18 +24,17 @@ 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-Br49332d.js';
|
|
28
27
|
import prettier from 'prettier';
|
|
29
28
|
import prettierPluginBabel from 'prettier/plugins/babel';
|
|
30
29
|
import prettierPluginEstree from 'prettier/plugins/estree';
|
|
31
30
|
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
32
31
|
import jsonSchemaToZod from 'json-schema-to-zod';
|
|
33
32
|
import { parse } from 'superjson';
|
|
34
|
-
import z$
|
|
33
|
+
import z$3, { z, ZodObject, ZodIntersection } from 'zod';
|
|
35
34
|
import { CodeBlock } from 'react-code-block';
|
|
36
35
|
import { create } from 'zustand';
|
|
37
36
|
import { persist } from 'zustand/middleware';
|
|
38
|
-
import { AutoForm as AutoForm$1, buildZodFieldConfig } from '@autoform/react';
|
|
37
|
+
import { useAutoForm, getPathInObject, AutoForm as AutoForm$1, buildZodFieldConfig } from '@autoform/react';
|
|
39
38
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
40
39
|
import { format, isValid, formatDistanceToNow, formatDate, isToday } from 'date-fns';
|
|
41
40
|
import { useDebouncedCallback } from 'use-debounce';
|
|
@@ -43,15 +42,19 @@ import { DayPicker } from 'react-day-picker';
|
|
|
43
42
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
44
43
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
45
44
|
import { v4 } from '@lukeed/uuid';
|
|
45
|
+
import { useFormContext, useFieldArray } from 'react-hook-form';
|
|
46
|
+
import { getLabel } from '@autoform/core';
|
|
46
47
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
47
|
-
import { ZodProvider, getFieldConfigInZodStack
|
|
48
|
+
import { ZodProvider, getFieldConfigInZodStack } from '@autoform/zod/v4';
|
|
48
49
|
import { z as z$1 } from 'zod/v3';
|
|
50
|
+
import z$2 from 'zod/v4';
|
|
49
51
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
50
52
|
import { useMastraClient, mapWorkflowStreamChunkToWatchResult, resolveToChildMessages, useChat, toAssistantUIMessage } from '@mastra/react';
|
|
51
53
|
import { useQuery, useMutation, useQueryClient, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
52
54
|
import './index.css';export * from '@tanstack/react-query';
|
|
53
55
|
import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
54
56
|
import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/runtime-context';
|
|
57
|
+
import { I as IconColors } from './colors-Br49332d.js';
|
|
55
58
|
import Markdown from 'react-markdown';
|
|
56
59
|
import { useShallow } from 'zustand/shallow';
|
|
57
60
|
import { RuntimeContext as RuntimeContext$2 } from '@mastra/core/di';
|
|
@@ -4312,25 +4315,20 @@ function useCopyToClipboard({ text, copyMessage = "Copied to clipboard!" }) {
|
|
|
4312
4315
|
return { isCopied, handleCopy };
|
|
4313
4316
|
}
|
|
4314
4317
|
|
|
4315
|
-
function CopyButton({
|
|
4316
|
-
|
|
4318
|
+
function CopyButton({
|
|
4319
|
+
content,
|
|
4320
|
+
copyMessage,
|
|
4321
|
+
tooltip = "Copy to clipboard",
|
|
4322
|
+
iconSize = "default"
|
|
4323
|
+
}) {
|
|
4324
|
+
const { handleCopy } = useCopyToClipboard({
|
|
4317
4325
|
text: content,
|
|
4318
4326
|
copyMessage
|
|
4319
4327
|
});
|
|
4320
|
-
return /* @__PURE__ */ jsxs(
|
|
4321
|
-
|
|
4322
|
-
{
|
|
4323
|
-
|
|
4324
|
-
size: "icon",
|
|
4325
|
-
className: cn("relative h-6 w-6", className),
|
|
4326
|
-
"aria-label": "Copy to clipboard",
|
|
4327
|
-
onClick: handleCopy,
|
|
4328
|
-
children: [
|
|
4329
|
-
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx(Check, { className: cn("h-4 w-4 transition-transform ease-in-out", isCopied ? "scale-100" : "scale-0") }) }),
|
|
4330
|
-
/* @__PURE__ */ jsx(Copy, { className: cn("h-4 w-4 transition-transform ease-in-out", isCopied ? "scale-0" : "scale-100") })
|
|
4331
|
-
]
|
|
4332
|
-
}
|
|
4333
|
-
);
|
|
4328
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4329
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("button", { onClick: handleCopy, type: "button", children: /* @__PURE__ */ jsx(Icon, { className: "transition-colors hover:bg-surface4 rounded-lg text-icon3 hover:text-icon6", size: iconSize, children: /* @__PURE__ */ jsx(CopyIcon, {}) }) }) }),
|
|
4330
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: tooltip })
|
|
4331
|
+
] });
|
|
4334
4332
|
}
|
|
4335
4333
|
|
|
4336
4334
|
const useCodemirrorTheme$2 = () => {
|
|
@@ -5253,7 +5251,7 @@ const useCodemirrorTheme$1 = () => {
|
|
|
5253
5251
|
fontSize: "0.8rem",
|
|
5254
5252
|
lineHighlight: "transparent",
|
|
5255
5253
|
gutterBackground: "transparent",
|
|
5256
|
-
gutterForeground:
|
|
5254
|
+
gutterForeground: "#939393",
|
|
5257
5255
|
background: "transparent"
|
|
5258
5256
|
},
|
|
5259
5257
|
styles: [{ tag: [tags.className, tags.propertyName] }]
|
|
@@ -6834,6 +6832,145 @@ const RecordField = ({ inputProps, field, error, id }) => {
|
|
|
6834
6832
|
] });
|
|
6835
6833
|
};
|
|
6836
6834
|
|
|
6835
|
+
const CustomObjectField = ({ field, path }) => {
|
|
6836
|
+
const { uiComponents } = useAutoForm();
|
|
6837
|
+
return /* @__PURE__ */ jsx(uiComponents.ObjectWrapper, { label: getLabel(field), field, children: Object.entries(field.schema).map(([_key, subField]) => /* @__PURE__ */ jsx(
|
|
6838
|
+
CustomAutoFormField,
|
|
6839
|
+
{
|
|
6840
|
+
field: subField,
|
|
6841
|
+
path: [...path, subField.key]
|
|
6842
|
+
},
|
|
6843
|
+
`${path.join(".")}.${subField.key}`
|
|
6844
|
+
)) });
|
|
6845
|
+
};
|
|
6846
|
+
|
|
6847
|
+
const CustomArrayField = ({ field, path }) => {
|
|
6848
|
+
const { uiComponents } = useAutoForm();
|
|
6849
|
+
const { control } = useFormContext();
|
|
6850
|
+
const { fields, append, remove } = useFieldArray({
|
|
6851
|
+
control,
|
|
6852
|
+
name: path.join(".")
|
|
6853
|
+
});
|
|
6854
|
+
const subFieldType = field.schema?.[0]?.type;
|
|
6855
|
+
let defaultValue;
|
|
6856
|
+
if (subFieldType === "object") {
|
|
6857
|
+
defaultValue = {};
|
|
6858
|
+
} else if (subFieldType === "array") {
|
|
6859
|
+
defaultValue = [];
|
|
6860
|
+
} else {
|
|
6861
|
+
defaultValue = null;
|
|
6862
|
+
}
|
|
6863
|
+
return /* @__PURE__ */ jsx(uiComponents.ArrayWrapper, { label: getLabel(field), field, onAddItem: () => append(defaultValue), children: fields.map((item, index) => /* @__PURE__ */ jsx(uiComponents.ArrayElementWrapper, { onRemove: () => remove(index), index, children: /* @__PURE__ */ jsx(CustomAutoFormField, { field: field.schema[0], path: [...path, index.toString()] }) }, item.id)) });
|
|
6864
|
+
};
|
|
6865
|
+
|
|
6866
|
+
const CustomAutoFormField = ({ field, path }) => {
|
|
6867
|
+
const { formComponents, uiComponents } = useAutoForm();
|
|
6868
|
+
const {
|
|
6869
|
+
register,
|
|
6870
|
+
formState: { errors },
|
|
6871
|
+
getValues
|
|
6872
|
+
} = useFormContext();
|
|
6873
|
+
const fullPath = path.join(".");
|
|
6874
|
+
const error = getPathInObject(errors, path)?.message;
|
|
6875
|
+
const value = getValues(fullPath);
|
|
6876
|
+
const FieldWrapper = field.fieldConfig?.fieldWrapper || uiComponents.FieldWrapper;
|
|
6877
|
+
let FieldComponent = () => /* @__PURE__ */ jsx(
|
|
6878
|
+
uiComponents.ErrorMessage,
|
|
6879
|
+
{
|
|
6880
|
+
error: `[AutoForm Configuration Error] No component found for type "${field.type}" nor a fallback`
|
|
6881
|
+
}
|
|
6882
|
+
);
|
|
6883
|
+
if (field.type === "array") {
|
|
6884
|
+
FieldComponent = CustomArrayField;
|
|
6885
|
+
} else if (field.type === "object") {
|
|
6886
|
+
FieldComponent = CustomObjectField;
|
|
6887
|
+
} else if (field.type in formComponents) {
|
|
6888
|
+
FieldComponent = formComponents[field.type];
|
|
6889
|
+
} else if ("fallback" in formComponents) {
|
|
6890
|
+
FieldComponent = formComponents.fallback;
|
|
6891
|
+
}
|
|
6892
|
+
return /* @__PURE__ */ jsx(FieldWrapper, { label: getLabel(field), error, id: fullPath, field, children: /* @__PURE__ */ jsx(
|
|
6893
|
+
FieldComponent,
|
|
6894
|
+
{
|
|
6895
|
+
label: getLabel(field),
|
|
6896
|
+
field,
|
|
6897
|
+
value,
|
|
6898
|
+
error,
|
|
6899
|
+
id: fullPath,
|
|
6900
|
+
path,
|
|
6901
|
+
inputProps: {
|
|
6902
|
+
required: field.required,
|
|
6903
|
+
error,
|
|
6904
|
+
key: `${fullPath}-input`,
|
|
6905
|
+
...field.fieldConfig?.inputProps,
|
|
6906
|
+
...register(fullPath)
|
|
6907
|
+
}
|
|
6908
|
+
},
|
|
6909
|
+
fullPath
|
|
6910
|
+
) });
|
|
6911
|
+
};
|
|
6912
|
+
|
|
6913
|
+
const UnionField = ({ field, inputProps }) => {
|
|
6914
|
+
const path = inputProps.name?.split(".") ?? [];
|
|
6915
|
+
return field.schema?.map((schema, index) => {
|
|
6916
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
6917
|
+
/* @__PURE__ */ jsx(CustomAutoFormField, { field: schema, path }, path.join(".")),
|
|
6918
|
+
index < (field.schema?.length ?? 0) - 1 && /* @__PURE__ */ jsx(Txt, { variant: "ui-xs", className: "text-center", children: "OR" })
|
|
6919
|
+
] }, schema.key);
|
|
6920
|
+
});
|
|
6921
|
+
};
|
|
6922
|
+
|
|
6923
|
+
const DiscriminatedUnionField = ({ field, path }) => {
|
|
6924
|
+
const { watch } = useFormContext();
|
|
6925
|
+
const fullPath = path.join(".");
|
|
6926
|
+
const value = watch(fullPath);
|
|
6927
|
+
const allSchemas = field.schema?.flatMap((schema) => schema.schema || []) || [];
|
|
6928
|
+
const literalSchemas = allSchemas?.filter((schema) => schema.fieldConfig?.customData?.isLiteral) || [];
|
|
6929
|
+
const firstLiteralSchema = literalSchemas[0];
|
|
6930
|
+
const literalSchemaField = literalSchemas?.reduce(
|
|
6931
|
+
(acc, schema) => {
|
|
6932
|
+
const optionValues = (schema.fieldConfig?.customData?.literalValues ?? []).map(
|
|
6933
|
+
(value2) => [value2, value2]
|
|
6934
|
+
);
|
|
6935
|
+
acc.options?.push(...optionValues);
|
|
6936
|
+
return acc;
|
|
6937
|
+
},
|
|
6938
|
+
{
|
|
6939
|
+
key: firstLiteralSchema.key,
|
|
6940
|
+
required: firstLiteralSchema.required,
|
|
6941
|
+
type: "select",
|
|
6942
|
+
default: firstLiteralSchema.default,
|
|
6943
|
+
description: firstLiteralSchema.description,
|
|
6944
|
+
options: [],
|
|
6945
|
+
fieldConfig: firstLiteralSchema.fieldConfig
|
|
6946
|
+
}
|
|
6947
|
+
);
|
|
6948
|
+
const otherFieldSchemas = field.schema?.reduce(
|
|
6949
|
+
(acc, schema) => {
|
|
6950
|
+
const literalSchema = schema.schema?.find((schema2) => schema2.fieldConfig?.customData?.isLiteral);
|
|
6951
|
+
const literalSchemaValue = literalSchema?.fieldConfig?.customData?.literalValues?.[0];
|
|
6952
|
+
const otherSchemas = schema.schema?.filter((schema2) => schema2.key !== literalSchema?.key) ?? [];
|
|
6953
|
+
if (literalSchemaValue) {
|
|
6954
|
+
acc[literalSchemaValue] = otherSchemas;
|
|
6955
|
+
}
|
|
6956
|
+
return acc;
|
|
6957
|
+
},
|
|
6958
|
+
{}
|
|
6959
|
+
);
|
|
6960
|
+
const literalFieldValue = value?.[literalSchemaField.key];
|
|
6961
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
6962
|
+
/* @__PURE__ */ jsx(
|
|
6963
|
+
CustomAutoFormField,
|
|
6964
|
+
{
|
|
6965
|
+
field: literalSchemaField,
|
|
6966
|
+
path: [...path, literalSchemaField.key]
|
|
6967
|
+
},
|
|
6968
|
+
`${fullPath}.${literalSchemaField.key}`
|
|
6969
|
+
),
|
|
6970
|
+
literalFieldValue && otherFieldSchemas?.[literalFieldValue] && otherFieldSchemas[literalFieldValue].map((schema) => /* @__PURE__ */ jsx(CustomAutoFormField, { field: schema, path: [...path, schema.key] }, `${fullPath}.${schema.key}`))
|
|
6971
|
+
] }, field.key);
|
|
6972
|
+
};
|
|
6973
|
+
|
|
6837
6974
|
const ShadcnUIComponents = {
|
|
6838
6975
|
Form,
|
|
6839
6976
|
FieldWrapper,
|
|
@@ -6861,6 +6998,8 @@ function AutoForm({
|
|
|
6861
6998
|
date: (props2) => /* @__PURE__ */ jsx(DateField, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
6862
6999
|
select: (props2) => /* @__PURE__ */ jsx(SelectField$1, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
6863
7000
|
record: (props2) => /* @__PURE__ */ jsx(RecordField, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
7001
|
+
union: (props2) => /* @__PURE__ */ jsx(UnionField, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
7002
|
+
"discriminated-union": (props2) => /* @__PURE__ */ jsx(DiscriminatedUnionField, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
6864
7003
|
...formComponents
|
|
6865
7004
|
}
|
|
6866
7005
|
}
|
|
@@ -6868,6 +7007,39 @@ function AutoForm({
|
|
|
6868
7007
|
}
|
|
6869
7008
|
|
|
6870
7009
|
buildZodFieldConfig();
|
|
7010
|
+
function removeEmptyValues(values) {
|
|
7011
|
+
const result = {};
|
|
7012
|
+
for (const key in values) {
|
|
7013
|
+
const value = values[key];
|
|
7014
|
+
if ([null, void 0, "", [], {}].includes(value)) {
|
|
7015
|
+
continue;
|
|
7016
|
+
}
|
|
7017
|
+
if (Array.isArray(value)) {
|
|
7018
|
+
const newArray = value.map((item) => {
|
|
7019
|
+
if (typeof item === "object") {
|
|
7020
|
+
const cleanedItem = removeEmptyValues(item);
|
|
7021
|
+
if (Object.keys(cleanedItem).length > 0) {
|
|
7022
|
+
return cleanedItem;
|
|
7023
|
+
}
|
|
7024
|
+
return null;
|
|
7025
|
+
}
|
|
7026
|
+
return item;
|
|
7027
|
+
});
|
|
7028
|
+
const filteredArray = newArray.filter((item) => item !== null);
|
|
7029
|
+
if (filteredArray.length > 0) {
|
|
7030
|
+
result[key] = filteredArray;
|
|
7031
|
+
}
|
|
7032
|
+
} else if (typeof value === "object") {
|
|
7033
|
+
const cleanedValue = removeEmptyValues(value);
|
|
7034
|
+
if (Object.keys(cleanedValue).length > 0) {
|
|
7035
|
+
result[key] = cleanedValue;
|
|
7036
|
+
}
|
|
7037
|
+
} else {
|
|
7038
|
+
result[key] = value;
|
|
7039
|
+
}
|
|
7040
|
+
}
|
|
7041
|
+
return result;
|
|
7042
|
+
}
|
|
6871
7043
|
|
|
6872
7044
|
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
6873
7045
|
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { ref, className: clsx(labelVariants(), className), ...props }));
|
|
@@ -6894,9 +7066,50 @@ function inferFieldType(schema, fieldConfig) {
|
|
|
6894
7066
|
if (schema instanceof z$1.ZodNativeEnum) return "select";
|
|
6895
7067
|
if (schema instanceof z.ZodArray) return "array";
|
|
6896
7068
|
if (schema instanceof z.ZodRecord) return "record";
|
|
7069
|
+
if (schema instanceof z.ZodUnion) {
|
|
7070
|
+
const options = schema._zod.def.options;
|
|
7071
|
+
const hasLiteral = options.every((option) => {
|
|
7072
|
+
if ("shape" in option._zod.def) {
|
|
7073
|
+
return Object.values(option._zod.def.shape).some(
|
|
7074
|
+
(value) => value instanceof z.ZodLiteral
|
|
7075
|
+
);
|
|
7076
|
+
}
|
|
7077
|
+
return false;
|
|
7078
|
+
});
|
|
7079
|
+
if (hasLiteral) {
|
|
7080
|
+
return "discriminated-union";
|
|
7081
|
+
}
|
|
7082
|
+
return "union";
|
|
7083
|
+
}
|
|
6897
7084
|
return "string";
|
|
6898
7085
|
}
|
|
6899
7086
|
|
|
7087
|
+
function getDefaultValueInZodStack(schema) {
|
|
7088
|
+
if (schema instanceof z$2.core.$ZodDefault) {
|
|
7089
|
+
return schema._zod.def.defaultValue;
|
|
7090
|
+
} else if ("innerType" in schema._zod.def) {
|
|
7091
|
+
return getDefaultValueInZodStack(schema._zod.def.innerType);
|
|
7092
|
+
} else if ("shape" in schema._zod.def) {
|
|
7093
|
+
return getDefaultValues(schema);
|
|
7094
|
+
} else if ("left" in schema._zod.def && "right" in schema._zod.def) {
|
|
7095
|
+
const left = getDefaultValues(schema._zod.def.left);
|
|
7096
|
+
const right = getDefaultValues(schema._zod.def.right);
|
|
7097
|
+
return { ...left, ...right };
|
|
7098
|
+
}
|
|
7099
|
+
return void 0;
|
|
7100
|
+
}
|
|
7101
|
+
function getDefaultValues(schema) {
|
|
7102
|
+
const shape = schema._zod.def.shape;
|
|
7103
|
+
const defaultValues = {};
|
|
7104
|
+
for (const [key, field] of Object.entries(shape)) {
|
|
7105
|
+
const defaultValue = getDefaultValueInZodStack(field);
|
|
7106
|
+
if (defaultValue !== void 0) {
|
|
7107
|
+
defaultValues[key] = defaultValue;
|
|
7108
|
+
}
|
|
7109
|
+
}
|
|
7110
|
+
return defaultValues;
|
|
7111
|
+
}
|
|
7112
|
+
|
|
6900
7113
|
function parseField(key, schema) {
|
|
6901
7114
|
const baseSchema = getBaseSchema(schema);
|
|
6902
7115
|
const fieldConfig = getFieldConfigInZodStack(schema);
|
|
@@ -6915,11 +7128,16 @@ function parseField(key, schema) {
|
|
|
6915
7128
|
if (baseSchema instanceof z$1.ZodObject || baseSchema instanceof z.ZodObject) {
|
|
6916
7129
|
subSchema = Object.entries(baseSchema.shape).map(([key2, field]) => parseField(key2, field));
|
|
6917
7130
|
}
|
|
7131
|
+
if (baseSchema instanceof z$1.ZodUnion || baseSchema instanceof z.ZodUnion) {
|
|
7132
|
+
subSchema = Object.entries(baseSchema.def.options).map(([key2, field]) => {
|
|
7133
|
+
return parseField(key2, field);
|
|
7134
|
+
});
|
|
7135
|
+
}
|
|
6918
7136
|
if (baseSchema instanceof z$1.ZodIntersection || baseSchema instanceof z.ZodIntersection) {
|
|
6919
|
-
const subSchemaLeft = Object.entries(baseSchema.
|
|
7137
|
+
const subSchemaLeft = Object.entries(baseSchema.def.left.shape).map(
|
|
6920
7138
|
([key2, field]) => parseField(key2, field)
|
|
6921
7139
|
);
|
|
6922
|
-
const subSchemaRight = Object.entries(baseSchema.
|
|
7140
|
+
const subSchemaRight = Object.entries(baseSchema.def.right.shape).map(
|
|
6923
7141
|
([key2, field]) => parseField(key2, field)
|
|
6924
7142
|
);
|
|
6925
7143
|
subSchema = [...subSchemaLeft, ...subSchemaRight];
|
|
@@ -6927,13 +7145,21 @@ function parseField(key, schema) {
|
|
|
6927
7145
|
if (baseSchema instanceof z$1.ZodArray || baseSchema instanceof z.ZodArray) {
|
|
6928
7146
|
subSchema = [parseField("0", baseSchema._zod.def.element)];
|
|
6929
7147
|
}
|
|
7148
|
+
const isLiteral = baseSchema instanceof z.ZodLiteral;
|
|
7149
|
+
const literalValues = isLiteral ? baseSchema._zod.def.values : void 0;
|
|
6930
7150
|
return {
|
|
6931
7151
|
key,
|
|
6932
7152
|
type,
|
|
6933
7153
|
required: !schema.optional(),
|
|
6934
7154
|
default: defaultValue,
|
|
6935
7155
|
description: baseSchema.description,
|
|
6936
|
-
fieldConfig
|
|
7156
|
+
fieldConfig: isLiteral || Object.keys(fieldConfig ?? {})?.length > 0 ? {
|
|
7157
|
+
...fieldConfig,
|
|
7158
|
+
customData: {
|
|
7159
|
+
...fieldConfig?.customData ?? {},
|
|
7160
|
+
...isLiteral ? { isLiteral, literalValues } : {}
|
|
7161
|
+
}
|
|
7162
|
+
} : void 0,
|
|
6937
7163
|
options: optionValues,
|
|
6938
7164
|
schema: subSchema
|
|
6939
7165
|
};
|
|
@@ -6958,8 +7184,12 @@ class CustomZodProvider extends ZodProvider {
|
|
|
6958
7184
|
super(schema);
|
|
6959
7185
|
this._schema = schema;
|
|
6960
7186
|
}
|
|
7187
|
+
getDefaultValues() {
|
|
7188
|
+
return getDefaultValues(this._schema);
|
|
7189
|
+
}
|
|
6961
7190
|
validateSchema(values) {
|
|
6962
|
-
const
|
|
7191
|
+
const cleanedValues = removeEmptyValues(values);
|
|
7192
|
+
const result = super.validateSchema(cleanedValues);
|
|
6963
7193
|
return result;
|
|
6964
7194
|
}
|
|
6965
7195
|
parseSchema() {
|
|
@@ -6992,10 +7222,10 @@ function DynamicForm({
|
|
|
6992
7222
|
}
|
|
6993
7223
|
const normalizedSchema = (schema2) => {
|
|
6994
7224
|
if (isEmptyZodObject(schema2)) {
|
|
6995
|
-
return z$
|
|
7225
|
+
return z$3.object({});
|
|
6996
7226
|
}
|
|
6997
7227
|
if (isNotZodObject) {
|
|
6998
|
-
return z$
|
|
7228
|
+
return z$3.object({
|
|
6999
7229
|
"": schema2
|
|
7000
7230
|
});
|
|
7001
7231
|
}
|
|
@@ -7668,6 +7898,7 @@ const LinkComponentContext = createContext({
|
|
|
7668
7898
|
scorerLink: () => "",
|
|
7669
7899
|
toolLink: () => "",
|
|
7670
7900
|
mcpServerLink: () => "",
|
|
7901
|
+
mcpServerToolLink: () => "",
|
|
7671
7902
|
workflowRunLink: () => ""
|
|
7672
7903
|
}
|
|
7673
7904
|
});
|
|
@@ -13199,7 +13430,7 @@ function MainSidebarNavLink({
|
|
|
13199
13430
|
className
|
|
13200
13431
|
}) {
|
|
13201
13432
|
const { Link } = useLinkComponent();
|
|
13202
|
-
const
|
|
13433
|
+
const isCollapsed = state === "collapsed";
|
|
13203
13434
|
const isFeatured = link?.variant === "featured";
|
|
13204
13435
|
const linkParams = link?.url?.startsWith("http") ? { target: "_blank", rel: "noreferrer" } : {};
|
|
13205
13436
|
return /* @__PURE__ */ jsx(
|
|
@@ -13213,22 +13444,31 @@ function MainSidebarNavLink({
|
|
|
13213
13444
|
{
|
|
13214
13445
|
"[&>a]:text-icon5 [&>a]:bg-surface3": isActive,
|
|
13215
13446
|
"[&_svg]:text-icon5": isActive,
|
|
13216
|
-
"[&>a]:justify-start ":
|
|
13217
|
-
"[&_svg]:text-icon3":
|
|
13447
|
+
"[&>a]:justify-start ": !isCollapsed,
|
|
13448
|
+
"[&_svg]:text-icon3": isCollapsed,
|
|
13218
13449
|
"[&>a]:rounded-md [&>a]:my-[0.5rem] [&>a]:bg-accent1/75 [&>a:hover]:bg-accent1/85 [&>a]:text-black [&>a:hover]:text-black": isFeatured,
|
|
13219
|
-
"[&_svg]:text-black/75": isFeatured
|
|
13450
|
+
"[&_svg]:text-black/75 [&>a:hover_svg]:text-black": isFeatured
|
|
13220
13451
|
},
|
|
13221
13452
|
className
|
|
13222
13453
|
),
|
|
13223
|
-
children: link ? /* @__PURE__ */
|
|
13224
|
-
|
|
13225
|
-
|
|
13226
|
-
/* @__PURE__ */ jsx(
|
|
13227
|
-
|
|
13228
|
-
|
|
13454
|
+
children: link ? /* @__PURE__ */ jsx(Fragment, { children: isCollapsed || link.tooltipMsg ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
13455
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Link, { href: link.url, ...linkParams, children: [
|
|
13456
|
+
link.icon && link.icon,
|
|
13457
|
+
isCollapsed ? /* @__PURE__ */ jsx(VisuallyHidden$1, { children: link.name }) : link.name,
|
|
13458
|
+
" ",
|
|
13459
|
+
children
|
|
13460
|
+
] }) }),
|
|
13461
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", align: "center", className: "bg-border1 text-icon6 ml-[1rem]", children: link.tooltipMsg ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13462
|
+
isCollapsed && `${link.name} | `,
|
|
13463
|
+
" ",
|
|
13464
|
+
link.tooltipMsg
|
|
13465
|
+
] }) : link.name })
|
|
13466
|
+
] }) : /* @__PURE__ */ jsxs(Link, { href: link.url, ...linkParams, children: [
|
|
13467
|
+
link.icon && link.icon,
|
|
13468
|
+
isCollapsed ? /* @__PURE__ */ jsx(VisuallyHidden$1, { children: link.name }) : link.name,
|
|
13229
13469
|
" ",
|
|
13230
13470
|
children
|
|
13231
|
-
] }) : children
|
|
13471
|
+
] }) }) : children
|
|
13232
13472
|
}
|
|
13233
13473
|
);
|
|
13234
13474
|
}
|
|
@@ -14844,6 +15084,86 @@ const useExecuteAgentTool = () => {
|
|
|
14844
15084
|
});
|
|
14845
15085
|
};
|
|
14846
15086
|
|
|
15087
|
+
const ToolIconMap = {
|
|
15088
|
+
agent: AgentIcon,
|
|
15089
|
+
workflow: WorkflowIcon,
|
|
15090
|
+
tool: ToolsIcon
|
|
15091
|
+
};
|
|
15092
|
+
|
|
15093
|
+
const ToolInformation = ({ toolDescription, toolId, toolType }) => {
|
|
15094
|
+
const ToolIconComponent = ToolIconMap[toolType || "tool"];
|
|
15095
|
+
return /* @__PURE__ */ jsx("div", { className: "p-5 border-b-sm border-border1", children: /* @__PURE__ */ jsxs("div", { className: "text-icon6 flex gap-2", children: [
|
|
15096
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Icon, { size: "lg", className: "bg-surface4 rounded-md p-1", children: /* @__PURE__ */ jsx(ToolIconComponent, {}) }) }),
|
|
15097
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-4 justify-between w-full min-w-0", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
15098
|
+
/* @__PURE__ */ jsx(Txt, { variant: "header-md", as: "h2", className: "font-medium truncate", children: toolId }),
|
|
15099
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-sm", className: "text-icon3", children: toolDescription })
|
|
15100
|
+
] }) })
|
|
15101
|
+
] }) });
|
|
15102
|
+
};
|
|
15103
|
+
|
|
15104
|
+
const ToolExecutor = ({
|
|
15105
|
+
isExecutingTool,
|
|
15106
|
+
zodInputSchema,
|
|
15107
|
+
handleExecuteTool,
|
|
15108
|
+
executionResult: result,
|
|
15109
|
+
errorString,
|
|
15110
|
+
toolDescription,
|
|
15111
|
+
toolId,
|
|
15112
|
+
toolType
|
|
15113
|
+
}) => {
|
|
15114
|
+
const theme = useCodemirrorTheme$1();
|
|
15115
|
+
const code = JSON.stringify(result ?? {}, null, 2);
|
|
15116
|
+
return /* @__PURE__ */ jsxs(MainContentContent, { hasLeftServiceColumn: true, className: "relative", children: [
|
|
15117
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-surface2 border-r-sm border-border1 w-[20rem]", children: [
|
|
15118
|
+
/* @__PURE__ */ jsx(ToolInformation, { toolDescription, toolId, toolType }),
|
|
15119
|
+
/* @__PURE__ */ jsx("div", { className: "p-5 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
15120
|
+
DynamicForm,
|
|
15121
|
+
{
|
|
15122
|
+
isSubmitLoading: isExecutingTool,
|
|
15123
|
+
schema: zodInputSchema,
|
|
15124
|
+
onSubmit: (data) => {
|
|
15125
|
+
handleExecuteTool(data);
|
|
15126
|
+
},
|
|
15127
|
+
className: "h-auto pb-7"
|
|
15128
|
+
}
|
|
15129
|
+
) })
|
|
15130
|
+
] }),
|
|
15131
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-4 right-4 z-10", children: /* @__PURE__ */ jsx(CopyButton, { content: code, tooltip: "Copy JSON result to clipboard" }) }),
|
|
15132
|
+
/* @__PURE__ */ jsx("div", { className: "p-5 h-full relative overflow-x-auto overflow-y-auto", children: /* @__PURE__ */ jsx(CodeMirror, { value: errorString || code, editable: true, theme, extensions: [jsonLanguage] }) })
|
|
15133
|
+
] });
|
|
15134
|
+
};
|
|
15135
|
+
|
|
15136
|
+
const AgentToolPanel = ({ toolId, agentId }) => {
|
|
15137
|
+
const { data: agent, isLoading: isAgentLoading } = useAgent(agentId);
|
|
15138
|
+
const tool = Object.values(agent?.tools ?? {}).find((tool2) => tool2.id === toolId);
|
|
15139
|
+
const { mutateAsync: executeTool, isPending: isExecutingTool, data: result } = useExecuteAgentTool();
|
|
15140
|
+
const { runtimeContext: playgroundRuntimeContext } = usePlaygroundStore();
|
|
15141
|
+
const handleExecuteTool = async (data) => {
|
|
15142
|
+
if (!tool) return;
|
|
15143
|
+
await executeTool({
|
|
15144
|
+
agentId,
|
|
15145
|
+
toolId: tool.id,
|
|
15146
|
+
input: data,
|
|
15147
|
+
playgroundRuntimeContext
|
|
15148
|
+
});
|
|
15149
|
+
};
|
|
15150
|
+
const zodInputSchema = tool?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(tool?.inputSchema))) : z.object({});
|
|
15151
|
+
if (isAgentLoading) return null;
|
|
15152
|
+
if (!tool)
|
|
15153
|
+
return /* @__PURE__ */ jsx("div", { className: "py-12 text-center px-6", children: /* @__PURE__ */ jsx(Txt, { variant: "header-md", className: "text-icon3", children: "Tool not found" }) });
|
|
15154
|
+
return /* @__PURE__ */ jsx(
|
|
15155
|
+
ToolExecutor,
|
|
15156
|
+
{
|
|
15157
|
+
executionResult: result,
|
|
15158
|
+
isExecutingTool,
|
|
15159
|
+
zodInputSchema,
|
|
15160
|
+
handleExecuteTool,
|
|
15161
|
+
toolDescription: tool.description,
|
|
15162
|
+
toolId: tool.id
|
|
15163
|
+
}
|
|
15164
|
+
);
|
|
15165
|
+
};
|
|
15166
|
+
|
|
14847
15167
|
const NameCell$1 = ({ row }) => {
|
|
14848
15168
|
const { Link, paths } = useLinkComponent();
|
|
14849
15169
|
const tool = row.original;
|
|
@@ -14991,6 +15311,52 @@ const useExecuteTool = () => {
|
|
|
14991
15311
|
});
|
|
14992
15312
|
};
|
|
14993
15313
|
|
|
15314
|
+
const useTools = () => {
|
|
15315
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
15316
|
+
const client = useMastraClient();
|
|
15317
|
+
return useQuery({
|
|
15318
|
+
queryKey: ["tools"],
|
|
15319
|
+
queryFn: () => client.getTools(runtimeContext)
|
|
15320
|
+
});
|
|
15321
|
+
};
|
|
15322
|
+
const useTool = (toolId) => {
|
|
15323
|
+
const client = useMastraClient();
|
|
15324
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
15325
|
+
return useQuery({
|
|
15326
|
+
queryKey: ["tool", toolId],
|
|
15327
|
+
queryFn: () => client.getTool(toolId).details(runtimeContext)
|
|
15328
|
+
});
|
|
15329
|
+
};
|
|
15330
|
+
|
|
15331
|
+
const ToolPanel = ({ toolId }) => {
|
|
15332
|
+
const { data: tool, isLoading } = useTool(toolId);
|
|
15333
|
+
const { mutateAsync: executeTool, isPending: isExecuting, data: result } = useExecuteTool();
|
|
15334
|
+
const { runtimeContext: playgroundRuntimeContext } = usePlaygroundStore();
|
|
15335
|
+
const handleExecuteTool = async (data) => {
|
|
15336
|
+
if (!tool) return;
|
|
15337
|
+
return executeTool({
|
|
15338
|
+
toolId: tool.id,
|
|
15339
|
+
input: data,
|
|
15340
|
+
runtimeContext: playgroundRuntimeContext
|
|
15341
|
+
});
|
|
15342
|
+
};
|
|
15343
|
+
const zodInputSchema = tool?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(parse(tool?.inputSchema))) : z.object({});
|
|
15344
|
+
if (isLoading) return null;
|
|
15345
|
+
if (!tool)
|
|
15346
|
+
return /* @__PURE__ */ jsx("div", { className: "py-12 text-center px-6", children: /* @__PURE__ */ jsx(Txt, { variant: "header-md", className: "text-icon3", children: "Tool not found" }) });
|
|
15347
|
+
return /* @__PURE__ */ jsx(
|
|
15348
|
+
ToolExecutor,
|
|
15349
|
+
{
|
|
15350
|
+
executionResult: result,
|
|
15351
|
+
isExecutingTool: isExecuting,
|
|
15352
|
+
zodInputSchema,
|
|
15353
|
+
handleExecuteTool,
|
|
15354
|
+
toolDescription: tool.description,
|
|
15355
|
+
toolId: tool.id
|
|
15356
|
+
}
|
|
15357
|
+
);
|
|
15358
|
+
};
|
|
15359
|
+
|
|
14994
15360
|
function TemplatesTools({
|
|
14995
15361
|
tagOptions,
|
|
14996
15362
|
selectedTag,
|
|
@@ -18543,6 +18909,234 @@ const EmptyMCPTable = () => /* @__PURE__ */ jsx("div", { className: "flex h-full
|
|
|
18543
18909
|
}
|
|
18544
18910
|
) });
|
|
18545
18911
|
|
|
18912
|
+
const useMCPServers = () => {
|
|
18913
|
+
const client = useMastraClient();
|
|
18914
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
18915
|
+
return useQuery({
|
|
18916
|
+
queryKey: ["mcp-servers"],
|
|
18917
|
+
queryFn: async () => {
|
|
18918
|
+
const mcpServers = (await client.getMcpServers(runtimeContext)).servers;
|
|
18919
|
+
return mcpServers;
|
|
18920
|
+
}
|
|
18921
|
+
});
|
|
18922
|
+
};
|
|
18923
|
+
|
|
18924
|
+
const useMCPServerTool = (serverId, toolId) => {
|
|
18925
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
18926
|
+
const client = useMastraClient();
|
|
18927
|
+
return useQuery({
|
|
18928
|
+
queryKey: ["mcp-server-tool", serverId, toolId],
|
|
18929
|
+
queryFn: () => {
|
|
18930
|
+
const instance = client.getMcpServerTool(serverId, toolId);
|
|
18931
|
+
return instance.details(runtimeContext);
|
|
18932
|
+
}
|
|
18933
|
+
});
|
|
18934
|
+
};
|
|
18935
|
+
const useExecuteMCPTool = (serverId, toolId) => {
|
|
18936
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
18937
|
+
const client = useMastraClient();
|
|
18938
|
+
return useMutation({
|
|
18939
|
+
mutationFn: (data) => {
|
|
18940
|
+
const instance = client.getMcpServerTool(serverId, toolId);
|
|
18941
|
+
return instance.execute({ data, runtimeContext });
|
|
18942
|
+
}
|
|
18943
|
+
});
|
|
18944
|
+
};
|
|
18945
|
+
|
|
18946
|
+
const MCPToolPanel = ({ toolId, serverId }) => {
|
|
18947
|
+
const { data: tool, isLoading } = useMCPServerTool(serverId, toolId);
|
|
18948
|
+
const { mutateAsync: executeTool, isPending: isExecuting, data: result } = useExecuteMCPTool(serverId, toolId);
|
|
18949
|
+
const handleExecuteTool = async (data) => {
|
|
18950
|
+
if (!tool) return;
|
|
18951
|
+
return await executeTool(data);
|
|
18952
|
+
};
|
|
18953
|
+
if (isLoading) return null;
|
|
18954
|
+
if (!tool)
|
|
18955
|
+
return /* @__PURE__ */ jsx("div", { className: "py-12 text-center px-6", children: /* @__PURE__ */ jsx(Txt, { variant: "header-md", className: "text-icon3", children: "Tool not found" }) });
|
|
18956
|
+
let zodInputSchema;
|
|
18957
|
+
try {
|
|
18958
|
+
zodInputSchema = resolveSerializedZodOutput(jsonSchemaToZod(tool.inputSchema));
|
|
18959
|
+
} catch (e) {
|
|
18960
|
+
console.error("Error processing input schema:", e);
|
|
18961
|
+
toast.error("Failed to process tool input schema.");
|
|
18962
|
+
zodInputSchema = z.object({});
|
|
18963
|
+
}
|
|
18964
|
+
return /* @__PURE__ */ jsx(
|
|
18965
|
+
ToolExecutor,
|
|
18966
|
+
{
|
|
18967
|
+
executionResult: result,
|
|
18968
|
+
isExecutingTool: isExecuting,
|
|
18969
|
+
zodInputSchema,
|
|
18970
|
+
handleExecuteTool,
|
|
18971
|
+
toolDescription: tool.description || "",
|
|
18972
|
+
toolId: tool.id
|
|
18973
|
+
}
|
|
18974
|
+
);
|
|
18975
|
+
};
|
|
18976
|
+
|
|
18977
|
+
const CodeMirrorBlock = (props) => {
|
|
18978
|
+
const theme = useCodemirrorTheme$1();
|
|
18979
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border-sm border-border1 bg-surface3 p-4 relative", children: [
|
|
18980
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-4 right-4 z-10", children: /* @__PURE__ */ jsx(CopyButton, { tooltip: "Copy code", content: props.value || "No content" }) }),
|
|
18981
|
+
/* @__PURE__ */ jsx(CodeMirror, { extensions: [json()], theme, ...props })
|
|
18982
|
+
] });
|
|
18983
|
+
};
|
|
18984
|
+
|
|
18985
|
+
const MCPDetail = ({ isLoading, server }) => {
|
|
18986
|
+
const [{ sseUrl, httpStreamUrl }, setUrls] = useState({
|
|
18987
|
+
sseUrl: "",
|
|
18988
|
+
httpStreamUrl: ""
|
|
18989
|
+
});
|
|
18990
|
+
useEffect(() => {
|
|
18991
|
+
if (!server) return;
|
|
18992
|
+
const host = window.MASTRA_SERVER_HOST;
|
|
18993
|
+
const port = window.MASTRA_SERVER_PORT;
|
|
18994
|
+
let baseUrl = null;
|
|
18995
|
+
if (host && port) {
|
|
18996
|
+
baseUrl = `http://${host}:${port}`;
|
|
18997
|
+
}
|
|
18998
|
+
const effectiveBaseUrl = baseUrl || "http://localhost:4111";
|
|
18999
|
+
const sseUrl2 = `${effectiveBaseUrl}/api/mcp/${server.id}/sse`;
|
|
19000
|
+
const httpStreamUrl2 = `${effectiveBaseUrl}/api/mcp/${server.id}/mcp`;
|
|
19001
|
+
setUrls({ sseUrl: sseUrl2, httpStreamUrl: httpStreamUrl2 });
|
|
19002
|
+
}, [server]);
|
|
19003
|
+
if (isLoading) return null;
|
|
19004
|
+
if (!server)
|
|
19005
|
+
return /* @__PURE__ */ jsx(MainContentContent, { children: /* @__PURE__ */ jsx(Txt, { as: "h1", variant: "header-md", className: "text-icon3 font-medium py-20 text-center", children: "Server not found" }) });
|
|
19006
|
+
return /* @__PURE__ */ jsxs(MainContentContent, { isDivided: true, children: [
|
|
19007
|
+
/* @__PURE__ */ jsxs("div", { className: "px-8 py-20 mx-auto max-w-[604px] w-full", children: [
|
|
19008
|
+
/* @__PURE__ */ jsx(Txt, { as: "h1", variant: "header-md", className: "text-icon6 font-medium pb-4", children: server.name }),
|
|
19009
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
19010
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
19011
|
+
/* @__PURE__ */ jsx(
|
|
19012
|
+
Badge$1,
|
|
19013
|
+
{
|
|
19014
|
+
icon: /* @__PURE__ */ jsx("span", { className: "font-mono w-6 text-accent1 text-ui-xs font-medium", children: "SSE" }),
|
|
19015
|
+
className: "!text-icon4",
|
|
19016
|
+
children: sseUrl
|
|
19017
|
+
}
|
|
19018
|
+
),
|
|
19019
|
+
/* @__PURE__ */ jsx(CopyButton, { tooltip: "Copy SSE URL", content: sseUrl, iconSize: "sm" })
|
|
19020
|
+
] }),
|
|
19021
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
19022
|
+
/* @__PURE__ */ jsx(
|
|
19023
|
+
Badge$1,
|
|
19024
|
+
{
|
|
19025
|
+
icon: /* @__PURE__ */ jsx("span", { className: "font-mono w-6 text-accent1 text-ui-xs font-medium", children: "HTTP" }),
|
|
19026
|
+
className: "!text-icon4",
|
|
19027
|
+
children: httpStreamUrl
|
|
19028
|
+
}
|
|
19029
|
+
),
|
|
19030
|
+
/* @__PURE__ */ jsx(CopyButton, { tooltip: "Copy HTTP Stream URL", content: httpStreamUrl, iconSize: "sm" })
|
|
19031
|
+
] })
|
|
19032
|
+
] }),
|
|
19033
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 pt-3 pb-9", children: [
|
|
19034
|
+
/* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(FolderIcon, { className: "text-icon6" }), className: "rounded-r-sm !text-icon4", children: "Version" }),
|
|
19035
|
+
/* @__PURE__ */ jsx(Badge$1, { className: "rounded-l-sm !text-icon4", children: server.version_detail.version })
|
|
19036
|
+
] }),
|
|
19037
|
+
/* @__PURE__ */ jsx(McpSetupTabs, { sseUrl, serverName: server.name })
|
|
19038
|
+
] }),
|
|
19039
|
+
/* @__PURE__ */ jsx("div", { className: "h-full overflow-y-scroll border-l-sm border-border1", children: /* @__PURE__ */ jsx(McpToolList, { server }) })
|
|
19040
|
+
] });
|
|
19041
|
+
};
|
|
19042
|
+
const McpSetupTabs = ({ sseUrl, serverName }) => {
|
|
19043
|
+
const { Link } = useLinkComponent();
|
|
19044
|
+
return /* @__PURE__ */ jsxs(PlaygroundTabs, { defaultTab: "cursor", children: [
|
|
19045
|
+
/* @__PURE__ */ jsxs(TabList$1, { children: [
|
|
19046
|
+
/* @__PURE__ */ jsx(Tab$1, { value: "cursor", children: "Cursor" }),
|
|
19047
|
+
/* @__PURE__ */ jsx(Tab$1, { value: "windsurf", children: "Windsurf" })
|
|
19048
|
+
] }),
|
|
19049
|
+
/* @__PURE__ */ jsxs(TabContent$1, { value: "cursor", children: [
|
|
19050
|
+
/* @__PURE__ */ jsxs(Txt, { className: "text-icon3 pb-4", children: [
|
|
19051
|
+
"Cursor comes with built-in MCP Support.",
|
|
19052
|
+
" ",
|
|
19053
|
+
/* @__PURE__ */ jsx(
|
|
19054
|
+
Link,
|
|
19055
|
+
{
|
|
19056
|
+
href: "https://docs.cursor.com/context/model-context-protocol",
|
|
19057
|
+
target: "_blank",
|
|
19058
|
+
rel: "noopener noreferrer",
|
|
19059
|
+
className: "underline hover:text-icon6",
|
|
19060
|
+
children: "Following the documentation"
|
|
19061
|
+
}
|
|
19062
|
+
),
|
|
19063
|
+
", you can register an MCP server using SSE with the following configuration."
|
|
19064
|
+
] }),
|
|
19065
|
+
/* @__PURE__ */ jsx(
|
|
19066
|
+
CodeMirrorBlock,
|
|
19067
|
+
{
|
|
19068
|
+
editable: false,
|
|
19069
|
+
value: `{
|
|
19070
|
+
"mcpServers": {
|
|
19071
|
+
"${serverName}": {
|
|
19072
|
+
"url": "${sseUrl}"
|
|
19073
|
+
}
|
|
19074
|
+
}
|
|
19075
|
+
}`
|
|
19076
|
+
}
|
|
19077
|
+
)
|
|
19078
|
+
] }),
|
|
19079
|
+
/* @__PURE__ */ jsxs(TabContent$1, { value: "windsurf", children: [
|
|
19080
|
+
/* @__PURE__ */ jsxs(Txt, { className: "text-icon3 pb-4", children: [
|
|
19081
|
+
"Windsurf comes with built-in MCP Support.",
|
|
19082
|
+
" ",
|
|
19083
|
+
/* @__PURE__ */ jsx(
|
|
19084
|
+
Link,
|
|
19085
|
+
{
|
|
19086
|
+
href: "https://docs.windsurf.com/windsurf/cascade/mcp#mcp-config-json",
|
|
19087
|
+
target: "_blank",
|
|
19088
|
+
rel: "noopener noreferrer",
|
|
19089
|
+
className: "underline hover:text-icon6",
|
|
19090
|
+
children: "Following the documentation"
|
|
19091
|
+
}
|
|
19092
|
+
),
|
|
19093
|
+
", you can register an MCP server using SSE with the following configuration."
|
|
19094
|
+
] }),
|
|
19095
|
+
/* @__PURE__ */ jsx(
|
|
19096
|
+
CodeMirrorBlock,
|
|
19097
|
+
{
|
|
19098
|
+
editable: false,
|
|
19099
|
+
value: `{
|
|
19100
|
+
"mcpServers": {
|
|
19101
|
+
"${serverName}": {
|
|
19102
|
+
"command": "npx",
|
|
19103
|
+
"args": ["-y", "mcp-remote", "${sseUrl}"]
|
|
19104
|
+
}
|
|
19105
|
+
}
|
|
19106
|
+
}`
|
|
19107
|
+
}
|
|
19108
|
+
)
|
|
19109
|
+
] })
|
|
19110
|
+
] });
|
|
19111
|
+
};
|
|
19112
|
+
const McpToolList = ({ server }) => {
|
|
19113
|
+
const { data: tools = {}, isLoading } = useMCPServerTools(server);
|
|
19114
|
+
if (isLoading) return null;
|
|
19115
|
+
const toolsKeyArray = Object.keys(tools);
|
|
19116
|
+
return /* @__PURE__ */ jsxs("div", { className: "p-5 overflow-y-scroll", children: [
|
|
19117
|
+
/* @__PURE__ */ jsxs("div", { className: "text-icon6 flex gap-2 items-center", children: [
|
|
19118
|
+
/* @__PURE__ */ jsx(Icon, { size: "lg", className: "bg-surface4 rounded-md p-1", children: /* @__PURE__ */ jsx(McpServerIcon, {}) }),
|
|
19119
|
+
/* @__PURE__ */ jsx(Txt, { variant: "header-md", as: "h2", className: "font-medium", children: "Available Tools" })
|
|
19120
|
+
] }),
|
|
19121
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 pt-6", children: toolsKeyArray.map((toolId) => {
|
|
19122
|
+
const tool = tools[toolId];
|
|
19123
|
+
return /* @__PURE__ */ jsx(ToolEntry, { tool, serverId: server.id }, toolId);
|
|
19124
|
+
}) })
|
|
19125
|
+
] });
|
|
19126
|
+
};
|
|
19127
|
+
const ToolEntry = ({ tool, serverId }) => {
|
|
19128
|
+
const linkRef = useRef(null);
|
|
19129
|
+
const { Link, paths } = useLinkComponent();
|
|
19130
|
+
const ToolIconComponent = ToolIconMap[tool.toolType || "tool"];
|
|
19131
|
+
return /* @__PURE__ */ jsxs(Entity, { onClick: () => linkRef.current?.click(), children: [
|
|
19132
|
+
/* @__PURE__ */ jsx(EntityIcon, { children: /* @__PURE__ */ jsx(ToolIconComponent, { className: "group-hover/entity:text-[#ECB047]" }) }),
|
|
19133
|
+
/* @__PURE__ */ jsxs(EntityContent, { children: [
|
|
19134
|
+
/* @__PURE__ */ jsx(EntityName, { children: /* @__PURE__ */ jsx(Link, { ref: linkRef, href: paths.mcpServerToolLink(serverId, tool.id), children: tool.id }) }),
|
|
19135
|
+
/* @__PURE__ */ jsx(EntityDescription, { children: tool.description })
|
|
19136
|
+
] })
|
|
19137
|
+
] });
|
|
19138
|
+
};
|
|
19139
|
+
|
|
18546
19140
|
const useEvalsByAgentId = (agentId, type) => {
|
|
18547
19141
|
const { runtimeContext } = usePlaygroundStore();
|
|
18548
19142
|
const client = useMastraClient();
|
|
@@ -18554,5 +19148,5 @@ const useEvalsByAgentId = (agentId, type) => {
|
|
|
18554
19148
|
});
|
|
18555
19149
|
};
|
|
18556
19150
|
|
|
18557
|
-
export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentsTable, AiIcon, Alert$1 as Alert, AlertDescription$1 as AlertDescription, AlertDialog, AlertTitle$1 as AlertTitle, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, ButtonsGroup, 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, EntryListSkeleton, 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, MainSidebar, MainSidebarProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, ModelResetProvider, Notification, OpenAIIcon, PageHeader, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupField, RadioGroupItem, RepoIcon, Row, RuntimeContext, RuntimeContextWrapper, ScoreDialog, ScoreIcon, ScorersTable, ScoresList, ScoresTools, SearchField, Searchbar, SearchbarWrapper, Section, Sections, SelectField, SettingsIcon, SideDialog, SlashIcon, SliderField, SpanScoreList, SpanScoring, SpanTabs, Tab$1 as Tab, TabContent$1 as TabContent, TabList$1 as 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, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineLegend, TraceTimelineSpan, TracesList, TracesTools, TracesView, TracesViewSkeleton, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunDetail, WorkflowRunList, WorkflowRunProvider, WorkflowTable, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, allowedAiSpanAttributes, cleanString, convertWorkflowRunStateToStreamResult, extractPrompt, formatDuration, formatHierarchicalSpans, formatOtelTimestamp, formatOtelTimestamp2, getColumnTemplate, getShortId, getSpanTypeUi, getToNextEntryFn, getToPreviousEntryFn, parseError, providerMapToIcon, scoresListColumns, spanTypePrefixes, traceScoresListColumns, tracesListColumns, transformKey, useAgent, useAgentSettings, useAgents, useCancelWorkflowRun, useCurrentRun, useDeleteThread, useEvalsByAgentId, useExecuteAgentTool, useExecuteTool, useExecuteWorkflow, useInView, useLinkComponent, useMCPServerTools, useMainSidebar, useMemory, useMemoryConfig, useMemorySearch, useModelProviders, useModelReset, usePlaygroundStore, usePolling, useReorderModelList, useScorer, useScorers, useScoresByEntityId, useScoresByScorerId, useSendWorkflowRunEvent, useSpeechRecognition, useStreamWorkflow, useThreadInput, useThreads, useTraceSpanScores, useUpdateAgentModel, useUpdateModelInModelList, useWorkflow, useWorkflowRuns, useWorkflows, useWorkingMemory };
|
|
19151
|
+
export { AgentChat, AgentCoinIcon, AgentEntityHeader, AgentEvals, AgentIcon, AgentMetadata, AgentMetadataList, AgentMetadataListEmpty, AgentMetadataListItem, AgentMetadataNetworkList, AgentMetadataPrompt, AgentMetadataScorerList, AgentMetadataSection, AgentMetadataToolList, AgentMetadataWorkflowList, AgentMetadataWrapper, AgentNetworkCoinIcon, AgentSettings, AgentSettingsContext, AgentSettingsProvider, AgentToolPanel, AgentsTable, AiIcon, Alert$1 as Alert, AlertDescription$1 as AlertDescription, AlertDialog, AlertTitle$1 as AlertTitle, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button$1 as Button, ButtonsGroup, 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, EntryListSkeleton, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, FormActions, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, InputField, JudgeIcon, Kbd, KeyValueList, LatencyIcon, LinkComponentProvider, LogsIcon, MCPDetail, MCPTable, MCPToolPanel, MainContentContent, MainContentLayout, MainSidebar, MainSidebarProvider, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, MemorySearch, ModelResetProvider, Notification, OpenAIIcon, PageHeader, PlaygroundQueryClient, PlaygroundTabs, PromptIcon, RadioGroup, RadioGroupField, RadioGroupItem, RepoIcon, Row, RuntimeContext, RuntimeContextWrapper, ScoreDialog, ScoreIcon, ScorersTable, ScoresList, ScoresTools, SearchField, Searchbar, SearchbarWrapper, Section, Sections, SelectField, SettingsIcon, SideDialog, SlashIcon, SliderField, SpanScoreList, SpanScoring, SpanTabs, Tab$1 as Tab, TabContent$1 as TabContent, TabList$1 as 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, ToolIconMap, ToolInformation, ToolPanel, ToolTable, ToolsIcon, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TraceDialog, TraceIcon, TraceTimeline, TraceTimelineLegend, TraceTimelineSpan, TracesList, TracesTools, TracesView, TracesViewSkeleton, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunDetail, WorkflowRunList, WorkflowRunProvider, WorkflowTable, WorkflowTrigger, WorkingMemoryContext, WorkingMemoryProvider, allowedAiSpanAttributes, cleanString, convertWorkflowRunStateToStreamResult, extractPrompt, formatDuration, formatHierarchicalSpans, formatOtelTimestamp, formatOtelTimestamp2, getColumnTemplate, getShortId, getSpanTypeUi, getToNextEntryFn, getToPreviousEntryFn, parseError, providerMapToIcon, scoresListColumns, spanTypePrefixes, traceScoresListColumns, tracesListColumns, transformKey, useAgent, useAgentSettings, useAgents, useCancelWorkflowRun, useCurrentRun, useDeleteThread, useEvalsByAgentId, useExecuteAgentTool, useExecuteMCPTool, useExecuteTool, useExecuteWorkflow, useInView, useLinkComponent, useMCPServerTool, useMCPServerTools, useMCPServers, useMainSidebar, useMemory, useMemoryConfig, useMemorySearch, useModelProviders, useModelReset, usePlaygroundStore, usePolling, useReorderModelList, useScorer, useScorers, useScoresByEntityId, useScoresByScorerId, useSendWorkflowRunEvent, useSpeechRecognition, useStreamWorkflow, useThreadInput, useThreads, useTool, useTools, useTraceSpanScores, useUpdateAgentModel, useUpdateModelInModelList, useWorkflow, useWorkflowRuns, useWorkflows, useWorkingMemory };
|
|
18558
19152
|
//# sourceMappingURL=index.es.js.map
|