import type { Result } from '../../domain/result.js'; import type { FileSystem } from '../ports/filesystem.js'; /** * Generic interceptor used by the global `--output-path` flag in `cli.ts`. * * Given a use-case's success value, if the user passed `--output-path * ` the CLI calls this helper to land the inlined bytes on disk * and rewrite the envelope so the LLM never sees a multi-MB base64 * string in stdout. * * Two recognized inline shapes — both produced by `inlineBinary` and * `office-to-markdown`: * * 1. `{ contentType, size, base64 }` — written via `fs.writeBytes`, * with `base64` replaced by `savedTo`. * 2. `{ contentType, size, text }` — written via `fs.writeText`, * with `text` replaced by `savedTo`. * * Anything else (plain JSON gets, error envelopes, etc.) returns * `no_inlined_bytes` so the CLI can surface a clear error rather than * silently no-op'ing. */ export type OutputPathError = { readonly type: 'no_inlined_bytes'; } | { readonly type: 'write_failed'; readonly message: string; } | { readonly type: 'empty_path'; } | { readonly type: 'is_directory'; } | { readonly type: 'passthrough_extension_mismatch'; readonly contentType: string; readonly requestedExtension: string; }; export declare const persistIfRequested: (fs: FileSystem, outputPath: string | undefined, data: unknown) => Promise>;