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
This commit is contained in:
bymyself
2026-02-27 17:21:14 -08:00
parent 1c7e656eb4
commit 83df2a88bd
6 changed files with 54 additions and 8 deletions

View File

@@ -1235,6 +1235,18 @@ class PromptServer():
def send_progress_text(
self, text: Union[bytes, bytearray, str], node_id: str, prompt_id: Optional[str] = None, sid=None
):
"""Send a progress text message to the client via WebSocket.
Encodes the text as a binary message with length-prefixed node_id. When
prompt_id is provided and the client supports the ``supports_progress_text_metadata``
feature flag, the prompt_id is prepended as an additional length-prefixed field.
Args:
text: The progress text content to send.
node_id: The unique identifier of the node sending the progress.
prompt_id: Optional prompt/job identifier to associate the message with.
sid: Optional session ID to target a specific client.
"""
if isinstance(text, str):
text = text.encode("utf-8")
node_id_bytes = str(node_id).encode("utf-8")