import type { Command } from "commander"; import type { ResolvedCodexProfile } from "./profile.js"; export interface AccessTokenResult { accessToken: string; expiresAt?: number; } export type AccessTokenProvider = (context: { forceRefresh: boolean; }) => Promise; export interface StaticAccessTokenAuth { accessToken: string; } export interface ProviderAuth { tokenProvider: AccessTokenProvider; loginProvider?: () => Promise; isLoginRequired?: (error: unknown) => boolean; loginHint?: string; } export interface OidcAuthOptions { discoveryUrl?: string; issuerUrl?: string; clientId?: string; tenantId?: string; audience?: string; clientSecret?: string; scope?: string; redirectHost?: string; redirectPort?: number; redirectPath?: string; openBrowser?: boolean; tokenFile?: string; } export type CodexAuthOptions = StaticAccessTokenAuth | ProviderAuth | { oidc: OidcAuthOptions; }; export interface CodexConnectionOptions { serverUrl?: string; tenantId?: string; tenantHeaderName?: string; allowInsecureHttp?: boolean; requestTimeoutMs?: number; } export interface CodexPersistenceOptions { configDirectory?: string; settingsFile?: string; loadStoredConfig?: boolean; } export interface CodexBrandingOptions { packageName?: string; registryUrl?: string; cliName?: string; commandName?: string; appName?: string; } export interface CodexLauncherOptions { cliCommandName?: string; runCommandName?: string; appCommandName?: string; launchMode?: "direct" | "npx"; codexBinary?: string; binaryEnvNames?: string[]; bundledEnvNames?: string[]; wrapperPackage?: string; wrapperCommand?: string[]; managedMarker?: string; manifestFileName?: string; bundleId?: string; } export interface CodexDesktopAppStatus { platform: NodeJS.Platform; architecture?: string; supported: boolean; installed: boolean; path?: string; bundleId?: string; version?: string; build?: string; } export interface CodexDesktopAppOptions { inspect?: () => Promise; } export interface CodexDiagnosticsOptions { /** Emit credential-safe startup and stage metadata to stderr. */ safeStartup?: boolean; } export interface CodexV6CredentialLossPrompt { operation: "use" | "run" | "app"; interactive: boolean; } export interface CodexInteractionOptions { release?: import("./request-bound-device-v6-release.js").CodexReleaseInteraction; confirmV6CredentialReplacement?: (input: CodexV6CredentialLossPrompt) => Promise; } export interface CodexModuleOptions { profile?: ResolvedCodexProfile; profileUrl?: string; discoverProfile?: boolean; auth?: CodexAuthOptions; connection?: CodexConnectionOptions; persistence?: CodexPersistenceOptions; branding?: CodexBrandingOptions; launcher?: CodexLauncherOptions; desktopApp?: CodexDesktopAppOptions; diagnostics?: CodexDiagnosticsOptions; interactions?: CodexInteractionOptions; env?: NodeJS.ProcessEnv; fetch?: typeof fetch; output?: NodeJS.WritableStream; errorOutput?: NodeJS.WritableStream; onProfileWarning?: (message: string) => void; jsonEnabled?: (command: Command) => boolean | Promise; } export interface ResolvedCodexConfig { auth: CodexAuthOptions; connection: Required; persistence: Required; branding: Required; launcher: Required; profile?: ResolvedCodexProfile; } export interface CodexModule { readonly config: ResolvedCodexConfig; readonly client: import("./client.js").CodexServiceClient; readonly status: import("./console-status.js").CodexStatusLoader; registerCommands(program: Command, options?: { nested?: boolean; includeAuthCommands?: boolean; }): Command; getConsoleStatus(): Promise; resolveRuntime(args?: string[]): Promise; run(args?: string[], options?: { signal?: AbortSignal; }): Promise; app(workspace?: string, options?: { signal?: AbortSignal; }): Promise; }