antigravity-claude-proxy 2.8.4 → 2.8.5

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/README.md CHANGED
@@ -183,9 +183,9 @@ Add this configuration:
183
183
  "ANTHROPIC_BASE_URL": "http://localhost:8080",
184
184
  "ANTHROPIC_MODEL": "claude-opus-4-6-thinking",
185
185
  "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6-thinking",
186
- "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6-thinking",
186
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
187
187
  "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-4-6",
188
- "CLAUDE_CODE_SUBAGENT_MODEL": "claude-sonnet-4-6-thinking",
188
+ "CLAUDE_CODE_SUBAGENT_MODEL": "claude-sonnet-4-6",
189
189
  "ENABLE_EXPERIMENTAL_MCP_CLI": "true"
190
190
  }
191
191
  }
@@ -198,11 +198,11 @@ Or to use Gemini models:
198
198
  "env": {
199
199
  "ANTHROPIC_AUTH_TOKEN": "test",
200
200
  "ANTHROPIC_BASE_URL": "http://localhost:8080",
201
- "ANTHROPIC_MODEL": "gemini-3.1-pro-high[1m]",
202
- "ANTHROPIC_DEFAULT_OPUS_MODEL": "gemini-3.1-pro-high[1m]",
203
- "ANTHROPIC_DEFAULT_SONNET_MODEL": "gemini-3-flash[1m]",
204
- "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3-flash[1m]",
205
- "CLAUDE_CODE_SUBAGENT_MODEL": "gemini-3-flash[1m]",
201
+ "ANTHROPIC_MODEL": "gemini-3.1-pro-low",
202
+ "ANTHROPIC_DEFAULT_OPUS_MODEL": "gemini-3.1-pro-low",
203
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "gemini-3.5-flash-low",
204
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3.5-flash-low",
205
+ "CLAUDE_CODE_SUBAGENT_MODEL": "gemini-3.5-flash-low",
206
206
  "ENABLE_EXPERIMENTAL_MCP_CLI": "true"
207
207
  }
208
208
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antigravity-claude-proxy",
3
- "version": "2.8.4",
3
+ "version": "2.8.5",
4
4
  "description": "Proxy server to use Antigravity's Claude models with Claude Code CLI",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -436,11 +436,11 @@ document.addEventListener('alpine:init', () => {
436
436
  _generatePlaceholderData() {
437
437
  const models = [
438
438
  'claude-opus-4-6-thinking',
439
- 'claude-sonnet-4-6-thinking',
440
439
  'claude-sonnet-4-6',
441
440
  'gemini-3.1-pro-high',
442
441
  'gemini-3.1-pro-low',
443
- 'gemini-3-flash'
442
+ 'gemini-3-flash',
443
+ 'gemini-3.1-flash-lite'
444
444
  ];
445
445
 
446
446
  const tiers = ['ultra', 'pro', 'pro', 'free'];
package/src/constants.js CHANGED
@@ -6,7 +6,7 @@
6
6
  import { homedir, platform, arch } from 'os';
7
7
  import { join } from 'path';
8
8
  import { config } from './config.js';
9
- import { generateSmartUserAgent } from './utils/version-detector.js';
9
+ import { generateSmartUserAgent, getClientVersion } from './utils/version-detector.js';
10
10
 
11
11
  /**
12
12
  * Get the Antigravity database path based on the current platform.
@@ -104,7 +104,7 @@ export const ANTIGRAVITY_HEADERS = {
104
104
  'User-Agent': getPlatformUserAgent(),
105
105
  'Content-Type': 'application/json',
106
106
  'X-Client-Name': 'antigravity',
107
- 'X-Client-Version': '1.107.0', // Match product.json version
107
+ 'X-Client-Version': getClientVersion(),
108
108
  'x-goog-api-client': 'gl-node/18.18.2 fire/0.8.6 grpc/1.10.x' // Simulate Google Node.js client environment
109
109
  };
110
110
 
@@ -279,16 +279,15 @@ export const ANTIGRAVITY_SYSTEM_INSTRUCTION = `You are Antigravity, a powerful a
279
279
  export const MODEL_FALLBACK_MAP = {
280
280
  'gemini-3.1-pro-high': 'claude-opus-4-6-thinking',
281
281
  'gemini-3.1-pro-low': 'claude-sonnet-4-6',
282
- 'gemini-3-flash': 'claude-sonnet-4-6-thinking',
282
+ 'gemini-3-flash': 'claude-sonnet-4-6',
283
283
  'claude-opus-4-6-thinking': 'gemini-3.1-pro-high',
284
- 'claude-sonnet-4-6-thinking': 'gemini-3-flash',
285
284
  'claude-sonnet-4-6': 'gemini-3-flash'
286
285
  };
287
286
 
288
287
  // Default test models for each family (used by test suite)
289
288
  export const TEST_MODELS = {
290
- claude: 'claude-sonnet-4-6-thinking',
291
- gemini: 'gemini-3-flash'
289
+ claude: 'claude-sonnet-4-6',
290
+ gemini: 'gemini-3.5-flash-low'
292
291
  };
293
292
 
294
293
  // Default Claude CLI presets (used by WebUI settings)
@@ -300,9 +299,9 @@ export const DEFAULT_PRESETS = [
300
299
  ANTHROPIC_BASE_URL: 'http://localhost:8080',
301
300
  ANTHROPIC_MODEL: 'claude-opus-4-6-thinking',
302
301
  ANTHROPIC_DEFAULT_OPUS_MODEL: 'claude-opus-4-6-thinking',
303
- ANTHROPIC_DEFAULT_SONNET_MODEL: 'claude-sonnet-4-6-thinking',
302
+ ANTHROPIC_DEFAULT_SONNET_MODEL: 'claude-sonnet-4-6',
304
303
  ANTHROPIC_DEFAULT_HAIKU_MODEL: 'claude-sonnet-4-6',
305
- CLAUDE_CODE_SUBAGENT_MODEL: 'claude-sonnet-4-6-thinking',
304
+ CLAUDE_CODE_SUBAGENT_MODEL: 'claude-sonnet-4-6',
306
305
  ENABLE_EXPERIMENTAL_MCP_CLI: 'true'
307
306
  }
308
307
  },
@@ -311,11 +310,11 @@ export const DEFAULT_PRESETS = [
311
310
  config: {
312
311
  ANTHROPIC_AUTH_TOKEN: 'test',
313
312
  ANTHROPIC_BASE_URL: 'http://localhost:8080',
314
- ANTHROPIC_MODEL: 'gemini-3.1-pro-high',
315
- ANTHROPIC_DEFAULT_OPUS_MODEL: 'gemini-3.1-pro-high',
316
- ANTHROPIC_DEFAULT_SONNET_MODEL: 'gemini-3.1-flash',
317
- ANTHROPIC_DEFAULT_HAIKU_MODEL: 'gemini-3.1-flash',
318
- CLAUDE_CODE_SUBAGENT_MODEL: 'gemini-3.1-flash',
313
+ ANTHROPIC_MODEL: 'gemini-3.1-pro-low',
314
+ ANTHROPIC_DEFAULT_OPUS_MODEL: 'gemini-3.1-pro-low',
315
+ ANTHROPIC_DEFAULT_SONNET_MODEL: 'gemini-3.5-flash-low',
316
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: 'gemini-3.5-flash-low',
317
+ CLAUDE_CODE_SUBAGENT_MODEL: 'gemini-3.5-flash-low',
319
318
  ENABLE_EXPERIMENTAL_MCP_CLI: 'true'
320
319
  }
321
320
  }
@@ -1,24 +1,37 @@
1
1
  import { execSync } from 'child_process';
2
2
  import { platform, homedir } from 'os';
3
3
  import { join } from 'path';
4
- import { existsSync } from 'fs';
4
+ import { existsSync, readFileSync } from 'fs';
5
5
 
6
6
  /**
7
7
  * Intelligent Version Detection for Antigravity
8
- * Attempts to find the local installation and extract its version.
9
- * Falls back to hard-coded stable versions if detection fails.
8
+ *
9
+ * Detects versions from the local Antigravity installation's product.json.
10
+ * Two version values are tracked:
11
+ * - "version" field → X-Client-Version header (API version gate)
12
+ * - "ideVersion" field → User-Agent version string
13
+ *
14
+ * Detection priority (for each):
15
+ * 1. Environment variable override
16
+ * 2. product.json from local Antigravity app
17
+ * 3. OS-specific detection (macOS plist / Windows exe)
18
+ * 4. Hardcoded fallback
10
19
  */
11
20
 
12
- // Fallback constant (can be overridden via FALLBACK_ANTIGRAVITY_VERSION env var)
13
- const FALLBACK_ANTIGRAVITY_VERSION = process.env.FALLBACK_ANTIGRAVITY_VERSION || '1.23.2';
21
+ // Fallback for User-Agent version (ideVersion in product.json)
22
+ const FALLBACK_USER_AGENT_VERSION = process.env.FALLBACK_ANTIGRAVITY_VERSION || '2.0.3';
23
+
24
+ // Fallback for X-Client-Version (top-level "version" in product.json)
25
+ // Can be overridden via ANTIGRAVITY_CLIENT_VERSION_FALLBACK env var
26
+ const FALLBACK_CLIENT_VERSION = process.env.ANTIGRAVITY_CLIENT_VERSION_FALLBACK || '1.110.0';
14
27
 
15
- // Cache for the generated User-Agent string
16
28
  let cachedUserAgent = null;
29
+ let cachedClientVersion = null;
30
+ let cachedProductJson = undefined; // undefined = not yet attempted
31
+ let loggedVersionInfo = false;
17
32
 
18
33
  /**
19
34
  * Compares two semver-ish version strings (X.Y.Z).
20
- * @param {string} v1 - Version string 1
21
- * @param {string} v2 - Version string 2
22
35
  * @returns {boolean} True if v1 > v2
23
36
  */
24
37
  function isVersionHigher(v1, v2) {
@@ -35,15 +48,119 @@ function isVersionHigher(v1, v2) {
35
48
  }
36
49
 
37
50
  /**
38
- * Gets the version config (version, source)
51
+ * Returns platform-specific search paths for product.json.
52
+ */
53
+ function getProductJsonPaths() {
54
+ const os = platform();
55
+ const paths = [];
56
+
57
+ if (os === 'darwin') {
58
+ paths.push('/Applications/Antigravity.app/Contents/Resources/app/product.json');
59
+ paths.push(join(homedir(), 'Applications', 'Antigravity.app', 'Contents', 'Resources', 'app', 'product.json'));
60
+ } else if (os === 'win32') {
61
+ const localAppData = process.env.LOCALAPPDATA;
62
+ const programFiles = process.env.ProgramFiles || 'C:\\Program Files';
63
+ if (localAppData) {
64
+ paths.push(join(localAppData, 'Programs', 'Antigravity', 'resources', 'app', 'product.json'));
65
+ }
66
+ paths.push(join(programFiles, 'Antigravity', 'resources', 'app', 'product.json'));
67
+ } else {
68
+ paths.push('/usr/share/antigravity/resources/app/product.json');
69
+ paths.push('/opt/antigravity/resources/app/product.json');
70
+ paths.push('/opt/Antigravity/resources/app/product.json');
71
+ paths.push(join(homedir(), '.local', 'share', 'antigravity', 'resources', 'app', 'product.json'));
72
+ paths.push('/snap/antigravity/current/resources/app/product.json');
73
+ }
74
+
75
+ return paths;
76
+ }
77
+
78
+ /**
79
+ * Find and parse product.json from the local Antigravity installation.
80
+ * Caches the result after first attempt.
81
+ * @returns {Object|null} Parsed product.json or null
82
+ */
83
+ function getProductJson() {
84
+ if (cachedProductJson !== undefined) return cachedProductJson;
85
+
86
+ for (const p of getProductJsonPaths()) {
87
+ try {
88
+ if (existsSync(p)) {
89
+ const content = JSON.parse(readFileSync(p, 'utf8'));
90
+ if (content && (content.version || content.ideVersion)) {
91
+ cachedProductJson = content;
92
+ return content;
93
+ }
94
+ }
95
+ } catch (e) {
96
+ // Continue to next path
97
+ }
98
+ }
99
+
100
+ cachedProductJson = null;
101
+ return null;
102
+ }
103
+
104
+ /**
105
+ * Log version detection results once at startup (lazy import to avoid circular deps).
106
+ */
107
+ function logVersionInfo(version, source) {
108
+ if (loggedVersionInfo) return;
109
+ loggedVersionInfo = true;
110
+
111
+ import('./logger.js').then(({ logger }) => {
112
+ if (source === 'fallback') {
113
+ logger.warn(`X-Client-Version: using hardcoded fallback ${version} — product.json not found. Set ANTIGRAVITY_CLIENT_VERSION (exact version) or ANTIGRAVITY_CLIENT_VERSION_FALLBACK (fallback value) env var to override.`);
114
+ } else {
115
+ logger.debug(`X-Client-Version: ${version} (source: ${source})`);
116
+ }
117
+ }).catch(() => {});
118
+ }
119
+
120
+ /**
121
+ * Get the X-Client-Version value for API requests.
122
+ * Priority: ANTIGRAVITY_CLIENT_VERSION env var > product.json "version" > hardcoded fallback
123
+ * @returns {string} Version string (e.g. "1.110.0")
124
+ */
125
+ export function getClientVersion() {
126
+ if (cachedClientVersion) return cachedClientVersion;
127
+
128
+ if (process.env.ANTIGRAVITY_CLIENT_VERSION) {
129
+ cachedClientVersion = process.env.ANTIGRAVITY_CLIENT_VERSION;
130
+ logVersionInfo(cachedClientVersion, 'env');
131
+ return cachedClientVersion;
132
+ }
133
+
134
+ const product = getProductJson();
135
+ if (product?.version) {
136
+ cachedClientVersion = product.version;
137
+ logVersionInfo(cachedClientVersion, 'product.json');
138
+ return cachedClientVersion;
139
+ }
140
+
141
+ cachedClientVersion = FALLBACK_CLIENT_VERSION;
142
+ logVersionInfo(cachedClientVersion, 'fallback');
143
+ return cachedClientVersion;
144
+ }
145
+
146
+ /**
147
+ * Get the User-Agent version string.
148
+ * Priority: FALLBACK_ANTIGRAVITY_VERSION env var > product.json "ideVersion" > OS detection > fallback
39
149
  * @returns {{ version: string, source: string }}
40
150
  */
41
- function getVersionConfig() {
151
+ function getUserAgentVersionConfig() {
152
+ if (process.env.FALLBACK_ANTIGRAVITY_VERSION) {
153
+ return { version: process.env.FALLBACK_ANTIGRAVITY_VERSION, source: 'env' };
154
+ }
155
+
156
+ const product = getProductJson();
157
+ if (product?.ideVersion && isVersionHigher(product.ideVersion, FALLBACK_USER_AGENT_VERSION)) {
158
+ return { version: product.ideVersion, source: 'product.json' };
159
+ }
160
+
161
+ // OS-specific detection (legacy — reads app binary metadata directly)
42
162
  const os = platform();
43
163
  let detectedVersion = null;
44
- let finalVersion = FALLBACK_ANTIGRAVITY_VERSION;
45
- let source = 'fallback';
46
-
47
164
  try {
48
165
  if (os === 'darwin') {
49
166
  detectedVersion = getVersionMacos();
@@ -54,16 +171,11 @@ function getVersionConfig() {
54
171
  // Silently fail and use fallback
55
172
  }
56
173
 
57
- // Only use detected version if it's higher than the fallback version
58
- if (detectedVersion && isVersionHigher(detectedVersion, FALLBACK_ANTIGRAVITY_VERSION)) {
59
- finalVersion = detectedVersion;
60
- source = 'local';
174
+ if (detectedVersion && isVersionHigher(detectedVersion, FALLBACK_USER_AGENT_VERSION)) {
175
+ return { version: detectedVersion, source: 'local' };
61
176
  }
62
177
 
63
- return {
64
- version: finalVersion,
65
- source
66
- };
178
+ return { version: FALLBACK_USER_AGENT_VERSION, source: 'fallback' };
67
179
  }
68
180
 
69
181
  /**
@@ -74,11 +186,10 @@ function getVersionConfig() {
74
186
  export function generateSmartUserAgent() {
75
187
  if (cachedUserAgent) return cachedUserAgent;
76
188
 
77
- const { version } = getVersionConfig();
189
+ const { version } = getUserAgentVersionConfig();
78
190
  const os = platform();
79
191
  const architecture = process.arch;
80
192
 
81
- // Map Node.js platform names to binary-friendly names
82
193
  const osName = os === 'darwin' ? 'darwin' : (os === 'win32' ? 'win32' : 'linux');
83
194
 
84
195
  cachedUserAgent = `antigravity/${version} ${osName}/${architecture}`;
@@ -131,4 +242,3 @@ function getVersionWindows() {
131
242
  }
132
243
  return null;
133
244
  }
134
-