Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(agentic-ide): add Antigravity CLI as a workspace harness

rubenluetke10-beepf01ac508e188
diff --git a/docs/os-parity.md b/docs/os-parity.md
index fe8fc5b774..0f25542480 100644
--- a/docs/os-parity.md
+++ b/docs/os-parity.md
@@ -241,6 +241,7 @@ experiences today.
| P-20 | Low | Coding-CLI panes | Kimi Code panes deliberately ship WITHOUT multi-subscription switching, unlike Claude Code and Codex. Three independent reasons, all recorded on the registry entry: the wound-down Python generation ignores `KIMI_CODE_HOME` entirely, so seats created on a machine that has it would all silently resolve to one login; its configuration and its credentials share a single `config.toml`, so no setup can be carried to a new seat without carrying the key with it; and its credential layout is unverified against a live install of the current generation | `jarvis/workspace/agents.py` (the `kimi` entry), `jarvis/agent_accounts.py::platforms` | All OSes: one Kimi login, and the account switcher honestly does not offer the CLI at all rather than showing a switch that does nothing. Unblocked by verifying the current generation's credential layout and gating the override on the generation probe |
| P-22 | Low | Orb window | The floating orb window (both looks: the Gigi mascot and the procedural **voice orb**) is a Tk window whose transparency comes from a colour key. Windows keys it out natively; macOS uses Aqua-Tk's `-transparent` in the companion host; on Linux the attribute is accepted only under a **compositing** window manager, and not at all on Wayland | `ui/orb/overlay.py::_apply_color_key`, `_build_renderer`, `jarvis/ui/jarvisbar/host.py::_build_surface` | Windows/macOS: full parity, including drag-to-any-monitor and the live mascot↔voice-orb switch. Linux with a compositor (GNOME/KDE/picom): works. Linux without one, and Wayland: the window would be an opaque magenta square, so it is NOT shown — the surface logs one actionable English line and stays hidden; voice, tray and the app window are unaffected. Note the Jarvis Bar degrades DIFFERENTLY on such a session (it keeps drawing and shows its key colour — pre-existing, the `transparentcolor unsupported` branch in `jarvis/ui/jarvisbar/overlay.py::JarvisBarOverlay.start`), so "None (hidden)" is the honest display style on a non-compositing Linux desktop until the bar adopts the same gate |
| P-21 | Low | Coding-CLI panes | OpenCode panes ship single-login for the same class of reason: the only variable that moves its credentials and session database is `XDG_DATA_HOME`, which is a SHARED variable rather than a dedicated override — redirecting it per pane would also redirect any other XDG-aware tool the agent spawns inside that pane | `jarvis/workspace/agents.py` (the `opencode` entry) | All OSes: one OpenCode login. Verified on Windows that `XDG_DATA_HOME` does move `auth.json` and the session database; the blast radius on macOS and Linux has not been measured, which is why it is not wired up |
+| P-38 | Low | Coding-CLI panes | Antigravity (`agy`) panes ship single-login. `GEMINI_HOME` would move the login, but it is a shared variable (the Gemini CLI, mission workers and the pane would all follow it), and `agy` has no `login` subcommand to point at an account directory — sign-in lives on the API-Keys page. The installer is OS-split (`install.ps1` on Windows, `install.sh` elsewhere); the binary also lands in `%LOCALAPPDATA%\agy\bin` on Windows, which `path_augment` already probes | `jarvis/workspace/agents.py` (the `antigravity` entry), `jarvis/google_cli/auth_service.py`, `jarvis/core/path_augment.py` | All OSes: one Google login, and the account switcher does not offer the CLI. Unblocked by a dedicated override that does not also redirect the Gemini CLI |
| P-22 | Low | Coding-CLI panes | Kimi Code uses the bundled Git Bash as its shell environment on Windows, so without Git for Windows installed the binary answers `--version` correctly and the agent then cannot run a single shell command | Kimi vendor docs; `jarvis/workspace/agents.py` (the `kimi` entry) | Windows without Git for Windows: the pane opens, the CLI reports a healthy version, and shell commands fail inside it. macOS/Linux unaffected. `KIMI_SHELL_PATH` points at a non-standard `bash.exe`. An install check that only runs `--version` cannot see this |
| P-23 | Info | Coding-CLI panes | Kimi Code's alternate screen cannot be disabled (an open upstream request notes it is the outlier versus Claude Code, Codex and the Gemini CLI), so it may conflict with the pane's own scrollback the way a Claude Code pane once did | Upstream issue; `jarvis/agentic_ide/screen.py` | All OSes equally — not an OS gap, recorded here because it is the same class of pane defect and is expected to need the same kind of fix |
| P-27 | Low | Mouse-button shortcuts | A shortcut may now be a MOUSE BUTTON (middle, and the two side buttons — `mouse_middle` / `mouse_x1` / `mouse_x2`). All three OSes are implemented in the same change and share one token vocabulary, but the delivery is not uniform: Windows needs nothing extra (the backend polls `GetAsyncKeyState`, which reports mouse buttons); macOS needs pyobjc `Quartz` plus the Accessibility + Input Monitoring grants the hotkey tap already requires; Linux/X11 needs `pynput`, which is the opt-in `[desktop-linux]` extra for the reason recorded in P-24 (`evdev` is source-only). Wayland cannot do it at all — no global button grab exists, the same design reason keyboard shortcuts degrade there. The left and right buttons are deliberately not bindable on any OS: their meaning follows the system "swap mouse buttons" setting, so a shortcut recorded as "left" would fire on the physical right button for a left-handed user | `jarvis/trigger/hotkey.py::mouse_hotkeys_available`, `backends/global_hotkeys.py::_MOUSE_TOKEN_TO_VK`, `backends/pynput.py::_start_mouse_listener`, `backends/quartz.py::_MOUSE_BUTTON_TO_TOKEN` | Every host answers the capability question BEFORE offering the control: `mouse_hotkeys_available()` returns an English sentence naming what is missing and what still works, and a backend that cannot start its mouse hook logs the same thing and keeps the KEYBOARD shortcuts alive rather than failing the whole binding. macOS/Linux desktop with the extras: full parity with Windows. Wayland and headless: key combinations only |
diff --git a/jarvis/agentic_ide/agent_sessions.py b/jarvis/agentic_ide/agent_sessions.py
index 758280b08b..7b6f1596a9 100644
--- a/jarvis/agentic_ide/agent_sessions.py
+++ b/jarvis/agentic_ide/agent_sessions.py
@@ -2,9 +2,9 @@
A pane of the Agentic IDE is not the conversation it shows. The conversation
lives inside the agent's own CLI — every coding CLI here (Claude Code, Codex,
-OpenCode, Kimi Code, Grok Build, and the launch profiles over them) keeps its
-own history on disk — and all this module does is hold the one string needed
-to point back at it: a *resume handle*.
+OpenCode, Kimi Code, Grok Build, Antigravity, and the launch profiles over
+them) keeps its own history on disk — and all this module does is hold the
+one string needed to point back at it: a *resume handle*.
That indirection is what makes a workspace survivable. Closing the browser kills
every agent process (deliberately: an unwatched agent burns tokens invisibly),
@@ -23,9 +23,10 @@ shapes cover all of them — ASSIGNED at launch, or DISCOVERED afterwards:
Codex panes in one repository would all resume the SAME conversation and two
users' work would silently vanish. Every pane must carry its own id.
* **Grok Build** is the Claude Code shape (``--session-id`` at launch,
- ``--resume`` later); **OpenCode** and **Kimi Code** are the Codex shape
- (the id is theirs to choose — a database row, a session directory — and
- ours to find by folder and time). Each adapter below says which.
+ ``--resume`` later); **OpenCode**, **Kimi Code** and **Antigravity** are
+ the Codex shape (the id is theirs to choose — a database row, a session
+ directory, a conversation UUID — and ours to find by folder and time).
+ Each adapter below says which.
Callers never branch on an agent name (AP-21). They ask this module whether a
handle can be minted, spent, or found, and an agent that answers "no" degrades
@@ -56,6 +57,7 @@ from dataclasses import dataclass
from datetime import UTC, datetime, timedelta
from pathlib import Path
from typing import Any
+from urllib.parse import unquote, urlparse
from uuid import uuid4
from loguru import logger
@@ -205,6 +207,16 @@ _ADAPTERS: dict[str, _Adapter] = {
discover=None,
exists=lambda handle, home: _grok_conversation_exists(handle, home),
),
+ "antigravity": _Adapter(
+ kind="agy_session",
+ launch=_discovered_launch,
+ # ``agy --conversation <id>`` is the long form; there is no short flag.
+ resume=lambda session_id: ("--conversation", session_id),
+ discover=lambda cwd, started, taken, home: _discover_antigravity(
+ cwd, started, taken, home
+ ),
+ exists=lambda handle, home: _agy_conversation_exists(handle, home),
+ ),
}
@@ -1012,6 +1024,7 @@ def _grok_conversation_exists(handle: ResumeHandle, home: Path | None = None) ->
# Every other record in `updates.jsonl` (hook runs, agent chunks, turn ends) can
# appear without a conversation ever having happened.
_GROK_USER_TURN_MARKER = b'"user_message_chunk"'
+_AGY_USER_TURN_MARKER = b'"USER_INPUT"'
def _grok_log_has_user_turn(log: Path) -> bool:
@@ -1028,6 +1041,205 @@ def _grok_log_has_user_turn(log: Path) -> bool:
return False
+# -------------------------------------------------------------- Antigravity
+def _agy_cli_root(override: Path | None = None) -> Path:
+ """The Antigravity CLI data root: ``<gemini-home>/antigravity-cli``.
+
+ ``GEMINI_HOME`` (when set) IS the ``.gemini`` directory, not its parent —
+ the same convention ``jarvis.google_cli.isolated_home`` uses. A test
+ passes an explicit home and files live at ``<home>/.gemini/antigravity-cli``.
+ """
+ if override is not None:
+ return Path(override).expanduser() / ".gemini" / "antigravity-cli"
+ raw = os.environ.get("GEMINI_HOME", "").strip()
+ base = Path(raw).expanduser() if raw else Path.home() / ".gemini"
+ return base / "antigravity-cli"
+
+
+def _agy_conversation_db(root: Path, session_id: str) -> Path | None:
+ if not session_id or "/" in session_id or "\\" in session_id:
+ return None
+ path = root / "conversations" / f"{session_id}.db"
+ return path if path.is_file() else None
+
+
+def _agy_transcript(root: Path, session_id: str) -> Path:
+ return (
+ root
+ / "brain"
+ / session_id
+ / ".system_generated"
+ / "logs"
+ / "transcript.jsonl"
+ )
+
+
+def _agy_log_has_user_turn(log: Path) -> bool:
+ """Does this transcript record at least one user turn?
+
+ Opening a pane already writes the conversation database; resuming one
+ without a user turn reopens an empty TUI. The marker is the JSONL
+ ``type`` Antigravity writes for an explicit user message (measured on
+ agy 1.1.20).
+ """
+ try:
+ with log.open("rb") as handle:
+ return any(_AGY_USER_TURN_MARKER in line for line in handle)
+ except OSError:
+ return False
+
+
+def _agy_conversation_exists(handle: ResumeHandle, home: Path | None = None) -> bool:
+ """True when Antigravity has a conversation with at least one user turn."""
+ session_id = handle.id
+ root = _agy_cli_root(home)
+ if _agy_conversation_db(root, session_id) is None:
+ return False
+ return _agy_log_has_user_turn(_agy_transcript(root, session_id))
+
+
+def _agy_file_uri_path(uri: str) -> str:
+ """``file:///C:/Users/...`` → a filesystem path, or empty when it is not one."""
+ raw = (uri or "").strip()
+ if not raw.lower().startswith("file:"):
+ return ""
+ parsed = urlparse(raw)
+ path = unquote(parsed.path or "")
+ if os.name == "nt" and path.startswith("/") and len(path) >= 3 and path[2] == ":":
+ path = path[1:]
+ return path
+
+
+def _agy_cwd_matches(recorded: str, cwd: str) -> bool:
+ if not recorded or not cwd:
+ return False
+ try:
+ return os.path.normcase(os.path.normpath(recorded)) == os.path.normcase(
+ os.path.normpath(cwd)
+ )
+ except (OSError, ValueError, TypeError):
+ return False
+
+
+def _agy_last_conversations(root: Path) -> dict[str, str]:
+ path = root / "cache" / "last_conversations.json"
+ try:
+ parsed = json.loads(path.read_text(encoding="utf-8", errors="replace"))
+ except (OSError, ValueError):
+ return {}
+ if not isinstance(parsed, dict):
+ return {}
+ out: dict[str, str] = {}
+ for key, value in parsed.items():
+ cwd = str(key or "").strip()
+ session_id = str(value or "").strip()
+ if cwd and session_id:
+ out[cwd] = session_id
+ return out
+
+
+def _agy_summaries_for_cwd(root: Path, cwd: str) -> list[tuple[float, str]]:
+ """``(mtime, session_id)`` of conversations whose workspace is ``cwd``."""
+ db = root / "conversation_summaries.db"
+ if not db.is_file():
+ return []
+ import sqlite3
+
+ try:
+ uri = f"file:{db.as_posix()}?mode=ro"
+ conn = sqlite3.connect(uri, uri=True, timeout=2.0)
+ except Exception: # noqa: BLE001 - summaries are a convenience
+ return []
+ found: list[tuple[float, str]] = []
+ try:
+ for row in conn.execute(
+ "SELECT conversation_id, workspace_uris, last_modified_time, "
+ "last_user_input_step_index FROM conversation_summaries"
+ ):
+ session_id = str(row[0] or "").strip()
+ if not session_id:
+ continue
+ try:
+ uris = json.loads(row[1] or "[]")
+ except (TypeError, ValueError):
+ uris = []
+ if not isinstance(uris, list):
+ continue
+ if not any(
+ _agy_cwd_matches(_agy_file_uri_path(str(uri)), cwd) for uri in uris
+ ):
+ continue
+ try:
+ stamp = datetime.fromisoformat(str(row[2] or "").replace("Z", "+00:00"))
+ mtime = stamp.timestamp()
+ except (TypeError, ValueError):
+ mtime = 0.0
+ found.append((mtime, session_id))
+ except Exception as exc: # noqa: BLE001
+ logger.debug("Agentic IDE: antigravity summaries unreadable: {}", exc)
+ finally:
+ conn.close()
+ return found
+
+
+def _discover_antigravity(
+ cwd: str,
+ started_at: float,
+ taken: Collection[str],
+ home: Path | None,
+) -> ResumeHandle | None:
+ """Find the conversation a pane started at ``started_at`` in ``cwd`` created.
+
+ Antigravity assigns the id; we cannot mint one. ``last_conversations.json``
+ maps a folder to its newest conversation, and the summaries database
+ records every conversation's workspace URI. Both are searched, newest
+ first, and an id another pane already holds is skipped.
+ """
+ root = _agy_cli_root(home)
+ taken_ids = {str(item) for item in taken}
+ floor = started_at - _SKEW_S
+ candidates: list[tuple[float, str]] = []
+
+ for recorded_cwd, session_id in _agy_last_conversations(root).items():
+ if session_id in taken_ids or not _agy_cwd_matches(recorded_cwd, cwd):
+ continue
+ db = _agy_conversation_db(root, session_id)
+ if db is None:
+ continue
+ try:
+ mtime = db.stat().st_mtime
+ except OSError:
+ continue
+ if mtime < floor:
+ continue
+ candidates.append((mtime, session_id))
+
+ for mtime, session_id in _agy_summaries_for_cwd(root, cwd):
+ if session_id in taken_ids or mtime < floor:
+ continue
+ if _agy_conversation_db(root, session_id) is None:
+ continue
+ candidates.append((mtime, session_id))
+
+ seen: set[str] = set()
+ ordered: list[tuple[float, str]] = []
+ for stamp, session_id in sorted(candidates, key=lambda item: item[0]):
+ if session_id in seen or session_id in taken_ids:
+ continue
+ seen.add(session_id)
+ if not _agy_log_has_user_turn(_agy_transcript(root, session_id)):
+ continue
+ ordered.append((stamp, session_id))
+ if len(ordered) >= _MAX_CANDIDATES:
+ break
+ if not ordered:
+ return None
+ # The earliest unclaimed conversation after the pane started is this
+ # pane's — later ones belong to panes opened in the same batch.
+ _stamp, session_id = ordered[0]
+ return ResumeHandle(kind="agy_session", id=session_id, captured_at=_stamp)
+
+
__all__ = [
"ResumeHandle",
"can_resume",
diff --git a/jarvis/agentic_ide/intent.py b/jarvis/agentic_ide/intent.py
index 778515e1a7..db8a31ca55 100644
--- a/jarvis/agentic_ide/intent.py
+++ b/jarvis/agentic_ide/intent.py
@@ -1927,7 +1927,6 @@ _UNSUPPORTED_CLI_SPELLINGS: dict[str, str] = {
"gimini": "Gemini",
"giming": "Gemini",
"jemini": "Gemini",
- "antigravity": "Antigravity",
"aider": "Aider",
"windsurf": "Windsurf",
"copilot": "Copilot",
diff --git a/jarvis/agentic_ide/names.py b/jarvis/agentic_ide/names.py
index c14f320906..39ebd883b7 100644
--- a/jarvis/agentic_ide/names.py
+++ b/jarvis/agentic_ide/names.py
@@ -68,6 +68,8 @@ _KNOWN_PRODUCTS: frozenset[str] = frozenset(
"grok",
"deepseek",
"dsh",
+ "antigravity",
+ "agy",
}
)
diff --git a/jarvis/costs/cli_usage_index.py b/jarvis/costs/cli_usage_index.py
index dac89dc643..e9327b09f1 100644
--- a/jarvis/costs/cli_usage_index.py
+++ b/jarvis/costs/cli_usage_index.py
@@ -118,8 +118,17 @@ AGENT_CLAUDE = "claude-cli"
AGENT_CODEX = "codex-cli"
"""The Codex CLI."""
+AGENT_KIMI = "kimi-cli"
+"""Kimi Code. Both generations keep wire logs under ``~/.kimi`` /
+``~/.kimi-code``. Historically stored under the ``agy-cli`` name; renamed
+when Antigravity (the Google ``agy`` binary) gained its own reader so the
+two no longer share a Spend row."""
+
AGENT_AGY = "agy-cli"
-"""The agy CLI (both generations of its data root)."""
+"""Antigravity (``agy``). Conversations live as SQLite files under
+``~/.gemini/antigravity-cli/conversations/<uuid>.db``. Token counts are
+inside the protobuf ``gen_metadata`` blobs (measured on agy 1.1.20); the
+model id is a string field on the same blob (``gemini-3.7-flash``, …)."""
AGENT_GROK = "grok-cli"
"""Grok Build (``~/.grok``). ``sessions/<url-encoded cwd>/<uuid>/updates.jsonl``
@@ -139,7 +148,14 @@ user brings their own key — the ``cost`` OpenCode itself computed. Read
with a timestamp cursor instead of a byte offset; the message id is the
identity. Not a subscription: the recorded cost is the bill."""
-AGENTS: tuple[str, ...] = (AGENT_CLAUDE, AGENT_CODEX, AGENT_AGY, AGENT_GROK, AGENT_OPENCODE)
+AGENTS: tuple[str, ...] = (
+ AGENT_CLAUDE,
+ AGENT_CODEX,
+ AGENT_KIMI,
+ AGENT_AGY,
+ AGENT_GROK,
+ AGENT_OPENCODE,
+)
#: Every coding harness the workspace registry can open, mapped to the
#: index reader that counts its spend. A harness whose transcripts cannot be
@@ -150,7 +166,8 @@ AGENTS: tuple[str, ...] = (AGENT_CLAUDE, AGENT_CODEX, AGENT_AGY, AGENT_GROK, AGE
COST_READER_FOR_HARNESS: dict[str, str] = {
"claude": AGENT_CLAUDE,
"codex": AGENT_CODEX,
- "kimi": AGENT_AGY,
+ "kimi": AGENT_KIMI,
+ "antigravity": AGENT_AGY,
"grok-build": AGENT_GROK,
"opencode": AGENT_OPENCODE,
# GLM runs the Claude Code binary against z.ai with the same config
@@ -227,9 +244,12 @@ _ROLLOUT_ID = re.compile(r"([0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}
# 2 — Codex: cached input subtracted from input; lineage-based dedup.
# 3 — cost_usd column (OpenCode records its own price). Additive: migrated
# in place, no rebuild.
-_SCHEMA_VERSION = 3
+# 4 — kimi wire logs were stored as ``agy-cli``; Antigravity (the Google
+# ``agy`` binary) has its own conversation DBs. Rebuild so the two no
+# longer share a Spend row.
+_SCHEMA_VERSION = 4
#: Versions whose rows are still right and only need columns added.
-_MIGRATE_IN_PLACE_FROM = 2
+_MIGRATE_IN_PLACE_FROM = 4
_SCHEMA = """
CREATE TABLE IF NOT EXISTS indexed_files (
@@ -295,9 +315,9 @@ _UPSERT_FILE = (
class CliTurn:
"""One model call a coding CLI made, as its own transcript recorded it.
- ``model`` is empty where the CLI does not write one down (agy), and
- ``cwd`` is empty where its layout does not preserve it (agy's legacy
- per-folder buckets are an MD5 of the directory, not the directory).
+ ``model`` is empty where the CLI does not write one down (Kimi's wire
+ log), and ``cwd`` is empty where its layout does not preserve it
+ (Kimi's legacy per-folder buckets are an MD5 of the directory).
"""
agent: str
@@ -553,12 +573,24 @@ def _codex_roots(home: Path | None) -> list[Path]:
return _dedup_paths(roots)
-def _agy_roots(home: Path | None) -> list[Path]:
- """Both generations. A machine can carry both histories at once."""
+def _kimi_roots(home: Path | None) -> list[Path]:
+ """Both Kimi generations. A machine can carry both histories at once."""
base = home if home is not None else Path.home()
return [base / ".kimi", base / ".kimi-code"]
+def _antigravity_roots(home: Path | None) -> list[Path]:
+ """``GEMINI_HOME`` when set (that directory IS ``.gemini``), else ``~/.gemini``."""
+ if home is not None:
+ return [home / ".gemini"]
+ roots: list[Path] = []
+ override = os.environ.get("GEMINI_HOME", "").strip()
+ if override:
+ roots.append(Path(override).expanduser())
+ roots.append(Path.home() / ".gemini")
+ return _dedup_paths(roots)
+
+
def _opencode_roots(home: Path | None) -> list[Path]:
"""``$XDG_DATA_HOME/opencode``, else ``~/.local/share/opencode`` — the
same path on every OS, which is how OpenCode itself resolves it."""
@@ -593,10 +625,12 @@ _LAYOUTS: tuple[tuple[str, str], ...] = (
(AGENT_CODEX, "sessions/*/*/*/rollout-*.jsonl"),
# Older Codex builds filed rollouts flat.
(AGENT_CODEX, "sessions/rollout-*.jsonl"),
- # agy, legacy layout (``sessions/<md5>/<session>/wire.jsonl``).
- (AGENT_AGY, "sessions/*/*/wire.jsonl"),
- # agy, current layout (``sessions/<wd_...>/<session>/agents/<name>/wire.jsonl``).
- (AGENT_AGY, "sessions/*/*/agents/*/wire.jsonl"),
+ # Kimi, legacy layout (``sessions/<md5>/<session>/wire.jsonl``).
+ (AGENT_KIMI, "sessions/*/*/wire.jsonl"),
+ # Kimi, current layout (``sessions/<wd_...>/<session>/agents/<name>/wire.jsonl``).
+ (AGENT_KIMI, "sessions/*/*/agents/*/wire.jsonl"),
+ # Antigravity: one SQLite conversation per UUID.
+ (AGENT_AGY, "antigravity-cli/conversations/*.db"),
# Grok Build: one folder per session under a url-encoded cwd.
(AGENT_GROK, "sessions/*/*/updates.jsonl"),
# OpenCode: the one SQLite store.
@@ -613,7 +647,29 @@ def _roots_for(agent: str, home: Path | None) -> list[Path]:
return _grok_roots(home)
if agent == AGENT_OPENCODE:
return _opencode_roots(home)
- return _agy_roots(home)
+ if agent == AGENT_AGY:
+ return _antigravity_roots(home)
+ return _kimi_roots(home)
+
+
+def _sqlite_stat(path: Path) -> tuple[int, int]:
+ """``(size, mtime_ns)`` for a SQLite file, WAL included.
+
+ Antigravity (and any SQLite store) writes new turns into the WAL while
+ the ``.db`` file stays the same size. Counting only the main file would
+ skip a live conversation until the next checkpoint.
+ """
+ try:
+ stat = path.stat()
+ except OSError:
+ return 0, 0
+ size = stat.st_size
+ mtime_ns = stat.st_mtime_ns
+ try:
+ wal = path.with_name(path.name + "-wal").stat()
+ except OSError:
+ return size, mtime_ns
+ return size + wal.st_size, max(mtime_ns, wal.st_mtime_ns)
def _discover(home: Path | None) -> list[_Candidate]:
@@ -637,7 +693,11 @@ def _discover(home: Path | None) -> list[_Candidate]:
if key in found:
continue
try:
- stat = path.stat()
+ if path.suffix == ".db":
+ size, mtime_ns = _sqlite_stat(path)
+ else:
+ stat = path.stat()
+ size, mtime_ns = stat.st_size, stat.st_mtime_ns
except OSError as exc:
log.debug("cli usage index: %s not stat-able (%s)", path, exc)
continue
@@ -645,8 +705,8 @@ def _discover(home: Path | None) -> list[_Candidate]:
path=path,
key=key,
agent=agent,
- size=stat.st_size,
- mtime_ns=stat.st_mtime_ns,
+ size=size,
+ mtime_ns=mtime_ns,
)
return list(found.values())
@@ -1004,6 +1064,250 @@ class _FileScan:
failed: bool = False
+_AGY_MODEL_RE = re.compile(
+ r"^(gemini-[\w.-]+|claude-[\w.-]+|gpt-oss-[\w.-]+)$", re.IGNORECASE
+)
+_AGY_EFFORT_SUFFIXES = ("-low", "-medium", "-high")
+
+
+def _agy_model_id(raw: str) -> str:
+ """Strip the effort suffix agy appends to Gemini ids (``-medium``)."""
+ model = raw.strip()
+ for suffix in _AGY_EFFORT_SUFFIXES:
+ if model.lower().endswith(suffix):
+ return model[: -len(suffix)]
+ return model
+
+
+def _pb_varint(buf: bytes, i: int) -> tuple[int, int] | None:
+ n = 0
+ shift = 0
+ while i < len(buf):
+ byte = buf[i]
+ i += 1
+ n |= (byte & 0x7F) << shift
+ if byte < 0x80:
+ return n, i
+ shift += 7
+ if shift > 70:
+ return None
+ return None
+
+
+def _pb_fields(buf: bytes) -> list[tuple[int, int, bytes | int]]:
+ """``(field, wire_type, value)`` for one protobuf message. Never raises."""
+ out: list[tuple[int, int, bytes | int]] = []
+ i = 0
+ n = len(buf)
+ while i < n:
+ parsed = _pb_varint(buf, i)
+ if parsed is None:
+ break
+ key, i = parsed
+ field, wtype = key >> 3, key & 7
+ if wtype == 0:
+ parsed = _pb_varint(buf, i)
+ if parsed is None:
+ break
+ val, i = parsed
+ out.append((field, wtype, val))
+ elif wtype == 1:
+ if i + 8 > n:
+ break
+ out.append((field, wtype, int.from_bytes(buf[i : i + 8], "little")))
+ i += 8
+ elif wtype == 2:
+ parsed = _pb_varint(buf, i)
+ if parsed is None:
+ break
+ length, i = parsed
+ if i + length > n:
+ break
+ out.append((field, wtype, buf[i : i + length]))
+ i += length
+ elif wtype == 5:
+ if i + 4 > n:
+ break
+ out.append((field, wtype, int.from_bytes(buf[i : i + 4], "little")))
+ i += 4
+ else:
+ break
+ return out
+
+
+def _agy_decode_str(value: bytes | int) -> str:
+ if not isinstance(value, (bytes, bytearray)):
+ return ""
+ try:
+ text = bytes(value).decode("utf-8")
+ except UnicodeDecodeError:
+ return ""
+ return text if text.isprintable() or "\n" in text else ""
+
+
+def _agy_usage_from_fields(
+ fields: list[tuple[int, int, bytes | int]],
+) -> tuple[int, int, int] | None:
+ """A nested message is usage when it names a bot and carries token counts.
+
+ Shape measured on agy 1.1.20 ``gen_metadata`` blobs: field 2 = uncached
+ input, field 3 = output, field 5 = cache read, field 7 = ``bot-<uuid>``.
+ """
+ by_field: dict[int, list[bytes | int]] = {}
+ for field, _wtype, value in fields:
+ by_field.setdefault(field, []).append(value)
+ bot = next((_agy_decode_str(v) for v in by_field.get(7, [])), "")
+ if not bot.startswith("bot-"):
+ return None
+ tokens_in = next((int(v) for v in by_field.get(2, []) if isinstance(v, int)), 0)
+ tokens_out = next((int(v) for v in by_field.get(3, []) if isinstance(v, int)), 0)
+ tokens_cached = next((int(v) for v in by_field.get(5, []) if isinstance(v, int)), 0)
+ if tokens_in + tokens_out + tokens_cached <= 0:
+ return None
+ return tokens_in, tokens_out, tokens_cached
+
+
+def _agy_collect_usage(
+ buf: bytes, found: list[tuple[int, int, int]], depth: int = 0
+) -> None:
+ if depth > 8 or not buf:
+ return
+ fields = _pb_fields(buf)
+ usage = _agy_usage_from_fields(fields)
+ if usage is not None:
+ found.append(usage)
+ return
+ for _field, wtype, value in fields:
+ if wtype == 2 and isinstance(value, (bytes, bytearray)):
+ _agy_collect_usage(bytes(value), found, depth + 1)
+
+
+def _agy_model_from_blob(buf: bytes, depth: int = 0) -> str:
+ if depth > 6 or not buf:
+ return ""
+ for _field, wtype, value in _pb_fields(buf):
+ if wtype != 2:
+ continue
+ text = _agy_decode_str(value if isinstance(value, (bytes, bytearray)) else b"")
+ if text and _AGY_MODEL_RE.match(text):
+ return _agy_model_id(text)
+ for _field, wtype, value in _pb_fields(buf):
+ if wtype == 2 and isinstance(value, (bytes, bytearray)):
+ nested = _agy_model_from_blob(bytes(value), depth + 1)
+ if nested:
+ return nested
+ return ""
+
+
+def _agy_cwd_from_blob(buf: bytes) -> str:
+ """Best-effort working directory from a ``file:///`` URI in the blob.
+
+ The URI sits inside a protobuf length-delimited string, so the bytes
+ after it are the next field, not path characters. Stop at the first
+ character a file URI cannot contain.
+ """
+ try:
+ text = buf.decode("utf-8", errors="replace")
+ except Exception: # noqa: BLE001
+ return ""
+ marker = "file:///"
+ start = text.lower().find(marker)
+ if start < 0:
+ return ""
+ end = start + len(marker)
+ while end < len(text) and (text[end].isalnum() or text[end] in ":/%._-"):
+ end += 1
+ uri = text[start:end]
+ path = uri[len("file://") :] # keep the slash that starts a POSIX path
+ if path.startswith("/") and len(path) >= 3 and path[2] == ":":
+ path = path[1:]
+ from urllib.parse import unquote
+
+ return unquote(path)
+
+
+def _scan_antigravity(cand: _Candidate, start: int) -> _FileScan:
+ """Read one Antigravity conversation database.
+
+ ``start`` is unused: a conversation DB is small and the WAL can rewrite
+ earlier rows, so a change always re-reads. Dedup is ``session_id:idx``.
+ """
+ del start
+ rows: list[_Row] = []
+ session_id = cand.path.stem
+ cwd = ""
+ model = ""
+ failed = False
+ try:
+ uri = f"file:{cand.path.as_posix()}?mode=ro"
+ conn = sqlite3.connect(uri, uri=True, timeout=_DB_TIMEOUT_S)
+ except sqlite3.Error as exc:
+ log.warning("cli usage index: %s not readable (%s)", cand.path, exc)
+ return _FileScan(
+ rows=[], offset=cand.size, cursor=_Cursor(), bytes_read=0, reason="error", failed=True
+ )
+ try:
+ conn.row_factory = sqlite3.Row
+ try:
+ blob_row = conn.execute(
+ "SELECT data FROM trajectory_metadata_blob LIMIT 1"
+ ).fetchone()
+ except sqlite3.Error:
+ blob_row = None
+ if blob_row is not None and blob_row["data"]:
+ cwd = _agy_cwd_from_blob(blob_row["data"])
+ try:
+ meta_rows = list(conn.execute("SELECT idx, data FROM gen_metadata ORDER BY idx"))
+ except sqlite3.Error as exc:
+ log.debug("cli usage index: %s has no gen_metadata (%s)", cand.path, exc)
+ meta_rows = []
+ ts_ms = cand.mtime_ns // 1_000_000
+ label = _clip(Path(cwd).name if cwd else session_id)
+ for meta in meta_rows:
+ blob = meta["data"]
+ if not blob:
+ continue
+ if not model:
+ model = _agy_model_from_blob(blob)
+ found: list[tuple[int, int, int]] = []
+ _agy_collect_usage(blob, found)
+ idx = _int(meta["idx"])
+ for call_i, (tokens_in, tokens_out, tokens_cached) in enumerate(found):
+ rows.append(
+ (
+ cand.agent,
+ f"{session_id}:{idx}:{call_i}",
+ cand.key,
+ session_id,
+ ts_ms,
+ model,
+ tokens_in,
+ tokens_out,
+ tokens_cached,
+ cwd,
+ label,
+ )
+ )
+ except sqlite3.Error as exc:
+ log.warning("cli usage index: %s query failed (%s)", cand.path, exc)
+ failed = True
+ finally:
+ conn.close()
+ return _FileScan(
+ rows=rows,
+ offset=cand.size,
+ cursor=_Cursor(
+ session_id=session_id,
+ model=model,
+ cwd=cwd,
+ label=_clip(Path(cwd).name if cwd else session_id),
+ ),
+ bytes_read=cand.size,
+ reason="eof",
+ failed=failed,
+ )
+
+
def _scan_opencode(cand: _Candidate, start: int) -> _FileScan:
"""Read OpenCode's store. ``start`` is the newest ``time_created`` already
indexed (the "offset" column holds a timestamp for this agent), so a run
@@ -1086,9 +1390,11 @@ def _scan(cand: _Candidate, start: int, cursor: _Cursor, deadline: float) -> _Fi
"""Read one transcript from ``start`` and return the turns it added."""
if cand.agent == AGENT_OPENCODE:
return _scan_opencode(cand, start)
+ if cand.agent == AGENT_AGY:
+ return _scan_antigravity(cand, start)
rows: list[_Row] = []
reader = _LineReader(None, start)
- if cand.agent == AGENT_AGY and not cursor.session_id:
+ if cand.agent == AGENT_KIMI and not cursor.session_id:
cursor.session_id, cursor.cwd, cursor.label = _agy_context(cand.path)
if cand.agent == AGENT_GROK and not cursor.session_id:
cursor.session_id, cursor.cwd, cursor.label, model = _grok_context(cand.path)
@@ -1133,7 +1439,9 @@ def _wanted(agent: str, raw: bytes) -> bool:
return any(mark in raw for mark in _CODEX_MARKS)
if agent == AGENT_GROK:
return _GROK_MARK in raw
- return _AGY_MARK in raw
+ if agent == AGENT_KIMI:
+ return _AGY_MARK in raw
+ return False
def _row_for(
@@ -1145,7 +1453,9 @@ def _row_for(
return _codex_row(record, offset, cand, cursor)
if agent == AGENT_GROK:
return _grok_row(record, offset, cand, cursor)
- return _agy_row(record, offset, cand, cursor)
+ if agent == AGENT_KIMI:
+ return _agy_row(record, offset, cand, cursor)
+ return None
# ---------------------------------------------------------------------------
@@ -1638,6 +1948,7 @@ __all__ = [
"AGENT_CLAUDE",
"AGENT_CODEX",
"AGENT_GROK",
+ "AGENT_KIMI",
"AGENT_OPENCODE",
"COST_READER_FOR_HARNESS",
"DB_NAME",
diff --git a/jarvis/costs/model.py b/jarvis/costs/model.py
index 88844c53de..057f5b9a15 100644
--- a/jarvis/costs/model.py
+++ b/jarvis/costs/model.py
@@ -129,6 +129,7 @@ SUBSCRIPTION_RUNNERS: frozenset[str] = frozenset(
"claude-cli",
"codex-cli",
"agy-cli",
+ "kimi-cli",
"grok-cli",
}
)
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.test.tsx
index e3651dd5f2..e5bcc7026f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.test.tsx
@@ -36,12 +36,20 @@ describe("AgentMark", () => {
expect(mark("claude").querySelector("img")).toBeNull();
unmount();
- render(<AgentMark agent="grok-build" label="Grok Build" />);
+ const grok = render(<AgentMark agent="grok-build" label="Grok Build" />);
expect(mark("grok-build").getAttribute("data-ground")).toBe("ink");
expect(mark("grok-build").getAttribute("data-logo")).toBe(
"/provider-logos/grok.svg",
);
expect(mark("grok-build").querySelector("img")).toBeNull();
+ grok.unmount();
+
+ render(<AgentMark agent="antigravity" label="Antigravity" />);
+ expect(mark("antigravity").getAttribute("data-ground")).toBe("ink");
+ expect(mark("antigravity").getAttribute("data-logo")).toBe(
+ "/provider-logos/antigravity.svg",
+ );
+ expect(mark("antigravity").querySelector("img")).toBeNull();
});
it("knows the harness whose own interface is not the terminal", () => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx
index 14bbceaa66..ff21b89da9 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx
@@ -33,6 +33,7 @@ interface LogoAsset {
}
const AGENT_LOGOS: Record<string, LogoAsset> = {
+ antigravity: { url: "/provider-logos/antigravity.svg", ground: "ink" },
claude: { url: "/provider-logos/claude.svg", ground: "ink" },
codex: { url: "/provider-logos/openai.svg", ground: "ink" },
"deepseek-harness": { url: "/agent-logos/deepseek.svg", ground: "ink" },
diff --git a/jarvis/ui/web/frontend/src/components/agentic/CustomCliDialog.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/CustomCliDialog.test.tsx
index 2183bb047c..28a0f4ea03 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/CustomCliDialog.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/CustomCliDialog.test.tsx
@@ -38,14 +38,14 @@ function text(testId: string): string {
}
const STORED: api.CustomCli = {
- id: "antigravity",
- display_name: "Antigravity",
- command: "agy",
- description: "Google's terminal coding CLI.",
+ id: "helix",
+ display_name: "Helix",
+ command: "helix",
+ description: "A user-added terminal CLI.",
file_reference: "quoted",
logo_url: "",
runs_through_shell: false,
- binary: "agy",
+ binary: "helix",
};
const AGENTS: AgentStatus[] = [
@@ -57,20 +57,20 @@ const AGENTS: AgentStatus[] = [
install_command: null,
},
{
- name: "antigravity",
- display_name: "Antigravity",
+ name: "helix",
+ display_name: "Helix",
installed: true,
version: null,
install_command: null,
custom: true,
- description: "Google's terminal coding CLI.",
+ description: "A user-added terminal CLI.",
},
];
function Harness({ count = 4 }: { count?: number }) {
const [planned, setPlanned] = useState<PlannedTerminal[]>(
Array.from({ length: count }, (_, index) => ({
- agent: index === 0 ? "antigravity" : "",
+ agent: index === 0 ? "helix" : "",
name: `T${index + 1}`,
})),
);
@@ -204,7 +204,7 @@ describe("CustomCliDialog", () => {
vi.mocked(api.createCustomCli).mockResolvedValue(STORED);
vi.mocked(api.uploadCustomCliLogo).mockResolvedValue({
...STORED,
- logo_url: "/api/workspace-clis/antigravity/logo",
+ logo_url: "/api/workspace-clis/helix/logo",
});
render(
<CustomCliDialog open onOpenChange={() => {}} onSaved={() => {}} />,
@@ -223,7 +223,7 @@ describe("CustomCliDialog", () => {
fireEvent.click(screen.getByTestId("custom-cli-save"));
await waitFor(() => expect(api.uploadCustomCliLogo).toHaveBeenCalled());
- expect(api.uploadCustomCliLogo).toHaveBeenCalledWith("antigravity", file);
+ expect(api.uploadCustomCliLogo).toHaveBeenCalledWith("helix", file);
});
it("fills its fields from the entry being edited", () => {
@@ -235,8 +235,8 @@ describe("CustomCliDialog", () => {
onSaved={() => {}}
/>,
);
- expect(field("custom-cli-name").value).toBe("Antigravity");
- expect(field("custom-cli-command").value).toBe("agy");
+ expect(field("custom-cli-name").value).toBe("Helix");
+ expect(field("custom-cli-command").value).toBe("helix");
expect(field("custom-cli-at-reference").checked).toBe(true);
});
});
@@ -244,7 +244,7 @@ describe("CustomCliDialog", () => {
describe("AgentAllocation with a CLI of your own", () => {
it("offers editing only on the rows that have something to edit", () => {
render(<Harness />);
- expect(screen.getByTestId("custom-cli-edit-antigravity")).toBeTruthy();
+ expect(screen.getByTestId("custom-cli-edit-helix")).toBeTruthy();
expect(screen.queryByTestId("custom-cli-edit-claude")).toBeNull();
});
@@ -258,10 +258,10 @@ describe("AgentAllocation with a CLI of your own", () => {
logo_extensions: [".svg"],
});
render(<Harness />);
- fireEvent.click(screen.getByTestId("custom-cli-edit-antigravity"));
+ fireEvent.click(screen.getByTestId("custom-cli-edit-helix"));
await waitFor(() =>
- expect(field("custom-cli-command").value).toBe("agy"),
+ expect(field("custom-cli-command").value).toBe("helix"),
);
});
@@ -269,10 +269,10 @@ describe("AgentAllocation with a CLI of your own", () => {
vi.mocked(api.deleteCustomCli).mockResolvedValue({ ok: true });
render(<Harness />);
expect(JSON.parse(screen.getByTestId("plan").textContent ?? "[]")[0]).toEqual(
- { agent: "antigravity", name: "T1" },
+ { agent: "helix", name: "T1" },
);
- fireEvent.click(screen.getByTestId("custom-cli-remove-antigravity"));
+ fireEvent.click(screen.getByTestId("custom-cli-remove-helix"));
await waitFor(() =>
expect(
@@ -286,13 +286,13 @@ describe("AgentAllocation with a CLI of your own", () => {
it("reports a failed removal instead of pretending it worked", async () => {
vi.mocked(api.deleteCustomCli).mockRejectedValue(new Error("store is busy"));
render(<Harness />);
- fireEvent.click(screen.getByTestId("custom-cli-remove-antigravity"));
+ fireEvent.click(screen.getByTestId("custom-cli-remove-helix"));
await waitFor(() =>
expect(text("custom-cli-list-error")).toContain("store is busy"),
);
expect(JSON.parse(screen.getByTestId("plan").textContent ?? "[]")[0]).toEqual(
- { agent: "antigravity", name: "T1" },
+ { agent: "helix", name: "T1" },
);
});
});
diff --git a/jarvis/workspace/agents.py b/jarvis/workspace/agents.py
index 0a3a492c0e..5068060b44 100644
--- a/jarvis/workspace/agents.py
+++ b/jarvis/workspace/agents.py
@@ -97,6 +97,11 @@ class TrustSpec:
# Take a one-time copy before the first mutation. Worth it for a file the
# user's own CLI configuration shares; pointless for one we created.
backup: bool = False
+ # True when the per-project value is a SCALAR (a string or bool sitting
+ # directly on the path key) rather than an object with ``key`` inside.
+ # Antigravity's ``trustedFolders.json`` is ``{ "<path>": "TRUST_FOLDER" }``;
+ # writing an object there would be a file the CLI no longer recognises.
+ scalar: bool = False
@dataclass(frozen=True, slots=True)
@@ -416,6 +421,21 @@ GROK_TRUST = TrustSpec(
backup=True,
)
+#: Antigravity (``agy``) shares ``~/.gemini/trustedFolders.json`` with the
+#: Gemini CLI: a flat map of path → ``"TRUST_FOLDER"``. ``GEMINI_HOME`` moves
+#: the whole directory. Backed up because the file is not ours alone.
+ANTIGRAVITY_TRUST = TrustSpec(
+ filename="trustedFolders.json",
+ fmt="json",
+ section=(),
+ value="TRUST_FOLDER",
+ home_env="GEMINI_HOME",
+ subdir=".gemini",
+ both_path_forms=True,
+ backup=True,
+ scalar=True,
+)
+
def _grok_build_install() -> InstallMethods:
"""Official Grok Build installer for the OS that will run it.
@@ -431,6 +451,21 @@ def _grok_build_install() -> InstallMethods:
return InstallMethods(script_url=url, recommended="script")
+def _antigravity_install() -> InstallMethods:
+ """Official Antigravity (``agy``) installer for the OS that will run it.
+
+ Same split as Grok Build: PowerShell on Windows, a shell script everywhere
+ else. The URLs are the ones the API-Keys card already prints
+ (``jarvis.google_cli.auth_service.antigravity_install_command``).
+ """
+ url = (
+ "https://antigravity.google/cli/install.ps1"
+ if sys.platform == "win32"
+ else "https://antigravity.google/cli/install.sh"
+ )
+ return InstallMethods(script_url=url, recommended="script")
+
+
#: Kimi ships under two generations that both install a binary called ``kimi``.
KIMI_CURRENT = "kimi-code"
KIMI_LEGACY = "kimi-cli"
@@ -737,6 +772,30 @@ _AGENTS: dict[str, WorkspaceAgent] = {
# drops the whole spawn group.
spoken_aliases=("grok", "groc", "grock", "grok build"),
),
+ "antigravity": make_cli_agent(
+ "antigravity",
+ "Antigravity",
+ binary="agy",
+ homepage="https://antigravity.google",
+ description="Google's terminal coding agent — billed against the Google subscription.",
+ install=_antigravity_install(),
+ trust=ANTIGRAVITY_TRUST,
+ # DELIBERATELY no AccountSpec. ``GEMINI_HOME`` would move the login,
+ # but it is a SHARED variable (the Gemini CLI, workers, and this
+ # pane would all follow it), and ``agy`` has no ``login`` subcommand
+ # to point at an account directory — sign-in lives on the API-Keys
+ # page. A seat switcher that silently spends one Google login is
+ # worse than none. Tracked in docs/os-parity.md.
+ extra_path_dirs=("~/.local/bin",),
+ file_reference="at",
+ instruction_filename="GEMINI.md",
+ spoken_aliases=(
+ "antigravity",
+ "anti gravity",
+ "anti-gravity",
+ "agy",
+ ),
+ ),
"deepseek-harness": make_cli_agent(
"deepseek-harness",
"DeepSeek Harness",
@@ -1478,6 +1537,7 @@ def pty_available() -> bool:
__all__ = [
"AGENT_NAMES",
+ "ANTIGRAVITY_TRUST",
"CLAUDE_TRUST",
"CODEX_TRUST",
"GROK_TRUST",
diff --git a/jarvis/workspace/trust.py b/jarvis/workspace/trust.py
index 5f93d06d95..127ab69461 100644
--- a/jarvis/workspace/trust.py
+++ b/jarvis/workspace/trust.py
@@ -20,6 +20,10 @@ module at all. Only two *shapes* exist, and they are the two file formats:
- a **TOML** table — Codex's ``$CODEX_HOME/config.toml``,
``[projects.'<path>'] trust_level = "trusted"``.
+A third JSON shape exists: a **flat scalar map** (Antigravity's
+``trustedFolders.json`` is ``{ "<path>": "TRUST_FOLDER" }``). ``TrustSpec.scalar``
+selects it; writing an object there would be a file the CLI no longer reads.
+
Both writes are atomic (temp file + ``os.replace``) and idempotent, and never
clobber unrelated keys. A spec may ask for a one-time backup before the first
mutation — worth it for a file the user's own CLI configuration shares, and
@@ -204,6 +208,11 @@ def _trust_json(
changed = False
for key in _project_keys(repo_root, spec):
+ if spec.scalar:
+ if projects.get(key) != spec.value:
+ projects[key] = spec.value
+ changed = True
+ continue
entry = projects.get(key)
if not isinstance(entry, dict):
entry = {}
diff --git a/tests/integration/test_workspace_clis_routes.py b/tests/integration/test_workspace_clis_routes.py
index adcf939166..ef762dd8e5 100644
--- a/tests/integration/test_workspace_clis_routes.py
+++ b/tests/integration/test_workspace_clis_routes.py
@@ -37,7 +37,7 @@ def client(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
def _create(client: TestClient, **overrides) -> dict:
- payload = {"display_name": "Antigravity", "command": "agy", **overrides}
+ payload = {"display_name": "Helix", "command": "helix", **overrides}
response = client.post("/api/workspace-clis", json=payload)
assert response.status_code == 200, response.text
return response.json()
@@ -54,20 +54,20 @@ def test_the_empty_list_still_carries_the_form_limits(client: TestClient) -> Non
def test_a_created_cli_is_immediately_openable(client: TestClient) -> None:
"""Stored, registered and offered — without a restart, which is the point."""
- entry = _create(client, description="Google's terminal coding CLI.")
- assert entry["id"] == "antigravity"
- assert entry["binary"] == "agy"
+ entry = _create(client, description="A user-added terminal CLI.")
+ assert entry["id"] == "helix"
+ assert entry["binary"] == "helix"
assert entry["runs_through_shell"] is False
assert entry["logo_url"] == ""
- assert "antigravity" in registry.coding_agent_names()
- agent = registry.get_agent("antigravity")
+ assert "helix" in registry.coding_agent_names()
+ agent = registry.get_agent("helix")
assert agent is not None and agent.custom is True
def test_a_shell_command_says_so_in_the_payload(client: TestClient) -> None:
"""It changes what "the pane exited" means, so the UI has to be able to say."""
- entry = _create(client, display_name="Piped", command="agy | tee log.txt")
+ entry = _create(client, display_name="Piped", command="helix | tee log.txt")
assert entry["runs_through_shell"] is True
@@ -85,12 +85,12 @@ def test_a_blank_command_is_refused_with_a_readable_reason(
def test_a_patch_leaves_untouched_fields_alone(client: TestClient) -> None:
entry = _create(client, description="Original description.")
updated = client.patch(
- f"/api/workspace-clis/{entry['id']}", json={"display_name": "Antigravity CLI"}
+ f"/api/workspace-clis/{entry['id']}", json={"display_name": "Helix CLI"}
).json()
assert updated["id"] == entry["id"]
- assert updated["display_name"] == "Antigravity CLI"
+ assert updated["display_name"] == "Helix CLI"
assert updated["description"] == "Original description."
- assert updated["command"] == "agy"
+ assert updated["command"] == "helix"
def test_patching_something_that_is_gone_says_so(client: TestClient) -> None:
@@ -103,7 +103,7 @@ def test_patching_something_that_is_gone_says_so(client: TestClient) -> None:
def test_delete_removes_it_from_the_registry(client: TestClient) -> None:
entry = _create(client)
assert client.delete(f"/api/workspace-clis/{entry['id']}").json()["ok"] is True
- assert "antigravity" not in registry.coding_agent_names()
+ assert "helix" not in registry.coding_agent_names()
def test_a_logo_round_trips_with_the_headers_that_make_it_safe(
diff --git a/tests/unit/agentic_ide/conftest.py b/tests/unit/agentic_ide/conftest.py
index d685f8d1d0..7247b05279 100644
--- a/tests/unit/agentic_ide/conftest.py
+++ b/tests/unit/agentic_ide/conftest.py
@@ -154,6 +154,10 @@ def _agent_history_in_tmp(
# This CLI follows the XDG data convention on every OS, so one variable
# moves its whole session database.
monkeypatch.setenv("XDG_DATA_HOME", str(home / "xdg"))
+ # Antigravity has no AccountSpec (GEMINI_HOME is a shared variable, not a
+ # dedicated seat override), so the only way a test can keep its history
+ # out of the developer's real ``~/.gemini`` is this.
+ monkeypatch.setenv("GEMINI_HOME", str(home / ".gemini"))
# And this one derives its root from the home directory with no variable at
# all, so the seam is the only place to intercept it.
kimi_root = home / "kimi"
diff --git a/tests/unit/agentic_ide/test_new_cli_providers.py b/tests/unit/agentic_ide/test_new_cli_providers.py
index 1827fa8cd6..e104850210 100644
--- a/tests/unit/agentic_ide/test_new_cli_providers.py
+++ b/tests/unit/agentic_ide/test_new_cli_providers.py
@@ -38,7 +38,7 @@ from jarvis.workspace import agents as workspace_agents
def test_every_new_provider_is_launchable_and_installable() -> None:
"""A registered entry must answer the three questions a pane asks of it."""
- for name in ("opencode", "kimi", "glm", "grok-build", "deepseek-harness"):
+ for name in ("opencode", "kimi", "glm", "grok-build", "antigravity", "deepseek-harness"):
entry = workspace_agents.get_agent(name)
assert entry is not None, f"{name} is not registered"
assert entry.is_coding_agent
@@ -62,7 +62,7 @@ def test_a_two_part_version_string_is_not_read_as_no_version() -> None:
def test_a_product_name_can_never_become_a_pane_call_sign() -> None:
"""Saying "Kimi" must address the CLI, not a pane that happens to be called that."""
reserved = workspace_agents.reserved_call_signs()
- for spoken in ("kimi", "opencode", "glm", "claude", "codex", "grok"):
+ for spoken in ("kimi", "opencode", "glm", "claude", "codex", "grok", "agy", "antigravity"):
assert spoken in reserved
from jarvis.agentic_ide import names
@@ -870,6 +870,71 @@ def test_declining_prompts_is_opt_out_so_a_later_cli_keeps_its_channel() -> None
assert entry.accepts_typed_prompts, f"{entry.name} lost its prompt channel"
+def test_antigravity_resumes_by_discovering_the_conversation() -> None:
+ """agy assigns the id; we cannot mint one, so resume is discover-then-flag."""
+ entry = workspace_agents.get_agent("antigravity")
+ assert entry is not None
+ assert entry.executable == "agy"
+ assert entry.adapter_key == "antigravity"
+ argv, handle = agent_sessions.launch_extra("antigravity")
+ assert argv == ()
+ assert handle is None
+ later = agent_sessions.ResumeHandle("agy_session", "abc-id", time.time())
+ assert agent_sessions.resume_argv("antigravity", later) == ("--conversation", "abc-id")
+ foreign = agent_sessions.ResumeHandle("claude_session", "abc-id", time.time())
+ assert agent_sessions.resume_argv("antigravity", foreign) is None
+
+
+def test_antigravity_treats_a_conversation_without_a_user_turn_as_fresh(
+ _agent_history_in_tmp: Path,
+) -> None:
+ """An opened-but-never-prompted pane must not be resumed into a dead TUI."""
+ handle = agent_sessions.ResumeHandle(
+ kind="agy_session", id="11111111-1111-1111-1111-111111111111", captured_at=time.time()
+ )
+ assert agent_sessions.has_conversation("antigravity", handle) is False
+ root = _agent_history_in_tmp / ".gemini" / "antigravity-cli"
+ conversations = root / "conversations"
+ conversations.mkdir(parents=True)
+ (conversations / f"{handle.id}.db").write_bytes(b"sqlite")
+ assert agent_sessions.has_conversation("antigravity", handle) is False
+ transcript = (
+ root / "brain" / handle.id / ".system_generated" / "logs" / "transcript.jsonl"
+ )
+ transcript.parent.mkdir(parents=True)
+ transcript.write_text(
+ '{"step_index":0,"type":"CHECKPOINT","content":"setup"}\n', encoding="utf-8"
+ )
+ assert agent_sessions.has_conversation("antigravity", handle) is False
+ transcript.write_text(
+ '{"step_index":0,"type":"USER_INPUT","content":"hello"}\n', encoding="utf-8"
+ )
+ assert agent_sessions.has_conversation("antigravity", handle) is True
+
+
+def test_antigravity_never_follows_a_session_id_out_of_its_home(
+ _agent_history_in_tmp: Path,
+) -> None:
+ handle = agent_sessions.ResumeHandle(
+ kind="agy_session", id="../outside", captured_at=time.time()
+ )
+ assert agent_sessions.has_conversation("antigravity", handle) is False
+
+
+def test_antigravity_is_spawnable_by_voice_in_both_languages() -> None:
+ from jarvis.agentic_ide import intent
+
+ for utterance in (
+ "open an antigravity",
+ "open an agy",
+ "öffne ein Antigravity", # i18n-allow: spoken-input vocabulary under test
+ "starte ein Anti Gravity", # i18n-allow: spoken-input vocabulary under test
+ ):
+ request = intent.detect_spawn(utterance)
+ assert request is not None, utterance
+ assert request.agent == "antigravity", utterance
+
+
def test_the_harness_is_spawnable_by_voice_in_both_languages() -> None:
"""An unmatched product word drops the whole spawn group it appeared in."""
from jarvis.agentic_ide import intent
diff --git a/tests/unit/costs/test_cli_usage_index.py b/tests/unit/costs/test_cli_usage_index.py
index d5714c24f1..082e6eef64 100644
--- a/tests/unit/costs/test_cli_usage_index.py
+++ b/tests/unit/costs/test_cli_usage_index.py
@@ -23,6 +23,7 @@ its own test:
from __future__ import annotations
import json
+import sqlite3
import time
from pathlib import Path
@@ -30,6 +31,7 @@ from jarvis.costs.cli_usage_index import (
AGENT_AGY,
AGENT_CLAUDE,
AGENT_CODEX,
+ AGENT_KIMI,
entries,
index_db_path,
index_state,
@@ -550,7 +552,7 @@ def test_agy_legacy_wire_log_is_indexed(tmp_path: Path) -> None:
turns = _all(data)
assert len(turns) == 2
- assert {t.agent for t in turns} == {AGENT_AGY}
+ assert {t.agent for t in turns} == {AGENT_KIMI}
assert turns[0].tokens_in == 1384
assert turns[0].tokens_out == 184
assert turns[0].tokens_cached == 4864
@@ -578,6 +580,71 @@ def test_agy_current_layout_takes_its_folder_from_state_json(tmp_path: Path) ->
assert turn.label == "personal-jarvis"
+def _pb_varint(n: int) -> bytes:
+ out = bytearray()
+ while True:
+ byte = n & 0x7F
+ n >>= 7
+ if n:
+ out.append(byte | 0x80)
+ else:
+ out.append(byte)
+ return bytes(out)
+
+
+def _pb_str(field: int, text: str) -> bytes:
+ raw = text.encode("utf-8")
+ return _pb_varint((field << 3) | 2) + _pb_varint(len(raw)) + raw
+
+
+def _pb_var(field: int, n: int) -> bytes:
+ return _pb_varint((field << 3) | 0) + _pb_varint(n)
+
+
+def _pb_len(field: int, blob: bytes) -> bytes:
+ return _pb_varint((field << 3) | 2) + _pb_varint(len(blob)) + blob
+
+
+def test_antigravity_conversation_db_is_indexed(tmp_path: Path) -> None:
+ """agy 1.1.20 stores usage in protobuf gen_metadata, not JSONL."""
+ usage = (
+ _pb_var(2, 1000)
+ + _pb_var(3, 40)
+ + _pb_var(5, 200)
+ + _pb_str(7, "bot-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
+ )
+ blob = _pb_len(1, _pb_len(4, usage)) + _pb_str(19, "gemini-3.7-flash-medium")
+ db = tmp_path / ".gemini" / "antigravity-cli" / "conversations" / "sess-agy.db"
+ db.parent.mkdir(parents=True)
+ con = sqlite3.connect(db)
+ con.execute(
+ "CREATE TABLE gen_metadata (idx integer, data blob, size integer NOT NULL DEFAULT 0, "
+ "PRIMARY KEY (idx))"
+ )
+ con.execute(
+ "CREATE TABLE trajectory_metadata_blob (id text, data blob, PRIMARY KEY (id))"
+ )
+ con.execute("INSERT INTO gen_metadata (idx, data, size) VALUES (0, ?, ?)", (blob, len(blob)))
+ con.execute(
+ "INSERT INTO trajectory_metadata_blob (id, data) VALUES ('main', ?)",
+ (b"file:///C:/work/personal-jarvis",),
+ )
+ con.commit()
+ con.close()
+ data = tmp_path / "data"
+
+ refresh(data_dir=data, home=tmp_path)
+
+ (turn,) = _all(data)
+ assert turn.agent == AGENT_AGY
+ assert turn.session_id == "sess-agy"
+ assert turn.tokens_in == 1000
+ assert turn.tokens_out == 40
+ assert turn.tokens_cached == 200
+ assert turn.model == "gemini-3.7-flash"
+ assert "personal-jarvis" in turn.cwd or turn.cwd.endswith("personal-jarvis")
+
+
def test_agy_setup_only_transcript_yields_nothing(tmp_path: Path) -> None:
"""What every current-layout transcript on the reference machine looks like."""
data = tmp_path / "data"
@@ -726,7 +793,7 @@ def test_all_three_agents_share_one_index(tmp_path: Path) -> None:
assert result.files_seen == 3
assert result.turns_added == 3
- assert {t.agent for t in _all(data)} == {AGENT_CLAUDE, AGENT_CODEX, AGENT_AGY}
+ assert {t.agent for t in _all(data)} == {AGENT_CLAUDE, AGENT_CODEX, AGENT_KIMI}
# ---------------------------------------------------------------------------
diff --git a/tests/unit/workspace/test_agents.py b/tests/unit/workspace/test_agents.py
index 3122655ee3..38c881057b 100644
--- a/tests/unit/workspace/test_agents.py
+++ b/tests/unit/workspace/test_agents.py
@@ -35,7 +35,9 @@ from jarvis.workspace.agents import (
# later addition into a test edit, which is the opposite of what an open
# registry is for. What must not break is that a shipped provider silently
# disappears.
-REQUIRED_CODING_AGENTS = frozenset({"claude", "codex", "opencode", "kimi", "glm", "grok-build"})
+REQUIRED_CODING_AGENTS = frozenset(
+ {"claude", "codex", "opencode", "kimi", "glm", "grok-build", "antigravity"}
+)
def test_every_promised_coding_agent_is_registered() -> None:
@@ -111,6 +113,12 @@ def test_install_commands_are_runnable_or_honestly_absent() -> None:
assert "install.ps1" in grok_install
else:
assert "install.sh" in grok_install
+ agy_install = install_command("antigravity")
+ assert agy_install is not None
+ if sys.platform == "win32":
+ assert "install.ps1" in agy_install
+ else:
+ assert "install.sh" in agy_install
assert install_command("nope") is None
@@ -131,6 +139,13 @@ def test_launch_command_is_bare_binary() -> None:
assert grok.file_reference == "at"
assert grok.account is not None
assert grok.account.env[0][0] == "GROK_HOME"
+ agy = get_agent("antigravity")
+ assert agy is not None
+ assert agy.executable == "agy"
+ assert agy.launch_command == "agy"
+ assert agy.file_reference == "at"
+ assert agy.account is None
+ assert agy.trust is not None and agy.trust.scalar is True
def test_build_agent_argv_wraps_command_in_a_shell() -> None:
diff --git a/tests/unit/workspace/test_trust.py b/tests/unit/workspace/test_trust.py
index 0f232df68b..20b0a8724a 100644
--- a/tests/unit/workspace/test_trust.py
+++ b/tests/unit/workspace/test_trust.py
@@ -1,4 +1,4 @@
-"""Trust pre-seed for Claude Code, Codex and Grok Build."""
+"""Trust pre-seed for Claude Code, Codex, Grok Build and Antigravity."""
from __future__ import annotations
@@ -67,6 +67,20 @@ def test_claude_is_idempotent_noop_second_run(tmp_path: Path) -> None:
assert res2.method == "noop"
+def test_antigravity_writes_a_scalar_trust_map(tmp_path: Path) -> None:
+ """trustedFolders.json is ``{ path: "TRUST_FOLDER" }``, not a nested object."""
+ home = tmp_path / "home"
+ home.mkdir()
+ repo = _repo(tmp_path)
+
+ [res] = ensure_trusted(repo, ["antigravity"], home=home)
+ assert res.ok and res.agent == "antigravity"
+
+ data = json.loads((home / ".gemini" / "trustedFolders.json").read_text(encoding="utf-8"))
+ assert data[str(repo)] == "TRUST_FOLDER"
+ assert data[repo.as_posix()] == "TRUST_FOLDER"
+
+
def test_grok_build_writes_trusted_folders_toml(tmp_path: Path) -> None:
home = tmp_path / "home"
home.mkdir()