cli-consumption 0.6.0__tar.gz → 0.6.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/CHANGELOG.md +17 -1
  2. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/PKG-INFO +5 -5
  3. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/README.md +4 -4
  4. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/pyproject.toml +1 -1
  5. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/_shared.py +3 -1
  6. cli_consumption-0.6.2/src/cli_consumption/adapters/antigravity.py +527 -0
  7. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/registry.py +31 -0
  8. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/copy_rank.py +19 -4
  9. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/dashboard_react.css +1 -1
  10. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/models.py +16 -5
  11. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/storage.py +27 -3
  12. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/web_runtime.zip +0 -0
  13. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/.gitignore +0 -0
  14. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/LICENSE +0 -0
  15. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/NOTICE +0 -0
  16. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/MARTIAN_MONO_FONT_LICENSE.txt +0 -0
  17. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/PRICING_DATA_LICENSE.txt +0 -0
  18. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/__init__.py +0 -0
  19. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/__main__.py +0 -0
  20. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/__init__.py +0 -0
  21. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/_claude_usage.py +0 -0
  22. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/_codex_zstd.py +0 -0
  23. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/_copilot_retry.py +0 -0
  24. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/_copy_selection.py +0 -0
  25. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/_incremental.py +0 -0
  26. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/_kimi_code.py +0 -0
  27. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/_primitives.py +0 -0
  28. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/_session_files.py +0 -0
  29. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/aider.py +0 -0
  30. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/amazon_q.py +0 -0
  31. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/amp.py +0 -0
  32. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/base.py +0 -0
  33. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/claude.py +0 -0
  34. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/cline.py +0 -0
  35. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/codex.py +0 -0
  36. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/continue_cli.py +0 -0
  37. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/copilot.py +0 -0
  38. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/crush.py +0 -0
  39. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/cursor.py +0 -0
  40. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/gemini.py +0 -0
  41. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/goose.py +0 -0
  42. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/grok.py +0 -0
  43. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/kilo.py +0 -0
  44. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/kimi.py +0 -0
  45. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/mistral_vibe.py +0 -0
  46. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/opencode.py +0 -0
  47. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/openhands.py +0 -0
  48. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/otlp.py +0 -0
  49. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/pi.py +0 -0
  50. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/plandex.py +0 -0
  51. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/adapters/qwen.py +0 -0
  52. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/api.py +0 -0
  53. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/block_report.py +0 -0
  54. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/budget.py +0 -0
  55. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/cli.py +0 -0
  56. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/dashboard.py +0 -0
  57. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/dashboard_layouts.py +0 -0
  58. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/dashboard_react.js +0 -0
  59. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/exporting.py +0 -0
  60. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/file_parse_cache.py +0 -0
  61. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/frontend.py +0 -0
  62. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/git_activity.py +0 -0
  63. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/git_report.py +0 -0
  64. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/insights_report.py +0 -0
  65. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/insights_sql.py +0 -0
  66. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/launcher.py +0 -0
  67. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/mcp_server.py +0 -0
  68. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/__init__.py +0 -0
  69. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/env.py +0 -0
  70. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/__init__.py +0 -0
  71. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0001_baseline.py +0 -0
  72. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0002_minimize_subagents.py +0 -0
  73. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0003_canonical_timestamps.py +0 -0
  74. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0004_subagent_scope_freshness.py +0 -0
  75. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0005_sync_receipts.py +0 -0
  76. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0006_dashboard_layouts.py +0 -0
  77. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0007_dashboard_layout_revision.py +0 -0
  78. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0008_cache_write_duration.py +0 -0
  79. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0009_replicated_call_keys.py +0 -0
  80. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0010_normalization_version.py +0 -0
  81. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0011_file_parse_cache.py +0 -0
  82. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0012_rate_limit_samples.py +0 -0
  83. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0013_git_commits.py +0 -0
  84. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0014_statusline_quota_observations.py +0 -0
  85. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0015_otlp_metrics.py +0 -0
  86. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0016_metric_client_budgets.py +0 -0
  87. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/migrations/versions/v0017_tool_outcomes.py +0 -0
  88. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/otlp.py +0 -0
  89. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/otlp_storage.py +0 -0
  90. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/pricing.json +0 -0
  91. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/pricing.py +0 -0
  92. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/py.typed +0 -0
  93. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/qualifications.py +0 -0
  94. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/reporting.py +0 -0
  95. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/reporting_api.py +0 -0
  96. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/retention.py +0 -0
  97. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/schema.py +0 -0
  98. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/snapshot_extraction.py +0 -0
  99. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/snapshot_files.py +0 -0
  100. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/snapshot_split.py +0 -0
  101. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/statusline.py +0 -0
  102. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/statusline_quota.py +0 -0
  103. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/sync.py +0 -0
  104. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/terminal_report.py +0 -0
  105. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/timestamps.py +0 -0
  106. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/tool_outcomes.py +0 -0
  107. {cli_consumption-0.6.0 → cli_consumption-0.6.2}/src/cli_consumption/usage_report.py +0 -0
@@ -6,6 +6,20 @@ use [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.6.2] - 2026-12-05
10
+
11
+ ### Fixed
12
+
13
+ - Align horizontal bars to a common left edge within each live and offline
14
+ dashboard ranking, including bars at the minimum visible width.
15
+
16
+ ## [0.6.1] - 2026-12-05
17
+
18
+ ### Added
19
+
20
+ - Collect Antigravity ACP model calls, token counters, turn timings, and tool
21
+ outcomes from local conversation databases.
22
+
9
23
  ## [0.6.0] - 2026-12-05
10
24
 
11
25
  ### Added
@@ -559,7 +573,9 @@ use [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
559
573
 
560
574
  - Refreshed the provider guide for the first minor release ([#26]).
561
575
 
562
- [Unreleased]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.6.0...HEAD
576
+ [Unreleased]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.6.2...HEAD
577
+ [0.6.2]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.6.1...v0.6.2
578
+ [0.6.1]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.6.0...v0.6.1
563
579
  [0.6.0]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.5.0...v0.6.0
564
580
  [0.5.0]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.4.5...v0.5.0
565
581
  [0.4.5]: https://github.com/Guillaume-Lombardo/cli-consumption/compare/v0.4.4...v0.4.5
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: cli-consumption
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: Analyze and consolidate AI coding CLI consumption across machines.
5
5
  Project-URL: Homepage, https://github.com/Guillaume-Lombardo/cli-consumption
6
6
  Project-URL: Documentation, https://github.com/Guillaume-Lombardo/cli-consumption#readme
@@ -177,10 +177,10 @@ PostgreSQL, retention, synchronization, readiness, and automation.
177
177
 
178
178
  ## Supported CLIs
179
179
 
180
- The current registry supports Aider, Amazon Q Developer CLI, Amp, Claude Code, Cline,
181
- Codex, Continue, Crush, Cursor CLI, Gemini CLI, GitHub Copilot CLI, Goose, Grok Build,
182
- Kilo Code, Kimi Code CLI, Mistral Vibe CLI, OpenCode, OpenHands CLI, Pi, Plandex, and
183
- Qwen Code.
180
+ The current registry supports Aider, Amazon Q Developer CLI, Amp, Antigravity,
181
+ Claude Code, Cline, Codex, Continue, Crush, Cursor CLI, Gemini CLI, GitHub Copilot
182
+ CLI, Goose, Grok Build, Kilo Code, Kimi Code CLI, Mistral Vibe CLI, OpenCode, OpenHands
183
+ CLI, Pi, Plandex, and Qwen Code.
184
184
 
185
185
  Provider formats are internal and can change without notice. Exact source locations,
186
186
  token semantics, extraction limits, synthetic qualification fixtures, provenance, and
@@ -131,10 +131,10 @@ PostgreSQL, retention, synchronization, readiness, and automation.
131
131
 
132
132
  ## Supported CLIs
133
133
 
134
- The current registry supports Aider, Amazon Q Developer CLI, Amp, Claude Code, Cline,
135
- Codex, Continue, Crush, Cursor CLI, Gemini CLI, GitHub Copilot CLI, Goose, Grok Build,
136
- Kilo Code, Kimi Code CLI, Mistral Vibe CLI, OpenCode, OpenHands CLI, Pi, Plandex, and
137
- Qwen Code.
134
+ The current registry supports Aider, Amazon Q Developer CLI, Amp, Antigravity,
135
+ Claude Code, Cline, Codex, Continue, Crush, Cursor CLI, Gemini CLI, GitHub Copilot
136
+ CLI, Goose, Grok Build, Kilo Code, Kimi Code CLI, Mistral Vibe CLI, OpenCode, OpenHands
137
+ CLI, Pi, Plandex, and Qwen Code.
138
138
 
139
139
  Provider formats are internal and can change without notice. Exact source locations,
140
140
  token semantics, extraction limits, synthetic qualification fixtures, provenance, and
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cli-consumption"
7
- version = "0.6.0"
7
+ version = "0.6.2"
8
8
  description = "Analyze and consolidate AI coding CLI consumption across machines."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -577,6 +577,7 @@ def ensure_provider_sqlite_fields(
577
577
  fields: Iterable[tuple[str, str]],
578
578
  *,
579
579
  where_equals: tuple[str, object] | None = None,
580
+ not_indexed: bool = False,
580
581
  ) -> None:
581
582
  identifier = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")
582
583
  # The equality filter comes first so SQLite skips other rows before it reads
@@ -590,11 +591,12 @@ def ensure_provider_sqlite_fields(
590
591
  raise ValueError("invalid_sqlite_field_check")
591
592
  predicate = f'"{column}" = ? AND '
592
593
  parameters = (value, MAX_PROVIDER_SQLITE_FIELD_BYTES)
594
+ scan = " NOT INDEXED" if not_indexed else ""
593
595
  for table, field in fields:
594
596
  if not identifier.fullmatch(table) or not identifier.fullmatch(field):
595
597
  raise ValueError("invalid_sqlite_field_check")
596
598
  oversized = connection.execute(
597
- f'SELECT 1 FROM "{table}" '
599
+ f'SELECT 1 FROM "{table}"{scan} '
598
600
  f'WHERE {predicate}length(CAST("{field}" AS BLOB)) > ? LIMIT 1',
599
601
  parameters,
600
602
  ).fetchone()
@@ -0,0 +1,527 @@
1
+ """Read the Antigravity ACP SQLite trajectory format qualified with version 1.5.17."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ import sqlite3
7
+ from collections.abc import Iterator
8
+ from dataclasses import dataclass
9
+ from datetime import UTC, datetime, timedelta
10
+ from itertools import chain
11
+ from pathlib import Path
12
+ from typing import Any, TypeAlias
13
+
14
+ from cli_consumption.adapters._shared import (
15
+ ProviderFileDisappearedError,
16
+ ProviderFileTypeError,
17
+ ProviderInputBudget,
18
+ add_tokens,
19
+ digest_records,
20
+ ensure_provider_sqlite_fields,
21
+ finish_turn,
22
+ iso,
23
+ new_turn,
24
+ open_provider_sqlite,
25
+ sqlite_columns,
26
+ tokens,
27
+ )
28
+ from cli_consumption.adapters.base import UnsupportedProviderFormat
29
+ from cli_consumption.copy_rank import snapshot_copy_rank
30
+ from cli_consumption.models import (
31
+ MAX_BIGINT,
32
+ MAX_INTEGER,
33
+ MAX_MODELS_PER_CONVERSATION,
34
+ Snapshot,
35
+ ToolOutcome,
36
+ empty_tokens,
37
+ )
38
+
39
+ _UUID = re.compile(r"[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}")
40
+ _T3_PROFILE = re.compile(r"[0-9a-f]{64}")
41
+ _LABEL = re.compile(rb"[A-Za-z0-9][A-Za-z0-9_.:+-]*")
42
+ _USER_INPUT = 14
43
+ _PLANNER_RESPONSE = 15
44
+ _GENERIC_TOOL = 132
45
+ _DONE = 3
46
+ _ERROR = 7
47
+ _EPOCH = datetime(1970, 1, 1, tzinfo=UTC)
48
+ _PbValue: TypeAlias = int | memoryview
49
+
50
+ # Ordinary tables and metadata columns are the entire read surface.
51
+ _COLUMNS = {
52
+ "trajectory_meta": {"cascade_id", "trajectory_type"},
53
+ "steps": {"idx", "step_type", "status", "step_format", "metadata"},
54
+ "gen_metadata": {"idx", "data"},
55
+ "parent_references": {"idx"},
56
+ }
57
+
58
+
59
+ class _InvalidRecord(ValueError):
60
+ """An invalid identity, row, or protobuf value."""
61
+
62
+
63
+ def _databases(home: Path) -> Iterator[Path]:
64
+ # The allowlist excludes credentials, annotations, caches and brain content.
65
+ # A store can be an individual profile or the T3 directory containing profiles.
66
+ roots = (
67
+ path
68
+ for path in home.glob("*/antigravity-acp")
69
+ if _T3_PROFILE.fullmatch(path.parent.name)
70
+ and not path.is_symlink()
71
+ and not path.parent.is_symlink()
72
+ )
73
+ for root in chain((home,), roots):
74
+ directory = root / "conversations"
75
+ if directory.is_symlink():
76
+ continue
77
+ for path in directory.glob("*.db"):
78
+ if _UUID.fullmatch(path.stem):
79
+ yield path
80
+
81
+
82
+ def has_antigravity_store(home: Path) -> bool:
83
+ return next(_databases(home), None) is not None
84
+
85
+
86
+ @dataclass(frozen=True, slots=True)
87
+ class _Step:
88
+ kind: int
89
+ status: int
90
+ created: datetime | None
91
+ started: datetime | None
92
+ completed: datetime | None
93
+ tool: str | None
94
+
95
+
96
+ @dataclass(frozen=True, slots=True)
97
+ class _Call:
98
+ planner_index: int
99
+ model: str
100
+ usage: dict[str, int]
101
+
102
+
103
+ class AntigravityAdapter:
104
+ name = "antigravity"
105
+
106
+ def collect(
107
+ self,
108
+ sources: list[tuple[str, Path]],
109
+ project_mappings: list[tuple[str, str]] | None = None,
110
+ ) -> Snapshot:
111
+ # Workspace paths are outside this format's read surface.
112
+ del project_mappings
113
+ budget = ProviderInputBudget()
114
+ snapshot = Snapshot(provider=self.name)
115
+ selected: dict[str, Snapshot] = {}
116
+ unsupported = False
117
+ for machine, home in sources:
118
+ for path in budget.sorted_paths(_databases(home)):
119
+ try:
120
+ candidate = _read_database(path, machine, budget)
121
+ except UnsupportedProviderFormat:
122
+ unsupported = True
123
+ snapshot.malformed_records += 1
124
+ continue
125
+ except (
126
+ ProviderFileDisappearedError,
127
+ ProviderFileTypeError,
128
+ OSError,
129
+ sqlite3.DatabaseError,
130
+ _InvalidRecord,
131
+ ):
132
+ snapshot.malformed_records += 1
133
+ continue
134
+ if candidate is None:
135
+ continue
136
+ snapshot.malformed_records += candidate.malformed_records
137
+ if not candidate.conversations:
138
+ continue
139
+ previous = selected.get(path.stem)
140
+ if previous is not None:
141
+ snapshot.duplicate_conversations += 1
142
+ if snapshot_copy_rank(previous) >= snapshot_copy_rank(candidate):
143
+ continue
144
+ selected[path.stem] = candidate
145
+ if unsupported and not selected:
146
+ raise UnsupportedProviderFormat("unsupported_antigravity_schema")
147
+ for _, candidate in sorted(selected.items()):
148
+ snapshot.conversations.extend(candidate.conversations)
149
+ snapshot.turns.extend(candidate.turns)
150
+ snapshot.model_calls.extend(candidate.model_calls)
151
+ snapshot.tool_calls.extend(candidate.tool_calls)
152
+ return snapshot
153
+
154
+
155
+ def _has_rowid_key(db: sqlite3.Connection, table: str) -> bool:
156
+ primary_key = [
157
+ (row["name"], row["type"].upper())
158
+ for row in db.execute(f'PRAGMA table_info("{table}")')
159
+ if row["pk"]
160
+ ]
161
+ # A DESC or WITHOUT ROWID primary key has a backing index. Only the
162
+ # INTEGER PRIMARY KEY that aliases the physical row ID is qualified.
163
+ return primary_key == [("idx", "INTEGER")] and not any(
164
+ row["origin"] == "pk" for row in db.execute(f'PRAGMA index_list("{table}")')
165
+ )
166
+
167
+
168
+ def _read_database(
169
+ path: Path, machine: str, budget: ProviderInputBudget
170
+ ) -> Snapshot | None:
171
+ candidate = Snapshot(provider="antigravity")
172
+ with open_provider_sqlite(path, budget) as db:
173
+ db.row_factory = sqlite3.Row
174
+ tables = {
175
+ row["name"]
176
+ for row in db.execute("PRAGMA table_list")
177
+ if row["type"] == "table"
178
+ }
179
+ if any(
180
+ table not in tables or not columns <= sqlite_columns(db, table)
181
+ for table, columns in _COLUMNS.items()
182
+ ) or not all(_has_rowid_key(db, table) for table in ("steps", "gen_metadata")):
183
+ raise UnsupportedProviderFormat("unsupported_antigravity_schema")
184
+ ensure_provider_sqlite_fields(
185
+ db,
186
+ (
187
+ ("trajectory_meta", "cascade_id"),
188
+ ("trajectory_meta", "trajectory_type"),
189
+ ("steps", "step_type"),
190
+ ("steps", "status"),
191
+ ("steps", "step_format"),
192
+ ("steps", "metadata"),
193
+ ("gen_metadata", "data"),
194
+ ),
195
+ not_indexed=True,
196
+ )
197
+ identities = db.execute(
198
+ "SELECT cascade_id, trajectory_type "
199
+ "FROM trajectory_meta NOT INDEXED LIMIT 2"
200
+ ).fetchall()
201
+ if len(identities) != 1 or identities[0]["cascade_id"] != path.stem:
202
+ raise _InvalidRecord("invalid_antigravity_identity")
203
+ # A fork can contain the model calls of its parent. Only the qualified
204
+ # cascade layout without a fork/prune reference is interpreted here.
205
+ if (
206
+ identities[0]["trajectory_type"] != 4
207
+ or db.execute(
208
+ "SELECT 1 FROM parent_references NOT INDEXED LIMIT 1"
209
+ ).fetchone()
210
+ ):
211
+ return None
212
+
213
+ steps: dict[int, _Step] = {}
214
+ # Scan the rowid tables directly. Secondary indexes from an untrusted
215
+ # database may disagree with the table. Sort only after projection.
216
+ for idx, kind, status, fmt, metadata in budget.rows(
217
+ db.execute(
218
+ "SELECT idx, step_type, status, step_format, metadata "
219
+ "FROM steps NOT INDEXED"
220
+ )
221
+ ):
222
+ try:
223
+ if not _valid_index(idx) or fmt != 0:
224
+ raise _InvalidRecord
225
+ steps[idx] = _step(kind, status, budget.json_field(metadata))
226
+ except _InvalidRecord:
227
+ candidate.malformed_records += 1
228
+
229
+ calls: dict[int, _Call] = {}
230
+ for idx, data in budget.rows(
231
+ db.execute("SELECT idx, data FROM gen_metadata NOT INDEXED")
232
+ ):
233
+ try:
234
+ if not _valid_index(idx):
235
+ raise _InvalidRecord
236
+ call = _model_call(budget.json_field(data), steps)
237
+ if call is None: # Injected action, with no model request.
238
+ continue
239
+ calls[idx] = call
240
+ except _InvalidRecord:
241
+ candidate.malformed_records += 1
242
+
243
+ if steps or calls:
244
+ _normalize(candidate, machine, path.stem, steps, calls)
245
+ return candidate
246
+
247
+
248
+ def _valid_index(value: object) -> bool:
249
+ return isinstance(value, int) and 0 <= value <= MAX_INTEGER
250
+
251
+
252
+ def _varint(data: memoryview, pos: int) -> tuple[int, int]:
253
+ value = 0
254
+ for shift in range(0, 70, 7):
255
+ if pos == len(data):
256
+ raise _InvalidRecord
257
+ byte = data[pos]
258
+ pos += 1
259
+ if shift == 63 and byte > 1:
260
+ raise _InvalidRecord
261
+ value |= (byte & 127) << shift
262
+ if byte < 128:
263
+ return value, pos
264
+ raise _InvalidRecord
265
+
266
+
267
+ def _fields(data: memoryview, selected: set[int]) -> Iterator[tuple[int, _PbValue]]:
268
+ """Project protobuf field numbers without decoding or copying skipped fields."""
269
+ pos = 0
270
+ while pos < len(data):
271
+ tag, pos = _varint(data, pos)
272
+ number, wire = divmod(tag, 8)
273
+ if not 0 < number < 2**29:
274
+ raise _InvalidRecord
275
+ if wire == 0:
276
+ value, pos = _varint(data, pos)
277
+ if number in selected:
278
+ yield number, value
279
+ elif wire in (1, 2, 5):
280
+ if wire == 2:
281
+ size, pos = _varint(data, pos)
282
+ else:
283
+ size = 8 if wire == 1 else 4
284
+ end = pos + size
285
+ if end > len(data):
286
+ raise _InvalidRecord
287
+ if number in selected:
288
+ if wire != 2:
289
+ raise _InvalidRecord
290
+ yield number, data[pos:end]
291
+ pos = end
292
+ else:
293
+ raise _InvalidRecord
294
+
295
+
296
+ def _blob(value: object) -> memoryview:
297
+ if isinstance(value, bytes):
298
+ return memoryview(value)
299
+ if isinstance(value, memoryview):
300
+ return value
301
+ raise _InvalidRecord
302
+
303
+
304
+ def _number(fields: dict[int, _PbValue], number: int) -> int:
305
+ value = fields.get(number, 0)
306
+ if not isinstance(value, int):
307
+ raise _InvalidRecord
308
+ return value
309
+
310
+
311
+ def _time(value: _PbValue | None) -> datetime | None:
312
+ if value is None:
313
+ return None
314
+ fields = dict(_fields(_blob(value), {1, 2}))
315
+ seconds = _number(fields, 1)
316
+ if seconds >= 2**63:
317
+ seconds -= 2**64 # google.protobuf.Timestamp seconds are signed.
318
+ nanos = _number(fields, 2)
319
+ if nanos >= 1_000_000_000:
320
+ raise _InvalidRecord
321
+ return _EPOCH + timedelta(seconds=seconds, microseconds=nanos // 1_000)
322
+
323
+
324
+ def _label(value: _PbValue | None, limit: int) -> str | None:
325
+ if value is None:
326
+ return None
327
+ data = _blob(value)
328
+ if len(data) > limit or not _LABEL.fullmatch(data):
329
+ raise _InvalidRecord
330
+ return bytes(data).decode("ascii")
331
+
332
+
333
+ def _step(kind: object, status: object, data: object) -> _Step:
334
+ if not isinstance(kind, int) or not isinstance(status, int):
335
+ raise _InvalidRecord
336
+ fields = dict(_fields(_blob(data), {1, 4, 8, 32}))
337
+ tool = None
338
+ if kind == _GENERIC_TOOL and 4 in fields:
339
+ tool = _label(dict(_fields(_blob(fields[4]), {2})).get(2), 512)
340
+ try:
341
+ return _Step(
342
+ kind,
343
+ status,
344
+ _time(fields.get(1)),
345
+ _time(fields.get(32)),
346
+ _time(fields.get(8)),
347
+ tool,
348
+ )
349
+ except OverflowError:
350
+ raise _InvalidRecord from None
351
+
352
+
353
+ def _indices(value: _PbValue) -> Iterator[int]:
354
+ if isinstance(value, int):
355
+ yield value
356
+ else:
357
+ pos = 0
358
+ while pos < len(value):
359
+ index, pos = _varint(value, pos)
360
+ yield index
361
+
362
+
363
+ def _model_call(data: object, steps: dict[int, _Step]) -> _Call | None:
364
+ chat = None
365
+ planner_index = None
366
+ injected = False
367
+ # CortexStepGeneratorMetadata carries a single ChatModelMetadata and links
368
+ # all generated steps, including the planner response and its tool steps.
369
+ for number, value in _fields(_blob(data), {1, 2, 7}):
370
+ if number == 1:
371
+ chat = _blob(value)
372
+ elif number == 2:
373
+ for index in _indices(value):
374
+ step = steps.get(index)
375
+ if step and step.kind == _PLANNER_RESPONSE:
376
+ if planner_index is not None and planner_index != index:
377
+ raise _InvalidRecord
378
+ planner_index = index
379
+ else:
380
+ _blob(value)
381
+ injected = True
382
+ if chat is None:
383
+ if injected:
384
+ return None
385
+ raise _InvalidRecord
386
+ if injected or planner_index is None:
387
+ raise _InvalidRecord
388
+ fields = dict(_fields(chat, {4, 19, 22}))
389
+ model = _label(fields.get(22, fields.get(19)), 255) or "unknown"
390
+ usage = _usage(_blob(fields[4])) if 4 in fields else empty_tokens()
391
+ return _Call(planner_index, model, usage)
392
+
393
+
394
+ def _usage(data: memoryview) -> dict[str, int]:
395
+ fields = dict(_fields(data, {2, 3, 4, 5, 9}))
396
+ uncached, output, writes, reads, reasoning = (
397
+ _number(fields, n) for n in (2, 3, 4, 5, 9)
398
+ )
399
+ # Antigravity stores the three input categories separately. Its output field
400
+ # includes reasoning, as confirmed against response_output_tokens.
401
+ if reasoning > output or uncached + writes + reads + output > MAX_BIGINT:
402
+ raise _InvalidRecord
403
+ return tokens(
404
+ uncached=uncached,
405
+ cached=reads,
406
+ cache_write=writes,
407
+ visible=output - reasoning,
408
+ reasoning=reasoning,
409
+ )
410
+
411
+
412
+ def _normalize(
413
+ snapshot: Snapshot,
414
+ machine: str,
415
+ external_id: str,
416
+ steps: dict[int, _Step],
417
+ calls: dict[int, _Call],
418
+ ) -> None:
419
+ conversation_id = f"antigravity:{external_id}"
420
+ turn: dict[str, Any] | None = None
421
+ last_step: _Step | None = None
422
+ turns_by_planner: dict[int, dict[str, Any] | None] = {}
423
+ timestamps: list[datetime] = []
424
+ for idx, step in sorted(steps.items()):
425
+ timestamps.extend(
426
+ time for time in (step.created, step.started, step.completed) if time
427
+ )
428
+ if step.kind == _USER_INPUT:
429
+ _finish(turn, last_step)
430
+ turn = new_turn(conversation_id, str(idx), step.created)
431
+ snapshot.turns.append(turn)
432
+ last_step = None
433
+ elif step.kind in (_PLANNER_RESPONSE, _GENERIC_TOOL):
434
+ last_step = step
435
+ if step.kind == _PLANNER_RESPONSE:
436
+ turns_by_planner[idx] = turn
437
+ if step.tool is not None:
438
+ if turn is not None:
439
+ turn["tool_calls"] += 1
440
+ _append_tool(
441
+ snapshot, conversation_id, idx, step, turn["id"] if turn else None
442
+ )
443
+
444
+ _finish(turn, last_step)
445
+
446
+ totals = empty_tokens()
447
+ models: set[str] = set()
448
+ matched_planners: set[int] = set()
449
+ for idx, call in sorted(calls.items()):
450
+ if call.planner_index in matched_planners:
451
+ snapshot.malformed_records += 1
452
+ continue
453
+ matched_planners.add(call.planner_index)
454
+ add_tokens(totals, call.usage)
455
+ models.add(call.model)
456
+ planner = steps[call.planner_index]
457
+ turn = turns_by_planner[call.planner_index]
458
+ if turn is not None:
459
+ turn["model_calls"] += 1
460
+ add_tokens(turn, call.usage)
461
+ snapshot.model_calls.append(
462
+ {
463
+ "id": f"{conversation_id}:model:{idx}",
464
+ "conversation_id": conversation_id,
465
+ "turn_id": turn["id"] if turn else None,
466
+ "sequence": idx,
467
+ "timestamp": iso(planner.started or planner.created),
468
+ "model": call.model,
469
+ **call.usage,
470
+ }
471
+ )
472
+
473
+ start, end = min(timestamps, default=None), max(timestamps, default=None)
474
+ snapshot.conversations.append(
475
+ {
476
+ "id": conversation_id,
477
+ "provider": "antigravity",
478
+ "external_id": external_id,
479
+ "source_machine": machine,
480
+ "project": "outside-project",
481
+ "project_source": "none",
482
+ "started_at": iso(start),
483
+ "ended_at": iso(end),
484
+ "duration_seconds": (end - start).total_seconds()
485
+ if start and end
486
+ else None,
487
+ "source": "local-sqlite",
488
+ "models": sorted(models)[:MAX_MODELS_PER_CONVERSATION],
489
+ "iterations": len(snapshot.turns),
490
+ "model_calls": len(snapshot.model_calls),
491
+ "tool_calls": len(snapshot.tool_calls),
492
+ "compactions": 0,
493
+ "event_count": len(steps) + len(snapshot.model_calls),
494
+ "content_hash": digest_records((steps, snapshot.model_calls)),
495
+ **totals,
496
+ }
497
+ )
498
+
499
+
500
+ def _finish(turn: dict[str, Any] | None, step: _Step | None) -> None:
501
+ if (
502
+ turn is not None
503
+ and step is not None
504
+ and step.kind == _PLANNER_RESPONSE
505
+ and step.status == _DONE
506
+ ):
507
+ finish_turn(turn, step.completed)
508
+
509
+
510
+ def _append_tool(
511
+ snapshot: Snapshot, conversation_id: str, idx: int, step: _Step, turn_id: str | None
512
+ ) -> None:
513
+ outcomes: dict[int, ToolOutcome] = {_DONE: "completed", _ERROR: "failed"}
514
+ outcome = outcomes.get(step.status, "unknown")
515
+ snapshot.tool_calls.append(
516
+ {
517
+ "id": f"{conversation_id}:tool:{idx}",
518
+ "conversation_id": conversation_id,
519
+ "turn_id": turn_id,
520
+ "sequence": idx,
521
+ "timestamp": iso(step.started or step.created),
522
+ "tool_name": step.tool,
523
+ "outer_tool_name": step.tool,
524
+ "outcome": outcome,
525
+ "outcome_source": "sqlite-step-status",
526
+ }
527
+ )
@@ -21,6 +21,10 @@ from cli_consumption.adapters._shared import (
21
21
  from cli_consumption.adapters.aider import AiderAdapter
22
22
  from cli_consumption.adapters.amazon_q import AmazonQAdapter
23
23
  from cli_consumption.adapters.amp import AmpAdapter
24
+ from cli_consumption.adapters.antigravity import (
25
+ AntigravityAdapter,
26
+ has_antigravity_store,
27
+ )
24
28
  from cli_consumption.adapters.base import (
25
29
  Adapter,
26
30
  IncrementalAdapter,
@@ -172,6 +176,7 @@ class ProviderDiagnostic:
172
176
 
173
177
 
174
178
  PROVIDER_HOME_UNAVAILABLE = "provider_home_unavailable"
179
+ _ANTIGRAVITY_HOME = HomeOverride("ANTIGRAVITY_HOME")
175
180
  _CLAUDE_HOME = HomeOverride("CLAUDE_CONFIG_DIR", comma_separated=True)
176
181
  _OPENCODE_HOME = HomeOverride("XDG_DATA_HOME", "opencode")
177
182
  _QUALIFIED_ON = "2026-12-03"
@@ -257,6 +262,32 @@ ADAPTER_SPECS = (
257
262
  "No subthreads, compactions, reasoning split, or latency.",
258
263
  ),
259
264
  ),
265
+ AdapterSpec(
266
+ "antigravity",
267
+ AntigravityAdapter,
268
+ ".t3/userdata/providers/antigravity",
269
+ ("*/antigravity-acp/conversations/*.db", "conversations/*.db"),
270
+ documented_source=(
271
+ "~/.t3/userdata/providers/antigravity/*/antigravity-acp/ and "
272
+ "~/.gemini/antigravity-cli/"
273
+ ),
274
+ local_homes=(
275
+ SourceHome(".t3/userdata/providers/antigravity", (_ANTIGRAVITY_HOME,)),
276
+ SourceHome(".gemini/antigravity-cli", (_ANTIGRAVITY_HOME,)),
277
+ ),
278
+ source_matcher=has_antigravity_store,
279
+ token_semantics="additive",
280
+ usage_signals=("cache", "toolOutcomes"),
281
+ qualification=_qualification(
282
+ "antigravity",
283
+ "ACP 1.5.17",
284
+ "SQLite trajectories with protobuf metadata",
285
+ "https://antigravity.google/docs/ide/extensions/acp/",
286
+ "Local cascade conversations only; standalone layout unverified; "
287
+ "no fork lineage or retries.",
288
+ qualified_on="2026-12-05",
289
+ ),
290
+ ),
260
291
  AdapterSpec(
261
292
  "codex",
262
293
  CodexAdapter,