@nanocollective/nanocoder
Version:
A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter
44 lines • 1.86 kB
TypeScript
/**
* GitHub Copilot subscription auth: device OAuth flow and token refresh.
* Uses the same approach as opencode-copilot-auth for compatibility.
* @see https://github.com/anomalyco/opencode-copilot-auth
*
* CLIENT_ID: VS Code Copilot OAuth client (Iv1.b507a08c87ecfe98). External
* dependency; changing it may break device flow compatibility.
*/
/** Headers required by Copilot API; export for reuse in provider-factory. */
export declare const COPILOT_HEADERS: Record<string, string>;
export declare function getCopilotUrls(domain: string): {
deviceCodeUrl: string;
accessTokenUrl: string;
copilotTokenUrl: string;
};
export interface DeviceFlowResult {
verificationUri: string;
userCode: string;
deviceCode: string;
interval: number;
}
export interface CopilotTokenResult {
token: string;
expiresAt: number;
}
/**
* Clear the in-memory Copilot token cache so the next request fetches a new token.
* Use after credential change or logout so credentials can be invalidated without waiting for expiry.
*/
export declare function clearCopilotTokenCache(): void;
export declare function getCopilotAccessToken(githubOAuthToken: string, domain?: string, fetchFn?: typeof fetch): Promise<CopilotTokenResult>;
export declare function getCopilotBaseUrl(domain: string): string;
/**
* Run the full Copilot device-flow login: start flow, show code via callback, poll for token, save credential.
* Shared by CLI (cli.tsx) and in-chat UI (copilot-login.tsx) so the flow logic lives in one place.
*/
export declare function runCopilotLoginFlow(providerName: string, options: {
onShowCode: (verificationUri: string, userCode: string) => void;
onPollingStart?: () => void;
delayBeforePollMs?: number;
domain?: string;
fetchFn?: typeof fetch;
}): Promise<void>;
//# sourceMappingURL=github-copilot.d.ts.map