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