Skip to content

parseVisualBlocks

parseVisualBlocks(raw): VisualBlock[]

Defined in: src/visual-blocks.ts:578

Parse + validate LLM-emitted JSON into typed VisualBlock[]. Never throws. Drops malformed blocks and returns only valid ones ([] on non-array input). Enforces unique block ids (a later duplicate is dropped) — the renderer keys its {#each} by block.id, so a duplicate id would break the keyed-each. This is the trust boundary — be defensive, drop on any doubt.

unknown

VisualBlock[]