/** * @fileoverview Output writer. * * Converts a {@link ToolExecutionResult} into human text, structured JSON, * NDJSON, or file output. Errors are routed to stderr with stable exit codes. * Color, spinners, and prompts are disabled in agent and --no-color modes. */ import { type ExecutionMode, type JsonSuccessOutput, type ToolExecutionResult } from '@textavia/core'; /** Configuration for a single write operation. */ export interface OutputContext { readonly toolId: string; readonly mode: ExecutionMode; readonly json: boolean; readonly quiet: boolean; readonly out?: string; readonly outDir?: string; readonly write: boolean; readonly dryRun: boolean; readonly backup: boolean; readonly sourceFile?: string; readonly inputType: string; readonly startedAt: number; readonly streams: { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream; }; } /** Result of writing a successful execution. */ export interface WriteResult { readonly exitCode: number; readonly writtenFiles: readonly string[]; } /** Additional per-item metadata for batch/NDJSON output. */ export interface JsonPayloadOptions { readonly durationMs: number; readonly writtenPaths?: readonly string[]; readonly inputPath?: string; } /** Writes a successful execution result and returns the success exit code. */ export declare function writeSuccess(result: ToolExecutionResult, context: OutputContext): Promise; /** Builds the stable JSON success payload without writing it. */ export declare function buildJsonSuccessPayload(result: ToolExecutionResult, context: Pick, options: JsonPayloadOptions): JsonSuccessOutput; /** Renders a result for human stdout without writing files. */ export declare function renderResultForHuman(result: ToolExecutionResult): string; /** Writes an error to stderr in the appropriate mode and returns the exit code. */ export declare function writeError(error: unknown, context: { mode: ExecutionMode; json: boolean; debug: boolean; stderr: NodeJS.WritableStream; }): number; /** Re-exported for callers that write a single file synchronously (e.g. QR SVG). */ export declare function writeBinarySync(path: string, bytes: Uint8Array): void; //# sourceMappingURL=output.d.ts.map