node.inputs, node.outputs, input.link, output.links, or
mutable link records from LiteGraph.
Slot identity and references
A slot index is a position and changes when the slot list changes. ASlotId is
stable for the lifetime of the slot.
Methods accepting SlotRef support:
{ index } so a volatile
positional dependency is visible in code review and search.
String resolution is:
- exact
SlotId; - exact slot name;
- while named slots are unavailable, a canonical integer string such as
'0'resolves positionally; - no match.
get(name) throws ComfyAmbiguousSlotError when more than one slot has that
name. byName(name) returns undefined on ambiguity. Output names may
legitimately repeat, so the API never guesses.
Slot IDs are runtime identity. Workflows still serialize link endpoints by
index, so do not persist a SlotId across save and reload.
Collections
Every node has input and output collections:Inspecting an input
Use
source() to edit physical topology. Use resolvedSource() to understand
what execution ultimately receives through reroutes, Get/Set nodes, and other
frontend resolvers.
Inspecting an output
links() and targets() are snapshots, so it is safe to iterate while
disconnecting.
Connecting and disconnecting
connectTo() returns the new LinkInfo, or undefined when the endpoint does
not exist or the host rejects the connection. Normal compatibility and
definition hooks still apply.
Do not update LinkInfo; it is a record of one observation. Perform the edit
through the slot handles.
Adding and removing dynamic slots
SlotOptions supports:
shape:'default','optional','list', or'directional';localizedName;- a custom graph-space
positionand linkdirection; widget, naming the widget whose socket form this input represents;widgetConfig, the declaration a connected Primitive should render.
Reordering slots safely
Modifying a slot
Apply related changes atomically:SlotPatch supports name, label, localized name, type, position, direction,
connected and unconnected colors, and shape. InputSlotPatch additionally
supports widget identity and widget configuration.
A type may be a string or an array of accepted types. The host normalizes an
array to the comma-separated form used by its compatibility checks.
Retyping keeps existing links. Dynamic wildcard-to-concrete nodes depend on
that behavior; explicitly disconnect a link when the feature requires it.
Moving output links without replacing them
moveLinksTo() moves every link to another output on the same node and
preserves link IDs. Disconnecting and reconnecting would allocate new IDs and
change the serialized workflow.
The move deliberately does not revalidate types. The observed migration pattern
moves links away and then retypes a slot; checking compatibility halfway through
would reject that valid sequence.
Widget-backed inputs
A dynamic input that is the socket form of a widget must carry the relationship:widgets_values.
InputSlotHandle.modify({ widget, widgetConfig }) updates an existing input.
Use null for widget to clear the relationship.
Physical and resolved topology
Frontend-only nodes can forward, replace, or omit execution values without changing physical links. Keep the distinction explicit:{ kind: 'output', graphId, nodeId, outputIndex };{ kind: 'literal', value };{ kind: 'omitted', reason }.