/** * Billing-mode probe: which auth a headless adapter child will actually use. * * The engine never handles credentials — children are plain adapter CLIs and * authenticate however that CLI does. But the CLIs prefer an exported API key * over a stored (subscription) login when both are present, and that override * is almost always an accident: a sourced .env or a leftover export silently * moves the run from subsidized subscription billing to per-token API billing. * This probe classifies the state per adapter so the engine can refuse the * silent-override case (see decision 0015 addendum) while leaving deliberate * key-only hosts (CI boxes with no login) working. * * Detection is a heuristic over well-known credential locations; when a * location can't prove presence or absence (e.g. Claude Code stores its OAuth * token in the macOS keychain, not a file), the state is "unknown" and the * engine never hard-fails on it — the adapter CLI itself is the final * authority and will error loudly if truly unauthenticated. */ import type { AdapterName } from "./types.js"; /** The env var each adapter CLI reads as an API key (preferred over a stored * login when set). Shared with the child-env builder's subscription-only * scrub. */ export declare const API_KEY_VARS: Record; export type LoginState = "present" | "absent" | "unknown"; export type BillingMode = /** No API key exported; the child rides the stored (subscription) login. */ "subscription" /** API key present, no stored login detected: a deliberate key-only host. */ | "api-key" /** API key present AND a stored login exists: the key silently overrides * subsidized auth. The engine refuses this unless explicitly allowed. */ | "api-key-override"; export interface BillingProbe { adapter: AdapterName; /** The env var checked (from API_KEY_VARS), or a note when the key was * found in a credential file instead of the environment. */ apiKeySource: string | null; apiKeyPresent: boolean; login: LoginState; mode: BillingMode; } export interface ProbeIo { env?: NodeJS.ProcessEnv; home?: string; } export type BillingProber = (adapter: AdapterName) => BillingProbe; export declare function probeBilling(adapter: AdapterName, io?: ProbeIo): BillingProbe; //# sourceMappingURL=billing.d.ts.map