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

    Class BlockAssembler

    Incrementally folds one provider stream into blocks, usage and a finish reason. One instance per stream; not reusable and not resettable, so state cannot leak between attempts.

    Index
    • get finishReason(): FinishReason | null

      The terminal finish reason, or null when none has arrived.

      Deliberately NOT defaulted to {kind: "stop"} the way dsh defaults it. A stream that never said why it stopped did not stop successfully, and inventing a clean stop is how a dropped connection becomes a signed claim that the model finished.

      Returns FinishReason | null

    • Settle a stream the consumer abandoned — cancellation, timeout, or a crash on the consuming side.

      The partial state is preserved in full: every open block appears in the result with an outcome saying it was truncated or why it was dropped. This is P2.2's crash-recovery rule one level down. An interrupted turn is recorded as interrupted rather than as a shorter successful one, and an interrupted BLOCK gets the same treatment for the same reason.

      Parameters

      • cause: string

        short machine-stable reason, recorded on the assembly.

      Returns StreamAssembly

    • Settle a stream that reached its terminal finish chunk.

      Throws AMC_LLM_STREAM_NOT_TERMINATED when no finish chunk arrived — a provider that simply stopped sending must be aborted, not completed.

      Returns StreamAssembly

    • Feed one chunk, in stream order.

      Validates before folding. A grammar violation throws an LlmStreamProtocolError and leaves this assembler terminated, because a stream that broke the contract once cannot be trusted about what came before it.

      Parameters

      Returns void