/** * GitHub Copilot premium request usage fetcher. * * The plugin uses GitHub billing APIs for PAT-backed usage checks and * `GET /copilot_internal/user` for OAuth-backed personal quota checks. */ import type { AuthData, CopilotQuotaConfig, CopilotResult } from "./types.js"; type CopilotAuthKeyName = "github-copilot" | "copilot" | "copilot-chat" | "github-copilot-chat"; type CopilotPatTokenKind = "github_pat" | "ghp" | "ghu" | "ghs" | "other"; type EffectiveCopilotAuthSource = "pat" | "oauth" | "none"; type CopilotQuotaApi = "github_billing_api" | "copilot_internal_user" | "none"; type CopilotBillingMode = "user_quota" | "organization_usage" | "enterprise_usage" | "none"; type CopilotRemainingTotalsState = "available" | "not_available_from_org_usage" | "not_available_from_enterprise_usage" | "unavailable"; export type CopilotPatState = "absent" | "invalid" | "valid"; export interface CopilotPatReadResult { state: CopilotPatState; checkedPaths: string[]; selectedPath?: string; config?: CopilotQuotaConfig; error?: string; tokenKind?: CopilotPatTokenKind; } export interface CopilotQuotaAuthDiagnostics { pat: CopilotPatReadResult; oauth: { configured: boolean; keyName: CopilotAuthKeyName | null; hasRefreshToken: boolean; hasAccessToken: boolean; }; effectiveSource: EffectiveCopilotAuthSource; override: "pat_overrides_oauth" | "none"; quotaApi: CopilotQuotaApi; billingMode: CopilotBillingMode; billingScope: "user" | "organization" | "enterprise" | "none"; billingApiAccessLikely: boolean; remainingTotalsState: CopilotRemainingTotalsState; queryPeriod?: { year: number; month: number; }; usernameFilter?: string; billingTargetError?: string; tokenCompatibilityError?: string; } export declare function getCopilotPatConfigCandidatePaths(): string[]; export declare function readQuotaConfigWithMeta(): CopilotPatReadResult; export declare function getCopilotQuotaAuthDiagnostics(authData: AuthData | null): CopilotQuotaAuthDiagnostics; /** * Query GitHub Copilot premium request usage. * * PAT configuration wins over OpenCode OAuth auth when both are present. */ export declare function queryCopilotQuota(options?: { requestTimeoutMs?: number; }): Promise; export declare function hasCopilotQuotaRuntimeAvailable(): Promise; export declare function formatCopilotQuota(result: CopilotResult): string | null; export {}; //# sourceMappingURL=copilot.d.ts.map