fix(pheby): preserve voice run IDs through Hermes admission
Carry run identity in the native message ID. Preserve typed and voice admission on current Hermes and use explicit reply anchors when a durable drain reuses its task.
This commit is contained in:
@@ -108,6 +108,9 @@ S_YOLO_CHANGED = "yolo.changed" # after yolo.set accepted
|
||||
# Reasoning effort levels supported by Hermes (hermes_constants).
|
||||
REASONING_EFFORTS = ("minimal", "low", "medium", "high", "xhigh", "max", "ultra")
|
||||
|
||||
INBOUND_MESSAGE_PREFIX = "pheby-"
|
||||
DRAFT_MESSAGE_PREFIX = "draft-"
|
||||
_RUN_ID_RE = re.compile(r"[0-9a-f]{16}")
|
||||
_ATTACHMENT_ID_RE = re.compile(r"^[0-9a-f]{32}$")
|
||||
|
||||
|
||||
@@ -121,6 +124,14 @@ def new_id() -> str:
|
||||
return uuid.uuid4().hex
|
||||
|
||||
|
||||
def run_id_from_message_id(value: Any, prefix: str = INBOUND_MESSAGE_PREFIX) -> Optional[str]:
|
||||
"""Return the run ID encoded in a Pheby message ID, when present."""
|
||||
if not isinstance(value, str) or not value.startswith(prefix):
|
||||
return None
|
||||
run_id = value[len(prefix):]
|
||||
return run_id if _RUN_ID_RE.fullmatch(run_id) else None
|
||||
|
||||
|
||||
def is_valid_attachment_id(value: str) -> bool:
|
||||
"""True when *value* looks like one of our opaque attachment IDs."""
|
||||
return bool(isinstance(value, str) and _ATTACHMENT_ID_RE.match(value))
|
||||
|
||||
Reference in New Issue
Block a user