@justjoshn/pi-google-oauth-v2 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justjoshn/pi-google-oauth-v2",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Use a Google AI plan in Pi by signing in with your Google account, with no API key.",
5
5
  "keywords": [
6
6
  "pi-package"
package/src/auth.ts CHANGED
@@ -52,7 +52,7 @@ export function createGoogleOAuth(deps: GoogleOAuthDeps = {}): OAuthAuth {
52
52
  name: 'Google AI subscription',
53
53
  isSubscription: true,
54
54
  loginLabel: 'Sign in with your Google AI plan',
55
- login: (interaction) => login(interaction, fetchImpl, deps.env ?? ENV_SCHEMA.parse(process.env)),
55
+ login: (interaction) => login(interaction, fetchImpl, deps.env ?? ENV_SCHEMA.parse({ ...process.env })),
56
56
  refresh: (credential, signal) => refresh(credential, signal, fetchImpl),
57
57
  toAuth,
58
58
  };
@@ -66,7 +66,7 @@ export function parseStoredCredential(credential: OAuthCredential): GoogleCreden
66
66
  return { ...credential, projectId };
67
67
  }
68
68
 
69
- export function buildAuthUrl(input: { redirectUri: string; state: string; codeChallenge: string }): string {
69
+ function buildAuthUrl(input: { redirectUri: string; state: string; codeChallenge: string }): string {
70
70
  const params = new URLSearchParams({
71
71
  client_id: ANTIGRAVITY_CLIENT_ID,
72
72
  redirect_uri: input.redirectUri,
@@ -4,9 +4,9 @@ import { ANTIGRAVITY_USER_AGENT, CODE_ASSIST_BASE_URL } from './constants.ts';
4
4
 
5
5
  export class CodeAssistError extends Error {}
6
6
 
7
- export class IneligibleTierError extends CodeAssistError {}
7
+ class IneligibleTierError extends CodeAssistError {}
8
8
 
9
- export class ValidationRequiredError extends CodeAssistError {
9
+ class ValidationRequiredError extends CodeAssistError {
10
10
  constructor(reasonMessage: string, validationUrl: string) {
11
11
  super(`${reasonMessage} Validate at: ${validationUrl}`, { cause: validationUrl });
12
12
  }
@@ -16,7 +16,7 @@ export class ValidationRequiredError extends CodeAssistError {
16
16
  }
17
17
  }
18
18
 
19
- export class ProjectRequiredError extends CodeAssistError {}
19
+ class ProjectRequiredError extends CodeAssistError {}
20
20
 
21
21
  export interface ResolvedProject {
22
22
  projectId: string;
@@ -75,7 +75,7 @@ export function readProjectOverride(env: NodeJS.ProcessEnv): string | undefined
75
75
  return value;
76
76
  }
77
77
 
78
- export function codeAssistUrl(method: string): string {
78
+ function codeAssistUrl(method: string): string {
79
79
  return `${CODE_ASSIST_BASE_URL}:${method}`;
80
80
  }
81
81
 
package/src/constants.ts CHANGED
@@ -8,7 +8,7 @@ export const PRIVATE_PROJECT_HEADER = 'x-pi-google-oauth-v2-project';
8
8
  const OS_TYPES: Record<string, string> = { darwin: 'darwin', linux: 'linux', win32: 'windows' };
9
9
  const ARCHITECTURES: Record<string, string> = { arm64: 'arm64', x64: 'amd64' };
10
10
 
11
- export function antigravityUserAgent(platform: string = process.platform, arch: string = process.arch): string {
11
+ function antigravityUserAgent(platform: string = process.platform, arch: string = process.arch): string {
12
12
  return `antigravity/cli/1.5.9 (aidev_client; os_type=${OS_TYPES[platform] ?? platform}; arch=${ARCHITECTURES[arch] ?? arch}; cl=1021519450; auth_method=consumer)`;
13
13
  }
14
14
 
package/src/loopback.ts CHANGED
@@ -14,7 +14,7 @@ export class LoopbackExpiredError extends Error {}
14
14
  const LOOPBACK_TIMEOUT_MINUTES = 5;
15
15
  const SECONDS_PER_MINUTE = 60;
16
16
  const MS_PER_SECOND = 1000;
17
- export const LOOPBACK_TIMEOUT_MS = LOOPBACK_TIMEOUT_MINUTES * SECONDS_PER_MINUTE * MS_PER_SECOND;
17
+ const LOOPBACK_TIMEOUT_MS = LOOPBACK_TIMEOUT_MINUTES * SECONDS_PER_MINUTE * MS_PER_SECOND;
18
18
 
19
19
  const CALLBACK_PATH = '/oauth2callback';
20
20
  const ROOT_PATH = '/';
package/src/models.ts CHANGED
@@ -46,7 +46,7 @@ function thinkingLevelMap(variants: Variant[], reasoning: boolean): ThinkingLeve
46
46
  }
47
47
 
48
48
  /** One Pi model per base family. Its thinking levels map to Google's per-effort wire ids. */
49
- export function catalogModels(catalog: Catalog): CodeAssistModel[] {
49
+ function catalogModels(catalog: Catalog): CodeAssistModel[] {
50
50
  const shown = new Set((catalog.agentModelSorts ?? []).flatMap((sort) => (sort.groups ?? []).flatMap((group) => group.modelIds ?? [])));
51
51
  const entries = [...shown].flatMap((wireId): { base: string; variant: Variant }[] => {
52
52
  const info = catalog.models?.[wireId];