import type { AccountIdentity, AccountUsage, ResolvedAccount } from "./accounts.js"; export interface AccountReport { /** The CLI answered (false: not installed, timed out, an older version without the protocol). */ ok: boolean; loggedIn: boolean; /** A login that existed and ran out. */ expired?: boolean; method?: "subscription" | "api_key" | "other"; identity?: AccountIdentity; usage?: AccountUsage; /** A usage window is full: runs fail until it resets. */ limited?: { until?: string; reason: string; }; error?: string; } /** `initialize`'s `account`: `{email, subscriptionType, tokenSource, apiKeySource, apiProvider, organization}`. */ export declare function parseClaudeAccount(account: unknown): Pick & { identity: Omit; }; /** `get_usage`: `{subscription_type, rate_limits_available, rate_limits: {five_hour, seven_day, model_scoped[], spend}, extra_usage}`. */ export declare function parseClaudeUsage(response: unknown): { usage?: Omit; plan?: string; }; /** `get_status`: sections of `{label, value}` rows; `Login: Expired — log in again` marks an expired login. */ export declare function parseClaudeStatus(response: unknown): { expired: boolean; email?: string; org?: string; }; /** A full window (≥ 100 %) means the account is limited until that window resets. */ export declare function limitFromUsage(usage: Pick | undefined): AccountReport["limited"]; export interface ProbeAccountOptions { command: string | string[]; env: Record; timeoutMs?: number; } export interface LineSession { send(message: unknown): void; end(): void; } /** * Starts the CLI and feeds it JSON lines: `onMessage` sees every JSON line it prints and returns true once it has * what it wants. Resolves with the reason the conversation ended; never throws. */ export declare function converse(command: string, args: string[], env: Record, timeoutMs: number, start: (session: LineSession) => void, onMessage: (message: Record, session: LineSession) => boolean): Promise<{ done: boolean; error?: string; stderr: string; }>; export declare function probeClaudeAccount(options: ProbeAccountOptions): Promise; /** `account/read`: `{account: {type: chatgpt|apiKey|amazonBedrock, email, planType} | null, requiresOpenaiAuth}`. */ export declare function parseCodexAccount(result: unknown): Pick & { identity: Omit; }; /** `account/rateLimits/read`: `rateLimitsByLimitId.codex` (else `rateLimits`) with `primary` / `secondary` windows, `credits`, `rateLimitReachedType`. */ export declare function parseCodexRateLimits(result: unknown): { usage?: Omit; reached?: string; }; export declare function probeCodexAccount(options: ProbeAccountOptions): Promise; /** The account's own report, from its CLI, with the account's environment. */ export declare function probeAccount(account: Pick, options: ProbeAccountOptions): Promise;