anygate 0.5.3 → 0.5.5
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/dist/{chunk-QPXRFBQI.js → chunk-CH5IEXJN.js} +376 -90
- package/dist/chunk-CH5IEXJN.js.map +1 -0
- package/dist/cli.js +77 -5
- package/dist/cli.js.map +1 -1
- package/dist/{command-M5GMEJCO.js → command-QEYVYS7O.js} +71 -22
- package/dist/command-QEYVYS7O.js.map +1 -0
- package/dist/ui/dist/assets/index-BBg1LGms.js +5 -0
- package/dist/ui/dist/assets/index-CeN2cmwU.css +1 -0
- package/dist/ui/dist/favicon.svg +13 -0
- package/dist/ui/dist/index.html +18 -0
- package/package.json +92 -90
- package/dist/chunk-QPXRFBQI.js.map +0 -1
- package/dist/command-M5GMEJCO.js.map +0 -1
- package/dist/ui/public/app.js +0 -2450
- package/dist/ui/public/icon-antigravity-ide.png +0 -0
- package/dist/ui/public/icon-antigravity.png +0 -0
- package/dist/ui/public/index.html +0 -217
- package/dist/ui/public/style.css +0 -1751
package/dist/cli.js
CHANGED
|
@@ -128,6 +128,7 @@ import {
|
|
|
128
128
|
readGlobalOpencodeCredential,
|
|
129
129
|
readOpencodeAuthFile,
|
|
130
130
|
recordLaunchSelection,
|
|
131
|
+
recordUsage,
|
|
131
132
|
refreshAllProviderModels,
|
|
132
133
|
refreshModelsDevCacheAsync,
|
|
133
134
|
refreshProviderModels,
|
|
@@ -168,7 +169,7 @@ import {
|
|
|
168
169
|
validateCustomEndpointUrl,
|
|
169
170
|
writeSecureLogLine,
|
|
170
171
|
zenRegistryStub
|
|
171
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-CH5IEXJN.js";
|
|
172
173
|
import {
|
|
173
174
|
filterTemplates,
|
|
174
175
|
getTemplateById,
|
|
@@ -4131,6 +4132,7 @@ function buildCloudCodeProxyRoute(model, apiKey, providerData) {
|
|
|
4131
4132
|
contextWindow: model.contextWindow,
|
|
4132
4133
|
providerId: "antigravity",
|
|
4133
4134
|
authType: "oauth",
|
|
4135
|
+
app: "Antigravity",
|
|
4134
4136
|
providerData,
|
|
4135
4137
|
refreshToken: () => resolveProviderCredential("antigravity", oauthAuthRef("antigravity"))
|
|
4136
4138
|
};
|
|
@@ -4150,6 +4152,7 @@ function buildOAuthAnthropicProxyRoute(model, apiKey, providerId, providerData)
|
|
|
4150
4152
|
contextWindow: model.contextWindow,
|
|
4151
4153
|
providerId,
|
|
4152
4154
|
authType: "oauth",
|
|
4155
|
+
app: "Claude",
|
|
4153
4156
|
providerData,
|
|
4154
4157
|
refreshToken: () => resolveProviderCredential(providerId, oauthAuthRef(providerId))
|
|
4155
4158
|
};
|
|
@@ -8143,19 +8146,67 @@ async function handleCloudCodeForwardRequest(res, route, parsed, lowerUrl, log15
|
|
|
8143
8146
|
res.end();
|
|
8144
8147
|
return;
|
|
8145
8148
|
}
|
|
8149
|
+
let inputTokens2 = 0;
|
|
8150
|
+
let outputTokens2 = 0;
|
|
8151
|
+
const decoder = new TextDecoder();
|
|
8152
|
+
let buf = "";
|
|
8146
8153
|
for await (const chunk of upstream.body) {
|
|
8154
|
+
const text4 = decoder.decode(chunk, { stream: true });
|
|
8155
|
+
buf += text4;
|
|
8156
|
+
const lines = buf.split("\n");
|
|
8157
|
+
buf = lines.pop() ?? "";
|
|
8158
|
+
for (const line2 of lines) {
|
|
8159
|
+
const t = line2.startsWith("data: ") ? line2.slice(6).trim() : line2.trim();
|
|
8160
|
+
if (!t || t === "[DONE]") continue;
|
|
8161
|
+
try {
|
|
8162
|
+
const obj = JSON.parse(t);
|
|
8163
|
+
const u = obj.response?.usageMetadata;
|
|
8164
|
+
if (u) {
|
|
8165
|
+
inputTokens2 = u.promptTokenCount ?? inputTokens2;
|
|
8166
|
+
outputTokens2 = u.candidatesTokenCount ?? outputTokens2;
|
|
8167
|
+
}
|
|
8168
|
+
} catch {
|
|
8169
|
+
}
|
|
8170
|
+
}
|
|
8147
8171
|
res.write(chunk);
|
|
8148
8172
|
}
|
|
8149
8173
|
res.end();
|
|
8174
|
+
recordUsage({
|
|
8175
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8176
|
+
modelId: route.displayName,
|
|
8177
|
+
providerId: route.providerId,
|
|
8178
|
+
app: "Antigravity",
|
|
8179
|
+
inputTokens: inputTokens2,
|
|
8180
|
+
outputTokens: outputTokens2
|
|
8181
|
+
});
|
|
8150
8182
|
return;
|
|
8151
8183
|
}
|
|
8152
8184
|
const body = await upstream.text();
|
|
8185
|
+
let inputTokens = 0;
|
|
8186
|
+
let outputTokens = 0;
|
|
8187
|
+
try {
|
|
8188
|
+
const obj = JSON.parse(body);
|
|
8189
|
+
const u = obj.response?.usageMetadata;
|
|
8190
|
+
if (u) {
|
|
8191
|
+
inputTokens = u.promptTokenCount ?? 0;
|
|
8192
|
+
outputTokens = u.candidatesTokenCount ?? 0;
|
|
8193
|
+
}
|
|
8194
|
+
} catch {
|
|
8195
|
+
}
|
|
8153
8196
|
res.writeHead(200, {
|
|
8154
8197
|
"content-type": upstream.headers.get("content-type") ?? "application/json",
|
|
8155
8198
|
"content-length": String(Buffer.byteLength(body)),
|
|
8156
8199
|
"grpc-status": "0"
|
|
8157
8200
|
});
|
|
8158
8201
|
res.end(body);
|
|
8202
|
+
recordUsage({
|
|
8203
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8204
|
+
modelId: route.displayName,
|
|
8205
|
+
providerId: route.providerId,
|
|
8206
|
+
app: "Antigravity",
|
|
8207
|
+
inputTokens,
|
|
8208
|
+
outputTokens
|
|
8209
|
+
});
|
|
8159
8210
|
}
|
|
8160
8211
|
function emitThinkingDelta(res, route, responseId, text4, startSse) {
|
|
8161
8212
|
if (!text4) return;
|
|
@@ -8351,6 +8402,15 @@ async function handleStreamingRequest(res, route, providerOptions, parsed, log15
|
|
|
8351
8402
|
res.write(`data: ${JSON.stringify(chunk)}
|
|
8352
8403
|
|
|
8353
8404
|
`);
|
|
8405
|
+
recordUsage({
|
|
8406
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8407
|
+
modelId: route.displayName,
|
|
8408
|
+
npm: route.npm,
|
|
8409
|
+
providerId: route.providerId,
|
|
8410
|
+
app: "Antigravity",
|
|
8411
|
+
inputTokens: p16.totalUsage?.inputTokens ?? 0,
|
|
8412
|
+
outputTokens: p16.totalUsage?.outputTokens ?? 0
|
|
8413
|
+
});
|
|
8354
8414
|
} else if (p16.type === "error") {
|
|
8355
8415
|
const message = formatUpstreamError(p16.error);
|
|
8356
8416
|
log15(`[gateway] stream provider error: ${message}`);
|
|
@@ -8431,6 +8491,15 @@ async function handleUnaryRequest(res, route, providerOptions, parsed, _log, opt
|
|
|
8431
8491
|
responseId
|
|
8432
8492
|
};
|
|
8433
8493
|
respondJson(res, 200, { response, traceId: "gateway-trace", metadata: {} });
|
|
8494
|
+
recordUsage({
|
|
8495
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8496
|
+
modelId: route.displayName,
|
|
8497
|
+
npm: route.npm,
|
|
8498
|
+
providerId: route.providerId,
|
|
8499
|
+
app: "Antigravity",
|
|
8500
|
+
inputTokens: result.usage?.inputTokens ?? 0,
|
|
8501
|
+
outputTokens: result.usage?.outputTokens ?? 0
|
|
8502
|
+
});
|
|
8434
8503
|
}
|
|
8435
8504
|
|
|
8436
8505
|
// src/gateway/antigravity/launch-routes.ts
|
|
@@ -12624,7 +12693,8 @@ Error: ${launchPlan.error}
|
|
|
12624
12693
|
providerId: activeProvider.id,
|
|
12625
12694
|
authType: "oauth",
|
|
12626
12695
|
providerData: activeProvider.providerData,
|
|
12627
|
-
modelFormat: "cloud-code"
|
|
12696
|
+
modelFormat: "cloud-code",
|
|
12697
|
+
app: "Antigravity"
|
|
12628
12698
|
},
|
|
12629
12699
|
launchApiKey
|
|
12630
12700
|
);
|
|
@@ -12652,7 +12722,8 @@ Error: ${launchPlan.error}
|
|
|
12652
12722
|
authType: "oauth",
|
|
12653
12723
|
oauthAccountId: activeProvider.oauthAccountId,
|
|
12654
12724
|
providerData: activeProvider.providerData,
|
|
12655
|
-
modelFormat: "anthropic"
|
|
12725
|
+
modelFormat: "anthropic",
|
|
12726
|
+
app: "Claude"
|
|
12656
12727
|
},
|
|
12657
12728
|
launchApiKey
|
|
12658
12729
|
);
|
|
@@ -12694,7 +12765,8 @@ Error: ${launchPlan.error}
|
|
|
12694
12765
|
reasoning: selectedModel.reasoning,
|
|
12695
12766
|
interleavedReasoningField: selectedModel.interleavedReasoningField,
|
|
12696
12767
|
useResponsesLite: selectedModel.useResponsesLite,
|
|
12697
|
-
preferWebSockets: selectedModel.preferWebSockets
|
|
12768
|
+
preferWebSockets: selectedModel.preferWebSockets,
|
|
12769
|
+
app: "Claude"
|
|
12698
12770
|
},
|
|
12699
12771
|
launchApiKey
|
|
12700
12772
|
);
|
|
@@ -12797,7 +12869,7 @@ Error: ${parsed.error}
|
|
|
12797
12869
|
console.log("Usage: anygate ui [--trace]\n\nOpen the settings UI in your browser.");
|
|
12798
12870
|
return 0;
|
|
12799
12871
|
}
|
|
12800
|
-
const { runUiCommand } = await import("./command-
|
|
12872
|
+
const { runUiCommand } = await import("./command-QEYVYS7O.js");
|
|
12801
12873
|
return runUiCommand({ trace: parsed.trace });
|
|
12802
12874
|
}
|
|
12803
12875
|
if (parsed.command === "models") {
|