Skip to main content

Crate cortexkit_usage_steps

Crate cortexkit_usage_steps 

Source
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§

codes
Refusal and ending codes. The provider sends them as the code of an error body; see Refusal.

Structs§

Cursor
An opaque feed position issued by the provider.
LatestRows
The last row per identity (harness plus step_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.
ReadReply
Reply of usage.steps.read. Unknown members are ignored.
ReadRequest
Request of usage.steps.read. Both members are optional and also accept null; any other member is refused malformed, and so does this type.
Refusal
The body of an Error frame: a refusal of either operation, or the lagged or cancelled ending of a subscription.
StepRow
One step in the feed. Rows carry no content: never prompt text, tool names or error text.
SubscribeRequest
Request of usage.steps.subscribe: {} for every notice, or {harness, session} for the notices of one session. The provider refuses an unknown member malformed, and so does this type.

Enums§

Applied
What LatestRows::apply did 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.
RequestSize
On a prompt drop, whether the request body shrank compared with the earlier step.
StepSource
Where the provider learned of a step.
Verdict
A step’s prompt-cache verdict. The rules that choose it are in CONTRACT.md and 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
limit used when a read names none.
MAX_READ_LIMIT
Largest limit a read may name; above it the read is refused range_too_large.
OP_READ
Operation that returns a page of rows.
OP_SUBSCRIBE
Operation that opens the notice stream.
PROMPT_DROP_TOKENS
prompt_dropped is true when a step’s prompt is 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 is bust. 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.