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:
@@ -564,7 +564,9 @@ async def send_chat(server: Any, conversation_id: str, text: str,
|
||||
|
||||
run_id = uuid.uuid4().hex[:16]
|
||||
source = _source_for(conversation_id)
|
||||
message_id = uuid.uuid4().hex[:12]
|
||||
# Hermes preserves message_id through native admission and replay. Its
|
||||
# native envelope rejects custom metadata from messaging plugins.
|
||||
message_id = f"{proto.INBOUND_MESSAGE_PREFIX}{run_id}"
|
||||
|
||||
# ── inbound attachments ────────────────────────────────────────────────
|
||||
media_urls: List[str] = []
|
||||
@@ -627,10 +629,6 @@ async def send_chat(server: Any, conversation_id: str, text: str,
|
||||
else MessageType.TEXT)),
|
||||
source=source,
|
||||
message_id=message_id,
|
||||
# No metadata: the gateway's native-admission validation only accepts
|
||||
# empty metadata on the native path (anything non-empty is refused as
|
||||
# invalid_params unless it is WhatsApp's own native payload), and
|
||||
# nothing in the plugin reads event metadata back.
|
||||
media_urls=media_urls,
|
||||
media_types=media_types,
|
||||
media_text_inlined=media_text_inlined,
|
||||
@@ -658,7 +656,7 @@ async def send_chat(server: Any, conversation_id: str, text: str,
|
||||
**({"request_id": request_id} if request_id else {}),
|
||||
})
|
||||
|
||||
draft_message_id = f"draft-{run_id}"
|
||||
draft_message_id = f"{proto.DRAFT_MESSAGE_PREFIX}{run_id}"
|
||||
await server.broadcast({
|
||||
"type": proto.S_MESSAGE_START,
|
||||
"conversation_id": conversation_id,
|
||||
|
||||
Reference in New Issue
Block a user