feat: add antigravity provider#2144
Conversation
Greptile SummaryThis PR adds Antigravity as the 30th supported provider, introducing a CLI classifier, provider registry entry, and UI metadata. It also generalises the
Confidence Score: 5/5Safe to merge; all changed paths are well-tested and the refactored session-ID logic preserves existing provider behaviour. The coordinate-system and permission-prompt false-positive bugs flagged in prior review rounds have been addressed with matching regression tests. The src/main/core/agent-hooks/classifiers/antigravity.ts — the
|
| Filename | Overview |
|---|---|
| src/main/core/agent-hooks/classifiers/antigravity.ts | New classifier for Antigravity CLI. Correctly addresses the mixed-coordinate-system bug and avoids allow/confirm false positives in the permission-prompt regex. Minor inconsistency: permissionPromptIndex uses first-match search while readyPromptIndex uses last-match Math.max. |
| src/main/core/agent-hooks/classifiers/antigravity.test.ts | Comprehensive test suite covering offset-mixing fix, error/auth-success chunk-scoping, false positive patterns, and the Generating... gate. |
| src/main/core/conversations/impl/agent-command.ts | Adds appendSessionId helper to handle equals-style flags and refactors the resume/fresh session-ID branching. Behavior for all existing providers is preserved. |
| src/main/core/agent-hooks/classifiers/base.ts | Minimal, backward-compatible signature extension: ClassifyFn gains a second chunk parameter and createProviderClassifier forwards the ANSI-stripped chunk. |
| src/shared/agent-provider-registry.ts | Adds the antigravity provider definition with sessionIdFlag: '--conversation=', consistent with the rest of the registry. |
| src/renderer/features/tasks/conversations/conversation-manager.ts | Sets the new conversation to working state immediately when an initialPrompt is provided. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[classify chunk] --> B[append to buffer, strip ANSI]
B --> C{buffer > 4 KB?}
C -- yes --> D[trim to last 4 KB]
C -- no --> E[compute tail = last 700 chars]
D --> E
E --> F[compute indices\npermissionPromptIndex tail.search\nauthSuccessIndex chunk.search\nerrorIndex chunk.search\nreadyPromptIndex Math.max of 3 tail.search\ngeneratingIndex tail.lastIndexOf]
F --> G[compute lastActionableIndex\nmax of all indices converted to text-global]
G --> H{Generating... present AND\ntailStart+generatingIndex > lastActionableIndex?}
H -- yes --> I[return undefined]
H -- no --> J{permissionPromptIndex >= 0?}
J -- yes --> K[return permission_prompt]
J -- no --> L{authSuccessIndex >= 0?}
L -- yes --> M[return auth_success]
L -- no --> N{errorIndex >= 0?}
N -- yes --> O[return error]
N -- no --> P{readyPromptIndex >= 0?}
P -- yes --> Q[return stop]
P -- no --> R[return undefined]
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
src/main/core/agent-hooks/classifiers/antigravity.ts:5-20
**`permissionPromptIndex` uses first-match `search` while `readyPromptIndex` uses last-match `Math.max`**
`readyPromptIndex` is deliberately computed as the *latest* matching position (via `Math.max`) so the gate correctly identifies whether a ready prompt is more recent than the last `Generating...`. `permissionPromptIndex` uses `tail.search(regex)`, which returns the *first* match.
In the edge case where a `run command?` prompt appears in the tail both before *and after* a `Generating...` block, `permissionPromptIndex` points to the earlier occurrence. That position will satisfy `tailStart + generatingIndex > lastActionableIndex` (Generating... is between the two prompts), so the later — and valid — permission prompt gets incorrectly suppressed. For consistency and correctness, consider returning the index of the *last* match, mirroring the `Math.max` approach used for `readyPromptIndex`.
Reviews (2): Last reviewed commit: "fix antigravity classifier review issues" | Re-trigger Greptile
summary