@timmyjl12/pi-agy-bridge 0.1.4 → 0.2.0
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 -8
- package/UPGRADING.md +133 -111
- package/compat/baselines/agy-1.5.12.json +259 -0
- package/compat/baselines/agy-1.5.14.json +260 -0
- package/compat/matrix.json +1 -1
- package/compat/probe.ts +71 -2
- package/compat/sdk-canary/canary.py +9 -3
- package/package.json +4 -2
- package/src/account-manager.ts +397 -0
- package/src/accounts.ts +349 -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 +440 -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.
|
|
7
|
+
> Status: 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
|
|
|
@@ -30,16 +30,56 @@ Models appear as `agy/<id>` in `/model`:
|
|
|
30
30
|
| --- | --- |
|
|
31
31
|
| `agy/gemini-4-argon`, `agy/gemini-3.8-flash`, `agy/claude-opus-5-5`, `agy/claude-sonnet-5-5` | low, medium, high |
|
|
32
32
|
| `agy/gemini-4-hydrogen` | low, medium, high, xhigh (reported by agy 1.5.8) |
|
|
33
|
-
| `agy/gemini-
|
|
33
|
+
| `agy/gemini-4-neon` | low, medium, high, xhigh (reported by agy 1.5.12) |
|
|
34
|
+
| `agy/gemini-pro-orchestrator-g1-pro`, `agy/gemini-pro-orchestrator-neon` | no selectable reasoning level |
|
|
34
35
|
| `agy/gpt-oss-120b-medium` | fixed (medium) |
|
|
35
36
|
|
|
36
37
|
The list is what your agy reports, so new models appear without an update. pi's "off" thinking level is not offered because agy cannot switch thinking off.
|
|
37
38
|
|
|
38
39
|
| Command | What it does |
|
|
39
40
|
| --- | --- |
|
|
40
|
-
| `/agy-bridge
|
|
41
|
-
| `/agy-bridge
|
|
42
|
-
| `/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
|
|
63
|
+
/agy-bridge accounts
|
|
64
|
+
agy default agy's own login enabled
|
|
65
|
+
agy-acct2 acct2 timm…2385@gmail.com enabled
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- **Your default account is unchanged.** `agy/<model>` keeps using agy's normal login; without extra accounts this package behaves exactly as before.
|
|
69
|
+
- **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:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
"agy/claude-opus-5-5": ["agy-acct2/claude-opus-5-5", "agy/gemini-4-argon", "agy-acct2/gemini-4-argon"]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Accounts on different plans offer different models: check with `/agy-bridge models acct2` and only chain to models the account lists.
|
|
76
|
+
- **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>)`.
|
|
77
|
+
- **Alias.** `/agy-bridge alias acct2 work` renames the provider to `agy-work`; the folder stays `accounts/acct2`.
|
|
78
|
+
- **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.
|
|
79
|
+
- **Cost.** One more `agy acp` process per account while in use; each stops after `PI_AGY_IDLE_MIN`.
|
|
80
|
+
- **Terms.** Whether using several Google accounts is allowed for your plans is your decision.
|
|
81
|
+
|
|
82
|
+
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.
|
|
43
83
|
|
|
44
84
|
## Configuration
|
|
45
85
|
|
|
@@ -57,14 +97,17 @@ Environment variables (all optional). Invalid values fall back to the default.
|
|
|
57
97
|
| `PI_AGY_CANCEL_GRACE_MS` | `3000` | wait this long for a cancel before giving up on a turn |
|
|
58
98
|
| `PI_AGY_MAX_REPLAY_KB` | `8192` | refuse to replay a conversation larger than this |
|
|
59
99
|
| `PI_AGY_CONTROL_TIMEOUT_SEC` | `60` | timeout for handshake and session calls |
|
|
60
|
-
| `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 |
|
|
100
|
+
| `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 |
|
|
101
|
+
| `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 |
|
|
61
102
|
| `PI_AGY_TRACE` | off | `1` appends diagnostics to `<home>/trace.log` |
|
|
103
|
+
| `PI_AGY_ACCOUNTS` | none | extra accounts by id, comma-separated, in addition to `accounts.json` (see [Multiple Antigravity accounts](#multiple-antigravity-accounts)) |
|
|
104
|
+
| `PI_AGY_ACCOUNT_<ID>_EMAIL` | none | expected Google account of an extra account (normally recorded at sign-in) |
|
|
62
105
|
|
|
63
106
|
pi's own request `timeoutMs`, when set, is honoured as a total deadline for the turn.
|
|
64
107
|
|
|
65
108
|
### What is written to disk
|
|
66
109
|
|
|
67
|
-
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
|
|
110
|
+
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.
|
|
68
111
|
|
|
69
112
|
## Working with your other extensions
|
|
70
113
|
|
|
@@ -93,9 +136,11 @@ Example chain, mirrored from an `antigravity/*` chain:
|
|
|
93
136
|
| --- | --- | --- |
|
|
94
137
|
| 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) |
|
|
95
138
|
| `agy authentication required (not logged in)` | login expired | run `agy` and sign in |
|
|
139
|
+
| `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) |
|
|
140
|
+
| `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) |
|
|
96
141
|
| `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 |
|
|
97
142
|
| `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 |
|
|
98
|
-
| `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 |
|
|
143
|
+
| `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 |
|
|
99
144
|
| `agy exited with status N` | the agy process died | retry (a new process starts); `/agy-bridge doctor` shows agy's last stderr |
|
|
100
145
|
| `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 |
|
|
101
146
|
| `pi-agy-bridge is unavailable: agy ... below the minimum` | agy too old | `agy update` |
|
package/UPGRADING.md
CHANGED
|
@@ -1,111 +1,133 @@
|
|
|
1
|
-
# Upgrading pi-agy-bridge (agy / SDK drift runbook)
|
|
2
|
-
|
|
3
|
-
`agy` ships often (three patch releases in one week of November 2026) and the
|
|
4
|
-
`google-antigravity` SDK ships about once a week. None of this needs a model
|
|
5
|
-
call or quota: the probes are free.
|
|
6
|
-
|
|
7
|
-
## Triggers
|
|
8
|
-
|
|
9
|
-
| Signal | What it means | Go to |
|
|
10
|
-
| --- | --- | --- |
|
|
11
|
-
| `/agy-bridge doctor`, or the one-time notice shown at the first request, says `untested` / `newer-untested` | a newer agy is installed than the matrix tested | §1, then §3 |
|
|
12
|
-
| doctor says `below-minimum`, `known-bad`, `protocol` or `not-agy` | the provider refused to start (it names the fix) | §1 → §4 |
|
|
13
|
-
| `npm run compat:probe` exits 1 or 2 | agy's flags/capabilities/models moved | §3 |
|
|
14
|
-
| `uv run --project compat/sdk-canary python compat/sdk-canary/canary.py --latest` exits 1 or 2 | the SDK harness contract moved | §5 |
|
|
15
|
-
| a contract test or replay fixture fails after an agy update | an ACP exchange changed shape | §4 |
|
|
16
|
-
| Windows/uv problems, missing `agy` | environment, not drift | §6 |
|
|
17
|
-
|
|
18
|
-
`npm run compat:probe` exit codes: `0` identical, `1` additive only (or no
|
|
19
|
-
baseline recorded yet), `2` breaking, `3` the probe could not run. The SDK
|
|
20
|
-
canary uses the same codes.
|
|
21
|
-
|
|
22
|
-
## 1. Free drift probe (no prompt, no quota)
|
|
23
|
-
|
|
24
|
-
```powershell
|
|
25
|
-
npm run compat:probe # compare installed agy with compat/baselines/agy-<version>.json
|
|
26
|
-
npm run compat:probe -- --json # machine-readable (status, breaking[], additive[])
|
|
27
|
-
npm run compat:probe -- --record # write compat/baselines/agy-<version>.json
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
> **PowerShell:** it consumes the first `--`, so `npm run compat:probe -- --record` silently runs a plain check (and `-- --help` goes to npm). Quote the separator, `npm run compat:probe "--" --record`, or call the script directly: `node compat/probe-cli.ts --record`. The same applies to every `npm run compat:... -- <flag>` in this file; for the SDK canary use `uv run --project compat/sdk-canary python compat/sdk-canary/canary.py --record`.
|
|
31
|
-
|
|
32
|
-
The probe uses a temp cwd and `agy acp --gemini-dir <temp>`, so `~/.gemini` is
|
|
33
|
-
never written and your login is only used, not copied. It kills only the process
|
|
34
|
-
it spawned.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
##
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- `
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1
|
+
# Upgrading pi-agy-bridge (agy / SDK drift runbook)
|
|
2
|
+
|
|
3
|
+
`agy` ships often (three patch releases in one week of November 2026) and the
|
|
4
|
+
`google-antigravity` SDK ships about once a week. None of this needs a model
|
|
5
|
+
call or quota: the probes are free.
|
|
6
|
+
|
|
7
|
+
## Triggers
|
|
8
|
+
|
|
9
|
+
| Signal | What it means | Go to |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| `/agy-bridge doctor`, or the one-time notice shown at the first request, says `untested` / `newer-untested` | a newer agy is installed than the matrix tested | §1, then §3 |
|
|
12
|
+
| doctor says `below-minimum`, `known-bad`, `protocol` or `not-agy` | the provider refused to start (it names the fix) | §1 → §4 |
|
|
13
|
+
| `npm run compat:probe` exits 1 or 2 | agy's flags/capabilities/models moved | §3 |
|
|
14
|
+
| `uv run --project compat/sdk-canary python compat/sdk-canary/canary.py --latest` exits 1 or 2 | the SDK harness contract moved | §5 |
|
|
15
|
+
| a contract test or replay fixture fails after an agy update | an ACP exchange changed shape | §4 |
|
|
16
|
+
| Windows/uv problems, missing `agy` | environment, not drift | §6 |
|
|
17
|
+
|
|
18
|
+
`npm run compat:probe` exit codes: `0` identical, `1` additive only (or no
|
|
19
|
+
baseline recorded yet), `2` breaking, `3` the probe could not run. The SDK
|
|
20
|
+
canary uses the same codes.
|
|
21
|
+
|
|
22
|
+
## 1. Free drift probe (no prompt, no quota)
|
|
23
|
+
|
|
24
|
+
```powershell
|
|
25
|
+
npm run compat:probe # compare installed agy with compat/baselines/agy-<version>.json
|
|
26
|
+
npm run compat:probe -- --json # machine-readable (status, breaking[], additive[])
|
|
27
|
+
npm run compat:probe -- --record # write compat/baselines/agy-<version>.json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> **PowerShell:** it consumes the first `--`, so `npm run compat:probe -- --record` silently runs a plain check (and `-- --help` goes to npm). Quote the separator, `npm run compat:probe "--" --record`, or call the script directly: `node compat/probe-cli.ts --record`. The same applies to every `npm run compat:... -- <flag>` in this file; for the SDK canary use `uv run --project compat/sdk-canary python compat/sdk-canary/canary.py --record`.
|
|
31
|
+
|
|
32
|
+
The probe uses a temp cwd and `agy acp --gemini-dir <temp>`, so `~/.gemini` is
|
|
33
|
+
never written and your login is only used, not copied. It kills only the process
|
|
34
|
+
it spawned.
|
|
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
|
+
|
|
48
|
+
## 2. Decide what the drift is
|
|
49
|
+
|
|
50
|
+
| Probe result | Meaning | Action |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `identical` | nothing changed | done |
|
|
53
|
+
| `additive` | new flags / capabilities / models / config values | review the list (for new models, also check what a real session accepts, see `tests/model-catalog.test.ts`), `-- --record`, add the version to `compat/matrix.json` (§4), commit both |
|
|
54
|
+
| `breaking` (removed flag, capability, config option or value, model id, auth method; changed protocolVersion or agent name) | the adapter may now be wrong | **stop**. Read `agy changelog`, adjust the adapter, add/re-record the replay fixture, run `node --test tests/features.test.ts tests/probe.test.ts`, and only then re-record baselines |
|
|
55
|
+
| `no baseline` | first run on a new major/minor | `-- --record` after reviewing the printed summary |
|
|
56
|
+
|
|
57
|
+
Never re-record a baseline to make a red probe green: it is the reviewed
|
|
58
|
+
"known good", not a snapshot of whatever happens to be installed.
|
|
59
|
+
|
|
60
|
+
## 3. Tests after an agy change
|
|
61
|
+
|
|
62
|
+
```powershell
|
|
63
|
+
node --test tests/features.test.ts tests/probe.test.ts
|
|
64
|
+
npm test # whole package (needs the other suites to exist)
|
|
65
|
+
npm run check # tsc --noEmit
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`features.test.ts` pins feature negotiation against the recorded 1.5.3
|
|
69
|
+
`initialize` result and its mutations. `model-catalog.test.ts` covers the
|
|
70
|
+
`session/new` catalog captured from agy 1.5.8 and the catalog recorded in the
|
|
71
|
+
1.5.12 baseline, including per-model `xhigh`, models with no selectable reasoning
|
|
72
|
+
level, and that the session-wide `thought_level` option never leaks a level to a
|
|
73
|
+
model whose own variants do not list it. `probe.test.ts` pins parsers, diff
|
|
74
|
+
classification, baseline selection and CLI exit codes through injected
|
|
75
|
+
fixtures; these tests never spawn agy.
|
|
76
|
+
|
|
77
|
+
## 4. Add a version to the matrix
|
|
78
|
+
|
|
79
|
+
Edit `compat/matrix.json` (JSON, no rebuild needed):
|
|
80
|
+
|
|
81
|
+
- `agy.tested`: add the version once its probe diff is reviewed (keep the list
|
|
82
|
+
short — the last two or three releases). The list may exceed that when an entry
|
|
83
|
+
is an **anchor** rather than a recent release. `1.5.3` is the recorded handshake
|
|
84
|
+
the feature negotiation and probe parser tests are built on, and `1.5.8`/`1.5.9`
|
|
85
|
+
are live-verified with committed baselines: dropping any of them turns working
|
|
86
|
+
installs into `older-untested` and tells the user to `agy update` for no reason.
|
|
87
|
+
Trim older *releases* on the next refresh; never drop an anchor.
|
|
88
|
+
- `agy.minimum`: raise only when a lower version provably can no longer work
|
|
89
|
+
(record why in the commit message; the refusal message is user-facing).
|
|
90
|
+
- `agy.knownBad`: `"1.5.2"` or `{ "version": "1.5.2", "reason": "ACP shutdown hang" }`.
|
|
91
|
+
- `acp.protocolVersion`: bump together with the adapter that speaks it.
|
|
92
|
+
- `sdk.tested`: the SDK releases whose fingerprint is committed.
|
|
93
|
+
|
|
94
|
+
## 5. SDK contract canary
|
|
95
|
+
|
|
96
|
+
```powershell
|
|
97
|
+
uv run --project compat/sdk-canary python compat/sdk-canary/canary.py
|
|
98
|
+
uv run --project compat/sdk-canary python compat/sdk-canary/canary.py --record
|
|
99
|
+
uv run --project compat/sdk-canary python compat/sdk-canary/canary.py --latest
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
First run creates `compat/sdk-canary/.venv` (the pinned `google-antigravity`
|
|
103
|
+
version is in `pyproject.toml`; `uv.lock` is committed and `.venv` is gitignored).
|
|
104
|
+
As of 2026-11-19, PyPI latest, the `main` branch of
|
|
105
|
+
`google-antigravity/antigravity-sdk-python` and the recorded SDK baseline are all
|
|
106
|
+
`0.1.23`, so there is no newer SDK to adopt. Check both upstreams before assuming
|
|
107
|
+
one leads the other: a missing git tag is not a newer release. `--latest` needs
|
|
108
|
+
network (PyPI + uv); `--record` is deterministic. Additive: re-record, add to
|
|
109
|
+
`sdk.tested`. Breaking (removed/renumbered messages, fields or enums): the harness
|
|
110
|
+
family behind `agy` changed — check the affected call in the adapter, then
|
|
111
|
+
re-record after review.
|
|
112
|
+
|
|
113
|
+
## 6. Rollback
|
|
114
|
+
|
|
115
|
+
- **agy**: reinstall the previous release and pin it (keep the old version in
|
|
116
|
+
`agy.tested`); the provider refuses only below `agy.minimum` or on a protocol
|
|
117
|
+
mismatch, so a tested older release keeps working.
|
|
118
|
+
- **package**: `npm i -g @timmyjl12/pi-agy-bridge@<previous>` (or `pi` extension
|
|
119
|
+
pin) and restore the previous `compat/baselines/*.json` and
|
|
120
|
+
`compat/matrix.json` from git — never edit them in place to dodge a failure.
|
|
121
|
+
- **fixtures**: replay fixtures are recorded artifacts; revert them with the code
|
|
122
|
+
that expects them.
|
|
123
|
+
|
|
124
|
+
## 7. Ground rules (non-negotiable)
|
|
125
|
+
|
|
126
|
+
- Never read, store, forward or replace Antigravity credentials, and never
|
|
127
|
+
override agy's endpoint or user agent. The bridge is a client, not a proxy.
|
|
128
|
+
- Never change the user's `~/.gemini` (`settings.json`, `mcp_config.json`,
|
|
129
|
+
agents, login). Per-session state travels in ACP parameters and a private
|
|
130
|
+
staged directory.
|
|
131
|
+
- Kill only processes the bridge spawned (exact PID, tree kill); never by name.
|
|
132
|
+
- Re-recording is one documented command whose diff is reviewed before the
|
|
133
|
+
baseline is committed.
|