@mastra/playground-ui 7.0.0-beta.24 → 7.0.0-beta.26
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 +75 -0
- package/dist/index.cjs.js +545 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +539 -30
- package/dist/index.es.js.map +1 -1
- package/dist/src/domains/agents/components/agent-metadata/agent-metadata.d.ts +11 -0
- package/dist/src/domains/processors/components/index.d.ts +2 -0
- package/dist/src/domains/processors/components/processor-panel.d.ts +8 -0
- package/dist/src/domains/processors/components/processor-table/columns.d.ts +12 -0
- package/dist/src/domains/processors/components/processor-table/index.d.ts +2 -0
- package/dist/src/domains/processors/components/processor-table/processor-table.d.ts +7 -0
- package/dist/src/domains/processors/hooks/index.d.ts +1 -0
- package/dist/src/domains/processors/hooks/use-processors.d.ts +50 -0
- package/dist/src/domains/processors/index.d.ts +2 -0
- package/dist/src/domains/workflows/hooks/use-workflows.d.ts +3 -1
- package/dist/src/domains/workflows/workflow/workflow-input-data.d.ts +2 -1
- package/dist/src/ds/icons/ProcessorIcon.d.ts +2 -0
- package/dist/src/ds/icons/index.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/lib/ai-ui/tools/badges/tool-approval-buttons.d.ts +2 -1
- package/dist/src/lib/framework.d.ts +2 -0
- package/dist/src/services/tool-call-provider.d.ts +5 -1
- package/package.json +10 -10
package/dist/index.cjs.js
CHANGED
|
@@ -71,6 +71,7 @@ const languageData = require('@codemirror/language-data');
|
|
|
71
71
|
const codemirrorThemeGithub = require('@uiw/codemirror-theme-github');
|
|
72
72
|
const AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
73
73
|
const format = require('date-fns/format');
|
|
74
|
+
const observability = require('@mastra/core/observability');
|
|
74
75
|
const semver = require('semver');
|
|
75
76
|
|
|
76
77
|
function _interopNamespaceDefault(e) {
|
|
@@ -4339,6 +4340,36 @@ const AgentNetworkCoinIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", {
|
|
|
4339
4340
|
) }) })
|
|
4340
4341
|
] });
|
|
4341
4342
|
|
|
4343
|
+
function ProcessorIcon(props) {
|
|
4344
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4345
|
+
"svg",
|
|
4346
|
+
{
|
|
4347
|
+
width: "24",
|
|
4348
|
+
height: "24",
|
|
4349
|
+
viewBox: "0 0 24 24",
|
|
4350
|
+
fill: "none",
|
|
4351
|
+
stroke: "currentColor",
|
|
4352
|
+
strokeWidth: "2",
|
|
4353
|
+
strokeLinecap: "round",
|
|
4354
|
+
strokeLinejoin: "round",
|
|
4355
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4356
|
+
...props,
|
|
4357
|
+
children: [
|
|
4358
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "16", height: "16", x: "4", y: "4", rx: "2" }),
|
|
4359
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "6", height: "6", x: "9", y: "9", rx: "1" }),
|
|
4360
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 2v2" }),
|
|
4361
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 20v2" }),
|
|
4362
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 15h2" }),
|
|
4363
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 9h2" }),
|
|
4364
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 15h2" }),
|
|
4365
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 9h2" }),
|
|
4366
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 2v2" }),
|
|
4367
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 20v2" })
|
|
4368
|
+
]
|
|
4369
|
+
}
|
|
4370
|
+
);
|
|
4371
|
+
}
|
|
4372
|
+
|
|
4342
4373
|
const variantClasses$1 = {
|
|
4343
4374
|
warning: "bg-accent6Darker border-accent6/30 text-accent6",
|
|
4344
4375
|
destructive: "bg-accent2Darker border-accent2/30 text-accent2",
|
|
@@ -4759,6 +4790,8 @@ function ToolCallProvider({
|
|
|
4759
4790
|
children,
|
|
4760
4791
|
approveToolcall,
|
|
4761
4792
|
declineToolcall,
|
|
4793
|
+
approveToolcallGenerate,
|
|
4794
|
+
declineToolcallGenerate,
|
|
4762
4795
|
approveNetworkToolcall,
|
|
4763
4796
|
declineNetworkToolcall,
|
|
4764
4797
|
isRunning,
|
|
@@ -4771,6 +4804,8 @@ function ToolCallProvider({
|
|
|
4771
4804
|
value: {
|
|
4772
4805
|
approveToolcall,
|
|
4773
4806
|
declineToolcall,
|
|
4807
|
+
approveToolcallGenerate,
|
|
4808
|
+
declineToolcallGenerate,
|
|
4774
4809
|
approveNetworkToolcall,
|
|
4775
4810
|
declineNetworkToolcall,
|
|
4776
4811
|
isRunning,
|
|
@@ -4794,11 +4829,14 @@ const ToolApprovalButtons = ({
|
|
|
4794
4829
|
toolCallId,
|
|
4795
4830
|
toolApprovalMetadata,
|
|
4796
4831
|
toolName,
|
|
4797
|
-
isNetwork
|
|
4832
|
+
isNetwork,
|
|
4833
|
+
isGenerateMode
|
|
4798
4834
|
}) => {
|
|
4799
4835
|
const {
|
|
4800
4836
|
approveToolcall,
|
|
4801
4837
|
declineToolcall,
|
|
4838
|
+
approveToolcallGenerate,
|
|
4839
|
+
declineToolcallGenerate,
|
|
4802
4840
|
isRunning,
|
|
4803
4841
|
toolCallApprovals,
|
|
4804
4842
|
approveNetworkToolcall,
|
|
@@ -4808,6 +4846,8 @@ const ToolApprovalButtons = ({
|
|
|
4808
4846
|
const handleApprove = () => {
|
|
4809
4847
|
if (isNetwork) {
|
|
4810
4848
|
approveNetworkToolcall(toolName, toolApprovalMetadata?.runId);
|
|
4849
|
+
} else if (isGenerateMode) {
|
|
4850
|
+
approveToolcallGenerate(toolCallId);
|
|
4811
4851
|
} else {
|
|
4812
4852
|
approveToolcall(toolCallId);
|
|
4813
4853
|
}
|
|
@@ -4815,6 +4855,8 @@ const ToolApprovalButtons = ({
|
|
|
4815
4855
|
const handleDecline = () => {
|
|
4816
4856
|
if (isNetwork) {
|
|
4817
4857
|
declineNetworkToolcall(toolName, toolApprovalMetadata?.runId);
|
|
4858
|
+
} else if (isGenerateMode) {
|
|
4859
|
+
declineToolcallGenerate(toolCallId);
|
|
4818
4860
|
} else {
|
|
4819
4861
|
declineToolcall(toolCallId);
|
|
4820
4862
|
}
|
|
@@ -4916,7 +4958,8 @@ const ToolBadge = ({
|
|
|
4916
4958
|
toolCallId,
|
|
4917
4959
|
toolApprovalMetadata,
|
|
4918
4960
|
toolName,
|
|
4919
|
-
isNetwork
|
|
4961
|
+
isNetwork,
|
|
4962
|
+
isGenerateMode: metadata?.mode === "generate"
|
|
4920
4963
|
}
|
|
4921
4964
|
)
|
|
4922
4965
|
] })
|
|
@@ -4994,7 +5037,10 @@ const useWorkflows = () => {
|
|
|
4994
5037
|
const { requestContext } = usePlaygroundStore();
|
|
4995
5038
|
return reactQuery.useQuery({
|
|
4996
5039
|
queryKey: ["workflows", requestContext],
|
|
4997
|
-
queryFn: () =>
|
|
5040
|
+
queryFn: async () => {
|
|
5041
|
+
const workflows = await client.listWorkflows(requestContext);
|
|
5042
|
+
return Object.fromEntries(Object.entries(workflows).filter(([_, workflow]) => !workflow.isProcessorWorkflow));
|
|
5043
|
+
}
|
|
4998
5044
|
});
|
|
4999
5045
|
};
|
|
5000
5046
|
|
|
@@ -8170,9 +8216,10 @@ const WorkflowInputData = ({
|
|
|
8170
8216
|
isSubmitLoading,
|
|
8171
8217
|
submitButtonLabel,
|
|
8172
8218
|
onSubmit,
|
|
8173
|
-
children
|
|
8219
|
+
children,
|
|
8220
|
+
isProcessorWorkflow
|
|
8174
8221
|
}) => {
|
|
8175
|
-
const [type, setType] = React.useState("form");
|
|
8222
|
+
const [type, setType] = React.useState(isProcessorWorkflow ? "simple" : "form");
|
|
8176
8223
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8177
8224
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8178
8225
|
RadioGroup,
|
|
@@ -8182,6 +8229,10 @@ const WorkflowInputData = ({
|
|
|
8182
8229
|
onValueChange: (value) => setType(value),
|
|
8183
8230
|
className: "pb-4",
|
|
8184
8231
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row gap-4", children: [
|
|
8232
|
+
isProcessorWorkflow && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
8233
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "simple", id: "simple" }),
|
|
8234
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "simple", className: "!text-neutral3 text-ui-sm", children: "Simple" })
|
|
8235
|
+
] }),
|
|
8185
8236
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
8186
8237
|
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: "form", id: "form" }),
|
|
8187
8238
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "form", className: "!text-neutral3 text-ui-sm", children: "Form" })
|
|
@@ -8199,7 +8250,18 @@ const WorkflowInputData = ({
|
|
|
8199
8250
|
className: cn({
|
|
8200
8251
|
"opacity-50 pointer-events-none": isSubmitLoading
|
|
8201
8252
|
}),
|
|
8202
|
-
children: type === "
|
|
8253
|
+
children: type === "simple" && isProcessorWorkflow ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8254
|
+
SimpleProcessorInput,
|
|
8255
|
+
{
|
|
8256
|
+
schema,
|
|
8257
|
+
defaultValues,
|
|
8258
|
+
isSubmitLoading,
|
|
8259
|
+
submitButtonLabel,
|
|
8260
|
+
onSubmit,
|
|
8261
|
+
withoutSubmit,
|
|
8262
|
+
children
|
|
8263
|
+
}
|
|
8264
|
+
) : type === "form" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8203
8265
|
DynamicForm,
|
|
8204
8266
|
{
|
|
8205
8267
|
schema,
|
|
@@ -8268,6 +8330,87 @@ const JSONInput = ({
|
|
|
8268
8330
|
withoutSubmit ? null : /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "light", onClick: handleSubmit, className: "w-full", size: "lg", children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) : submitButtonLabel })
|
|
8269
8331
|
] });
|
|
8270
8332
|
};
|
|
8333
|
+
const PROCESSOR_PHASES = [
|
|
8334
|
+
{ value: "input", label: "Input - Process input messages before LLM" },
|
|
8335
|
+
{ value: "inputStep", label: "Input Step - Process at each agentic loop step" },
|
|
8336
|
+
{ value: "outputStream", label: "Output Stream - Process streaming chunks" },
|
|
8337
|
+
{ value: "outputResult", label: "Output Result - Process complete output" },
|
|
8338
|
+
{ value: "outputStep", label: "Output Step - Process after each LLM response" }
|
|
8339
|
+
];
|
|
8340
|
+
const SimpleProcessorInput = ({
|
|
8341
|
+
schema,
|
|
8342
|
+
defaultValues,
|
|
8343
|
+
isSubmitLoading,
|
|
8344
|
+
submitButtonLabel,
|
|
8345
|
+
onSubmit,
|
|
8346
|
+
withoutSubmit,
|
|
8347
|
+
children
|
|
8348
|
+
}) => {
|
|
8349
|
+
const [message, setMessage] = React.useState("Hello, this is a test message.");
|
|
8350
|
+
const [phase, setPhase] = React.useState("input");
|
|
8351
|
+
const [errors, setErrors] = React.useState([]);
|
|
8352
|
+
const handleSubmit = () => {
|
|
8353
|
+
setErrors([]);
|
|
8354
|
+
const isOutputPhase = phase === "outputStep" || phase === "outputResult";
|
|
8355
|
+
const messageRole = isOutputPhase ? "assistant" : "user";
|
|
8356
|
+
const data = {
|
|
8357
|
+
messages: [
|
|
8358
|
+
{
|
|
8359
|
+
id: crypto.randomUUID(),
|
|
8360
|
+
role: messageRole,
|
|
8361
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8362
|
+
content: {
|
|
8363
|
+
format: 2,
|
|
8364
|
+
parts: [{ type: "text", text: message }]
|
|
8365
|
+
}
|
|
8366
|
+
}
|
|
8367
|
+
],
|
|
8368
|
+
phase
|
|
8369
|
+
};
|
|
8370
|
+
try {
|
|
8371
|
+
const result = schema.safeParse(data);
|
|
8372
|
+
if (!result.success) {
|
|
8373
|
+
setErrors(result.error.issues.map((e) => `[${e.path.join(".")}] ${e.message}`));
|
|
8374
|
+
} else {
|
|
8375
|
+
onSubmit(result.data);
|
|
8376
|
+
}
|
|
8377
|
+
} catch (e) {
|
|
8378
|
+
setErrors(["Error processing input"]);
|
|
8379
|
+
}
|
|
8380
|
+
};
|
|
8381
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
8382
|
+
errors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border border-accent2 rounded-lg p-2", children: [
|
|
8383
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Txt, { as: "p", variant: "ui-md", className: "text-accent2 font-semibold", children: [
|
|
8384
|
+
errors.length,
|
|
8385
|
+
" errors found"
|
|
8386
|
+
] }),
|
|
8387
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-disc list-inside", children: errors.map((error, idx) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-ui-sm text-accent2", children: error }, idx)) })
|
|
8388
|
+
] }),
|
|
8389
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
8390
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", variant: "ui-sm", className: "text-neutral3", children: "Phase" }),
|
|
8391
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: phase, onValueChange: setPhase, children: [
|
|
8392
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select phase" }) }),
|
|
8393
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: PROCESSOR_PHASES.map((p) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: p.value, children: p.value }, p.value)) })
|
|
8394
|
+
] }),
|
|
8395
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-xs", className: "text-icon4", children: PROCESSOR_PHASES.find((p) => p.value === phase)?.label })
|
|
8396
|
+
] }),
|
|
8397
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
8398
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", variant: "ui-sm", className: "text-neutral3", children: "Test Message" }),
|
|
8399
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8400
|
+
"textarea",
|
|
8401
|
+
{
|
|
8402
|
+
value: message,
|
|
8403
|
+
onChange: (e) => setMessage(e.target.value),
|
|
8404
|
+
placeholder: "Enter a test message...",
|
|
8405
|
+
rows: 4,
|
|
8406
|
+
className: "w-full bg-transparent border border-border1 rounded-md p-3 text-ui-sm text-neutral6 placeholder:text-neutral3 focus:outline-none focus:ring-2 focus:ring-accent1"
|
|
8407
|
+
}
|
|
8408
|
+
)
|
|
8409
|
+
] }),
|
|
8410
|
+
children,
|
|
8411
|
+
withoutSubmit ? null : /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "light", onClick: handleSubmit, className: "w-full", size: "lg", children: isSubmitLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) : submitButtonLabel })
|
|
8412
|
+
] });
|
|
8413
|
+
};
|
|
8271
8414
|
|
|
8272
8415
|
const formatJSON = async (code) => {
|
|
8273
8416
|
const formatted = await prettier.format(code, {
|
|
@@ -9648,7 +9791,8 @@ function WorkflowTrigger({
|
|
|
9648
9791
|
setPayload(data);
|
|
9649
9792
|
handleExecuteWorkflow(data);
|
|
9650
9793
|
},
|
|
9651
|
-
withoutSubmit: !!paramsRunId
|
|
9794
|
+
withoutSubmit: !!paramsRunId,
|
|
9795
|
+
isProcessorWorkflow: workflow?.isProcessorWorkflow
|
|
9652
9796
|
}
|
|
9653
9797
|
) : !!paramsRunId ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
9654
9798
|
Button,
|
|
@@ -10079,6 +10223,8 @@ const LinkComponentContext = React.createContext({
|
|
|
10079
10223
|
networkThreadLink: () => "",
|
|
10080
10224
|
scorerLink: () => "",
|
|
10081
10225
|
toolLink: () => "",
|
|
10226
|
+
processorsLink: () => "",
|
|
10227
|
+
processorLink: () => "",
|
|
10082
10228
|
mcpServerLink: () => "",
|
|
10083
10229
|
mcpServerToolLink: () => "",
|
|
10084
10230
|
workflowRunLink: () => ""
|
|
@@ -10095,7 +10241,7 @@ const useLinkComponent = () => {
|
|
|
10095
10241
|
return ctx;
|
|
10096
10242
|
};
|
|
10097
10243
|
|
|
10098
|
-
const columns$
|
|
10244
|
+
const columns$5 = [
|
|
10099
10245
|
{
|
|
10100
10246
|
id: "name",
|
|
10101
10247
|
header: "Name",
|
|
@@ -10105,10 +10251,7 @@ const columns$4 = [
|
|
|
10105
10251
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10106
10252
|
EntryCell,
|
|
10107
10253
|
{
|
|
10108
|
-
name: /* @__PURE__ */ jsxRuntime.
|
|
10109
|
-
/* @__PURE__ */ jsxRuntime.jsx(Link, { href: paths.workflowLink(row.original.id), children: row.original.name }),
|
|
10110
|
-
workflow.isProcessorWorkflow && /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cpu, { className: "h-3 w-3" }), className: "!h-badge-sm bg-violet-500/20 text-violet-400", children: "Processor" })
|
|
10111
|
-
] }),
|
|
10254
|
+
name: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: paths.workflowLink(row.original.id), children: row.original.name }),
|
|
10112
10255
|
description: workflow.description,
|
|
10113
10256
|
meta: void 0
|
|
10114
10257
|
}
|
|
@@ -10221,7 +10364,7 @@ function WorkflowTable({ workflows, isLoading }) {
|
|
|
10221
10364
|
}, [workflows]);
|
|
10222
10365
|
const table = reactTable.useReactTable({
|
|
10223
10366
|
data: workflowData,
|
|
10224
|
-
columns: columns$
|
|
10367
|
+
columns: columns$5,
|
|
10225
10368
|
getCoreRowModel: reactTable.getCoreRowModel()
|
|
10226
10369
|
});
|
|
10227
10370
|
const ths = table.getHeaderGroups()[0];
|
|
@@ -11114,7 +11257,8 @@ const WorkflowBadge = ({
|
|
|
11114
11257
|
toolCallId,
|
|
11115
11258
|
toolApprovalMetadata,
|
|
11116
11259
|
toolName,
|
|
11117
|
-
isNetwork
|
|
11260
|
+
isNetwork,
|
|
11261
|
+
isGenerateMode: metadata?.mode === "generate"
|
|
11118
11262
|
}
|
|
11119
11263
|
)
|
|
11120
11264
|
]
|
|
@@ -11218,7 +11362,8 @@ const AgentBadge = ({
|
|
|
11218
11362
|
toolCallId,
|
|
11219
11363
|
toolApprovalMetadata,
|
|
11220
11364
|
toolName,
|
|
11221
|
-
isNetwork
|
|
11365
|
+
isNetwork,
|
|
11366
|
+
isGenerateMode: metadata?.mode === "generate"
|
|
11222
11367
|
}
|
|
11223
11368
|
)
|
|
11224
11369
|
]
|
|
@@ -11286,8 +11431,8 @@ const ToolFallbackInner = ({ toolName, result, args, metadata, toolCallId, ...pr
|
|
|
11286
11431
|
const isNetwork = metadata?.mode === "network";
|
|
11287
11432
|
const agentToolName = toolName.startsWith("agent-") ? toolName.substring("agent-".length) : toolName;
|
|
11288
11433
|
const workflowToolName = toolName.startsWith("workflow-") ? toolName.substring("workflow-".length) : toolName;
|
|
11289
|
-
const requireApprovalMetadata = (metadata?.mode === "stream" || metadata?.mode === "network") && metadata?.requireApprovalMetadata;
|
|
11290
|
-
const suspendedTools = (metadata?.mode === "stream" || metadata?.mode === "network") && metadata?.suspendedTools;
|
|
11434
|
+
const requireApprovalMetadata = (metadata?.mode === "stream" || metadata?.mode === "network" || metadata?.mode === "generate") && metadata?.requireApprovalMetadata;
|
|
11435
|
+
const suspendedTools = (metadata?.mode === "stream" || metadata?.mode === "network" || metadata?.mode === "generate") && metadata?.suspendedTools;
|
|
11291
11436
|
const toolApprovalMetadata = requireApprovalMetadata ? requireApprovalMetadata?.[toolName] ?? requireApprovalMetadata?.[toolCallId] : void 0;
|
|
11292
11437
|
const suspendedToolMetadata = suspendedTools ? suspendedTools?.[toolName] : void 0;
|
|
11293
11438
|
const toolCalled = metadata?.mode === "network" && metadata?.hasMoreMessages ? true : void 0;
|
|
@@ -13033,6 +13178,8 @@ function MastraRuntimeProvider({
|
|
|
13033
13178
|
setMessages,
|
|
13034
13179
|
approveToolCall,
|
|
13035
13180
|
declineToolCall,
|
|
13181
|
+
approveToolCallGenerate,
|
|
13182
|
+
declineToolCallGenerate,
|
|
13036
13183
|
toolCallApprovals,
|
|
13037
13184
|
approveNetworkToolCall,
|
|
13038
13185
|
declineNetworkToolCall,
|
|
@@ -13484,6 +13631,8 @@ function MastraRuntimeProvider({
|
|
|
13484
13631
|
{
|
|
13485
13632
|
approveToolcall: approveToolCall,
|
|
13486
13633
|
declineToolcall: declineToolCall,
|
|
13634
|
+
approveToolcallGenerate: approveToolCallGenerate,
|
|
13635
|
+
declineToolcallGenerate: declineToolCallGenerate,
|
|
13487
13636
|
isRunning: isRunningStream,
|
|
13488
13637
|
toolCallApprovals,
|
|
13489
13638
|
approveNetworkToolcall: approveNetworkToolCall,
|
|
@@ -14087,7 +14236,7 @@ const AgentSettings = ({ agentId }) => {
|
|
|
14087
14236
|
] });
|
|
14088
14237
|
};
|
|
14089
14238
|
|
|
14090
|
-
const NameCell$
|
|
14239
|
+
const NameCell$4 = ({ row }) => {
|
|
14091
14240
|
const { Link, paths } = useLinkComponent();
|
|
14092
14241
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14093
14242
|
EntryCell,
|
|
@@ -14097,11 +14246,11 @@ const NameCell$3 = ({ row }) => {
|
|
|
14097
14246
|
}
|
|
14098
14247
|
);
|
|
14099
14248
|
};
|
|
14100
|
-
const columns$
|
|
14249
|
+
const columns$4 = [
|
|
14101
14250
|
{
|
|
14102
14251
|
header: "Name",
|
|
14103
14252
|
accessorKey: "name",
|
|
14104
|
-
cell: NameCell$
|
|
14253
|
+
cell: NameCell$4
|
|
14105
14254
|
},
|
|
14106
14255
|
{
|
|
14107
14256
|
header: "Model",
|
|
@@ -14143,7 +14292,9 @@ const columns$3 = [
|
|
|
14143
14292
|
const agentsCount = Object.keys(agent.agents || {}).length;
|
|
14144
14293
|
const toolsCount = Object.keys(agent.tools || {}).length;
|
|
14145
14294
|
const workflowsCount = Object.keys(agent.workflows || {}).length;
|
|
14146
|
-
|
|
14295
|
+
const inputProcessorsCount = (agent.inputProcessors || []).length;
|
|
14296
|
+
const outputProcessorsCount = (agent.outputProcessors || []).length;
|
|
14297
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-row gap-2 w-full items-center flex-wrap", children: [
|
|
14147
14298
|
/* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "default", icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, { className: "text-accent1" }), children: [
|
|
14148
14299
|
agentsCount,
|
|
14149
14300
|
" agent",
|
|
@@ -14158,6 +14309,22 @@ const columns$3 = [
|
|
|
14158
14309
|
workflowsCount,
|
|
14159
14310
|
" workflow",
|
|
14160
14311
|
workflowsCount > 1 ? "s" : ""
|
|
14312
|
+
] }),
|
|
14313
|
+
(inputProcessorsCount > 0 || outputProcessorsCount > 0) && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
14314
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", icon: /* @__PURE__ */ jsxRuntime.jsx(ProcessorIcon, { className: "text-accent4" }) }) }),
|
|
14315
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TooltipContent, { className: "flex flex-col gap-1", children: [
|
|
14316
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14317
|
+
"a",
|
|
14318
|
+
{
|
|
14319
|
+
href: "https://mastra.ai/docs/agents/processors",
|
|
14320
|
+
target: "_blank",
|
|
14321
|
+
rel: "noopener noreferrer",
|
|
14322
|
+
className: "text-accent1 hover:underline",
|
|
14323
|
+
children: "Processors"
|
|
14324
|
+
}
|
|
14325
|
+
),
|
|
14326
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-icon3", children: [inputProcessorsCount > 0 && "input", outputProcessorsCount > 0 && "output"].filter(Boolean).join(", ") })
|
|
14327
|
+
] })
|
|
14161
14328
|
] })
|
|
14162
14329
|
] }) });
|
|
14163
14330
|
}
|
|
@@ -14170,7 +14337,7 @@ function AgentsTable({ agents, isLoading }) {
|
|
|
14170
14337
|
const projectData = React.useMemo(() => Object.values(agents), [agents]);
|
|
14171
14338
|
const table = reactTable.useReactTable({
|
|
14172
14339
|
data: projectData,
|
|
14173
|
-
columns: columns$
|
|
14340
|
+
columns: columns$4,
|
|
14174
14341
|
getCoreRowModel: reactTable.getCoreRowModel()
|
|
14175
14342
|
});
|
|
14176
14343
|
const ths = table.getHeaderGroups()[0];
|
|
@@ -15216,7 +15383,7 @@ function ScorerCombobox({
|
|
|
15216
15383
|
);
|
|
15217
15384
|
}
|
|
15218
15385
|
|
|
15219
|
-
const NameCell$
|
|
15386
|
+
const NameCell$3 = ({ row }) => {
|
|
15220
15387
|
const { Link, paths } = useLinkComponent();
|
|
15221
15388
|
const scorer = row.original;
|
|
15222
15389
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15227,11 +15394,11 @@ const NameCell$2 = ({ row }) => {
|
|
|
15227
15394
|
}
|
|
15228
15395
|
);
|
|
15229
15396
|
};
|
|
15230
|
-
const columns$
|
|
15397
|
+
const columns$3 = [
|
|
15231
15398
|
{
|
|
15232
15399
|
header: "Name",
|
|
15233
15400
|
accessorKey: "name",
|
|
15234
|
-
cell: NameCell$
|
|
15401
|
+
cell: NameCell$3
|
|
15235
15402
|
}
|
|
15236
15403
|
];
|
|
15237
15404
|
|
|
@@ -15250,7 +15417,7 @@ function ScorersTable({ scorers, isLoading }) {
|
|
|
15250
15417
|
);
|
|
15251
15418
|
const table = reactTable.useReactTable({
|
|
15252
15419
|
data: scorersData,
|
|
15253
|
-
columns: columns$
|
|
15420
|
+
columns: columns$3,
|
|
15254
15421
|
getCoreRowModel: reactTable.getCoreRowModel()
|
|
15255
15422
|
});
|
|
15256
15423
|
const ths = table.getHeaderGroups()[0];
|
|
@@ -16190,6 +16357,8 @@ const AgentMetadata = ({ agentId }) => {
|
|
|
16190
16357
|
const tools = Object.keys(agentTools).map((key) => agentTools[key]);
|
|
16191
16358
|
const agentWorkflows = agent.workflows ?? {};
|
|
16192
16359
|
const workflows = Object.keys(agentWorkflows).map((key) => ({ id: key, ...agentWorkflows[key] }));
|
|
16360
|
+
const inputProcessors = agent.inputProcessors ?? [];
|
|
16361
|
+
const outputProcessors = agent.outputProcessors ?? [];
|
|
16193
16362
|
return /* @__PURE__ */ jsxRuntime.jsxs(AgentMetadataWrapper, { children: [
|
|
16194
16363
|
agent?.description && /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "Description", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral6", children: agent.description }) }),
|
|
16195
16364
|
agent.modelList ? /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "Models", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -16283,6 +16452,17 @@ const AgentMetadata = ({ agentId }) => {
|
|
|
16283
16452
|
children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataWorkflowList, { workflows })
|
|
16284
16453
|
}
|
|
16285
16454
|
),
|
|
16455
|
+
(inputProcessors.length > 0 || outputProcessors.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
16456
|
+
AgentMetadataSection,
|
|
16457
|
+
{
|
|
16458
|
+
title: "Processors",
|
|
16459
|
+
hint: {
|
|
16460
|
+
link: "https://mastra.ai/docs/agents/processors",
|
|
16461
|
+
title: "Processors documentation"
|
|
16462
|
+
},
|
|
16463
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataCombinedProcessorList, { inputProcessors, outputProcessors })
|
|
16464
|
+
}
|
|
16465
|
+
),
|
|
16286
16466
|
/* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "Scorers", children: /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataScorerList, { entityId: agent.name, entityType: "AGENT" }) }),
|
|
16287
16467
|
/* @__PURE__ */ jsxRuntime.jsx(AgentMetadataSection, { title: "System Prompt", children: /* @__PURE__ */ jsxRuntime.jsx(PromptEnhancer, { agentId }) })
|
|
16288
16468
|
] });
|
|
@@ -16319,6 +16499,21 @@ const AgentMetadataScorerList = ({ entityId, entityType }) => {
|
|
|
16319
16499
|
}
|
|
16320
16500
|
return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataList, { children: scorerList.map((scorer) => /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: paths.scorerLink(scorer.id), "data-testid": "scorer-badge", children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GaugeIcon, { className: "text-neutral3" }), children: scorer.scorer.config.name }) }) }, scorer.id)) });
|
|
16321
16501
|
};
|
|
16502
|
+
const AgentMetadataCombinedProcessorList = ({
|
|
16503
|
+
inputProcessors,
|
|
16504
|
+
outputProcessors
|
|
16505
|
+
}) => {
|
|
16506
|
+
const { Link, paths } = useLinkComponent();
|
|
16507
|
+
if (inputProcessors.length === 0 && outputProcessors.length === 0) {
|
|
16508
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListEmpty, { children: "No processors" });
|
|
16509
|
+
}
|
|
16510
|
+
const inputProcessorId = inputProcessors[0]?.id;
|
|
16511
|
+
const outputProcessorId = outputProcessors[0]?.id;
|
|
16512
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AgentMetadataList, { children: [
|
|
16513
|
+
inputProcessors.length > 0 && inputProcessorId && /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: `${paths.workflowLink(inputProcessorId)}/graph`, "data-testid": "processor-badge", children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(ProcessorIcon, { className: "text-accent4" }), children: "input" }) }) }),
|
|
16514
|
+
outputProcessors.length > 0 && outputProcessorId && /* @__PURE__ */ jsxRuntime.jsx(AgentMetadataListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(Link, { href: `${paths.workflowLink(outputProcessorId)}/graph`, "data-testid": "processor-badge", children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { icon: /* @__PURE__ */ jsxRuntime.jsx(ProcessorIcon, { className: "text-accent5" }), children: "output" }) }) })
|
|
16515
|
+
] });
|
|
16516
|
+
};
|
|
16322
16517
|
|
|
16323
16518
|
const AgentEntityHeader = ({ agentId }) => {
|
|
16324
16519
|
const { data: agent, isLoading } = useAgent(agentId);
|
|
@@ -17518,6 +17713,320 @@ const AgentLayout = ({ agentId, children, leftSlot, rightSlot }) => {
|
|
|
17518
17713
|
] });
|
|
17519
17714
|
};
|
|
17520
17715
|
|
|
17716
|
+
const NameCell$2 = ({ row }) => {
|
|
17717
|
+
const { Link, paths } = useLinkComponent();
|
|
17718
|
+
const processor = row.original;
|
|
17719
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17720
|
+
EntryCell,
|
|
17721
|
+
{
|
|
17722
|
+
name: /* @__PURE__ */ jsxRuntime.jsx(Link, { className: "w-full space-y-0", href: paths.processorLink(processor.id), children: processor.name || processor.id }),
|
|
17723
|
+
description: processor.description
|
|
17724
|
+
}
|
|
17725
|
+
);
|
|
17726
|
+
};
|
|
17727
|
+
const PhasesCell = ({ row }) => {
|
|
17728
|
+
const processor = row.original;
|
|
17729
|
+
const phases = processor.phases || [];
|
|
17730
|
+
const phaseLabels = {
|
|
17731
|
+
input: "Input",
|
|
17732
|
+
inputStep: "Input Step",
|
|
17733
|
+
outputStream: "Output Stream",
|
|
17734
|
+
outputResult: "Output Result",
|
|
17735
|
+
outputStep: "Output Step"
|
|
17736
|
+
};
|
|
17737
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: phases.map((phase) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", children: phaseLabels[phase] || phase }, phase)) }) });
|
|
17738
|
+
};
|
|
17739
|
+
const AgentsCell = ({ row }) => {
|
|
17740
|
+
const processor = row.original;
|
|
17741
|
+
const agentsCount = processor.agentIds?.length || 0;
|
|
17742
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "default", icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, { className: "text-accent1" }), children: [
|
|
17743
|
+
agentsCount,
|
|
17744
|
+
" agent",
|
|
17745
|
+
agentsCount !== 1 ? "s" : ""
|
|
17746
|
+
] }) });
|
|
17747
|
+
};
|
|
17748
|
+
const columns$2 = [
|
|
17749
|
+
{
|
|
17750
|
+
header: "Name",
|
|
17751
|
+
accessorKey: "name",
|
|
17752
|
+
cell: NameCell$2
|
|
17753
|
+
},
|
|
17754
|
+
{
|
|
17755
|
+
header: "Phases",
|
|
17756
|
+
accessorKey: "phases",
|
|
17757
|
+
cell: PhasesCell
|
|
17758
|
+
},
|
|
17759
|
+
{
|
|
17760
|
+
header: "Used by",
|
|
17761
|
+
accessorKey: "agentIds",
|
|
17762
|
+
cell: AgentsCell
|
|
17763
|
+
}
|
|
17764
|
+
];
|
|
17765
|
+
|
|
17766
|
+
function ProcessorTable({ processors, isLoading }) {
|
|
17767
|
+
const [search, setSearch] = React.useState("");
|
|
17768
|
+
const { navigate, paths } = useLinkComponent();
|
|
17769
|
+
const processorData = React.useMemo(() => {
|
|
17770
|
+
return Object.values(processors ?? {}).filter((p) => p.phases && p.phases.length > 0);
|
|
17771
|
+
}, [processors]);
|
|
17772
|
+
const table = reactTable.useReactTable({
|
|
17773
|
+
data: processorData,
|
|
17774
|
+
columns: columns$2,
|
|
17775
|
+
getCoreRowModel: reactTable.getCoreRowModel()
|
|
17776
|
+
});
|
|
17777
|
+
const ths = table.getHeaderGroups()[0];
|
|
17778
|
+
const rows = table.getRowModel().rows.concat();
|
|
17779
|
+
if (rows.length === 0 && !isLoading) {
|
|
17780
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EmptyProcessorsTable, {});
|
|
17781
|
+
}
|
|
17782
|
+
const filteredRows = rows.filter((row) => {
|
|
17783
|
+
const id = row.original.id.toLowerCase();
|
|
17784
|
+
const name = (row.original.name || "").toLowerCase();
|
|
17785
|
+
const searchLower = search.toLowerCase();
|
|
17786
|
+
return id.includes(searchLower) || name.includes(searchLower);
|
|
17787
|
+
});
|
|
17788
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
17789
|
+
/* @__PURE__ */ jsxRuntime.jsx(SearchbarWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(Searchbar, { onSearch: setSearch, label: "Search processors", placeholder: "Search processors" }) }),
|
|
17790
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(ProcessorTableSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsx(ScrollableContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
|
|
17791
|
+
/* @__PURE__ */ jsxRuntime.jsx(Thead, { className: "sticky top-0", children: ths.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(Th, { style: { width: header.column.getSize() ?? "auto" }, children: reactTable.flexRender(header.column.columnDef.header, header.getContext()) }, header.id)) }),
|
|
17792
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: filteredRows.map((row) => {
|
|
17793
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17794
|
+
Row,
|
|
17795
|
+
{
|
|
17796
|
+
onClick: () => {
|
|
17797
|
+
if (row.original.isWorkflow) {
|
|
17798
|
+
navigate(paths.workflowLink(row.original.id) + "/graph");
|
|
17799
|
+
} else {
|
|
17800
|
+
navigate(paths.processorLink(row.original.id));
|
|
17801
|
+
}
|
|
17802
|
+
},
|
|
17803
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
|
|
17804
|
+
},
|
|
17805
|
+
row.id
|
|
17806
|
+
);
|
|
17807
|
+
}) })
|
|
17808
|
+
] }) }) })
|
|
17809
|
+
] });
|
|
17810
|
+
}
|
|
17811
|
+
const ProcessorTableSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
|
|
17812
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Thead, { children: [
|
|
17813
|
+
/* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Name" }),
|
|
17814
|
+
/* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Phases" }),
|
|
17815
|
+
/* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Used by" })
|
|
17816
|
+
] }),
|
|
17817
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsxs(Row, { children: [
|
|
17818
|
+
/* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
17819
|
+
/* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) }),
|
|
17820
|
+
/* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-1/2" }) })
|
|
17821
|
+
] }, index)) })
|
|
17822
|
+
] });
|
|
17823
|
+
const EmptyProcessorsTable = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17824
|
+
EmptyState,
|
|
17825
|
+
{
|
|
17826
|
+
iconSlot: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cpu, {}),
|
|
17827
|
+
titleSlot: "Configure Processors",
|
|
17828
|
+
descriptionSlot: "No processors are configured yet. Add input or output processors to your agents to transform messages.",
|
|
17829
|
+
actionSlot: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17830
|
+
Button,
|
|
17831
|
+
{
|
|
17832
|
+
size: "lg",
|
|
17833
|
+
className: "w-full",
|
|
17834
|
+
variant: "light",
|
|
17835
|
+
as: "a",
|
|
17836
|
+
href: "https://mastra.ai/en/docs/processors",
|
|
17837
|
+
target: "_blank",
|
|
17838
|
+
children: [
|
|
17839
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cpu, {}) }),
|
|
17840
|
+
"Docs"
|
|
17841
|
+
]
|
|
17842
|
+
}
|
|
17843
|
+
)
|
|
17844
|
+
}
|
|
17845
|
+
) });
|
|
17846
|
+
|
|
17847
|
+
const useProcessors = () => {
|
|
17848
|
+
const { requestContext } = usePlaygroundStore();
|
|
17849
|
+
const client = react$1.useMastraClient();
|
|
17850
|
+
return reactQuery.useQuery({
|
|
17851
|
+
queryKey: ["processors"],
|
|
17852
|
+
queryFn: () => client.listProcessors(requestContext)
|
|
17853
|
+
});
|
|
17854
|
+
};
|
|
17855
|
+
const useProcessor = (processorId, options) => {
|
|
17856
|
+
const client = react$1.useMastraClient();
|
|
17857
|
+
const { requestContext } = usePlaygroundStore();
|
|
17858
|
+
return reactQuery.useQuery({
|
|
17859
|
+
queryKey: ["processor", processorId],
|
|
17860
|
+
queryFn: () => client.getProcessor(processorId).details(requestContext),
|
|
17861
|
+
enabled: options?.enabled !== false && !!processorId
|
|
17862
|
+
});
|
|
17863
|
+
};
|
|
17864
|
+
const useExecuteProcessor = () => {
|
|
17865
|
+
const client = react$1.useMastraClient();
|
|
17866
|
+
const { requestContext } = usePlaygroundStore();
|
|
17867
|
+
return reactQuery.useMutation({
|
|
17868
|
+
mutationFn: async ({
|
|
17869
|
+
processorId,
|
|
17870
|
+
phase,
|
|
17871
|
+
messages,
|
|
17872
|
+
agentId
|
|
17873
|
+
}) => {
|
|
17874
|
+
return client.getProcessor(processorId).execute({
|
|
17875
|
+
phase,
|
|
17876
|
+
messages,
|
|
17877
|
+
agentId,
|
|
17878
|
+
requestContext
|
|
17879
|
+
});
|
|
17880
|
+
}
|
|
17881
|
+
});
|
|
17882
|
+
};
|
|
17883
|
+
|
|
17884
|
+
const PHASE_LABELS = {
|
|
17885
|
+
input: "Input - Process input messages before LLM (once at start)",
|
|
17886
|
+
inputStep: "Input Step - Process at each agentic loop step",
|
|
17887
|
+
outputStream: "Output Stream - Process streaming chunks",
|
|
17888
|
+
outputResult: "Output Result - Process complete output after streaming",
|
|
17889
|
+
outputStep: "Output Step - Process after each LLM response (before tools)"
|
|
17890
|
+
};
|
|
17891
|
+
function ProcessorPanel({ processorId }) {
|
|
17892
|
+
const { data: processor, isLoading, error } = useProcessor(processorId);
|
|
17893
|
+
React.useEffect(() => {
|
|
17894
|
+
if (error) {
|
|
17895
|
+
const errorMessage = error instanceof Error ? error.message : "Failed to load processor";
|
|
17896
|
+
toast.error(`Error loading processor: ${errorMessage}`);
|
|
17897
|
+
}
|
|
17898
|
+
}, [error]);
|
|
17899
|
+
if (isLoading) {
|
|
17900
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6", children: [
|
|
17901
|
+
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-48 mb-4" }),
|
|
17902
|
+
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-32 w-full" })
|
|
17903
|
+
] });
|
|
17904
|
+
}
|
|
17905
|
+
if (error) return null;
|
|
17906
|
+
if (!processor)
|
|
17907
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-12 text-center px-6", children: /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "header-md", className: "text-neutral3", children: "Processor not found" }) });
|
|
17908
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ProcessorDetailPanel, { processor });
|
|
17909
|
+
}
|
|
17910
|
+
function ProcessorDetailPanel({ processor }) {
|
|
17911
|
+
const theme = useCodemirrorTheme$1();
|
|
17912
|
+
const formId = React.useId();
|
|
17913
|
+
const [selectedPhase, setSelectedPhase] = React.useState(processor.phases[0] || "input");
|
|
17914
|
+
const [selectedAgentId, setSelectedAgentId] = React.useState(processor.configurations[0]?.agentId || "");
|
|
17915
|
+
const [testMessage, setTestMessage] = React.useState("Hello, this is a test message.");
|
|
17916
|
+
const [result, setResult] = React.useState(null);
|
|
17917
|
+
const [errorString, setErrorString] = React.useState();
|
|
17918
|
+
const executeProcessor = useExecuteProcessor();
|
|
17919
|
+
const handleExecute = async () => {
|
|
17920
|
+
setErrorString(void 0);
|
|
17921
|
+
setResult(null);
|
|
17922
|
+
const isOutputPhase = selectedPhase === "outputStep" || selectedPhase === "outputResult";
|
|
17923
|
+
const messageRole = isOutputPhase ? "assistant" : "user";
|
|
17924
|
+
const messages = [
|
|
17925
|
+
{
|
|
17926
|
+
id: crypto.randomUUID(),
|
|
17927
|
+
role: messageRole,
|
|
17928
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
17929
|
+
content: {
|
|
17930
|
+
format: 2,
|
|
17931
|
+
parts: [{ type: "text", text: testMessage }]
|
|
17932
|
+
}
|
|
17933
|
+
}
|
|
17934
|
+
];
|
|
17935
|
+
try {
|
|
17936
|
+
const response = await executeProcessor.mutateAsync({
|
|
17937
|
+
processorId: processor.id,
|
|
17938
|
+
phase: selectedPhase,
|
|
17939
|
+
messages,
|
|
17940
|
+
agentId: selectedAgentId || void 0
|
|
17941
|
+
});
|
|
17942
|
+
setResult(response);
|
|
17943
|
+
if (!response.success && response.error) {
|
|
17944
|
+
setErrorString(response.error);
|
|
17945
|
+
}
|
|
17946
|
+
} catch (error) {
|
|
17947
|
+
setErrorString(error.message || "An error occurred");
|
|
17948
|
+
}
|
|
17949
|
+
};
|
|
17950
|
+
const resultCode = result ? JSON.stringify(result, null, 2) : "{}";
|
|
17951
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(MainContentContent, { hasLeftServiceColumn: true, className: "relative", children: [
|
|
17952
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-surface2 border-r border-border1 w-[22rem] overflow-y-auto", children: [
|
|
17953
|
+
/* @__PURE__ */ jsxRuntime.jsx(ProcessorInformation, { processor }),
|
|
17954
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-5 space-y-5", children: [
|
|
17955
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
17956
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", variant: "ui-sm", className: "text-icon3", children: "Phase" }),
|
|
17957
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: selectedPhase, onValueChange: (v) => setSelectedPhase(v), children: [
|
|
17958
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select phase" }) }),
|
|
17959
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: processor.phases.map((phase) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: phase, children: phase }, phase)) })
|
|
17960
|
+
] }),
|
|
17961
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-xs", className: "text-icon4", children: PHASE_LABELS[selectedPhase] })
|
|
17962
|
+
] }),
|
|
17963
|
+
processor.configurations.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
17964
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", variant: "ui-sm", className: "text-icon3", children: "Agent Configuration" }),
|
|
17965
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: selectedAgentId, onValueChange: setSelectedAgentId, children: [
|
|
17966
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select agent" }) }),
|
|
17967
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: processor.configurations.map((config) => /* @__PURE__ */ jsxRuntime.jsxs(SelectItem, { value: config.agentId, children: [
|
|
17968
|
+
config.agentName,
|
|
17969
|
+
" (",
|
|
17970
|
+
config.type,
|
|
17971
|
+
")"
|
|
17972
|
+
] }, config.agentId)) })
|
|
17973
|
+
] })
|
|
17974
|
+
] }),
|
|
17975
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
17976
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { as: "label", htmlFor: formId, variant: "ui-sm", className: "text-icon3", children: "Test Message" }),
|
|
17977
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17978
|
+
"textarea",
|
|
17979
|
+
{
|
|
17980
|
+
id: formId,
|
|
17981
|
+
value: testMessage,
|
|
17982
|
+
onChange: (e) => setTestMessage(e.target.value),
|
|
17983
|
+
placeholder: "Enter a test message...",
|
|
17984
|
+
rows: 4,
|
|
17985
|
+
className: "w-full bg-transparent border border-border1 rounded-md p-3 text-ui-sm text-neutral6 placeholder:text-neutral3 focus:outline-none focus:ring-2 focus:ring-accent1"
|
|
17986
|
+
}
|
|
17987
|
+
)
|
|
17988
|
+
] }),
|
|
17989
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17990
|
+
Button,
|
|
17991
|
+
{
|
|
17992
|
+
onClick: handleExecute,
|
|
17993
|
+
disabled: executeProcessor.isPending || selectedPhase === "outputStream",
|
|
17994
|
+
className: "w-full",
|
|
17995
|
+
children: executeProcessor.isPending ? "Running..." : "Run Processor"
|
|
17996
|
+
}
|
|
17997
|
+
),
|
|
17998
|
+
selectedPhase === "outputStream" && /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-xs", className: "text-accent6", children: "Output Stream phase cannot be executed directly. Use streaming instead." }),
|
|
17999
|
+
result && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 pt-4 border-t border-border1", children: [
|
|
18000
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3", children: "Status" }),
|
|
18001
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
18002
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: result.success ? "success" : "error", children: result.success ? "Success" : "Failed" }),
|
|
18003
|
+
result.tripwire?.triggered && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "info", children: "Tripwire Triggered" })
|
|
18004
|
+
] }),
|
|
18005
|
+
result.tripwire?.triggered && result.tripwire.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 p-3 bg-accent6Dark rounded-md border border-accent6/20", children: [
|
|
18006
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-accent6 font-medium", children: "Tripwire Reason" }),
|
|
18007
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon3 mt-1", children: result.tripwire.reason })
|
|
18008
|
+
] })
|
|
18009
|
+
] })
|
|
18010
|
+
] })
|
|
18011
|
+
] }),
|
|
18012
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-4 right-4 z-10", children: /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: resultCode, tooltip: "Copy JSON result to clipboard" }) }),
|
|
18013
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-5 h-full relative overflow-x-auto overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { value: errorString || resultCode, editable: true, theme, extensions: [langJson.jsonLanguage] }) })
|
|
18014
|
+
] });
|
|
18015
|
+
}
|
|
18016
|
+
function ProcessorInformation({ processor }) {
|
|
18017
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-5 pt-5 pb-4 border-b border-border1", children: [
|
|
18018
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "header-md", className: "text-icon1 mb-2", children: processor.name || processor.id }),
|
|
18019
|
+
processor.name && processor.name !== processor.id && /* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-sm", className: "text-icon4 mb-3", children: processor.id }),
|
|
18020
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1 mt-3", children: processor.phases.map((phase) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", children: phase }, phase)) }),
|
|
18021
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-xs", className: "text-icon4", children: [
|
|
18022
|
+
"Attached to ",
|
|
18023
|
+
processor.configurations.length,
|
|
18024
|
+
" agent",
|
|
18025
|
+
processor.configurations.length !== 1 ? "s" : ""
|
|
18026
|
+
] }) })
|
|
18027
|
+
] });
|
|
18028
|
+
}
|
|
18029
|
+
|
|
17521
18030
|
const NameCell$1 = ({ row }) => {
|
|
17522
18031
|
const { Link, paths } = useLinkComponent();
|
|
17523
18032
|
const tool = row.original;
|
|
@@ -19466,9 +19975,9 @@ function SpanTabs({
|
|
|
19466
19975
|
}) {
|
|
19467
19976
|
const { Link } = useLinkComponent();
|
|
19468
19977
|
let entityType;
|
|
19469
|
-
if (span?.attributes?.agentId) {
|
|
19978
|
+
if (span?.attributes?.agentId || span?.entityType === observability.EntityType.AGENT) {
|
|
19470
19979
|
entityType = "Agent";
|
|
19471
|
-
} else if (span?.attributes?.workflowId) {
|
|
19980
|
+
} else if (span?.attributes?.workflowId || span?.entityType === observability.EntityType.WORKFLOW_RUN) {
|
|
19472
19981
|
entityType = "Workflow";
|
|
19473
19982
|
}
|
|
19474
19983
|
return /* @__PURE__ */ jsxRuntime.jsxs(Tabs, { defaultTab: defaultActiveTab, children: [
|
|
@@ -21637,6 +22146,7 @@ exports.AgentInformationTabLayout = AgentInformationTabLayout;
|
|
|
21637
22146
|
exports.AgentLayout = AgentLayout;
|
|
21638
22147
|
exports.AgentMemory = AgentMemory;
|
|
21639
22148
|
exports.AgentMetadata = AgentMetadata;
|
|
22149
|
+
exports.AgentMetadataCombinedProcessorList = AgentMetadataCombinedProcessorList;
|
|
21640
22150
|
exports.AgentMetadataList = AgentMetadataList;
|
|
21641
22151
|
exports.AgentMetadataListEmpty = AgentMetadataListEmpty;
|
|
21642
22152
|
exports.AgentMetadataListItem = AgentMetadataListItem;
|
|
@@ -21764,6 +22274,9 @@ exports.PopoverTrigger = PopoverTrigger;
|
|
|
21764
22274
|
exports.ProcessStepList = ProcessStepList;
|
|
21765
22275
|
exports.ProcessStepListItem = ProcessStepListItem;
|
|
21766
22276
|
exports.ProcessStepProgressBar = ProcessStepProgressBar;
|
|
22277
|
+
exports.ProcessorIcon = ProcessorIcon;
|
|
22278
|
+
exports.ProcessorPanel = ProcessorPanel;
|
|
22279
|
+
exports.ProcessorTable = ProcessorTable;
|
|
21767
22280
|
exports.PromptIcon = PromptIcon;
|
|
21768
22281
|
exports.RadioGroup = RadioGroup;
|
|
21769
22282
|
exports.RadioGroupItem = RadioGroupItem;
|
|
@@ -21870,6 +22383,7 @@ exports.WorkingMemoryContext = WorkingMemoryContext;
|
|
|
21870
22383
|
exports.WorkingMemoryProvider = WorkingMemoryProvider;
|
|
21871
22384
|
exports.buttonVariants = buttonVariants;
|
|
21872
22385
|
exports.cn = cn;
|
|
22386
|
+
exports.columns = columns$2;
|
|
21873
22387
|
exports.convertWorkflowRunStateToStreamResult = convertWorkflowRunStateToStreamResult;
|
|
21874
22388
|
exports.extractPrompt = extractPrompt;
|
|
21875
22389
|
exports.fieldConfig = fieldConfig;
|
|
@@ -21906,6 +22420,7 @@ exports.useDeleteThread = useDeleteThread;
|
|
|
21906
22420
|
exports.useDeleteWorkflowRun = useDeleteWorkflowRun;
|
|
21907
22421
|
exports.useExecuteAgentTool = useExecuteAgentTool;
|
|
21908
22422
|
exports.useExecuteMCPTool = useExecuteMCPTool;
|
|
22423
|
+
exports.useExecuteProcessor = useExecuteProcessor;
|
|
21909
22424
|
exports.useExecuteTool = useExecuteTool;
|
|
21910
22425
|
exports.useExecuteWorkflow = useExecuteWorkflow;
|
|
21911
22426
|
exports.useInView = useInView;
|
|
@@ -21921,6 +22436,8 @@ exports.useMemoryConfig = useMemoryConfig;
|
|
|
21921
22436
|
exports.useMemorySearch = useMemorySearch;
|
|
21922
22437
|
exports.usePackageUpdates = usePackageUpdates;
|
|
21923
22438
|
exports.usePlaygroundStore = usePlaygroundStore;
|
|
22439
|
+
exports.useProcessor = useProcessor;
|
|
22440
|
+
exports.useProcessors = useProcessors;
|
|
21924
22441
|
exports.useReorderModelList = useReorderModelList;
|
|
21925
22442
|
exports.useResetAgentModel = useResetAgentModel;
|
|
21926
22443
|
exports.useScorer = useScorer;
|