/** * Grounding read-set collector — the SDK-coupled half of the grounding gate. * ========================================================================== * * `grounding.ts` is deliberately pure and SDK-agnostic. This module is the thin * adapter that watches the live SDK message stream and turns data-read tool * activity (Read / Grep / Glob / the brainbotbeta MCP data tools) into the * `ReadSetItem[]` that the pure gate consumes. * * WHY A SEPARATE FILE: keeps the Anthropic SDK message-shape coupling out of the * pure, exhaustively-unit-tested core, and keeps `processClaudeMessage` readable — * the loop just calls `collectReadSetFromMessage(message, readSet)` once per turn. * * The collector is intentionally forgiving: SDK content-block shapes vary across * versions, so it defensively probes for tool_use/tool_result blocks and never * throws into the turn loop. A missed block only shrinks the read-set (at worst a * grounded claim looks ungrounded and gets annotated — never the reverse). */ import type { ReadSetItem } from './grounding.js'; /** Create the initial (empty) read-set. Kept as a fn for symmetry with the loop. */ export declare function collectReadSetInit(): ReadSetItem[]; /** * Inspect one SDK stream message and append any data-read results to `readSet`. * Handles the two-phase shape: an `assistant` message emits a `tool_use` block * (name + input + id); a later `user` message emits the matching `tool_result` * (tool_use_id + content). We remember the source label at tool_use time and * attach it to the text at tool_result time. */ export declare function collectReadSetFromMessage(message: unknown, readSet: ReadSetItem[]): void;