createParseTreeStore
Create a ParseTreeStore — feeds streamed JSON chunks through a partial-JSON parser and exposes the progressively-materialized spec and per-element accumulation state as signals, so a generative-UI surface can render while the spec is still arriving.
import { createParseTreeStore } from '@threadplane/chat';Declaration · overload 1
export declare function createParseTreeStore(parser: PartialJsonParser): ParseTreeStore;Parameters
parser· requiredPartialJsonParserThe partial-JSON parser used to incrementally materialize chunks.
Returns
ParseTreeStoreA ParseTreeStore; call push(chunk) as bytes stream in.
Examples
const store = createParseTreeStore(parser);
store.push('{"type":"Car');
store.spec(); // best-effort Spec | null