/** * Structured JSON output extraction from flow responses. * * Parses a JSON code block from the end of the flow's final assistant text * and validates it against the FlowStructuredOutput schema. */ import type { Message } from "@earendil-works/pi-ai"; import type { CommandEntry, FlowStructuredOutput } from "../types/output.js"; /** * Extract a structured JSON output block from the end of an assistant's text. * * Looks for a final ```json ... ``` code block, parses it, and validates * against the FlowStructuredOutput schema. Returns undefined when the block * is missing, malformed, or fails validation. */ export declare function extractStructuredOutput(text: string): FlowStructuredOutput | undefined; /** * Walk the message history and mechanically generate a commands array * from all bash tool calls (standalone, batch-nested, and batch_bash_poll). * * This replaces the old enrichStructuredOutputCommands approach which relied * on the LLM generating a paraphrased commands array that was then replaced * with verbatim versions. Now commands are generated purely from tool call * history — no LLM involvement required. * * Deduplication strategy: * - Batch-nested bash ops that completed within the batch call are emitted * immediately with their timing. * - Batch-nested bash ops that were still pending when the batch returned * (no timing available) are deferred to batch_bash_poll. * - batch_bash_poll only emits entries for IDs that were deferred AND have * completed (with timing). Still-pending poll results are skipped. * - Once an ID is emitted (from batch or poll), subsequent encounters skip it. */ export declare function generateCommandsFromHistory(messages: Message[]): CommandEntry[]; //# sourceMappingURL=structured-output.d.ts.map