Documentation
¶
Overview ¶
Package canvas mutates a Workflow's graph atomically. Used by MCP canvas ops (`workflow_add_node`, `workflow_connect`, ...) and by the UI inspector when the operator edits in the visual editor.
Each mutation returns the updated workflow so callers can persist it via service.Update. Mutations never partially apply — if validation fails post-edit, the workflow is returned unchanged.
Index ¶
- type Canvas
- func (c *Canvas) AddNode(id string, n workflow.Node) (workflow.Workflow, error)
- func (c *Canvas) AutoLayout(id string, nodeIDs []string) (workflow.Workflow, error)
- func (c *Canvas) Connect(id, fromID, toID, caseLabel string) (workflow.Workflow, error)
- func (c *Canvas) DeleteNode(id, nodeID string) (workflow.Workflow, error)
- func (c *Canvas) Disconnect(id, fromID, toID string) (workflow.Workflow, error)
- func (c *Canvas) MoveNode(id, nodeID string, x, y int) (workflow.Workflow, error)
- func (c *Canvas) MoveNodes(id string, moves []NodeMove) (workflow.Workflow, error)
- func (c *Canvas) SetTriggers(id string, triggers []workflow.Trigger) (workflow.Workflow, error)
- func (c *Canvas) Toggle(id string, enabled bool) (workflow.Workflow, error)
- func (c *Canvas) UpdateNode(id, nodeID string, patch map[string]any) (workflow.Workflow, error)
- type NodeMove
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶
Canvas wraps a Service for atomic graph edits.
func (*Canvas) AutoLayout ¶ added in v0.14.20
AutoLayout computes DAG-aware positions and applies them in one draft mutation. nodeIDs restricts re-layout to those IDs only; empty = lay out ALL graph nodes and triggers. Positions for IDs outside scope are preserved.
func (*Canvas) DeleteNode ¶
DeleteNode removes a node and every edge touching it.
func (*Canvas) Disconnect ¶
Disconnect removes an edge.
func (*Canvas) MoveNodes ¶ added in v0.14.20
MoveNodes batch-updates canvas positions in a single draft mutation. Cheaper than N serial MoveNode calls; avoids partial-update races.
func (*Canvas) SetTriggers ¶
SetTriggers replaces the trigger list.