export interface IOpenAiChatGptTokenInfo { email?: string; chatgptPlanType?: string; chatgptUserId?: string; chatgptAccountId?: string; chatgptAccountIsFedramp: boolean; expiresAt?: string; rawJwt: string; } export interface IOpenAiChatGptAuthCredentials { accessToken: string; refreshToken?: string; idToken?: string; accountId?: string; /** Verified from the current access token when tokenInfo is not supplied. */ isFedrampAccount?: boolean; tokenInfo?: IOpenAiChatGptTokenInfo; originator?: string; } export interface IOpenAiChatGptAccessIdentity { /** Exact workspace claim expected on every resolved access token. */ readonly accountId: string | undefined; /** Exact residency claim expected on every resolved access token. */ readonly isFedrampAccount: boolean; } export interface IOpenAiChatGptAccessRequest { /** The provider request signal. A resolver should pass it through to its authority. */ readonly signal: AbortSignal; } /** Access-only result. Refresh and ID tokens are not part of the request-time contract. */ export interface IOpenAiChatGptResolvedAccess { readonly accessToken: string; } export interface IOpenAiChatGptDynamicModelConnectionOptions { /** Pins the account and residency boundary for the lifetime of the connection. */ readonly expectedIdentity: IOpenAiChatGptAccessIdentity; /** Stable provider originator header. Defaults to `smartai`. */ readonly originator?: string; /** Resolves current access immediately before every provider network request. */ readonly resolveAccess: (request: IOpenAiChatGptAccessRequest) => Promise; /** Optional underlying transport. Defaults to the current global fetch. */ readonly fetch?: typeof fetch; } export interface IOpenAiChatGptTokenData extends IOpenAiChatGptAuthCredentials { refreshToken: string; tokenInfo: IOpenAiChatGptTokenInfo; } export interface IOpenAiChatGptDeviceCode { verificationUrl: string; userCode: string; deviceAuthId: string; intervalSeconds: number; } export interface IOpenAiChatGptAuthOptions { fetch?: typeof fetch; /** Abort network requests and device-code polling. */ signal?: AbortSignal; /** Omit provider response bodies and enforce strict response/token bounds. Defaults to true. */ safeErrors?: boolean; } /** A failed refresh is replayable only when no request was handed to fetch. */ export type { TOpenAiChatGptRequestOutcome } from './plugins.js'; export interface IOpenAiChatGptBrowserAuthorizationOptions extends IOpenAiChatGptAuthOptions { redirectUri: string; originator?: string; allowedWorkspaceIds?: string[]; } export interface IOpenAiChatGptBrowserAuthorization { authUrl: string; state: string; codeVerifier: string; redirectUri: string; } export interface IOpenAiChatGptBrowserCallbackOptions { expectedState: string; expectedRedirectUri: string; } export interface IOpenAiChatGptBrowserCallbackSuccess { authorizationCode: string; } export interface IOpenAiChatGptBrowserCallbackDenied { providerError: string; } export type TOpenAiChatGptBrowserCallback = IOpenAiChatGptBrowserCallbackSuccess | IOpenAiChatGptBrowserCallbackDenied; export interface IOpenAiChatGptBrowserExchangeOptions extends IOpenAiChatGptAuthOptions { redirectUri: string; codeVerifier: string; } export type TOpenAiChatGptTokenTypeHint = 'refresh_token' | 'access_token'; export interface IOpenAiChatGptRevokeOptions extends IOpenAiChatGptAuthOptions { tokenTypeHint: TOpenAiChatGptTokenTypeHint; } export interface IOpenAiChatGptDeviceCodePollOptions extends IOpenAiChatGptAuthOptions { timeoutMs?: number; sleep?: (ms: number) => Promise; } export interface IOpenAiChatGptCompleteDeviceCodeOptions extends IOpenAiChatGptDeviceCodePollOptions { forcedChatGptWorkspaceId?: string; }