/** * Structured-output parsing for harnesses that emit JSON / NDJSON * (antigravity `--output-format json`, claude `stream-json`, gemini json, ...). * * The reply loops call parseHarnessOutput() on the raw stdout and get back the * plain-text reply. Defensive by design: when nothing structured is found the * raw text is returned unchanged, so plain-text harnesses (opencode, codex * exec) are never touched. * * formatHarnessEvent() is the live-streaming counterpart: it converts a single * NDJSON event line into a human-readable transcript line for the console/tee. */ /** Hard cap for any formatted transcript line (console/WS frames stay small). */ export declare const MAX_FORMATTED_CHARS = 1200; /** * Parse a harness NDJSON event line into a human-readable transcript line. * * Contract: * - `string` → emit this transcript line (already capped). * - `''` → skip the line entirely (noisy event, nothing to show). * - `null` → not a JSON event; pass the RAW line through (plain-text * harnesses like aider/codex-exec must stream untouched). * * NEVER returns a raw JSON event: every parseable object gets a compact * summary (or a salvaged text part). The old implementation returned null * for unrecognized/huge events, and callers did `formatted ?? line` - that * is how 64KB+ NDJSON fragments (split across pipe chunks) flooded the * console and broke streaming (see gotchas.md). * * Supports: opencode, claude, cursor, cline, gemini/antigravity, goose, * copilot, openhands - all harnesses that emit `--output-format json`, * `--format json`, or (cline) `--json`. */ export declare function formatHarnessEvent(raw: string): string | null; /** * Best-effort extraction of the plain-text reply from structured stdout. * Returns null when nothing structured was found (caller keeps raw text). */ export declare function tryExtractStructuredReply(raw: string): string | null; /** * Extract the plain-text reply for a harness. `structured` mirrors the * adapter's `structuredOutput` flag; plain-text harnesses pass through. */ export declare function parseHarnessOutput(structured: boolean, raw: string): string;