UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

32 lines • 1.76 kB
export declare const GENERATED_IMAGE_DIRECTORY = "generated-images"; export type OutputFormat = "png" | "jpeg" | "webp"; export type TargetPaths = { ok: true; paths: string[]; } | { ok: false; error: string; }; /** * Reduces a provider-supplied identifier to a safe file stem: path separators and * any other unexpected character collapse to `_`, the result is length-capped, and * an identifier that sanitizes to nothing falls back to `image`. */ export declare function sanitizeImageStem(identifier: string): string; /** * Resolves the absolute destination paths for a generation call. * * A relative output_path resolves against the working directory. An omitted path * falls back to generated-images/<sanitized tool call id> with the format's * extension. An extensionless path gains that extension; an extension that does * not belong to the format is rejected (.jpg and .jpeg both serve jpeg). With more * than one image a zero-padded index is inserted before the extension. */ export declare function resolveTargets(cwd: string, toolCallId: string, count: number, outputPath: string | undefined, outputFormat?: OutputFormat): TargetPaths; /** The output format a returned MIME type denotes, or undefined for anything outside the supported three. */ export declare function outputFormatOf(mimeType: string): OutputFormat | undefined; /** Swaps a target's extension so the file name matches the bytes a provider actually returned. */ export declare function withFormatExtension(path: string, outputFormat: OutputFormat): string; /** Prefers a path relative to the working directory, falling back to absolute. */ export declare function displayPath(cwd: string, absolute: string): string; //# sourceMappingURL=paths.d.ts.map