@timmyjl12/pi-agy-bridge 0.1.5 → 0.2.1
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.
- package/ARCHITECTURE.md +11 -1
- package/README.md +53 -7
- package/UPGRADING.md +12 -0
- package/compat/baselines/agy-1.5.14.json +260 -0
- package/compat/matrix.json +1 -1
- package/compat/probe.ts +71 -2
- package/package.json +4 -2
- package/src/account-manager.ts +399 -0
- package/src/accounts.ts +394 -0
- package/src/acp/connection.ts +1 -1
- package/src/config.ts +6 -0
- package/src/doctor.ts +13 -3
- package/src/index.ts +199 -25
- package/src/model-catalog.ts +19 -6
- package/src/provider.ts +30 -8
- package/src/runtime.ts +133 -6
- package/src/session-pool.ts +88 -6
- package/src/stream.ts +41 -8
- package/src/ui/menu.ts +478 -0
- package/src/ui/panel.ts +376 -0
package/ARCHITECTURE.md
CHANGED
|
@@ -65,6 +65,16 @@ Invalidation comes from three places: pi-context's rewrite registry (`Symbol.for
|
|
|
65
65
|
|
|
66
66
|
One shared `agy acp` per extension runtime, started on first real use, serving every caller (main session, subagents, side calls). Start is single-flight. A turn that went silent or hit pi's `timeoutMs` and then ignores `session/cancel` for the grace period gets its process killed (our PID only, identity-checked); an aborted or tool-call turn that ignores the cancel only has its session discarded. Other turns on a killed process fail with `agy exited with status N`, which fallback chains treat as transient. An unconditional synchronous kill runs on pi's `exit` event. Every `session_shutdown` (`quit`, `reload`, `new`, `resume` or `fork`) recycles the outgoing runtime: stop the process, forget sessions/discovery, detach global hooks and flush writes without permanently latching the pool. A background caller on the outgoing model runtime can therefore retry through a fresh process, which the normal idle reaper stops later. Explicit `AgyRuntime.dispose()` remains terminal for real cleanup and replaced pools.
|
|
67
67
|
|
|
68
|
+
## Accounts
|
|
69
|
+
|
|
70
|
+
`AccountManager` (`account-manager.ts`) owns one `AgyRuntime` per Antigravity account. The default runtime is the one described above (provider `agy`, api `agy-acp`, agy's keyring login) and is registered synchronously at load, exactly as before. Each enabled entry of `<home>/accounts.json` (plus `PI_AGY_ACCOUNTS`) gets its own runtime, pool and `agy acp` process, and its own pi provider `agy-<alias ?? id>` with its own api id `agy-acp-<alias ?? id>` (pi-ai's compat stream registry is keyed by api id, so ids must not be shared). Providers are (un)registered live through `pi.registerProvider` / `pi.unregisterProvider` when an account is added, renamed, enabled, disabled or removed.
|
|
71
|
+
|
|
72
|
+
An extra account's process differs from the default in three ways: `--gemini-dir <home>/accounts/<id>/gemini` (and its own work dir), `--log-file <home>/accounts/<id>/acp.log`, and `SSH_CONNECTION` in its environment. agy keeps one login per OS user in the keyring; when it sees an SSH session it uses a token file inside the gemini dir instead (measured on 1.5.12 and 1.5.14, `.plan/agy-multi-account/evidence`). `agy acp --login` with the same three settings signs that folder in (`accounts.ts` `startLogin`).
|
|
73
|
+
|
|
74
|
+
The identity guard (`PoolOptions.verifyProcess`, `AgyRuntime` `#checkIdentity`) runs once per process right after its first `session/new`, because agy resolves the login lazily during that call. It reads agy's own log: the process is used only if agy reports file-based token storage and `authenticated successfully as <expected email>`. Otherwise the session is closed, the process stopped, and the request fails with `agy authentication required (not logged in) … account <id>` (non-retryable for pi-fallback-chains) or, when the storage trigger is missing, `pi-agy-bridge is unavailable: …` - so an extra provider never silently spends the default account's quota. Each account has its own `state.json` hint and trace tag; error messages of an extra account end with `(account <id>)`.
|
|
75
|
+
|
|
76
|
+
Management: `/agy-bridge` subcommands (`index.ts` `handle`) and the overlay (`ui/menu.ts` on `ui/panel.ts`, modelled on pi-advisor's settings overlay) call the same `AccountManager` and `runAccountAction` functions; outside the TUI the menu falls back to `ui.select` / `ui.input` / `ui.confirm`.
|
|
77
|
+
|
|
68
78
|
## Isolation and the native-tool fence
|
|
69
79
|
|
|
70
80
|
- agy runs with `--gemini-dir <home>/gemini`: its conversations, logs and caches never touch `~/.gemini`, and your global MCP servers and settings are not loaded.
|
|
@@ -104,7 +114,7 @@ Own messages avoid bare three-digit numbers because the classifier reads them as
|
|
|
104
114
|
|
|
105
115
|
`compat/matrix.json` lists the tested agy versions, the minimum, known-bad versions and the ACP protocol. At handshake `deriveFeatures` negotiates optional features with fallbacks (system prompt inside the conversation resource, history inlined as text, no images). A protocol or minimum-version mismatch stops the provider with an actionable message; a newer untested version only warns once.
|
|
106
116
|
|
|
107
|
-
The backend can refuse a prompt that the protocol accepts. Since 2026-11-14 (agy 1.5.9) a session whose system prompt arrives through the append hook and contains pi's default opening line gets `RESOURCE_EXHAUSTED` on every try, for every model, while the same text inline is served. agy reports each retry as an `agent_message_chunk` ("⚠ API error (attempt N): ..."); the Translator keeps these out of the answer. With `PI_AGY_SYSTEM_PROMPT=auto` (default) a fresh appended session refused before any output is cancelled at the first notice and the turn is retried once with the system text inline; if that is served, later sessions of this runtime start inline. Everywhere else (continued sessions, inline sessions) agy's own retries run, so a short throttle in a subagent's tool loop is ridden out; only agy giving up becomes an error (`agy quota exceeded: Antigravity answered RESOURCE_EXHAUSTED ...`, worded so pi-ai does not retry on top while pi-fallback-chains rotates). `UPGRADING.md` is the runbook; the probe and the SDK canary cost no quota.
|
|
117
|
+
The backend can refuse a prompt that the protocol accepts. Since 2026-11-14 (agy 1.5.9) a session whose system prompt arrives through the append hook and contains pi's default opening line gets `RESOURCE_EXHAUSTED` on every try, for every model, while the same text inline is served. agy reports each retry as an `agent_message_chunk` ("⚠ API error (attempt N): ..."); the Translator keeps these out of the answer. With `PI_AGY_SYSTEM_PROMPT=auto` (default) a fresh appended session refused before any output is cancelled at the first notice and the turn is retried once with the system text inline; if that is served, later sessions of this runtime start inline. agy 1.5.14 changed the shape: it retries silently for about 140 s and sends a single `⚠ RESOURCE_EXHAUSTED` chunk only at the end, so the notice no longer arrives in time. `auto` therefore also arms a refusal probe on a fresh appended session: no model output (text or thinking) within `PI_AGY_REFUSAL_PROBE_SEC` (30 s; measured first output 0.4-3.4 s) cancels it as `refused` and takes the same inline retry. A false positive costs one inline session, which is always served. Everywhere else (continued sessions, inline sessions) agy's own retries run, so a short throttle in a subagent's tool loop is ridden out; only agy giving up becomes an error (`agy quota exceeded: Antigravity answered RESOURCE_EXHAUSTED ...`, worded so pi-ai does not retry on top while pi-fallback-chains rotates). `UPGRADING.md` is the runbook; the probe and the SDK canary cost no quota.
|
|
108
118
|
|
|
109
119
|
## Tests
|
|
110
120
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Use Google Antigravity models (Gemini, Claude, GPT-OSS) in [pi](https://github.c
|
|
|
4
4
|
|
|
5
5
|
It follows the design of `pi-claude-code`: **pi keeps the conversation, the approvals and the tool execution; agy is only the model.** Every pi request becomes one ACP prompt turn. When the model wants a pi tool it writes a small tool-call block, pi runs the tool, and the next request carries the result. Nothing is parked between requests, so a slow tool (a long `pytest` run, a user dialog) can take as long as it needs and there is no turn time limit.
|
|
6
6
|
|
|
7
|
-
> Status: 0.1.5.
|
|
7
|
+
> Status: 0.2.1. Extra-account sign-in works on agy 1.5.14: agy now prints a link and waits for the authorization code, so the bridge opens the link and asks for the code in a dialog. 0.2.0: Multiple Antigravity accounts: each extra account runs as its own provider `agy-<alias or id>` with its own login, managed from `/agy-bridge menu` or the `/agy-bridge` account commands; verified live on agy 1.5.14 with two Google accounts answering side by side. agy 1.5.14 is now tested: it refuses pi's appended system prompt silently (no notice for ~2 min), which uto now detects with a 30 s refusal probe and answers inline (see [Multiple Antigravity accounts](#multiple-antigravity-accounts)). 0.1.5: the default bridge home now honors Pi's configured agent directory (`PI_CODING_AGENT_DIR`). Every Pi session shutdown now recycles the outgoing runtime instead of permanently latching it shut, so a late pi-advisor retry can start a fresh ACP process; explicit terminal disposal remains terminal. The compatibility probe passed on `agy 1.5.8`, `1.5.9` and `1.5.12`; the drift from 1.5.9 to 1.5.12 is additive only (the `gemini-4-neon` family, `gemini-pro-orchestrator-neon`, and `xhigh` as a `thought_level`). The `google-antigravity` SDK is current at `0.1.23` on both PyPI and the SDK repository, and its fingerprint still matches the recorded baseline. On 2026-11-14 (agy 1.5.9) the Antigravity backend began refusing pi's default system prompt sent through the append hook with `RESOURCE_EXHAUSTED`; live `gemini-4-hydrogen` turns and pi-subagents runs succeed through the `auto` inline fallback (see `PI_AGY_SYSTEM_PROMPT`). Earlier live bridge checks passed on `agy 1.5.8`. Live turns succeeded on `gemini-3.8-flash`, `gemini-4-hydrogen` (including `xhigh`), and `gemini-pro-orchestrator-g1-pro`. A real pi surface check with the configured extensions also passed. Claude, GPT-OSS and the `gemini-4-neon` family have not been exercised in a live model turn.
|
|
8
8
|
|
|
9
9
|
## Requirements
|
|
10
10
|
|
|
@@ -38,9 +38,50 @@ The list is what your agy reports, so new models appear without an update. pi's
|
|
|
38
38
|
|
|
39
39
|
| Command | What it does |
|
|
40
40
|
| --- | --- |
|
|
41
|
-
| `/agy-bridge
|
|
42
|
-
| `/agy-bridge
|
|
43
|
-
| `/agy-bridge
|
|
41
|
+
| `/agy-bridge` or `/agy-bridge menu` | full-screen accounts & settings menu (same keys as pi-advisor: ↑↓ move, ←→ pane, Tab section, `/` search, Enter select, Esc back/close) |
|
|
42
|
+
| `/agy-bridge status` | one line per account: sign-in state, agy version, process, pooled sessions |
|
|
43
|
+
| `/agy-bridge doctor [id]` | handshake, compatibility with this package, features, models, process, hooks (no model call, no quota) |
|
|
44
|
+
| `/agy-bridge reset [id\|all]` | stop agy process(es) and forget pooled sessions |
|
|
45
|
+
| `/agy-bridge accounts` | list accounts, providers and recorded Google accounts |
|
|
46
|
+
| `/agy-bridge add <id> [alias]` | add an Antigravity account (then sign in) |
|
|
47
|
+
| `/agy-bridge login <id>` | sign an extra account in, or switch it to another Google account |
|
|
48
|
+
| `/agy-bridge alias <id> [alias]` | rename the provider to `agy-<alias>` (empty clears) |
|
|
49
|
+
| `/agy-bridge email <id> [email]` | pin or clear the expected Google account by hand |
|
|
50
|
+
| `/agy-bridge enable\|disable <id>` | show or hide an account's models (its login is kept) |
|
|
51
|
+
| `/agy-bridge remove <id>` | forget an account; asks before deleting its saved login |
|
|
52
|
+
| `/agy-bridge check [id]` / `models [id]` | start an account once and list its models (no prompt, no quota) |
|
|
53
|
+
|
|
54
|
+
Every menu entry has a command and vice versa. Arguments complete with Tab.
|
|
55
|
+
|
|
56
|
+
## Multiple Antigravity accounts
|
|
57
|
+
|
|
58
|
+
agy keeps one login per OS user (on Windows the Credential Manager entry `gemini:antigravity`). An extra account gets its own folder, `<PI_AGY_HOME>/accounts/<id>/`, and its own `agy acp` process, started so that agy keeps that account's login in a file inside the folder instead of the shared keyring. pi lists it as a separate provider, `agy-<alias or id>`, with the models that account's plan offers:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
/agy-bridge add acct2 # or: /agy-bridge menu → Add account
|
|
62
|
+
# your browser opens: sign in with the second Google account, then paste the
|
|
63
|
+
# authorization code (or the full URL of the page you land on) into pi's prompt
|
|
64
|
+
/agy-bridge accounts
|
|
65
|
+
agy default agy's own login enabled
|
|
66
|
+
agy-acct2 acct2 timm…2385@gmail.com enabled
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **Sign-in on agy 1.5.14+.** With a per-account token file agy no longer catches the browser redirect; it prints a link and waits for the code. The bridge opens that link (set `PI_AGY_NO_BROWSER=1` to only show it), asks for the code in a dialog and passes it to agy. An empty answer cancels.
|
|
70
|
+
- **Your default account is unchanged.** `agy/<model>` keeps using agy's normal login; without extra accounts this package behaves exactly as before.
|
|
71
|
+
- **Use them in fallback chains.** A quota error on one account parks only that `provider/model` (pi-fallback-chains' per-model quota rule), so a chain can continue on the next account:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
"agy/claude-opus-5-5": ["agy-acct2/claude-opus-5-5", "agy/gemini-4-argon", "agy-acct2/gemini-4-argon"]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Accounts on different plans offer different models: check with `/agy-bridge models acct2` and only chain to models the account lists.
|
|
78
|
+
- **Wrong-account protection.** Before an extra account serves a turn, agy's own log must show that it uses that account's token file and is signed in as the recorded Google account. Otherwise the turn fails with `agy authentication required (not logged in) for account <id>` (pi-fallback-chains does not retry it) and nothing is spent on another account. Errors of an extra account end with `(account <id>)`.
|
|
79
|
+
- **Alias.** `/agy-bridge alias acct2 work` renames the provider to `agy-work`; the folder stays `accounts/acct2`.
|
|
80
|
+
- **Settings.** Accounts are stored in `<PI_AGY_HOME>/accounts.json` (id, alias, email, enabled: no credentials). `PI_AGY_ACCOUNTS=acct2,acct3` adds accounts from the environment; `PI_AGY_ACCOUNT_<ID>_EMAIL` pins the expected Google account.
|
|
81
|
+
- **Cost.** One more `agy acp` process per account while in use; each stops after `PI_AGY_IDLE_MIN`.
|
|
82
|
+
- **Terms.** Whether using several Google accounts is allowed for your plans is your decision.
|
|
83
|
+
|
|
84
|
+
How it works: agy switches to per-folder token storage when it sees `SSH_CONNECTION` in its environment (measured on agy 1.5.12 and 1.5.14). The bridge sets that variable only on extra-account processes. It is not a documented agy option, so the free compat probe records it (`fileTokenStorageTrigger`) and reports breaking drift if a new agy stops honouring it; the wrong-account protection fails closed in that case.
|
|
44
85
|
|
|
45
86
|
## Configuration
|
|
46
87
|
|
|
@@ -58,14 +99,17 @@ Environment variables (all optional). Invalid values fall back to the default.
|
|
|
58
99
|
| `PI_AGY_CANCEL_GRACE_MS` | `3000` | wait this long for a cancel before giving up on a turn |
|
|
59
100
|
| `PI_AGY_MAX_REPLAY_KB` | `8192` | refuse to replay a conversation larger than this |
|
|
60
101
|
| `PI_AGY_CONTROL_TIMEOUT_SEC` | `60` | timeout for handshake and session calls |
|
|
61
|
-
| `PI_AGY_SYSTEM_PROMPT` | `auto` | how pi's system prompt reaches agy: `append` (the `session/new` append hook), `inline` (top of the first prompt), or `auto` (append; if Antigravity refuses a fresh appended session with `RESOURCE_EXHAUSTED` before any output, retry that turn inline once and keep using inline). In `auto` the refusal is saved in `<home>/state.json` for 24 hours (or until agy's version changes), so other pi processes, including subagents, start inline without a refused attempt |
|
|
102
|
+
| `PI_AGY_SYSTEM_PROMPT` | `auto` | how pi's system prompt reaches agy: `append` (the `session/new` append hook), `inline` (top of the first prompt), or `auto` (append; if Antigravity refuses a fresh appended session with `RESOURCE_EXHAUSTED` before any output, retry that turn inline once and keep using inline). In `auto` the refusal is saved in `<home>/state.json` for 24 hours (or until agy's version changes), so other pi processes, including subagents, start inline without a refused attempt. agy 1.5.14 retries the refusal silently for about two minutes, so in uto a fresh appended session that shows no model output (text or thinking) within PI_AGY_REFUSAL_PROBE_SEC is treated as refused too |
|
|
103
|
+
| `PI_AGY_REFUSAL_PROBE_SEC` | `30` | `auto` only: seconds a fresh session with the appended system prompt may stay silent before it is retried inline (measured first output on agy 1.5.14: 0.4-3.4 s); `0` disables the probe |
|
|
62
104
|
| `PI_AGY_TRACE` | off | `1` appends diagnostics to `<home>/trace.log` |
|
|
105
|
+
| `PI_AGY_ACCOUNTS` | none | extra accounts by id, comma-separated, in addition to `accounts.json` (see [Multiple Antigravity accounts](#multiple-antigravity-accounts)) |
|
|
106
|
+
| `PI_AGY_ACCOUNT_<ID>_EMAIL` | none | expected Google account of an extra account (normally recorded at sign-in) |
|
|
63
107
|
|
|
64
108
|
pi's own request `timeoutMs`, when set, is honoured as a total deadline for the turn.
|
|
65
109
|
|
|
66
110
|
### What is written to disk
|
|
67
111
|
|
|
68
|
-
Only under `PI_AGY_HOME`: the staged carrier agent (`stage/`), agy's private config root (`gemini/`), an empty working directory (`work/`), a small health hint (`state.json`) and the optional trace. Nothing is written to your project, to `~/.gemini` or to any global agy setting
|
|
112
|
+
Only under `PI_AGY_HOME`: the staged carrier agent (`stage/`), agy's private config root (`gemini/`), an empty working directory (`work/`), a small health hint (`state.json`), the account list (`accounts.json`), one folder per extra account (`accounts/<id>/`, holding that account's agy data, agy's log and the login agy saved there) and the optional trace. Nothing is written to your project, to `~/.gemini` or to any global agy setting. Logins are only *used*: the bridge never reads, copies or forwards a token; it reads only agy's own log line that names the signed-in account.
|
|
69
113
|
|
|
70
114
|
## Working with your other extensions
|
|
71
115
|
|
|
@@ -94,9 +138,11 @@ Example chain, mirrored from an `antigravity/*` chain:
|
|
|
94
138
|
| --- | --- | --- |
|
|
95
139
|
| no `agy/*` models in `/model` | agy not found, or the last use found it logged out or too old (hidden for 5 minutes) | `agy` once to sign in, then `/agy-bridge doctor` (a successful run clears the hint) |
|
|
96
140
|
| `agy authentication required (not logged in)` | login expired | run `agy` and sign in |
|
|
141
|
+
| `agy authentication required (not logged in) for account <id>` | that extra account has no saved login, or agy is signed in as a different Google account than the one recorded | `/agy-bridge login <id>` (the new email becomes the expected one) |
|
|
142
|
+
| `pi-agy-bridge is unavailable: agy did not switch to per-account token storage for account <id>` | an agy update stopped honouring the trigger extra accounts use; they fail closed rather than use your default login | see `UPGRADING.md` §1 (the compat probe reports this as breaking) |
|
|
97
143
|
| `agy quota exhausted: ... Resets in ...` | the plan's quota for that model is used up (agy delivers this as a normal reply with no tokens; the bridge turns it into an error so fallback chains rotate) | use another model; the reset time is in the message |
|
|
98
144
|
| `agy quota exceeded: Antigravity answered RESOURCE_EXHAUSTED ...` | the backend refused the request (429). agy would retry five times (~75 s); the bridge stops at the first notice. Since 2026-11-14 the backend refuses pi's default system prompt when it comes through the append hook (all models), while the same text inline is served; `auto` handles this | nothing in `auto` mode; otherwise use another model. The message says whether the prompt was appended or inline |
|
|
99
|
-
| `agy stalled for 120s with no output` | the model produced nothing for the silence limit | retry; raise `PI_AGY_SILENCE_SEC` for very long silent thinking |
|
|
145
|
+
| `agy stalled for 120s with no output` | the model produced nothing for the silence limit (with agy 1.5.14 and `PI_AGY_SYSTEM_PROMPT=append`: the backend's silent refusal of the appended prompt; use `auto`) | retry; raise `PI_AGY_SILENCE_SEC` for very long silent thinking |
|
|
100
146
|
| `agy exited with status N` | the agy process died | retry (a new process starts); `/agy-bridge doctor` shows agy's last stderr |
|
|
101
147
|
| `agy is unavailable: pi-agy-bridge is shut down` during or just after reload/session replacement | 0.1.2 or older permanently latched the outgoing pool while a background caller (often pi-advisor) was retrying | upgrade to 0.1.3 or newer. An old advisor error can remain visible until a later review succeeds; that sticky status is normal |
|
|
102
148
|
| `pi-agy-bridge is unavailable: agy ... below the minimum` | agy too old | `agy update` |
|
package/UPGRADING.md
CHANGED
|
@@ -33,6 +33,18 @@ The probe uses a temp cwd and `agy acp --gemini-dir <temp>`, so `~/.gemini` is
|
|
|
33
33
|
never written and your login is only used, not copied. It kills only the process
|
|
34
34
|
it spawned.
|
|
35
35
|
|
|
36
|
+
It also checks the **per-account token storage trigger** that extra accounts rely
|
|
37
|
+
on: one more `agy acp` on an empty temp gemini dir with `SSH_CONNECTION` set, one
|
|
38
|
+
`session/new` (answered "Authentication required", since the dir holds no login),
|
|
39
|
+
and agy's own log must say `Using file-based token storage`. The result is stored
|
|
40
|
+
as `fileTokenStorageTrigger` in the baseline; losing it is **breaking** drift.
|
|
41
|
+
If that happens, extra accounts stop with `pi-agy-bridge is unavailable: agy did
|
|
42
|
+
not switch to per-account token storage …` (they fail closed and never use the
|
|
43
|
+
default login). Find agy's new trigger (search the binary or changelog for
|
|
44
|
+
"file-based token storage"), change `FILE_STORAGE_ENV` in `src/accounts.ts` and
|
|
45
|
+
the probe's `fileStorageTrigger`, re-run `node --test tests/accounts.test.ts`,
|
|
46
|
+
then re-record.
|
|
47
|
+
|
|
36
48
|
## 2. Decide what the drift is
|
|
37
49
|
|
|
38
50
|
| Probe result | Meaning | Action |
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"agyVersion": "1.5.14",
|
|
4
|
+
"collectedAt": "2026-11-22T15:18:08.727Z",
|
|
5
|
+
"helpFlags": [
|
|
6
|
+
"--add-dir",
|
|
7
|
+
"--agent",
|
|
8
|
+
"--continue",
|
|
9
|
+
"--conversation",
|
|
10
|
+
"--dangerously-skip-permissions",
|
|
11
|
+
"--disable-slash-commands",
|
|
12
|
+
"--effort",
|
|
13
|
+
"--input-format",
|
|
14
|
+
"--json-schema",
|
|
15
|
+
"--log-file",
|
|
16
|
+
"--mode",
|
|
17
|
+
"--model",
|
|
18
|
+
"--new-project",
|
|
19
|
+
"--output-format",
|
|
20
|
+
"--print",
|
|
21
|
+
"--print-timeout",
|
|
22
|
+
"--project",
|
|
23
|
+
"--prompt",
|
|
24
|
+
"--prompt-interactive",
|
|
25
|
+
"--remote-agent",
|
|
26
|
+
"--remote-control",
|
|
27
|
+
"--sandbox",
|
|
28
|
+
"--settings",
|
|
29
|
+
"-c",
|
|
30
|
+
"-i",
|
|
31
|
+
"-p"
|
|
32
|
+
],
|
|
33
|
+
"acpHelpFlags": [
|
|
34
|
+
"--add-dir",
|
|
35
|
+
"--agent",
|
|
36
|
+
"--app-data-dir",
|
|
37
|
+
"--app_data_dir",
|
|
38
|
+
"--cli_dir_name",
|
|
39
|
+
"--cli_log_file",
|
|
40
|
+
"--cloud_code_endpoint",
|
|
41
|
+
"--dangerously-skip-permissions",
|
|
42
|
+
"--disable-telemetry",
|
|
43
|
+
"--disable_telemetry",
|
|
44
|
+
"--gemini-dir",
|
|
45
|
+
"--gemini_dir",
|
|
46
|
+
"--help",
|
|
47
|
+
"--ide-mcp-port",
|
|
48
|
+
"--ide_mcp_port",
|
|
49
|
+
"--include-default-customizations",
|
|
50
|
+
"--is_google3_workspace",
|
|
51
|
+
"--is_google_internal",
|
|
52
|
+
"--log-file",
|
|
53
|
+
"--login",
|
|
54
|
+
"--override_user_agent_name",
|
|
55
|
+
"--process-per-session",
|
|
56
|
+
"--sandbox",
|
|
57
|
+
"--stdio",
|
|
58
|
+
"--use_stubby_auth",
|
|
59
|
+
"--worker",
|
|
60
|
+
"-h"
|
|
61
|
+
],
|
|
62
|
+
"models": [
|
|
63
|
+
{
|
|
64
|
+
"id": "claude-opus-5-5-high",
|
|
65
|
+
"label": "Claude Opus 5.5 (High)"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "claude-opus-5-5-low",
|
|
69
|
+
"label": "Claude Opus 5.5 (Low)"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "claude-opus-5-5-medium",
|
|
73
|
+
"label": "Claude Opus 5.5 (Medium)"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "claude-sonnet-5-5-high",
|
|
77
|
+
"label": "Claude Sonnet 5.5 (High)"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "claude-sonnet-5-5-low",
|
|
81
|
+
"label": "Claude Sonnet 5.5 (Low)"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "claude-sonnet-5-5-medium",
|
|
85
|
+
"label": "Claude Sonnet 5.5 (Medium)"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "gemini-3.8-flash-high",
|
|
89
|
+
"label": "Gemini 3.8 Flash (High)"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "gemini-3.8-flash-low",
|
|
93
|
+
"label": "Gemini 3.8 Flash (Low)"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "gemini-3.8-flash-medium",
|
|
97
|
+
"label": "Gemini 3.8 Flash (Medium)"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"id": "gemini-4-argon-high",
|
|
101
|
+
"label": "Gemini 4 Argon (High)"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "gemini-4-argon-low",
|
|
105
|
+
"label": "Gemini 4 Argon (Low)"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "gemini-4-argon-medium",
|
|
109
|
+
"label": "Gemini 4 Argon (Medium)"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"id": "gemini-4-hydrogen-high",
|
|
113
|
+
"label": "Gemini 4 Hydrogen (High)"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "gemini-4-hydrogen-low",
|
|
117
|
+
"label": "Gemini 4 Hydrogen (Low)"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"id": "gemini-4-hydrogen-medium",
|
|
121
|
+
"label": "Gemini 4 Hydrogen (Medium)"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": "gemini-4-hydrogen-xhigh",
|
|
125
|
+
"label": "Gemini 4 Hydrogen (XHigh)"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"id": "gemini-4-neon-high",
|
|
129
|
+
"label": "Gemini 4 Neon (High)"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"id": "gemini-4-neon-low",
|
|
133
|
+
"label": "Gemini 4 Neon (Low)"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "gemini-4-neon-medium",
|
|
137
|
+
"label": "Gemini 4 Neon (Medium)"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"id": "gemini-4-neon-xhigh",
|
|
141
|
+
"label": "Gemini 4 Neon (XHigh)"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"id": "gemini-pro-orchestrator-g1-pro",
|
|
145
|
+
"label": "Orchestrator (Argon)"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"id": "gemini-pro-orchestrator-neon",
|
|
149
|
+
"label": "Orchestrator (Neon)"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"id": "gpt-oss-120b-medium",
|
|
153
|
+
"label": "GPT-OSS 120B (Medium)"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"initialize": {
|
|
157
|
+
"protocolVersion": 1,
|
|
158
|
+
"agentName": "Antigravity ACP Server",
|
|
159
|
+
"agentVersion": "1.5.14",
|
|
160
|
+
"capabilities": {
|
|
161
|
+
"_meta.antigravity.systemPrompt.append": true,
|
|
162
|
+
"auth.logout": true,
|
|
163
|
+
"loadSession": true,
|
|
164
|
+
"load_session": true,
|
|
165
|
+
"promptCapabilities.audio": false,
|
|
166
|
+
"promptCapabilities.embeddedContext": true,
|
|
167
|
+
"promptCapabilities.image": true,
|
|
168
|
+
"sessionCapabilities.additionalDirectories": true,
|
|
169
|
+
"sessionCapabilities.close": true,
|
|
170
|
+
"sessionCapabilities.list": true,
|
|
171
|
+
"sessionCapabilities.load": true,
|
|
172
|
+
"sessionCapabilities.resume": true,
|
|
173
|
+
"session_capabilities.additionalDirectories": true,
|
|
174
|
+
"session_capabilities.close": true,
|
|
175
|
+
"session_capabilities.list": true,
|
|
176
|
+
"session_capabilities.load": true,
|
|
177
|
+
"session_capabilities.resume": true
|
|
178
|
+
},
|
|
179
|
+
"authMethodIds": [
|
|
180
|
+
"agent-platform",
|
|
181
|
+
"gemini-api-key",
|
|
182
|
+
"oauth-business",
|
|
183
|
+
"oauth-personal"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"session": {
|
|
187
|
+
"configOptions": [
|
|
188
|
+
{
|
|
189
|
+
"id": "mode",
|
|
190
|
+
"type": "select",
|
|
191
|
+
"values": [
|
|
192
|
+
"accept-edits",
|
|
193
|
+
"auto",
|
|
194
|
+
"default",
|
|
195
|
+
"plan"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"id": "model",
|
|
200
|
+
"type": "select",
|
|
201
|
+
"values": [
|
|
202
|
+
"claude-opus-5-5",
|
|
203
|
+
"claude-sonnet-5-5",
|
|
204
|
+
"gemini-3.8-flash",
|
|
205
|
+
"gemini-4-argon",
|
|
206
|
+
"gemini-4-hydrogen",
|
|
207
|
+
"gemini-4-neon",
|
|
208
|
+
"gemini-pro-orchestrator-g1-pro",
|
|
209
|
+
"gemini-pro-orchestrator-neon",
|
|
210
|
+
"gpt-oss-120b-medium"
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"id": "thought_level",
|
|
215
|
+
"type": "select",
|
|
216
|
+
"values": [
|
|
217
|
+
"high",
|
|
218
|
+
"low",
|
|
219
|
+
"medium",
|
|
220
|
+
"xhigh"
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
"modeIds": [
|
|
225
|
+
"accept-edits",
|
|
226
|
+
"auto",
|
|
227
|
+
"default",
|
|
228
|
+
"plan"
|
|
229
|
+
],
|
|
230
|
+
"modelIds": [
|
|
231
|
+
"claude-opus-5-5-high",
|
|
232
|
+
"claude-opus-5-5-low",
|
|
233
|
+
"claude-opus-5-5-medium",
|
|
234
|
+
"claude-sonnet-5-5-high",
|
|
235
|
+
"claude-sonnet-5-5-low",
|
|
236
|
+
"claude-sonnet-5-5-medium",
|
|
237
|
+
"gemini-3.8-flash-high",
|
|
238
|
+
"gemini-3.8-flash-low",
|
|
239
|
+
"gemini-3.8-flash-medium",
|
|
240
|
+
"gemini-4-argon-high",
|
|
241
|
+
"gemini-4-argon-low",
|
|
242
|
+
"gemini-4-argon-medium",
|
|
243
|
+
"gemini-4-hydrogen-high",
|
|
244
|
+
"gemini-4-hydrogen-low",
|
|
245
|
+
"gemini-4-hydrogen-medium",
|
|
246
|
+
"gemini-4-hydrogen-xhigh",
|
|
247
|
+
"gemini-4-neon-high",
|
|
248
|
+
"gemini-4-neon-low",
|
|
249
|
+
"gemini-4-neon-medium",
|
|
250
|
+
"gemini-4-neon-xhigh",
|
|
251
|
+
"gemini-pro-orchestrator-g1-pro",
|
|
252
|
+
"gemini-pro-orchestrator-neon",
|
|
253
|
+
"gpt-oss-120b-medium"
|
|
254
|
+
],
|
|
255
|
+
"metaKeys": [
|
|
256
|
+
"antigravity"
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
"fileTokenStorageTrigger": "SSH_CONNECTION"
|
|
260
|
+
}
|
package/compat/matrix.json
CHANGED
package/compat/probe.ts
CHANGED
|
@@ -40,7 +40,7 @@ export const PROBE_PROTOCOL_VERSION = 1;
|
|
|
40
40
|
export const PROBE_CLIENT_INFO = {
|
|
41
41
|
name: "pi-agy-bridge-compat-probe",
|
|
42
42
|
title: "pi-agy-bridge zero-cost compat probe",
|
|
43
|
-
version: "0.
|
|
43
|
+
version: "0.2.0",
|
|
44
44
|
} as const;
|
|
45
45
|
|
|
46
46
|
/** One failed probe step. `step` names the command or exchange. */
|
|
@@ -70,6 +70,9 @@ export interface AcpHandshake {
|
|
|
70
70
|
export interface ProbeRunner {
|
|
71
71
|
runCommand(args: string[]): Promise<CommandResult>;
|
|
72
72
|
acpHandshake(): Promise<AcpHandshake>;
|
|
73
|
+
/** Does agy switch to its per-folder token file when SSH_CONNECTION is set (what extra accounts rely on)? Returns
|
|
74
|
+
* the trigger that worked, or undefined. Optional: recorded fixtures and older runners do not have it. */
|
|
75
|
+
fileStorageTrigger?(): Promise<string | undefined>;
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
export interface ProbeModel {
|
|
@@ -108,6 +111,9 @@ export interface ProbeSnapshot {
|
|
|
108
111
|
models: ProbeModel[];
|
|
109
112
|
initialize: ProbeInitialize;
|
|
110
113
|
session: ProbeSession;
|
|
114
|
+
/** `SSH_CONNECTION` when agy used per-folder token storage under that variable (multi-account support); absent when
|
|
115
|
+
* not measured. A baseline that has it and a current snapshot that lost it is breaking drift. */
|
|
116
|
+
fileTokenStorageTrigger?: string;
|
|
111
117
|
}
|
|
112
118
|
|
|
113
119
|
export interface ProbeDiff {
|
|
@@ -308,6 +314,15 @@ export async function collectSnapshot(runner: ProbeRunner, options: CollectOptio
|
|
|
308
314
|
if (err instanceof ProbeError) throw err;
|
|
309
315
|
throw new ProbeError("agy acp handshake", errorMessage(err));
|
|
310
316
|
}
|
|
317
|
+
let trigger: string | undefined;
|
|
318
|
+
if (runner.fileStorageTrigger) {
|
|
319
|
+
try {
|
|
320
|
+
trigger = await runner.fileStorageTrigger();
|
|
321
|
+
} catch (err) {
|
|
322
|
+
if (err instanceof ProbeError) throw err;
|
|
323
|
+
throw new ProbeError("agy acp file-storage check", errorMessage(err));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
311
326
|
|
|
312
327
|
return {
|
|
313
328
|
schema: PROBE_SCHEMA,
|
|
@@ -318,6 +333,7 @@ export async function collectSnapshot(runner: ProbeRunner, options: CollectOptio
|
|
|
318
333
|
models: parseModels(outputOf(models)),
|
|
319
334
|
initialize: initializeSnapshot(handshake.initialize),
|
|
320
335
|
session: sessionSnapshot(handshake.sessionNew),
|
|
336
|
+
...(trigger ? { fileTokenStorageTrigger: trigger } : {}),
|
|
321
337
|
};
|
|
322
338
|
}
|
|
323
339
|
|
|
@@ -373,6 +389,13 @@ export function diffSnapshots(baseline: ProbeSnapshot, current: ProbeSnapshot):
|
|
|
373
389
|
);
|
|
374
390
|
}
|
|
375
391
|
|
|
392
|
+
if (baseline.fileTokenStorageTrigger && current.fileTokenStorageTrigger !== baseline.fileTokenStorageTrigger) {
|
|
393
|
+
breaking.push(
|
|
394
|
+
`per-account token storage trigger lost: ${baseline.fileTokenStorageTrigger} -> ${current.fileTokenStorageTrigger ?? "none"} (extra accounts would stop; see UPGRADING.md)`,
|
|
395
|
+
);
|
|
396
|
+
} else if (!baseline.fileTokenStorageTrigger && current.fileTokenStorageTrigger) {
|
|
397
|
+
additive.push(`per-account token storage trigger recorded: ${current.fileTokenStorageTrigger}`);
|
|
398
|
+
}
|
|
376
399
|
compareSets("agy flag", baseline.helpFlags, current.helpFlags);
|
|
377
400
|
compareSets("agy acp flag", baseline.acpHelpFlags, current.acpHelpFlags);
|
|
378
401
|
compareSets("auth method", baseline.initialize.authMethodIds, current.initialize.authMethodIds);
|
|
@@ -523,6 +546,7 @@ export function serializeSnapshot(snapshot: ProbeSnapshot): string {
|
|
|
523
546
|
modelIds: [...snapshot.session.modelIds].sort(),
|
|
524
547
|
metaKeys: [...snapshot.session.metaKeys].sort(),
|
|
525
548
|
},
|
|
549
|
+
...(snapshot.fileTokenStorageTrigger ? { fileTokenStorageTrigger: snapshot.fileTokenStorageTrigger } : {}),
|
|
526
550
|
};
|
|
527
551
|
return `${JSON.stringify(ordered, null, "\t")}\n`;
|
|
528
552
|
}
|
|
@@ -633,6 +657,7 @@ function parseBaselineSnapshot(raw: unknown, path: string): ProbeSnapshot {
|
|
|
633
657
|
modelIds: session.modelIds as string[],
|
|
634
658
|
metaKeys: session.metaKeys as string[],
|
|
635
659
|
},
|
|
660
|
+
...(typeof root.fileTokenStorageTrigger === "string" ? { fileTokenStorageTrigger: root.fileTokenStorageTrigger } : {}),
|
|
636
661
|
};
|
|
637
662
|
}
|
|
638
663
|
|
|
@@ -821,5 +846,49 @@ export function createAgyRunner(options: AgyRunnerOptions = {}): AgyProbeRunner
|
|
|
821
846
|
}
|
|
822
847
|
};
|
|
823
848
|
|
|
824
|
-
|
|
849
|
+
/** Start `agy acp` with SSH_CONNECTION on an empty private gemini dir and read agy's own log for the storage line.
|
|
850
|
+
* agy resolves its token store lazily (measured on 1.5.14: the line appears while `session/new` runs), so one
|
|
851
|
+
* `session/new` is sent; with no login in the empty dir it fails with "Authentication required", which is expected.
|
|
852
|
+
* No prompt is sent and no existing login is touched. */
|
|
853
|
+
const fileStorageTrigger = async (): Promise<string | undefined> => {
|
|
854
|
+
const cwd = await ensureWorkspace();
|
|
855
|
+
const geminiDir = await mkdtemp(join(tempRoot, "pi-agy-probe-storage-"));
|
|
856
|
+
const logFile = join(geminiDir, "acp.log");
|
|
857
|
+
const child = trackSpawnedIdentity(
|
|
858
|
+
spawn(agyBin, ["acp", "--gemini-dir", geminiDir, "--log-file", logFile], {
|
|
859
|
+
cwd,
|
|
860
|
+
windowsHide: true,
|
|
861
|
+
env: { ...env, SSH_CONNECTION: "pi-agy-probe 0 pi-agy-probe 0" },
|
|
862
|
+
}),
|
|
863
|
+
agyBin,
|
|
864
|
+
);
|
|
865
|
+
const session = new JsonRpcSession({
|
|
866
|
+
send: (frame: string) => {
|
|
867
|
+
child.stdin?.write(`${frame}\n`);
|
|
868
|
+
},
|
|
869
|
+
defaultTimeoutMs: handshakeTimeoutMs,
|
|
870
|
+
});
|
|
871
|
+
child.stdout?.setEncoding("utf8");
|
|
872
|
+
child.stdout?.on("data", (chunk: string) => session.feed(chunk));
|
|
873
|
+
child.on("error", (err) => session.abortAll(`could not start ${agyBin}: ${errorMessage(err)}`));
|
|
874
|
+
child.on("close", (code) => session.abortAll(`agy acp exited with code ${code ?? "?"} during the file-storage check`));
|
|
875
|
+
try {
|
|
876
|
+
await session.request("initialize", INITIALIZE_PARAMS, handshakeTimeoutMs);
|
|
877
|
+
await session.request("session/new", { cwd, mcpServers: [] }, handshakeTimeoutMs).catch(() => undefined);
|
|
878
|
+
const deadline = Date.now() + 10_000;
|
|
879
|
+
while (Date.now() < deadline) {
|
|
880
|
+
const text = await readFile(logFile, "utf8").catch(() => "");
|
|
881
|
+
if (/Using file-based token storage/.test(text)) return "SSH_CONNECTION";
|
|
882
|
+
if (/authenticated successfully as|Silent sign-in failed/.test(text)) return undefined;
|
|
883
|
+
await new Promise((resolveDelay) => setTimeout(resolveDelay, 100));
|
|
884
|
+
}
|
|
885
|
+
return undefined;
|
|
886
|
+
} finally {
|
|
887
|
+
session.abortAll("probe finished");
|
|
888
|
+
await terminateProcessTree(child);
|
|
889
|
+
await rm(geminiDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 }).catch(() => undefined);
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
return { agyBin, runCommand, acpHandshake, fileStorageTrigger, dispose };
|
|
825
894
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timmyjl12/pi-agy-bridge",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "pi provider for Google Antigravity (agy) models over the official ACP server, modelled on pi-claude-code: pi keeps the loop, history and tool execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,11 +35,13 @@
|
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@earendil-works/pi-ai": "*",
|
|
38
|
-
"@earendil-works/pi-coding-agent": "*"
|
|
38
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
39
|
+
"@earendil-works/pi-tui": "*"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@earendil-works/pi-ai": "^1.5.2",
|
|
42
43
|
"@earendil-works/pi-coding-agent": "^1.5.2",
|
|
44
|
+
"@earendil-works/pi-tui": "^1.5.2",
|
|
43
45
|
"@types/node": "^22.19.0",
|
|
44
46
|
"typescript": "^5.9.3"
|
|
45
47
|
},
|