The engine protocol
A front-end and a ral engine share exactly one duplex stream, sorted into
channels by direction, by whether a message is answered, and by the scope of
the handler that receives it; the stream is realised by exactly two bindings —
a direct call in one address space, or a codec across a socket, a re-exec’d
process, or a vsock into a guest. Nothing exists in one binding and not the
other: identity is the trivial instantiation of the algebra wire encodes,
never a second design. A channel is a scope, never a purpose: every host
facility yet to be invented is a class inside an existing channel’s payload,
decoded by one more arm.
One engine, two carriers
The claim is true by construction, not by discipline: there is one engine, and a binding is only the carriage around it.
- One engine.
Engineis the engine side of one session — theShell, the scopes that stop its runs, and the installer it was born from — and it answers a run and a probe. The identity carrier holds one behind its session lock and calls it on the dispatching thread; the wire carrier runs one on a worker thread behind a frame loop. They differ only in theRailseach lays for a dispatch: where its events go and who answers its enquiries. - One session constructor.
Engine::bootreads anAttachunder anEngineInstallerfor either carrier: resolve the installer (version first, then tag), derive itsRuntimeonce from the attach’sEngineSpec(builtins live on it and nowhere else), then eitherShell::rootand the root recipe over theOrigin::Root(seating its cwd and env), then re-hold and install itsRoot::grantsas permanent session layers, oldest first; orShell::child_ofover theMarshalledparent inOrigin::Child.IdentityTransport::childcalls the sameShell::child_of, sharing the parent’sArc<Runtime>while reading the same bytes a wire child reads. Construction is attach:IdentityTransport::bootreturns the verdict the wire’sawait_attacheddoes —Severed::Refused, in the refusing step’s own words — so a transport in hand is one its engine accepted. Every step of the attach (the runtime, the root recipe, the marshalled parent,Shell::child_ofand the host’sGrantNarrower) refuses with anError, which crosses as aWireError, so a refusal’s hints reach the host on either carrier.WireErrorcarries the typedreason, optional reportcontextand ordered storedhints. Reconstruction preserves that reason, so its code and intrinsic advice remain derivable; no rendered sentence becomesRaised. Host provenance, witnesses, compiler rejections and unwind facts do not cross this envelope: the enquiring operation claims engine-side provenance (docs/SPEC.md§13.1). - No front-end holds a
Shell. Nothing public onIdentityTransportyields aShellor accepts one. A front-end reaches its engine only throughTransport— dispatch, probe, control — so a facility it needs must exist in the protocol, and therefore exists under the wire as well. Tests reach engine state throughral_core::test_access(featuretest-util) or a probe, never a public method:test_access::workersreads throughIdentityTransport::inspect, itselftest-util-only, and core’s own tests boot their engines as every engine is booted, throughcarrier::testkit. - One parent-to-child route.
Shell::marshalwrites the parent’s image andSpawnGranttoMarshalledbytes under either carrier. Both children read them throughShell::child_of, which pushes the child’s one grant layer (Two bindings, below). - One meaning per verb.
Control, reentrancy, and every probe class are defined once, and each carrier applies the same definition.
Channels: direction, answer, scope
| answered (call) | one-way (notice) | |
|---|---|---|
| host → engine | Dispatch → Report — one whole run: clocked, walled, cancel-scoped | Control — addressed strike, end of the root, out-of-band |
| engine → host | Enquiry → Answer — nested inside a run, no clock of its own | Surface — a run’s live values, ordered before its Report; a worker’s batch, on the session |
Each direction owns one answered channel and one one-way channel, and the engine’s one-way traffic splits once more by scope (below). The remaining asymmetries are semantic, not accidental, and are never smoothed into a fake mirror pair:
- Mood.
Controlis imperative whileSurfaceis indicative: this happened, this is now true.Controlhas two verbs, each meaning one thing under either carrier (Scopes::apply):Strike(id, cause)unwinds only that dispatch with the exact cause, even before it has arrived, and a stale id strikes nothing. A dispatch-local terminal cause never ends the engine;End(cause)cancels the durable root — every run and every worker, for good — with aRootCause, closed:Cancelled,Terminated(SIGTERM/SIGHUP) orAborted(Ctrl-\). No engine folds its process’s signals: its front-end forwards them as these verbs (ControlSender::forward_signals), aiming an interrupt only at a dispatch it sent before the interrupt was raised, so a Ctrl-C struck between runs reaches none. A wire engine hears only its own process’s shutdown. So a process hosting many engines — exarch, a test binary — never has one signal reach them all. - Ordering.
Surfaceis sequenced within its dispatch, strictly before that dispatch’sReport— what makes the transcript truthful.Controlis deliberately unsequenced: it must race past an in-flight dispatch, or cancel could not work. Naming its dispatch is what makes the race harmless: a verb that arrives late finds a stale id. - Clock.
Dispatchopens the turn’s clock and holds the session’s single worker rendezvous;Enquiryhappens inside a dispatch and inherits all of it — no wall of its own, and aControl::Strikemust wake an engine parked on an unanswered enquiry.
A further frame, Probe, rides the Dispatch → Report rail rather than
opening a channel of its own (see Probes, below).
Two scopes of Surface
Surface is two channels, because a producer can outlive the dispatch that
started it. A surfaced value is handled by the innermost host handler whose
lifetime contains its producer:
- Dispatch scope —
Event::Surface: a running dispatch’s values, rendered as they arrive and ordered before itsReport. - Session scope —
SessionEvent::DeferredSurface: a detached worker’s values, delivered to the host’sDeferredSinkas one batch when the worker settles, closed by its`done, or awatchline as it arrives; rendered at the host’s next boundary. A worker holds no live sink and no desk, so it cannot speak on a dispatch-scoped channel at all (surface-delivers-itself).
Both carry the same vocabulary and meet the same decoder; only the scope differs.
The channels as asynchronous effects
Read through Ahman and Pretnar’s asynchronous effects, engine and host are two processes in parallel, exchanging operations rather than calls (asynchronous-effects).
Surfaceis an outgoing signal: issued, never answered.Controlis an incoming interrupt, arriving at any point of a run; its handlers are the runtime’s (Scopes::apply), never the program’s.- A
spawnhandle is a promise, andawaitits eliminator. Enquiry → Answeris a synchronous operation — in Æff a signal, a promise of the reply, and anawait— fused into one primitive, so that it stays inside its dispatch’s window, ordered before theReport.- The session scope has no Æff counterpart: an Æff signal propagates at once, while a worker’s waits for its scope’s boundary — as a kernel makes a pending signal visible only on a return to user mode.
Payloads: first-order or it does not cross
Every open payload position — a surfaced value, an enquiry and its answer,
a probe’s reading and its answer, a hook’s arguments, a settled run’s value
— carries FOValue: a serialisable first-order ral value — unit, bool,
number, string, bytes, and lists/maps/variants thereof, data all the way
down, its extension slot uninhabited by construction. The envelope’s own
fields (Run, Ending, Control, Attach) are closed Rust types, and
nothing in either carries an fd, a handle, a closure, or a capability beyond
the resolved grants a Root or a marshalled Child already carries. Attach
is { engine: EngineSpec, origin: Root | Child(Marshalled) } and carries only
what an engine reads. EngineSpec names the engine — protocol version,
installer tag, terminal state, home. A Root is the session a root starts
from — its cwd, the host’s per-session env, grants installed after the
recipe, and config, the installer’s own settings as an FOValue its
recipe decodes and core never reads. A Child carries its parent’s image
and SpawnGrant as one JSON document, Marshalled, which the engine alone
reads. The opacity law is that a payload the host relays but never reads
crosses as bytes; its content is a contract between the engines at its two
ends, and the spawner makes those ends one binary
(single-binary). The document therefore carries
no build-id, which would check what the spawner already guarantees;
host/guest skew is gated by PROTOCOL_VERSION at attach.
Marshalling preserves how values are held and what they share.
- An explicit dependencies-first walk writes each environment once, by
allocation identity. Row
inames only rowsj < i; the root environment and handler frames may name any row. No value nests another wire value, and tag spines cross as flat lists. - Syntax crosses as a closure over its environment row; a list or map built at run time is such a closure, its elements bound in the row. Shared environments remain shared in the child. IR is copied once per closure that holds it, not shared across closures.
- Builtins cross by name. A residual crosses as a builtin name, an environment row and a supplied-argument count; the receiving entry reconstructs its own η suffix. δ is not wire syntax. Builtins, handles and residuals sit only at a value closure’s root, never beneath a tag.
- Writing a live handle as its title withholds it in place, under both
carriers. Names, positions and
Handletypes survive; observations refusewithheld-handle. A caught failure is plain record data and crosses as a closure; a worker’s own failure crosses as itsErrorFact(runtime-values-are-value-closures). - Reading admits and constructs each row in one pass, then the roots: a
structural decode, then a semantic admission of every IR leaf and node,
since the structural decoder admits no semantic serde validators. Every
refusal is a
DecodeFailureat its JSON path, wrapped once asProtocolFailure::Decode { kind: Parent, operation: "child" }; the checks are listed in transport. Marshalledhas no inner length prefix: only its carrying protocol frame delimits and bounds it. In-process construction still encodes and decodes that same document, without a protocol frame. Writing refuses only a non-Unicode cwd (ProtocolFailure::Marshal).
The envelope — Frame, Event, SessionEvent, correlation ids,
Attach’s handshake — stays a closed set of Rust types behind
PROTOCOL_VERSION, checked at Attach and refused loudly on mismatch. This
split is the design: the envelope must be exhaustive-matchable and
version-gated, because an envelope change is a protocol change; the
payload must be open, because operations keep arriving. The extension
law, stated once for every channel: a new facility is a new class — a
FOValue::Variant label — on an existing channel, plus a decoder arm at the
receiving end, never a new channel or frame family. The law binds a second
level too: a class that nests tags beneath it (exarch-agents `list,
exarch-schedules `add) draws the same loud error for an unrecognised tag as
for an unrecognised class — nesting must not open a silent hole beneath the
rule it was introduced under. An unrecognised enquiry class or tag answers
Err naming it; an unrecognised surface class is dropped with a note, never
silently. Every surface class is a label, an audit observation included
(`observed), so a host dispatches on the tag alone and never on a
value’s shape.
A payload is typed once, for both ends. It is an FOValue on the wire
and a Rust type on either side of it: Datum (ral_core::data::datum) is
the one first-order codec — encode, and a strict decode naming whatever
arrived ill-shaped — and record! derives it for a record whose keys must be
exactly its own, answering an unknown key with the one it most likely meant
(variant! and label! are its siblings for payload enums and enums of bare tags).
Probe classes, exarch’s enquiries, the REPL’s enquiries and an installer’s
Root.config all cross through it, so a builtin and the desk behind it decode
with one function and refuse in one wording.
The frame codec has no depth cap. Frames are length-prefixed JSON, and
serde_stacker grows both encode and decode onto the heap, so a frame nests
as deep as the data it carries and only the frame-length fuse bounds it;
FOValue is externally tagged. A frame that decodes but is out of protocol —
one only the other side ever sends — is a breach, not noise: the front-end
severs Faulted, and the wire engine ends the session Corrupt.
The desk’s decode is a trust boundary, not a duplicate check. Under the wire the engine and its shell run inside a guest and the desk runs on the host, so a guest can send whatever it likes regardless of what its own builtin already validated. Both ends re-validate: the builtin refuses early for a fast, legible diagnostic; the desk refuses again because a registry’s own admission check (naming, uniqueness) must hold independent of which path reached it.
The guest’s end ships in media built earlier. The warrant between ral and
its confined child is one pinned binary at both ends, so a changed encoding
changes its version string and no old form is decoded. The engine is different:
the guest end lives in the VM image, built before the host. So any change to a
payload’s shape (the grant value’s tables, verb sets as sequences) bumps
PROTOCOL_VERSION and rebuilds the guest media, whose
manifest the host compares before packaging. Without the bump stale media passes
the packaging check and the attach handshake and fails decoding the first
dispatch. An authored ceiling crosses as a grant
value, the record grant takes, in Root.config, and the engine decodes it where
it lands (Shell::decode_grant, against its own anchor) as it decodes any
grant, under the refusals of every decoder
(a-grant-is-decoded-where-it-lands). Rebuild guest media with just vm::boot. A Fragment never
crosses: it lives only between loading and extend. A grant goes back out the
same way: Probe::Grants answers each layer’s value, never a summary of key
strings.
The laws of an enquiry
- Containment. An enquiry lives inside its run: same wall, same
foreground cancel scope, no clock of its own. A worker is built
with no desk at all — a worker outlives its spawning run’s
Report, so one that could enquire would answer into aReportwindow already closed. - A strike wakes a park.
Control::Strikemust reach an engine parked on an unanswered enquiry; the wire engine’s park polls the run’s cancel cause between boundedmpscrecv_timeoutwaits on its answer channel, so cancel and answer race safely. - Correlation from day one.
EnquiryId, fresh per enquiry, rides insideFrame::Event(DispatchId, Event::Enquiry(EnquiryId, _))on the way out, and alone onFrame::Answer(EnquiryId, _)on the way back — the dispatch is implicit in which enquiry is outstanding. Dispatches and probes share one id mint precisely so a probe’sReportcan never be mistaken for a dispatch’s. - At-most-once, no protocol-level retries. A dispatch, an enquiry, an answer
each cross once. A broken transport fails the run —
Severed— and is never replayed. - Reentrancy, enforced rather than documented, on both carriers. A
Hosthandler runs on the dispatching thread, inside the dispatch that called it, so it must not dispatch, probe, or reach the session of that same transport: the identity carrier would deadlock on its own session lock, and the wire’s drain loop would swallow the outer run’s events. One thread-local registry, entered bydispatch_to_reportand consulted by every typed reading, names the transports this thread is dispatching on, and a reentrant call panics with a didactic message — a wedge becomes a loud, named failure at the exact call that would have hung, under either carrier. - Duration discipline, with a litmus for what belongs on this channel: promote a verb only when the caller can observe and act on the host’s answer — value or refusal — within the turn. A start receipt, a ledger read, a confirmation belong here; a result that arrives later belongs to the inbox (agents).
- Authority is enforced at the desk, never by a visibility filter over which verbs a builtin index advertises — a filter is not an authority check once the engine may be a different machine. The desk refuses, in the same words the builtin’s own check would have used.
Two bindings: a call and a codec
A run’s whole host-facing surface — where its surfaced values go, and who
answers its enquiries — is one object, Host, handed to each dispatch, so
the rails a run speaks on can never be bound to two different hosts by
accident. A host with nothing to offer hands over the mute Host () —
renders nothing, refuses every enquiry with the honest absence error — which
is batch’s whole story. A helper’s parent crosses as Marshalled under
both bindings; the host relays it without reading the session it describes.
- Identity binding — a direct call.
dispatchruns the whole turn on the calling thread, and the front-end drains events only afterdispatchreturns; routing an enquiry through that event channel would park with nobody draining. So the desk is a direct call into the installedHost, adapted by a drain-then-handle law — it drains whateverSurfaceevents the run already queued before invoking the handler, so a handler’s own output can never outrun its run’s earlier values. The handler runs on the dispatching thread, inside the host’s own call stack, answering from state it captured. - Wire binding — the desk is the codec. The engine writes
Event::Enquiry, parks a rendezvous keyed byEnquiryId, and the front-end’s own drain loop (dispatch_to_report) answers by calling the sameHostand writingFrame::Answerback. Only who calls theHost, and when, differs between the two bindings. - The child reads one marshalled parent. The spawning builtin puts
Shell::marshal’s bytes in its enquiry’sparentfield. Identity callsIdentityTransport::child(&parent); wire puts the same parent in the new engine’sAttach(see The factory). Neither gives the host aShell.Shell::child_ofreads the image and pushes itsSpawnGrantthroughSpawnGrant::narrow_onto, under the parent’s installer and against the child’s own cwd. The inherited grant stack is reheld on either carrier; the new layer stays unfrozen until this construction step.
Probes: boundary-time reads
A probe is a pure, boundary-time reading of session state — no wall, no
sinks, no clock, absent by type — so it is a Frame, not a Run. It shares
the engine’s single worker rendezvous with dispatches: a probe sent mid-run
gets the same “engine busy” a second dispatch would, since probes are legal
only at a run boundary.
A reading is typed once. Core’s Probe enum (protocol/probe.rs) is
the frame’s payload: each variant states what it takes, so a payload its probe
does not take is not representable and the engine has nothing to refuse. The
engine’s answer (engine/probe.rs) and the host’s typed reading —
t.cwd() -> Option<PathBuf>, t.workers() -> Vec<WorkerRow>, one per variant,
provided methods of Transport — match on the one enum, so the two ends of a
probe cannot disagree about what a probe means. A working directory that cannot
travel as text answers None, as no cwd at all. The answer is its own event,
Event::Reading, not a forged run report. The probes span session state
(cwd, home, env-var, builtin-names, session-ended),
the scope (bindings, completion-names, the binding counts), the
engine’s filesystem (path-bytes, path-entries) and its grant stack
(grants: each layer a reader needs, GrantLayer::is_shown, as its grant
value, LayerValue,
and whether the engine’s host holds a gpu: `withheld;
a-grant-has-one-outward-form).
What a probe answers is data, never a handle. An answer outside its class’s shape is the engine breaking
the protocol: the typed reading severs the transport Faulted itself, which is
why Transport::sever is on the trait, identity included.
A failed probe distinguishes two unrelated causes: a probe the engine would not read at all — one sent mid-run, or whose reading panicked — is a program error on the caller’s side, since a probe is legal only at a boundary; a probe for which no answer will ever come, because the transport itself is gone, is the far side’s death. The two are never conflated into one string a caller might pattern-match.
A session is a process is a connection
One engine process per session, one connection per engine process — the
connection is the session, so no frame carries a session address.
Attach opens it; Detach closes it with an Ended acknowledgment;
EOF or the liveness deadline closes it without certification.
Dispatch, Probe, Event, Control, Answer all ride it unaddressed.
One owner per connection. A wire transport alone owns its Line:
the write channel, a never-locked duplicate to shut the socket with, and
the severance, a Fatal<Severed>. A control sender and the heartbeat hold the
line weakly, so holding a sender holds no connection, and a verb aimed at a
gone line is a no-op. The wire transport’s drop shuts the socket, which
acts on the connection rather than on one descriptor, and the engine reads
EOF; this initiates teardown but proves nothing about when it finishes.
WireTransport::end instead sends Detach and waits for Ended, emitted
only after engine-thread join and an empty session-worker census. A timeout
or severance refuses that proof. Exarch retains membership during this
exchange; Synod refuses its closing folder walk if certification fails.
The identity transport’s drop destroys its engine directly.
The process is what makes a session’s end final. Most of what a session
needs from its boundary is already software: Control cancels a dispatch,
the session’s DurableRoot and Roster contain its workers, and the worker’s
catch_unwind contains a panic. None of that ends a session that will not
cooperate. Cancellation is polling, not revocation
(cancellation): an effect already past its last
check runs to completion. An atomic write’s commit, for one, fsyncs and then
renames; a thread blocked in that fsync renames over its target after its
session has been abandoned. Only the death of a process ends every thread at
once, and with it every effect the session still had in flight. The process
is therefore the unit of forced termination, and so of a session’s
effects. The isolation, scoped cancel and teardown a process also gives
come along with it.
-
No session is adopted into another’s process. In-process adoption of a wire helper would avoid a process (The factory) but would lose that bound. Recovering it means one of two things. The first is ending the guest whenever a helper fails to settle, which turns one wedged helper into the loss of the whole conversation. The second is a contract that no effect outlives its session, and cooperative cancellation cannot give one. Either way the adoption needs more machinery than a child process costs: a session supervisor, a process cancel root, an audit of every process-global mutation, and a new handshake. The host’s identity seats share exarch’s process, and accept the weaker bound there.
-
/clearis host lifecycle, not a frame: drop the engine and boot a fresh one from the sameAttach, onto the same interrupt target. A seat that cannot be reborn here — a wire seat, whose engine was not booted by this process, or a child session, whose authority a fresh root boot would not carry — refuses/clearwith a sentence. -
A sub-agent fork under the wire is a child engine spawned by the guest daemon, on a connection the host dialled, born from an
Attachthat carriesOrigin::Child(parent). The parent crosses asMarshalledbytes the host relays unread, interpreted only by two instances of one binary, both spawned by the daemon from one path. The first-order law governs the positions the host reads; this one it does not.
The factory: the host dials the daemon
A wire spawn is one exchange. No engine spawns an engine: the parent’s
spawning builtin checks that it has a desk before marshalling, then puts
Shell::marshal’s bytes in its start enquiry’s parent field.
- The host, while still answering that enquiry, asks its
Factoryfor a connection: the desk dialsguest_abi::ports::FACTORY, the one guest port, on which the guest daemon listens for the life of the VM. - The daemon admits only a peer whose CID is
VMADDR_CID_HOSTand drops anything else; a guest process cannot present the host’s CID, since the guest kernel’s transport writes the source. Each admitted connection is one engine, spawned exactly as the root is, on fd 3. - The desk builds the child’s
Attachfrom the parent’s engine specification andOrigin::Child(parent), writes it, waits forAttached, and only then answers the enquiry. The child exists and is attached before the roster names it. A refused attach reaches the parent as the desk’s refusal, in the engine’s words.
The root keeps dialling out: its dial is the boot’s readiness signal. Children
are dialled in because the host already holds the spawn the connection is for,
so no correlation is needed. Marshalled carries the parent’s sources, terms,
fixings and grant as well as its scope and context. No recipe runs in a child:
the engine derives its runtime, then Shell::child_of reads the parent and
constructs the session.
A child ends when the host drops its connection (EOF on fd 3).
The scratch belongs to the host. The root attach names
$EXARCH_SCRATCH; a child inherits its spelling in Terms, and no engine
mints a scratch or moves its lock. Agents in one tree therefore share the
scratch and the tool homes under it, and trust one another: a narrowed child
may plant tool configuration a wider relative later runs. A grant bounds
access to the user’s world, not trust within the tree.
Liveness and severance
Any frame that arrives is proof of life; heartbeats exist only to
manufacture traffic where the failure mode is silence rather than EOF.
Silence is counted in unanswered probes, never in elapsed clock
(silence-is-counted-in-probes):
a deadline is evidence only if someone was running to observe it, and a
suspended host is not. A
same-host child’s death is a kernel-guaranteed EOF the moment its process
exits — nothing to manufacture. A guest across a virtual socket can die into
silence with no EOF at all, so the front-end that crosses one must ping, and
by pinging enters a contract it cannot silently leave: the first Ping
the engine receives arms its read deadline; a front-end that never pings
leaves the engine’s patience infinite, correctly, since its death needs no
deadline to be noticed. A write that stalls past the same patience reads as
death too — a front-end that stopped reading is, within that bound,
indistinguishable from one that no longer exists. Only failed I/O severs: a
frame the fuse refuses is refused before the wire is touched, is the writer’s
fault, and is answered where its writer stands (a Report or a reading by the
engine’s refusal, a Dispatch by a host-fault Report, a Probe by a
rejection, an Answer by Err, an enquiry by the enquirer’s own error, an
Attach by a refused attach); a frame with nowhere to refuse into is
diagnosed and dropped. The reader still severs on an oversize frame, a peer’s
protocol violation.
Every terminal cause collapses into one type, Severed: the engine
refused Attach in its own words (a version mismatch, an unknown installer,
a parent it could not read); the stream closed or a frame failed to cross;
nothing arrived before the liveness deadline; or the engine answered outside
the protocol — a reading outside its class’s shape, a frame only a front-end
sends — a fault the front-end observed for itself and records through
Transport::sever. Severed is terminal — a front-end that observes one
ends its session, never retries into it: exarch’s headless and synod
front-ends end the conversation on it, showing its sentence once — and first
cause wins where more than one could apply.
A front-end may bind a home to the severance (Transport::bind); whichever
thread severs then cancels it — the reader, the heartbeat or a failed write.
Teardown severs too (the reader on Ended, the drop), so a front-end
replacing an engine under a living home unbinds it first (Transport::unbind).
Exarch binds each agent’s life, so a lost engine stops its owner’s work at once.
The reader thread that watches a wire connection always severs before it closes the event stream it drives, so a closed stream is proof a cause already exists to read back.
A severed transport refuses a dispatch itself: Transport::dispatch answers
the standing cause, and its Ok promises the stream the run’s Report, or
its close once severed. The check sits in the carrier that sends, so a sever
racing it still leaves the drain an end (identity’s Report, a wire’s close),
never a scoped drain polling an identity stream, which never closes, for a
Report that will not come.
The attach verdict is the handshake’s answer: the engine replies to
every Attach with Attached or Refused(reason) as a session event, and
the wire front-end’s await_attached blocks on exactly that verdict before
its first dispatch — a refusal is learnt at construction, in the engine’s own
words, rather than inferred from an EOF three frames later.
IdentityTransport::boot returns the same verdict from the same
Engine::boot, so neither carrier hands out a transport its engine refused.
Platform neutrality
The frame algebra is data, identical on every platform that can serialise
it; only its producers are gated. A wire type carries no platform cfg of
its own even when only a Unix engine can ever construct one particular
value of it, so a Windows front-end decoding a Linux guest’s report at equal
PROTOCOL_VERSION succeeds exactly as any other value would; only the code
that produces or acts on the Unix-only value locally is gated. The
wire’s own stream abstraction is std’s generic owner of a connected stream
socket — one end of a socketpair, a vsock into a guest, or on Windows an
AF_UNIX socket that OpenVMM relays to the guest’s vsock
(windows-runs-openvmm) — never a
name for one address family, so a new transport is a constructor, not a
rewrite.
Why not gRPC, JSON-RPC, or Cap’n Proto
| this protocol | gRPC | LSP / JSON-RPC | Cap’n Proto | |
|---|---|---|---|---|
| both directions request | native (Dispatch↓, Enquiry↑) | client-streaming hacks, hand-rolled correlation | yes | yes (capabilities both ways) |
| in-band ordering (events before result) | law, on one stream | not across RPCs | not guaranteed | pipelined, per-capability |
| cancellation | out-of-band by law, wakes a parked enquiry | per-RPC deadline, tied to the call | advisory | promise drop |
| payload fit for ral data | native (FOValue: variants, bytes, NaN by bits) | protobuf: no bare variants, no NaN discipline, codegen | JSON: loses bytes/NaN/variants | schema + codegen |
| schema evolution | a class on a stable envelope; unknown class = one clean error | a .proto rev and regen on both ends per operation | method strings, ad hoc | schema evolution rules, codegen |
| fit with [[invariants/single-binary | single-binary]] | perfect: both ends are this repository, re-exec’d | poor: a second IDL, codegen artefacts | good |
The shape that does match is the LSP/JSON-RPC one — bidirectional requests plus notifications, with a typed envelope over method strings. gRPC is built for polyglot service meshes with independent teams and a schema registry as the contract; this protocol is two halves of one program that must also survive a machine boundary, exactly where the heavier options are weakest.
See also
engine-protocol (the files and symbols that realise this), agents (the inbox as the “I want it eventually” channel the enquiry litmus routes around), grant (the capability meet a fork’s authority narrows through, never the protocol), single-binary (every wire peer is a re-exec of the same binary, which is what makes a bare tag a safe boot recipe).