ModelContext

What the loop hands an adapter for one send or lookup: the fencing pair it re-checks at its real send point, and artifact access, since the rendered request carries refs, not bytes.

Bound to the writer that created it: fence, read and put always act for that branch_id and epoch, and nothing on it selects another.

A protocol: adapters implement it.

Properties

branchId / branch_idBranchIdrequired

The branch this attempt is dispatched for. fence, read and put always act for this branch.

epochnumberrequired

The lease epoch this attempt is dispatched under.

Methods

fence

Re-checks that the dispatching writer still holds the branch lease at epoch. A failure means send nothing.

fence(): Promise<Result<void>>

Returns an error value with one of these codes: stale_epoch.

read

The verified bytes (sha256 and length checked) of an artifact the rendered request references.

read(ref: ArtifactRef): Promise<Result<Uint8Array>>
refArtifactRefrequired

An artifact ref named in the rendered request (an image, a document or an earlier reasoning block).

Returns an error value with one of these codes: artifact_missing, artifact_corrupt.

put

Stores exact provider bytes (reasoning, hosted tool blocks) and returns their ref once durable, so a part may name it.

put(data: Uint8Array, mediaType: string): Promise<ArtifactRef>
dataUint8Arrayrequired

The exact bytes the provider returned, stored unchanged.

mediaType / media_typestringrequired

The MIME type of data, for example application/json or image/png.

Edit on GitHub

On this page