import { type AgentProvider, type AgentMessage, type ProviderRunOptions } from '@duckcodeailabs/dql-agent'; import { type CodexOAuthCredentials } from './oauth-store.js'; /** * ChatGPT Plus/Pro subscription login via OpenAI OAuth 2.0 + PKCE, and a provider * that drives the ChatGPT Codex backend with the resulting bearer token. * * Ported from the reference coding-extension flow. Tokens live in the `chmod 600` * `.dql/oauth-credentials.json` file. Same ToS caveat as the Claude flow: this * reuses the official Codex OAuth client id against a subscription; the provider * falls back to the CLI-passthrough path when not connected. */ export declare const CODEX_OAUTH_CONFIG: { readonly authorizationEndpoint: "https://auth.openai.com/oauth/authorize"; readonly tokenEndpoint: "https://auth.openai.com/oauth/token"; readonly clientId: "app_EMoamEEZ73f0CkXaXp7hrann"; readonly redirectUri: "http://localhost:1455/auth/callback"; readonly scopes: "openid profile email offline_access"; readonly callbackPort: 1455; }; export declare const CODEX_OAUTH_MODELS: readonly ["gpt-5.5", "gpt-5.4", "gpt-5.4-mini"]; export declare const CODEX_OAUTH_DEFAULT_MODEL = "gpt-5.5"; export declare function generateCodeVerifier(): string; export declare function generateCodeChallenge(verifier: string): string; export declare function generateState(): string; export declare function buildAuthorizationUrl(codeChallenge: string, state: string): string; export declare function extractAccountId(tokens: { id_token?: string; access_token: string; }): string | undefined; export declare function exchangeCodeForTokens(code: string, codeVerifier: string): Promise; export declare function refreshAccessToken(credentials: CodexOAuthCredentials): Promise; export declare function isTokenExpired(credentials: CodexOAuthCredentials): boolean; export declare class CodexOAuthManager { private readonly projectRoot; private pendingAuth; private refreshPromise; constructor(projectRoot: string); cancelAuthorizationFlow(): void; /** True while a login is in flight (callback server listening). */ isPending(): boolean; startAuthorizationFlow(): string; waitForCallback(): Promise; getAccessToken(): Promise; getAccountId(): string | null; getEmail(): string | null; isAuthenticated(): Promise; signOut(): void; } export declare function codexOAuthConnected(projectRoot: string): boolean; /** * AgentProvider that drives ChatGPT Codex via the subscription OAuth token. * Streams the Responses SSE and accumulates visible text (reasoning deltas are * dropped from the returned string). Requires a prior `Sign in with ChatGPT`. */ export declare class CodexOAuthProvider implements AgentProvider { readonly name: "openai"; private readonly manager; private readonly projectRoot; private readonly defaultModel; private readonly cliModel?; private readonly sessionId; private cliFallback?; constructor(opts: { projectRoot: string; model?: string; }); available(): Promise; generate(messages: AgentMessage[], options?: ProviderRunOptions): Promise; } //# sourceMappingURL=codex-oauth.d.ts.map