@expiren/opencode-antigravity-auth 1.6.38 → 1.6.40
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/index.js +22 -13
- package/dist/index.js.map +2 -2
- package/dist/src/plugin/request.d.ts +6 -0
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +17 -3
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/plugin.js +6 -1
- package/dist/src/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7556,6 +7556,10 @@ function ensureThinkingBeforeToolUseInMessages(messages, signatureSessionKey) {
|
|
|
7556
7556
|
}) };
|
|
7557
7557
|
});
|
|
7558
7558
|
}
|
|
7559
|
+
var _lastCacheStats = null;
|
|
7560
|
+
function getLastCacheStats() {
|
|
7561
|
+
return _lastCacheStats;
|
|
7562
|
+
}
|
|
7559
7563
|
function generateSyntheticProjectId() {
|
|
7560
7564
|
const adjectives = ["useful", "bright", "swift", "calm", "bold"];
|
|
7561
7565
|
const nouns = ["fuze", "wave", "spark", "flow", "core"];
|
|
@@ -8151,12 +8155,13 @@ async function transformAntigravityResponse(response, streaming, debugContext, r
|
|
|
8151
8155
|
onInjectDebug: injectDebugThinking,
|
|
8152
8156
|
onUsageMetadata: (usage) => {
|
|
8153
8157
|
if (effectiveModel) {
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
);
|
|
8158
|
+
const cacheRead = usage.cachedContentTokenCount;
|
|
8159
|
+
const totalInput = usage.promptTokenCount ?? usage.totalTokenCount;
|
|
8160
|
+
const hitRate = totalInput > 0 ? Math.round(cacheRead / totalInput * 100) : 0;
|
|
8161
|
+
const status = cacheRead > 0 ? "HIT" : "MISS";
|
|
8162
|
+
logCacheStats(effectiveModel, cacheRead, 0, totalInput);
|
|
8163
|
+
log6.debug(`[Cache] ${status} model=${effectiveModel} read=${cacheRead} total=${totalInput} hitRate=${hitRate}%`);
|
|
8164
|
+
_lastCacheStats = { model: effectiveModel, read: cacheRead, total: totalInput, hitRate };
|
|
8160
8165
|
}
|
|
8161
8166
|
},
|
|
8162
8167
|
transformThinkingParts
|
|
@@ -8254,13 +8259,12 @@ ${debugText}` : "";
|
|
|
8254
8259
|
const effectiveBody = patched ?? parsed ?? void 0;
|
|
8255
8260
|
const usage = usageFromSse ?? (effectiveBody ? extractUsageMetadata(effectiveBody) : null);
|
|
8256
8261
|
if (usage && effectiveModel) {
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
);
|
|
8262
|
+
const cacheRead = usage.cachedContentTokenCount ?? 0;
|
|
8263
|
+
const totalInput = usage.promptTokenCount ?? usage.totalTokenCount ?? 0;
|
|
8264
|
+
const hitRate = totalInput > 0 ? Math.round(cacheRead / totalInput * 100) : 0;
|
|
8265
|
+
const status = cacheRead > 0 ? "HIT" : "MISS";
|
|
8266
|
+
logCacheStats(effectiveModel, cacheRead, 0, totalInput);
|
|
8267
|
+
log6.debug(`[Cache] ${status} model=${effectiveModel} read=${cacheRead} total=${totalInput} hitRate=${hitRate}%`);
|
|
8264
8268
|
}
|
|
8265
8269
|
if (usage?.cachedContentTokenCount !== void 0) {
|
|
8266
8270
|
headers.set("x-antigravity-cached-content-token-count", String(usage.cachedContentTokenCount));
|
|
@@ -12324,6 +12328,11 @@ var createAntigravityPlugin = (providerId) => async ({ client, directory }) => {
|
|
|
12324
12328
|
debugLines.push(line);
|
|
12325
12329
|
};
|
|
12326
12330
|
pushDebug(`request=${urlString}`);
|
|
12331
|
+
const cachedStats = getLastCacheStats();
|
|
12332
|
+
if (cachedStats) {
|
|
12333
|
+
const label = cachedStats.hitRate > 0 ? "HIT" : "MISS";
|
|
12334
|
+
pushDebug(`[Cache] ${label} model=${cachedStats.model} read=${cachedStats.read} total=${cachedStats.total} hitRate=${cachedStats.hitRate}%`);
|
|
12335
|
+
}
|
|
12327
12336
|
let lastFailure = null;
|
|
12328
12337
|
let lastError = null;
|
|
12329
12338
|
const abortSignal = init?.signal ?? void 0;
|