export type RawHttpRequestDump = { provider: string; api: string; model: string; method?: string; url?: string; headers?: Record; body?: unknown; }; export type CapturedHttpErrorResponse = { status: number; headers?: Headers; bodyText?: string; bodyJson?: unknown; }; export declare function appendRawHttpRequestDumpFor400(message: string, error: unknown, dump: RawHttpRequestDump | undefined): Promise; export declare function finalizeErrorMessage(error: unknown, rawRequestDump: RawHttpRequestDump | undefined, capturedErrorResponse?: CapturedHttpErrorResponse): Promise; /** * Rewrite error message for GitHub Copilot request failures. * Must run AFTER finalizeErrorMessage since it replaces the message entirely. * * 400 `model_not_supported` = Copilot routing rollout gap for our OAuth client. * A preview model (gpt-5.3-codex, gpt-5.4*, ...) flaps between 200 and * 400 because only some of Copilot's backends have the model. After the * in-request retry exhausts, surface guidance rather than the raw error. * 401 = token invalid/expired → credential removal is safe, prompt re-login. * 403 = token valid but access denied (plan, model policy, org restriction) → * do NOT reuse the auth-failed string (which triggers credential removal). */ export declare function rewriteCopilotError(errorMessage: string, error: unknown, provider: string): string;