chore: code cleanup and documentation overhaul
- Remove debug header dump from MITM proxy (was temp debugging code) - Suppress dead_code warnings for intentional OpenAI compat fields - Rewrite README with styled mermaid architecture diagrams, full feature listing, usage examples, and CLI reference - Update endpoint-gap-analysis: images implemented, audio only stretch - Update mitm-interception-status: add request modification and error capture components - Update standalone-ls-todo: add new endpoints to test results - Zero compiler warnings
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
- ✅ `response_format: {type: "json_object"}` — injected as `responseMimeType: "application/json"`
|
||||
- ✅ Google Search grounding — `web_search: true` (Completions), `tools: [{type: "web_search_preview"}]` (Responses), `google_search: true` (Gemini)
|
||||
- ✅ `/v1/search` endpoint — dedicated web search via Google Search grounding, returns structured results + citations
|
||||
- ✅ Image uploads — `input_image` / `image_url` with base64 data URIs, injected via MITM as `inlineData`
|
||||
- ✅ Upstream error propagation — Google API errors (400, 429, 500) returned to client instantly instead of hanging
|
||||
|
||||
### Reasoning Effort → Thinking Level Mapping
|
||||
|
||||
@@ -114,9 +116,9 @@ All structured output features have been implemented.
|
||||
|
||||
### Stretch (research needed)
|
||||
|
||||
| # | Gap | API | Notes |
|
||||
| --- | -------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 12 | **Image/audio modalities** | Both | LS `sendMessage` is text-only. Need to reverse-engineer proto format for binary payloads. Gemini 3 supports vision natively. |
|
||||
| # | Gap | API | Notes |
|
||||
| --- | --------------- | ---- | ---------------------------------------------------------------- |
|
||||
| 12 | **Audio input** | Both | Audio modalities not yet supported. Vision/images work via MITM. |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -45,6 +45,21 @@ Client → Proxy (8741) → Standalone LS (as antigravity-ls user)
|
||||
- Forwards HTTP/1.1 requests upstream with real DNS resolution (`dig @8.8.8.8`)
|
||||
- Chunked response detection for fast completion
|
||||
|
||||
6. **Request modification** (`src/mitm/modify.rs`)
|
||||
- Strips LS system instructions down to `<identity>` block only
|
||||
- Removes stale conversation history (keeps only last user message)
|
||||
- Injects client tools, tool configs, generation params
|
||||
- Injects images as `inlineData` (base64) into user message parts
|
||||
- Injects tool results as `functionResponse` parts
|
||||
- Enables Google Search grounding when requested
|
||||
- Updates `Content-Length` header after body modification
|
||||
|
||||
7. **Upstream error capture** (`src/mitm/store.rs`)
|
||||
- Captures Google API error responses (HTTP 400, 429, 500, etc.)
|
||||
- Parses error JSON for message and status fields
|
||||
- Stores in `MitmStore` for immediate forwarding to client
|
||||
- Prevents request hangs on upstream failures
|
||||
|
||||
## What We Tried (Historical)
|
||||
|
||||
### 1. Extension Patch — `detectAndUseProxy` ✅ Still Active
|
||||
@@ -129,8 +144,8 @@ Last event includes `"finishReason": "STOP"` in the candidate.
|
||||
# One-time setup (creates user + iptables rule)
|
||||
sudo ./scripts/mitm-redirect.sh install
|
||||
|
||||
# Run proxy with standalone LS + MITM
|
||||
RUST_LOG=info ./target/release/antigravity-proxy --standalone
|
||||
# Run proxy (standalone + MITM are default)
|
||||
RUST_LOG=info ./target/release/antigravity-proxy
|
||||
|
||||
# Check usage
|
||||
curl -s http://localhost:8741/v1/usage | jq .
|
||||
|
||||
@@ -60,19 +60,25 @@ byte-exact protobuf encoder.
|
||||
- API endpoint: `daily-cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse`
|
||||
- SSE response format: `{"response": {"usageMetadata": {"promptTokenCount", "candidatesTokenCount", "thoughtsTokenCount"}, "modelVersion": "..."}}`
|
||||
|
||||
## Test Results (2026-02-14)
|
||||
## Test Results (2026-02-15)
|
||||
|
||||
| Endpoint | Result |
|
||||
| --------------------------------- | ------------------------- |
|
||||
| `GET /health` | ✅ |
|
||||
| `GET /v1/models` | ✅ 5 models |
|
||||
| `GET /v1/sessions` | ✅ |
|
||||
| `GET /v1/quota` | ✅ real plan/credits |
|
||||
| `GET /v1/usage` | ✅ real MITM tokens |
|
||||
| `POST /v1/responses` (sync) | ✅ |
|
||||
| `POST /v1/responses` (stream) | ✅ SSE events |
|
||||
| `POST /v1/responses` (multi-turn) | ✅ context preserved |
|
||||
| `POST /v1/chat/completions` | ✅ |
|
||||
| MITM interception | ✅ TLS decrypt + parse |
|
||||
| MITM usage capture | ✅ per-model token counts |
|
||||
| UID isolation | ✅ no side effects |
|
||||
| Endpoint | Result |
|
||||
| --------------------------------- | --------------------------- |
|
||||
| `GET /health` | OK |
|
||||
| `GET /v1/models` | OK, 5 models |
|
||||
| `GET /v1/sessions` | OK |
|
||||
| `GET /v1/quota` | OK, real plan/credits |
|
||||
| `GET /v1/usage` | OK, real MITM tokens |
|
||||
| `POST /v1/responses` (sync) | OK |
|
||||
| `POST /v1/responses` (stream) | OK, full SSE event set |
|
||||
| `POST /v1/responses` (multi-turn) | OK, context preserved |
|
||||
| `POST /v1/responses` (tools) | OK, function calls captured |
|
||||
| `POST /v1/responses` (images) | OK, MITM injection |
|
||||
| `POST /v1/chat/completions` | OK |
|
||||
| `POST /v1/gemini` | OK |
|
||||
| `GET/POST /v1/search` | OK, grounding + citations |
|
||||
| MITM interception | OK, TLS decrypt + parse |
|
||||
| MITM request modification | OK, tools/images/params |
|
||||
| MITM usage capture | OK, per-model token counts |
|
||||
| MITM error capture | OK, instant client feedback |
|
||||
| UID isolation | OK, no side effects |
|
||||
|
||||
Reference in New Issue
Block a user