pub fn extract_items(
data: Option<&Value>,
text: &str,
) -> Result<Vec<ScatterItem>, String>Expand description
Extract typed items from structured data or text (GH #73 contract).
Structured .data wins and fans out TYPED: a JSON array yields one item per
element with the element’s real type (a record element subscripts as
${ITEM[k]} in the worker; number 1 and string "1" stay distinct). A
null element is a loud error — a worker silently running with a null
binding is corruption. A single non-array OBJECT is a loud error with a
select-the-array hint (one worker running on the {"jobs":[…]} envelope is
never what was meant); a single scalar is one item. Binary data is a loud
error.
Plain-text stdin is split on newlines only — one item per line, each a
string — matching the for-loop $(cmd) contract: trailing newlines trimmed
once, each line’s trailing \r stripped, whitespace within a line never
split. Blank lines are SKIPPED (panel-ratified: a worker spawned on "" is
silent corruption of the most common input shape). Empty input yields zero
items (the caller exits 0 with no rows).