/** * Where a streamed JSON document currently ends: the containers still open, * and whether the text stops inside a string. * * The one scanner behind partial-JSON handling in the chat: the connector * closes the open containers to repair a tool's streaming input, and a tool * that renders while the input streams reads the same cursor to tell the * settled part of the document from the part still being written (repair * makes a half-written value look complete). */ export type JsonCursorFrame = { /** The property the container was opened under; `''` for the root and for array items. */ key: string; /** The last property name read inside this container, when it is an object. */ lastKey: string; isObject: boolean; /** * How many entries have started in this container so far: array items, or * object properties. Counts the entry under the cursor too. */ items: number; }; export type JsonCursor = { /** The open containers, outermost first: `frames[0]` is the root. */ frames: JsonCursorFrame[]; /** Whether the document ends inside an unterminated string literal. */ inString: boolean; /** When `inString`, whether that string is a property name rather than a value. */ isKey: boolean; /** When `inString`, whether the last character is a lone escaping backslash. */ isEscaped: boolean; }; export declare function getJsonCursor(rawJson: string): JsonCursor; /** * Whether the document ends inside the root property `key` — that property's * value is still being written (an open string, array, or object under it). */ export declare function endsInsideRootProperty(cursor: JsonCursor, key: string): boolean;