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

    Class StreamGrammar

    The stream grammar as a state machine over one provider stream.

    Not reusable across streams and not resettable: a grammar instance is one-to-one with a stream, so leftover state cannot leak between attempts.

    Index
    • get terminated(): boolean

      True once a terminal finish chunk arrived or the stream was aborted.

      Returns boolean

    • Record that the consumer abandoned the stream.

      Abort is a legitimate termination — it is how cancellation reaches this layer — so it settles the grammar rather than failing it. What it must not do is leave the grammar accepting: a chunk arriving after the consumer stopped listening is output nobody will ever sign.

      Returns void

    • Assert the stream reached a terminal finish chunk.

      Called when a consumer claims the stream completed normally. A provider that just stopped sending — a dropped connection read as an ending — must not be recorded as a clean completion.

      Returns void

    • Validate one chunk against the grammar and advance the state.

      Throws on the first violation. Nothing is folded, nothing is signed, and the caller's stream is dead: a stream that broke the contract once cannot be trusted to have told the truth about what came before.

      Parameters

      Returns void