Pack filesystem versions
The pack’s filesystem version is selected before either language API loads. A converted pack retains its complete V1 distribution at the pack root and stores its complete replacement V2 distribution underv2/.
v2/ directory is a replacement pack root, not a patch or overlay and not the Python API module name. It is generally copied from the top-level distribution before conversion. When selected, frontend modules inside it import /comfy/api/v2.js. Keep version-specific entrypoints, dependencies, assets, and metadata inside their respective distribution trees; do not rely on fallback to V1.
JavaScript versions
Import the published module directly:comfy.version reports the contract as major.minor. A major change can remove behavior. A minor change only adds behavior. comfy.forMajor(major) keeps a pack on a supported major during a deprecation period.
Do not branch on a version string when you need one feature. Backports and grant policy can make a version comparison inaccurate.
Probe a capability
supports() is cheap and does not throw. Its answer includes both host support and the current pack grant.
Use require() when the extension has no useful behavior without the feature:
comfy.capabilities() for diagnostics or a compatibility report, not to request everything the host offers.
Request a missing capability
The V2 API is intended to grow with real node-author needs. If a useful node cannot be implemented through the published surface, report the missing operation or extension point instead of building a permanent dependency on private ComfyUI internals. A useful capability request includes:- the user-visible behavior the node is trying to provide;
- the old API, private object, or monkeypatch currently used;
- why existing refs, context services, handles, hooks, or UI contributions are insufficient;
- whether the capability is required or an optional enhancement;
- a small example showing the desired author-facing API when practical.
Handle API generations
Two handles can describe the same entity while coming from different API instances, graph scopes, or majors. Compare them withcomfy.sameEntity():
comfy.adopt(handle) to re-resolve a node handle into the current API instance. It returns undefined when the value is not a node handle or the entity is gone.
Compatibility policy for a pack
- Import
/comfy/api/v2.jsand require only hard dependencies. - Probe optional enhancements individually with
supports(). - Keep a released pack on a supported major with
comfy.forMajor(). - Treat an ungranted capability as unavailable rather than reaching for a private equivalent.
- Never fall back to a private import, global object, path, or DOM selector.
- Report a named API gap and its user-visible use case when the supported surface cannot express required behavior.