@expiren/opencode-antigravity-auth 1.6.40 → 1.6.41
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 +59 -0
- package/dist/index.js.map +2 -2
- package/dist/src/plugin/config/schema.d.ts +1 -0
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +12 -0
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/plugin.js +45 -0
- package/dist/src/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3226,6 +3226,17 @@ var AntigravityConfigSchema = z2.object({
|
|
|
3226
3226
|
* @default false
|
|
3227
3227
|
*/
|
|
3228
3228
|
thinking_warmup: z2.boolean().default(false),
|
|
3229
|
+
/**
|
|
3230
|
+
* Send a lightweight cache-seeding probe when switching to a different account.
|
|
3231
|
+
* The probe reuses the same request prefix with maxOutputTokens=1 so the
|
|
3232
|
+
* server-side implicit cache warms up before the real request fires.
|
|
3233
|
+
* Costs ~1 quota unit per account switch but eliminates the 0% cold-cache
|
|
3234
|
+
* MISS that otherwise occurs on every rotation.
|
|
3235
|
+
*
|
|
3236
|
+
* Env override: OPENCODE_ANTIGRAVITY_CACHE_WARMUP_ON_SWITCH=1
|
|
3237
|
+
* @default true
|
|
3238
|
+
*/
|
|
3239
|
+
cache_warmup_on_switch: z2.boolean().default(true),
|
|
3229
3240
|
// =========================================================================
|
|
3230
3241
|
// Session Recovery
|
|
3231
3242
|
// =========================================================================
|
|
@@ -3525,6 +3536,7 @@ var DEFAULT_CONFIG = {
|
|
|
3525
3536
|
debug_tui: false,
|
|
3526
3537
|
keep_thinking: false,
|
|
3527
3538
|
thinking_warmup: false,
|
|
3539
|
+
cache_warmup_on_switch: true,
|
|
3528
3540
|
session_recovery: true,
|
|
3529
3541
|
auto_resume: true,
|
|
3530
3542
|
resume_text: "continue",
|
|
@@ -12369,6 +12381,8 @@ var createAntigravityPlugin = (providerId) => async ({ client, directory }) => {
|
|
|
12369
12381
|
};
|
|
12370
12382
|
let accountSwitchCount = 0;
|
|
12371
12383
|
const maxAccountSwitches = config.max_account_switches ?? 2;
|
|
12384
|
+
let previousAccountIndex = -1;
|
|
12385
|
+
let needsCacheWarmup = false;
|
|
12372
12386
|
while (true) {
|
|
12373
12387
|
checkAborted();
|
|
12374
12388
|
const accountCount = accountManager.getAccountCount();
|
|
@@ -12475,6 +12489,11 @@ var createAntigravityPlugin = (providerId) => async ({ client, directory }) => {
|
|
|
12475
12489
|
pushDebug(
|
|
12476
12490
|
`selected idx=${account.index} email=${account.email ?? ""} family=${family} accounts=${accountCount} strategy=${config.account_selection_strategy}`
|
|
12477
12491
|
);
|
|
12492
|
+
if (previousAccountIndex >= 0 && previousAccountIndex !== account.index) {
|
|
12493
|
+
needsCacheWarmup = config.cache_warmup_on_switch;
|
|
12494
|
+
pushDebug(`account-switch: ${previousAccountIndex} \u2192 ${account.index}, warmup=${needsCacheWarmup}`);
|
|
12495
|
+
}
|
|
12496
|
+
previousAccountIndex = account.index;
|
|
12478
12497
|
if (isDebugEnabled()) {
|
|
12479
12498
|
logAccountContext("Selected", {
|
|
12480
12499
|
index: account.index,
|
|
@@ -12646,6 +12665,45 @@ var createAntigravityPlugin = (providerId) => async ({ client, directory }) => {
|
|
|
12646
12665
|
);
|
|
12647
12666
|
}
|
|
12648
12667
|
};
|
|
12668
|
+
const runCacheWarmupProbe = async (prepared) => {
|
|
12669
|
+
if (!needsCacheWarmup) return;
|
|
12670
|
+
needsCacheWarmup = false;
|
|
12671
|
+
const bodyStr = typeof prepared.init.body === "string" ? prepared.init.body : void 0;
|
|
12672
|
+
if (!bodyStr) return;
|
|
12673
|
+
try {
|
|
12674
|
+
const parsed = JSON.parse(bodyStr);
|
|
12675
|
+
parsed.generationConfig = {
|
|
12676
|
+
...parsed.generationConfig ?? {},
|
|
12677
|
+
maxOutputTokens: 1,
|
|
12678
|
+
candidateCount: 1
|
|
12679
|
+
};
|
|
12680
|
+
if (parsed.generationConfig.thinkingConfig) {
|
|
12681
|
+
parsed.generationConfig.thinkingConfig = {
|
|
12682
|
+
thinkingBudget: 0
|
|
12683
|
+
};
|
|
12684
|
+
}
|
|
12685
|
+
const probeHeaders = new Headers(prepared.init.headers ?? {});
|
|
12686
|
+
probeHeaders.set("accept", "application/json");
|
|
12687
|
+
const probeUrl = toUrlString(prepared.request).replace(
|
|
12688
|
+
":streamGenerateContent?alt=sse",
|
|
12689
|
+
":generateContent"
|
|
12690
|
+
);
|
|
12691
|
+
pushDebug("cache-warmup-probe: start");
|
|
12692
|
+
const probeResponse = await fetch(probeUrl, {
|
|
12693
|
+
...prepared.init,
|
|
12694
|
+
method: "POST",
|
|
12695
|
+
headers: probeHeaders,
|
|
12696
|
+
body: JSON.stringify(parsed)
|
|
12697
|
+
});
|
|
12698
|
+
await probeResponse.text();
|
|
12699
|
+
const status = probeResponse.status;
|
|
12700
|
+
pushDebug(`cache-warmup-probe: done status=${status}`);
|
|
12701
|
+
} catch (error) {
|
|
12702
|
+
pushDebug(
|
|
12703
|
+
`cache-warmup-probe: failed ${error instanceof Error ? error.message : String(error)}`
|
|
12704
|
+
);
|
|
12705
|
+
}
|
|
12706
|
+
};
|
|
12649
12707
|
let apiRequestCount = 0;
|
|
12650
12708
|
let shouldSwitchAccount = false;
|
|
12651
12709
|
let headerStyle = preferredHeaderStyle;
|
|
@@ -12756,6 +12814,7 @@ var createAntigravityPlugin = (providerId) => async ({ client, directory }) => {
|
|
|
12756
12814
|
toolDebugPayload: prepared.toolDebugPayload
|
|
12757
12815
|
});
|
|
12758
12816
|
await runThinkingWarmup(prepared, projectContext.effectiveProjectId);
|
|
12817
|
+
await runCacheWarmupProbe(prepared);
|
|
12759
12818
|
if (config.request_jitter_max_ms > 0) {
|
|
12760
12819
|
const jitterMs = Math.floor(Math.random() * config.request_jitter_max_ms);
|
|
12761
12820
|
if (jitterMs > 0) {
|