Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Generate images via OpenAI, Google, OpenRouter, DashScope, Jimeng, Seedream, and Replicate APIs with batch support.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/codex-imagegen/types.ts
1export interface CliOptions {2prompt: string;3promptFile: string | null;4outputPath: string;5aspect: string;6refImages: string[];7timeoutMs: number;8retries: number;9retryDelayMs: number;10cacheDir: string | null;11logFile: string | null;12verbose: boolean;13}1415export interface ToolCall {16id: string;17tool: string;18status: string;19command?: string;20}2122export interface TokenUsage {23input: number;24cached_input: number;25output: number;26reasoning: number;27}2829export interface CodexRunResult {30threadId: string | null;31toolCalls: ToolCall[];32agentMessage: string | null;33usage: TokenUsage | null;34rawLogPath: string;35durationMs: number;36}3738export interface GenerateResult {39status: "ok" | "error";40path: string;41bytes: number;42elapsed_seconds: number;43thread_id: string | null;44attempts: number;45cached: boolean;46usage: TokenUsage | null;47tool_calls: { tool: string; status: string }[];48error?: string;49error_kind?: ErrorKind;50}5152export type ErrorKind =53| "codex_not_installed"54| "invalid_args"55| "prompt_file_missing"56| "spawn_failed"57| "timeout"58| "no_image_gen_tool_use"59| "output_missing"60| "invalid_png"61| "agent_refused"62| "lock_busy";6364export const RETRYABLE: ReadonlySet<ErrorKind> = new Set([65"spawn_failed",66"timeout",67"no_image_gen_tool_use",68"output_missing",69"invalid_png",70"agent_refused",71]);7273export class GenError extends Error {74attempts?: number;75constructor(public kind: ErrorKind, message: string, public retryable?: boolean) {76super(message);77this.retryable = retryable ?? RETRYABLE.has(kind);78}79}80