* Parser state for incremental JSON Array parsing. * * Accumulates raw text from the LLM stream. Once the opening `[` is found, * uses `partial-json` to incrementally parse the growing array. Emits new * complete items as they appear, and streams partial text content deltas * for the last (pote
| 40 | * for the last (potentially incomplete) text item. |
| 41 | */ |
| 42 | interface ParserState { |
| 43 | /** Accumulated raw text from the LLM */ |
| 44 | buffer: string; |
| 45 | /** Whether we've found the opening `[` */ |
| 46 | jsonStarted: boolean; |
| 47 | /** Number of fully processed (emitted) items */ |
| 48 | lastParsedItemCount: number; |
| 49 | /** Length of text content already emitted for the trailing partial text item */ |
| 50 | lastPartialTextLength: number; |
| 51 | /** Whether parsing is complete (closing `]` found) */ |
| 52 | isDone: boolean; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Create initial parser state |
nothing calls this directly
no outgoing calls
no test coverage detected