/** * Binary-output kit — write tool-generated bytes (images, maps, exports) to a * configurable directory instead of dumping megabytes of base64 into a tool * result. * * Consolidates the duplicated trio in gemini (`images.ts#resolveOutputDir` / * `uniquePath` / `writeImage`) and flightaware (`shared.ts#resolveOutputDir` / * `writePng`): per-call dir → `_OUTPUT_DIR` env → cwd, non-overwriting * filenames, extension derived from the MIME type. The fleet convention (see * the mcp-fleet-builder skill) is that every binary-output tool uses this shape. */ import { type EnvSource } from '../config/index.js'; /** * Resolve the directory a binary-output tool should write into: * the per-call argument → the named env var → the current working directory. * `~` and relative paths are expanded ({@link expandPath}) and the directory is * created recursively so the subsequent write can't ENOENT. */ export declare function resolveOutputDir(perCall: string | undefined, envVar: string, opts?: { env?: EnvSource; }): string; /** * A non-overwriting path for `base.ext` in `dir`: the bare name when free, * else `base-2.ext`, `base-3.ext`, … (gemini's numbering). `ext` is passed * without the dot. `base` is sanitized to a single path component * ({@link sanitizeBaseName}) so a `../…` stem can't write outside `dir`. */ export declare function uniquePath(dir: string, base: string, ext: string): string; /** Options for {@link writeBinaryOutput}. */ export interface WriteBinaryOutputOptions { /** Directory to write into (already resolved — see {@link resolveOutputDir}). */ dir: string; /** Filename stem (no extension). */ baseName: string; /** The bytes, base64-encoded (as returned by generation APIs). */ base64: string; /** MIME type used to derive the extension when `extension` is not given. */ mimeType?: string; /** Explicit extension (no dot); overrides the MIME lookup. */ extension?: string; } /** * Decode `base64` and write it to a **non-overwriting** file in `dir`, deriving * the extension from `extension` → the MIME type → `'bin'`. Returns the * absolute path written. The caller returns that path from the tool result * (with an `inline` flag for base64 via `imageResult` when the user asks). */ export declare function writeBinaryOutput(opts: WriteBinaryOutputOptions): string; /** * Magic-byte MIME sniff for the image formats the fleet passes around * (PNG / JPEG / WebP / GIF). Returns `undefined` for anything else — callers * decide their own default. Pairs with `readFileHead` for on-disk files; * consolidates gemini's `sniffMimeBytes` (and evite's dimension sniffer uses * the same signatures). */ export declare function sniffMimeBytes(bytes: Uint8Array): string | undefined; //# sourceMappingURL=output.d.ts.map