antigravity-claude-proxy 2.4.2 → 2.4.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 +1 -0
- package/package.json +1 -1
- package/src/auth/oauth.js +7 -5
- package/src/constants.js +1 -1
- package/src/index.js +13 -2
package/README.md
CHANGED
|
@@ -387,6 +387,7 @@ For macOS users who prefer a native experience, there's a companion menu bar app
|
|
|
387
387
|
- **Status Indicator**: Menu bar icon shows server running state at a glance.
|
|
388
388
|
- **WebUI Access**: Open the web management console directly from the menu.
|
|
389
389
|
- **Port Configuration**: Customize the proxy server port (default: 8080).
|
|
390
|
+
- **Account Selection Strategy**: Choose between Hybrid, Sticky, or Round-Robin load balancing strategies.
|
|
390
391
|
- **Auto-Start Options**: Launch server on app start and launch app at login.
|
|
391
392
|
- **Native Experience**: Clean, native SwiftUI interface designed for macOS.
|
|
392
393
|
|
package/package.json
CHANGED
package/src/auth/oauth.js
CHANGED
|
@@ -141,9 +141,10 @@ export function extractCodeFromInput(input) {
|
|
|
141
141
|
* Attempt to bind server to a specific port
|
|
142
142
|
* @param {http.Server} server - HTTP server instance
|
|
143
143
|
* @param {number} port - Port to bind to
|
|
144
|
+
* @param {string} host - Host to bind to
|
|
144
145
|
* @returns {Promise<number>} Resolves with port on success, rejects on error
|
|
145
146
|
*/
|
|
146
|
-
function tryBindPort(server, port) {
|
|
147
|
+
function tryBindPort(server, port, host = '0.0.0.0') {
|
|
147
148
|
return new Promise((resolve, reject) => {
|
|
148
149
|
const onError = (err) => {
|
|
149
150
|
server.removeListener('listening', onSuccess);
|
|
@@ -155,7 +156,7 @@ function tryBindPort(server, port) {
|
|
|
155
156
|
};
|
|
156
157
|
server.once('error', onError);
|
|
157
158
|
server.once('listening', onSuccess);
|
|
158
|
-
server.listen(port);
|
|
159
|
+
server.listen(port, host);
|
|
159
160
|
});
|
|
160
161
|
}
|
|
161
162
|
|
|
@@ -173,6 +174,7 @@ export function startCallbackServer(expectedState, timeoutMs = 120000) {
|
|
|
173
174
|
let timeoutId = null;
|
|
174
175
|
let isAborted = false;
|
|
175
176
|
let actualPort = OAUTH_CONFIG.callbackPort;
|
|
177
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
176
178
|
|
|
177
179
|
const promise = new Promise(async (resolve, reject) => {
|
|
178
180
|
// Build list of ports to try: primary + fallbacks
|
|
@@ -180,7 +182,7 @@ export function startCallbackServer(expectedState, timeoutMs = 120000) {
|
|
|
180
182
|
const errors = [];
|
|
181
183
|
|
|
182
184
|
server = http.createServer((req, res) => {
|
|
183
|
-
const url = new URL(req.url, `http
|
|
185
|
+
const url = new URL(req.url, `http://${host === '0.0.0.0' ? 'localhost' : host}:${actualPort}`);
|
|
184
186
|
|
|
185
187
|
if (url.pathname !== '/oauth-callback') {
|
|
186
188
|
res.writeHead(404);
|
|
@@ -264,14 +266,14 @@ export function startCallbackServer(expectedState, timeoutMs = 120000) {
|
|
|
264
266
|
let boundSuccessfully = false;
|
|
265
267
|
for (const port of portsToTry) {
|
|
266
268
|
try {
|
|
267
|
-
await tryBindPort(server, port);
|
|
269
|
+
await tryBindPort(server, port, host);
|
|
268
270
|
actualPort = port;
|
|
269
271
|
boundSuccessfully = true;
|
|
270
272
|
|
|
271
273
|
if (port !== OAUTH_CONFIG.callbackPort) {
|
|
272
274
|
logger.warn(`[OAuth] Primary port ${OAUTH_CONFIG.callbackPort} unavailable, using fallback port ${port}`);
|
|
273
275
|
} else {
|
|
274
|
-
logger.info(`[OAuth] Callback server listening on
|
|
276
|
+
logger.info(`[OAuth] Callback server listening on ${host}:${port}`);
|
|
275
277
|
}
|
|
276
278
|
break;
|
|
277
279
|
} catch (err) {
|
package/src/constants.js
CHANGED
|
@@ -33,7 +33,7 @@ function getAntigravityDbPath() {
|
|
|
33
33
|
function getPlatformUserAgent() {
|
|
34
34
|
const os = platform();
|
|
35
35
|
const architecture = arch();
|
|
36
|
-
return `antigravity/1.
|
|
36
|
+
return `antigravity/1.15.8 ${os}/${architecture}`;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// Cloud Code API endpoints (in fallback order)
|
package/src/index.js
CHANGED
|
@@ -46,12 +46,22 @@ if (isFallbackEnabled) {
|
|
|
46
46
|
export const FALLBACK_ENABLED = isFallbackEnabled;
|
|
47
47
|
|
|
48
48
|
const PORT = process.env.PORT || DEFAULT_PORT;
|
|
49
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
50
|
+
|
|
51
|
+
if (process.env.HOST) {
|
|
52
|
+
logger.info(`[Startup] Using HOST environment variable: ${process.env.HOST}`);
|
|
53
|
+
}
|
|
49
54
|
|
|
50
55
|
// Home directory for account storage
|
|
51
56
|
const HOME_DIR = os.homedir();
|
|
52
57
|
const CONFIG_DIR = path.join(HOME_DIR, '.antigravity-claude-proxy');
|
|
53
58
|
|
|
54
|
-
const server = app.listen(PORT, () => {
|
|
59
|
+
const server = app.listen(PORT, HOST, () => {
|
|
60
|
+
// Get actual bound address
|
|
61
|
+
const address = server.address();
|
|
62
|
+
const boundHost = typeof address === 'string' ? address : address.address;
|
|
63
|
+
const boundPort = typeof address === 'string' ? null : address.port;
|
|
64
|
+
|
|
55
65
|
// Clear console for a clean start
|
|
56
66
|
console.clear();
|
|
57
67
|
|
|
@@ -93,7 +103,8 @@ const server = app.listen(PORT, () => {
|
|
|
93
103
|
║ Antigravity Claude Proxy Server ║
|
|
94
104
|
╠══════════════════════════════════════════════════════════════╣
|
|
95
105
|
║ ║
|
|
96
|
-
${border} ${align(`Server and WebUI running at: http
|
|
106
|
+
${border} ${align(`Server and WebUI running at: http://${HOST === '0.0.0.0' ? 'localhost' : HOST}:${PORT}`)}${border}
|
|
107
|
+
${border} ${align(`Bound to: ${boundHost}:${boundPort}`)}${border}
|
|
97
108
|
${statusSection}║ ║
|
|
98
109
|
${controlSection}
|
|
99
110
|
║ ║
|