Files
t3code/packages
Ben DavisandClaude Fable 5 b4beb1aed9 feat(contracts): Hermes gateway protocol v4 — media frames and file attachments
v4 is a lockstep bump (the v2->v3 precedent): media is part of the contract,
not a negotiated option, so capabilities require `attachments: true` and a
v3 plugin is rejected at the version gate with upgrade instructions.

New surface:
- `media.deliver` / `media.deliver.ack` — plugin-initiated media shaped like
  `home.deliver`: idempotent on deliveryId, kind/label provenance, optional
  turnId (absent = proactive, lands in Home) and caption, base64 payload
  bounded at 25MB (HERMES_MEDIA_MAX_BYTES) at the schema so an oversized
  frame fails at decode. Ack only after durable write.
- `turn.start`/`turn.steer` gain optional inline-base64 `attachments`.
- `ChatFileAttachment` joins the ChatAttachment union: one generic variant,
  rendering kind derived from mimeType client-side so new renderable types
  never need a schema change. Persisted rows admit 25MB (what the wire can
  deliver); the Upload variant keeps the tighter 10MB send bound.
- `thread.notification.deliver` (+ its event payload) carries optional
  attachments/turnId — media deliveries reuse the notification machinery
  for dedupe, provenance, and lifecycle reset.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-27 17:46:58 -07:00
..