Agent Maturity Compass API - v1.2.0
    Preparing search index...

    Interface LlmAdapter

    One provider's wire format.

    id and version are recorded on every settlement row, so a stream that decoded strangely can be attributed to a specific adapter build rather than to "the LLM seam". version moves when the DECODING changes in a way that could alter the blocks a stream produces — it is the same discipline RequestEncoder.version applies to the send half.

    interface LlmAdapter {
        capabilities?: ProviderCapabilities;
        encoderId: string;
        encoderVersion: number;
        id: string;
        version: number;
        assertParams?(params: Record<string, unknown>): void;
        decode(response: HttpResponse): AsyncIterable<StreamChunk>;
        describeFailure?(input: AdapterFailureInput): AdapterFailureHint;
        envelope(input: AdapterEnvelopeInput): HttpRequest;
    }
    Index
    capabilities?: ProviderCapabilities

    Missing metadata is unknown, never an implicit support claim.

    encoderId: string

    The encoder whose output this adapter transmits.

    Declared rather than assumed so the runtime can REFUSE a route that pairs an Anthropic adapter with an OpenAI body. Sending a well-formed request of the wrong shape is a 400 that looks like a model problem, and the mismatch is cheap to catch at registration.

    encoderVersion: number
    id: string
    version: number
    • Refuse a request this adapter cannot carry, BEFORE anything durable exists.

      Optional, and deliberately a refusal rather than a fixer: an adapter that repaired params would produce bytes the caller did not ask for, and a request/header row would then commit to a request nobody wrote. Called by the runtime before the request is encoded or logged, so a refusal costs nothing durable.

      The case that motivates it: anthropic-messages@1 does not set stream itself, so a caller who omits it gets a plain JSON response that the streaming decoder can only report, sixty seconds later, as a connection that ended early. Refusing up front turns that into one clear sentence.

      Parameters

      • params: Record<string, unknown>

      Returns void

    • Decode one successful response into chunks.

      May throw: a malformed frame is a real failure and the runtime turns it into a typed terminal failure with a durable row. What it must NOT do is silently skip a frame it does not understand, because a silently skipped usage frame becomes a signed row claiming a step cost nothing.

      Parameters

      Returns AsyncIterable<StreamChunk>