ComfyUI/comfy_api_nodes/util
Kristen T. Tran e4dbc95a73
Main (#3)
* Add prompt_id to progress_text binary WS messages

Add supports_progress_text_metadata feature flag and extend
send_progress_text() to accept optional prompt_id param. When
prompt_id is provided and the client supports the new format,
the binary wire format includes a length-prefixed prompt_id field:

  [4B event_type][4B prompt_id_len][prompt_id][4B node_id_len][node_id][text]

Legacy format preserved for clients without the flag.

Both callers (nodes_images.py, client.py) updated to pass prompt_id
from get_executing_context().

Part of COM-12671: parallel workflow execution support.

Amp-Thread-ID: https://ampcode.com/threads/T-019c79f7-f19b-70d9-b662-0687cc206282

* refactor: add prompt_id as hidden type, fix imports, add docstrings

- Add PROMPT_ID as a new hidden type in the Hidden enum, HiddenHolder,
  HiddenInputTypeDict, and execution engine resolution (both V3 and legacy)
- Refactor GetImageSize to use cls.hidden.prompt_id instead of manually
  calling get_executing_context() — addresses reviewer feedback
- Remove lazy import of get_executing_context from nodes_images.py
- Add docstrings to send_progress_text, _display_text, HiddenHolder,
  and HiddenHolder.from_dict

Amp-Thread-ID: https://ampcode.com/threads/T-019ca1cb-0150-7549-8b1b-6713060d3408

* fix: send_progress_text unicasts to client_id instead of broadcasting

- Default sid to self.client_id when not explicitly provided, matching
  every other WS message dispatch (executing, executed, progress_state, etc.)
- Previously sid=None caused broadcast to all connected clients
- Format signature per ruff, remove redundant comments
- Add unit tests for routing, legacy format, and new prompt_id format

Amp-Thread-ID: https://ampcode.com/threads/T-019ca3ce-c530-75dd-8d68-349e745a022e

* remove send_progress_text stub tests

Copy-paste stub tests don't verify the real implementation and add
maintenance burden without meaningful coverage.

Amp-Thread-ID: https://ampcode.com/threads/T-019ca3ce-c530-75dd-8d68-349e745a022e

* fix: always send new binary format when client supports feature flag

When prompt_id is None, encode as zero-length string instead of falling
back to old format. Prevents binary parse corruption on the frontend.

Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI/pull/12540#discussion_r2923412491

---------

Co-authored-by: bymyself <cbyrne@comfy.org>
2026-03-19 06:19:21 +07:00
..
__init__.py [API Nodes] add ElevenLabs nodes (#12207) 2026-02-19 22:12:28 -08:00
_helpers.py fix(api-nodes-vidu): preserve percent-encoding for signed URLs (#11564) 2025-12-30 20:12:38 -08:00
client.py Main (#3) 2026-03-19 06:19:21 +07:00
common_exceptions.py feat(api-nodes): network client v2: async ops, cancellation, downloads, refactor (#10390) 2025-10-23 22:37:16 -07:00
conversions.py feat(api-nodes): add Bria RMBG nodes (#12465) 2026-02-15 17:22:30 -08:00
download_helpers.py fix(api-nodes): add separate retry budget for 429 rate limit responses (#12421) 2026-02-12 01:38:51 -08:00
request_logger.py fix(api-nodes): add separate retry budget for 429 rate limit responses (#12421) 2026-02-12 01:38:51 -08:00
upload_helpers.py feat(api-nodes-Tencent): add ModelTo3DUV, 3DTextureEdit, 3DParts nodes (#12428) 2026-02-15 05:33:18 -08:00
validation_utils.py [API Nodes]: fixes and refactor (#11104) 2025-12-04 14:05:28 -08:00