Files
ComfyUI_frontend/docs/extensions/core.md
Alexander Brown ab6c44aabf feat: remove deprecated group nodes, auto-convert to subgraphs on load (#12931)
## Summary

Removes the deprecated Group Nodes feature and replaces it with a
load-time migration that auto-converts any group nodes in a loaded
workflow into Subgraphs (with accepted lossiness).

## Changes

- **What**:
- `groupNode.ts` is now a migration-only extension.
`beforeConfigureGraph` registers temporary node types from
`extra.groupNodes` so instances are created during `configure`; a new
`afterConfigureGraph` hook converts every group node in the root graph
to a subgraph (via `LGraph.convertToSubgraph`), re-scanning until none
remain, then deletes `extra.groupNodes`. A failed conversion removes the
offending node so loading never hangs or breaks.
- Kept the minimum needed: `GroupNodeConfig` (builds the
input/output/widget maps), a slimmed `GroupNodeHandler` exposing a
rewritten `convertToNodes()` that no longer depends on the execution
DTOs, the `globalDefs`/`addCustomNodeDefs` path, and the `nodeDefStore`
`Object.assign` shim the migration relies on to detect group nodes.
- Deleted: the Manage Group Nodes dialog (`groupNodeManage.ts`/`.css`),
execution DTOs (`executableGroupNodeDto.ts`,
`executableGroupNodeChildDTO.ts`), the create/builder flow, recreate,
commands, keybindings, menus, the `isGroupNode` branches in the
right-side panel / error grouping / focus composable, the group-node
branches in node templates, dead i18n keys, and the now-unused
`serialise` clipboard helper.
- Rewrote `browser_tests/tests/groupNode.spec.ts` to assert
auto-conversion; deleted the `ManageGroupNode` page object and
`manageGroupNode()` helper.
  - Net: ~2,700 lines removed across 23 files (7 files deleted).
- **Breaking**: Group nodes can no longer be created, managed, or
executed. Existing workflows still load — their group nodes are
converted to subgraphs on open.

## Review Focus

- The load-time migration in `afterConfigureGraph` and the rewritten
`GroupNodeHandler.convertToNodes()` (no longer uses the execution
`getInnerNodes()` / DTOs; derives inner node type/index from
`groupData.nodeData.nodes` and relies on `deserialiseAndCreate` +
selection ordering).
- Kept `nodeDefStore`'s `Object.assign(this, obj)` shim: the migration
depends on it to propagate the group-node marker symbol onto the
registered node definition.

### Accepted lossiness
- Group nodes nested inside subgraphs (or inside other group nodes)
convert into the root graph rather than their original container —
essentially nonexistent in real legacy workflows since group nodes
predate subgraphs.
- Temporary `workflow>name` node types stay registered for the session;
instantiating one auto-converts it to a subgraph.

## Verification

`pnpm typecheck`, `typecheck:browser`, `knip`, `oxlint`, `eslint`, and
`oxfmt` are green (also enforced by pre-commit hooks). Unit tests for
the touched files could not be run locally due to a pre-existing
environment error (`file:///assets/images/*.svg` passed to a Node
filename API at import time, which also fails on unmodified test files);
the browser spec requires a live server.

---------

Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: AustinMroz <austin@comfy.org>
Co-authored-by: GitHub Action <action@github.com>
2026-06-18 21:16:24 +00:00

8.3 KiB

Core Extensions

This directory contains the core extensions that provide essential functionality to the ComfyUI frontend.

Table of Contents

Overview

Extensions in ComfyUI are modular JavaScript modules that extend and enhance the functionality of the frontend. The extensions in this directory are considered "core" as they provide fundamental features that are built into ComfyUI by default.

Extension Architecture

ComfyUI's extension system follows these key principles:

  1. Registration-based: Extensions must register themselves with the application using app.registerExtension()
  2. Hook-driven: Extensions interact with the system through predefined hooks
  3. Non-intrusive: Extensions should avoid directly modifying core objects where possible

Core Extensions List

The following table lists ALL core extensions in the system as of 2025-01-30:

Main Extensions

Extension Description Category
clipspace.ts Implements the Clipspace feature for temporary image storage Image
contextMenuFilter.ts Provides context menu filtering capabilities UI
dynamicPrompts.ts Provides dynamic prompt generation capabilities Prompts
editAttention.ts Implements attention editing functionality Text
electronAdapter.ts Adapts functionality for Electron environment Platform
groupNode.ts Migrates deprecated group nodes to subgraphs on load Graph
groupOptions.ts Handles group node configuration options Graph
index.ts Main extension registration and coordination Core
load3d.ts Supports 3D model loading and visualization 3D
maskeditor.ts Implements the mask editor for image masking operations Image
nodeTemplates.ts Provides node template functionality Templates
noteNode.ts Adds note nodes for documentation within workflows Graph
previewAny.ts Universal preview functionality for various data types Preview
rerouteNode.ts Implements reroute nodes for cleaner workflow connections Graph
saveImageExtraOutput.ts Handles additional image output saving Image
saveMesh.ts Implements 3D mesh saving functionality 3D
simpleTouchSupport.ts Provides basic touch interaction support Input
slotDefaults.ts Manages default values for node slots Nodes
uploadAudio.ts Handles audio file upload functionality Audio
uploadImage.ts Handles image upload functionality Image
webcamCapture.ts Provides webcam capture capabilities Media
widgetInputs.ts Implements various widget input types Widgets

Conditional Lines Subdirectory

Located in extensions/core/load3d/conditional-lines/:

File Description
ColoredShadowMaterial.js Material for colored shadow rendering
ConditionalEdgesGeometry.js Geometry for conditional edge rendering
ConditionalEdgesShader.js Shader for conditional edges
OutsideEdgesGeometry.js Geometry for outside edge detection

Lines2 Subdirectory

Located in extensions/core/load3d/conditional-lines/Lines2/:

File Description
ConditionalLineMaterial.js Material for conditional line rendering
ConditionalLineSegmentsGeometry.js Geometry for conditional line segments

ThreeJS Override Subdirectory

Located in extensions/core/load3d/threejsOverride/:

File Description
OverrideMTLLoader.js Custom MTL loader with enhanced functionality

Extension Development

When developing or modifying extensions, follow these best practices:

  1. Use provided hooks rather than directly modifying core application objects
  2. Maintain compatibility with other extensions
  3. Follow naming conventions for both extension names and settings
  4. Properly document extension hooks and functionality
  5. Test with other extensions to ensure no conflicts

Extension Registration

Extensions are registered using the app.registerExtension() method:

app.registerExtension({
  name: 'MyExtension',

  // Hook implementations
  async init() {
    // Implementation
  },

  async beforeRegisterNodeDef(nodeType, nodeData, app) {
    // Implementation
  }

  // Other hooks as needed
})

Extension Hooks

ComfyUI extensions can implement various hooks that are called at specific points in the application lifecycle:

Hook Execution Sequence

Web Page Load

init
addCustomNodeDefs
getCustomWidgets
beforeRegisterNodeDef    [repeated multiple times]
registerCustomNodes
beforeConfigureGraph
nodeCreated
loadedGraphNode
afterConfigureGraph
setup

Loading Workflow

beforeConfigureGraph
beforeRegisterNodeDef   [zero, one, or multiple times]
nodeCreated             [repeated multiple times]
loadedGraphNode         [repeated multiple times]
afterConfigureGraph

Adding New Node

nodeCreated

Key Hooks

Hook Description
init Called after canvas creation but before nodes are added
setup Called after the application is fully set up and running
addCustomNodeDefs Called before nodes are registered with the graph
getCustomWidgets Allows extensions to add custom widgets
beforeRegisterNodeDef Allows extensions to modify nodes before registration
registerCustomNodes Allows extensions to register additional nodes
loadedGraphNode Called when a node is reloaded onto the graph
nodeCreated Called after a node's constructor
beforeConfigureGraph Called before a graph is configured
afterConfigureGraph Called after a graph is configured
getSelectionToolboxCommands Allows extensions to add commands to the selection toolbox

For the complete list of available hooks and detailed descriptions, see the ComfyExtension interface in comfy.ts.

Further Reading

For more detailed information about ComfyUI's extension system, refer to the official documentation:

Also, check the main README.md section on Developer APIs for the latest information on extension APIs and features.