Character-by-character state machine for parsing streamed JSON.

Expects JSON matching the cortex_output schema: { "response": "...", "code": "...", "thoughts": "..." }

Fires callbacks as content is extracted from response/thoughts fields. Batches response text and flushes on sentence-ending punctuation for TTS.

Constructors

Properties

Methods

Constructors

Properties

hasCode: boolean
hasResponse: boolean

Methods

  • Feed a chunk of streamed JSON text into the parser.

    Parameters

    • chunk: string

    Returns void

  • Finalize parsing and return accumulated field values.

    Returns JsonStreamParserResult