omp-antigravity-acp-provider 0.1.19 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,11 +15,13 @@ The original project's ACP transport, Google-managed authentication, runtime ins
15
15
 
16
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
17
 
18
- The repository keeps the OMP adapter sources separately and installs upstream version **0.1.15** as an unmodified, pinned npm dependency. 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.
18
+ The repository keeps the OMP adapter sources separately and uses upstream version **0.1.15** as an unmodified, pinned build dependency. 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
19
 
20
20
  ## Status
21
21
 
22
- Version 0.1.19 supports all models advertised by the official ACP server. Tested with macOS, OMP 18.12.3, upstream provider 0.1.15 and official ACP runtime 1.4.1. Other platforms and OMP versions are not yet verified.
22
+ Version 0.1.20 includes resource-management improvements, verified OMP-deletion reconciliation and standalone packaging. Restart OMP after upgrading to load the new code.
23
+
24
+ Version 0.1.20 supports all models advertised by the official ACP server. Tested with macOS, OMP 18.12.5, upstream provider 0.1.15 and official ACP runtime 1.4.1. Other platforms and OMP versions are not yet verified.
23
25
 
24
26
  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.
25
27
 
@@ -56,7 +58,7 @@ Or, inside OMP:
56
58
 
57
59
  Select **omp-antigravity-acp-provider** in the browser, install it, and restart OMP to load the provider.
58
60
 
59
- 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.19** prebuilt npm adapter and production dependencies on first load. It disables npm install scripts, skips Pi CLI peer installation, and performs no local compilation. Node.js 22.19+ and npm must be on PATH. First preparation needs internet access and roughly **150 MiB** of disk space; later loads reuse the installed cache without npm network access.
61
+ 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.20** 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.
60
62
 
61
63
  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.
62
64
 
@@ -80,12 +82,12 @@ omp plugin install npm:omp-antigravity-acp-provider
80
82
  To pin a specific release:
81
83
 
82
84
  ```sh
83
- omp plugin install npm:omp-antigravity-acp-provider@0.1.19
85
+ omp plugin install npm:omp-antigravity-acp-provider@0.1.20
84
86
  ```
85
87
 
86
88
  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.
87
89
 
88
- The upstream dependency declares Pi-specific peers, so package managers that automatically install peers may also fetch the Pi CLI. The OMP adapter does not invoke that CLI. This does not apply to source installs using this repository's `.npmrc`.
90
+ 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`.
89
91
 
90
92
  ## Find it with zmarketplace
91
93
 
@@ -118,7 +120,7 @@ npm run check
118
120
 
119
121
  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.
120
122
 
121
- The build produces `extension/runtime.mjs` 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 the installed upstream dependency, so the bundle does not embed the developer's home directory.
123
+ 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.
122
124
 
123
125
  For a temporary session, from this repository:
124
126
 
@@ -164,7 +166,9 @@ After upgrading from an older adapter, run `/antigravity-acp refresh` once to re
164
166
  | `/antigravity-acp cleanup` | Show cleanup mode/deadline and check eligible local sessions |
165
167
  | `/antigravity-acp cleanup off` | Disable automatic session-file deletion |
166
168
  | `/antigravity-acp cleanup conservative` | Delete confirmed replaced/disposable sessions only (default) |
167
- | `/antigravity-acp cleanup timeout DAYS` | Also delete inactive owned sessions after DAYS (default 7) |
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) |
168
172
  | `/antigravity-acp tools` | Available and omitted OMP tool schemas after a request |
169
173
  | `/antigravity-acp refresh` | Explicit network discovery and local catalog refresh |
170
174
  | `/antigravity-acp native-tools prefer` | Prefer OMP tools; retain native built-ins (default) |
@@ -211,6 +215,12 @@ Never include those user data directories, OAuth callback URLs, account identifi
211
215
 
212
216
  ## Context continuity and local performance
213
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 compatible with existing `sessions.json` files. Cancellation checkpoints are awaited before the turn releases its queue; shutdown waits for active checkpoint writes. This keeps the event loop responsive during session-registry lock contention without acknowledging an unwritten checkpoint. 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 [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
+
214
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. 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.
215
225
 
216
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).
@@ -253,7 +263,7 @@ omp config set compaction.modelThresholds '{"antigravity-acp/*":"85%"}'
253
263
 
254
264
  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.
255
265
 
256
- 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. Active streams, outstanding ACP prompts, tools and permission waits prevent eviction. No background model prewarming, quota polling or tokenizer model download is performed.
266
+ 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.
257
267
 
258
268
  ### Local ACP session cleanup
259
269
 
@@ -263,28 +273,45 @@ Session-file deletion is separate from the five-minute idle process shutdown. Co
263
273
  | --- | --- |
264
274
  | `off` | Keep session files, including replaced sessions. Ownership/lease bookkeeping remains enabled so cleanup can be enabled later. |
265
275
  | `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 are also removed after their connection exits. Ordinary shutdown and idle eviction preserve resumable sessions. |
266
- | `timeout` | Conservative cleanup plus removal of owned sessions whose last activity exceeds `idleDays`. 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. Live leases always override the deadline. |
276
+ | `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. |
267
277
 
268
278
  ```text
269
279
  /antigravity-acp cleanup
270
280
  /antigravity-acp cleanup off
271
281
  /antigravity-acp cleanup conservative
272
282
  /antigravity-acp cleanup timeout 7
283
+ /antigravity-acp cleanup budget 50 512
273
284
  ```
274
285
 
275
286
  Settings persist in `~/.omp/agent/antigravity-acp-provider/cleanup.json`:
276
287
 
277
288
  ```json
278
- { "mode": "conservative", "idleDays": 7 }
289
+ { "mode": "conservative", "idleDays": 7, "maxSessions": 0, "maxBytes": 0, "orphanGraceDays": 1, "batchSize": 8 }
279
290
  ```
280
291
 
281
- 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. 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.
292
+ The optional budgets default to disabled (`0`); the command accepts MiB and saves bytes. 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`, 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 grace period applies to budget eviction; confirmed replacement and ordinary idle expiry have their own eligibility rules.
293
+
294
+ 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.
282
295
 
283
- Only sessions created and registered by this adapter version onward are eligible. Pre-existing/unidentified ACP sessions are preserved. 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. Busy/corrupt registries and unsafe paths defer deletion. 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.
296
+ 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, 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.
284
297
 
285
298
  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.
286
299
 
287
- Timeout cleanup sacrifices ACP-only reasoning/checkpoint state. The next request reconstructs a session from OMP's retained history and can incur replay latency and a different token count. Cache expiry is not assumed or guaranteed. Conservative mode avoids that tradeoff for ordinary resumable sessions; it does not bound the number of unrelated OMP conversations you keep.
300
+ Timeout cleanup sacrifices 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.
301
+
302
+ ### Deleting an OMP conversation
303
+
304
+ 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.
305
+
306
+ 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.
307
+
308
+ 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.
309
+
310
+ ### Optional timing diagnostics
311
+
312
+ 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.
313
+
314
+ 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.
288
315
 
289
316
  Optional environment settings, applied when OMP starts:
290
317
 
@@ -292,6 +319,7 @@ Optional environment settings, applied when OMP starts:
292
319
  | --- | --- | --- |
293
320
  | `OMP_ACP_HISTORY_BYTES` | context.json or 16 MiB | Optional byte-limit override, 64 KiB–128 MiB; independent of token window |
294
321
  | `OMP_ACP_IDLE_TIMEOUT_MS` | `300000` | Idle runtime reclamation; `0` disables it, positive values must be at least `1000` |
322
+ | `OMP_ACP_MAX_IDLE_RUNTIMES` | `2` | Per-process idle runtime LRU limit; `0` disables the limit. Busy/leased runtimes remain protected |
295
323
  | `OMP_ACP_USAGE` | context.json or auto | `off` forces supplemental queries off, including when the saved option is auto |
296
324
 
297
325
  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.
@@ -325,7 +353,7 @@ See the [0.1.8 context/compaction and usage benchmark](docs/context-compaction-0
325
353
 
326
354
  `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.
327
355
 
328
- `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 runtime assets, and loads its model catalog with ACP execution disabled. It downloads production dependencies and removes the temporary installation afterward.
356
+ `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.
329
357
 
330
358
  `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.
331
359
 
@@ -0,0 +1,205 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "generatedAt": "2026-10-03T11:44:17.523Z",
4
+ "releases": [
5
+ {
6
+ "version": "1.1.1",
7
+ "platforms": {
8
+ "darwin-aarch64": {
9
+ "archive": "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-agy_acp_server_1.1.1-darwin-arm64.zip",
10
+ "archiveSha256": "fdfa915652cdb7ba8085cc8fffed072cbe009251aa2c951aabdda07a8c28a189",
11
+ "archiveBytes": 316014828,
12
+ "binaryName": "agy_acp_server.par",
13
+ "binaryBytes": 802163856,
14
+ "harnessName": "localharness_external",
15
+ "harnessBytes": 116766704,
16
+ "args": []
17
+ },
18
+ "linux-x86_64": {
19
+ "archive": "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-agy_acp_server_1.1.1-linux-x86_64.zip",
20
+ "archiveSha256": "38f62d01b32deb0907b3d39a71ec301fd36369f6ffd1cf262d4af385177f79df",
21
+ "archiveBytes": 681969407,
22
+ "binaryName": "agy_acp_server.par",
23
+ "binaryBytes": 1880360328,
24
+ "harnessName": "localharness_external",
25
+ "harnessBytes": 128966920,
26
+ "args": [
27
+ "--uid="
28
+ ]
29
+ },
30
+ "linux-aarch64": {
31
+ "archive": "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-agy_acp_server_1.1.1-linux-arm64.zip",
32
+ "archiveSha256": "ed69e64b308fcb123ab54bf3277bf9cb0d651064f885ea5aab0ff520c7175398",
33
+ "archiveBytes": 656572786,
34
+ "binaryName": "agy_acp_server.par",
35
+ "binaryBytes": 1862073131,
36
+ "harnessName": "localharness_external",
37
+ "harnessBytes": 122158704,
38
+ "args": [
39
+ "--uid="
40
+ ]
41
+ },
42
+ "windows-x86_64": {
43
+ "archive": "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-agy_acp_server_1.1.1-windows-x86_64.zip",
44
+ "archiveSha256": "47cb50eef14f0a4655d78cfcfda869bcea7aaee5f9787e936bc2935ea612c3b8",
45
+ "archiveBytes": 468238392,
46
+ "binaryName": "agy_acp_server.exe",
47
+ "binaryBytes": 430801616,
48
+ "harnessName": "localharness_external.exe",
49
+ "harnessBytes": 130971800,
50
+ "args": []
51
+ },
52
+ "windows-aarch64": {
53
+ "archive": "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-agy_acp_server_1.1.1-windows-arm64.zip",
54
+ "archiveSha256": "35f4b1f47ba6a3fea7b0a3e30010df5ea73a64b4f0e7cf991cddc673ddfbcafc",
55
+ "archiveBytes": 468521191,
56
+ "binaryName": "agy_acp_server.exe",
57
+ "binaryBytes": 435075816,
58
+ "harnessName": "localharness_external.exe",
59
+ "harnessBytes": 122455704,
60
+ "args": []
61
+ }
62
+ }
63
+ },
64
+ {
65
+ "version": "1.2.1",
66
+ "platforms": {
67
+ "darwin-aarch64": {
68
+ "archive": "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-1.2.1-darwin-arm64.zip",
69
+ "archiveSha256": "0fab9938812e6b32b3b543e65e4f3a0025ceef755413db13542d9a9b81ea803c",
70
+ "archiveBytes": 111725488,
71
+ "binaryName": "agy_acp_server.par",
72
+ "binaryBytes": 276920768,
73
+ "harnessName": "localharness_external",
74
+ "harnessBytes": 120663872,
75
+ "args": []
76
+ },
77
+ "darwin-x86_64": {
78
+ "archive": "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-1.2.1-darwin-x86_64.zip",
79
+ "archiveSha256": "d09bf99bdea7b82021e1afcff829da35e4aa583d8f0984ef364dc3a7c064e07e",
80
+ "archiveBytes": 117493869,
81
+ "binaryName": "agy_acp_server.par",
82
+ "binaryBytes": 281143216,
83
+ "harnessName": "localharness_external",
84
+ "harnessBytes": 126174208,
85
+ "args": []
86
+ },
87
+ "linux-x86_64": {
88
+ "archive": "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-1.2.1-linux-x86_64.zip",
89
+ "archiveSha256": "9fbf0bd584a26478161f637cabd75113f72541c842d148f578ef1a6a9edcb843",
90
+ "archiveBytes": 333590110,
91
+ "binaryName": "agy_acp_server.par",
92
+ "binaryBytes": 919951920,
93
+ "harnessName": "localharness_external",
94
+ "harnessBytes": 132815192,
95
+ "args": [
96
+ "--uid="
97
+ ]
98
+ },
99
+ "linux-aarch64": {
100
+ "archive": "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-1.2.1-linux-arm64.zip",
101
+ "archiveSha256": "7e7ef4088bc185e1af4204029e0f4ec4210af20724f3ff262186ac0bcea6aa0e",
102
+ "archiveBytes": 321280184,
103
+ "binaryName": "agy_acp_server.par",
104
+ "binaryBytes": 921424555,
105
+ "harnessName": "localharness_external",
106
+ "harnessBytes": 125568904,
107
+ "args": [
108
+ "--uid="
109
+ ]
110
+ },
111
+ "windows-x86_64": {
112
+ "archive": "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-1.2.1-windows-x86_64.zip",
113
+ "archiveSha256": "9b82493819bc14613baa76264d55ad307ddd8ab4a8d6e110edb32da35498c07b",
114
+ "archiveBytes": 124869770,
115
+ "binaryName": "agy_acp_server.exe",
116
+ "binaryBytes": 81231712,
117
+ "harnessName": "localharness_external.exe",
118
+ "harnessBytes": 147063448,
119
+ "args": []
120
+ },
121
+ "windows-aarch64": {
122
+ "archive": "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-1.2.1-windows-arm64.zip",
123
+ "archiveSha256": "21db37ae246284053212f2670e05c4de8d6ee9488b000bf304e1fe4ea191f7b8",
124
+ "archiveBytes": 124945935,
125
+ "binaryName": "agy_acp_server.exe",
126
+ "binaryBytes": 85647280,
127
+ "harnessName": "localharness_external.exe",
128
+ "harnessBytes": 137181336,
129
+ "args": []
130
+ }
131
+ }
132
+ },
133
+ {
134
+ "version": "1.3.0",
135
+ "platforms": {
136
+ "darwin-aarch64": {
137
+ "archive": "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-1.3.0-darwin-arm64.zip",
138
+ "archiveSha256": "7cd97045f7b4fe81175a107cdf16f9c51484e3c78a5162cae415338bb6aa5b88",
139
+ "archiveBytes": 111456962,
140
+ "binaryName": "agy_acp_server.par",
141
+ "binaryBytes": 278535456,
142
+ "harnessName": "localharness_external",
143
+ "harnessBytes": 118611392,
144
+ "args": []
145
+ },
146
+ "darwin-x86_64": {
147
+ "archive": "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-1.3.0-darwin-x86_64.zip",
148
+ "archiveSha256": "bb23956b89984bf5d354af2c3725e6c57f0cc1b7228e77a0e91c9c2bc1d47646",
149
+ "archiveBytes": 117245544,
150
+ "binaryName": "agy_acp_server.par",
151
+ "binaryBytes": 282840688,
152
+ "harnessName": "localharness_external",
153
+ "harnessBytes": 124175392,
154
+ "args": []
155
+ },
156
+ "linux-x86_64": {
157
+ "archive": "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-1.3.0-linux-x86_64.zip",
158
+ "archiveSha256": "9fb60956af0a9d76220a4db91ca9ac88e2a2372ad68f985ab5fceace6b825b96",
159
+ "archiveBytes": 333727150,
160
+ "binaryName": "agy_acp_server.par",
161
+ "binaryBytes": 926533965,
162
+ "harnessName": "localharness_external",
163
+ "harnessBytes": 130388040,
164
+ "args": [
165
+ "--uid="
166
+ ]
167
+ },
168
+ "linux-aarch64": {
169
+ "archive": "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-1.3.0-linux-arm64.zip",
170
+ "archiveSha256": "500b0bc0fb858e88f4df404d4cedf80bf9298c178291e39e383d6c50b111cbdf",
171
+ "archiveBytes": 321690363,
172
+ "binaryName": "agy_acp_server.par",
173
+ "binaryBytes": 930848992,
174
+ "harnessName": "localharness_external",
175
+ "harnessBytes": 123224968,
176
+ "args": [
177
+ "--uid="
178
+ ]
179
+ },
180
+ "windows-x86_64": {
181
+ "archive": "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-1.3.0-windows-x86_64.zip",
182
+ "archiveSha256": "65215e0688681fa3116e048a9eab27ef53af1bbd6f3da3f1c52bd4911d8b17f9",
183
+ "archiveBytes": 124509787,
184
+ "binaryName": "agy_acp_server.exe",
185
+ "binaryBytes": 81437336,
186
+ "harnessName": "localharness_external.exe",
187
+ "harnessBytes": 145548952,
188
+ "args": []
189
+ },
190
+ "windows-aarch64": {
191
+ "archive": "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-1.3.0-windows-arm64.zip",
192
+ "archiveSha256": "4a0f469720e9beb9438a979f543fdbfad5022ebe0992c052c590bd78b3144ca3",
193
+ "archiveBytes": 124654803,
194
+ "binaryName": "agy_acp_server.exe",
195
+ "binaryBytes": 85893472,
196
+ "harnessName": "localharness_external.exe",
197
+ "harnessBytes": 135640216,
198
+ "args": []
199
+ }
200
+ }
201
+ }
202
+ ],
203
+ "signature": "yfTGgbXRKpUL41Sz8FG6z7NkleAa51sRkyRdSeYoBqvwssibrR16Wq7wl95UVk4L0Z/MtHgiA5pI0M5Ep9rRCA=="
204
+ }
205
+
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+
5
+ // SSL_CERT_FILE is resolved by AntigravityProcess.applyDefaultTlsEnvironment
6
+ // before this supervisor is spawned; the supervisor passes its environment
7
+ // through to the agent unchanged.
8
+
9
+ const forwarded = process.argv.slice(2);
10
+ const genericCommand = forwarded[0] === "--command";
11
+ if (genericCommand) forwarded.shift();
12
+ const [entryOrCommand, ...forwardedArgs] = forwarded;
13
+ if (!entryOrCommand) {
14
+ process.stderr.write("Antigravity ACP supervisor: missing agent command\n");
15
+ process.exit(64);
16
+ }
17
+ const agentCommand = genericCommand ? entryOrCommand : process.execPath;
18
+ const agentArgs = genericCommand ? forwardedArgs : [entryOrCommand, ...forwardedArgs];
19
+
20
+ const parentPid = process.ppid;
21
+ const agent = spawn(agentCommand, agentArgs, {
22
+ stdio: ["pipe", "pipe", "pipe"],
23
+ shell: false,
24
+ windowsHide: true,
25
+ // Give Antigravity and every tool it starts a group separate from the watchdog.
26
+ detached: process.platform !== "win32",
27
+ env: process.env,
28
+ });
29
+
30
+ let shuttingDown = false;
31
+ let hardKillTimer;
32
+
33
+ process.stdin.pipe(agent.stdin);
34
+ agent.stdout.pipe(process.stdout);
35
+ agent.stderr.pipe(process.stderr);
36
+
37
+ const parentWatch = setInterval(() => {
38
+ try {
39
+ process.kill(parentPid, 0);
40
+ } catch {
41
+ shutdown("parent exited", 0);
42
+ }
43
+ }, 500);
44
+ parentWatch.unref();
45
+
46
+ process.stdin.once("end", () => shutdown("ACP stdin closed", 0));
47
+ process.stdin.once("error", () => shutdown("ACP stdin failed", 1));
48
+ process.once("SIGTERM", () => shutdown("SIGTERM", 0));
49
+ process.once("SIGINT", () => shutdown("SIGINT", 0));
50
+ process.once("SIGHUP", () => shutdown("SIGHUP", 0));
51
+
52
+ agent.once("error", (error) => {
53
+ process.stderr.write(`Antigravity ACP supervisor: ${error.message}\n`);
54
+ shutdown("agent spawn failed", 1);
55
+ });
56
+ agent.once("exit", (code, signal) => {
57
+ clearInterval(parentWatch);
58
+ if (hardKillTimer) clearTimeout(hardKillTimer);
59
+ process.stdin.unpipe(agent.stdin);
60
+ process.stdin.destroy();
61
+ if (!shuttingDown && signal) process.stderr.write(`Antigravity ACP agent exited on ${signal}\n`);
62
+ const exitCode = code ?? (signal ? 1 : 0);
63
+ // End forwarded stdout so the parent SDK closes immediately, then exit even
64
+ // though the original parent may still hold its pipe descriptors open.
65
+ process.stdout.end(() => process.exit(exitCode));
66
+ });
67
+
68
+ function shutdown(_reason, exitCode) {
69
+ if (shuttingDown) return;
70
+ shuttingDown = true;
71
+ clearInterval(parentWatch);
72
+ process.exitCode = exitCode;
73
+ try {
74
+ process.stdin.unpipe(agent.stdin);
75
+ agent.stdin.end();
76
+ } catch {
77
+ // Agent input already closed.
78
+ }
79
+ signalAgent("SIGTERM");
80
+ hardKillTimer = setTimeout(() => {
81
+ signalAgent("SIGKILL");
82
+ process.exit(exitCode);
83
+ }, 750);
84
+ // This timer must remain referenced: the watchdog owns killing the detached
85
+ // agent process group before it is allowed to exit.
86
+ }
87
+
88
+ function signalAgent(signal) {
89
+ try {
90
+ if (process.platform === "win32" && agent.pid) {
91
+ const args = ["/PID", String(agent.pid), "/T"];
92
+ if (signal === "SIGKILL") args.push("/F");
93
+ spawn("taskkill", args, { stdio: "ignore", windowsHide: true });
94
+ return;
95
+ }
96
+ if (agent.pid) process.kill(-agent.pid, signal);
97
+ else agent.kill(signal);
98
+ } catch {
99
+ // ESRCH means the process tree is already gone.
100
+ }
101
+ }
@@ -80,6 +80,7 @@ export interface OmpCommandContext {
80
80
  };
81
81
  sessionManager?: {
82
82
  getSessionId?: () => string | undefined;
83
+ getSessionFile?: () => string | undefined;
83
84
  };
84
85
  modelRegistry?: {
85
86
  refreshProvider?: (provider: string, mode?: string) => Promise<void>;
@@ -15,6 +15,9 @@ export class CatalogStore {
15
15
  readonly upstreamModels = new Map<string, ConfiguredCatalogModel>();
16
16
  currentModels: ConfiguredCatalogModel[] = [];
17
17
  private dynamicCache?: { mtimeMs: number; size: number; settings: ContextSettings; models: ConfiguredCatalogModel[] };
18
+ private discovery?: Promise<AdvertisedModel[]>;
19
+ private refreshing?: Promise<ConfiguredCatalogModel[]>;
20
+ private latestSettings?: ContextSettings;
18
21
 
19
22
  constructor(
20
23
  private readonly cachePath: string,
@@ -24,6 +27,8 @@ export class CatalogStore {
24
27
  ) {}
25
28
 
26
29
  projectWithSettings(models: PublicCatalogModel[], settings: ContextSettings): ConfiguredCatalogModel[] {
30
+ this.latestSettings = settings;
31
+ this.upstreamModels.clear();
27
32
  return models.map(source => {
28
33
  const limits = resolveContextOptions(source, settings);
29
34
  const model: ConfiguredCatalogModel = {
@@ -84,6 +89,13 @@ export class CatalogStore {
84
89
  }
85
90
 
86
91
  async discoverModels(): Promise<AdvertisedModel[]> {
92
+ if (this.discovery) return this.discovery;
93
+ const pending = this.discoverOnce();
94
+ this.discovery = pending;
95
+ try { return await pending; }
96
+ finally { if (this.discovery === pending) this.discovery = undefined; }
97
+ }
98
+ private async discoverOnce(): Promise<AdvertisedModel[]> {
87
99
  await this.prepareRuntime();
88
100
  const connection = new TierConnection({ cwd: process.cwd(), ompCleanup: this.cleanup });
89
101
  let discoveredSession: string | undefined;
@@ -106,15 +118,21 @@ export class CatalogStore {
106
118
  if (!models.length) throw new Error("Antigravity did not advertise any models");
107
119
  return models;
108
120
  } finally {
109
- if (discoveredSession) connection.discardSession(discoveredSession);
110
- await connection.close();
121
+ try { if (discoveredSession) await connection.discardSession(discoveredSession); }
122
+ finally { await connection.close(); }
111
123
  }
112
124
  }
113
125
 
114
126
  async refresh(settings: ContextSettings): Promise<ConfiguredCatalogModel[]> {
127
+ this.latestSettings = settings;
128
+ if (this.refreshing) return this.refreshing;
129
+ const pending = this.refreshOnce(); this.refreshing = pending;
130
+ try { return await pending; } finally { if (this.refreshing === pending) this.refreshing = undefined; }
131
+ }
132
+ private async refreshOnce(): Promise<ConfiguredCatalogModel[]> {
115
133
  const models = await this.discoverModels();
116
134
  this.upstreamModels.clear();
117
- const registered = this.projectWithSettings(projectCatalog(models), settings);
135
+ const registered = this.projectWithSettings(projectCatalog(models), this.latestSettings ?? { defaults: {}, models: {} });
118
136
  this.currentModels = registered;
119
137
  writeJsonAtomic(this.cachePath, {
120
138
  schemaVersion: 2,
@@ -5,6 +5,7 @@ import { saveToolPolicy, type ToolPolicy } from "./tool-policy.ts";
5
5
  import { updateContextSettings, resolveContextOptions, saveContextSettings, type ContextSettings } from "./context-settings.ts";
6
6
  import type { CatalogStore, ConfiguredCatalogModel } from "./catalog-store.ts";
7
7
  import type { SessionCleanup, CleanupMode } from "./session-cleanup.ts";
8
+ import type { Diagnostics } from "./diagnostics.ts";
8
9
  import type { TierConnection } from "./tier-connection.ts";
9
10
 
10
11
  export interface RuntimeSnapshotProcess {
@@ -62,6 +63,7 @@ export interface CommandControllerDeps {
62
63
  contextPath: string;
63
64
  toolPolicyPath: string;
64
65
  cleanup: SessionCleanup;
66
+ diagnostics?: Diagnostics;
65
67
  connections: Set<TierConnection>;
66
68
  auth: OmpAuthCoordinator;
67
69
  catalog: CatalogStore;
@@ -88,8 +90,19 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
88
90
  deps.auth.watchOmpCredentials(ctx);
89
91
  const parts = args.trim().split(/\s+/);
90
92
  const [command, value] = parts;
93
+ if (command === "diagnostics") {
94
+ if (parts.length > 2 || (value !== undefined && !["on", "off", "reset"].includes(value))) throw new Error("Usage: /antigravity-acp diagnostics [on|off|reset]");
95
+ if (value === "reset") deps.diagnostics?.reset();
96
+ else if (value) deps.diagnostics?.configure(value === "on");
97
+ ctx.ui.notify(JSON.stringify(deps.diagnostics?.status() ?? { enabled: false }, null, 2), "info");
98
+ return;
99
+ }
91
100
 
92
101
  if (command === "cleanup") {
102
+ if (value === "budget") {
103
+ if (parts.length !== 4) throw new Error("Usage: /antigravity-acp cleanup budget MAX_SESSIONS MAX_MIB (0 disables a limit)");
104
+ deps.cleanup.budget(Number(parts[2]), Number(parts[3]) * 1024 * 1024);
105
+ } else
93
106
  if (value) {
94
107
  if (!["off", "conservative", "timeout"].includes(value) || parts.length > 3 || (parts[2] !== undefined && value !== "timeout")) {
95
108
  throw new Error("Usage: /antigravity-acp cleanup [off|conservative|timeout [DAYS]]");
@@ -97,7 +110,8 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
97
110
  deps.cleanup.configure(value as CleanupMode, parts[2] === undefined ? undefined : Number(parts[2]));
98
111
  deps.cleanup.start();
99
112
  }
100
- const removed = deps.cleanup.collect();
113
+ deps.cleanup.start();
114
+ const removed = await deps.cleanup.collect();
101
115
  ctx.ui.notify(JSON.stringify({
102
116
  ...deps.cleanup.status(),
103
117
  removed,
@@ -260,7 +274,7 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
260
274
  await Promise.all(deps.getAllRuntimes().map(bundle => bundle.runtime.setPermissionMode(mode)));
261
275
  savePermissionMode(mode, deps.configPath);
262
276
  }
263
- const usageError = "Usage: /antigravity-acp [status|account|login|logout|tools|usage|context|cleanup|debug|native-tools|permissions|refresh]";
277
+ const usageError = "Usage: /antigravity-acp [status|account|login|logout|tools|usage|context|cleanup|diagnostics|debug|native-tools|permissions|refresh]";
264
278
  if (command && command !== "status" && command !== "tools" && command !== "permissions") {
265
279
  throw new Error(usageError);
266
280
  }
@@ -0,0 +1,40 @@
1
+ import fs from "node:fs";
2
+ import { writeJsonAtomic, isMissingFileError } from "./fs-atomic.ts";
3
+ export class Diagnostics {
4
+ private enabled = false;
5
+ private readonly samples: Array<{ stage: string; ms: number }> = [];
6
+ constructor(private readonly file: string) {
7
+ try { this.enabled = JSON.parse(fs.readFileSync(file, "utf8")).enabled === true; } catch (e) { if (!isMissingFileError(e)) this.enabled = false; }
8
+ }
9
+ configure(enabled: boolean) { writeJsonAtomic(this.file, { enabled }, false); this.enabled = enabled; if (!enabled) this.samples.length = 0; }
10
+ reset() { this.samples.length = 0; }
11
+ record(stage: string, ms: number) {
12
+ if (!this.enabled || !Number.isFinite(ms) || ms < 0) return;
13
+ this.samples.push({ stage, ms }); if (this.samples.length > 128) this.samples.shift();
14
+ }
15
+ sync<T>(stage: string, work: () => T): T { if (!this.enabled) return work(); const t = performance.now(); try { return work(); } finally { this.record(stage, performance.now() - t); } }
16
+ async measure<T>(stage: string, work: () => Promise<T>): Promise<T> { if (!this.enabled) return work(); const t = performance.now(); try { return await work(); } finally { this.record(stage, performance.now() - t); } }
17
+ status() {
18
+ const stages: { [key: string]: { count: number; medianMs: number; maxMs: number } } = {};
19
+ for (const name of new Set(this.samples.map(s => s.stage))) {
20
+ const values = this.samples.filter(s => s.stage === name).map(s => s.ms).sort((a, b) => a - b);
21
+ stages[name] = { count: values.length, medianMs: +values[Math.floor(values.length / 2)].toFixed(3), maxMs: +values.at(-1)!.toFixed(3) };
22
+ }
23
+ return { enabled: this.enabled, samples: this.samples.length, capacity: 128, stages };
24
+ }
25
+ }
26
+
27
+ // Instrument only adapter-controlled methods. No request content, model output,
28
+ // account identifiers or session IDs are collected or persisted.
29
+ export function instrumentRuntime(runtime: object, diagnostics: Diagnostics) {
30
+ for (const [method, stage] of [["ompMessagesFingerprint", "history.compare"], ["ompToolsFingerprint", "tools.compare"]]) {
31
+ const original = Reflect.get(runtime, method) as (...args: unknown[]) => unknown;
32
+ Reflect.set(runtime, method, (...args: unknown[]) => diagnostics.sync(stage, () => original.apply(runtime, args)));
33
+ }
34
+ for (const [method, stage] of [["getBinding", "session.binding"], ["createBinding", "session.initialize-or-restore"], ["persistBinding", "checkpoint.write"]]) {
35
+ const original = Reflect.get(runtime, method) as (...args: unknown[]) => Promise<unknown>;
36
+ Reflect.set(runtime, method, (...args: unknown[]) => diagnostics.measure(stage, () => original.apply(runtime, args)));
37
+ }
38
+ const drop = Reflect.get(runtime, "dropBinding") as (...args: unknown[]) => Promise<unknown>;
39
+ Reflect.set(runtime, "dropBinding", (...args: unknown[]) => diagnostics.measure(args[2] ? "session.rebuild" : "session.close", () => drop.apply(runtime, args)));
40
+ }