Commit Graph

32 Commits

Author SHA1 Message Date
Luis Pater
2dce19ed2f fix(antigravity): preserve signature cache grant scope across Home OAuth refreshes
- Rebind cpa_signature_cache_grant and cpa_signature_cache_grant_binding after RefreshAuthViaHome in Refresh and ensureAccessTokenWithOptions only when account continuity is verified.
- Align Home-dispatched Antigravity credentials with Home's enum scope and home_binding so Claude thinking signature scopes stay consistent across token rotations and rolling Home upgrades.
- Add regression tests covering Home refresh scope preservation, cross-account isolation, and bidirectional rolling-upgrade cache lookups.

Closes: #8168
2026-11-26 07:45:39 +08:00
Luis Pater
b11aacdd2b fix(antigravity): enforce claude min thinking budget and max_output_tokens cap
- Strip thinkingConfig and thinking_config in CapAntigravityMaxOutputTokensDoc when clamping a numeric Claude thinking budget would fall below 1024 while leaving non-numeric, dynamic, and level-based configs untouched.
- Recognize numeric snake_case max_output_tokens aliases capped by model MaxCompletionTokens in effectiveMaxTokensDoc and apply the same catalog output cap in buildRequestForModelDoc.
- Add unit tests covering sub-1024 Claude budget stripping, snake_case max_output_tokens handling, and catalog-limit clamping.

Closes: #8165
2026-11-26 07:29:10 +08:00
Luis Pater
531aea156a fix(util): normalize numeric protobuf Schema.Type enums in Gemini schemas
- Decode numeric protobuf Schema.Type enum values (1..7) to lowercase JSON Schema type strings via *ojson.Doc in NormalizeJSONSchemaNumericConstraints while preserving literals and special property keys.
- Normalize schemas prior to nested wrapper cleaning, Claude 5.5 structured output prompt fallback, Interactions response_format emission, and snake_case Gemini pass-through schema fields.
- Add regression tests covering schema cleaners, Antigravity executor paths, and Gemini-ingress translators.

Closes: #8032
2026-11-25 11:41:46 +08:00
Luis Pater
14a95b19e2 fix(antigravity): preserve thinking-group output caps
- Preserve smaller caller output limits while applying thinking-group catalog caps.
- Clamp Claude thinking budgets and normalize output token aliases before payload rules run.

Closes: #7985
2026-11-24 09:48:07 +08:00
Luis Pater
38067a2997 fix(antigravity): align outbound request wire format
- Preserve normalizer request IDs and correlation labels while generating slash-delimited native fallbacks.
- Normalize native tool output keys and single-part system instructions across Antigravity request paths.

Closes: #7967
2026-11-24 07:06:16 +08:00
Luis Pater
85225381d8 fix(antigravity): isolate signature cache by credential
- Scope Claude signature recovery and writes to the active credential.
- Preserve scoped cache continuity across verified token refreshes.
- Fail closed for unscoped recovery and credential replacement.
- Add stream and non-stream multi-account isolation regression coverage.

Closes: #7960
2026-11-23 22:46:33 +08:00
Luis Pater
2f86992c94 feat(antigravity): route grouped models by requested thinking level 2026-11-23 13:23:05 +08:00
Luis Pater
16bcf5a072 fix(antigravity): re-clamp Claude thinking budget after output cap
- Clamp Claude thinking budgets when the model output limit reduces maxOutputTokens below an accepted requested ceiling.
- Add regression coverage for Antigravity Sonnet and Opus models, including case-insensitive model resolution.

Closes: #7916
2026-11-23 12:32:55 +08:00
Luis Pater
b8e3bc6647 feat(antigravity): align and minify upstream model requests
Resolve model enums per credential and correlate agent request IDs with session labels. Preserve the reference key order for agent envelopes and remove formatting whitespace when serializing all model requests.
2026-11-23 11:08:44 +08:00
Luis Pater
ca43428b98 Revert "fix(antigravity): set X-Goog-User-Project header on Cloud Code PA requests"
This reverts commit acf238f6a9.
2026-11-22 17:35:10 +08:00
Luis Pater
55e5a7ead8 fix(antigravity): use signed int64 session IDs matching Hub format
- Generate random and deterministic session IDs as signed 64-bit decimal values, using FNV-1a for stable IDs.
- Preserve negative signs in reasoning replay keys and test positive/negative ID coverage.

Closes: #7857
2026-11-22 17:20:32 +08:00
Luis Pater
14e12fb5d3 fix(antigravity): scope incoming request.sessionId per credential and subagent
- Prefer credential-scoped derived session IDs over raw incoming request.sessionId values when auth.ID is set, and deterministically scope direct incoming session IDs via ScopeAntigravitySessionIDForAuth across standard, image, and web_search requests without synthesizing sessionId when absent.
- Preserve verbatim incoming request.sessionId when auth.ID is empty while keeping reasoning replay keying and final payload barrier rules unchanged.
- Add regression tests covering Gemini, native Antigravity, image, web_search, unenriched direct calls, subagent isolation, anonymous auth preservation, and payload override/filter barriers.

Closes: #7838
2026-11-22 15:54:08 +08:00
Luis Pater
acf238f6a9 fix(antigravity): set X-Goog-User-Project header on Cloud Code PA requests
- Attach X-Goog-User-Project whenever a non-empty project_id is available across generation, countTokens, fetchAvailableModels, credits loadCodeAssist, PrepareRequest, HttpRequest, and fetch_antigravity_models requests before custom header overrides.
- Scope automatic injection in PrepareRequest and HttpRequest to Cloud Code PA endpoints or matching per-auth base_url targets, and clear stale headers when switching credentials on a reused request.
- Apply cross-origin redirect header stripping across Antigravity executor HTTP clients and disable redirects in fetch_antigravity_models so project IDs cannot leak across origins.

Closes: #7837
2026-11-22 15:47:36 +08:00
Luis Pater
94b164bf16 fix(antigravity): enforce short cooldowns, 429 bookkeeping, and schema sanitization in CountTokens
- Enforce active short-cooldown checks at CountTokens entry without credits bypass and share model-aware schema sanitization with buildRequestDoc before payload finalization.
- Route CountTokens HTTP 429 responses through shared 429 state bookkeeping with single idle-transport eviction per response and bound CountTokens response reads to 1 MiB.
- Add regression tests covering short-cooldown gating, 429 bookkeeping, bounded response reads, model schema sanitization, and payload-finalizer ordering.

Closes: #7786
2026-11-22 04:17:12 +08:00
Luis Pater
e0cc1cf876 fix(antigravity): preserve NONE tool calling mode for Claude models
- Skip overwriting functionCallingConfig.mode with VALIDATED in buildRequestDoc when the request already specifies mode NONE under camelCase or snake_case proto-JSON paths, canonicalizing non-canonical NONE strings in place.
- Add regression tests covering OpenAI Chat Completions, OpenAI Responses, Claude, Gemini, proto-JSON alias spellings, and final payload rule precedence on Antigravity Claude models.

Closes: #7792
2026-11-22 04:04:41 +08:00
Luis Pater
18a03e40c1 fix(antigravity): scan all user parts for session ID and match models case-insensitively
- Scan all parts of the first user turn in generateStableSessionIDFromContentsForAuth for the first non-empty text part so multimodal turns retain a stable sessionId across turns.
- Normalize model names to lowercase in buildRequestDoc, geminiToAntigravityDocForAuth, and Execute routing, including lowercase fallback lookup when capping maxOutputTokens.
- Add regression tests covering multimodal Turn 1 session ID stability and case-insensitive Claude, Gemini Pro, and image model handling.

Closes: #7760
2026-11-21 20:20:41 +08:00
Luis Pater
3a24d03cdd feat(antigravity): scope synthesized request.sessionId per credential
- Derive synthesized Antigravity request.sessionId deterministically from auth.ID and canonical, execution, or derived session identity across non-stream, Claude non-stream, and streaming paths.
- Scope the content-based fallback session ID by auth.ID so credential failovers emit a fresh request.sessionId while keeping explicit request.sessionId values and reasoning replay keys unchanged.
- Add regression tests verifying cross-model stability on the same credential and sessionId rotation across credential failover.

Closes: #7706
2026-11-20 08:30:42 +08:00
sususu98
cc95661ce4 feat(gemini): support asymmetric thoughtSignature replay KV across Gemini executors 2026-11-09 18:54:46 +08:00
Luis Pater
6e6afab99a refactor: migrate gjson, sjson, and base64 to MoeForge/moego
- Replace tidwall/gjson and tidwall/sjson with github.com/MoeForge/moego/ojson
  and encoding/base64 with github.com/MoeForge/moego/base64 across the main
  module and examples
- Introduce cross-method *ojson.Doc request rewriting pipelines across
  thinking, signature, client/codex, runtime/executor/helps, pluginhost, and
  all provider executors with FinalizePayloadDoc as the final semantic barrier
- Convert all consecutive JSON mutations (>= 2 Set/SetRaw/Delete operations)
  to batch edits on ojson.Doc
- Upgrade read-only byte paths to ojson.GetBytesNoCopy,
  ojson.GetManyBytesNoCopy, and util.ParseGJSONBytesNoCopy with explicit
  strings.Clone ownership protection across streaming and persistent state
- Use base64.StdEncoding.ValidateString for zero-allocation signature checks
  and base64.EncodeDataURL for single-allocation data URL construction
2026-11-03 03:05:04 +08:00
Luis Pater
1d45a5f332 fix(claude): handle forced tool restrictions in claude 5.5
- Fall back to schema prompts for Antigravity Claude 5.5 while preserving unrelated request settings.
- Normalize unsupported forced tool choices before thinking preparation in direct Claude execution and token-count paths.
- Add regression coverage for schema integrity, model boundaries, retries, and final payload rule precedence.

Closes: #7000
2026-10-26 20:36:51 +08:00
Luis Pater
da21f1e58e fix(antigravity): restore non-stream tool signatures and preserve stream call indices
- Use stream-wide tool call indices in Gemini OpenAI chat response translation and preserve explicit upstream tool call IDs across stream and non-stream responses.
- Bind preceding turn thought signatures to unsigned function calls, mark completed non-stream candidate payloads as terminal, and clone request payloads before envelope mutation.
- Fall back to context API keys for reasoning replay caller isolation when explicit caller scope metadata is absent.

Closes: #6825
2026-10-24 20:42:16 +08:00
Dylan
02e9e85204 fix(antigravity): align Hub requests and invalidate versioned model caches
Include the captured client User-Agent in model capability cache and backoff
keys, discard obsolete publications, and cancel stale probes on refresh.

Use release-specific Hub changelists and the daily loadCodeAssist endpoint
for project discovery and credits queries.

Refs #6619
2026-10-20 18:46:02 +08:00
Luis Pater
b8d4e14a8e feat(runtime): optimize antigravity schema sanitization to scale linearly with declarations
- Refactor antigravity tool schema sanitization to process declarations and elements in a single pass.
- Avoid quadratic whole-document rewrites for payloads with many function declarations.
- Preserve original array whitespace and untouched elements during byte splicing.

Closes: #6714
2026-10-18 02:50:03 +08:00
Luis Pater
5efe97582c feat(antigravity): flatten multi-branch tool unions for Claude model requests
- Introduce `CleanJSONSchemaForAntigravityClaudeTool` and model-aware schema sanitization helpers to flatten multi-branch `anyOf`/`oneOf` unions specifically for Antigravity Claude tool parameter schemas.
- Preserve multi-branch union support for Gemini model variants while preventing Claude backend HTTP 400 validation errors on nested unions.
- Ensure proper inheritance of nullable markers and idempotency across the translator and executor chain.

Closes: #3662
2026-10-14 21:43:22 +08:00
Luis Pater
868e137f6c feat(payload): introduce payload finalizer for protobuf and multipart requests
- Add `PayloadFinalizer` to apply configuration rules at the final serialization barrier
- Support decoding, modifying, and re-encoding Devin protobuf business fields
- Add multipart form-data payload normalization to JSON for media payload rules

Closes: #5067
2026-10-04 03:01:34 +08:00
Luis Pater
31f4cfab3f feat: migrate CLIProxyAPI to version 8 2026-09-27 14:42:26 +08:00
Chén Mù
adf052984f fix(antigravity): remove cross-endpoint fallback (#5209) (#5228)
Fixes #5209
2026-08-25 11:51:17 +08:00
shengyy
7d55d0da0d fix(antigravity): preserve schema semantics 2026-08-16 13:00:59 +08:00
sususu
c33a33e14a perf(antigravity): reuse native upstream connections 2026-08-11 18:33:50 +08:00
sususu
d5f68856f6 perf(antigravity): batch pre-upstream JSON rewrites 2026-08-11 16:07:42 +08:00
Luis Pater
5dedb303f1 feat(util, executor, translator): enhance Antigravity schema handling and response formatting
- Introduced `CleanJSONSchemaForAntigravityResponse` to process schemas without adding tool-specific placeholders.
- Updated `cleanJSONSchema` with `removeGeminiMetadata` parameter for improved schema control.
- Refactored Antigravity schema sanitization to handle declaration and generation paths independently.
- Mapped OpenAI `response_format` to Antigravity settings, ensuring proper response schema cleaning.
- Expanded tests to verify proper placeholder-free response schema handling and metadata preservation.

Closes: #4652
2026-07-29 17:35:29 +08:00
Luis Pater
fe4ae4989c chore(pluginhost): refactor and remove unused interceptors and executor methods
- Removed deprecated interceptor and executor-related methods, including `callRequestInterceptor`, `callResponseInterceptor`, and `callStreamChunkInterceptor`.
- Consolidated unused logic and pruned redundant imports to streamline `adapters.go`.
- No functional changes.
2026-07-26 14:31:45 +08:00