Skip to main content

Module protocol

Module protocol 

Source
Expand description

The framed stdin/stdout protocol between the runner and a worker.

One frame is a four-byte big-endian length prefix followed by exactly that many bytes of one UTF-8 JSON value. The same frame format runs both directions. The declared length is checked against a limit before any allocation, so an oversized declaration is refused without buying its buffer. EOF inside the header or the payload is a truncated frame, the footprint of a killed writer, and never parses.

A response frame alone is not success. The runner also requires a clean child exit and no trailing stdout bytes, so a worker that crashes after writing plausible JSON, or logs past its frame, is refused.

Modules§

bodies
Typed request and response bodies for the shipped adapters. Each adapter’s payload and ok values are these shapes.

Structs§

Request
One request frame from the runner to a worker.
RequestSchema
A schema field pinned to one literal value. Serializes to that literal and rejects every other value on read.
Response
One response frame from a worker to the runner.
ResponseSchema
A schema field pinned to one literal value. Serializes to that literal and rejects every other value on read.
WireError
A machine-readable failure carried over the wire.

Enums§

FrameRead
How reading one frame ended.
ResponseValidationError
Why a response violates the one-body wire shape.

Constants§

MAX_REQUEST_BYTES
Ceiling on request frame payload bytes, enforced by the worker before allocation. Requests carry paths and options, never file content, so they stay small.
REQUEST_SCHEMA
The schema identifier carried by every adapter request.
RESPONSE_SCHEMA
The schema identifier carried by every adapter response.

Functions§

read_frame
Reads one length-prefixed frame, checking the declared length against max_bytes before allocating.
write_frame
Writes one value as one frame and flushes.