@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.cjs.js
CHANGED
|
@@ -26,7 +26,6 @@ const Dagre = require('@dagrejs/dagre');
|
|
|
26
26
|
const prismReactRenderer = require('prism-react-renderer');
|
|
27
27
|
const CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
28
28
|
const ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
29
|
-
const colors = require('./colors-B_l6leHd.cjs');
|
|
30
29
|
const prettier = require('prettier');
|
|
31
30
|
const prettierPluginBabel = require('prettier/plugins/babel');
|
|
32
31
|
const prettierPluginEstree = require('prettier/plugins/estree');
|
|
@@ -45,14 +44,18 @@ const reactDayPicker = require('react-day-picker');
|
|
|
45
44
|
const PopoverPrimitive = require('@radix-ui/react-popover');
|
|
46
45
|
const SelectPrimitive = require('@radix-ui/react-select');
|
|
47
46
|
const uuid = require('@lukeed/uuid');
|
|
47
|
+
const reactHookForm = require('react-hook-form');
|
|
48
|
+
const core = require('@autoform/core');
|
|
48
49
|
const LabelPrimitive = require('@radix-ui/react-label');
|
|
49
50
|
const v4 = require('@autoform/zod/v4');
|
|
50
51
|
const v3 = require('zod/v3');
|
|
52
|
+
const z$1 = require('zod/v4');
|
|
51
53
|
const RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
52
54
|
const react$3 = require('@mastra/react');
|
|
53
55
|
const reactQuery = require('@tanstack/react-query');
|
|
54
56
|
const reactTable = require('@tanstack/react-table');
|
|
55
57
|
const runtimeContext = require('@mastra/core/runtime-context');
|
|
58
|
+
const colors = require('./colors-B_l6leHd.cjs');
|
|
56
59
|
const Markdown = require('react-markdown');
|
|
57
60
|
const shallow = require('zustand/shallow');
|
|
58
61
|
const di = require('@mastra/core/di');
|
|
@@ -4347,25 +4350,20 @@ function useCopyToClipboard({ text, copyMessage = "Copied to clipboard!" }) {
|
|
|
4347
4350
|
return { isCopied, handleCopy };
|
|
4348
4351
|
}
|
|
4349
4352
|
|
|
4350
|
-
function CopyButton({
|
|
4351
|
-
|
|
4353
|
+
function CopyButton({
|
|
4354
|
+
content,
|
|
4355
|
+
copyMessage,
|
|
4356
|
+
tooltip = "Copy to clipboard",
|
|
4357
|
+
iconSize = "default"
|
|
4358
|
+
}) {
|
|
4359
|
+
const { handleCopy } = useCopyToClipboard({
|
|
4352
4360
|
text: content,
|
|
4353
4361
|
copyMessage
|
|
4354
4362
|
});
|
|
4355
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4356
|
-
|
|
4357
|
-
{
|
|
4358
|
-
|
|
4359
|
-
size: "icon",
|
|
4360
|
-
className: cn("relative h-6 w-6", className),
|
|
4361
|
-
"aria-label": "Copy to clipboard",
|
|
4362
|
-
onClick: handleCopy,
|
|
4363
|
-
children: [
|
|
4364
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: cn("h-4 w-4 transition-transform ease-in-out", isCopied ? "scale-100" : "scale-0") }) }),
|
|
4365
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: cn("h-4 w-4 transition-transform ease-in-out", isCopied ? "scale-0" : "scale-100") })
|
|
4366
|
-
]
|
|
4367
|
-
}
|
|
4368
|
-
);
|
|
4363
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
4364
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: handleCopy, type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "transition-colors hover:bg-surface4 rounded-lg text-icon3 hover:text-icon6", size: iconSize, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) }) }) }),
|
|
4365
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: tooltip })
|
|
4366
|
+
] });
|
|
4369
4367
|
}
|
|
4370
4368
|
|
|
4371
4369
|
const useCodemirrorTheme$2 = () => {
|
|
@@ -5288,7 +5286,7 @@ const useCodemirrorTheme$1 = () => {
|
|
|
5288
5286
|
fontSize: "0.8rem",
|
|
5289
5287
|
lineHighlight: "transparent",
|
|
5290
5288
|
gutterBackground: "transparent",
|
|
5291
|
-
gutterForeground:
|
|
5289
|
+
gutterForeground: "#939393",
|
|
5292
5290
|
background: "transparent"
|
|
5293
5291
|
},
|
|
5294
5292
|
styles: [{ tag: [highlight.tags.className, highlight.tags.propertyName] }]
|
|
@@ -6869,6 +6867,145 @@ const RecordField = ({ inputProps, field, error, id }) => {
|
|
|
6869
6867
|
] });
|
|
6870
6868
|
};
|
|
6871
6869
|
|
|
6870
|
+
const CustomObjectField = ({ field, path }) => {
|
|
6871
|
+
const { uiComponents } = react$2.useAutoForm();
|
|
6872
|
+
return /* @__PURE__ */ jsxRuntime.jsx(uiComponents.ObjectWrapper, { label: core.getLabel(field), field, children: Object.entries(field.schema).map(([_key, subField]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6873
|
+
CustomAutoFormField,
|
|
6874
|
+
{
|
|
6875
|
+
field: subField,
|
|
6876
|
+
path: [...path, subField.key]
|
|
6877
|
+
},
|
|
6878
|
+
`${path.join(".")}.${subField.key}`
|
|
6879
|
+
)) });
|
|
6880
|
+
};
|
|
6881
|
+
|
|
6882
|
+
const CustomArrayField = ({ field, path }) => {
|
|
6883
|
+
const { uiComponents } = react$2.useAutoForm();
|
|
6884
|
+
const { control } = reactHookForm.useFormContext();
|
|
6885
|
+
const { fields, append, remove } = reactHookForm.useFieldArray({
|
|
6886
|
+
control,
|
|
6887
|
+
name: path.join(".")
|
|
6888
|
+
});
|
|
6889
|
+
const subFieldType = field.schema?.[0]?.type;
|
|
6890
|
+
let defaultValue;
|
|
6891
|
+
if (subFieldType === "object") {
|
|
6892
|
+
defaultValue = {};
|
|
6893
|
+
} else if (subFieldType === "array") {
|
|
6894
|
+
defaultValue = [];
|
|
6895
|
+
} else {
|
|
6896
|
+
defaultValue = null;
|
|
6897
|
+
}
|
|
6898
|
+
return /* @__PURE__ */ jsxRuntime.jsx(uiComponents.ArrayWrapper, { label: core.getLabel(field), field, onAddItem: () => append(defaultValue), children: fields.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(uiComponents.ArrayElementWrapper, { onRemove: () => remove(index), index, children: /* @__PURE__ */ jsxRuntime.jsx(CustomAutoFormField, { field: field.schema[0], path: [...path, index.toString()] }) }, item.id)) });
|
|
6899
|
+
};
|
|
6900
|
+
|
|
6901
|
+
const CustomAutoFormField = ({ field, path }) => {
|
|
6902
|
+
const { formComponents, uiComponents } = react$2.useAutoForm();
|
|
6903
|
+
const {
|
|
6904
|
+
register,
|
|
6905
|
+
formState: { errors },
|
|
6906
|
+
getValues
|
|
6907
|
+
} = reactHookForm.useFormContext();
|
|
6908
|
+
const fullPath = path.join(".");
|
|
6909
|
+
const error = react$2.getPathInObject(errors, path)?.message;
|
|
6910
|
+
const value = getValues(fullPath);
|
|
6911
|
+
const FieldWrapper = field.fieldConfig?.fieldWrapper || uiComponents.FieldWrapper;
|
|
6912
|
+
let FieldComponent = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6913
|
+
uiComponents.ErrorMessage,
|
|
6914
|
+
{
|
|
6915
|
+
error: `[AutoForm Configuration Error] No component found for type "${field.type}" nor a fallback`
|
|
6916
|
+
}
|
|
6917
|
+
);
|
|
6918
|
+
if (field.type === "array") {
|
|
6919
|
+
FieldComponent = CustomArrayField;
|
|
6920
|
+
} else if (field.type === "object") {
|
|
6921
|
+
FieldComponent = CustomObjectField;
|
|
6922
|
+
} else if (field.type in formComponents) {
|
|
6923
|
+
FieldComponent = formComponents[field.type];
|
|
6924
|
+
} else if ("fallback" in formComponents) {
|
|
6925
|
+
FieldComponent = formComponents.fallback;
|
|
6926
|
+
}
|
|
6927
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FieldWrapper, { label: core.getLabel(field), error, id: fullPath, field, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6928
|
+
FieldComponent,
|
|
6929
|
+
{
|
|
6930
|
+
label: core.getLabel(field),
|
|
6931
|
+
field,
|
|
6932
|
+
value,
|
|
6933
|
+
error,
|
|
6934
|
+
id: fullPath,
|
|
6935
|
+
path,
|
|
6936
|
+
inputProps: {
|
|
6937
|
+
required: field.required,
|
|
6938
|
+
error,
|
|
6939
|
+
key: `${fullPath}-input`,
|
|
6940
|
+
...field.fieldConfig?.inputProps,
|
|
6941
|
+
...register(fullPath)
|
|
6942
|
+
}
|
|
6943
|
+
},
|
|
6944
|
+
fullPath
|
|
6945
|
+
) });
|
|
6946
|
+
};
|
|
6947
|
+
|
|
6948
|
+
const UnionField = ({ field, inputProps }) => {
|
|
6949
|
+
const path = inputProps.name?.split(".") ?? [];
|
|
6950
|
+
return field.schema?.map((schema, index) => {
|
|
6951
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
6952
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomAutoFormField, { field: schema, path }, path.join(".")),
|
|
6953
|
+
index < (field.schema?.length ?? 0) - 1 && /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-xs", className: "text-center", children: "OR" })
|
|
6954
|
+
] }, schema.key);
|
|
6955
|
+
});
|
|
6956
|
+
};
|
|
6957
|
+
|
|
6958
|
+
const DiscriminatedUnionField = ({ field, path }) => {
|
|
6959
|
+
const { watch } = reactHookForm.useFormContext();
|
|
6960
|
+
const fullPath = path.join(".");
|
|
6961
|
+
const value = watch(fullPath);
|
|
6962
|
+
const allSchemas = field.schema?.flatMap((schema) => schema.schema || []) || [];
|
|
6963
|
+
const literalSchemas = allSchemas?.filter((schema) => schema.fieldConfig?.customData?.isLiteral) || [];
|
|
6964
|
+
const firstLiteralSchema = literalSchemas[0];
|
|
6965
|
+
const literalSchemaField = literalSchemas?.reduce(
|
|
6966
|
+
(acc, schema) => {
|
|
6967
|
+
const optionValues = (schema.fieldConfig?.customData?.literalValues ?? []).map(
|
|
6968
|
+
(value2) => [value2, value2]
|
|
6969
|
+
);
|
|
6970
|
+
acc.options?.push(...optionValues);
|
|
6971
|
+
return acc;
|
|
6972
|
+
},
|
|
6973
|
+
{
|
|
6974
|
+
key: firstLiteralSchema.key,
|
|
6975
|
+
required: firstLiteralSchema.required,
|
|
6976
|
+
type: "select",
|
|
6977
|
+
default: firstLiteralSchema.default,
|
|
6978
|
+
description: firstLiteralSchema.description,
|
|
6979
|
+
options: [],
|
|
6980
|
+
fieldConfig: firstLiteralSchema.fieldConfig
|
|
6981
|
+
}
|
|
6982
|
+
);
|
|
6983
|
+
const otherFieldSchemas = field.schema?.reduce(
|
|
6984
|
+
(acc, schema) => {
|
|
6985
|
+
const literalSchema = schema.schema?.find((schema2) => schema2.fieldConfig?.customData?.isLiteral);
|
|
6986
|
+
const literalSchemaValue = literalSchema?.fieldConfig?.customData?.literalValues?.[0];
|
|
6987
|
+
const otherSchemas = schema.schema?.filter((schema2) => schema2.key !== literalSchema?.key) ?? [];
|
|
6988
|
+
if (literalSchemaValue) {
|
|
6989
|
+
acc[literalSchemaValue] = otherSchemas;
|
|
6990
|
+
}
|
|
6991
|
+
return acc;
|
|
6992
|
+
},
|
|
6993
|
+
{}
|
|
6994
|
+
);
|
|
6995
|
+
const literalFieldValue = value?.[literalSchemaField.key];
|
|
6996
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
6997
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6998
|
+
CustomAutoFormField,
|
|
6999
|
+
{
|
|
7000
|
+
field: literalSchemaField,
|
|
7001
|
+
path: [...path, literalSchemaField.key]
|
|
7002
|
+
},
|
|
7003
|
+
`${fullPath}.${literalSchemaField.key}`
|
|
7004
|
+
),
|
|
7005
|
+
literalFieldValue && otherFieldSchemas?.[literalFieldValue] && otherFieldSchemas[literalFieldValue].map((schema) => /* @__PURE__ */ jsxRuntime.jsx(CustomAutoFormField, { field: schema, path: [...path, schema.key] }, `${fullPath}.${schema.key}`))
|
|
7006
|
+
] }, field.key);
|
|
7007
|
+
};
|
|
7008
|
+
|
|
6872
7009
|
const ShadcnUIComponents = {
|
|
6873
7010
|
Form,
|
|
6874
7011
|
FieldWrapper,
|
|
@@ -6896,6 +7033,8 @@ function AutoForm({
|
|
|
6896
7033
|
date: (props2) => /* @__PURE__ */ jsxRuntime.jsx(DateField, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
6897
7034
|
select: (props2) => /* @__PURE__ */ jsxRuntime.jsx(SelectField$1, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
6898
7035
|
record: (props2) => /* @__PURE__ */ jsxRuntime.jsx(RecordField, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
7036
|
+
union: (props2) => /* @__PURE__ */ jsxRuntime.jsx(UnionField, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
7037
|
+
"discriminated-union": (props2) => /* @__PURE__ */ jsxRuntime.jsx(DiscriminatedUnionField, { ...props2, inputProps: { ...props2.inputProps, readOnly } }),
|
|
6899
7038
|
...formComponents
|
|
6900
7039
|
}
|
|
6901
7040
|
}
|
|
@@ -6903,6 +7042,39 @@ function AutoForm({
|
|
|
6903
7042
|
}
|
|
6904
7043
|
|
|
6905
7044
|
react$2.buildZodFieldConfig();
|
|
7045
|
+
function removeEmptyValues(values) {
|
|
7046
|
+
const result = {};
|
|
7047
|
+
for (const key in values) {
|
|
7048
|
+
const value = values[key];
|
|
7049
|
+
if ([null, void 0, "", [], {}].includes(value)) {
|
|
7050
|
+
continue;
|
|
7051
|
+
}
|
|
7052
|
+
if (Array.isArray(value)) {
|
|
7053
|
+
const newArray = value.map((item) => {
|
|
7054
|
+
if (typeof item === "object") {
|
|
7055
|
+
const cleanedItem = removeEmptyValues(item);
|
|
7056
|
+
if (Object.keys(cleanedItem).length > 0) {
|
|
7057
|
+
return cleanedItem;
|
|
7058
|
+
}
|
|
7059
|
+
return null;
|
|
7060
|
+
}
|
|
7061
|
+
return item;
|
|
7062
|
+
});
|
|
7063
|
+
const filteredArray = newArray.filter((item) => item !== null);
|
|
7064
|
+
if (filteredArray.length > 0) {
|
|
7065
|
+
result[key] = filteredArray;
|
|
7066
|
+
}
|
|
7067
|
+
} else if (typeof value === "object") {
|
|
7068
|
+
const cleanedValue = removeEmptyValues(value);
|
|
7069
|
+
if (Object.keys(cleanedValue).length > 0) {
|
|
7070
|
+
result[key] = cleanedValue;
|
|
7071
|
+
}
|
|
7072
|
+
} else {
|
|
7073
|
+
result[key] = value;
|
|
7074
|
+
}
|
|
7075
|
+
}
|
|
7076
|
+
return result;
|
|
7077
|
+
}
|
|
6906
7078
|
|
|
6907
7079
|
const labelVariants = cva("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
6908
7080
|
const Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(LabelPrimitive__namespace.Root, { ref, className: clsx(labelVariants(), className), ...props }));
|
|
@@ -6929,14 +7101,55 @@ function inferFieldType(schema, fieldConfig) {
|
|
|
6929
7101
|
if (schema instanceof v3.z.ZodNativeEnum) return "select";
|
|
6930
7102
|
if (schema instanceof z.z.ZodArray) return "array";
|
|
6931
7103
|
if (schema instanceof z.z.ZodRecord) return "record";
|
|
7104
|
+
if (schema instanceof z.z.ZodUnion) {
|
|
7105
|
+
const options = schema._zod.def.options;
|
|
7106
|
+
const hasLiteral = options.every((option) => {
|
|
7107
|
+
if ("shape" in option._zod.def) {
|
|
7108
|
+
return Object.values(option._zod.def.shape).some(
|
|
7109
|
+
(value) => value instanceof z.z.ZodLiteral
|
|
7110
|
+
);
|
|
7111
|
+
}
|
|
7112
|
+
return false;
|
|
7113
|
+
});
|
|
7114
|
+
if (hasLiteral) {
|
|
7115
|
+
return "discriminated-union";
|
|
7116
|
+
}
|
|
7117
|
+
return "union";
|
|
7118
|
+
}
|
|
6932
7119
|
return "string";
|
|
6933
7120
|
}
|
|
6934
7121
|
|
|
7122
|
+
function getDefaultValueInZodStack(schema) {
|
|
7123
|
+
if (schema instanceof z$1.core.$ZodDefault) {
|
|
7124
|
+
return schema._zod.def.defaultValue;
|
|
7125
|
+
} else if ("innerType" in schema._zod.def) {
|
|
7126
|
+
return getDefaultValueInZodStack(schema._zod.def.innerType);
|
|
7127
|
+
} else if ("shape" in schema._zod.def) {
|
|
7128
|
+
return getDefaultValues(schema);
|
|
7129
|
+
} else if ("left" in schema._zod.def && "right" in schema._zod.def) {
|
|
7130
|
+
const left = getDefaultValues(schema._zod.def.left);
|
|
7131
|
+
const right = getDefaultValues(schema._zod.def.right);
|
|
7132
|
+
return { ...left, ...right };
|
|
7133
|
+
}
|
|
7134
|
+
return void 0;
|
|
7135
|
+
}
|
|
7136
|
+
function getDefaultValues(schema) {
|
|
7137
|
+
const shape = schema._zod.def.shape;
|
|
7138
|
+
const defaultValues = {};
|
|
7139
|
+
for (const [key, field] of Object.entries(shape)) {
|
|
7140
|
+
const defaultValue = getDefaultValueInZodStack(field);
|
|
7141
|
+
if (defaultValue !== void 0) {
|
|
7142
|
+
defaultValues[key] = defaultValue;
|
|
7143
|
+
}
|
|
7144
|
+
}
|
|
7145
|
+
return defaultValues;
|
|
7146
|
+
}
|
|
7147
|
+
|
|
6935
7148
|
function parseField(key, schema) {
|
|
6936
7149
|
const baseSchema = getBaseSchema(schema);
|
|
6937
7150
|
const fieldConfig = v4.getFieldConfigInZodStack(schema);
|
|
6938
7151
|
const type = inferFieldType(baseSchema, fieldConfig);
|
|
6939
|
-
const defaultValue =
|
|
7152
|
+
const defaultValue = getDefaultValueInZodStack(schema);
|
|
6940
7153
|
const options = baseSchema._zod.def?.entries;
|
|
6941
7154
|
let optionValues = [];
|
|
6942
7155
|
if (options) {
|
|
@@ -6950,11 +7163,16 @@ function parseField(key, schema) {
|
|
|
6950
7163
|
if (baseSchema instanceof v3.z.ZodObject || baseSchema instanceof z.z.ZodObject) {
|
|
6951
7164
|
subSchema = Object.entries(baseSchema.shape).map(([key2, field]) => parseField(key2, field));
|
|
6952
7165
|
}
|
|
7166
|
+
if (baseSchema instanceof v3.z.ZodUnion || baseSchema instanceof z.z.ZodUnion) {
|
|
7167
|
+
subSchema = Object.entries(baseSchema.def.options).map(([key2, field]) => {
|
|
7168
|
+
return parseField(key2, field);
|
|
7169
|
+
});
|
|
7170
|
+
}
|
|
6953
7171
|
if (baseSchema instanceof v3.z.ZodIntersection || baseSchema instanceof z.z.ZodIntersection) {
|
|
6954
|
-
const subSchemaLeft = Object.entries(baseSchema.
|
|
7172
|
+
const subSchemaLeft = Object.entries(baseSchema.def.left.shape).map(
|
|
6955
7173
|
([key2, field]) => parseField(key2, field)
|
|
6956
7174
|
);
|
|
6957
|
-
const subSchemaRight = Object.entries(baseSchema.
|
|
7175
|
+
const subSchemaRight = Object.entries(baseSchema.def.right.shape).map(
|
|
6958
7176
|
([key2, field]) => parseField(key2, field)
|
|
6959
7177
|
);
|
|
6960
7178
|
subSchema = [...subSchemaLeft, ...subSchemaRight];
|
|
@@ -6962,13 +7180,21 @@ function parseField(key, schema) {
|
|
|
6962
7180
|
if (baseSchema instanceof v3.z.ZodArray || baseSchema instanceof z.z.ZodArray) {
|
|
6963
7181
|
subSchema = [parseField("0", baseSchema._zod.def.element)];
|
|
6964
7182
|
}
|
|
7183
|
+
const isLiteral = baseSchema instanceof z.z.ZodLiteral;
|
|
7184
|
+
const literalValues = isLiteral ? baseSchema._zod.def.values : void 0;
|
|
6965
7185
|
return {
|
|
6966
7186
|
key,
|
|
6967
7187
|
type,
|
|
6968
7188
|
required: !schema.optional(),
|
|
6969
7189
|
default: defaultValue,
|
|
6970
7190
|
description: baseSchema.description,
|
|
6971
|
-
fieldConfig
|
|
7191
|
+
fieldConfig: isLiteral || Object.keys(fieldConfig ?? {})?.length > 0 ? {
|
|
7192
|
+
...fieldConfig,
|
|
7193
|
+
customData: {
|
|
7194
|
+
...fieldConfig?.customData ?? {},
|
|
7195
|
+
...isLiteral ? { isLiteral, literalValues } : {}
|
|
7196
|
+
}
|
|
7197
|
+
} : void 0,
|
|
6972
7198
|
options: optionValues,
|
|
6973
7199
|
schema: subSchema
|
|
6974
7200
|
};
|
|
@@ -6993,8 +7219,12 @@ class CustomZodProvider extends v4.ZodProvider {
|
|
|
6993
7219
|
super(schema);
|
|
6994
7220
|
this._schema = schema;
|
|
6995
7221
|
}
|
|
7222
|
+
getDefaultValues() {
|
|
7223
|
+
return getDefaultValues(this._schema);
|
|
7224
|
+
}
|
|
6996
7225
|
validateSchema(values) {
|
|
6997
|
-
const
|
|
7226
|
+
const cleanedValues = removeEmptyValues(values);
|
|
7227
|
+
const result = super.validateSchema(cleanedValues);
|
|
6998
7228
|
return result;
|
|
6999
7229
|
}
|
|
7000
7230
|
parseSchema() {
|
|
@@ -7703,6 +7933,7 @@ const LinkComponentContext = React.createContext({
|
|
|
7703
7933
|
scorerLink: () => "",
|
|
7704
7934
|
toolLink: () => "",
|
|
7705
7935
|
mcpServerLink: () => "",
|
|
7936
|
+
mcpServerToolLink: () => "",
|
|
7706
7937
|
workflowRunLink: () => ""
|
|
7707
7938
|
}
|
|
7708
7939
|
});
|
|
@@ -13234,7 +13465,7 @@ function MainSidebarNavLink({
|
|
|
13234
13465
|
className
|
|
13235
13466
|
}) {
|
|
13236
13467
|
const { Link } = useLinkComponent();
|
|
13237
|
-
const
|
|
13468
|
+
const isCollapsed = state === "collapsed";
|
|
13238
13469
|
const isFeatured = link?.variant === "featured";
|
|
13239
13470
|
const linkParams = link?.url?.startsWith("http") ? { target: "_blank", rel: "noreferrer" } : {};
|
|
13240
13471
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13248,22 +13479,31 @@ function MainSidebarNavLink({
|
|
|
13248
13479
|
{
|
|
13249
13480
|
"[&>a]:text-icon5 [&>a]:bg-surface3": isActive,
|
|
13250
13481
|
"[&_svg]:text-icon5": isActive,
|
|
13251
|
-
"[&>a]:justify-start ":
|
|
13252
|
-
"[&_svg]:text-icon3":
|
|
13482
|
+
"[&>a]:justify-start ": !isCollapsed,
|
|
13483
|
+
"[&_svg]:text-icon3": isCollapsed,
|
|
13253
13484
|
"[&>a]:rounded-md [&>a]:my-[0.5rem] [&>a]:bg-accent1/75 [&>a:hover]:bg-accent1/85 [&>a]:text-black [&>a:hover]:text-black": isFeatured,
|
|
13254
|
-
"[&_svg]:text-black/75": isFeatured
|
|
13485
|
+
"[&_svg]:text-black/75 [&>a:hover_svg]:text-black": isFeatured
|
|
13255
13486
|
},
|
|
13256
13487
|
className
|
|
13257
13488
|
),
|
|
13258
|
-
children: link ? /* @__PURE__ */ jsxRuntime.
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13262
|
-
|
|
13263
|
-
|
|
13489
|
+
children: link ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: isCollapsed || link.tooltipMsg ? /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
13490
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Link, { href: link.url, ...linkParams, children: [
|
|
13491
|
+
link.icon && link.icon,
|
|
13492
|
+
isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(VisuallyHidden.VisuallyHidden, { children: link.name }) : link.name,
|
|
13493
|
+
" ",
|
|
13494
|
+
children
|
|
13495
|
+
] }) }),
|
|
13496
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: "bg-border1 text-icon6 ml-[1rem]", children: link.tooltipMsg ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13497
|
+
isCollapsed && `${link.name} | `,
|
|
13498
|
+
" ",
|
|
13499
|
+
link.tooltipMsg
|
|
13500
|
+
] }) : link.name })
|
|
13501
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(Link, { href: link.url, ...linkParams, children: [
|
|
13502
|
+
link.icon && link.icon,
|
|
13503
|
+
isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(VisuallyHidden.VisuallyHidden, { children: link.name }) : link.name,
|
|
13264
13504
|
" ",
|
|
13265
13505
|
children
|
|
13266
|
-
] }) : children
|
|
13506
|
+
] }) }) : children
|
|
13267
13507
|
}
|
|
13268
13508
|
);
|
|
13269
13509
|
}
|
|
@@ -14879,6 +15119,86 @@ const useExecuteAgentTool = () => {
|
|
|
14879
15119
|
});
|
|
14880
15120
|
};
|
|
14881
15121
|
|
|
15122
|
+
const ToolIconMap = {
|
|
15123
|
+
agent: AgentIcon,
|
|
15124
|
+
workflow: WorkflowIcon,
|
|
15125
|
+
tool: ToolsIcon
|
|
15126
|
+
};
|
|
15127
|
+
|
|
15128
|
+
const ToolInformation = ({ toolDescription, toolId, toolType }) => {
|
|
15129
|
+
const ToolIconComponent = ToolIconMap[toolType || "tool"];
|
|
15130
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-5 border-b-sm border-border1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-icon6 flex gap-2", children: [
|
|
15131
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: "bg-surface4 rounded-md p-1", children: /* @__PURE__ */ jsxRuntime.jsx(ToolIconComponent, {}) }) }),
|
|
15132
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-4 justify-between w-full min-w-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
15133
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "header-md", as: "h2", className: "font-medium truncate", children: toolId }),
|
|
15134
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3", children: toolDescription })
|
|
15135
|
+
] }) })
|
|
15136
|
+
] }) });
|
|
15137
|
+
};
|
|
15138
|
+
|
|
15139
|
+
const ToolExecutor = ({
|
|
15140
|
+
isExecutingTool,
|
|
15141
|
+
zodInputSchema,
|
|
15142
|
+
handleExecuteTool,
|
|
15143
|
+
executionResult: result,
|
|
15144
|
+
errorString,
|
|
15145
|
+
toolDescription,
|
|
15146
|
+
toolId,
|
|
15147
|
+
toolType
|
|
15148
|
+
}) => {
|
|
15149
|
+
const theme = useCodemirrorTheme$1();
|
|
15150
|
+
const code = JSON.stringify(result ?? {}, null, 2);
|
|
15151
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(MainContentContent, { hasLeftServiceColumn: true, className: "relative", children: [
|
|
15152
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface2 border-r-sm border-border1 w-[20rem]", children: [
|
|
15153
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolInformation, { toolDescription, toolId, toolType }),
|
|
15154
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-5 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15155
|
+
DynamicForm,
|
|
15156
|
+
{
|
|
15157
|
+
isSubmitLoading: isExecutingTool,
|
|
15158
|
+
schema: zodInputSchema,
|
|
15159
|
+
onSubmit: (data) => {
|
|
15160
|
+
handleExecuteTool(data);
|
|
15161
|
+
},
|
|
15162
|
+
className: "h-auto pb-7"
|
|
15163
|
+
}
|
|
15164
|
+
) })
|
|
15165
|
+
] }),
|
|
15166
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-4 right-4 z-10", children: /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: code, tooltip: "Copy JSON result to clipboard" }) }),
|
|
15167
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-5 h-full relative overflow-x-auto overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { value: errorString || code, editable: true, theme, extensions: [langJson.jsonLanguage] }) })
|
|
15168
|
+
] });
|
|
15169
|
+
};
|
|
15170
|
+
|
|
15171
|
+
const AgentToolPanel = ({ toolId, agentId }) => {
|
|
15172
|
+
const { data: agent, isLoading: isAgentLoading } = useAgent(agentId);
|
|
15173
|
+
const tool = Object.values(agent?.tools ?? {}).find((tool2) => tool2.id === toolId);
|
|
15174
|
+
const { mutateAsync: executeTool, isPending: isExecutingTool, data: result } = useExecuteAgentTool();
|
|
15175
|
+
const { runtimeContext: playgroundRuntimeContext } = usePlaygroundStore();
|
|
15176
|
+
const handleExecuteTool = async (data) => {
|
|
15177
|
+
if (!tool) return;
|
|
15178
|
+
await executeTool({
|
|
15179
|
+
agentId,
|
|
15180
|
+
toolId: tool.id,
|
|
15181
|
+
input: data,
|
|
15182
|
+
playgroundRuntimeContext
|
|
15183
|
+
});
|
|
15184
|
+
};
|
|
15185
|
+
const zodInputSchema = tool?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(tool?.inputSchema))) : z.z.object({});
|
|
15186
|
+
if (isAgentLoading) return null;
|
|
15187
|
+
if (!tool)
|
|
15188
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-12 text-center px-6", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "header-md", className: "text-icon3", children: "Tool not found" }) });
|
|
15189
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15190
|
+
ToolExecutor,
|
|
15191
|
+
{
|
|
15192
|
+
executionResult: result,
|
|
15193
|
+
isExecutingTool,
|
|
15194
|
+
zodInputSchema,
|
|
15195
|
+
handleExecuteTool,
|
|
15196
|
+
toolDescription: tool.description,
|
|
15197
|
+
toolId: tool.id
|
|
15198
|
+
}
|
|
15199
|
+
);
|
|
15200
|
+
};
|
|
15201
|
+
|
|
14882
15202
|
const NameCell$1 = ({ row }) => {
|
|
14883
15203
|
const { Link, paths } = useLinkComponent();
|
|
14884
15204
|
const tool = row.original;
|
|
@@ -15026,6 +15346,52 @@ const useExecuteTool = () => {
|
|
|
15026
15346
|
});
|
|
15027
15347
|
};
|
|
15028
15348
|
|
|
15349
|
+
const useTools = () => {
|
|
15350
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
15351
|
+
const client = react$3.useMastraClient();
|
|
15352
|
+
return reactQuery.useQuery({
|
|
15353
|
+
queryKey: ["tools"],
|
|
15354
|
+
queryFn: () => client.getTools(runtimeContext)
|
|
15355
|
+
});
|
|
15356
|
+
};
|
|
15357
|
+
const useTool = (toolId) => {
|
|
15358
|
+
const client = react$3.useMastraClient();
|
|
15359
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
15360
|
+
return reactQuery.useQuery({
|
|
15361
|
+
queryKey: ["tool", toolId],
|
|
15362
|
+
queryFn: () => client.getTool(toolId).details(runtimeContext)
|
|
15363
|
+
});
|
|
15364
|
+
};
|
|
15365
|
+
|
|
15366
|
+
const ToolPanel = ({ toolId }) => {
|
|
15367
|
+
const { data: tool, isLoading } = useTool(toolId);
|
|
15368
|
+
const { mutateAsync: executeTool, isPending: isExecuting, data: result } = useExecuteTool();
|
|
15369
|
+
const { runtimeContext: playgroundRuntimeContext } = usePlaygroundStore();
|
|
15370
|
+
const handleExecuteTool = async (data) => {
|
|
15371
|
+
if (!tool) return;
|
|
15372
|
+
return executeTool({
|
|
15373
|
+
toolId: tool.id,
|
|
15374
|
+
input: data,
|
|
15375
|
+
runtimeContext: playgroundRuntimeContext
|
|
15376
|
+
});
|
|
15377
|
+
};
|
|
15378
|
+
const zodInputSchema = tool?.inputSchema ? resolveSerializedZodOutput(jsonSchemaToZod(superjson.parse(tool?.inputSchema))) : z.z.object({});
|
|
15379
|
+
if (isLoading) return null;
|
|
15380
|
+
if (!tool)
|
|
15381
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-12 text-center px-6", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "header-md", className: "text-icon3", children: "Tool not found" }) });
|
|
15382
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15383
|
+
ToolExecutor,
|
|
15384
|
+
{
|
|
15385
|
+
executionResult: result,
|
|
15386
|
+
isExecutingTool: isExecuting,
|
|
15387
|
+
zodInputSchema,
|
|
15388
|
+
handleExecuteTool,
|
|
15389
|
+
toolDescription: tool.description,
|
|
15390
|
+
toolId: tool.id
|
|
15391
|
+
}
|
|
15392
|
+
);
|
|
15393
|
+
};
|
|
15394
|
+
|
|
15029
15395
|
function TemplatesTools({
|
|
15030
15396
|
tagOptions,
|
|
15031
15397
|
selectedTag,
|
|
@@ -18578,6 +18944,234 @@ const EmptyMCPTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
|
18578
18944
|
}
|
|
18579
18945
|
) });
|
|
18580
18946
|
|
|
18947
|
+
const useMCPServers = () => {
|
|
18948
|
+
const client = react$3.useMastraClient();
|
|
18949
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
18950
|
+
return reactQuery.useQuery({
|
|
18951
|
+
queryKey: ["mcp-servers"],
|
|
18952
|
+
queryFn: async () => {
|
|
18953
|
+
const mcpServers = (await client.getMcpServers(runtimeContext)).servers;
|
|
18954
|
+
return mcpServers;
|
|
18955
|
+
}
|
|
18956
|
+
});
|
|
18957
|
+
};
|
|
18958
|
+
|
|
18959
|
+
const useMCPServerTool = (serverId, toolId) => {
|
|
18960
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
18961
|
+
const client = react$3.useMastraClient();
|
|
18962
|
+
return reactQuery.useQuery({
|
|
18963
|
+
queryKey: ["mcp-server-tool", serverId, toolId],
|
|
18964
|
+
queryFn: () => {
|
|
18965
|
+
const instance = client.getMcpServerTool(serverId, toolId);
|
|
18966
|
+
return instance.details(runtimeContext);
|
|
18967
|
+
}
|
|
18968
|
+
});
|
|
18969
|
+
};
|
|
18970
|
+
const useExecuteMCPTool = (serverId, toolId) => {
|
|
18971
|
+
const { runtimeContext } = usePlaygroundStore();
|
|
18972
|
+
const client = react$3.useMastraClient();
|
|
18973
|
+
return reactQuery.useMutation({
|
|
18974
|
+
mutationFn: (data) => {
|
|
18975
|
+
const instance = client.getMcpServerTool(serverId, toolId);
|
|
18976
|
+
return instance.execute({ data, runtimeContext });
|
|
18977
|
+
}
|
|
18978
|
+
});
|
|
18979
|
+
};
|
|
18980
|
+
|
|
18981
|
+
const MCPToolPanel = ({ toolId, serverId }) => {
|
|
18982
|
+
const { data: tool, isLoading } = useMCPServerTool(serverId, toolId);
|
|
18983
|
+
const { mutateAsync: executeTool, isPending: isExecuting, data: result } = useExecuteMCPTool(serverId, toolId);
|
|
18984
|
+
const handleExecuteTool = async (data) => {
|
|
18985
|
+
if (!tool) return;
|
|
18986
|
+
return await executeTool(data);
|
|
18987
|
+
};
|
|
18988
|
+
if (isLoading) return null;
|
|
18989
|
+
if (!tool)
|
|
18990
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-12 text-center px-6", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "header-md", className: "text-icon3", children: "Tool not found" }) });
|
|
18991
|
+
let zodInputSchema;
|
|
18992
|
+
try {
|
|
18993
|
+
zodInputSchema = resolveSerializedZodOutput(jsonSchemaToZod(tool.inputSchema));
|
|
18994
|
+
} catch (e) {
|
|
18995
|
+
console.error("Error processing input schema:", e);
|
|
18996
|
+
sonner.toast.error("Failed to process tool input schema.");
|
|
18997
|
+
zodInputSchema = z.z.object({});
|
|
18998
|
+
}
|
|
18999
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19000
|
+
ToolExecutor,
|
|
19001
|
+
{
|
|
19002
|
+
executionResult: result,
|
|
19003
|
+
isExecutingTool: isExecuting,
|
|
19004
|
+
zodInputSchema,
|
|
19005
|
+
handleExecuteTool,
|
|
19006
|
+
toolDescription: tool.description || "",
|
|
19007
|
+
toolId: tool.id
|
|
19008
|
+
}
|
|
19009
|
+
);
|
|
19010
|
+
};
|
|
19011
|
+
|
|
19012
|
+
const CodeMirrorBlock = (props) => {
|
|
19013
|
+
const theme = useCodemirrorTheme$1();
|
|
19014
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border-sm border-border1 bg-surface3 p-4 relative", children: [
|
|
19015
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-4 right-4 z-10", children: /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { tooltip: "Copy code", content: props.value || "No content" }) }),
|
|
19016
|
+
/* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { extensions: [langJson.json()], theme, ...props })
|
|
19017
|
+
] });
|
|
19018
|
+
};
|
|
19019
|
+
|
|
19020
|
+
const MCPDetail = ({ isLoading, server }) => {
|
|
19021
|
+
const [{ sseUrl, httpStreamUrl }, setUrls] = React.useState({
|
|
19022
|
+
sseUrl: "",
|
|
19023
|
+
httpStreamUrl: ""
|
|
19024
|
+
});
|
|
19025
|
+
React.useEffect(() => {
|
|
19026
|
+
if (!server) return;
|
|
19027
|
+
const host = window.MASTRA_SERVER_HOST;
|
|
19028
|
+
const port = window.MASTRA_SERVER_PORT;
|
|
19029
|
+
let baseUrl = null;
|
|
19030
|
+
if (host && port) {
|
|
19031
|
+
baseUrl = `http://${host}:${port}`;
|
|
19032
|
+
}
|
|
19033
|
+
const effectiveBaseUrl = baseUrl || "http://localhost:4111";
|
|
19034
|
+
const sseUrl2 = `${effectiveBaseUrl}/api/mcp/${server.id}/sse`;
|
|
19035
|
+
const httpStreamUrl2 = `${effectiveBaseUrl}/api/mcp/${server.id}/mcp`;
|
|
19036
|
+
setUrls({ sseUrl: sseUrl2, httpStreamUrl: httpStreamUrl2 });
|
|
19037
|
+
}, [server]);
|
|
19038
|
+
if (isLoading) return null;
|
|
19039
|
+
if (!server)
|
|
19040
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MainContentContent, { children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "h1", variant: "header-md", className: "text-icon3 font-medium py-20 text-center", children: "Server not found" }) });
|
|
19041
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(MainContentContent, { isDivided: true, children: [
|
|
19042
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-8 py-20 mx-auto max-w-[604px] w-full", children: [
|
|
19043
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "h1", variant: "header-md", className: "text-icon6 font-medium pb-4", children: server.name }),
|
|
19044
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
19045
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
19046
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19047
|
+
Badge$1,
|
|
19048
|
+
{
|
|
19049
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono w-6 text-accent1 text-ui-xs font-medium", children: "SSE" }),
|
|
19050
|
+
className: "!text-icon4",
|
|
19051
|
+
children: sseUrl
|
|
19052
|
+
}
|
|
19053
|
+
),
|
|
19054
|
+
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { tooltip: "Copy SSE URL", content: sseUrl, iconSize: "sm" })
|
|
19055
|
+
] }),
|
|
19056
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
19057
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19058
|
+
Badge$1,
|
|
19059
|
+
{
|
|
19060
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono w-6 text-accent1 text-ui-xs font-medium", children: "HTTP" }),
|
|
19061
|
+
className: "!text-icon4",
|
|
19062
|
+
children: httpStreamUrl
|
|
19063
|
+
}
|
|
19064
|
+
),
|
|
19065
|
+
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { tooltip: "Copy HTTP Stream URL", content: httpStreamUrl, iconSize: "sm" })
|
|
19066
|
+
] })
|
|
19067
|
+
] }),
|
|
19068
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 pt-3 pb-9", children: [
|
|
19069
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(FolderIcon, { className: "text-icon6" }), className: "rounded-r-sm !text-icon4", children: "Version" }),
|
|
19070
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge$1, { className: "rounded-l-sm !text-icon4", children: server.version_detail.version })
|
|
19071
|
+
] }),
|
|
19072
|
+
/* @__PURE__ */ jsxRuntime.jsx(McpSetupTabs, { sseUrl, serverName: server.name })
|
|
19073
|
+
] }),
|
|
19074
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-y-scroll border-l-sm border-border1", children: /* @__PURE__ */ jsxRuntime.jsx(McpToolList, { server }) })
|
|
19075
|
+
] });
|
|
19076
|
+
};
|
|
19077
|
+
const McpSetupTabs = ({ sseUrl, serverName }) => {
|
|
19078
|
+
const { Link } = useLinkComponent();
|
|
19079
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(PlaygroundTabs, { defaultTab: "cursor", children: [
|
|
19080
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TabList$1, { children: [
|
|
19081
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tab$1, { value: "cursor", children: "Cursor" }),
|
|
19082
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tab$1, { value: "windsurf", children: "Windsurf" })
|
|
19083
|
+
] }),
|
|
19084
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TabContent$1, { value: "cursor", children: [
|
|
19085
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { className: "text-icon3 pb-4", children: [
|
|
19086
|
+
"Cursor comes with built-in MCP Support.",
|
|
19087
|
+
" ",
|
|
19088
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19089
|
+
Link,
|
|
19090
|
+
{
|
|
19091
|
+
href: "https://docs.cursor.com/context/model-context-protocol",
|
|
19092
|
+
target: "_blank",
|
|
19093
|
+
rel: "noopener noreferrer",
|
|
19094
|
+
className: "underline hover:text-icon6",
|
|
19095
|
+
children: "Following the documentation"
|
|
19096
|
+
}
|
|
19097
|
+
),
|
|
19098
|
+
", you can register an MCP server using SSE with the following configuration."
|
|
19099
|
+
] }),
|
|
19100
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19101
|
+
CodeMirrorBlock,
|
|
19102
|
+
{
|
|
19103
|
+
editable: false,
|
|
19104
|
+
value: `{
|
|
19105
|
+
"mcpServers": {
|
|
19106
|
+
"${serverName}": {
|
|
19107
|
+
"url": "${sseUrl}"
|
|
19108
|
+
}
|
|
19109
|
+
}
|
|
19110
|
+
}`
|
|
19111
|
+
}
|
|
19112
|
+
)
|
|
19113
|
+
] }),
|
|
19114
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TabContent$1, { value: "windsurf", children: [
|
|
19115
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { className: "text-icon3 pb-4", children: [
|
|
19116
|
+
"Windsurf comes with built-in MCP Support.",
|
|
19117
|
+
" ",
|
|
19118
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19119
|
+
Link,
|
|
19120
|
+
{
|
|
19121
|
+
href: "https://docs.windsurf.com/windsurf/cascade/mcp#mcp-config-json",
|
|
19122
|
+
target: "_blank",
|
|
19123
|
+
rel: "noopener noreferrer",
|
|
19124
|
+
className: "underline hover:text-icon6",
|
|
19125
|
+
children: "Following the documentation"
|
|
19126
|
+
}
|
|
19127
|
+
),
|
|
19128
|
+
", you can register an MCP server using SSE with the following configuration."
|
|
19129
|
+
] }),
|
|
19130
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19131
|
+
CodeMirrorBlock,
|
|
19132
|
+
{
|
|
19133
|
+
editable: false,
|
|
19134
|
+
value: `{
|
|
19135
|
+
"mcpServers": {
|
|
19136
|
+
"${serverName}": {
|
|
19137
|
+
"command": "npx",
|
|
19138
|
+
"args": ["-y", "mcp-remote", "${sseUrl}"]
|
|
19139
|
+
}
|
|
19140
|
+
}
|
|
19141
|
+
}`
|
|
19142
|
+
}
|
|
19143
|
+
)
|
|
19144
|
+
] })
|
|
19145
|
+
] });
|
|
19146
|
+
};
|
|
19147
|
+
const McpToolList = ({ server }) => {
|
|
19148
|
+
const { data: tools = {}, isLoading } = useMCPServerTools(server);
|
|
19149
|
+
if (isLoading) return null;
|
|
19150
|
+
const toolsKeyArray = Object.keys(tools);
|
|
19151
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-5 overflow-y-scroll", children: [
|
|
19152
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-icon6 flex gap-2 items-center", children: [
|
|
19153
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: "bg-surface4 rounded-md p-1", children: /* @__PURE__ */ jsxRuntime.jsx(McpServerIcon, {}) }),
|
|
19154
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "header-md", as: "h2", className: "font-medium", children: "Available Tools" })
|
|
19155
|
+
] }),
|
|
19156
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 pt-6", children: toolsKeyArray.map((toolId) => {
|
|
19157
|
+
const tool = tools[toolId];
|
|
19158
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolEntry, { tool, serverId: server.id }, toolId);
|
|
19159
|
+
}) })
|
|
19160
|
+
] });
|
|
19161
|
+
};
|
|
19162
|
+
const ToolEntry = ({ tool, serverId }) => {
|
|
19163
|
+
const linkRef = React.useRef(null);
|
|
19164
|
+
const { Link, paths } = useLinkComponent();
|
|
19165
|
+
const ToolIconComponent = ToolIconMap[tool.toolType || "tool"];
|
|
19166
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Entity, { onClick: () => linkRef.current?.click(), children: [
|
|
19167
|
+
/* @__PURE__ */ jsxRuntime.jsx(EntityIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(ToolIconComponent, { className: "group-hover/entity:text-[#ECB047]" }) }),
|
|
19168
|
+
/* @__PURE__ */ jsxRuntime.jsxs(EntityContent, { children: [
|
|
19169
|
+
/* @__PURE__ */ jsxRuntime.jsx(EntityName, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { ref: linkRef, href: paths.mcpServerToolLink(serverId, tool.id), children: tool.id }) }),
|
|
19170
|
+
/* @__PURE__ */ jsxRuntime.jsx(EntityDescription, { children: tool.description })
|
|
19171
|
+
] })
|
|
19172
|
+
] });
|
|
19173
|
+
};
|
|
19174
|
+
|
|
18581
19175
|
const useEvalsByAgentId = (agentId, type) => {
|
|
18582
19176
|
const { runtimeContext } = usePlaygroundStore();
|
|
18583
19177
|
const client = react$3.useMastraClient();
|
|
@@ -18609,6 +19203,7 @@ exports.AgentNetworkCoinIcon = AgentNetworkCoinIcon;
|
|
|
18609
19203
|
exports.AgentSettings = AgentSettings;
|
|
18610
19204
|
exports.AgentSettingsContext = AgentSettingsContext;
|
|
18611
19205
|
exports.AgentSettingsProvider = AgentSettingsProvider;
|
|
19206
|
+
exports.AgentToolPanel = AgentToolPanel;
|
|
18612
19207
|
exports.AgentsTable = AgentsTable;
|
|
18613
19208
|
exports.AiIcon = AiIcon;
|
|
18614
19209
|
exports.Alert = Alert$1;
|
|
@@ -18676,7 +19271,9 @@ exports.KeyValueList = KeyValueList;
|
|
|
18676
19271
|
exports.LatencyIcon = LatencyIcon;
|
|
18677
19272
|
exports.LinkComponentProvider = LinkComponentProvider;
|
|
18678
19273
|
exports.LogsIcon = LogsIcon;
|
|
19274
|
+
exports.MCPDetail = MCPDetail;
|
|
18679
19275
|
exports.MCPTable = MCPTable;
|
|
19276
|
+
exports.MCPToolPanel = MCPToolPanel;
|
|
18680
19277
|
exports.MainContentContent = MainContentContent;
|
|
18681
19278
|
exports.MainContentLayout = MainContentLayout;
|
|
18682
19279
|
exports.MainSidebar = MainSidebar;
|
|
@@ -18742,6 +19339,9 @@ exports.ThreadList = ThreadList;
|
|
|
18742
19339
|
exports.Threads = Threads;
|
|
18743
19340
|
exports.ToolCoinIcon = ToolCoinIcon;
|
|
18744
19341
|
exports.ToolFallback = ToolFallback;
|
|
19342
|
+
exports.ToolIconMap = ToolIconMap;
|
|
19343
|
+
exports.ToolInformation = ToolInformation;
|
|
19344
|
+
exports.ToolPanel = ToolPanel;
|
|
18745
19345
|
exports.ToolTable = ToolTable;
|
|
18746
19346
|
exports.ToolsIcon = ToolsIcon;
|
|
18747
19347
|
exports.Tooltip = Tooltip;
|
|
@@ -18801,11 +19401,14 @@ exports.useCurrentRun = useCurrentRun;
|
|
|
18801
19401
|
exports.useDeleteThread = useDeleteThread;
|
|
18802
19402
|
exports.useEvalsByAgentId = useEvalsByAgentId;
|
|
18803
19403
|
exports.useExecuteAgentTool = useExecuteAgentTool;
|
|
19404
|
+
exports.useExecuteMCPTool = useExecuteMCPTool;
|
|
18804
19405
|
exports.useExecuteTool = useExecuteTool;
|
|
18805
19406
|
exports.useExecuteWorkflow = useExecuteWorkflow;
|
|
18806
19407
|
exports.useInView = useInView;
|
|
18807
19408
|
exports.useLinkComponent = useLinkComponent;
|
|
19409
|
+
exports.useMCPServerTool = useMCPServerTool;
|
|
18808
19410
|
exports.useMCPServerTools = useMCPServerTools;
|
|
19411
|
+
exports.useMCPServers = useMCPServers;
|
|
18809
19412
|
exports.useMainSidebar = useMainSidebar;
|
|
18810
19413
|
exports.useMemory = useMemory;
|
|
18811
19414
|
exports.useMemoryConfig = useMemoryConfig;
|
|
@@ -18824,6 +19427,8 @@ exports.useSpeechRecognition = useSpeechRecognition;
|
|
|
18824
19427
|
exports.useStreamWorkflow = useStreamWorkflow;
|
|
18825
19428
|
exports.useThreadInput = useThreadInput;
|
|
18826
19429
|
exports.useThreads = useThreads;
|
|
19430
|
+
exports.useTool = useTool;
|
|
19431
|
+
exports.useTools = useTools;
|
|
18827
19432
|
exports.useTraceSpanScores = useTraceSpanScores;
|
|
18828
19433
|
exports.useUpdateAgentModel = useUpdateAgentModel;
|
|
18829
19434
|
exports.useUpdateModelInModelList = useUpdateModelInModelList;
|