Expand description
Wire contract of the live usage step feed, contract version 1.
The usage feed provider serves two operations. usage.steps.subscribe
sends a Notice whenever new steps may exist, and usage.steps.read
returns them as StepRows in a ReadReply. Apps on every platform
decode these shapes; CONTRACT.md in this crate is the normative text and
test-vectors/usage-steps-v1/ holds the pinned bytes.
Readers are lenient toward a newer provider: an unknown member on a reply,
notice or row is ignored, and an unknown Verdict, StepSource or
RequestSize value decodes as Other. Requests are strict: the
provider refuses an unknown request member malformed, so the request
types refuse one too.
LatestRows applies rows in the order reads return them and keeps the
last row per identity (harness plus step_ref).
Modules§
Structs§
- Cursor
- An opaque feed position issued by the provider.
- Latest
Rows - The last row per identity (
harnessplusstep_ref), in the order reads returned them. - Notice
- One StreamData frame of an open subscription: new steps may exist up to
through, the newest committed cursor. - Read
Reply - Reply of
usage.steps.read. Unknown members are ignored. - Read
Request - Request of
usage.steps.read. Both members are optional and also acceptnull; any other member is refusedmalformed, and so does this type. - Refusal
- The body of an Error frame: a refusal of either operation, or the
laggedorcancelledending of a subscription. - StepRow
- One step in the feed. Rows carry no content: never prompt text, tool names or error text.
- Subscribe
Request - Request of
usage.steps.subscribe:{}for every notice, or{harness, session}for the notices of one session. The provider refuses an unknown membermalformed, and so does this type.
Enums§
- Applied
- What
LatestRows::applydid with a row. - BadCounts
- A row whose counts break a contract rule. Readers still decode such a row; this is for the provider’s own tests.
- NotClosed
- A JSON value that is not within a published v1 member list.
- Request
Size - On a prompt drop, whether the request body shrank compared with the earlier step.
- Step
Source - Where the provider learned of a step.
- Verdict
- A step’s prompt-cache verdict. The rules that choose it are in
CONTRACT.mdand are computed over the step’s whole session in time order.
Constants§
- CONTRACT_
VERSION - The version of this contract. Changing a member’s meaning or type, removing a member, or changing any threshold below makes a new version.
- DEFAULT_
READ_ LIMIT limitused when a read names none.- MAX_
READ_ LIMIT - Largest
limita read may name; above it the read is refusedrange_too_large. - OP_READ
- Operation that returns a page of rows.
- OP_
SUBSCRIBE - Operation that opens the notice stream.
- PROMPT_
DROP_ TOKENS prompt_droppedis true when a step’spromptis at least this many tokens smaller than the earlier step it is compared with. Part of the contract version.- STABLE_
RETENTION_ AT_ LEAST - A retention of at least this is
stable. Part of the contract version. - WARNING_
RETENTION_ AT_ LEAST - A retention of at least this (and below the stable threshold) is
warning; anything lower isbust. Part of the contract version.
Functions§
- live_
row_ identity - The identity
(harness, step_ref)of the row the provider serves for a step a runner announced on the bus (step.finished.v1), from that event’s members. Plain strings, so it needs nothing from the runner contract crate.