Skip to main content

Module remote

Module remote 

Source
Expand description

Shared remote HTTP client and response validation (JOE-1587, JOE-1588).

All OpenRouter STT/cleanup traffic should go through this module so endpoint policy, redirects, credentials, and body caps stay consistent.

Structs§

HardenedHttpClient
Hardened reqwest client shared by STT and cleanup.
RemoteBodyLimits
Endpoint-specific body byte caps.
RemoteEndpoint
Validated remote endpoint with trust classification.
RemotePolicy
Policy knobs for building the shared client.
TranscriptLimits
Limits applied after JSON parse to transcript structures.

Constants§

DEFAULT_CHAT_BODY_CAP
DEFAULT_CLEANUP_BODY_CAP
DEFAULT_OPENROUTER_ORIGIN
Official OpenRouter HTTPS origin (credentialed default).
DEFAULT_STT_BODY_CAP
Default hard caps for response bodies (bytes).

Functions§

map_http_status
Map HTTP status codes to typed provider errors (no payload echo of secrets).
read_body_limited
Stream a response body under a hard byte cap.
redact_secret
Redact bearer tokens / API keys from diagnostic strings.
validate_endpoint
Parse and validate a base URL under the remote policy.
validate_segments
Validate segment list: counts, lengths, finite ordered timestamps.
validate_text_bounds
Validate transcript text size and optional expansion vs input.