Skip to main content

Crate amberfork_record

Crate amberfork_record 

Source
Expand description

The record path: wrap an agent, capture what crossed the provider boundary.

amberfork has two ingestion paths sharing one canonical model (design doc, “Counterfactual attribution is impossible against passive OTLP alone”). The PASSIVE path aligns OTel traces you already have — framework-agnostic, but content is opt-in and often absent, and you cannot re-run a telemetry photo. This crate is the RECORD path: it runs the agent behind a local capture proxy, so content is guaranteed and the run stays re-executable.

Two things follow from that, and they are the reason this crate exists rather than being a flag on ingest:

  • Full content. The passive path’s full content guaranteed cell is “no”; this path’s is “yes”. Full inputs are worth +76% relative step-level accuracy over output-only logs (“Replay fidelity ceiling”), which improves the ordinary diff before any re-execution exists.
  • Re-executability. A boundary recording can be replayed and mutated, which is what counterfactual attribution needs. This crate captures; re-execution is its consumer.

tokio lives here because this is an I/O edge, alongside amberfork-server. Engine crates stay sync and pure.

Structs§

CaptureProxy
A bound, running capture proxy.
CapturedRequest
One captured request, with full inputs.
CapturedResponse
One captured response.
Cassette
A full-content recording of one agent run at the provider boundary.
CassetteVersion
Version of the cassette contract.
Exchange
One request/response round trip at the provider boundary.

Enums§

Body
What the recorder writes when a body is not valid JSON. The cassette stays a JSON document, so a non-JSON body (an HTML error page from a proxy, a truncated stream) is preserved as text rather than dropped or allowed to fail the capture.
RecordError
Something that went wrong standing up or running a recording session.

Functions§

normalize
Normalize a captured cassette into the canonical Run the aligner consumes.
normalize_str
Parse a cassette from JSON and normalize it into a Run.
retain_request_headers
Filter request headers to the recordable allowlist.
retain_response_headers
Filter response headers to the recordable allowlist.