Implement agent node functionality in canvas, including connection policies and UI updates. Add support for agent node type in node catalog, templates, and connection validation. Update documentation to reflect new agent capabilities and ensure proper handling of input sources. Enhance adjustment preview to include crop node. Add tests for agent connection policies.

This commit is contained in:
2026-04-09 10:06:53 +02:00
parent b7f24223f2
commit 6d0c7b1ff6
18 changed files with 749 additions and 5 deletions

View File

@@ -37,6 +37,19 @@ const RENDER_ALLOWED_SOURCE_TYPES = new Set<string>([
"detail-adjust",
]);
const AGENT_ALLOWED_SOURCE_TYPES = new Set<string>([
"image",
"asset",
"video",
"text",
"note",
"frame",
"compare",
"render",
"ai-image",
"ai-video",
]);
const ADJUSTMENT_DISALLOWED_TARGET_TYPES = new Set<string>(["prompt", "ai-image"]);
export type CanvasConnectionValidationReason =
@@ -51,7 +64,8 @@ export type CanvasConnectionValidationReason =
| "crop-incoming-limit"
| "compare-incoming-limit"
| "adjustment-target-forbidden"
| "render-source-invalid";
| "render-source-invalid"
| "agent-source-invalid";
export function validateCanvasConnectionPolicy(args: {
sourceType: string;
@@ -81,6 +95,10 @@ export function validateCanvasConnectionPolicy(args: {
}
}
if (targetType === "agent" && !AGENT_ALLOWED_SOURCE_TYPES.has(sourceType)) {
return "agent-source-invalid";
}
if (isAdjustmentNodeType(targetType) && targetType !== "render") {
if (!ADJUSTMENT_ALLOWED_SOURCE_TYPES.has(sourceType)) {
return "adjustment-source-invalid";
@@ -132,6 +150,8 @@ export function getCanvasConnectionValidationMessage(
return "Adjustment-Ausgaben koennen nicht an Prompt- oder KI-Bild-Nodes angeschlossen werden.";
case "render-source-invalid":
return "Render akzeptiert nur Bild-, Asset-, KI-Bild-, Crop- oder Adjustment-Input.";
case "agent-source-invalid":
return "Agent-Nodes akzeptieren nur Content- und Kontext-Inputs, keine Generierungs-Steuerknoten wie Prompt.";
default:
return "Verbindung ist fuer diese Node-Typen nicht erlaubt.";
}