This commit is contained in:
2026-08-26 17:42:00 -04:00
commit ad95d530ad
134 changed files with 31750 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
class ControlKind(str, Enum):
"""Strongly-typed kinds for :class:`PipelineControlMessage`."""
SESSION_END = "session_end"
@dataclass(frozen=True)
class PipelineControlMessage:
kind: ControlKind
# Session that enqueued the message, when known. Lets the pooled realtime
# send loop ignore a SESSION_END from a force-released session so it can't
# satisfy the drain wait of the session that claimed the unit afterwards.
session_id: str | None = None
SESSION_END = PipelineControlMessage(ControlKind.SESSION_END)
def is_control_message(message: object, kind: ControlKind | None = None) -> bool:
return isinstance(message, PipelineControlMessage) and (kind is None or message.kind == kind)