Canvas Node Development
When a canvas-only node is actually justified, where the package lives, how the manifest and port contract are written, and what a handler may and may not touch — all aligned with the repository's canvas-node protocol and the Infinite Canvas 1.5.0 implementation.
First: do you really need a node?
Most nodes in the canvas panel require no development from you:
- A new generation capability (image, video, speech, music) → write a normal generation plugin per the standard plugin protocol; after a gateway restart it appears under Generation plugins automatically;
- A new resource-scoped post-processing action (
scope: resourceplugin action) → it lands under Post-processing plugins automatically; - Text/number/boolean/JSON inputs, image/video/audio loaders, the four preview nodes, the generic agent, the LLM condition, and the count control → already built into Infinite Canvas.
Only capabilities the normal plugin protocol cannot express deserve a canvas-only node: branching logic, special data transforms (split, merge, format conversion), and batched project-asset reads or filters. Ask first: can existing nodes already do this when wired together?
Where a node package lives
Canvas nodes are a separate canvas_node plugin type, fully isolated from normal plugins:
- Fixed location:
plugins/canvas-nodes/<package-id>/— never inside a normalplugins/<plugin-id>/plugin.json; - They appear in none of the workspace plugin bar, the normal plugin directory, or the MCP plugin list — only the Infinite Canvas host discovers them;
- The package must contain
plugin.json,INSTALL.md, and every handler/resource file the manifest references; - They are trusted local Python code, not a security sandbox — vet third-party node packages’ provenance, license, and
INSTALL.mdbefore installing.
Minimal structure:
plugins/canvas-nodes/my-nodes/
├── plugin.json # manifest: node declarations
├── INSTALL.md # required install notes
└── handlers/
└── library.py # handler
The manifest: plugin.json
{
"schema_version": 1,
"plugin_type": "canvas_node",
"id": "my-nodes",
"version": "1.0.0",
"name": "My canvas nodes",
"assets": [],
"nodes": [{
"id": "read-library",
"name": "Read project library",
"description": "List current-project assets by media kind",
"category": "resources",
"icon": "solar:album-linear",
"handler": "handlers/library.py:read",
"inputs": [{ "id": "kind", "name": "Media kind", "type": "text" }],
"outputs": [{ "id": "assets", "name": "Asset list", "type": "json" }],
"config_schema": {
"type": "object",
"properties": { "limit": { "type": "integer", "minimum": 1 } },
"additionalProperties": false
}
}]
}
Key rules:
- Node IDs are unique within the package; the stable canvas type name is
<package-id>.<node-id>(e.g.my-nodes.read-library). Port IDs are unique within their own input/output lists. handleris a package-relativefile:functionreference.config_schemamust be a JSON Schema Draft 2020-12 object schema; parameters users fill on the node card are validated against it.
The port contract
Fourteen port types are allowed: text, number, integer, boolean, json, upload, asset, image, video, audio, music, media, project, category. Ports may carry description, required, and multiple; multiple applies to inputs only and means an array.
Three handles carry special semantics:
- Asset handles (
asset/image/video/audio/music/media): at minimum{ "project_id": "...", "path": "project-relative path", "type": "image|video|audio|music" }, optionally with library metadata (name,category_id,media_type,size,modified,url).asset/mediaaccept any supported media type; specific type ports restrict it. - Upload handles (
upload):{ "upload_id": "32-hex ID", "name": "optional file name", "kind": "optional media type" }— inputs only, and execution verifies the upload is still gateway-registered and present. - Project / category ports:
projectmay only point at the current project,categorymust belong to it; asset ports validate project ownership, existence, and extension. A node package can never reach another project’s assets through workflow data.
accepts
,
semantic
,
cardinality
,
min_items
,
max_items
), but
the framework’s canvas-node discovery API currently passes through basic fields only
— third-party
canvas-nodes
packages must not depend on enhanced fields yet and keep using the basic type-compatibility rules. Enhanced fields currently apply only to the canvas’s own adapted platform capabilities, actions, and built-in nodes.
The handler: execute(inputs, config, runtime)
def execute(inputs, config, runtime):
assets = runtime.application.library(
kind=inputs.get("kind"),
category_id=config.get("category_id", ""),
)
limit = config.get("limit")
return { "assets": assets[:limit] if limit else assets }
- The signature is fixed:
execute(inputs: dict, config: dict, runtime);async defis supported. - You must return a JSON object containing only declared output ports: extra undeclared keys or non-JSON returns are rejected by the framework.
- Inputs and outputs are validated automatically against JSON Schema and the port types.
runtime is the only legitimate gateway out:
| Need | Use |
|---|---|
| Read the current project’s asset library | runtime.application.library(kind=..., category_id=...) |
| Turn a temp upload into a project asset | runtime.application.import_upload(upload_id, name=..., kind=...) |
| Call any registered generation capability | runtime.invoke_capability(...) |
| Execute any registered plugin action | runtime.execute_action(...) |
| Call an LLM | runtime.call_model(...) |
Forbidden: touching SQLite directly, reading/writing absolute project paths, using the ComfyUI HTTP client directly, importing another plugin’s code or the framework’s boot modules. ApplicationRuntime.library() returns project-relative paths and never disk absolutes — don’t try to route around it.
HTTP API: discovery and single-node execution
Two authenticated endpoints; both the canvas host and your debug scripts use them:
GET /api/v2/canvas-nodes
POST /api/v2/canvas-nodes/{package-id}.{node-id}/execute
- The execute body is
{ "project_id": "optional, defaults to current", "category_id": "optional", "inputs": {}, "config": {} }; the response is exactly the handler’s output JSON. - The discovery response contains display declarations and
config_schemaonly — no handler paths, package directories, or revisions. - If plugin files changed, you get 409 with
X-Plugin-Restart-Required: true: drain running node tasks and restart the gateway. - Failed execution returns a generic error summary; Python tracebacks and absolute paths go to the gateway log only — read the log when debugging.
From development to release
- Create the package:
plugin.json,INSTALL.md, and handlers underplugins/canvas-nodes/<package-id>/. - Syntax check:
python -m compileall -q plugins/canvas-nodes. - Drain running tasks and restart the VideoFree Studio gateway.
GET /api/v2/canvas-nodesshows your package and node declarations.- Open Infinite Canvas: the node appears under Canvas extensions; drop it, wire a minimal case (input → your node → data preview), and run.
- Before publishing:
INSTALL.mdmatches reality, no machine-specific absolute paths, no direct SQLite/ComfyUI access, the handler only goes throughruntime, and returned objects contain only declared outputs.
The protocol itself covers node discovery, single-node execution, project asset access, and bridging to existing generation/LLM services; canvas UI, connection validation, DAG scheduling, and workflow save/share belong to the Infinite Canvas app plugin — and the framework never mints a per-node MCP tool. In practice: keep your node package pure business logic; the canvas handles the wiring.
For how your node behaves inside runs — loop edges, validation, failure semantics — see the previous guide, Infinite Canvas Guide.