@mastra/playground-ui 22.1.1-alpha.0 → 22.1.1-alpha.1
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 +11 -0
- package/dist/index.cjs.js +98 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +4 -0
- package/dist/index.es.js +98 -5
- package/dist/index.es.js.map +1 -1
- package/dist/src/domains/tool-providers/components/selected-tool-list.d.ts +7 -0
- package/dist/src/domains/tool-providers/components/toolkit-list.d.ts +3 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @mastra/playground-ui
|
|
2
2
|
|
|
3
|
+
## 22.1.1-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed integration tools (Composio, Arcade) not saving when added to code-defined agents in the Agent Editor ([#15185](https://github.com/mastra-ai/mastra/pull/15185))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`ef94400`](https://github.com/mastra-ai/mastra/commit/ef9440049402596b31f2ab976c5e4508f6cb6c91)]:
|
|
10
|
+
- @mastra/core@1.24.1-alpha.0
|
|
11
|
+
- @mastra/client-js@1.13.3-alpha.0
|
|
12
|
+
- @mastra/react@0.2.25-alpha.0
|
|
13
|
+
|
|
3
14
|
## 22.1.1-alpha.0
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -30171,6 +30171,53 @@ const useAllIntegrationTools = () => {
|
|
|
30171
30171
|
};
|
|
30172
30172
|
};
|
|
30173
30173
|
|
|
30174
|
+
function SelectedToolList({ providerId, selectedTools, onToggle }) {
|
|
30175
|
+
const tools = React.useMemo(() => {
|
|
30176
|
+
const result = [];
|
|
30177
|
+
for (const [id, description] of selectedTools) {
|
|
30178
|
+
const sep = id.indexOf(":");
|
|
30179
|
+
if (sep === -1) continue;
|
|
30180
|
+
if (id.slice(0, sep) !== providerId) continue;
|
|
30181
|
+
result.push({ id, slug: id.slice(sep + 1), description });
|
|
30182
|
+
}
|
|
30183
|
+
return result;
|
|
30184
|
+
}, [selectedTools, providerId]);
|
|
30185
|
+
if (tools.length === 0) {
|
|
30186
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-neutral3", children: "No tools selected" }) });
|
|
30187
|
+
}
|
|
30188
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1 p-3", children: tools.map((tool) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
30189
|
+
"div",
|
|
30190
|
+
{
|
|
30191
|
+
role: onToggle ? "button" : void 0,
|
|
30192
|
+
tabIndex: onToggle ? 0 : void 0,
|
|
30193
|
+
onClick: onToggle ? () => onToggle(tool.id, tool.description) : void 0,
|
|
30194
|
+
onKeyDown: onToggle ? (e) => {
|
|
30195
|
+
if (e.target !== e.currentTarget) return;
|
|
30196
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
30197
|
+
e.preventDefault();
|
|
30198
|
+
onToggle(tool.id, tool.description);
|
|
30199
|
+
}
|
|
30200
|
+
} : void 0,
|
|
30201
|
+
className: cn("flex items-start gap-3 rounded-md px-3 py-2.5 bg-surface4", onToggle && "cursor-pointer"),
|
|
30202
|
+
children: [
|
|
30203
|
+
onToggle && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
30204
|
+
Checkbox,
|
|
30205
|
+
{
|
|
30206
|
+
checked: true,
|
|
30207
|
+
onCheckedChange: () => onToggle(tool.id, tool.description),
|
|
30208
|
+
onClick: (e) => e.stopPropagation()
|
|
30209
|
+
}
|
|
30210
|
+
) }),
|
|
30211
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
30212
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-neutral6 font-medium", children: tool.slug }),
|
|
30213
|
+
tool.description && /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-neutral3 line-clamp-2", children: tool.description })
|
|
30214
|
+
] })
|
|
30215
|
+
]
|
|
30216
|
+
},
|
|
30217
|
+
tool.id
|
|
30218
|
+
)) }) });
|
|
30219
|
+
}
|
|
30220
|
+
|
|
30174
30221
|
const useProviderTools = (providerId, params) => {
|
|
30175
30222
|
const client = react.useMastraClient();
|
|
30176
30223
|
return reactQuery.useQuery({
|
|
@@ -30202,6 +30249,7 @@ function ToolList({ providerId, toolkit, selectedIds, onToggle }) {
|
|
|
30202
30249
|
tabIndex: onToggle ? 0 : void 0,
|
|
30203
30250
|
onClick: onToggle ? () => onToggle(toolId, tool.description || "") : void 0,
|
|
30204
30251
|
onKeyDown: onToggle ? (e) => {
|
|
30252
|
+
if (e.target !== e.currentTarget) return;
|
|
30205
30253
|
if (e.key === "Enter" || e.key === " ") {
|
|
30206
30254
|
e.preventDefault();
|
|
30207
30255
|
onToggle(toolId, tool.description || "");
|
|
@@ -30245,7 +30293,8 @@ const useToolkits = (providerId) => {
|
|
|
30245
30293
|
});
|
|
30246
30294
|
};
|
|
30247
30295
|
|
|
30248
|
-
|
|
30296
|
+
const SELECTED_TOOLKIT_SENTINEL = "__selected__";
|
|
30297
|
+
function ToolkitList({ providerId, selectedToolkit, onSelectToolkit, selectedCount = 0 }) {
|
|
30249
30298
|
const { data, isLoading } = useToolkits(providerId);
|
|
30250
30299
|
const toolkits = data?.data ?? [];
|
|
30251
30300
|
if (isLoading) {
|
|
@@ -30265,6 +30314,22 @@ function ToolkitList({ providerId, selectedToolkit, onSelectToolkit }) {
|
|
|
30265
30314
|
children: "All"
|
|
30266
30315
|
}
|
|
30267
30316
|
),
|
|
30317
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
30318
|
+
"button",
|
|
30319
|
+
{
|
|
30320
|
+
type: "button",
|
|
30321
|
+
onClick: () => onSelectToolkit(SELECTED_TOOLKIT_SENTINEL),
|
|
30322
|
+
className: cn(
|
|
30323
|
+
"text-left px-3 py-2 rounded-md text-ui-sm flex items-center justify-between gap-2",
|
|
30324
|
+
transitions.colors,
|
|
30325
|
+
selectedToolkit === SELECTED_TOOLKIT_SENTINEL ? "bg-surface4 text-neutral6 font-medium" : "text-neutral3 hover:bg-surface4 hover:text-neutral5"
|
|
30326
|
+
),
|
|
30327
|
+
children: [
|
|
30328
|
+
"Selected",
|
|
30329
|
+
selectedCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-xs tabular-nums bg-surface3 rounded-full px-1.5 py-0.5 min-w-[1.25rem] text-center", children: selectedCount })
|
|
30330
|
+
]
|
|
30331
|
+
}
|
|
30332
|
+
),
|
|
30268
30333
|
toolkits.map((toolkit) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
30269
30334
|
"button",
|
|
30270
30335
|
{
|
|
@@ -30341,10 +30406,18 @@ function ToolProviderDialog({ provider, onClose, selectedToolIds, onSubmit }) {
|
|
|
30341
30406
|
{
|
|
30342
30407
|
providerId: provider.id,
|
|
30343
30408
|
selectedToolkit,
|
|
30344
|
-
onSelectToolkit: setSelectedToolkit
|
|
30409
|
+
onSelectToolkit: setSelectedToolkit,
|
|
30410
|
+
selectedCount: localSelection.size
|
|
30345
30411
|
}
|
|
30346
30412
|
) }),
|
|
30347
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden", children: provider && /* @__PURE__ */ jsxRuntime.jsx(
|
|
30413
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden", children: provider && selectedToolkit === SELECTED_TOOLKIT_SENTINEL ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
30414
|
+
SelectedToolList,
|
|
30415
|
+
{
|
|
30416
|
+
providerId: provider.id,
|
|
30417
|
+
selectedTools: localSelection,
|
|
30418
|
+
onToggle: onSubmit ? handleToggle : void 0
|
|
30419
|
+
}
|
|
30420
|
+
) : provider && /* @__PURE__ */ jsxRuntime.jsx(
|
|
30348
30421
|
ToolList,
|
|
30349
30422
|
{
|
|
30350
30423
|
providerId: provider.id,
|
|
@@ -30363,6 +30436,17 @@ function IntegrationToolsSection({ selectedToolIds, onSubmitTools }) {
|
|
|
30363
30436
|
const { data, isLoading } = useToolProviders();
|
|
30364
30437
|
const providers = data?.providers ?? [];
|
|
30365
30438
|
const [selectedProvider, setSelectedProvider] = React.useState(null);
|
|
30439
|
+
const toolCountsByProvider = React.useMemo(() => {
|
|
30440
|
+
const counts = {};
|
|
30441
|
+
if (!selectedToolIds) return counts;
|
|
30442
|
+
for (const key of Object.keys(selectedToolIds)) {
|
|
30443
|
+
const sep = key.indexOf(":");
|
|
30444
|
+
if (sep === -1) continue;
|
|
30445
|
+
const providerId = key.slice(0, sep);
|
|
30446
|
+
counts[providerId] = (counts[providerId] ?? 0) + 1;
|
|
30447
|
+
}
|
|
30448
|
+
return counts;
|
|
30449
|
+
}, [selectedToolIds]);
|
|
30366
30450
|
if (isLoading || providers.length === 0) {
|
|
30367
30451
|
return null;
|
|
30368
30452
|
}
|
|
@@ -30372,6 +30456,7 @@ function IntegrationToolsSection({ selectedToolIds, onSubmitTools }) {
|
|
|
30372
30456
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: providers.map((provider) => {
|
|
30373
30457
|
const bg = stringToColor(provider.name);
|
|
30374
30458
|
const text = stringToColor(provider.name, 25);
|
|
30459
|
+
const count = toolCountsByProvider[provider.id] ?? 0;
|
|
30375
30460
|
return /* @__PURE__ */ jsxRuntime.jsxs(Entity, { onClick: () => setSelectedProvider(provider), className: "bg-surface2", children: [
|
|
30376
30461
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
30377
30462
|
"div",
|
|
@@ -30385,7 +30470,14 @@ function IntegrationToolsSection({ selectedToolIds, onSubmitTools }) {
|
|
|
30385
30470
|
/* @__PURE__ */ jsxRuntime.jsx(EntityName, { children: provider.name }),
|
|
30386
30471
|
provider.description && /* @__PURE__ */ jsxRuntime.jsx(EntityDescription, { children: provider.description })
|
|
30387
30472
|
] }),
|
|
30388
|
-
/* @__PURE__ */ jsxRuntime.
|
|
30473
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
30474
|
+
count > 0 && /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "default", children: [
|
|
30475
|
+
count,
|
|
30476
|
+
" ",
|
|
30477
|
+
count === 1 ? "tool" : "tools"
|
|
30478
|
+
] }),
|
|
30479
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "success", children: "Available" })
|
|
30480
|
+
] })
|
|
30389
30481
|
] }, provider.id);
|
|
30390
30482
|
}) })
|
|
30391
30483
|
] }),
|
|
@@ -33496,9 +33588,10 @@ function useAgentCmsForm(options) {
|
|
|
33496
33588
|
// applyStoredOverrides will NOT apply these fields for code agent overrides.
|
|
33497
33589
|
name: values.name,
|
|
33498
33590
|
model: values.model,
|
|
33499
|
-
// Only send editable fields: instructions, tools, and variables (requestContextSchema)
|
|
33591
|
+
// Only send editable fields: instructions, tools, integrationTools, and variables (requestContextSchema)
|
|
33500
33592
|
instructions: mapInstructionBlocksToApi(values.instructionBlocks),
|
|
33501
33593
|
tools: Object.keys(registryTools2).length > 0 ? registryTools2 : void 0,
|
|
33594
|
+
integrationTools: transformIntegrationToolsForApi(values.integrationTools),
|
|
33502
33595
|
mcpClients: mcpClientsParam2,
|
|
33503
33596
|
requestContextSchema: values.variables ? Object.fromEntries(Object.entries(values.variables)) : void 0
|
|
33504
33597
|
};
|