Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ ai-devkit init --template ./senior-engineer.yaml
| [Pi](https://pi.dev) | yes | yes |
| [Cursor](https://cursor.sh/) | yes | — |
| [GitHub Copilot](https://code.visualstudio.com/) | yes | — |
| [Antigravity](https://antigravity.google/) | yes | |
| [Antigravity](https://antigravity.google/) | yes | yes |
| [Amp](https://ampcode.com/) | yes | — |
| [Kilo Code](https://github.com/Kilo-Org/kilocode) | yes | — |
| [Roo Code](https://roocode.com/) | testing | — |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ One `.ai-devkit.json` configures all of them. Add a new agent to your team witho
| [Pi](https://pi.dev) | yes | yes |
| [Cursor](https://cursor.sh/) | yes | — |
| [GitHub Copilot](https://code.visualstudio.com/) | yes | — |
| [Antigravity](https://antigravity.google/) | yes | |
| [Antigravity](https://antigravity.google/) | yes | yes |
| [Amp](https://ampcode.com/) | yes | — |
| [Kilo Code](https://github.com/Kilo-Org/kilocode) | yes | — |
| [Roo Code](https://roocode.com/) | testing | — |
Expand Down
37 changes: 37 additions & 0 deletions docs/ai/design/feature-antigravity-cli-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
phase: design
title: "Antigravity CLI Adapter in @ai-devkit/agent-manager - Design"
feature: antigravity-cli-adapter
description: Architecture for the Antigravity (`agy`) CLI detection adapter, launch map entry, and CLI wiring
---

# Design: Antigravity CLI Adapter for @ai-devkit/agent-manager

## Responsibilities
- `AntigravityCliAdapter`: discover running `agy` processes, resolve each to its conversation via `cache/last_conversations.json`, read its transcript, emit `AgentInfo`, and enumerate conversations — parsing kept inline like the other recent adapters.
- `AGENTS.antigravity_cli`: launch command (`agy`) + `ps` matcher.
- CLI/channel: register the adapter, label the type, validate `--type`.

## Data model
Reuse `AgentAdapter`, `AgentInfo`, `AgentStatus`, `AgentType`, `SessionSummary`. `AgentType` gains `'antigravity_cli'`.

- `cache/last_conversations.json` (at the CLI home root): `{ <cwd>: <conversationId> }`. The live process cwd is the join key; there is no pid in this file, so `proc.cwd` is the lookup key.
- `brain/<conversationId>/.system_generated/logs/transcript.jsonl`: `{ source, type, created_at, content }` per line. `content` is a string or an array of `{ type: "text", text }` blocks. User prompt = text inside `<USER_REQUEST>...</USER_REQUEST>` of a `type: "USER_INPUT"` record; assistant reply = `type: "PLANNER_RESPONSE"`. Other MODEL records (tool calls like RUN_COMMAND) and `SYSTEM` records are execution detail, skipped unless verbose.

Normalized into `AgentInfo`: `name` ← `generateAgentName(projectPath, pid)`; `projectPath` ← cwd from the registry (else process cwd); `sessionId` ← the conversation id; `summary` ← last `<USER_REQUEST>`; `status` ← time-threshold + last-transcript-role heuristic; `sessionFilePath` ← the conversation's `transcript.jsonl`.

## Component breakdown
1. `packages/agent-manager/src/adapters/AntigravityCliAdapter.ts` (new, self-contained)
- `canHandle`: argv[0] basename `agy`/`agy.exe`.
- `detectAgents`: `enrichProcesses(listAgentProcesses('agy'))`; per process resolve cwd → conversationId via `readRegistry()`, read the transcript; live processes with no conversation → process-only RUNNING agents.
- inline parsing: `readRegistry`, `readSession`, `parseTranscript` (`<USER_REQUEST>` prompts + `PLANNER_RESPONSE` replies), `determineStatus`, `getConversation`.
- `listSessions`: iterate the `cwd → id` registry, parse each transcript, strict `cwd` filter.
2. `AntigravityCliAdapter.test.ts` (new): fixtures from the captured real format.
3. Exports, launch map, CLI registration, labels, validation.

## Design decisions
- Resolve a live process's conversation from `cache/last_conversations.json` (cwd → id), not from cwd-encoded session dirs; there is one current conversation per workspace.
- Parse `transcript.jsonl` for conversation and summary; take the prompt inside `<USER_REQUEST>...</USER_REQUEST>`.
- `sessionFilePath` points at `transcript.jsonl` so the console's `fs.stat().mtime` cache invalidation tracks conversation growth.
- Keep parsing resilient — a missing/malformed transcript skips the session; adapter-level failures return empty so other adapters still render.
- Independent of the `antigravity` IDE environment (same split as `gemini_cli` vs `gemini`).
27 changes: 27 additions & 0 deletions docs/ai/implementation/feature-antigravity-cli-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
phase: implementation
title: "Antigravity CLI Adapter in @ai-devkit/agent-manager - Implementation"
feature: antigravity-cli-adapter
description: Implementation notes for the Antigravity (`agy`) CLI adapter
---

# Implementation: Antigravity CLI Adapter

## What shipped
- `packages/agent-manager/src/adapters/AntigravityCliAdapter.ts` — self-contained adapter.
- `AgentType`/`StartableAgentType` gain `'antigravity_cli'`; `AGENTS.antigravity_cli = { command: 'agy', matches: matchArgv0('agy') }`; exported from `adapters/index.ts` and `index.ts`.
- CLI: registered in `commands/agent.ts` and `services/channel/channel-runner.ts`; `TYPE_LABELS.antigravity_cli = 'Antigravity CLI'`; `--type` help + `VALID_AGENT_TYPES` updated.

## Notes
- Home: `~/.gemini/antigravity-cli/` (override via `ANTIGRAVITY_CLI_HOME`). A live process is resolved to its conversation via `cache/last_conversations.json` (`{cwd:id}`); the process cwd is the join key.
- Parsing: `transcript.jsonl` → user prompts are the text inside `<USER_REQUEST>...</USER_REQUEST>` of `type:'USER_INPUT'` records; the assistant reply is a `type:'PLANNER_RESPONSE'` record; other MODEL records (tool calls like RUN_COMMAND) and `SYSTEM` records are skipped unless verbose. `lastActive` is the newest record `created_at` (else file mtime).
- `AgentInfo.sessionFilePath` / `SessionSummary.sessionFilePath` point at `transcript.jsonl`; `getConversation` accepts the file path, a session dir, or a bare conversation id.

## Patterns & best practices
- Mirror `GrokCliAdapter`'s shape (registry JSON + transcript JSONL), parsing kept **inline** like the other recent adapters.
- Fail soft: a missing/malformed `transcript.jsonl` skips the session; adapter-level failures return empty so other adapters still render.

## Error handling
- Missing `cache/last_conversations.json` → empty registry, no throw.
- Mapped conversation with no transcript → process-only RUNNING agent.
- A live `agy` process whose cwd is not in the registry → process-only RUNNING agent.
24 changes: 24 additions & 0 deletions docs/ai/planning/feature-antigravity-cli-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
phase: planning
title: "Antigravity CLI Adapter in @ai-devkit/agent-manager - Planning"
feature: antigravity-cli-adapter
description: Task plan for the Antigravity (`agy`) CLI adapter
---

# Planning: Antigravity CLI Adapter

## Key facts
- Conversation source: `brain/<id>/.system_generated/logs/transcript.jsonl`. Live cwd→id from `cache/last_conversations.json`.
- Binary `agy`; home `~/.gemini/antigravity-cli/` (override `ANTIGRAVITY_CLI_HOME`).

## Tasks
- [x] Capture real layout: `agy -p` produces `cache/last_conversations.json` (`{cwd:id}`) + `brain/<id>/.system_generated/logs/transcript.jsonl`.
- [x] Confirm schemas (`{cwd:id}` registry; transcript `{source,type,created_at,content}` with `<USER_REQUEST>` prompts and `MODEL` responses).
- [x] Implement self-contained `AntigravityCliAdapter` (`canHandle`, `detectAgents` via registry, inline `transcript.jsonl` parsing, `getConversation`, `listSessions`) + unit tests.
- [x] Add `'antigravity_cli'` to `AgentType`/`StartableAgentType`; `AGENTS.antigravity_cli` launch map; exports.
- [x] Wire CLI: register in `agent` command + channel runner; `TYPE_LABELS`; `--type` help; `VALID_AGENT_TYPES`.
- [x] Update cli test fixtures (adapter mock, registerAdapter counts, `STARTABLE_AGENT_TYPES`, `--type` list).

## Risks
- Risk: Antigravity CLI schema evolves. Mitigation: defensive parsing, fixtures for partial/malformed inputs.
- Risk: `proc.cwd` unavailable for some processes → falls back to process-only agent (still listed).
31 changes: 31 additions & 0 deletions docs/ai/requirements/feature-antigravity-cli-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
phase: requirements
title: "Antigravity CLI Adapter in @ai-devkit/agent-manager - Requirements"
feature: antigravity-cli-adapter
description: Detect, list, and manage Google's Antigravity (`agy`) CLI agents in the ai-devkit control plane
---

# Requirements: Antigravity CLI Adapter for @ai-devkit/agent-manager

## Problem
ai-devkit already configures the Antigravity **IDE** via the `antigravity` environment, but it cannot see or control the Antigravity **CLI** (`agy`). Running `agy` sessions do not show in `agent list`, `agent sessions`, the console, or `agent send`. This mirrors how `gemini` (env) and `gemini_cli` (adapter) are separate; Antigravity needs its CLI adapter.

## Goals
- Detect running `agy` processes and surface them in `agent list` / console.
- List historical Antigravity CLI conversations in `agent sessions --type antigravity_cli`.
- Read a conversation transcript for `agent detail` / `agent send` targeting.
- Keep the existing `antigravity` IDE environment untouched.

## Non-goals
- Launching is data-driven from `AGENTS`; no bespoke start flow.
- No changes to the Antigravity IDE environment or its skill paths.

## On-disk facts (verified against `agy`, Google Gemini-family CLI)
- Home: `~/.gemini/antigravity-cli/` (`ANTIGRAVITY_CLI_HOME` overrides it).
- `cache/last_conversations.json`: a `{ "<cwd>": "<conversationId>" }` map of the current conversation per workspace. This is the join key from a live process's cwd to its conversation.
- Transcript: `brain/<conversationId>/.system_generated/logs/transcript.jsonl`, newline-delimited `{ source, type, created_at, content }`. User turns are `type: "USER_INPUT"` with the prompt inside `<USER_REQUEST>...</USER_REQUEST>`; the model reply is a `type: "PLANNER_RESPONSE"` record. Other MODEL records (tool calls such as RUN_COMMAND) and `SYSTEM` records (conversation history, checkpoints) are non-conversational.
- The `agy` binary's argv[0] basename is `agy`.

## Acceptance
- Unit tests cover: `canHandle`, no-process, registry cwd→id resolution, process-only fallback, missing transcript, transcript conversation extraction, status mapping, `listSessions` + cwd filter.
- Verified end-to-end against a real `agy 0.x` session on disk (`agent-manager:test` and `cli:test` pass).
30 changes: 30 additions & 0 deletions docs/ai/testing/feature-antigravity-cli-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
phase: testing
title: "Antigravity CLI Adapter in @ai-devkit/agent-manager - Testing"
feature: antigravity-cli-adapter
description: Test strategy and coverage for the Antigravity (`agy`) CLI adapter
---

# Testing Strategy: Antigravity CLI Adapter

## Unit Tests (`AntigravityCliAdapter.test.ts`)
- [x] Exposes `antigravity_cli` type
- [x] `canHandle` true for `agy` (plain + full path + args); false for non-agy / arg-only matches
- [x] `detectAgents` returns `[]` with no processes
- [x] Resolves the conversation via `last_conversations.json` (cwd → id)
- [x] Process-only RUNNING fallback when the cwd is not in the registry
- [x] Process-only when the mapped conversation has no transcript
- [x] `getConversation` maps `USER_INPUT` (`<USER_REQUEST>`) + `PLANNER_RESPONSE` records to roles; excludes MODEL tool calls (RUN_COMMAND) except in verbose; skips malformed lines
- [x] `getConversation` excludes `SYSTEM` records unless verbose
- [x] Status: WAITING on trailing MODEL turn; RUNNING on trailing USER_INPUT; IDLE past threshold
- [x] Agent summary is the last user request
- [x] `listSessions` returns `[]` without a registry; lists from the registry with cwd; applies the cwd filter

## Integration / launch map
- [x] `AGENTS.antigravity_cli.command === 'agy'`; registered in `agent` command + channel runner; `STARTABLE_AGENT_TYPES` includes `antigravity_cli`; `--type antigravity_cli` accepted.

## End-to-End (verified against a real `agy` install)
- [x] `listSessions()` against the real `~/.gemini/antigravity-cli` lists the on-disk conversation with `cwd`, `firstUserMessage`, and the `transcript.jsonl` `sessionFilePath`.
- [x] `getConversation()` against the real transcript returns the `[{user}, {assistant}]` turns (`<USER_REQUEST>` extracted, `MODEL` response, `SYSTEM` skipped).
- [x] `detectAgents()` with a live `agy` process + real registry resolves the cwd, picks the conversation, and surfaces `{type:"antigravity_cli", projectPath:<repo>, summary:<prompt>}`.
- [x] Regression: full `agent-manager` and `cli` suites pass.
Loading
Loading