antigravity-claude-proxy 2.7.3 → 2.7.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/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ # ⚠️ DO NOT USE THIS ANYMORE – GOOGLE IS ISSUING TOS VIOLATION BANS FOR THE ACCOUNTS CONNECTED
2
+
1
3
  # Antigravity Claude Proxy
2
4
 
3
5
  [![npm version](https://img.shields.io/npm/v/antigravity-claude-proxy.svg)](https://www.npmjs.com/package/antigravity-claude-proxy)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antigravity-claude-proxy",
3
- "version": "2.7.3",
3
+ "version": "2.7.4",
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",
@@ -235,7 +235,7 @@ export async function discoverProject(token, projectId = undefined) {
235
235
  'Content-Type': 'application/json',
236
236
  ...LOAD_CODE_ASSIST_HEADERS
237
237
  },
238
- body: JSON.stringify({ metadata })
238
+ body: JSON.stringify({ metadata, mode: 1 })
239
239
  });
240
240
 
241
241
  if (!response.ok) {
@@ -139,7 +139,7 @@ export async function sendMessage(anthropicRequest, accountManager, fallbackEnab
139
139
  // Get token and project for this account
140
140
  const token = await accountManager.getTokenForAccount(account);
141
141
  const project = await accountManager.getProjectForAccount(account, token);
142
- const payload = buildCloudCodeRequest(anthropicRequest, project);
142
+ const payload = buildCloudCodeRequest(anthropicRequest, project, account.email);
143
143
 
144
144
  logger.debug(`[CloudCode] Sending request for model: ${model}`);
145
145
 
@@ -49,12 +49,12 @@ export async function listModels(token) {
49
49
  const modelList = Object.entries(data.models)
50
50
  .filter(([modelId]) => isSupportedModel(modelId))
51
51
  .map(([modelId, modelData]) => ({
52
- id: modelId,
53
- object: 'model',
54
- created: Math.floor(Date.now() / 1000),
55
- owned_by: 'anthropic',
56
- description: modelData.displayName || modelId
57
- }));
52
+ id: modelId,
53
+ object: 'model',
54
+ created: Math.floor(Date.now() / 1000),
55
+ owned_by: 'anthropic',
56
+ description: modelData.displayName || modelId
57
+ }));
58
58
 
59
59
  // Warm the model validation cache
60
60
  modelCache.validModels = new Set(modelList.map(m => m.id));
@@ -183,10 +183,8 @@ export async function getSubscriptionTier(token) {
183
183
  method: 'POST',
184
184
  headers,
185
185
  body: JSON.stringify({
186
- metadata: {
187
- ...CLIENT_METADATA,
188
- duetProject: 'rising-fact-p41fc'
189
- }
186
+ metadata: CLIENT_METADATA,
187
+ mode: 1
190
188
  })
191
189
  });
192
190
 
@@ -19,14 +19,15 @@ import { deriveSessionId } from './session-manager.js';
19
19
  *
20
20
  * @param {Object} anthropicRequest - The Anthropic-format request
21
21
  * @param {string} projectId - The project ID to use
22
+ * @param {string} accountEmail - The account email for session ID derivation
22
23
  * @returns {Object} The Cloud Code API request payload
23
24
  */
24
- export function buildCloudCodeRequest(anthropicRequest, projectId) {
25
+ export function buildCloudCodeRequest(anthropicRequest, projectId, accountEmail) {
25
26
  const model = anthropicRequest.model;
26
27
  const googleRequest = convertAnthropicToGoogle(anthropicRequest);
27
28
 
28
29
  // Use stable session ID derived from first user message for cache continuity
29
- googleRequest.sessionId = deriveSessionId(anthropicRequest);
30
+ googleRequest.sessionId = deriveSessionId(anthropicRequest, accountEmail);
30
31
 
31
32
  // Build system instruction parts array with [ignore] tags to prevent model from
32
33
  // identifying as "Antigravity" (fixes GitHub issue #76)
@@ -14,9 +14,10 @@ import crypto from 'crypto';
14
14
  * enabling prompt caching (cache is scoped to session + organization).
15
15
  *
16
16
  * @param {Object} anthropicRequest - The Anthropic-format request
17
+ * @param {string} accountEmail - The account email to make session IDs unique per account
17
18
  * @returns {string} A stable session ID (32 hex characters) or random UUID if no user message
18
19
  */
19
- export function deriveSessionId(anthropicRequest) {
20
+ export function deriveSessionId(anthropicRequest, accountEmail) {
20
21
  const messages = anthropicRequest.messages || [];
21
22
 
22
23
  // Find the first user message
@@ -35,8 +36,13 @@ export function deriveSessionId(anthropicRequest) {
35
36
  }
36
37
 
37
38
  if (content) {
39
+ // Include account email in the content to be hashed to ensure
40
+ // unique session IDs per account for the same conversation.
41
+ // This prevents Google from correlating sessions across accounts.
42
+ const saltedContent = accountEmail ? `${accountEmail}:${content}` : content;
43
+
38
44
  // Hash the content with SHA256, return first 32 hex chars
39
- const hash = crypto.createHash('sha256').update(content).digest('hex');
45
+ const hash = crypto.createHash('sha256').update(saltedContent).digest('hex');
40
46
  return hash.substring(0, 32);
41
47
  }
42
48
  }
@@ -139,7 +139,7 @@ export async function* sendMessageStream(anthropicRequest, accountManager, fallb
139
139
  // Get token and project for this account
140
140
  const token = await accountManager.getTokenForAccount(account);
141
141
  const project = await accountManager.getProjectForAccount(account, token);
142
- const payload = buildCloudCodeRequest(anthropicRequest, project);
142
+ const payload = buildCloudCodeRequest(anthropicRequest, project, account.email);
143
143
 
144
144
  logger.debug(`[CloudCode] Starting stream for model: ${model}`);
145
145
 
package/src/constants.js CHANGED
@@ -40,24 +40,25 @@ function getPlatformUserAgent() {
40
40
  // Reference: Antigravity binary analysis - google.internal.cloud.code.v1internal.ClientMetadata.IdeType
41
41
  export const IDE_TYPE = {
42
42
  UNSPECIFIED: 0,
43
- JETSKI: 5, // Internal codename for Gemini CLI
44
- ANTIGRAVITY: 6,
43
+ JETSKI: 10, // Internal codename for Gemini CLI
44
+ ANTIGRAVITY: 9,
45
45
  PLUGINS: 7
46
46
  };
47
47
 
48
- // Platform enum
49
- // Reference: Antigravity binary analysis - google.internal.cloud.code.v1internal.ClientMetadata.Platform
48
+ // Platform enum (as specified in Antigravity binary)
50
49
  export const PLATFORM = {
51
50
  UNSPECIFIED: 0,
52
- WINDOWS: 1,
53
- LINUX: 2,
54
- MACOS: 3
51
+ DARWIN_AMD64: 1,
52
+ DARWIN_ARM64: 2,
53
+ LINUX_AMD64: 3,
54
+ LINUX_ARM64: 4,
55
+ WINDOWS_AMD64: 5
55
56
  };
56
57
 
57
- // Plugin type enum
58
+ // Plugin type enum (as specified in Antigravity binary)
58
59
  export const PLUGIN_TYPE = {
59
60
  UNSPECIFIED: 0,
60
- DUET_AI: 1,
61
+ CLOUD_CODE: 1,
61
62
  GEMINI: 2
62
63
  };
63
64
 
@@ -66,12 +67,17 @@ export const PLUGIN_TYPE = {
66
67
  * @returns {number} Platform enum value
67
68
  */
68
69
  function getPlatformEnum() {
69
- switch (platform()) {
70
- case 'darwin': return PLATFORM.MACOS;
71
- case 'win32': return PLATFORM.WINDOWS;
72
- case 'linux': return PLATFORM.LINUX;
73
- default: return PLATFORM.UNSPECIFIED;
70
+ const os = platform();
71
+ const architecture = arch();
72
+
73
+ if (os === 'darwin') {
74
+ return architecture === 'arm64' ? PLATFORM.DARWIN_ARM64 : PLATFORM.DARWIN_AMD64;
75
+ } else if (os === 'linux') {
76
+ return architecture === 'arm64' ? PLATFORM.LINUX_ARM64 : PLATFORM.LINUX_AMD64;
77
+ } else if (os === 'win32') {
78
+ return PLATFORM.WINDOWS_AMD64;
74
79
  }
80
+ return PLATFORM.UNSPECIFIED;
75
81
  }
76
82
 
77
83
  // Centralized client metadata (used in request bodies for loadCodeAssist, onboardUser, etc.)
@@ -93,10 +99,11 @@ export const ANTIGRAVITY_ENDPOINT_FALLBACKS = [
93
99
  ];
94
100
 
95
101
  // Required headers for Antigravity API requests
102
+ // Headers for general Antigravity API requests
103
+ // Strictly matches the generic 'u' method in main.js
96
104
  export const ANTIGRAVITY_HEADERS = {
97
105
  'User-Agent': getPlatformUserAgent(),
98
- 'X-Goog-Api-Client': 'google-cloud-sdk vscode_cloudshelleditor/0.1',
99
- 'Client-Metadata': JSON.stringify(CLIENT_METADATA)
106
+ 'Content-Type': 'application/json'
100
107
  };
101
108
 
102
109
  // Endpoint order for loadCodeAssist (prod first)
@@ -110,6 +117,7 @@ export const LOAD_CODE_ASSIST_ENDPOINTS = [
110
117
  export const ONBOARD_USER_ENDPOINTS = ANTIGRAVITY_ENDPOINT_FALLBACKS;
111
118
 
112
119
  // Headers for loadCodeAssist API
120
+ // Matches the minimal headers seen in the binary's u() method
113
121
  export const LOAD_CODE_ASSIST_HEADERS = ANTIGRAVITY_HEADERS;
114
122
 
115
123
  // Default project ID if none can be discovered