Settings
Declare a setting once at module load:boolean,number,slider, andknob;comboandradio;text,password,color,image, andurl.
{ value, label } when they differ so numeric values remain numeric.
Read, write, and observe settings:
onChange() can observe a setting the pack did not declare. It fires on change,
not on registration.
Settings are small preferences. Use comfy.storage for named content the user
authors.
Commands, keybindings, and notifications
scope: 'canvas' prevents the keybinding from firing while the user is typing
in a node widget or another field. Omit it for an application-wide command.
Run a host or pack command without reaching into its implementation:
run() rejects when the command does not exist. Use has() for an optional
entry.
Show a notification:
success, info, warn, or error and defaults to info.
Sidebar tabs
Hand-written modules can render into a host container:render() can run each time the tab becomes visible. Treat it as a mount and
release retained resources from destroy().
A built pack can instead provide a bundled Vue component:
Top-bar badges and action buttons
These contributions are declarative so the host retains control of layout and style:comfy.commands.run().
Dialogs, menus, and prompts
Dialog
component and optional frozen props.
Dialog keys must be namespaced because the host maps them into one dialog
keyspace.
Context menu raised by a pack
MouseEvent positions the menu. A submenu item is mutually exclusive with
run. Use NodeDefBuilder.addMenuItem() instead when the host is opening a
node’s own context menu.
Prompt
undefined when the user cancels.
Backend URLs, requests, and events
Authenticated API calls
fetch() delegates credentials and authentication behavior to the host. Its
route is API-relative and must start with /.
backend.url(route) builds the absolute API URL but does not attach credentials
to a later plain fetch(). Prefer backend.fetch() for API requests.
Static host files
assetUrl() does not add the API prefix. For a file next to the current pack’s
module, use the install-location-safe form:
Backend messages and session identity
unknown because a pack owns its own event schema. Validate
before use. The session ID can be undefined until the backend connection is
established and must not be persisted.
Workflow service
Open parsed ComfyUI workflow JSON as the active document:Per-user storage
Storage is for named text documents such as presets, templates, and saved prompts:...
get() returns undefined for a missing item; list() returns an empty frozen
array when the namespace has no entries.
Storage lives with the user’s server-side data and follows the user between
machines. Use settings for small preferences, and storage for content the user
expects to retain and manage by name.