pi-antigravity-rotator 2.3.0 → 2.3.2
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/CHANGELOG.md +25 -0
- package/README.md +18 -12
- package/package.json +12 -8
- package/src/cli.ts +27 -2
- package/src/compat/translators.ts +58 -8
- package/src/compat.ts +103 -15
- package/src/dashboard.ts +35 -0
- package/src/exposure.ts +17 -0
- package/src/index.ts +12 -0
- package/src/login.ts +4 -3
- package/src/notification-poller.ts +23 -10
- package/src/onboarding.ts +16 -1
- package/src/proxy.ts +422 -387
- package/src/rotator.ts +271 -6
- package/src/static/dashboard.js +1971 -928
- package/src/telemetry.ts +7 -5
- package/src/types.ts +4 -9
- package/src/version-check.ts +23 -10
- package/tools/telemetry-receiver/README.md +2 -1
- package/tools/telemetry-receiver/receiver.js +5 -0
package/src/telemetry.ts
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
// - Flag events: HTTP status, matched patterns, model, pool state,
|
|
10
10
|
// request velocity — everything needed to improve the anti-flag algorithm
|
|
11
11
|
//
|
|
12
|
-
// What we NEVER
|
|
13
|
-
// - Emails, tokens,
|
|
12
|
+
// What we NEVER include in telemetry payloads or event files:
|
|
13
|
+
// - Emails, tokens, project IDs, request bodies, error message text
|
|
14
|
+
// Source IPs are not part of the JSON telemetry payload, but the receiver and
|
|
15
|
+
// network path can observe them for transport and rate limiting.
|
|
14
16
|
//
|
|
15
17
|
// Docs: https://github.com/tuxevil/pi-antigravity-rotator#telemetry
|
|
16
18
|
|
|
@@ -129,8 +131,8 @@ function printTelemetryNotice(): void {
|
|
|
129
131
|
console.log();
|
|
130
132
|
console.log(" ╭──────────────────────────────────────────────────────────╮");
|
|
131
133
|
console.log(" │ Anonymous telemetry is enabled to help improve the │");
|
|
132
|
-
console.log(" │ rotator. No emails, tokens,
|
|
133
|
-
console.log(" │
|
|
134
|
+
console.log(" │ rotator. No emails, tokens, project IDs, request bodies │");
|
|
135
|
+
console.log(" │ or error text are sent — only aggregate usage stats. │");
|
|
134
136
|
console.log(" │ │");
|
|
135
137
|
console.log(" │ Flag events help us improve the anti-flag algorithm │");
|
|
136
138
|
console.log(" │ for everyone. Consider keeping telemetry on! │");
|
|
@@ -182,7 +184,7 @@ export interface TelemetryPayload {
|
|
|
182
184
|
// This is the most important telemetry signal — it drives anti-flag
|
|
183
185
|
// algorithm improvements that benefit all users.
|
|
184
186
|
//
|
|
185
|
-
// NO PII: no email, no error text, no
|
|
187
|
+
// NO PII in the payload: no email, no error text, no projectId, no request body.
|
|
186
188
|
// Only structured, anonymous context about what happened.
|
|
187
189
|
export interface FlagEventData {
|
|
188
190
|
// What triggered it
|
package/src/types.ts
CHANGED
|
@@ -150,14 +150,6 @@ export interface ModelSpecConfig {
|
|
|
150
150
|
isThinking: boolean;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
// Per-model thinking/output spec used by the compat layer.
|
|
154
|
-
// Operators can override defaults via the `modelSpecs` field in accounts.json.
|
|
155
|
-
export interface ModelSpecConfig {
|
|
156
|
-
maxOutputTokens: number;
|
|
157
|
-
thinkingBudget: number; // -1 = adaptive (model decides), >=0 = fixed
|
|
158
|
-
isThinking: boolean;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
153
|
// Per-model quota info for an account
|
|
162
154
|
export interface ModelQuota {
|
|
163
155
|
modelKey: string;
|
|
@@ -345,6 +337,7 @@ export interface PersistedState {
|
|
|
345
337
|
protectivePauseUntil?: number;
|
|
346
338
|
protectivePauseReason?: string | null;
|
|
347
339
|
allowFreshWindowStarts?: boolean;
|
|
340
|
+
autoWarmupEnabled?: boolean;
|
|
348
341
|
safety?: PersistedSafetyState;
|
|
349
342
|
accounts: Record<
|
|
350
343
|
string,
|
|
@@ -396,6 +389,7 @@ export interface StatusResponse {
|
|
|
396
389
|
protectivePauseReason: string | null;
|
|
397
390
|
operatorControls: {
|
|
398
391
|
allowFreshWindowStarts: boolean;
|
|
392
|
+
autoWarmupEnabled: boolean;
|
|
399
393
|
};
|
|
400
394
|
security: {
|
|
401
395
|
adminTokenConfigured: boolean;
|
|
@@ -617,9 +611,10 @@ export const CLIENT_SECRET = atob(
|
|
|
617
611
|
);
|
|
618
612
|
export const TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
619
613
|
|
|
614
|
+
// Production default: use the daily Cloud Code Assist endpoint. The proxy
|
|
615
|
+
// forwarder supports cascading if additional verified endpoints are added here.
|
|
620
616
|
export const ANTIGRAVITY_ENDPOINTS = [
|
|
621
617
|
"https://daily-cloudcode-pa.googleapis.com",
|
|
622
|
-
// "https://cloudcode-pa.googleapis.com",
|
|
623
618
|
] as const;
|
|
624
619
|
|
|
625
620
|
export const QUOTA_API_URL =
|
package/src/version-check.ts
CHANGED
|
@@ -26,6 +26,7 @@ let cachedInfo: UpdateInfo = {
|
|
|
26
26
|
updateAvailable: false,
|
|
27
27
|
checkedAt: 0,
|
|
28
28
|
};
|
|
29
|
+
let initialCheckTimer: ReturnType<typeof setTimeout> | null = null;
|
|
29
30
|
let checkTimer: ReturnType<typeof setInterval> | null = null;
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -123,18 +124,26 @@ export function getUpdateInfo(): UpdateInfo {
|
|
|
123
124
|
*/
|
|
124
125
|
export function startVersionChecker(): void {
|
|
125
126
|
// Initial delayed check
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
if (!initialCheckTimer) {
|
|
128
|
+
initialCheckTimer = setTimeout(() => {
|
|
129
|
+
initialCheckTimer = null;
|
|
130
|
+
void checkForUpdate();
|
|
131
|
+
}, 10_000);
|
|
132
|
+
if (initialCheckTimer.unref) {
|
|
133
|
+
initialCheckTimer.unref();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
129
136
|
|
|
130
137
|
// Periodic check
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
checkTimer.unref
|
|
138
|
+
if (!checkTimer) {
|
|
139
|
+
checkTimer = setInterval(() => {
|
|
140
|
+
void checkForUpdate();
|
|
141
|
+
}, CHECK_INTERVAL_MS);
|
|
142
|
+
|
|
143
|
+
// Don't keep process alive just for version checking
|
|
144
|
+
if (checkTimer.unref) {
|
|
145
|
+
checkTimer.unref();
|
|
146
|
+
}
|
|
138
147
|
}
|
|
139
148
|
}
|
|
140
149
|
|
|
@@ -142,6 +151,10 @@ export function startVersionChecker(): void {
|
|
|
142
151
|
* Stop periodic version checking.
|
|
143
152
|
*/
|
|
144
153
|
export function stopVersionChecker(): void {
|
|
154
|
+
if (initialCheckTimer) {
|
|
155
|
+
clearTimeout(initialCheckTimer);
|
|
156
|
+
initialCheckTimer = null;
|
|
157
|
+
}
|
|
145
158
|
if (checkTimer) {
|
|
146
159
|
clearInterval(checkTimer);
|
|
147
160
|
checkTimer = null;
|
|
@@ -113,7 +113,8 @@ curl -H "Authorization: Bearer YOUR_STATS_TOKEN" https://telemetry.yourdomain.co
|
|
|
113
113
|
|
|
114
114
|
## Security
|
|
115
115
|
|
|
116
|
-
- **No PII is stored**: no emails, tokens,
|
|
116
|
+
- **No PII is stored in telemetry event files**: no emails, tokens, project IDs, request bodies, or error text
|
|
117
|
+
- Source IPs are used transiently for in-memory rate limiting and may be visible to your network, host, or reverse-proxy logs. The receiver does not write IPs into telemetry JSONL event files.
|
|
117
118
|
- Email-pattern detection in validation: payloads containing `@` email patterns are rejected
|
|
118
119
|
- Payloads capped at 4KB
|
|
119
120
|
- Rate limited: 12 req/min per IP
|
|
@@ -269,6 +269,11 @@ const MODEL_PRICING = {
|
|
|
269
269
|
"gemini-3.1-pro-low": { inputPer1M: 2.00, outputPer1M: 12.00 },
|
|
270
270
|
"gemini-3.1-pro-high": { inputPer1M: 2.00, outputPer1M: 12.00 },
|
|
271
271
|
"gemini-3-flash": { inputPer1M: 0.50, outputPer1M: 3.00 },
|
|
272
|
+
"gemini-3.5-flash": { inputPer1M: 1.50, outputPer1M: 9.00 },
|
|
273
|
+
"gemini-3.5-flash-low": { inputPer1M: 1.50, outputPer1M: 9.00 },
|
|
274
|
+
"gemini-3.5-flash-medium": { inputPer1M: 1.50, outputPer1M: 9.00 },
|
|
275
|
+
"gemini-3.5-flash-high": { inputPer1M: 1.50, outputPer1M: 9.00 },
|
|
276
|
+
"gpt-oss-120b-medium": { inputPer1M: 2.00, outputPer1M: 10.00 },
|
|
272
277
|
};
|
|
273
278
|
|
|
274
279
|
function calculateSavings(tokensByModel) {
|