antigravity-claude-proxy 3.0.0 → 3.1.0
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/bin/cli.js +4 -11
- package/package.json +1 -1
- package/public/app.js +7 -4
- package/public/css/src/input.css +379 -216
- package/public/css/style.css +1 -1
- package/public/favicon.svg +4 -8
- package/public/index.html +78 -72
- package/public/js/components/claude-config.js +0 -8
- package/public/js/components/dashboard/charts.js +25 -51
- package/public/js/components/dashboard/stats.js +1 -1
- package/public/js/components/dashboard.js +16 -21
- package/public/js/components/logs-viewer.js +1 -1
- package/public/js/components/models.js +12 -12
- package/public/js/components/server-config.js +1 -9
- package/public/js/data-store.js +2 -2
- package/public/js/store.js +1 -1
- package/public/js/translations/en.js +37 -39
- package/public/js/translations/id.js +36 -37
- package/public/js/translations/pt.js +37 -38
- package/public/js/translations/tr.js +37 -39
- package/public/js/translations/zh.js +0 -2
- package/public/js/utils/error-handler.js +0 -2
- package/public/js/utils/ui-logger.js +4 -3
- package/public/views/accounts.html +34 -38
- package/public/views/dashboard.html +86 -99
- package/public/views/logs.html +4 -4
- package/public/views/models.html +32 -36
- package/public/views/settings.html +50 -50
- package/src/account-manager/index.js +0 -4
- package/src/account-manager/rate-limits.js +0 -5
- package/src/account-manager/strategies/base-strategy.js +4 -4
- package/src/account-manager/strategies/hybrid-strategy.js +3 -3
- package/src/auth/database.js +1 -0
- package/src/auth/oauth.js +43 -41
- package/src/auth/token-extractor.js +1 -1
- package/src/cli/accounts.js +2 -1
- package/src/cloudcode/model-registry.js +0 -3
- package/src/cloudcode/rate-limit-state.js +1 -7
- package/src/config.js +1 -1
- package/src/constants.js +0 -2
- package/src/format/content-converter.js +0 -4
- package/src/format/request-converter.js +1 -6
- package/src/format/response-converter.js +0 -3
- package/src/format/schema-sanitizer.js +3 -22
- package/src/format/thinking-utils.js +1 -13
- package/src/index.js +1 -6
- package/src/modules/usage-stats.js +1 -1
- package/src/server.js +1 -28
- package/src/utils/claude-config.js +2 -6
- package/src/utils/native-module-helper.js +0 -4
- package/src/utils/proxy.js +1 -10
- package/src/utils/version-detector.js +14 -5
- package/src/webui/index.js +1 -37
|
@@ -83,7 +83,7 @@ export async function updateClaudeConfig(updates) {
|
|
|
83
83
|
try {
|
|
84
84
|
await fs.mkdir(configDir, { recursive: true });
|
|
85
85
|
} catch (error) {
|
|
86
|
-
|
|
86
|
+
logger.debug(`[ClaudeConfig] Could not create ${configDir}: ${error.message}`);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// 4. Write back to file
|
|
@@ -112,7 +112,7 @@ export async function replaceClaudeConfig(config) {
|
|
|
112
112
|
try {
|
|
113
113
|
await fs.mkdir(configDir, { recursive: true });
|
|
114
114
|
} catch (error) {
|
|
115
|
-
|
|
115
|
+
logger.debug(`[ClaudeConfig] Could not create ${configDir}: ${error.message}`);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// 2. Write config directly (no merge)
|
|
@@ -153,10 +153,6 @@ function isObject(item) {
|
|
|
153
153
|
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
// ==========================================
|
|
157
|
-
// Claude CLI Presets
|
|
158
|
-
// ==========================================
|
|
159
|
-
|
|
160
156
|
/**
|
|
161
157
|
* Get the path to the presets file
|
|
162
158
|
* @returns {string} Absolute path to claude-presets.json
|
|
@@ -64,14 +64,12 @@ export function rebuildModule(packagePath) {
|
|
|
64
64
|
try {
|
|
65
65
|
logger.info(`[NativeModule] Rebuilding native module at: ${packagePath}`);
|
|
66
66
|
|
|
67
|
-
// Run npm rebuild in the package directory
|
|
68
67
|
const output = execSync('npm rebuild', {
|
|
69
68
|
cwd: packagePath,
|
|
70
69
|
stdio: 'pipe', // Capture output instead of printing
|
|
71
70
|
timeout: 120000 // 2 minute timeout
|
|
72
71
|
});
|
|
73
72
|
|
|
74
|
-
// Log rebuild output for debugging
|
|
75
73
|
const outputStr = output?.toString().trim();
|
|
76
74
|
if (outputStr) {
|
|
77
75
|
logger.debug(`[NativeModule] Rebuild output:\n${outputStr}`);
|
|
@@ -140,7 +138,6 @@ export function clearRequireCache(modulePath, cache, visited = new Set()) {
|
|
|
140
138
|
}
|
|
141
139
|
}
|
|
142
140
|
|
|
143
|
-
// Remove from parent's children array
|
|
144
141
|
if (mod.parent && mod.parent.children) {
|
|
145
142
|
const idx = mod.parent.children.indexOf(mod);
|
|
146
143
|
if (idx !== -1) {
|
|
@@ -148,7 +145,6 @@ export function clearRequireCache(modulePath, cache, visited = new Set()) {
|
|
|
148
145
|
}
|
|
149
146
|
}
|
|
150
147
|
|
|
151
|
-
// Delete from cache
|
|
152
148
|
delete cache[modulePath];
|
|
153
149
|
}
|
|
154
150
|
|
package/src/utils/proxy.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* HTTP Proxy Support
|
|
3
|
-
*
|
|
4
|
-
* Configures global fetch to use HTTP proxy from environment variables.
|
|
5
|
-
* Supports: http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY
|
|
6
|
-
*
|
|
7
|
-
* This module should be imported at the very beginning of the application
|
|
8
|
-
* entry point (src/index.js) before any fetch calls are made.
|
|
9
|
-
*/
|
|
10
|
-
|
|
1
|
+
// Routes global fetch through http(s)_proxy env vars. Import before any fetch call (see src/index.js).
|
|
11
2
|
import { ProxyAgent, setGlobalDispatcher } from 'undici';
|
|
12
3
|
import { logger } from './logger.js';
|
|
13
4
|
|
|
@@ -27,7 +27,7 @@ import { config } from '../config.js';
|
|
|
27
27
|
|
|
28
28
|
// Fallback for User-Agent version (ideVersion in product.json), used only when
|
|
29
29
|
// no installed Antigravity version is detected
|
|
30
|
-
const FALLBACK_USER_AGENT_VERSION = process.env.FALLBACK_ANTIGRAVITY_VERSION || '2.
|
|
30
|
+
const FALLBACK_USER_AGENT_VERSION = process.env.FALLBACK_ANTIGRAVITY_VERSION || '2.32.0';
|
|
31
31
|
|
|
32
32
|
// Detected versions must be above this to be used (older installs are ignored)
|
|
33
33
|
const MIN_DETECTED_USER_AGENT_VERSION = '2.0.3';
|
|
@@ -104,7 +104,7 @@ function getProductJson() {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
} catch (e) {
|
|
107
|
-
|
|
107
|
+
logDetectionFailure(`Reading ${p}`, e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -112,6 +112,15 @@ function getProductJson() {
|
|
|
112
112
|
return null;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Debug-log a failed detection step (lazy import to avoid circular deps).
|
|
117
|
+
*/
|
|
118
|
+
function logDetectionFailure(step, err) {
|
|
119
|
+
import('./logger.js').then(({ logger }) => {
|
|
120
|
+
logger.debug(`[VersionDetector] ${step} failed: ${err?.message ?? err}`);
|
|
121
|
+
}).catch(() => {});
|
|
122
|
+
}
|
|
123
|
+
|
|
115
124
|
/**
|
|
116
125
|
* Log version detection results once at startup (lazy import to avoid circular deps).
|
|
117
126
|
*/
|
|
@@ -188,7 +197,7 @@ function getUserAgentVersionConfig() {
|
|
|
188
197
|
localVersion = getVersionWindows();
|
|
189
198
|
}
|
|
190
199
|
} catch (error) {
|
|
191
|
-
|
|
200
|
+
logDetectionFailure('OS version detection', error);
|
|
192
201
|
}
|
|
193
202
|
|
|
194
203
|
return resolveUserAgentVersion({ localVersion });
|
|
@@ -246,7 +255,7 @@ function getVersionMacos() {
|
|
|
246
255
|
return version;
|
|
247
256
|
}
|
|
248
257
|
} catch (e) {
|
|
249
|
-
|
|
258
|
+
logDetectionFailure('plutil', e);
|
|
250
259
|
}
|
|
251
260
|
return null;
|
|
252
261
|
}
|
|
@@ -273,7 +282,7 @@ function getVersionWindows() {
|
|
|
273
282
|
}
|
|
274
283
|
}
|
|
275
284
|
} catch (e) {
|
|
276
|
-
|
|
285
|
+
logDetectionFailure('PowerShell version lookup', e);
|
|
277
286
|
}
|
|
278
287
|
return null;
|
|
279
288
|
}
|
package/src/webui/index.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import path from 'path';
|
|
16
16
|
import express from 'express';
|
|
17
17
|
import { getPublicConfig, saveConfig, config } from '../config.js';
|
|
18
|
-
import { DEFAULT_PORT, ACCOUNT_CONFIG_PATH, MAX_ACCOUNTS, DEFAULT_PRESETS
|
|
18
|
+
import { DEFAULT_PORT, ACCOUNT_CONFIG_PATH, MAX_ACCOUNTS, DEFAULT_PRESETS } from '../constants.js';
|
|
19
19
|
import { readClaudeConfig, updateClaudeConfig, replaceClaudeConfig, getClaudeConfigPath, readPresets, savePreset, deletePreset } from '../utils/claude-config.js';
|
|
20
20
|
import { readServerPresets, saveServerPreset, updateServerPreset, deleteServerPreset } from '../utils/server-presets.js';
|
|
21
21
|
import { logger } from '../utils/logger.js';
|
|
@@ -259,10 +259,6 @@ export function mountWebUI(app, dirname, accountManager) {
|
|
|
259
259
|
// Serve static files from public directory
|
|
260
260
|
app.use(express.static(path.join(dirname, '../public')));
|
|
261
261
|
|
|
262
|
-
// ==========================================
|
|
263
|
-
// Account Management API
|
|
264
|
-
// ==========================================
|
|
265
|
-
|
|
266
262
|
/**
|
|
267
263
|
* GET /api/accounts - List all accounts with status
|
|
268
264
|
*/
|
|
@@ -554,10 +550,6 @@ export function mountWebUI(app, dirname, accountManager) {
|
|
|
554
550
|
}
|
|
555
551
|
});
|
|
556
552
|
|
|
557
|
-
// ==========================================
|
|
558
|
-
// Configuration API
|
|
559
|
-
// ==========================================
|
|
560
|
-
|
|
561
553
|
/**
|
|
562
554
|
* GET /api/config - Get server configuration
|
|
563
555
|
*/
|
|
@@ -703,10 +695,6 @@ export function mountWebUI(app, dirname, accountManager) {
|
|
|
703
695
|
}
|
|
704
696
|
});
|
|
705
697
|
|
|
706
|
-
// ==========================================
|
|
707
|
-
// Claude CLI Configuration API
|
|
708
|
-
// ==========================================
|
|
709
|
-
|
|
710
698
|
/**
|
|
711
699
|
* GET /api/claude/config - Get Claude CLI configuration
|
|
712
700
|
*/
|
|
@@ -790,10 +778,6 @@ export function mountWebUI(app, dirname, accountManager) {
|
|
|
790
778
|
}
|
|
791
779
|
});
|
|
792
780
|
|
|
793
|
-
// ==========================================
|
|
794
|
-
// Claude CLI Mode Toggle API (Proxy/Paid)
|
|
795
|
-
// ==========================================
|
|
796
|
-
|
|
797
781
|
/**
|
|
798
782
|
* GET /api/claude/mode - Get current mode (proxy or paid)
|
|
799
783
|
* Returns 'proxy' if ANTHROPIC_BASE_URL is set to localhost, 'paid' otherwise
|
|
@@ -869,10 +853,6 @@ export function mountWebUI(app, dirname, accountManager) {
|
|
|
869
853
|
}
|
|
870
854
|
});
|
|
871
855
|
|
|
872
|
-
// ==========================================
|
|
873
|
-
// Claude CLI Presets API
|
|
874
|
-
// ==========================================
|
|
875
|
-
|
|
876
856
|
|
|
877
857
|
/**
|
|
878
858
|
* GET /api/claude/presets - Get all saved presets
|
|
@@ -923,10 +903,6 @@ export function mountWebUI(app, dirname, accountManager) {
|
|
|
923
903
|
}
|
|
924
904
|
});
|
|
925
905
|
|
|
926
|
-
// ==========================================
|
|
927
|
-
// Server Configuration Presets API
|
|
928
|
-
// ==========================================
|
|
929
|
-
|
|
930
906
|
/**
|
|
931
907
|
* GET /api/server/presets - List all server config presets
|
|
932
908
|
*/
|
|
@@ -1063,10 +1039,6 @@ export function mountWebUI(app, dirname, accountManager) {
|
|
|
1063
1039
|
}
|
|
1064
1040
|
});
|
|
1065
1041
|
|
|
1066
|
-
// ==========================================
|
|
1067
|
-
// Logs API
|
|
1068
|
-
// ==========================================
|
|
1069
|
-
|
|
1070
1042
|
/**
|
|
1071
1043
|
* GET /api/logs - Get log history
|
|
1072
1044
|
*/
|
|
@@ -1108,10 +1080,6 @@ export function mountWebUI(app, dirname, accountManager) {
|
|
|
1108
1080
|
});
|
|
1109
1081
|
});
|
|
1110
1082
|
|
|
1111
|
-
// ==========================================
|
|
1112
|
-
// Strategy Health API (Developer Mode)
|
|
1113
|
-
// ==========================================
|
|
1114
|
-
|
|
1115
1083
|
/**
|
|
1116
1084
|
* GET /api/strategy/health - Get strategy health data for the inspector panel
|
|
1117
1085
|
* Only available when devMode is enabled
|
|
@@ -1136,10 +1104,6 @@ export function mountWebUI(app, dirname, accountManager) {
|
|
|
1136
1104
|
}
|
|
1137
1105
|
});
|
|
1138
1106
|
|
|
1139
|
-
// ==========================================
|
|
1140
|
-
// OAuth API
|
|
1141
|
-
// ==========================================
|
|
1142
|
-
|
|
1143
1107
|
/**
|
|
1144
1108
|
* GET /api/auth/url - Get OAuth URL to start the flow
|
|
1145
1109
|
* Uses CLI's OAuth flow (localhost:51121) instead of WebUI's port
|