Skip to content

feat(antigravity): support Antigravity Desktop tool signatures (write_file, edit_file) - #227

Open
Joy Mondal (Equlient-Joy) wants to merge 4 commits into
microsoft:mainfrom
Equlient-Joy:feat/antigravity-desktop-tools
Open

Joy Mondal (Equlient-Joy) wants to merge 4 commits into
microsoft:mainfrom
Equlient-Joy:feat/antigravity-desktop-tools

Conversation

@Equlient-Joy

Copy link
Copy Markdown

feat(antigravity): support Antigravity Desktop tool signatures (write_file, edit_file)

Summary

This PR follows up on review feedback from Aaron Li (@aaron-jx-li) on PR #184 requesting that Antigravity Desktop tool mappings and transcript evidence be separated into a dedicated PR.

It adds support for Antigravity Desktop IDE tool signatures to the Antigravity trace parser, includes a real redacted transcript fixture from Antigravity Desktop, provides full test coverage for trajectory generation and token usage calculation, and documents dual CLI and Desktop support.

Key Changes

1. Tool Signature Mapping (tokeneconomizer/trace/antigravity.py)

  • Added write_file and edit_file to _TOOLS, mapping them to Write and Edit mechanism actions.
  • Configured argument extraction to support Path (used by Desktop IDE tools) alongside existing CLI argument names (TargetFile, AbsolutePath).
  • Preserves full backwards compatibility with CLI tool signatures (write_to_file, replace_file_content, multi_replace_file_content, sed_file).

2. Real Desktop Transcript Fixture (tests/fixtures/antigravity_desktop_transcript.jsonl)

  • Redacted, real Antigravity Desktop IDE session transcript demonstrating multi-step tool calls:
    • Step 1: User prompt.
    • Step 2: write_file call with Path parameter.
    • Step 3: Tool response for write_file.
    • Step 4: edit_file call with Path, Target, and Replacement parameters.
    • Step 5: Tool response for edit_file.

3. Unit & Integration Tests (tests/test_antigravity.py)

  • test_antigravity_recognizes_desktop_tools_from_fixture:
    • Validates parser extraction of write_file -> Write and edit_file -> Edit with normalized file_path.
  • test_desktop_tools_feed_mechanisms_and_session_usage:
    • Verifies session usage computation (request count, input tokens, cache read tokens, output tokens).
    • Verifies trajectory generation into Claude-formatted actions (Write, Edit) feeding downstream mechanisms.

4. Documentation Updates

  • README.md:
    • Updated experimental host overview and supported versions table to reflect support for both agy CLI and Antigravity Desktop.
  • docs/PLUGIN.md:
    • Added documentation under Antigravity section clarifying recognition of both CLI tool signatures (write_to_file, replace_file_content) and Desktop IDE tools (write_file, edit_file with Path parameter).
  • plugin/README.md:
    • Clarified support for both Antigravity CLI and Desktop IDE sessions.

Cross-Platform Verification

  • Windows 11 (Python 3.12):
    • pytest tests/test_antigravity.py -v: 28 passed, 1 skipped (POSIX launcher check expected on Windows).
  • Linux (WSL2, Python 3.14.4):
    • py_compile tokeneconomizer/trace/antigravity.py tests/test_antigravity.py: Clean compilation.
    • Fixture parsing, tool mapping, trajectory generation, and token usage verification: PASSED.
  • macOS Code Analysis:
    • Pure Python stdlib (json, os, re); no OS-specific assumptions.
    • CRLF normalization (replace("\r\n", "\n")) and platform-neutral path extraction.

Copilot AI balanced review requested due to automatic review settings November 14, 2026 20:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants