/** * Anthropic OAuth flow (Anthropic model Pro/Max) */ import { OAuthCallbackFlow } from "./callback-server"; import type { OAuthController, OAuthCredentials } from "./types"; /** * Redirect target for the paste-a-code login. Anthropic renders the * authorization code on this page instead of redirecting into this machine, so * a gjc running over SSH, in a container, or on a headless box can be paired * from a browser that has no route back to `localhost:54545`. * * Deliberately a hard-coded constant rather than an env/config override: this * is where the authorization code is delivered, so making it injectable would * turn any writable environment into an auth-code exfiltration channel. */ export declare const ANTHROPIC_MANUAL_REDIRECT_URI = "https://platform.claude.com/oauth/code/callback"; export interface AnthropicOAuthFlowOptions { /** * Pair by pasting the code Anthropic displays instead of waiting on a local * `localhost:54545` callback. Use when the browser completing the login has * no network route back to the machine running gjc. */ manualCode?: boolean; } export declare class AnthropicOAuthFlow extends OAuthCallbackFlow { #private; constructor(ctrl: OAuthController, options?: AnthropicOAuthFlowOptions); generateAuthUrl(state: string, redirectUri: string): Promise<{ url: string; instructions?: string; }>; exchangeToken(code: string, state: string, redirectUri: string): Promise; } /** * Login with Anthropic OAuth */ export declare function loginAnthropic(ctrl: OAuthController, options?: AnthropicOAuthFlowOptions): Promise; /** * Refresh Anthropic OAuth token */ export declare function refreshAnthropicToken(refreshToken: string): Promise;