Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1935e0e
feat(gemini): support Antigravity SQLite conversation database parsing
tanmayvdani Aug 30, 2026
3420929
fix(gemini): resolve model from 1.19, guard 10th varint byte, and bou…
tanmayvdani Aug 30, 2026
04bc2a4
fix(gemini): normalize Antigravity display models and propagate model…
tanmayvdani Aug 30, 2026
fe75641
fix(gemini): order SQLite metadata queries, synchronize thoughts tota…
tanmayvdani Aug 30, 2026
7f68f3b
fix(gemini): restrict default discovery roots, harden total aggregati…
tanmayvdani Aug 30, 2026
29d5ddb
fix(gemini): split visible and thinking tokens to prevent cost inflation
tanmayvdani Aug 30, 2026
be402af
fix(gemini): align output and reasoning protobuf field mappings with …
tanmayvdani Aug 30, 2026
feaedb7
fix(antigravity): isolate SQLite usage parsing
ryoppippi Aug 31, 2026
d2f0878
Merge remote-tracking branch 'origin/main' into feat/gemini-antigravi…
ryoppippi Aug 31, 2026
a3a435b
fix(antigravity): repair SQLite usage accounting
ryoppippi Aug 31, 2026
77c063c
fix(antigravity): prefer usage model IDs for step costs
ryoppippi Aug 31, 2026
ea41380
fix(antigravity): harden protobuf and pricing decoding
ryoppippi Aug 31, 2026
d05cfac
fix(antigravity): bound database loading and enrich reports
ryoppippi Aug 31, 2026
696c9d4
fix(antigravity): deduplicate aliased database roots
ryoppippi Aug 31, 2026
b473192
docs(antigravity): document data roots and public surface
ryoppippi Aug 31, 2026
358a3f6
Merge remote-tracking branch 'origin/main' into feat/gemini-antigravi…
ryoppippi Aug 31, 2026
1c02455
fix(cli): include ZCode in adapter exposure test
ryoppippi Aug 31, 2026
d335e9a
test(zcode): refresh session table snapshot
ryoppippi Aug 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(antigravity): repair SQLite usage accounting
Decode the real Antigravity ModelUsageStats buckets and collect usage from generation, step, and retry metadata. Preserve model and source identity across continuation and duplicate rows, keep Gemini and Antigravity discovery independent, and surface SQLite/protobuf failures instead of reporting partial data. Add real-schema fixtures and production report snapshots, restore Gemini diagnostics, and remove the unrelated Gemini pricing feature.

Co-authored-by: Tanmay Vivek Dani <[email protected]>
  • Loading branch information
ryoppippi and tanmayvdani committed Aug 31, 2026
commit a3a435bffba6925196a47cc8072952f17fcf6bfc
18 changes: 11 additions & 7 deletions docs/guide/antigravity/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,27 @@ ANTIGRAVITY_DATA_DIR="$HOME/.gemini/antigravity-cli,/backup/antigravity" \
```

Only `.db` files are read. ccusage opens them read-only and reads the
`gen_metadata` rows in ascending `idx` order.
`gen_metadata` rows in ascending `idx` order. When present, the real `steps`
schema contributes step and retry usage, and `trajectory_metadata_blob` supplies
the timestamp fallback. SQLite, row-iteration, and protobuf failures are
reported instead of becoming empty or partial reports.

## What Gets Calculated

- **Input tokens** - The system-prompt and fresh-input buckets are combined.
- **Cache reads** - The cache-read bucket remains separate from uncached input.
- **Output and reasoning** - Visible output and thinking tokens are reported in
their corresponding output and reasoning fields.
- **Input tokens** - The fresh-input bucket is reported independently.
- **Cache writes and reads** - Both cache buckets remain separate from uncached input.
- **Output and reasoning** - Total output is split into visible output and
thinking/reasoning tokens.
- **Model names** - Antigravity display names and known internal aliases are
normalized to pricing model IDs. For example, `Gemini 3 Pro` is reported as
`gemini-3-pro`.
- **Costs** - `calculate` and `auto` use the embedded pricing catalog when a
matching model is available. Use `--offline` to avoid a pricing refresh.

Continuation rows inherit the most recently observed model in their database.
Rows with a response ID are deduplicated when the same conversation is found in
multiple configured roots.
Usage in generation metadata and step metadata is combined, including retry
records. Successful, retry, and source copies are deduplicated by their response,
provider-assigned message, or message identity.

## Configuration

Expand Down
1 change: 1 addition & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/adapters/antigravity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ sqlite.workspace = true
[dev-dependencies]
ccusage-core = { workspace = true, features = ["fetch-litellm-pricing"] }
ccusage-test-support.workspace = true
insta.workspace = true
9 changes: 6 additions & 3 deletions rust/adapters/antigravity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ from the Gemini CLI adapter so unified reports preserve source attribution.

## Owns

- `loader.rs` — database discovery, ordered parallel reads, and response-ID deduplication.
- `parser.rs` — SQLite row handling, GeneratorMetadata protobuf decoding, token buckets, and model naming.
- `loader.rs` — database discovery, bounded ordered reads, and identity-based deduplication.
- `parser.rs` — SQLite row handling, GeneratorMetadata/CortexStepMetadata protobuf decoding, token buckets, retries, and model naming.
- `paths.rs` — environment variables, default roots, and `.db` discovery.
- `report.rs` — the JSON and table shapes where they differ from the shared ones.

Expand All @@ -24,7 +24,10 @@ The adapter reads `.db` files below these default roots:
`ANTIGRAVITY_DATA_DIR` accepts one or more comma-separated data roots. Each
root may contain a `conversations/` child or be the conversation directory
itself. Databases are opened read-only and must provide the `gen_metadata`
table.
table. When present, the real `steps` schema contributes step and retry usage,
and `trajectory_metadata_blob` supplies the timestamp fallback. SQLite,
row-iteration, and protobuf failures are reported instead of becoming empty or
partial reports.

## Public surface

Expand Down
Loading