antigravity-claude-proxy 2.9.0 → 2.9.1
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/package.json
CHANGED
package/src/constants.js
CHANGED
|
@@ -202,8 +202,8 @@ export const STRATEGY_LABELS = {
|
|
|
202
202
|
'hybrid': 'Hybrid (Smart Distribution)'
|
|
203
203
|
};
|
|
204
204
|
|
|
205
|
-
// Gemini-specific limits
|
|
206
|
-
export const GEMINI_MAX_OUTPUT_TOKENS =
|
|
205
|
+
// Gemini-specific limits (Gemini 3.8 / Gemini 4 Argon support up to 65536 output tokens)
|
|
206
|
+
export const GEMINI_MAX_OUTPUT_TOKENS = 65536;
|
|
207
207
|
|
|
208
208
|
// Gemini signature handling
|
|
209
209
|
// Sentinel value to skip thought signature validation when Claude Code strips the field
|
|
@@ -202,13 +202,24 @@ export function convertAnthropicToGoogle(anthropicRequest) {
|
|
|
202
202
|
googleRequest.generationConfig.thinkingConfig = thinkingConfig;
|
|
203
203
|
} else if (isGeminiModel) {
|
|
204
204
|
// Gemini thinking config (uses camelCase)
|
|
205
|
-
//
|
|
205
|
+
// For callers that did not explicitly request thinking and asked for small max_tokens,
|
|
206
|
+
// use minimal thinking budget (32) and reserve output headroom so thinking doesn't
|
|
207
|
+
// consume the entire maxOutputTokens budget and return empty text.
|
|
208
|
+
const requestedBudget = thinking?.budget_tokens
|
|
209
|
+
? clampGeminiThinkingBudget(modelName, thinking.budget_tokens)
|
|
210
|
+
: (max_tokens && max_tokens <= 1024 ? 32 : clampGeminiThinkingBudget(modelName, undefined));
|
|
206
211
|
const thinkingConfig = {
|
|
207
|
-
includeThoughts:
|
|
208
|
-
thinkingBudget:
|
|
212
|
+
includeThoughts: Boolean(thinking?.type === 'enabled' || thinking?.budget_tokens || !max_tokens || max_tokens > 256),
|
|
213
|
+
thinkingBudget: requestedBudget
|
|
209
214
|
};
|
|
210
215
|
logger.debug(`[RequestConverter] Gemini thinking enabled with budget: ${thinkingConfig.thinkingBudget}`);
|
|
211
216
|
|
|
217
|
+
const currentMaxTokens = googleRequest.generationConfig.maxOutputTokens;
|
|
218
|
+
if (currentMaxTokens && currentMaxTokens <= thinkingConfig.thinkingBudget) {
|
|
219
|
+
const adjustedMaxTokens = Math.min(thinkingConfig.thinkingBudget + Math.max(currentMaxTokens, 8192), GEMINI_MAX_OUTPUT_TOKENS);
|
|
220
|
+
logger.debug(`[RequestConverter] Adjusting Gemini maxOutputTokens from ${currentMaxTokens} to ${adjustedMaxTokens} to exceed thinkingBudget (${thinkingConfig.thinkingBudget})`);
|
|
221
|
+
googleRequest.generationConfig.maxOutputTokens = adjustedMaxTokens;
|
|
222
|
+
}
|
|
212
223
|
|
|
213
224
|
googleRequest.generationConfig.thinkingConfig = thinkingConfig;
|
|
214
225
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { MIN_SIGNATURE_LENGTH } from '../constants.js';
|
|
7
|
-
import { getCachedSignatureFamily } from './signature-cache.js';
|
|
7
|
+
import { getCachedSignature, getCachedSignatureFamily } from './signature-cache.js';
|
|
8
8
|
import { logger } from '../utils/logger.js';
|
|
9
9
|
|
|
10
10
|
// ============================================================================
|
|
@@ -447,6 +447,11 @@ function messageHasValidThinking(message) {
|
|
|
447
447
|
const content = message.content || message.parts || [];
|
|
448
448
|
if (!Array.isArray(content)) return false;
|
|
449
449
|
return content.some(block => {
|
|
450
|
+
if (block && (block.type === 'tool_use' || block.functionCall)) {
|
|
451
|
+
if (block.thoughtSignature && block.thoughtSignature.length >= MIN_SIGNATURE_LENGTH) return true;
|
|
452
|
+
if (block.id && getCachedSignature(block.id)) return true;
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
450
455
|
if (!isThinkingPart(block)) return false;
|
|
451
456
|
// Check for valid signature (Anthropic style)
|
|
452
457
|
if (block.signature && block.signature.length >= MIN_SIGNATURE_LENGTH) return true;
|