antigravity-claude-proxy 2.0.9 → 2.0.10
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 +19 -0
- package/package.json +1 -1
- package/src/cloudcode/message-handler.js +11 -10
- package/src/cloudcode/streaming-handler.js +12 -11
package/README.md
CHANGED
|
@@ -343,6 +343,25 @@ Refer to `config.example.json` for a complete list of fields and documentation.
|
|
|
343
343
|
|
|
344
344
|
---
|
|
345
345
|
|
|
346
|
+
## macOS Menu Bar App
|
|
347
|
+
|
|
348
|
+
For macOS users who prefer a native experience, there's a companion menu bar app that provides quick access to server controls without touching the terminal. Get it from: [antigravity-claude-proxy-bar](https://github.com/IrvanFza/antigravity-claude-proxy-bar)
|
|
349
|
+
|
|
350
|
+
> **Note:** This is a GUI wrapper only. You still need to install and setup the proxy server first using one of the [installation methods](#installation) above.
|
|
351
|
+
|
|
352
|
+

|
|
353
|
+
|
|
354
|
+
### Key Features
|
|
355
|
+
|
|
356
|
+
- **Server Control**: Start/stop the proxy server with a single click or ⌘S shortcut.
|
|
357
|
+
- **Status Indicator**: Menu bar icon shows server running state at a glance.
|
|
358
|
+
- **WebUI Access**: Open the web management console directly from the menu.
|
|
359
|
+
- **Port Configuration**: Customize the proxy server port (default: 8080).
|
|
360
|
+
- **Auto-Start Options**: Launch server on app start and launch app at login.
|
|
361
|
+
- **Native Experience**: Clean, native SwiftUI interface designed for macOS.
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
346
365
|
## API Endpoints
|
|
347
366
|
|
|
348
367
|
| Endpoint | Method | Description |
|
package/package.json
CHANGED
|
@@ -55,8 +55,17 @@ export async function sendMessage(anthropicRequest, accountManager, fallbackEnab
|
|
|
55
55
|
const minWaitMs = accountManager.getMinWaitTimeMs(model);
|
|
56
56
|
const resetTime = new Date(Date.now() + minWaitMs).toISOString();
|
|
57
57
|
|
|
58
|
-
// If wait time is too long (> 2 minutes), throw error
|
|
58
|
+
// If wait time is too long (> 2 minutes), try fallback first, then throw error
|
|
59
59
|
if (minWaitMs > MAX_WAIT_BEFORE_ERROR_MS) {
|
|
60
|
+
// Check if fallback is enabled and available
|
|
61
|
+
if (fallbackEnabled) {
|
|
62
|
+
const fallbackModel = getFallbackModel(model);
|
|
63
|
+
if (fallbackModel) {
|
|
64
|
+
logger.warn(`[CloudCode] All accounts exhausted for ${model} (${formatDuration(minWaitMs)} wait). Attempting fallback to ${fallbackModel}`);
|
|
65
|
+
const fallbackRequest = { ...anthropicRequest, model: fallbackModel };
|
|
66
|
+
return await sendMessage(fallbackRequest, accountManager, false);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
60
69
|
throw new Error(
|
|
61
70
|
`RESOURCE_EXHAUSTED: Rate limited on ${model}. Quota will reset after ${formatDuration(minWaitMs)}. Next available: ${resetTime}`
|
|
62
71
|
);
|
|
@@ -70,15 +79,7 @@ export async function sendMessage(anthropicRequest, accountManager, fallbackEnab
|
|
|
70
79
|
continue; // Retry the loop
|
|
71
80
|
}
|
|
72
81
|
|
|
73
|
-
//
|
|
74
|
-
if (fallbackEnabled) {
|
|
75
|
-
const fallbackModel = getFallbackModel(model);
|
|
76
|
-
if (fallbackModel) {
|
|
77
|
-
logger.warn(`[CloudCode] All accounts exhausted for ${model}. Attempting fallback to ${fallbackModel}`);
|
|
78
|
-
const fallbackRequest = { ...anthropicRequest, model: fallbackModel };
|
|
79
|
-
return await sendMessage(fallbackRequest, accountManager, false);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
+
// No accounts available and not rate-limited (shouldn't happen normally)
|
|
82
83
|
throw new Error('No accounts available');
|
|
83
84
|
}
|
|
84
85
|
|
|
@@ -54,8 +54,18 @@ export async function* sendMessageStream(anthropicRequest, accountManager, fallb
|
|
|
54
54
|
const minWaitMs = accountManager.getMinWaitTimeMs(model);
|
|
55
55
|
const resetTime = new Date(Date.now() + minWaitMs).toISOString();
|
|
56
56
|
|
|
57
|
-
// If wait time is too long (> 2 minutes), throw error
|
|
57
|
+
// If wait time is too long (> 2 minutes), try fallback first, then throw error
|
|
58
58
|
if (minWaitMs > MAX_WAIT_BEFORE_ERROR_MS) {
|
|
59
|
+
// Check if fallback is enabled and available
|
|
60
|
+
if (fallbackEnabled) {
|
|
61
|
+
const fallbackModel = getFallbackModel(model);
|
|
62
|
+
if (fallbackModel) {
|
|
63
|
+
logger.warn(`[CloudCode] All accounts exhausted for ${model} (${formatDuration(minWaitMs)} wait). Attempting fallback to ${fallbackModel} (streaming)`);
|
|
64
|
+
const fallbackRequest = { ...anthropicRequest, model: fallbackModel };
|
|
65
|
+
yield* sendMessageStream(fallbackRequest, accountManager, false);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
59
69
|
throw new Error(
|
|
60
70
|
`RESOURCE_EXHAUSTED: Rate limited on ${model}. Quota will reset after ${formatDuration(minWaitMs)}. Next available: ${resetTime}`
|
|
61
71
|
);
|
|
@@ -69,16 +79,7 @@ export async function* sendMessageStream(anthropicRequest, accountManager, fallb
|
|
|
69
79
|
continue; // Retry the loop
|
|
70
80
|
}
|
|
71
81
|
|
|
72
|
-
//
|
|
73
|
-
if (fallbackEnabled) {
|
|
74
|
-
const fallbackModel = getFallbackModel(model);
|
|
75
|
-
if (fallbackModel) {
|
|
76
|
-
logger.warn(`[CloudCode] All accounts exhausted for ${model}. Attempting fallback to ${fallbackModel} (streaming)`);
|
|
77
|
-
const fallbackRequest = { ...anthropicRequest, model: fallbackModel };
|
|
78
|
-
yield* sendMessageStream(fallbackRequest, accountManager, false);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
+
// No accounts available and not rate-limited (shouldn't happen normally)
|
|
82
83
|
throw new Error('No accounts available');
|
|
83
84
|
}
|
|
84
85
|
|