@@ -171,6 +171,15 @@ Node structure:
171171 }
172172}
173173
174+ NODE POSITIONING RULES:
175+ - Nodes are squares, so use equal spacing in both directions
176+ - Horizontal spacing between sequential nodes: 250px (e.g., x: 100, then x: 350, then x: 600)
177+ - Vertical spacing for parallel branches: 250px (e.g., y: 75, y: 325, y: 575)
178+ - Start trigger node at position {"x": 100, "y": 200}
179+ - For linear workflows: increment x by 250 for each subsequent node, keep y constant
180+ - For branching workflows: keep x the same for parallel branches, space y by 250px per branch
181+ - When adding nodes to existing workflows, position new nodes 250px away from existing nodes
182+
174183Trigger types:
175184- Manual: {"triggerType": "Manual"}
176185- Webhook: {"triggerType": "Webhook", "webhookPath": "/webhooks/name", ...}
@@ -221,12 +230,21 @@ WORKFLOW FLOW:
221230- For linear workflows: trigger -> action1 -> action2 -> etc
222231- For branching (conditions): one source can connect to multiple targets
223232
224- Example output:
233+ Example output (linear workflow with 250px horizontal spacing) :
225234{"op": "setName", "name": "Contact Form Workflow"}
226235{"op": "setDescription", "description": "Processes contact form submissions"}
227236{"op": "addNode", "node": {"id": "trigger-1", "type": "trigger", "position": {"x": 100, "y": 200}, "data": {"label": "Contact Form", "type": "trigger", "config": {"triggerType": "Manual"}, "status": "idle"}}}
228- {"op": "addNode", "node": {"id": "send-email", "type": "action", "position": {"x": 400, "y": 200}, "data": {"label": "Send Email", "type": "action", "config": {"actionType": "Send Email", "emailTo": "admin@example.com", "emailSubject": "New Contact", "emailBody": "New contact form submission"}, "status": "idle"}}}
237+ {"op": "addNode", "node": {"id": "send-email", "type": "action", "position": {"x": 350, "y": 200}, "data": {"label": "Send Email", "type": "action", "config": {"actionType": "Send Email", "emailTo": "admin@example.com", "emailSubject": "New Contact", "emailBody": "New contact form submission"}, "status": "idle"}}}
238+ {"op": "addNode", "node": {"id": "log-action", "type": "action", "position": {"x": 600, "y": 200}, "data": {"label": "Log Result", "type": "action", "config": {"actionType": "HTTP Request", "httpMethod": "POST", "endpoint": "https://api.example.com/log"}, "status": "idle"}}}
229239{"op": "addEdge", "edge": {"id": "e1", "source": "trigger-1", "target": "send-email", "type": "default"}}
240+ {"op": "addEdge", "edge": {"id": "e2", "source": "send-email", "target": "log-action", "type": "default"}}
241+
242+ Example output (branching workflow with 250px vertical spacing):
243+ {"op": "addNode", "node": {"id": "trigger-1", "type": "trigger", "position": {"x": 100, "y": 200}, "data": {"label": "Webhook", "type": "trigger", "config": {"triggerType": "Webhook"}, "status": "idle"}}}
244+ {"op": "addNode", "node": {"id": "branch-a", "type": "action", "position": {"x": 350, "y": 75}, "data": {"label": "Branch A", "type": "action", "config": {"actionType": "Send Email"}, "status": "idle"}}}
245+ {"op": "addNode", "node": {"id": "branch-b", "type": "action", "position": {"x": 350, "y": 325}, "data": {"label": "Branch B", "type": "action", "config": {"actionType": "Send Slack Message"}, "status": "idle"}}}
246+ {"op": "addEdge", "edge": {"id": "e1", "source": "trigger-1", "target": "branch-a", "type": "default"}}
247+ {"op": "addEdge", "edge": {"id": "e2", "source": "trigger-1", "target": "branch-b", "type": "default"}}
230248
231249REMEMBER: After adding all nodes, you MUST add edges to connect them! Every node should be reachable from the trigger.` ;
232250
@@ -302,6 +320,7 @@ IMPORTANT: Output ONLY the operations needed to make the requested changes.
302320- When connecting nodes, look at the node IDs in the current workflow list above
303321- DO NOT output operations for existing nodes/edges unless specifically modifying them
304322- Keep the existing workflow structure and only add/modify/remove what was requested
323+ - POSITIONING: When adding new nodes, look at existing node positions and place new nodes 250px away (horizontally or vertically) from existing nodes. Never overlap nodes.
305324
306325Example: If user says "connect node A to node B", output:
307326{"op": "addEdge", "edge": {"id": "e-new", "source": "A", "target": "B", "type": "default"}}` ;
0 commit comments