@expiren/opencode-antigravity-auth 1.6.47 → 1.6.49

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 CHANGED
@@ -12733,35 +12733,42 @@ var createAntigravityPlugin = (providerId) => async ({ client, directory }) => {
12733
12733
  const bodyStr = typeof prepared.init.body === "string" ? prepared.init.body : void 0;
12734
12734
  if (!bodyStr) return;
12735
12735
  try {
12736
- const parsed = JSON.parse(bodyStr);
12737
- const originalThinking = parsed.generationConfig?.thinkingConfig;
12738
- parsed.generationConfig = {
12739
- maxOutputTokens: originalThinking ? 256 : 1,
12740
- ...originalThinking ? { thinkingConfig: { thinkingBudget: 128 } } : {}
12741
- };
12742
12736
  pushDebug("cache-warmup-probe: start");
12737
+ let probeBody = bodyStr;
12738
+ try {
12739
+ const parsed = JSON.parse(bodyStr);
12740
+ if (parsed.request && typeof parsed.request === "object") {
12741
+ const req = { ...parsed.request };
12742
+ delete req.generationConfig;
12743
+ delete req.thinkingConfig;
12744
+ delete req.tools;
12745
+ delete req.toolConfig;
12746
+ delete req.safetySettings;
12747
+ probeBody = JSON.stringify({ ...parsed, request: req });
12748
+ }
12749
+ } catch {
12750
+ }
12743
12751
  const probeResponse = await fetch(toUrlString(prepared.request), {
12744
12752
  ...prepared.init,
12745
12753
  method: "POST",
12746
- body: JSON.stringify(parsed)
12754
+ body: probeBody
12747
12755
  });
12748
- let probeBody = "";
12749
12756
  if (probeResponse.body) {
12750
12757
  const reader = probeResponse.body.getReader();
12751
- const decoder = new TextDecoder();
12752
- let chunk;
12753
- while (!(chunk = await reader.read()).done) {
12754
- probeBody += decoder.decode(chunk.value, { stream: true });
12755
- }
12756
- } else {
12757
- probeBody = await probeResponse.text();
12758
+ await reader.read();
12759
+ await reader.cancel();
12758
12760
  }
12759
12761
  const status = probeResponse.status;
12760
12762
  if (status >= 400) {
12761
- const errorSnippet = probeBody.slice(0, 200);
12762
- pushDebug(`cache-warmup-probe: done status=${status} error=${errorSnippet}`);
12763
+ let errorSnippet = "";
12764
+ try {
12765
+ const errText = await probeResponse.text().catch(() => "");
12766
+ errorSnippet = errText.slice(0, 200);
12767
+ } catch {
12768
+ }
12769
+ pushDebug(`cache-warmup-probe: done status=${status}${errorSnippet ? ` error=${errorSnippet}` : ""}`);
12763
12770
  } else {
12764
- pushDebug(`cache-warmup-probe: done status=${status}`);
12771
+ pushDebug(`cache-warmup-probe: done status=${status} (aborted after first chunk)`);
12765
12772
  }
12766
12773
  } catch (error) {
12767
12774
  pushDebug(