Skip to main content

Module exec

Module exec 

Source
Expand description

The handle a caller holds for one running exec.

The whole reason this module exists is ExecHandle::stream. Everything else here is a thin wrapper over one route.

§The cursor is the contract

A reconnect passes ?offset=<bytes consumed>, and the daemon replays from there. Without it a dropped connection means either losing everything after the drop or replaying from zero, and neither is distinguishable from correct behaviour with nothing to check against — E2B’s cursorless connect(pid) and their issue #1352 are exactly that.

Two rules the cursor arithmetic has to obey, and both are properties of what the caller has seen rather than of what arrived:

  • Advance only past bytes actually handed to the caller, so a reconnect never re-delivers and never skips.
  • Advance past a gap too. The daemon has already moved its own cursor past evicted bytes; if ours did not follow, a reconnect would ask for them again and be told about the same gap forever.

§The reconnect condition is a typed event, not a byte count

A stream that ended without an exit event was cut. A stream that ended with one is over. Those two are the identical byte sequence on a raw stream, which is the whole argument for SSE framing here and why this is not a byte stream. The reconnect decision reads that distinction and nothing else.

Structs§

ExecHandle
One exec, addressed by its caller-minted id.
ExecResult
An exec’s phase and, once it has one, its outcome.
StreamEnd
Why a stream stopped, and where a resume would pick up.
StreamOptions
How a stream should behave. See ExecHandle::stream_with.

Enums§

EndReason
The three ways a stream ends without an error.

Constants§

DEFAULT_STREAM_IDLE_TIMEOUT
How long an attached stream may be silent before it is treated as dead.

Functions§

mint_exec_id
A fresh exec id: x- plus 16 hex characters, the Python client’s shape.

Type Aliases§

StdinAck
What a stdin write accomplished.