import type { Auth, Provider, Model } from "@opencode-ai/sdk"; /** * Plugin configuration from ~/.opencode/openai-codex-auth-config.json */ export interface PluginConfig { /** * Enable CODEX_MODE (Codex-OpenCode bridge prompt instead of tool remap) * @default true */ codexMode?: boolean; } /** * User configuration structure from opencode.json */ export interface UserConfig { global: ConfigOptions; models: { [modelName: string]: { options?: ConfigOptions; variants?: Record; [key: string]: unknown; }; }; } /** * Configuration options for reasoning and text settings */ export interface ConfigOptions { reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh"; reasoningSummary?: "auto" | "concise" | "detailed" | "off" | "on"; textVerbosity?: "low" | "medium" | "high"; include?: string[]; } /** * Reasoning configuration for requests */ export interface ReasoningConfig { effort: "none" | "minimal" | "low" | "medium" | "high" | "xhigh"; summary: "auto" | "concise" | "detailed" | "off" | "on"; } /** * OAuth server information */ export interface OAuthServerInfo { port: number; ready: boolean; close: () => void; waitForCode: (state: string) => Promise<{ code: string; } | null>; } /** * PKCE challenge and verifier */ export interface PKCEPair { challenge: string; verifier: string; } /** * Authorization flow result */ export interface AuthorizationFlow { pkce: PKCEPair; state: string; url: string; } /** * Token exchange success result */ export interface TokenSuccess { type: "success"; access: string; refresh: string; expires: number; } /** * Token exchange failure result */ export interface TokenFailure { type: "failed"; } /** * Token exchange result */ export type TokenResult = TokenSuccess | TokenFailure; /** * Parsed authorization input */ export interface ParsedAuthInput { code?: string; state?: string; } /** * JWT payload with ChatGPT account info */ export interface JWTPayload { "https://api.openai.com/auth"?: { chatgpt_account_id?: string; }; [key: string]: unknown; } /** * Message input item */ export interface InputItem { id?: string; type: string; role: string; content?: unknown; [key: string]: unknown; } /** * Request body structure */ export interface RequestBody { model: string; store?: boolean; stream?: boolean; instructions?: string; input?: InputItem[]; tools?: unknown; reasoning?: Partial; text?: { verbosity?: "low" | "medium" | "high"; }; include?: string[]; providerOptions?: { openai?: Partial & { store?: boolean; include?: string[]; }; [key: string]: unknown; }; /** Stable key to enable prompt-token caching on Codex backend */ prompt_cache_key?: string; max_output_tokens?: number; max_completion_tokens?: number; [key: string]: unknown; } /** * SSE event data structure */ export interface SSEEventData { type: string; response?: unknown; [key: string]: unknown; } /** * Cache metadata for Codex instructions */ export interface CacheMetadata { etag: string | null; tag: string; lastChecked: number; url: string; } /** * GitHub release data */ export interface GitHubRelease { tag_name: string; [key: string]: unknown; } /** * Rate limit state tracking reset times per account */ export interface RateLimitState { resetTime?: number; } /** * Stored account metadata */ export interface AccountMetadata { refreshToken: string; chatgptAccountId: string; email?: string; addedAt: number; lastUsed: number; lastSwitchReason?: "rate-limit" | "initial" | "rotation"; rateLimitResetTime?: number; } /** * Account storage structure (persisted to disk) */ export interface AccountStorage { version: 1; accounts: AccountMetadata[]; activeIndex: number; } /** * Managed account in memory with runtime state */ export interface ManagedAccount { index: number; refreshToken: string; chatgptAccountId: string; accessToken?: string; expiresAt?: number; rateLimitResetTime?: number; lastUsed: number; email?: string; lastSwitchReason?: "rate-limit" | "initial" | "rotation"; } /** * Multi-account refresh token format * Multiple accounts separated by || * Each account: refreshToken|chatgptAccountId */ export interface MultiAccountRefresh { accounts: Array<{ refreshToken: string; chatgptAccountId: string; }>; } /** * OAuth auth details with type guard */ export interface OAuthAuthDetails { type: "oauth"; access: string; refresh: string; expires: number; } export type { Auth, Provider, Model }; //# sourceMappingURL=types.d.ts.map