/** * Gemini CLI UserInfo 辅助函数 * 对齐 CLIProxyAPI 的实现,为 Gemini CLI OAuth 流程添加 UserInfo 和 Projects 获取功能 */ import type { UnknownObject } from '../../modules/pipeline/types/common-types.js'; export interface GeminiCLIUserInfo { email?: string; name?: string; picture?: string; verified_email?: boolean; } export interface GeminiCLIProject { projectId: string; name?: string; } export interface GeminiCLITokenData extends UnknownObject { access_token: string; refresh_token?: string; token_type: string; expires_in?: number; scope?: string; expires_at?: number; expired?: string; email?: string; name?: string; picture?: string; projects?: GeminiCLIProject[]; project_id?: string; shared_credential?: boolean; } /** * 使用 access_token 调用 Google UserInfo 接口 * 等价于 CLIProxyAPI 的 fetchUserInfo */ export declare function fetchGeminiCLIUserInfo(accessToken: string): Promise; /** * 使用 access_token 获取 Google Projects 列表 * 等价于 CLIProxyAPI 的 listProjects */ export declare function fetchGeminiCLIProjects(accessToken: string): Promise; /** * 将 OAuth token 与 UserInfo 和 Projects 合并 * 等价于 CLIProxyAPI 的 mergeTokenData */ export declare function mergeGeminiCLITokenData(oauthToken: UnknownObject, userInfo: GeminiCLIUserInfo, projects: GeminiCLIProject[]): GeminiCLITokenData; /** * 获取默认 project_id */ export declare function getDefaultProjectId(token: UnknownObject): string | undefined; /** * 检查是否包含有效的 projects */ export declare function hasValidProjects(token: UnknownObject): boolean;