1.8 KiB
1.8 KiB
drive-transport-https-v1
Why
@suaveplan/drive-mesh-protocol defines the wire format for chunk
discovery / request / delivery envelopes. To put those envelopes on
the wire, drive-mesh consumers need a TransportLike<MessageEnvelope>
implementation. This change ships the first one — an HTTPS-relay
backed transport that works in browsers, sits behind any TLS
proxy, and only requires the relay to host an HTTP server.
The HTTPS path is the lowest-friction connectivity tier in the drive stack: every browser, every server, every CI runner can speak it. WebRTC and WebSocket transports follow.
What Changes
- New package
@suaveplan/drive-transport-httpsatpackages/drive/drive-transport-https/with full Vite + Vitest + Biome scaffolding. HttpsTransportclass implementingTransportLike<MessageEnvelope>from@suaveplan/types/transportwith explicitstart()/stop()lifecycle.- Long-poll receive loop (
GET /recv?for=...&since=cursor&timeoutMs=...) with exponential backoff, equal jitter, AbortSignal cancellation, and alastAuthErrordiagnostic getter for credential-refresh flows. - Stateless send (
POST /sendwith{ to, envelope }body) with Zod-validated request and response shapes. - Nine frozen
HTTPS_TRANSPORT_CODES(NOT_CONNECTED/CLOSED/SEND_FAILED/RECV_FAILED/AUTH_FAILED/RELAY_UNAVAILABLE/MALFORMED_RESPONSE/ABORTED/PEER_UNKNOWN). - Auth-failure short-circuit: a
401/403from/recvstops the loop instead of looping forever — back-pressure belongs to the consumer. - 58 tests across 6 files at 100/100/100/100 coverage; 5/5 docs coverage.
Impact
- New public package. No consumers yet — drive-mesh wiring will follow.
- Browser-friendly: no Node-only imports. Works against any HTTP
relay that implements the documented
/sendand/recvendpoints.