omp-antigravity-acp-provider 0.1.30 → 0.1.32

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.
@@ -0,0 +1,22 @@
1
+ # Install for agents
2
+
3
+ Hand this file to an agent with terminal access. It installs and verifies the adapter without starting an interactive login.
4
+
5
+ ```text
6
+ Install the OMP plugin "omp-antigravity-acp-provider" from https://github.com/SenCha930511/omp-antigravity-acp-provider.
7
+
8
+ Constraints:
9
+ - Do not start a Google login, open a browser, or run any command that waits for user input.
10
+ - Do not copy, print, store or transmit credentials, tokens or account identifiers.
11
+ - Do not install both the npm and marketplace variants.
12
+
13
+ Steps:
14
+ 1. Run `omp --version` and `node --version`. Stop and report if OMP is missing or Node.js is below 22.19.
15
+ 2. Run `omp plugin list --json` and search `npm[].name` and `marketplace[].id` for `antigravity-acp-provider`. If one exists, stop and report it instead of installing a second copy.
16
+ 3. Install with `omp plugin install npm:omp-antigravity-acp-provider`. For the marketplace variant, run `omp plugin marketplace add SenCha930511/omp-antigravity-acp-provider` first, then `omp plugin install omp-antigravity-acp-provider@sencha-plugins`.
17
+ 4. Run `omp plugin list --json` again and confirm exactly one adapter is present. Record its version.
18
+ 5. Run `omp models antigravity-acp --json`. Cached listing must not start the ACP server. An empty catalog before sign-in is acceptable; report it instead of retrying in a loop.
19
+ 6. Tell the user to restart OMP, then run `/login` → "Google Antigravity (ACP)" and `/antigravity-acp refresh` inside OMP. Do not perform these steps yourself.
20
+
21
+ Acceptance: one adapter installed, `omp models antigravity-acp --json` returns valid JSON, and no credential material appears in any output. Report the commands run, the adapter version, any model IDs and the first step that failed.
22
+ ```
package/README.md CHANGED
@@ -2,397 +2,121 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/omp-antigravity-acp-provider.svg)](https://www.npmjs.com/package/omp-antigravity-acp-provider)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/omp-antigravity-acp-provider.svg)](https://www.npmjs.com/package/omp-antigravity-acp-provider)
5
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+ [![node](https://img.shields.io/badge/node-%E2%89%A522.19-339933?logo=node.js&logoColor=white)](package.json)
7
+ [![OMP marketplace](https://img.shields.io/badge/OMP-marketplace-7c3aed)](https://github.com/SenCha930511/omp-antigravity-acp-provider)
8
+ [![ACP runtime](https://img.shields.io/badge/ACP%20runtime-%E2%89%A51.4.1-4285F4)](https://github.com/SenCha930511/omp-antigravity-acp-provider)
9
+ [![GitHub stars](https://img.shields.io/github/stars/SenCha930511/omp-antigravity-acp-provider)](https://github.com/SenCha930511/omp-antigravity-acp-provider/stargazers)
5
10
 
6
11
  Google Antigravity's official ACP server, adapted for **Oh My Pi (OMP)**.
7
12
 
8
13
  **An OMP-focused derivative fork of [zacbemis/pi-antigravity-acp-provider](https://github.com/zacbemis/pi-antigravity-acp-provider).** Original project by [zacbemis](https://github.com/zacbemis) and contributors, licensed under MIT.
9
14
 
10
- This is an independent adaptation, not an official Google or OMP integration. It uses ACP over stdio. The local HTTP MCP bridge carries tool calls; it is not a model API reverse proxy.
15
+ This is an independent adaptation, **NOT** an official Google or OMP integration. It uses ACP over stdio. The local HTTP MCP bridge carries tool calls; it is not a model API reverse proxy.
11
16
 
12
- ## Upstream and fork scope
13
-
14
- The original project's ACP transport, Google-managed authentication, runtime installation, session restoration and MCP tool bridge form the foundation of this project. Credit for those capabilities belongs to the upstream authors.
15
-
16
- This derivative adds OMP-specific provider registration, confirmed model/thinking selectors, lazy catalog loading, OMP-first tool instructions, API-equivalent pricing and per-session runtime lifecycle fixes for planning/refinement.
17
-
18
- The repository vendors the upstream **0.1.15** source under `extension/vendor/pi-antigravity-acp-provider` (MIT, see `extension/vendor/pi-antigravity-acp-provider/LICENSE`). The standalone artifact bundles its runtime code, supervisor and signed runtime manifest; end users need no production npm dependencies. It does not contain a copy of upstream's Git history. See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for the original copyright and license notice.
19
- ## Status
20
-
21
- Version 0.1.28 classifies macOS keychain failures explicitly, refuses a fresh Google login when the previous credential cannot be confirmed removed, and closes logout race windows so a quick re-login cannot lose its new keychain credential. It keeps the 0.1.26 session-lease, idle-runtime and 0.1.24 ownership fixes. Restart all OMP processes after upgrading so they participate in session ownership.
17
+ ## Features
22
18
 
23
- Version 0.1.26 supports all models advertised by the official ACP server. Earlier live inference was tested with macOS, OMP 18.12.5, upstream provider 0.1.15 and official ACP runtime 1.4.1. The 0.1.21–0.1.24 continuity fixes are verified offline, including OMP 18.13.3 catalog loading and the local OMP summarizer source. Other platforms and full interactive Refine plan behavior with a real model remain unverified.
19
+ - All server-advertised models, including Claude, GPT-OSS and future IDs when the ACP endpoint advertises them.
20
+ - Per-model thinking levels, exposed only when the server confirms them.
21
+ - OMP tools through an authenticated loopback MCP bridge.
22
+ - Optional `disabled` native-tool mode for strict OMP-only sessions.
23
+ - Lazy ACP startup and warm session reuse.
24
+ - `/login` plus `/antigravity-acp` account, usage and cleanup commands.
25
+ - API-equivalent cost estimates, not subscription billing.
24
26
 
25
- Google's consumer-plan policies can restrict third-party agent access even through the official CLI or ACP executable. An official transport does not establish permission to use a subscription in OMP. Check the current [Antigravity FAQ](https://www.antigravity.google/docs/faq/) and [terms](https://antigravity.google/terms) for your account.
27
+ ## Install: for human
26
28
 
27
- ## Features
29
+ Follow these steps in order. The whole flow takes a few minutes, plus Google's sign-in and the first runtime download.
28
30
 
29
- - All server-advertised model IDs, without a Gemini-only whitelist. Claude, GPT-OSS or future models become available when the ACP endpoint advertises them for your account.
30
- - Per-model, server-confirmed thinking selection. OMP efforts `off`, `minimal`, `low`, `medium`, `high`, `xhigh` and `max` are exposed only when advertised; models without these choices use the server default.
31
- - Compatible OMP tools exposed through an authenticated loopback MCP bridge.
32
- - Provider-specific instructions prefer OMP tools and require approval before substituting native Antigravity tools. Supported runtimes receive these instructions through the official system-append extension and eagerly register the pi-bridge tools.
33
- - Optional native built-in tool filtering; default `prefer` mode keeps native tools available, while `disabled` mode removes native built-ins for this adapter's ACP sessions.
34
- - Duplicate gray ACP tool-status lines are hidden by default, with an optional debug display switch. OMP tool calls/results and actual thought summaries remain visible.
35
- - Lazy ACP startup; model selection and cached listing do not launch the server.
36
- - Runtimes scoped to OMP sessions, including recovery after a planning session is disposed.
37
- - OMP `/login` support plus `/antigravity-acp login`, `logout` and `account` commands; OMP's `/logout` automatically finishes the Antigravity-side logout, including the macOS keychain entry the Antigravity server owns.
38
- - API-equivalent cost estimates, not subscription billing or quota measurements.
31
+ ### 1. Check prerequisites
39
32
 
40
- ## Install from the OMP marketplace
33
+ - OMP is installed and `omp --version` works.
34
+ - Node.js 22.19 or newer (`node --version`) and npm are on `PATH`; the marketplace launcher uses them on first load.
35
+ - A supported platform: macOS, Linux or Windows. Live testing has been on macOS.
36
+ - Internet access for the first run. The official Antigravity runtime downloads separately (about 383 MiB on macOS) into `~/.local/opt/agy-acp/`.
41
37
 
42
- No server is needed: this GitHub repository is also an OMP marketplace named **sencha-plugins**.
38
+ ### 2. Install exactly one adapter
43
39
 
44
- Add the source once, then install the plugin:
40
+ Use the marketplace (this repository is also the **sencha-plugins** marketplace):
45
41
 
46
42
  ```sh
47
43
  omp plugin marketplace add SenCha930511/omp-antigravity-acp-provider
48
44
  omp plugin install omp-antigravity-acp-provider@sencha-plugins
49
45
  ```
50
46
 
51
- Or, inside OMP:
52
-
53
- ```text
54
- /marketplace add SenCha930511/omp-antigravity-acp-provider
55
- /marketplace
56
- ```
57
-
58
- Select **omp-antigravity-acp-provider** in the browser, install it, and restart OMP to load the provider.
59
-
60
- OMP's marketplace installer currently copies Git content without installing npm dependencies. This marketplace therefore ships a small source launcher that retrieves the exact published **0.1.28** prebuilt npm adapter on first load. It disables npm install scripts and performs no local compilation. Node.js 22.19+ and npm must be on PATH. The standalone build bundles the required code and supervisor assets with no production dependencies: a clean test installation occupied approximately **2.6 MiB** (477 KiB tarball), down from roughly 150 MiB with the old dependency tree. This excludes the separately downloaded Google runtime. First preparation needs internet access; later loads reuse the installed cache without npm network access.
61
-
62
- The launcher stores its versioned dependencies in `.runtime/` inside the installed marketplace plugin's cache directory. Uninstalling the marketplace plugin removes that cache when it is no longer referenced by another scope. Google credentials and the separately downloaded official ACP runtime are unaffected.
63
-
64
- Use either marketplace installation or direct npm installation for this provider. Disable/remove an existing installation before switching to avoid duplicate provider registration. Adding this source makes it available to users who add **sencha-plugins**; it does not submit the package to a central curated store.
65
-
66
- To refresh the catalog and upgrade an existing marketplace installation:
67
-
68
- ```sh
69
- omp plugin marketplace update sencha-plugins
70
- omp plugin upgrade omp-antigravity-acp-provider@sencha-plugins
71
- ```
72
-
73
- ## Install directly from npm
74
-
75
- The prebuilt package is published on [npm as `omp-antigravity-acp-provider`](https://www.npmjs.com/package/omp-antigravity-acp-provider). Use Node.js 22.19 or newer and OMP to install the latest release:
47
+ Or install the published npm package directly:
76
48
 
77
49
  ```sh
78
50
  omp plugin install npm:omp-antigravity-acp-provider
79
51
  ```
80
52
 
81
- To pin a specific release:
82
-
83
- ```sh
84
- omp plugin install npm:omp-antigravity-acp-provider@0.1.28
85
- ```
53
+ Do not install both. Remove or disable any older Antigravity ACP adapter first.
86
54
 
87
- Restart OMP after installation. The npm package includes the built adapter; users do not need esbuild or a manual build step. Disable any older ACP adapter for the same provider before loading this package.
55
+ ### 3. Restart OMP
88
56
 
89
- The standalone npm package has no production dependencies or Pi CLI peers. Source development uses the pinned upstream build dependency and this repository's `.npmrc`.
57
+ The provider registers at startup. Restart every running OMP process so they agree on session ownership.
90
58
 
91
- ## Find it with zmarketplace
59
+ ### 4. Sign in
92
60
 
93
- [zmarketplace](https://github.com/zico20047/zmarketplace) searches npm using ecosystem keywords; it has no separate submission catalog. This package includes the `pi-package` keyword used for both Pi and OMP discovery, plus `extension` and `plugin` resource tags. These discovery tags do not establish compatibility with untested agent runtimes; this adapter targets OMP.
61
+ Run `/login`, choose **Google Antigravity (ACP)**, and complete Google's consent in the browser. On a headless machine the provider relays the callback URL.
94
62
 
95
- With zmarketplace already installed in OMP:
63
+ ### 5. Load models and pick one
96
64
 
97
65
  ```text
98
- /zmarketplace search omp-antigravity-acp-provider --eco=omp --type=extension
99
- ```
100
-
101
- Or search from a terminal with Bun:
102
-
103
- ```sh
104
- bunx zmarketplace search omp-antigravity-acp-provider --eco=omp --type=extension
105
- ```
106
-
107
- Use the OMP installation target when installing from the search result. The direct OMP command is `omp plugin install npm:omp-antigravity-acp-provider`. Newly published metadata may take time to appear in npm search results.
108
-
109
- ## Build from source
110
-
111
- Use Node.js 22.19 or newer and OMP. Node.js is also required by the upstream process supervisor.
112
-
113
- ```sh
114
- git clone https://github.com/SenCha930511/omp-antigravity-acp-provider.git
115
- cd omp-antigravity-acp-provider
116
- npm ci
117
- npm run check
66
+ /antigravity-acp refresh
67
+ /model
118
68
  ```
119
69
 
120
- The checked-in npm configuration disables automatic peer installation because the upstream package declares Pi-specific peers. This adapter explicitly supplies its runtime dependency on `pi-ai`; it does not need the Pi coding-agent CLI.
70
+ `refresh` asks the ACP server which models the account can use; `/model` lists them. Set an effort with OMP's thinking control when the model advertises levels. If OMP's `enabledModels` whitelist is configured, add `antigravity-acp/*` to it.
121
71
 
122
- The build produces `extension/runtime.mjs`, `extension/assets/` and `THIRD_PARTY_LICENSES.txt`. They are ignored by Git, rebuilt locally and included in published npm tarballs. Supervisor and runtime catalog paths resolve against these bundled assets, so the bundle does not embed the developer's home directory.
72
+ ### 6. Verify
123
73
 
124
- For a temporary session, from this repository:
125
-
126
- ```sh
127
- omp --no-extensions -e ./extension/index.ts
74
+ ```text
75
+ /antigravity-acp status
128
76
  ```
129
77
 
130
- This disables other extension discovery for that invocation, avoiding duplicate registration of an existing ACP adapter. For normal installation, use OMP's extension configuration or point `~/.omp/agent/extensions/omp-antigravity-acp-provider` at the built `extension` directory. Disable any previous `antigravity-acp-omp` or upstream Pi extension first; do not load two adapters for the same provider.
131
-
132
- This repository does not change an existing OMP installation or overwrite its settings.
78
+ This shows the runtime, native-tool mode and usage state. Send a short prompt to confirm inference.
133
79
 
134
- ## Sign in and choose a model
80
+ ### Troubleshooting
135
81
 
136
- 1. Run `/login` and select **Google Antigravity (ACP)**.
137
- 2. Complete Google's authorization flow. On headless machines the upstream provider can relay a browser callback.
138
- 3. Run `/antigravity-acp refresh` to discover the models actually advertised for the account.
139
- 4. Select a model with `/model` and use OMP's thinking control to select a supported effort.
140
-
141
- `/antigravity-acp login` runs the same Google authorization through a command dialog without touching OMP's stored account record; use it to re-authenticate or switch the Antigravity-side Google account. `/antigravity-acp account` shows the current authentication state on both sides.
142
-
143
- Both login paths always start a fresh Google sign-in: stored Antigravity credentials are cleared first, so the Google account chooser is always offered and a saved login cannot silently keep the previous account. The Google browser session itself is outside this adapter's control; pick the intended account (or "Use another account") on Google's consent screen.
144
-
145
- First use or login may download the official runtime. The observed macOS runtime occupies about **383 MiB**; size varies by platform/version. It lives outside this repository under `~/.local/opt/agy-acp/`. Do not remove it while ACP processes are running.
82
+ | Symptom | Check |
83
+ | --- | --- |
84
+ | `omp: command not found` | This is an OMP plugin. Install OMP first; there is no standalone CLI. |
85
+ | No models after `/antigravity-acp refresh` | Run `/antigravity-acp account` to confirm both sides are signed in, then retry with internet access. ACP can advertise fewer models than the Antigravity app. |
86
+ | Two Antigravity providers appear | Remove the older adapter (`antigravity-acp-omp`, the upstream Pi extension, or a duplicate npm install), then restart OMP. |
87
+ | Login opens the wrong Google account | Both login paths always start a fresh sign-in. Choose the intended account (or "Use another account") on Google's consent screen. |
88
+ | `disabled` native-tool mode rejects the session | The official runtime must advertise system-append support (1.4.1+). Upgrade the runtime or run `/antigravity-acp native-tools prefer`. |
89
+ | The first request is slow | Runtime download and cold ACP start happen once; later turns reuse the warm session. |
146
90
 
147
- If OMP's `enabledModels` whitelist is configured, add `antigravity-acp/*` alongside your existing entries in `~/.omp/agent/config.yml` to allow newly discovered models. Use individual `antigravity-acp/<server-model-id>` entries instead if you prefer a restricted list. The adapter does not rewrite that whitelist or any model-role preset.
91
+ ## Install: for agents
148
92
 
149
- After upgrading from an older adapter, run `/antigravity-acp refresh` once to replace the old cached list with per-model selector choices. Startup and ordinary catalog listing remain offline, so new server models appear after an explicit refresh. Availability in the Antigravity app or CLI does not guarantee availability through ACP: on the tested account, ACP still advertised only `gemini-4-argon` and `gemini-3.8-flash` on 2026-10-20.
93
+ The installation runbook is in [AGENT_INSTALL.md](AGENT_INSTALL.md). Hand that file to an agent with terminal access; it installs and verifies the adapter without starting an interactive login. For example: `Read AGENT_INSTALL.md and follow it.`
150
94
 
151
95
  ## Commands
152
96
 
153
97
  | Command | Purpose |
154
98
  | --- | --- |
155
- | `/antigravity-acp account` | Signed-in Google account and authentication state on both the OMP and Antigravity sides |
156
- | `/antigravity-acp login` | Run the Antigravity Google authorization in a command dialog |
157
- | `/antigravity-acp logout` | Clear Antigravity credentials, saved ACP sessions and OMP's marker record |
158
- | `/antigravity-acp status` | Runtime, confirmed thinking and usage information |
159
- | `/antigravity-acp usage` | Current ACP context occupancy, accounting source and cache-data availability |
160
- | `/antigravity-acp usage auto` | Enable supplemental usage queries |
161
- | `/antigravity-acp usage off` | Skip supplemental queries; preserve context occupancy updates |
162
- | `/antigravity-acp context` | Show saved settings and effective per-model budgets |
163
- | `/antigravity-acp context set default KEY NUMBER` | Set a default token or payload setting |
164
- | `/antigravity-acp context set MODEL KEY NUMBER` | Override one advertised model ID |
165
- | `/antigravity-acp cleanup` | Show cleanup mode/deadline and check eligible local sessions |
166
- | `/antigravity-acp cleanup off` | Disable automatic session-file deletion |
167
- | `/antigravity-acp cleanup conservative` | Delete confirmed replaced/disposable sessions only (default) |
168
- | `/antigravity-acp cleanup balanced [DAYS]` | Keep recovery copies for 1 day, expire unmapped data after 7 days, and set soft 50-session/512-MiB defaults |
169
- | `/antigravity-acp cleanup timeout DAYS` | Also delete inactive unmapped owned sessions after DAYS (default 7) |
170
- | `/antigravity-acp cleanup budget MAX_SESSIONS MAX_MIB` | Set soft session-count/size budgets; `0` disables each limit |
171
- | `/antigravity-acp diagnostics [on\|off\|reset]` | Show bounded timing samples, enable/disable collection, or clear samples (default off) |
172
- | `/antigravity-acp tools` | Available and omitted OMP tool schemas after a request |
173
- | `/antigravity-acp refresh` | Explicit network discovery and local catalog refresh |
174
- | `/antigravity-acp native-tools prefer` | Prefer OMP tools; retain native built-ins (default) |
175
- | `/antigravity-acp native-tools disabled` | Disable native built-ins for this adapter's ACP sessions |
176
- | `/antigravity-acp debug on` | Show ACP tool-status lines for debugging |
177
- | `/antigravity-acp debug off` | Hide ACP tool-status lines (default) |
178
- | `/antigravity-acp permissions default` | Prompting permission mode |
179
- | `/antigravity-acp permissions auto-edit` | Auto-edit mode |
180
- | `/antigravity-acp permissions yolo` | Upstream permissive mode |
181
-
182
- The initial permission mode follows upstream configuration, whose default is `yolo`. Native Antigravity tools have separate execution permissions from OMP tools.
183
-
184
- ### Sign out
185
-
186
- OMP's oauth contract has no provider-side logout hook, so `/logout` by itself only removes OMP's stored non-secret marker record. This adapter watches the credential store and finishes the Antigravity-side logout automatically: after `/logout` removes the marker, it closes this process's ACP runtimes, clears saved ACP session mappings, deletes the local token file and the settings auth choice, and removes the matching macOS keychain entry, then confirms with one line (`/antigravity-acp account` shows the details). The keychain removal waits for this adapter's ACP server processes to fully exit and verifies the deletion, because a dying server can flush its token back. The cleanup waits for in-flight Antigravity requests to finish, a re-login before it runs cancels it, and automatic credential soft-disables (for example an expired refresh grant) never trigger it. Set `OMP_ACP_FOLLOW_LOGOUT=0` before starting OMP to keep OMP's `/logout` marker-only. `/antigravity-acp logout` performs the same complete logout in one command without waiting for OMP; it refuses to run while Antigravity requests are active. If its OMP-marker removal is unavailable through the host API, the command says so and OMP's `/logout` finishes that part.
187
-
188
- The provider's non-secret config apiKey fallback is registered only until a logout is observed: removing the marker credential makes the adapter re-register without it in the same tick, so OMP's own logout report finds no remaining "provider config (fallback)" source and the model catalog hides until the next `/login`. Fresh profiles that never stored a marker keep the fallback so first-run model listing works; storing a marker again restores it.
189
-
190
- The debug switch controls gray `[Antigravity tool: …]` and `[Antigravity tool update: …]` lines. It defaults to off and applies immediately to this process's active ACP connections. Normal OMP tool displays/results, real thought chunks and plan messages are preserved. The option is saved as `debugToolUpdates` in `omp-tools.json` alongside `nativeTools`; toggling either option preserves the other. Existing policy files without the debug field default to off. Other OMP processes need a restart to read a setting changed elsewhere. `OMP_ACP_TRACE=1` is a separate, opt-in terminal diagnostic setting.
191
-
192
- ## OMP tool routing and native-tool mode
193
-
194
- By default, `prefer` mode sends the OMP-first instruction through `_meta.antigravity.systemPrompt.append` and preloads the `pi-bridge` tools with `eagerMcpServers`. These are official runtime extension fields on session new/load/resume, not model API requests. The adapter preserves conversation-level instructions as well. Prompt preference can still be ignored by a model; it does not enforce a tool allowlist.
195
-
196
- Eager loading supplies tool schemas up front, which can increase initial prompt size compared with lazy discovery.
197
-
198
- For strict native built-in filtering, run `/antigravity-acp native-tools disabled`. This sets `enabledTools: []` in the session extension while retaining the OMP MCP bridge. Run `/antigravity-acp native-tools prefer` to restore native tool availability. The command closes this process's ACP runtimes; the next request recreates/restores them with the selected policy. Switching back explicitly clears the saved server filter, including on restored sessions.
199
-
200
- The setting is stored separately in `~/.omp/agent/antigravity-acp-provider/omp-tools.json` as `{"nativeTools":"prefer"}` or `{"nativeTools":"disabled"}`. It applies to this adapter and does not configure other providers. Other already-running OMP processes need to restart to pick up a change. Native filtering does not remove separately configured global MCP servers and is not a filesystem sandbox. Unsupported or omitted OMP tool schemas remain unavailable; disabled mode cannot substitute native tools for them.
201
-
202
- Advanced routing requires the official `antigravity-acp` 1.x server, version 1.4.1 or newer, advertising system-append support in its agent capabilities. On an incompatible server, `prefer` falls back to the conversation-level prompt; `disabled` rejects session creation/restoration rather than silently allowing native tools. `/antigravity-acp status` shows the selected mode and whether active connections use system append or the legacy prompt channel. Live behavior has been verified on server 1.4.1.
203
-
204
- ## Data locations
205
-
206
- | Data | Location |
207
- | --- | --- |
208
- | Adapter configuration, catalog and session mappings | `~/.omp/agent/antigravity-acp-provider/` |
209
- | OMP-specific native-tool policy | `~/.omp/agent/antigravity-acp-provider/omp-tools.json` |
210
- | Official credentials/settings/history | Managed by Antigravity under its own storage/keychain |
211
- | Downloaded official runtime | `~/.local/opt/agy-acp/` |
212
- | Generated adapter bundle | `extension/runtime.mjs` |
213
-
214
- Never include those user data directories, OAuth callback URLs, account identifiers or downloaded runtime binaries in issues or commits. `OMP_ACP_TRACE=1` enables opt-in tool/selector diagnostics; review diagnostic output before sharing.
215
-
216
- ## Context continuity and local performance
217
-
218
- Each runtime also keeps bounded, value-validated system-message and tool-definition snapshots. Equivalent new containers reuse the existing canonical fingerprint/tool projection fingerprint; every selected field is still checked, including in-place schema edits and non-enumerable schema properties. Unsupported shapes fall back to the original algorithm. Each of the two caches holds one entry, capped at 32,768 value nodes, 131,072 primitive snapshot items and 2,097,152 UTF-16 code units in keys/string values; these are local snapshot limits, not model tokens or context limits. Tool execution closures are not retained, and runtime teardown clears the caches.
219
-
220
- Session mappings use asynchronous file I/O and nonblocking cross-process lock retries, with ordered read/merge/atomic-rename writes. Each request saves a versioned in-flight marker before dispatch and clears it only with an accepted terminal checkpoint. A failed checkpoint, unknown prompt failure or incomplete tool/permission fallback cannot be trusted as a warm restoration point. Legacy mappings without the marker are reconstructed once from retained OMP history; subsequent clean checkpoints remain resumable. Invalidated turns cannot repersist old mappings, and conditional removal preserves a newer replacement. Local preflight failures retain known-good warm sessions. Cancellation checkpoints are awaited before the turn releases its queue; shutdown waits for active checkpoint writes and rechecks dispatch eligibility afterward. Malformed JSON/non-array registries and I/O failures are reported rather than silently overwritten. Cleanup registry transactions, file scans and deletion also use asynchronous I/O; small command/configuration reads remain synchronous. This does not remove Google's cancellation-confirmation wait. See the [continuity invariants](docs/session-continuity.md), [Esc performance implementation and measurements](docs/esc-session-performance-research.md#production-implementation) and [resource-management notes](docs/resource-management.md).
221
-
222
- History comparisons reuse SHA-256 digests for unchanged large, simple messages. Every lookup validates the selected live fields against an independent snapshot, including nested tool arguments and in-place text edits; object identity alone never establishes a match. Small messages (below 2,048 characters per text/image/thinking string), complex payloads and unsupported objects use the original algorithm. The digest format and all checks after asynchronous work remain unchanged, so saved sessions stay compatible. Weak keys allow snapshots to be reclaimed when OMP drops old messages, including after compaction. This reduces local comparison work; it does not increase Google's cache-hit rate or guarantee faster model generation. See the [offline benchmarks and memory measurements](docs/history-comparison-research.md#production-integration).
223
-
224
- New user requests supersede an interrupted ACP turn, including pending tool calls and permission prompts. The adapter cancels old waits and sends official `session/cancel`, then waits up to the existing 1.5-second cancellation deadline for the old turn to settle. A confirmed cancellation (or a clean completion racing with cancellation) keeps the warm ACP session when the transport is alive and the retained OMP history matches. When the server replies that `session/cancel` is not implemented (verified against `agy_acp_server` 1.4.3: `-32601`), the adapter instead holds the caller's abort and waits for the old turn to end naturally, keeping the transport open, freezing `agent_message_chunk`/thought/tool/plan updates so retained partial output stays consistent, and checkpointing the same warm session once the turn ends. This steering grace is activity-aware: every update from the draining turn — thinking chunks, output or tool activity — extends the wait, so long thinking or tool loops do not expire it; only a silent gap beyond `OMP_ACP_STEER_GRACE_MS` (default 60 seconds, `0` restores the legacy immediate rebuild) or the absolute `OMP_ACP_STEER_GRACE_MAX_MS` cap (default 5 minutes, `0` = uncapped) falls back to cold reconstruction. The vendored progress watchdog (10 minutes silent / 60 minutes busy) remains the outer safety net. New prompts queue behind that drain and are sent as new requests, never silently treated as old tool-result continuations. Ordinary completed turns and genuine tool continuations also stay warm. Tool/permission continuations claim one owner before asynchronous work; overlapping duplicates receive an explicit error instead of stealing the response stream. Changed or missing completed assistant output forces reconstruction so the backend and OMP-visible histories agree.
225
-
226
- The cancellation checkpoint records the accepted message boundary and the partial assistant output fingerprint, including across idle shutdown/resume. If cancellation is unacknowledged, the process fails, the history is edited/compacted, or previously emitted partial output is missing or changed in OMP, the adapter reconstructs from retained history instead. Thus Esc does not always create a new ACP session, but reuse is conditional rather than guaranteed. Cancelled turns skip supplemental `/usage` queries while retaining any ACP context-occupancy update. History is explicitly separated from the current request after official ACP text conversion; cold tool handoffs resume from completed results rather than restarting prior actions. Preserving a session avoids unnecessary replay but does not guarantee a backend cache hit. See the [Flash cancellation/cache research and implementation checks](docs/cache-cancellation-research.md).
227
-
228
- Routing uses the provider request's `sessionId`, independently of shared prompt-cache keys and the UI transcript ID. OMP's provider-state close/release hooks cover `/fresh`, reset and side-request lifetimes; old deferred requests cannot dispatch after closure, and replacement requests wait for teardown. Duplicate/ambiguous mappings are rebuilt, and a fresh Google login clears previous-account mappings. Concurrent identical input snapshots are rejected instead of dispatched twice; the same text in a distinct later user turn remains valid. Only tool names, descriptions and schemas enter ACP history fingerprints, excluding mutable OMP host objects. See the [source review and transition coverage](docs/session-transition-audit-2026-10-30.md). Run `npm run test:omp-sessions` for an isolated offline integration with the installed OMP CLI and a fake ACP transport; it creates no Google sessions and performs no inference.
229
-
230
- The adapter transfers complete replay history within bounded budgets, including historical image attachments. It does not silently keep only a history tail. The official harness also has a per-step text conversion limit independent of its model window: the inspected configuration limits a step to 64,000 tokens and truncates oversized text to its first 192,000 UTF-8 bytes. A large cold replay after **Refine plan** can therefore lose the latest question at the tail even when the advertised model window has room. The adapter rejects rendered prompt text above 188,000 bytes before `session/prompt`, leaving 4,000 bytes for official wrapping/metadata. The context-overflow error lets OMP use its existing compaction/retry flow; OMP's adaptive summary windows can split oversized summary input too. If compaction is disabled or cannot reduce the request, use `/compact` or reduce the input before retrying. The adapter itself neither summarizes nor adds inference. See [step-limit behavior and offline validation](docs/plan-refinement-step-limit.md).
231
-
232
- Token budgets, wire payload size and the per-step text limit are independent. The default wire payload limit is 16 MiB, configurable up to 128 MiB; raising it or `contextWindow` does not bypass the per-step text guard. Image data additionally defaults to an 8 MiB decoded payload limit and is not counted as rendered text. The automatic input-token budget is `contextWindow - maxTokens - reserveTokens`, where reserve defaults to the smaller of 16,384 and 5% of the window. A lightweight Unicode-aware estimate checks serialized text plus approximately 4,096 tokens per image. This is not a Gemini tokenizer, cannot guarantee exact token counts and does not include every hidden server instruction.
233
-
234
- Persist settings in `~/.omp/agent/antigravity-acp-provider/context.json`, or use the commands below. Defaults apply to every ACP model; entries under `models` override one advertised model ID. Model limits are client metadata and transfer budgets: they do not expand Google's server window or set an unsupported ACP generation-output parameter.
235
-
236
- ```json
237
- {
238
- "defaults": {
239
- "contextWindow": 524288,
240
- "maxTokens": 32000,
241
- "reserveTokens": 16384,
242
- "maxTransferBytes": 16777216,
243
- "maxImageBytes": 8388608,
244
- "usageMode": "off"
245
- },
246
- "models": {}
247
- }
248
- ```
249
-
250
- Numeric keys: `contextWindow`, `maxTokens`, `reserveTokens`, `inputTokenBudget`, `maxTransferBytes`, `maxImageBytes`. Omit `inputTokenBudget` to calculate it automatically. A custom input budget must fit alongside output and reserve. Settings load once per process, without disk reads on every streamed chunk. Direct file edits require a restart; commands persist settings and refresh registration in the current process. Restart OMP or reselect the model to refresh displayed metadata. Other OMP processes must restart.
251
-
252
- ```text
253
- /antigravity-acp context
254
- /antigravity-acp context set default maxTransferBytes 33554432
255
- /antigravity-acp context set gemini-4-argon contextWindow 1000000
256
- /antigravity-acp usage off
257
- /antigravity-acp usage auto
258
- ```
259
-
260
- For OMP-managed automatic compaction, keep `compaction.enabled`, `compaction.midTurnEnabled` and `compaction.autoContinue` enabled with a working method such as `soft`. A provider-specific threshold can be set without changing other providers:
261
-
262
- ```sh
263
- omp config set compaction.modelThresholds '{"antigravity-acp/*":"85%"}'
264
- ```
265
-
266
- Merge that map with existing model-specific entries before running the command. At the example 524,288-token window, 85% triggers at 445,644 tokens, below the automatic transfer estimate budget of 475,904 tokens. OMP can also recover from local context/payload overflow errors. Google independently controls its internal agent summaries. Plugin installation does not automatically change OMP's global compaction configuration.
267
-
268
- Active sessions are reused. After five idle minutes, the adapter closes its ACP runtime, bridge and child processes; the next request tries to restore the saved server session. It also keeps at most two idle runtimes per OMP process by default, evicting the least recently used idle entry when necessary. Active streams, outstanding ACP prompts, tools and permission waits prevent eviction. Process eviction preserves mapped session files. No background model prewarming, quota polling or tokenizer model download is performed.
269
-
270
- ### Local ACP session cleanup
271
-
272
- Session-file deletion is separate from the five-minute idle process shutdown. Configure one of four modes:
273
-
274
- | Mode | Behavior |
275
- | --- | --- |
276
- | `off` | Keep session files, including replaced sessions. Ownership/lease bookkeeping remains enabled so cleanup can be enabled later. |
277
- | `conservative` (default) | Remove an old session after its OMP history is rebuilt (for example after `/compact`), a replacement successfully completes a turn, and all registered users of the old session have released it. Disposable model-discovery sessions and explicitly released one-shot side requests are also removed after their connection exits. Ordinary shutdown and idle eviction preserve resumable sessions. |
278
- | `balanced` | Keep unmapped replacement/one-shot copies for at least `recoveryDays` (default 1 day), including under quota pressure. Expire other unmapped owned data, and mapped conversations whose last activity exceeds `idleDays` (default 7 days), measured from the later of last use and first observation without a mapping. A reclaimed mapping is removed before its files, and the next turn rebuilds the conversation from OMP history. Above a soft budget, evict eligible unmapped data in activity order after the orphan grace (default 1 day). Active sessions, live leases, ambiguous mappings and OMP journals remain protected. |
279
- | `timeout` | Conservative cleanup plus removal of unmapped owned sessions whose last activity exceeds `idleDays`, or eligible unmapped sessions above a configured soft budget after the orphan grace period. Default 7 days; accepts fractional days (for example `0.5` for 12 hours), with a minimum of one hour and a maximum of 3650 days. Saved OMP mappings and live leases always override deletion. |
280
-
281
- ```text
282
- /antigravity-acp cleanup
283
- /antigravity-acp cleanup off
284
- /antigravity-acp cleanup conservative
285
- /antigravity-acp cleanup balanced
286
- /antigravity-acp cleanup timeout 7
287
- /antigravity-acp cleanup budget 50 512
288
- ```
289
-
290
- Settings persist in `~/.omp/agent/antigravity-acp-provider/cleanup.json`:
291
-
292
- ```json
293
- { "mode": "conservative", "idleDays": 7, "maxSessions": 0, "maxBytes": 0, "orphanGraceDays": 1, "batchSize": 8 }
294
- ```
295
-
296
- The optional budgets default to disabled (`0`); the command accepts MiB and saves bytes. `cleanup balanced` sets missing budgets to 50 sessions and 512 MiB, resets ordinary orphan retention to 7 days (or the supplied DAYS), and supplies a 1-day orphan grace and recovery window. Existing explicit budgets, including disabled (`0`) limits, are preserved. The default remains `conservative`; installing an update does not switch an existing policy.
297
-
298
- For example, the balanced preset without prior overrides saves:
299
-
300
- ```json
301
- { "mode": "balanced", "idleDays": 7, "maxSessions": 50, "maxBytes": 536870912, "orphanGraceDays": 1, "recoveryDays": 1 }
302
- ```
303
-
304
- Size accounting uses logical file sizes rather than allocated APFS space. In `off` and `conservative`, exceeding a budget only produces a status warning. In `timeout` and `balanced`, budget eviction uses least-recent activity among unmapped, unleased owned sessions after `orphanGraceDays` (default 1 day, range 1 hour–3650 days). Mapped and active sessions can keep usage above the budget. The balanced recovery window cannot be bypassed by either quota pressure or ordinary idle expiry; `recoveryDays` accepts 1 hour–3650 days. Explicitly deleted OMP journals retain their separate deletion-confirmation rules.
305
-
306
- Commands take effect immediately; direct file edits are read on the next cleanup check. Checks run when the cleanup service starts, after replacement/release, on the inspection command, and every 15 minutes while the service is running. Replacement/release persists bookkeeping before scheduling file cleanup in the background. Each batch removes at most `batchSize` sessions (default 8, range 1–100); eligible overflow schedules another batch after one second. OMP must be running for timed checks; the deadline is not an exact scheduled deletion time. No additional model requests, tokenizer downloads or background worker processes are used.
307
-
308
- Only sessions created and registered by this adapter version onward are eligible. Pre-existing/unidentified ACP sessions are preserved. All cleanup modes protect IDs in saved `sessions.json` mappings. The registry is separated by the resolved ACP storage root, and tracks both OMP and ACP supervisor PIDs across participating processes. Resume/load acquires a lease before replay; the cross-process lease lock remains held during asynchronous deletion. Busy/corrupt registries, malformed mappings and unsafe paths defer deletion. Failed lifecycle updates remain in a bounded in-memory retry queue (1024 entries) until the next successful transaction; a process crash can lose queued intentions, so deletion is never guaranteed. The status shows mapped/unmapped/active counts, logical bytes, bytes reclaimed in the latest batch, copies retained for recovery, deferred work, failures and pending updates. Restart older OMP instances when upgrading: clients that do not implement these leases, or external clients manually opening the same session, are outside this coordination mechanism.
309
-
310
- OMP explicitly releases routing IDs for final one-shot side requests. After runtime teardown, the adapter persists a disposable marker and conditionally removes only that request's matching owned mapping; newer, duplicated or shared mappings are preserved. A reused routing ID waits for this cleanup before dispatch. This also works after idle runtime eviction. If a process exits between marking and unmapping, later collection repairs the interruption; restoration refuses a finally released ACP ID. Generic provider close, process shutdown, switching sessions, and reusable side conversations do not mark their mappings disposable. Balanced mode retains the released ACP files as a temporary recovery copy; it does not add them to OMP history or expose a recovery UI.
99
+ | `/antigravity-acp status` | Runtime, thinking and usage information |
100
+ | `/antigravity-acp account` | Signed-in account and authentication state |
101
+ | `/antigravity-acp login` | Re-run the Google authorization |
102
+ | `/antigravity-acp logout` | Clear Antigravity credentials and saved sessions |
103
+ | `/antigravity-acp refresh` | Discover and cache advertised models |
104
+ | `/antigravity-acp usage [auto\|off]` | Context occupancy and supplemental usage queries |
105
+ | `/antigravity-acp context` | Per-model context budgets |
106
+ | `/antigravity-acp cleanup [mode]` | Session-file cleanup policy |
107
+ | `/antigravity-acp native-tools prefer\|disabled` | Native built-in tool policy |
108
+ | `/antigravity-acp tools` | Available and omitted OMP tool schemas |
109
+ | `/antigravity-acp debug on\|off` | ACP tool-status lines |
110
+ | `/antigravity-acp permissions default\|auto-edit\|yolo` | Permission mode |
311
111
 
312
- Cleanup targets only the registered UUID's `.db`, SQLite journal/WAL/SHM files, `.meta`, and `brain/<UUID>` directory under the ACP storage root (normally `~/.gemini/antigravity-acp/`; respects `GEMINI_HOME`). Symlinked targets are preserved. Credentials, global settings, shared artifacts, workspace files and OMP's own conversation history are untouched. Local deletion is permanent and does not request deletion of Google's server-side logs. The current official ACP runtime does not advertise session deletion, so this uses the inspected local layout rather than an unsupported RPC.
112
+ ## Steering and queued messages
313
113
 
314
- Timeout and balanced cleanup sacrifice ACP-only reasoning/checkpoint state for eligible unmapped sessions. If that session is later requested through another history source, the adapter reconstructs it from OMP's retained history and can incur replay latency and a different token count. Cache expiry is not assumed or guaranteed. Ordinary mapped conversations remain resumable in every mode; budgets cannot bound the number of mapped OMP conversations you keep.
315
-
316
- ### Deleting an OMP conversation
317
-
318
- Version 0.1.20 can reconcile deleted OMP journal files with their ACP mappings. On `session_start`, `session_switch` and `agent_end`, it records the file path only after reading a matching OMP session header and finding an adapter-owned ACP mapping. It supports the managed `sessions/` root beside the provider state directory, including named profiles. Custom/external storage and old mappings without a verified source remain protected until supported or observed again; merely installing the build does not identify every old mapping.
319
-
320
- With `conservative` or `timeout`, a tracked source must be absent on two cleanup checks at least 60 seconds apart, have no live ACP leases, and remain absent after a bounded search of the managed journal buckets for the same header ID. Moving/renaming a journal within those buckets updates its path. Missing/replaced storage roots, symlinks, malformed headers, permission errors and scan limits preserve data. Only then does cleanup conditionally remove the matching mapping and make the owned ACP session eligible for the existing deletion batches. Newer mappings are protected by the mapping store's lock. Turning cleanup `off` preserves both mapping and files.
321
-
322
- This is eventual reconciliation, not a synchronous OMP delete callback. OMP must be running; periodic checks are 15 minutes apart, so idle detection commonly needs two checks (up to roughly 30 minutes after deletion). The cleanup command can trigger checks manually, but cannot bypass the one-minute confirmation interval or live leases. Closing, switching or archiving a conversation leaves its journal intact and does not request deletion. There are no model calls or continuous transcript watchers. Normal checks inspect tracked paths; relocation scans run only for missing sources and are shared within one sweep, bounded to 20,000 entries, four directory levels and 64 KiB per journal prefix.
323
-
324
- ### Optional timing diagnostics
325
-
326
- Use `/antigravity-acp diagnostics on`, then `/antigravity-acp diagnostics` to inspect timings for history/tool comparisons, session initialization/restoration, checkpoint writes, prompt/first-output and cancellation confirmation. `/antigravity-acp diagnostics reset` clears samples; `off` disables collection and clears them. This is separate from the tool-status debug switch.
327
-
328
- Collection defaults to off and retains at most 128 samples in memory. Only the enabled flag persists in `diagnostics.json`; samples contain stage names and durations, without request content, account identifiers or session IDs. It sends no model/usage requests. Prompt timings include Google processing and tools, and are not a measure of local comparison cost alone.
329
-
330
- Optional environment settings, applied when OMP starts:
331
-
332
- | Setting | Default | Effect |
333
- | --- | --- | --- |
334
- | `OMP_ACP_HISTORY_BYTES` | context.json or 16 MiB | Optional byte-limit override, 64 KiB–128 MiB; independent of token window |
335
- | `OMP_ACP_IDLE_TIMEOUT_MS` | `300000` | Idle runtime reclamation; `0` disables it, otherwise `1000`–`2147483647` (Node timer range) |
336
- | `OMP_ACP_MAX_IDLE_RUNTIMES` | `2` | Per-process idle runtime LRU limit; `0` disables the limit. Busy/leased runtimes remain protected |
337
- | `OMP_ACP_USAGE` | context.json or auto | `off` forces supplemental queries off, including when the saved option is auto |
338
- | `OMP_ACP_STEER_GRACE_MS` | `60000` | Steering grace when `session/cancel` is unimplemented: max silent gap while waiting for the old turn, `0`–`600000`; `0` rebuilds immediately |
339
- | `OMP_ACP_STEER_GRACE_MAX_MS` | `300000` | Absolute cap on one steering wait however active the turn; `0` = uncapped, otherwise `100`–`3600000` |
340
-
341
- When automatic usage is enabled and `/usage` is advertised by the official server, the adapter queries it after each completed ACP prompt and computes a difference from the previous cumulative snapshot. A restored session first establishes a baseline so its old tokens are not charged again. These are main-agent totals and can include multiple internal model calls. Thinking tokens count toward estimated output cost. Queries are bounded by a five-second deadline; unavailable/malformed usage or a counter reset does not turn a successful model answer into a billing claim. Native ACP response usage takes priority when supplied. Query failures can cancel/retire the connection; subsequent work can restore the server session.
342
-
343
- Supplemental queries default to `auto` for compatibility; the example above opts out. Use `/antigravity-acp usage off` to reduce the delay between the last text chunk and OMP regaining control, or `auto` to retain available token/cache/cost estimates. In a Flash Low test with three turns per mode, that final delay had a median of **282 ms with auto vs 21 ms with off** (261 ms less). Individual queries took 241–580 ms. This small sample does not establish a universal speedup, and total response time also varies with inference. Turning queries off preserves ACP context-occupancy updates used by OMP compaction; missing accounting data stays unavailable.
344
-
345
- ACP `usage_update.used` is passed to OMP separately as `usage.contextTokens`, rather than treating aggregate billable consumption as context occupancy. OMP 18.12.3 recognizes this field; it can still use a local stored-history estimate when deciding whether to compact. Google continues to control its own internal summaries.
346
-
347
- Stable tool ordering and stable context-resource identifiers avoid unnecessary client-side prefix changes. They do not guarantee implicit cache hits. `/antigravity-acp usage` marks cache information as `unknown` when Google omits it; zero cache fields in OMP's numeric usage structure must not be read as proof of zero backend caching. If cache counts are missing, the API-equivalent estimate prices input as uncached and cannot reflect any unreported cache discount. This is not a subscription bill or a measurement of quota deduction.
348
-
349
- See the [0.1.8 context/compaction and usage benchmark](docs/context-compaction-0.1.8.md) for current settings and measurements. The [0.1.7 report](docs/continuity-performance-0.1.7.md) documents the previous implementation.
350
-
351
- ## Limitations
352
-
353
- - Argon/Flash default to client metadata of 1,000,000 context tokens and 65,536 output tokens. These can be overridden in context.json. Other models use conservative defaults of 32,768 context tokens and 8,192 output tokens because the model selector does not supply these limits. These are client metadata, not verified server limits or controls over Antigravity's internal compaction.
354
- - API background execution and long decode controls are not exposed.
355
- - The bridge advertises text and image input, not the full Gemini API media surface.
356
- - Thought summaries appear only if the ACP server emits them. A verified Argon High request returned no `agent_thought_chunk`; plan progress and optional debug tool-status lines can appear in OMP's thinking area.
357
- - Cached-token usage appears only when ACP reports it. Missing counts are not proof that backend caching was disabled.
358
- - The prompt inactivity watchdog is 10 minutes without progress, or 60 minutes while tools/permissions are outstanding.
359
- - Argon estimates use the undiscounted list price: $4 input, $20 output and $0.20 cached input per million tokens. Flash estimates use the announced date-dependent rates. These are snapshots, not live pricing discovery.
360
- - Other models have no configured API price yet. Their zero cost fields are placeholders for unavailable estimates and do not mean free usage.
361
- - Not every OMP tool schema is bridge-compatible. Inspect `tools` after a request.
362
- - Antigravity still manages its own native tools and checkpoint summaries.
363
-
364
- ## Development and verification
365
-
366
- `npm test` runs offline regression tests for all-vendor catalogs, per-model thinking choices, selector routing, session ownership, restart-after-shutdown, asynchronous teardown and price calculations. It performs no model inference and consumes no account quota.
367
-
368
- `npm run test:omp-compaction` additionally requires `OMP_ACP_TEST_OMP_SOURCE` pointing to an OMP source checkout with built dependencies. An optional `OMP_ACP_TEST_NATIVE_ADDON` can point to an installed OMP native addon when the checkout has no built addon. It runs OMP's real adaptive summary-window algorithm with synthetic completions, verifies that all history windows are visited, and checks that a compacted plan refinement retains the newest question. It performs no inference and does not modify the OMP checkout.
369
-
370
- `npm run test:usage` uses Bun and mocked protocol responses to verify restored-session baselines, counter resets, query failures and advertised-command gating without starting ACP. `bun scripts/verify-continuity-live.ts --live` is a separate Flash-only probe of long history, synthetic tools, usage accounting and idle process reclamation/restoration; it consumes quota. Its one-second idle setting is isolated to the test process and is not the production default.
371
-
372
- `npm run test:auth` uses Bun with an isolated `GEMINI_HOME`, a stubbed keychain and a stubbed OAuth flow to verify the account view (including Google-account email extraction from the stored id_token), login dialog mapping, logout cleanup, the active-request guard and the credential-store watch behind OMP-logout following (removal, automatic-disable suppression, re-login cancellation, opt-out and busy deferral) without starting ACP. Real Google login and logout change account state, so they are not part of any automated test.
373
-
374
- `npm run test:packed` additionally requires OMP on PATH. It installs the exact npm tarball into a temporary consumer directory with development dependencies omitted and install scripts disabled, checks the standalone assets and supervisor, verifies there are no production dependencies, measures package size, and loads its model catalog with ACP execution disabled. It removes the temporary installation afterward.
375
-
376
- `npm run test:marketplace` exercises catalog discovery, installation, automatic provider loading, offline cache reuse and uninstallation in a temporary named OMP profile. It downloads the published adapter and cleans the entire test profile afterward. Add `-- --remote` after publishing catalog changes to test the GitHub source instead of the local working tree. No model inference is performed.
377
-
378
- `bun scripts/verify-session-routing-live.ts --live` tests synthetic read/edit/command tool round trips, cold ACP session restoration, model changes, and both directions of native-tool mode switching. It consumes quota and creates server history, but does not execute real commands or edit workspace files. Temporary client session mappings are removed afterward.
379
-
380
- `npm run test:commands` requires Bun and exercises command persistence and validation offline with an explicitly isolated state directory. The 0.1.4 live routing check passed both `prefer → disabled` and `disabled → prefer` on cold session resume, including an Argon-to-Flash model change; all observed task tools were `pi_read`, `pi_edit` and `pi_bash`.
381
-
382
- `bun scripts/verify-debug-live.ts --live` explicitly tests default-off, on and off again on the same ACP session, using an isolated policy and a synthetic read tool. It checks that tool calls/results and a clearly marked synthetic thought event still reach OMP while debug status visibility follows the switch. It consumes quota and creates server history.
383
-
384
- For an explicit live check of outgoing tool-priority instructions, incoming thought events and a synthetic OMP tool round trip, use `bun scripts/diagnose-observability.ts --live --installed` from this source checkout. It consumes quota and creates ACP sessions. See the [2026-10-20 verification report](docs/observability-check-2026-10-20.md), including the corrected diagnosis of an isolated prompt-precedence test.
385
-
386
- Before publishing, verify local OMP loading without allowing ACP to start:
387
-
388
- ```sh
389
- AGY_ACP_BIN=/usr/bin/false omp models antigravity-acp --no-extensions -e ./extension/index.ts --json
390
- ```
114
+ By default a new user message waits for the active ACP turn to finish (`OMP_ACP_STEER_MODE=queue`) and then continues on the warm session, avoiding a full replay and OMP auto-compaction. Set `OMP_ACP_STEER_MODE=steer` to restore immediate interruption. At tool/permission boundaries the adapter falls back to steer and waits for the ACP terminal response; `OMP_ACP_STEER_GRACE_MS` (default 60000) and `OMP_ACP_STEER_GRACE_MAX_MS` (default 300000) bound that wait.
391
115
 
392
- With no local model cache, upstream's conservative fallback may list fewer models. Listing a model is not proof of account entitlement or successful inference.
116
+ Inference and `/antigravity-acp refresh` refuse to start ACP when no local Google login is available; run `/login` (or `/antigravity-acp login`) first instead of waiting for an interactive consent flow inside `session/new`.
393
117
 
394
- The original local implementation also passed live Argon/Flash inference, effort-selector and OMP tool round-trip checks. The planning lifecycle fix passed a live Argon Medium request, session shutdown and a subsequent request with conversation history. Those tests do not cover every platform or the complete interactive Refine plan UI.
118
+ Detailed behavior, advanced settings and limitations: [docs/](docs/) and [CHANGELOG.md](CHANGELOG.md).
395
119
 
396
- The generic catalog implementation passed a live refresh and Argon Low/High inference. Claude, GPT-OSS and future IDs are covered by offline catalog/selector fixtures; live inference for those models remains unverified until the ACP server advertises them.
120
+ ## License
397
121
 
398
122
  MIT. See [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). Upstream source is vendored under `extension/vendor/pi-antigravity-acp-provider` (MIT) and kept with attribution. Official Google executables and their licenses are separate.
@@ -25,6 +25,7 @@ export class CatalogStore {
25
25
  private readonly cleanup: SessionCleanup,
26
26
  private readonly prepareRuntime: () => Promise<void>,
27
27
  private readonly fallbackModels: () => PublicCatalogModel[],
28
+ private readonly requireAuth: () => Promise<void> = async () => {},
28
29
  ) {}
29
30
 
30
31
  projectWithSettings(models: PublicCatalogModel[], settings: ContextSettings): ConfiguredCatalogModel[] {
@@ -108,6 +109,7 @@ export class CatalogStore {
108
109
  finally { if (this.discovery === pending) this.discovery = undefined; }
109
110
  }
110
111
  private async discoverOnce(): Promise<AdvertisedModel[]> {
112
+ await this.requireAuth();
111
113
  await this.prepareRuntime();
112
114
  const connection = new TierConnection({ cwd: process.cwd(), ompCleanup: this.cleanup });
113
115
  let discoveredSession: string | undefined;
@@ -70,6 +70,18 @@ export function currentSystemInstructions(context: TransferContext): string {
70
70
  return prompt;
71
71
  }
72
72
 
73
+ const DATE_CWD_REMINDER = /^(?:<system-reminder>\s*)?Today: [^\n]*?Do not repeat this information in your reply\.(?:\s*<\/system-reminder>)?\s*$/gmu;
74
+
75
+ // OMP injects a date/cwd reminder around turns. Its metadata changes without
76
+ // changing policy, so it must not force a full ACP replay (and possible
77
+ // compaction) in the middle of an active tool continuation.
78
+ export function stableSystemInstructions(context: TransferContext): string {
79
+ return currentSystemInstructions(context)
80
+ .replace(DATE_CWD_REMINDER, "")
81
+ .replace(/\n{3,}/g, "\n\n")
82
+ .trim();
83
+ }
84
+
73
85
  export function historyBudget(_contextWindow = 32_768, env = process.env, configured = 16_777_216): number {
74
86
  const bytes = Number(env.OMP_ACP_HISTORY_BYTES ?? configured);
75
87
  if (!Number.isSafeInteger(bytes) || bytes < 65_536 || bytes > 134_217_728) {
@@ -78,8 +90,20 @@ export function historyBudget(_contextWindow = 32_768, env = process.env, config
78
90
  return bytes;
79
91
  }
80
92
 
93
+ // OMP /retry drops the generated answer from its branch and resends the same
94
+ // context. The warm ACP session already holds the request, so regeneration is
95
+ // requested explicitly instead of replaying history into a cold session.
96
+ function retryRequestText(content: string | TransferBlock[]): string {
97
+ const restate = typeof content === "string" ? content.trim()
98
+ : content.filter(block => block.type === "text").map(block => block.text ?? "").join("\n\n").trim();
99
+ return "\n\n# OMP retry request\n\n" +
100
+ "The user discarded the previous response to the current user request. " +
101
+ "Produce a completely new answer for it. Do not continue, quote or repeat the discarded response." +
102
+ (restate ? `\n\n# Original request\n\n${restate}` : "");
103
+ }
104
+
81
105
  export function buildPromptParts(context: TransferContext, fresh: boolean, unseenStart?: number,
82
- limits: { contextWindow?: number; maxTokens?: number; policy?: ContextOptions } = {}) {
106
+ limits: { contextWindow?: number; maxTokens?: number; policy?: ContextOptions } = {}, retryResend = false) {
83
107
  // The runtime hot path always passes a fully resolved ompContextPolicy
84
108
  // (see scripts/build.mjs); re-resolution is only needed for partial input.
85
109
  const policy = limits.policy;
@@ -138,7 +162,8 @@ export function buildPromptParts(context: TransferContext, fresh: boolean, unsee
138
162
  for (const block of images) prompt.push(block);
139
163
  const tailBlocks: TransferBlock[] = [];
140
164
  if (!fresh && start > latest) {
141
- const continuation = { type: "text", text: "\n\n# Continue the active OMP request\n\n" +
165
+ const continuation = { type: "text", text: retryResend ? retryRequestText(messages[latest]!.content) :
166
+ "\n\n# Continue the active OMP request\n\n" +
142
167
  "The new context/tool results above belong to the user request already received in this session. " +
143
168
  "Finish that request from those results. Do not answer historical user requests or repeat completed tool actions." };
144
169
  prompt.push(continuation);
@@ -18,6 +18,7 @@ import {
18
18
  MARKER,
19
19
  OmpAuthCoordinator,
20
20
  antigravityAccountEmail,
21
+ authReady,
21
22
  keychain,
22
23
  logoutFollow,
23
24
  type OmpCommandContext,
@@ -99,6 +100,14 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
99
100
  return readiness;
100
101
  }
101
102
 
103
+ // Inference and model discovery must not let the ACP server open an
104
+ // interactive Google consent flow at session/new. A missing local login is a
105
+ // user action, not a reason to leave the submitted message pending.
106
+ async function requireAcpAuth(): Promise<void> {
107
+ if (await authReady()) return;
108
+ throw new Error("Antigravity ACP is not signed in. Run /login (or /antigravity-acp login) before sending a message.");
109
+ }
110
+
102
111
  const connections = new Set<TierConnection>();
103
112
  const idleTimeoutMs = Number(process.env.OMP_ACP_IDLE_TIMEOUT_MS ?? 300_000);
104
113
  if (!Number.isSafeInteger(idleTimeoutMs) || idleTimeoutMs < 0 || idleTimeoutMs > 2_147_483_647 || (idleTimeoutMs > 0 && idleTimeoutMs < 1000)) {
@@ -218,6 +227,7 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
218
227
  cleanup,
219
228
  prepareRuntime,
220
229
  () => [...(FALLBACK_MODELS as PublicCatalogModel[])],
230
+ requireAcpAuth,
221
231
  );
222
232
  let initialModels = catalogStore.loadInitialOrCached(contextSettings);
223
233
 
@@ -321,6 +331,7 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
321
331
  try {
322
332
  if (options?.signal?.aborted) throw new Error("ACP request cancelled before startup");
323
333
  await lifecycle.ready(ticket);
334
+ await requireAcpAuth();
324
335
  await diagnostics.measure("runtime.prepare", prepareRuntime);
325
336
  if (options?.signal?.aborted) throw new Error("ACP request cancelled during startup");
326
337
  if (!catalogStore.upstreamModels.has(model.id)) await catalogStore.refresh(contextSettings);
@@ -19259,6 +19259,16 @@ async function claimContinuation(binding, work, invalidate) {
19259
19259
  }
19260
19260
 
19261
19261
  // extension/turn-cancellation.ts
19262
+ function steerMode(env2 = process.env) {
19263
+ const value = env2.OMP_ACP_STEER_MODE?.trim().toLowerCase();
19264
+ if (!value || value === "queue") return "queue";
19265
+ if (value === "steer") return "steer";
19266
+ throw new Error("OMP_ACP_STEER_MODE must be steer or queue");
19267
+ }
19268
+ function isSteerAbort(signal) {
19269
+ const reason = signal.reason;
19270
+ return reason === void 0 || reason instanceof Error && reason.name === "AbortError";
19271
+ }
19262
19272
  function steerTimings(env2 = process.env) {
19263
19273
  const idleMs = Number(env2.OMP_ACP_STEER_GRACE_MS ?? 6e4);
19264
19274
  if (!Number.isSafeInteger(idleMs) || idleMs < 0 || idleMs > 6e5) {
@@ -19305,12 +19315,12 @@ function armSteerGiveup(source, sessionId, timings, fire) {
19305
19315
  detach?.();
19306
19316
  } };
19307
19317
  }
19308
- function deferredAbortSignal(signal, timings, activity) {
19318
+ function deferredAbortSignal(signal, timings, activity, holdOnAbort) {
19309
19319
  if (!(timings.idleMs > 0)) return { signal, dispose: () => void 0 };
19310
19320
  const controller = new AbortController();
19311
19321
  let giveup;
19312
19322
  const onAbort = () => {
19313
- if (giveup) return;
19323
+ if (giveup || holdOnAbort?.()) return;
19314
19324
  giveup = armSteerGiveup(activity?.source, activity?.sessionId, timings, () => controller.abort(signal.reason));
19315
19325
  };
19316
19326
  signal.addEventListener("abort", onAbort, { once: true });
@@ -19330,25 +19340,29 @@ async function drainCancelledTurn(binding, abort, signal, timeoutMs = 1500, timi
19330
19340
  const cancelled = () => deadline.resolve(false);
19331
19341
  let timer = setTimeout(cancelled, timeoutMs);
19332
19342
  let giveup;
19343
+ let finished = false;
19333
19344
  signal?.addEventListener("abort", cancelled, { once: true });
19334
19345
  const extendForNaturalCompletion = () => {
19346
+ if (finished || giveup) return;
19335
19347
  binding.connection.muteSteerChunks?.(binding.session.sessionId);
19336
19348
  clearTimeout(timer);
19337
19349
  giveup = armSteerGiveup(binding.connection, binding.session.sessionId, timings, cancelled);
19338
19350
  };
19339
19351
  try {
19340
19352
  abort();
19341
- try {
19342
- void binding.connection.cancel(binding.session.sessionId).catch((error62) => {
19353
+ void (async () => {
19354
+ try {
19355
+ await binding.connection.cancel(binding.session.sessionId);
19356
+ if (timings.idleMs > 0) extendForNaturalCompletion();
19357
+ else deadline.resolve(false);
19358
+ } catch (error62) {
19343
19359
  if (timings.idleMs > 0 && isCancelUnsupported(error62)) extendForNaturalCompletion();
19344
19360
  else deadline.resolve(false);
19345
- });
19346
- } catch (error62) {
19347
- if (timings.idleMs > 0 && isCancelUnsupported(error62)) extendForNaturalCompletion();
19348
- else return false;
19349
- }
19361
+ }
19362
+ })();
19350
19363
  return await Promise.race([completion.then(() => true, () => false), deadline.promise]);
19351
19364
  } finally {
19365
+ finished = true;
19352
19366
  giveup?.dispose();
19353
19367
  clearTimeout(timer);
19354
19368
  signal?.removeEventListener("abort", cancelled);
@@ -44471,7 +44485,8 @@ function classifyError(error62) {
44471
44485
  }
44472
44486
  function structuredErrorDetail(data) {
44473
44487
  if (!data || typeof data !== "object") return void 0;
44474
- const detail = data.details;
44488
+ const record3 = data;
44489
+ const detail = record3.details ?? record3.message;
44475
44490
  return typeof detail === "string" && detail.trim() ? redact(detail.trim()) : void 0;
44476
44491
  }
44477
44492
 
@@ -59477,6 +59492,10 @@ function currentSystemInstructions(context) {
59477
59492
  if (Buffer.byteLength(prompt, "utf8") > 134217728) throw new Error("OMP system instructions exceed the 128 MiB hard transfer ceiling; reduce them rather than truncating instructions");
59478
59493
  return prompt;
59479
59494
  }
59495
+ var DATE_CWD_REMINDER = /^(?:<system-reminder>\s*)?Today: [^\n]*?Do not repeat this information in your reply\.(?:\s*<\/system-reminder>)?\s*$/gmu;
59496
+ function stableSystemInstructions(context) {
59497
+ return currentSystemInstructions(context).replace(DATE_CWD_REMINDER, "").replace(/\n{3,}/g, "\n\n").trim();
59498
+ }
59480
59499
  function historyBudget(_contextWindow = 32768, env2 = process.env, configured = 16777216) {
59481
59500
  const bytes = Number(env2.OMP_ACP_HISTORY_BYTES ?? configured);
59482
59501
  if (!Number.isSafeInteger(bytes) || bytes < 65536 || bytes > 134217728) {
@@ -59484,7 +59503,15 @@ function historyBudget(_contextWindow = 32768, env2 = process.env, configured =
59484
59503
  }
59485
59504
  return bytes;
59486
59505
  }
59487
- function buildPromptParts(context, fresh, unseenStart, limits = {}) {
59506
+ function retryRequestText(content) {
59507
+ const restate = typeof content === "string" ? content.trim() : content.filter((block) => block.type === "text").map((block) => block.text ?? "").join("\n\n").trim();
59508
+ return "\n\n# OMP retry request\n\nThe user discarded the previous response to the current user request. Produce a completely new answer for it. Do not continue, quote or repeat the discarded response." + (restate ? `
59509
+
59510
+ # Original request
59511
+
59512
+ ${restate}` : "");
59513
+ }
59514
+ function buildPromptParts(context, fresh, unseenStart, limits = {}, retryResend = false) {
59488
59515
  const policy = limits.policy;
59489
59516
  const options = policy && typeof policy.inputTokenBudget === "number" && typeof policy.maxTransferBytes === "number" && typeof policy.maxImageBytes === "number" ? policy : resolveContextOptions(
59490
59517
  { id: "transfer", contextWindow: limits.contextWindow ?? 32768, maxTokens: limits.maxTokens ?? 8192 },
@@ -59537,7 +59564,7 @@ ${instructions}` : "";
59537
59564
  for (const block of images) prompt.push(block);
59538
59565
  const tailBlocks = [];
59539
59566
  if (!fresh && start > latest) {
59540
- const continuation = { type: "text", text: "\n\n# Continue the active OMP request\n\nThe new context/tool results above belong to the user request already received in this session. Finish that request from those results. Do not answer historical user requests or repeat completed tool actions." };
59567
+ const continuation = { type: "text", text: retryResend ? retryRequestText(messages[latest].content) : "\n\n# Continue the active OMP request\n\nThe new context/tool results above belong to the user request already received in this session. Finish that request from those results. Do not answer historical user requests or repeat completed tool actions." };
59541
59568
  prompt.push(continuation);
59542
59569
  tailBlocks.push(continuation);
59543
59570
  } else {
@@ -60092,19 +60119,34 @@ var AntigravityRuntime = class {
60092
60119
  let binding = await this.getBinding(key, model, acpModelId, options.apiKey, writer, tools, options.signal);
60093
60120
  await this.modeChanges;
60094
60121
  this.assertEpoch(epoch);
60095
- if (binding.cwd !== process.cwd() || binding.turnCompletion && binding.modelId !== acpModelId || binding.mode !== this.permissionMode || this.confirmedMode(binding) !== this.permissionMode || binding.toolFingerprint !== this.ompToolsFingerprint(tools)) {
60122
+ const ompContinuation = Boolean(binding.turnCompletion) && (binding.permission !== void 0 || binding.pendingTools.size > 0);
60123
+ if (binding.cwd !== process.cwd() || binding.turnCompletion && binding.modelId !== acpModelId || binding.mode !== this.permissionMode || this.confirmedMode(binding) !== this.permissionMode || !ompContinuation && binding.toolFingerprint !== this.ompToolsFingerprint(tools)) {
60096
60124
  await this.invalidateBinding(binding);
60097
60125
  binding = await this.getBinding(key, model, acpModelId, options.apiKey, writer, tools, options.signal);
60098
60126
  }
60099
60127
  if (binding.turnCompletion || binding.permission || binding.pendingTools.size > 0) {
60100
- let ompPrefixFingerprint;
60101
- if (context.messages.findLastIndex((message) => message.role === "user") >= binding.pendingContextCount || (ompPrefixFingerprint = this.ompMessagesFingerprint(context.messages.slice(0, binding.pendingContextCount))) !== binding.pendingContextFingerprint) {
60102
- const prefixMatches = context.messages.length >= binding.pendingContextCount && (ompPrefixFingerprint ?? this.ompMessagesFingerprint(context.messages.slice(0, binding.pendingContextCount))) === binding.pendingContextFingerprint;
60103
- const drained = prefixMatches && await drainCancelledTurn(binding, () => abortTurn(binding), options.signal);
60104
- if (!drained || !binding.connection.process.alive || binding.needsReconstruction || !["cancelled", "end_turn", "max_turn_requests", "max_tokens"].includes(binding.ompTerminalStopReason)) {
60105
- await this.invalidateBinding(binding);
60128
+ const ompPrefixMessages = context.messages.slice(0, binding.pendingContextCount);
60129
+ const ompPrefixFingerprint = this.ompMessagesFingerprint(ompPrefixMessages);
60130
+ const ompConversationPrefixFingerprint = this.ompMessagesFingerprint(ompPrefixMessages.filter((message) => message.role !== "system"));
60131
+ const ompNewUser = context.messages.findLastIndex((message) => message.role === "user") >= binding.pendingContextCount;
60132
+ const ompPrefixChanged = ompPrefixFingerprint !== binding.pendingContextFingerprint;
60133
+ const ompConversationPrefixChanged = binding.pendingConversationFingerprint === void 0 ? ompPrefixChanged : ompConversationPrefixFingerprint !== binding.pendingConversationFingerprint;
60134
+ if (ompNewUser || ompConversationPrefixChanged) {
60135
+ const prefixMatches = context.messages.length >= binding.pendingContextCount && (!ompPrefixChanged || binding.pendingConversationFingerprint !== void 0 && ompConversationPrefixFingerprint === binding.pendingConversationFingerprint);
60136
+ const ompQueueSteer = prefixMatches && steerMode() === "queue" && Boolean(binding.turnCompletion) && !binding.permission && binding.pendingTools.size === 0;
60137
+ if (ompQueueSteer) {
60138
+ binding.connection.muteSteerChunks?.(binding.session.sessionId);
60139
+ } else {
60140
+ const drained = prefixMatches && await drainCancelledTurn(binding, () => abortTurn(binding), options.signal);
60141
+ if (!drained || !binding.connection.process.alive || binding.needsReconstruction || !["cancelled", "end_turn", "max_turn_requests", "max_tokens"].includes(binding.ompTerminalStopReason)) {
60142
+ await this.invalidateBinding(binding);
60143
+ }
60144
+ if (drained && prefixMatches) {
60145
+ binding.toolFingerprint = this.ompToolsFingerprint(tools);
60146
+ binding.historyFingerprint = this.ompMessagesFingerprint(context.messages.slice(0, binding.messageCount));
60147
+ }
60148
+ binding = await this.getBinding(key, model, acpModelId, options.apiKey, writer, tools, options.signal);
60106
60149
  }
60107
- binding = await this.getBinding(key, model, acpModelId, options.apiKey, writer, tools, options.signal);
60108
60150
  }
60109
60151
  }
60110
60152
  if (binding.turnCompletion && !binding.abortRequested && context.messages.length === binding.pendingContextCount && this.ompMessagesFingerprint(context.messages) === binding.pendingContextFingerprint) {
@@ -60125,6 +60167,7 @@ var AntigravityRuntime = class {
60125
60167
  if (!continuationTurn || binding.turnCompletion !== continuationTurn || binding.abortRequested || options.signal?.aborted || !binding.connection.process.alive) throw abortError();
60126
60168
  binding.pendingContextCount = context.messages.length;
60127
60169
  binding.pendingContextFingerprint = this.ompMessagesFingerprint(context.messages);
60170
+ binding.pendingConversationFingerprint = this.ompMessagesFingerprint(context.messages.filter((message) => message.role !== "system"));
60128
60171
  binding.permission = void 0;
60129
60172
  clearTimeout(pending.timer);
60130
60173
  if (!result.cancelled && result.optionId && pending.request.options.some((option) => option.optionId === result.optionId)) {
@@ -60133,6 +60176,7 @@ var AntigravityRuntime = class {
60133
60176
  pending.resolve({ outcome: { outcome: "cancelled" } });
60134
60177
  }
60135
60178
  }, () => this.invalidateBinding(binding));
60179
+ binding.toolFingerprint = this.ompToolsFingerprint(tools);
60136
60180
  await this.awaitContinuation(binding, options.signal);
60137
60181
  return;
60138
60182
  }
@@ -60154,11 +60198,13 @@ var AntigravityRuntime = class {
60154
60198
  if (!continuationTurn || binding.turnCompletion !== continuationTurn || binding.abortRequested || options.signal?.aborted || !binding.connection.process.alive) throw abortError();
60155
60199
  binding.pendingContextCount = context.messages.length;
60156
60200
  binding.pendingContextFingerprint = this.ompMessagesFingerprint(context.messages);
60201
+ binding.pendingConversationFingerprint = this.ompMessagesFingerprint(context.messages.filter((message) => message.role !== "system"));
60157
60202
  for (const { pending, message } of results) {
60158
60203
  binding.pendingTools.delete(pending.invocation.id);
60159
60204
  pending.resolve(toMcpToolResult(message));
60160
60205
  }
60161
60206
  }, () => this.invalidateBinding(binding));
60207
+ binding.toolFingerprint = this.ompToolsFingerprint(tools);
60162
60208
  await this.awaitContinuation(binding, options.signal);
60163
60209
  return;
60164
60210
  }
@@ -60178,10 +60224,11 @@ var AntigravityRuntime = class {
60178
60224
  await this.modeChanges;
60179
60225
  this.assertEpoch(epoch);
60180
60226
  binding = await this.getBinding(key, model, acpModelId, options.apiKey, writer, tools, options.signal);
60227
+ const ompRetryResend = binding.messageCount > 0 && context.messages.length === binding.messageCount && this.ompMessagesFingerprint(context.messages) === binding.historyFingerprint;
60181
60228
  if (ompQueuedBehindTurn && binding.modelId === acpModelId && !binding.ompCancelledCheckpoint && binding.expectedAssistantFingerprint && context.messages.length === binding.messageCount && this.ompMessagesFingerprint(context.messages) === binding.historyFingerprint) {
60182
60229
  throw new AntigravityAcpError("invalid_input", "ACP request was already processed by the preceding turn; refusing duplicate dispatch");
60183
60230
  }
60184
- if (binding.needsReconstruction || binding.cwd !== process.cwd() || binding.expectedAssistantFingerprint && context.messages[binding.messageCount]?.role === "assistant" && this.ompMessageFingerprint(context.messages[binding.messageCount]) !== binding.expectedAssistantFingerprint || (binding.ompExpectedAssistantHasOutput || binding.ompCancelledCheckpoint && binding.ompCancelledHadOutput) && context.messages[binding.messageCount]?.role !== "assistant" || binding.mode !== this.permissionMode || this.confirmedMode(binding) !== this.permissionMode || binding.toolFingerprint !== this.ompToolsFingerprint(tools) || context.messages.length < binding.messageCount || this.ompMessagesFingerprint(context.messages.slice(0, binding.messageCount)) !== binding.historyFingerprint) {
60231
+ if (binding.needsReconstruction || binding.cwd !== process.cwd() || binding.expectedAssistantFingerprint && context.messages[binding.messageCount]?.role === "assistant" && this.ompMessageFingerprint(context.messages[binding.messageCount]) !== binding.expectedAssistantFingerprint || (binding.ompExpectedAssistantHasOutput || binding.ompCancelledCheckpoint && binding.ompCancelledHadOutput) && context.messages[binding.messageCount]?.role !== "assistant" && !ompRetryResend || binding.mode !== this.permissionMode || this.confirmedMode(binding) !== this.permissionMode || binding.toolFingerprint !== this.ompToolsFingerprint(tools) || context.messages.length < binding.messageCount || this.ompMessagesFingerprint(context.messages.slice(0, binding.messageCount)) !== binding.historyFingerprint) {
60185
60232
  await this.dropBinding(key, binding, true);
60186
60233
  binding = await this.getBinding(key, model, acpModelId, options.apiKey, writer, tools, options.signal);
60187
60234
  }
@@ -60197,7 +60244,7 @@ var AntigravityRuntime = class {
60197
60244
  unseenStart += 1;
60198
60245
  }
60199
60246
  const parts = adaptPromptToCapabilities(
60200
- buildPromptParts(context, fresh, unseenStart, { contextWindow: model.contextWindow, maxTokens: model.maxTokens, policy: model.ompContextPolicy }),
60247
+ buildPromptParts(context, fresh, unseenStart, { contextWindow: model.contextWindow, maxTokens: model.maxTokens, policy: model.ompContextPolicy }, ompRetryResend),
60201
60248
  binding.initialize
60202
60249
  );
60203
60250
  await this.modeChanges;
@@ -60211,12 +60258,17 @@ var AntigravityRuntime = class {
60211
60258
  binding.needsReconstruction = false;
60212
60259
  binding.pendingContextCount = context.messages.length;
60213
60260
  binding.pendingContextFingerprint = this.ompMessagesFingerprint(context.messages);
60261
+ binding.pendingConversationFingerprint = this.ompMessagesFingerprint(context.messages.filter((message) => message.role !== "system"));
60214
60262
  binding.turnCompletion = new Promise((resolve) => {
60215
60263
  completeTurn = resolve;
60216
60264
  });
60217
60265
  if (options.signal) {
60218
60266
  const promptBinding = binding;
60219
- onTurnAbort = () => abortTurn(promptBinding);
60267
+ onTurnAbort = () => {
60268
+ if (steerMode() === "queue" && isSteerAbort(options.signal)) {
60269
+ promptBinding.connection.muteSteerChunks?.(promptBinding.session.sessionId);
60270
+ } else abortTurn(promptBinding);
60271
+ };
60220
60272
  options.signal.addEventListener("abort", onTurnAbort, { once: true });
60221
60273
  if (options.signal.aborted) onTurnAbort();
60222
60274
  }
@@ -60464,6 +60516,7 @@ var AntigravityRuntime = class {
60464
60516
  ompInvalidated: false,
60465
60517
  ompReleaseLease: releaseLease,
60466
60518
  ompExpectedAssistantHasOutput: restored && saved?.ompExpectedAssistantHasOutput === true,
60519
+ pendingConversationFingerprint: this.ompMessagesFingerprint([]),
60467
60520
  key,
60468
60521
  cwd,
60469
60522
  connection,
@@ -60807,7 +60860,7 @@ function cancelPermission(binding) {
60807
60860
  binding.permission = void 0;
60808
60861
  }
60809
60862
  function instructionFingerprint(context) {
60810
- return createHash3("sha256").update(currentSystemInstructions(context)).digest("hex");
60863
+ return createHash3("sha256").update(stableSystemInstructions(context)).digest("hex");
60811
60864
  }
60812
60865
  function abortTurn(binding) {
60813
60866
  binding.abortRequested = true;
@@ -61101,6 +61154,7 @@ var TierConnection = class extends AntigravityAcpConnection {
61101
61154
  ownershipRetry;
61102
61155
  cleanupLeases = /* @__PURE__ */ new Map();
61103
61156
  toolRouting;
61157
+ steerMode;
61104
61158
  steerTimings;
61105
61159
  steerMuted = /* @__PURE__ */ new Set();
61106
61160
  steerActivity = /* @__PURE__ */ new Map();
@@ -61113,6 +61167,7 @@ var TierConnection = class extends AntigravityAcpConnection {
61113
61167
  });
61114
61168
  this.debugToolUpdates = options.ompDebugToolUpdates ?? false;
61115
61169
  this.usageMode = options.ompUsageMode ?? "auto";
61170
+ this.steerMode = options.ompSteerMode ?? steerMode();
61116
61171
  this.steerTimings = options.ompSteerTimings ?? steerTimings();
61117
61172
  this.setHandlers({ ...options.handlers, onUpdate: async (notification) => {
61118
61173
  const update = notification.update;
@@ -61295,11 +61350,13 @@ var TierConnection = class extends AntigravityAcpConnection {
61295
61350
  this.steerMuted?.delete(id);
61296
61351
  await this.retryOwnership();
61297
61352
  let abortedAt;
61353
+ const queueHold = () => this.steerMode === "queue" && signal !== void 0 && isSteerAbort(signal);
61298
61354
  const aborted2 = () => {
61299
61355
  abortedAt = performance.now();
61356
+ if (queueHold()) this.muteSteerChunks(id);
61300
61357
  };
61301
61358
  signal?.addEventListener("abort", aborted2, { once: true });
61302
- const deferred = signal ? deferredAbortSignal(signal, this.steerTimings, { source: this, sessionId: id }) : void 0;
61359
+ const deferred = signal ? deferredAbortSignal(signal, this.steerTimings, { source: this, sessionId: id }, queueHold) : void 0;
61303
61360
  try {
61304
61361
  await this.cleanup?.touch(id);
61305
61362
  } catch {
@@ -7,7 +7,7 @@ import { showAcpUpdate } from "./activity-presentation.ts";
7
7
  import { parseSessionUsage, usageDelta, type SessionUsage } from "./usage-accounting.ts";
8
8
  import type { SessionCleanup } from "./session-cleanup.ts";
9
9
  import type { Diagnostics } from "./diagnostics.ts";
10
- import { deferredAbortSignal, steerTimings as resolveSteerTimings, type SteerTimings } from "./turn-cancellation.ts";
10
+ import { deferredAbortSignal, isSteerAbort, steerMode as resolveSteerMode, steerTimings as resolveSteerTimings, type SteerMode, type SteerTimings } from "./turn-cancellation.ts";
11
11
 
12
12
  // Updates that would extend the retained turn output stay frozen while a
13
13
  // turn the server cannot cancel drains towards its natural end.
@@ -31,11 +31,12 @@ export class TierConnection extends AntigravityAcpConnection {
31
31
  private ownershipRetry?: Promise<void>;
32
32
  private cleanupLeases = new Map<string, string>();
33
33
  toolRouting: { nativeTools: NativeToolMode; channel: "pending" | "system-append" | "legacy-prompt" } | undefined;
34
+ private readonly steerMode: SteerMode;
34
35
  private readonly steerTimings: SteerTimings;
35
36
  private readonly steerMuted = new Set<string>();
36
37
  private readonly steerActivity = new Map<string, Set<() => void>>();
37
38
 
38
- constructor(options: ConstructorParameters<typeof AntigravityAcpConnection>[0] & { ompNativeTools?: NativeToolMode; ompDebugToolUpdates?: boolean; ompUsageMode?: "auto" | "off"; ompSteerTimings?: SteerTimings; ompCleanup?: SessionCleanup; ompDiagnostics?: Diagnostics }) {
39
+ constructor(options: ConstructorParameters<typeof AntigravityAcpConnection>[0] & { ompNativeTools?: NativeToolMode; ompDebugToolUpdates?: boolean; ompUsageMode?: "auto" | "off"; ompSteerMode?: SteerMode; ompSteerTimings?: SteerTimings; ompCleanup?: SessionCleanup; ompDiagnostics?: Diagnostics }) {
39
40
  super(options);
40
41
  this.cleanup = options.ompCleanup;
41
42
  this.diagnostics = options.ompDiagnostics;
@@ -43,6 +44,7 @@ export class TierConnection extends AntigravityAcpConnection {
43
44
  void this.process.exited.then(() => this.releaseCleanupLeases()).catch(() => {});
44
45
  this.debugToolUpdates = options.ompDebugToolUpdates ?? false;
45
46
  this.usageMode = options.ompUsageMode ?? "auto";
47
+ this.steerMode = options.ompSteerMode ?? resolveSteerMode();
46
48
  this.steerTimings = options.ompSteerTimings ?? resolveSteerTimings();
47
49
  this.setHandlers({ ...options.handlers, onUpdate: async notification => {
48
50
  const update = notification.update as {
@@ -218,14 +220,18 @@ export class TierConnection extends AntigravityAcpConnection {
218
220
  this.steerMuted?.delete(id);
219
221
  await this.retryOwnership();
220
222
  let abortedAt: number | undefined;
221
- const aborted = () => { abortedAt = performance.now(); };
223
+ const queueHold = () => this.steerMode === "queue" && signal !== undefined && isSteerAbort(signal);
224
+ const aborted = () => {
225
+ abortedAt = performance.now();
226
+ // Queue mode keeps the ACP turn alive after OMP's steering abort. Freeze
227
+ // output from this point so the checkpoint matches what OMP retained.
228
+ if (queueHold()) this.muteSteerChunks(id);
229
+ };
222
230
  signal?.addEventListener("abort", aborted, { once: true });
223
- // The official server has no session/cancel, so a caller abort must not
224
- // reach the vendored transport immediately: upstream closes the whole
225
- // connection 1.5s later and would destroy the warm session that
226
- // drainCancelledTurn is waiting to reuse. The hold lasts as long as the
227
- // draining turn keeps producing updates, within the grace timings.
228
- const deferred = signal ? deferredAbortSignal(signal, this.steerTimings, { source: this, sessionId: id }) : undefined;
231
+ // The server may acknowledge session/cancel but still send final updates.
232
+ // A transport abort would close the whole connection 1.5s later. Hold it
233
+ // while the draining turn is alive; queue mode holds until it completes.
234
+ const deferred = signal ? deferredAbortSignal(signal, this.steerTimings, { source: this, sessionId: id }, queueHold) : undefined;
229
235
  try { await this.cleanup?.touch(id); } catch { /* Cleanup must not affect inference. */ }
230
236
  try {
231
237
  const queryUsage = process.env.OMP_ACP_USAGE !== "off" && this.usageMode !== "off" && this.usageCommands.has(id);
@@ -5,6 +5,25 @@ export interface SteerTimings {
5
5
  maxMs: number;
6
6
  }
7
7
 
8
+ export type SteerMode = "steer" | "queue";
9
+
10
+ // Queue mode keeps the active ACP turn alive and sends the next user message
11
+ // as a warm delta after it finishes. Steer mode keeps the original interrupt
12
+ // behavior for callers that explicitly want it.
13
+ export function steerMode(env: NodeJS.ProcessEnv = process.env): SteerMode {
14
+ const value = env.OMP_ACP_STEER_MODE?.trim().toLowerCase();
15
+ if (!value || value === "queue") return "queue";
16
+ if (value === "steer") return "steer";
17
+ throw new Error("OMP_ACP_STEER_MODE must be steer or queue");
18
+ }
19
+
20
+ // OMP aborts a steering turn with a reason-less AbortController. User cancels
21
+ // and internal interrupts carry an explicit reason and must still stop work.
22
+ export function isSteerAbort(signal: AbortSignal): boolean {
23
+ const reason = signal.reason;
24
+ return reason === undefined || (reason instanceof Error && reason.name === "AbortError");
25
+ }
26
+
8
27
  export interface SteerActivitySource {
9
28
  onSteerActivity?(sessionId: string, listener: () => void): () => void;
10
29
  }
@@ -19,14 +38,14 @@ interface PendingTurn {
19
38
  };
20
39
  }
21
40
 
22
- // The official ACP server still lacks session/cancel (verified against
23
- // agy_acp_server 1.4.3: -32601 Method not found), so an interrupted turn
24
- // cannot be stopped. The steering grace instead waits for the old turn to end
25
- // naturally, letting the adapter checkpoint the warm ACP session and send the
26
- // new request as a delta instead of a full cold replay. The wait extends while
27
- // the old turn keeps producing updates — long thinking or tool loops do not
28
- // expire it — and only a silent gap beyond idleMs, or the absolute maxMs cap,
29
- // gives up. idleMs 0 restores the legacy immediate-reconstruction behavior.
41
+ // session/cancel is a notification: the server may acknowledge it and still
42
+ // send final updates before the prompt terminates. The steering grace therefore
43
+ // waits for the terminal response, letting the adapter checkpoint the warm ACP
44
+ // session and send the new request as a delta instead of a full cold replay.
45
+ // The wait extends while the old turn keeps producing updates — long thinking
46
+ // or tool loops do not expire it — and only a silent gap beyond idleMs, or the
47
+ // absolute maxMs cap, gives up. idleMs 0 restores the legacy immediate
48
+ // reconstruction behavior.
30
49
  export function steerTimings(env: NodeJS.ProcessEnv = process.env): SteerTimings {
31
50
  const idleMs = Number(env.OMP_ACP_STEER_GRACE_MS ?? 60_000);
32
51
  if (!Number.isSafeInteger(idleMs) || idleMs < 0 || idleMs > 600_000) {
@@ -90,14 +109,16 @@ export function deferredAbortSignal(
90
109
  signal: AbortSignal,
91
110
  timings: SteerTimings,
92
111
  activity?: { source: SteerActivitySource; sessionId: string },
112
+ holdOnAbort?: () => boolean,
93
113
  ): { signal: AbortSignal; dispose: () => void } {
94
114
  if (!(timings.idleMs > 0)) return { signal, dispose: () => undefined };
95
115
  const controller = new AbortController();
96
116
  let giveup: { dispose: () => void } | undefined;
97
117
  const onAbort = () => {
98
- if (giveup) return;
118
+ if (giveup || holdOnAbort?.()) return;
99
119
  giveup = armSteerGiveup(activity?.source, activity?.sessionId, timings, () => controller.abort(signal.reason));
100
120
  };
121
+
101
122
  signal.addEventListener("abort", onAbort, { once: true });
102
123
  if (signal.aborted) onAbort();
103
124
  return {
@@ -124,12 +145,14 @@ export async function drainCancelledTurn(
124
145
  const cancelled = () => deadline.resolve(false);
125
146
  let timer = setTimeout(cancelled, timeoutMs);
126
147
  let giveup: { dispose: () => void } | undefined;
148
+ let finished = false;
127
149
  signal?.addEventListener("abort", cancelled, { once: true });
128
- // Without session/cancel the old turn keeps running. Freeze what OMP has
129
- // retained so the checkpointed fingerprint still matches once it ends, and
130
- // wait for natural completion: the grace extends while the turn keeps
131
- // producing updates and only gives up after a silent gap or the hard cap.
150
+ // session/cancel is an ACP notification: a successful send only means the
151
+ // server received it, not that the prompt already stopped. Freeze retained
152
+ // output and wait for the terminal response under the same activity-aware
153
+ // grace. The initial timer only bounds a transport that never sends.
132
154
  const extendForNaturalCompletion = () => {
155
+ if (finished || giveup) return;
133
156
  binding.connection.muteSteerChunks?.(binding.session.sessionId);
134
157
  clearTimeout(timer);
135
158
  giveup = armSteerGiveup(binding.connection, binding.session.sessionId, timings, cancelled);
@@ -137,17 +160,19 @@ export async function drainCancelledTurn(
137
160
  try {
138
161
  abort();
139
162
  // A blocked cancel transport must not block the fallback deadline.
140
- try {
141
- void binding.connection.cancel(binding.session.sessionId).catch((error: unknown) => {
163
+ void (async () => {
164
+ try {
165
+ await binding.connection.cancel(binding.session.sessionId);
166
+ if (timings.idleMs > 0) extendForNaturalCompletion();
167
+ else deadline.resolve(false);
168
+ } catch (error) {
142
169
  if (timings.idleMs > 0 && isCancelUnsupported(error)) extendForNaturalCompletion();
143
170
  else deadline.resolve(false);
144
- });
145
- } catch (error) {
146
- if (timings.idleMs > 0 && isCancelUnsupported(error)) extendForNaturalCompletion();
147
- else return false;
148
- }
171
+ }
172
+ })();
149
173
  return await Promise.race([completion.then(() => true, () => false), deadline.promise]);
150
174
  } finally {
175
+ finished = true;
151
176
  giveup?.dispose();
152
177
  clearTimeout(timer);
153
178
  signal?.removeEventListener("abort", cancelled);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omp-antigravity-acp-provider",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "ompAcpBundle": 1,
5
5
  "description": "Google Antigravity ACP provider for Oh My Pi (OMP), with tool bridging and per-model thinking; derived from zacbemis/pi-antigravity-acp-provider",
6
6
  "type": "module",
@@ -25,6 +25,7 @@
25
25
  "!extension/vendor/",
26
26
  "licenses/",
27
27
  "README.md",
28
+ "AGENT_INSTALL.md",
28
29
  "LICENSE",
29
30
  "THIRD_PARTY_NOTICES.md",
30
31
  "THIRD_PARTY_LICENSES.txt"