@oh-my-pi/pi-ai 12.17.2 → 12.18.1

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,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-ai",
4
- "version": "12.17.2",
4
+ "version": "12.18.1",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Bölük",
@@ -44,7 +44,7 @@
44
44
  "@connectrpc/connect-node": "^2.1.1",
45
45
  "@google/genai": "^1.41.0",
46
46
  "@mistralai/mistralai": "^1.14.0",
47
- "@oh-my-pi/pi-utils": "12.17.2",
47
+ "@oh-my-pi/pi-utils": "12.18.1",
48
48
  "@sinclair/typebox": "^0.34.48",
49
49
  "@smithy/node-http-handler": "^4.4.10",
50
50
  "ajv": "^8.18.0",
@@ -8,20 +8,11 @@ import type {
8
8
  UsageWindow,
9
9
  } from "../usage";
10
10
  import { refreshGoogleCloudToken } from "../utils/oauth/google-gemini-cli";
11
+ import { getGeminiCliHeaders } from "./google-gemini-cli";
11
12
 
12
13
  const DEFAULT_ENDPOINT = "https://cloudcode-pa.googleapis.com";
13
14
  const CACHE_TTL_MS = 60_000;
14
15
 
15
- const GEMINI_CLI_HEADERS = {
16
- "User-Agent": "google-cloud-sdk vscode_cloudshelleditor/0.1",
17
- "X-Goog-Api-Client": "gl-node/22.17.0",
18
- "Client-Metadata": JSON.stringify({
19
- ideType: "IDE_UNSPECIFIED",
20
- platform: "PLATFORM_UNSPECIFIED",
21
- pluginType: "GEMINI",
22
- }),
23
- };
24
-
25
16
  const GEMINI_TIER_MAP: Array<{ tier: string; models: string[] }> = [
26
17
  {
27
18
  tier: "3-Flash",
@@ -140,7 +131,7 @@ async function loadCodeAssist(
140
131
  headers: {
141
132
  Authorization: `Bearer ${accessToken}`,
142
133
  "Content-Type": "application/json",
143
- ...GEMINI_CLI_HEADERS,
134
+ ...getGeminiCliHeaders(),
144
135
  },
145
136
  body: JSON.stringify({
146
137
  ...(projectId ? { cloudaicompanionProject: projectId } : {}),
@@ -177,7 +168,7 @@ async function fetchQuota(
177
168
  headers: {
178
169
  Authorization: `Bearer ${accessToken}`,
179
170
  "Content-Type": "application/json",
180
- ...GEMINI_CLI_HEADERS,
171
+ ...getGeminiCliHeaders(),
181
172
  },
182
173
  body: JSON.stringify(projectId ? { project: projectId } : {}),
183
174
  signal: params.signal,
@@ -58,35 +58,55 @@ export interface GoogleGeminiCliOptions extends StreamOptions {
58
58
  const DEFAULT_ENDPOINT = "https://cloudcode-pa.googleapis.com";
59
59
  const ANTIGRAVITY_DAILY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
60
60
  const ANTIGRAVITY_ENDPOINT_FALLBACKS = [ANTIGRAVITY_DAILY_ENDPOINT, DEFAULT_ENDPOINT] as const;
61
- // Headers for Gemini CLI (prod endpoint)
62
- const GEMINI_CLI_HEADERS = {
63
- "User-Agent": "google-cloud-sdk vscode_cloudshelleditor/0.1",
61
+
62
+ const GEMINI_CLI_USER_AGENT = process.env.PI_AI_GEMINI_CLI_USER_AGENT || "google-api-nodejs-client/9.15.1";
63
+
64
+ const ANTIGRAVITY_USER_AGENT = (() => {
65
+ const DEFAULT_ANTIGRAVITY_VERSION = "1.104.0";
66
+ const version = process.env.PI_AI_ANTIGRAVITY_VERSION || DEFAULT_ANTIGRAVITY_VERSION;
67
+ return `antigravity/${version} darwin/arm64`;
68
+ })();
69
+
70
+ const GEMINI_CLI_HEADERS = Object.freeze({
71
+ "User-Agent": GEMINI_CLI_USER_AGENT,
64
72
  "X-Goog-Api-Client": "gl-node/22.17.0",
73
+ "Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI",
74
+ });
75
+
76
+ // Antigravity auth headers (project discovery/onboarding) — matches CLIProxyAPI antigravity auth module.
77
+ // Same User-Agent as Gemini CLI, but different X-Goog-Api-Client.
78
+ const ANTIGRAVITY_AUTH_HEADERS = Object.freeze({
79
+ "User-Agent": GEMINI_CLI_USER_AGENT,
80
+ "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
65
81
  "Client-Metadata": JSON.stringify({
66
82
  ideType: "IDE_UNSPECIFIED",
67
83
  platform: "PLATFORM_UNSPECIFIED",
68
84
  pluginType: "GEMINI",
69
85
  }),
70
- };
86
+ });
71
87
 
72
- // Headers for Antigravity (sandbox endpoint) - requires specific User-Agent
73
- const DEFAULT_ANTIGRAVITY_VERSION = "1.18.3";
88
+ // Antigravity executor headers (streaming/generation) only User-Agent per CLIProxyAPI executor.
89
+ const ANTIGRAVITY_STREAMING_HEADERS = Object.freeze({
90
+ "User-Agent": ANTIGRAVITY_USER_AGENT,
91
+ });
74
92
 
75
- export function getAntigravityUserAgent() {
76
- const version = process.env.PI_AI_ANTIGRAVITY_VERSION || DEFAULT_ANTIGRAVITY_VERSION;
77
- return `antigravity/${version} darwin/arm64`;
93
+ // Headers for Gemini CLI (prod endpoint)
94
+ export function getGeminiCliHeaders() {
95
+ return GEMINI_CLI_HEADERS;
96
+ }
97
+ export function getGeminiCliUserAgent() {
98
+ return GEMINI_CLI_USER_AGENT;
78
99
  }
79
100
 
80
- function getAntigravityHeaders() {
81
- return {
82
- "User-Agent": getAntigravityUserAgent(),
83
- "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
84
- "Client-Metadata": JSON.stringify({
85
- ideType: "IDE_UNSPECIFIED",
86
- platform: "PLATFORM_UNSPECIFIED",
87
- pluginType: "GEMINI",
88
- }),
89
- };
101
+ // Headers for Antigravity (sandbox endpoint)
102
+ export function getAntigravityAuthHeaders() {
103
+ return ANTIGRAVITY_AUTH_HEADERS;
104
+ }
105
+ export function getAntigravityHeaders() {
106
+ return ANTIGRAVITY_STREAMING_HEADERS;
107
+ }
108
+ export function getAntigravityUserAgent() {
109
+ return ANTIGRAVITY_USER_AGENT;
90
110
  }
91
111
 
92
112
  // Antigravity system instruction (compact version from CLIProxyAPI).
@@ -2,6 +2,7 @@
2
2
  * Antigravity OAuth flow (Gemini 3, Claude, GPT-OSS via Google Cloud)
3
3
  * Uses different OAuth credentials than google-gemini-cli for access to additional models.
4
4
  */
5
+ import { getAntigravityAuthHeaders } from "../../providers/google-gemini-cli";
5
6
  import { OAuthCallbackFlow } from "./callback-server";
6
7
  import { generatePKCE } from "./pkce";
7
8
  import type { OAuthController, OAuthCredentials } from "./types";
@@ -36,13 +37,7 @@ async function discoverProject(accessToken: string, onProgress?: (message: strin
36
37
  const headers = {
37
38
  Authorization: `Bearer ${accessToken}`,
38
39
  "Content-Type": "application/json",
39
- "User-Agent": "google-api-nodejs-client/9.15.1",
40
- "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
41
- "Client-Metadata": JSON.stringify({
42
- ideType: "IDE_UNSPECIFIED",
43
- platform: "PLATFORM_UNSPECIFIED",
44
- pluginType: "GEMINI",
45
- }),
40
+ ...getAntigravityAuthHeaders(),
46
41
  };
47
42
 
48
43
  const endpoints = ["https://cloudcode-pa.googleapis.com", "https://daily-cloudcode-pa.sandbox.googleapis.com"];
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import { $env } from "@oh-my-pi/pi-utils";
7
+ import { getGeminiCliHeaders } from "../../providers/google-gemini-cli";
7
8
  import { OAuthCallbackFlow } from "./callback-server";
8
9
  import { generatePKCE } from "./pkce";
9
10
  import type { OAuthController, OAuthCredentials } from "./types";
@@ -98,8 +99,7 @@ async function discoverProject(accessToken: string, onProgress?: (message: strin
98
99
  const headers = {
99
100
  Authorization: `Bearer ${accessToken}`,
100
101
  "Content-Type": "application/json",
101
- "User-Agent": "google-api-nodejs-client/9.15.1",
102
- "X-Goog-Api-Client": "gl-node/22.17.0",
102
+ ...getGeminiCliHeaders(),
103
103
  };
104
104
 
105
105
  onProgress?.("Checking for existing Cloud Code Assist project...");