omp-antigravity-acp-provider 0.1.10 → 0.1.11

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
@@ -19,7 +19,7 @@ The repository keeps the OMP adapter sources separately and installs upstream ve
19
19
 
20
20
  ## Status
21
21
 
22
- Version 0.1.10 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.11 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.
23
23
 
24
24
  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
25
 
@@ -33,7 +33,7 @@ Google's consumer-plan policies can restrict third-party agent access even throu
33
33
  - 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.
34
34
  - Lazy ACP startup; model selection and cached listing do not launch the server.
35
35
  - Runtimes scoped to OMP sessions, including recovery after a planning session is disposed.
36
- - OMP `/login` support plus `/antigravity-acp login`, `logout` and `account` commands; the full local logout also removes the macOS keychain entry that the Antigravity server owns.
36
+ - 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.
37
37
  - API-equivalent cost estimates, not subscription billing or quota measurements.
38
38
 
39
39
  ## Install from the OMP marketplace
@@ -56,7 +56,7 @@ Or, inside OMP:
56
56
 
57
57
  Select **omp-antigravity-acp-provider** in the browser, install it, and restart OMP to load the provider.
58
58
 
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.10** 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.
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.11** 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.
60
60
 
61
61
  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
62
 
@@ -80,7 +80,7 @@ omp plugin install npm:omp-antigravity-acp-provider
80
80
  To pin a specific release:
81
81
 
82
82
  ```sh
83
- omp plugin install npm:omp-antigravity-acp-provider@0.1.10
83
+ omp plugin install npm:omp-antigravity-acp-provider@0.1.11
84
84
  ```
85
85
 
86
86
  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.
@@ -177,7 +177,7 @@ The initial permission mode follows upstream configuration, whose default is `yo
177
177
 
178
178
  ### Sign out
179
179
 
180
- OMP's `/logout` removes only OMP's stored non-secret marker record for this provider; it cannot reach the Google credentials that the Antigravity runtime keeps in its own storage. `/antigravity-acp logout` performs the complete local logout: it closes this process's ACP runtimes, clears saved ACP session mappings, deletes the local token file and the settings auth choice, removes the matching macOS keychain entry when present, and removes OMP's marker record. It refuses to run while Antigravity requests are active. If OMP's marker cannot be removed through the host API, the command says so and OMP's `/logout` finishes the job.
180
+ 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 a notification. 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.
181
181
 
182
182
  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.
183
183
 
@@ -315,7 +315,7 @@ See the [0.1.8 context/compaction and usage benchmark](docs/context-compaction-0
315
315
 
316
316
  `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.
317
317
 
318
- `npm run test:auth` uses Bun with an isolated `GEMINI_HOME`, a stubbed keychain and a stubbed OAuth flow to verify the account view, login dialog mapping, logout cleanup and the active-request guard without starting ACP. Real Google login and logout change account state, so they are not part of any automated test.
318
+ `npm run test:auth` uses Bun with an isolated `GEMINI_HOME`, a stubbed keychain and a stubbed OAuth flow to verify the account view, 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.
319
319
 
320
320
  `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.
321
321
 
@@ -38,6 +38,10 @@ export const keychain = {
38
38
  },
39
39
  };
40
40
 
41
+ // Timing knobs for following OMP-side logouts; mutable so offline tests can
42
+ // run the delayed detection without real waits.
43
+ export const logoutFollow = { delayMs: 500, retryMs: 15_000 };
44
+
41
45
  function authReady() {
42
46
  return hasAntigravityAuth() || keychain.present() === true;
43
47
  }
@@ -121,6 +125,80 @@ export async function registerOmpAdapter(pi: any, stateDir: string) {
121
125
  await runtimes.closeAll();
122
126
  }
123
127
  });
128
+ // OMP's oauth contract has no logout hook: /logout only removes the stored
129
+ // marker credential. Watching the credential store's generation counter lets
130
+ // this adapter finish the Antigravity-side logout when OMP reports removal.
131
+ let watchingCredentials = false;
132
+ let markerPresent: boolean | undefined;
133
+ let suppressFollow = false;
134
+ let selfLogout = false;
135
+ let followTimer: ReturnType<typeof setTimeout> | undefined;
136
+ let followRetry: ReturnType<typeof setTimeout> | undefined;
137
+ function ompMarkerStored(ctx: any): boolean | undefined {
138
+ try {
139
+ return Boolean(ctx?.modelRegistry?.authStorage?.credentials?.getOAuth?.("antigravity-acp"));
140
+ } catch { return undefined; }
141
+ }
142
+ async function finishFollowedLogout(ctx: any) {
143
+ if (runtimes.values().some(bundle => bundle.isBusy())) {
144
+ // Never interrupt an in-flight Antigravity request; retry once idle.
145
+ clearTimeout(followRetry);
146
+ followRetry = setTimeout(() => {
147
+ followRetry = undefined;
148
+ if (ompMarkerStored(ctx) === false) void finishFollowedLogout(ctx);
149
+ }, logoutFollow.retryMs);
150
+ followRetry.unref?.();
151
+ return;
152
+ }
153
+ runtimes.get();
154
+ await Promise.all(runtimes.values().map(bundle => bundle.runtime.logout()));
155
+ await runtimes.closeAll();
156
+ const keychainRemoved = keychain.remove();
157
+ const after = inspectAntigravityAuth();
158
+ try {
159
+ ctx?.ui?.notify?.([
160
+ "Antigravity ACP: finished the logout OMP started.",
161
+ `ACP auth after logout: ${after.status}${after.authType ? ` (${after.authType})` : ""}`,
162
+ `macOS keychain entry: ${keychainRemoved === undefined ? "not applicable (non-macOS)" : keychainRemoved ? "removed" : "not present or not removable"}`,
163
+ "Saved ACP sessions: cleared",
164
+ "Run /antigravity-acp login or OMP /login to sign in again.",
165
+ ].join("\n"), "info");
166
+ } catch { /* the host UI may already be gone */ }
167
+ }
168
+ function watchOmpCredentials(ctx: any) {
169
+ if (watchingCredentials) return;
170
+ const credentials = ctx?.modelRegistry?.authStorage?.credentials;
171
+ if (!credentials?.getOAuth || !credentials.onGeneration) return;
172
+ const initial = ompMarkerStored(ctx);
173
+ if (initial === undefined) return;
174
+ watchingCredentials = true;
175
+ markerPresent = initial;
176
+ // Automatic soft-disables (for example an invalid_grant refresh) must not
177
+ // destroy the Antigravity-side login. OMP emits credential_disabled for
178
+ // those, but not for user-initiated removals such as /logout.
179
+ pi.on("credential_disabled", (event: any) => {
180
+ if (event?.provider === "antigravity-acp") suppressFollow = true;
181
+ });
182
+ credentials.onGeneration(() => {
183
+ const current = ompMarkerStored(ctx);
184
+ if (current === undefined) return;
185
+ const wasPresent = markerPresent === true;
186
+ markerPresent = current;
187
+ if (current) suppressFollow = false;
188
+ if (!wasPresent || current || selfLogout) return;
189
+ clearTimeout(followTimer);
190
+ followTimer = setTimeout(() => {
191
+ followTimer = undefined;
192
+ if (process.env.OMP_ACP_FOLLOW_LOGOUT === "0") return;
193
+ if (suppressFollow) { suppressFollow = false; return; }
194
+ // A quick re-login after the removal cancels the cleanup.
195
+ if (ompMarkerStored(ctx) !== false) return;
196
+ void finishFollowedLogout(ctx);
197
+ }, logoutFollow.delayMs);
198
+ followTimer.unref?.();
199
+ });
200
+ }
201
+ pi.on("session_start", async (_event: any, ctx: any) => { watchOmpCredentials(ctx); });
124
202
  pi.registerTool({
125
203
  name: PERMISSION_TOOL_NAME,
126
204
  label: "Antigravity ACP Permission",
@@ -141,6 +219,7 @@ export async function registerOmpAdapter(pi: any, stateDir: string) {
141
219
  pi.registerCommand("antigravity-acp", {
142
220
  description: "Inspect ACP status/account/tools/usage/context/cleanup, manage Antigravity login/logout, configure budgets, toggle debug, refresh models or set tool policies",
143
221
  async handler(args: string, ctx: any) {
222
+ watchOmpCredentials(ctx);
144
223
  const parts = args.trim().split(/\s+/);
145
224
  const [command, value] = parts;
146
225
  if (command === "cleanup") {
@@ -230,7 +309,10 @@ export async function registerOmpAdapter(pi: any, stateDir: string) {
230
309
  await Promise.all(runtimes.values().map(bundle => bundle.runtime.logout()));
231
310
  await runtimes.closeAll();
232
311
  const keychainRemoved = keychain.remove();
233
- const ompMarker = await removeOmpCredentialRecord(ctx);
312
+ // Removing the marker ourselves must not trigger the follow-up logout.
313
+ selfLogout = true;
314
+ let ompMarker: "removed" | "absent" | "unavailable";
315
+ try { ompMarker = await removeOmpCredentialRecord(ctx); } finally { selfLogout = false; }
234
316
  const after = inspectAntigravityAuth();
235
317
  ctx.ui.notify([
236
318
  "Antigravity ACP logout",
@@ -256,7 +338,7 @@ export async function registerOmpAdapter(pi: any, stateDir: string) {
256
338
  macOSKeychainEntry: keychain.present(),
257
339
  savedAcpSessions: runtimes.get(sessionIdOf(ctx)).runtime.sessionStore?.read().length ?? 0,
258
340
  runtime: { permissionMode: snapshot.permissionMode, activeSessions: snapshot.bindings },
259
- note: "Google OAuth tokens stay in Antigravity-owned storage (~/.gemini/antigravity-acp or the macOS keychain). OMP stores only a non-secret marker. /antigravity-acp logout clears both sides; OMP /logout removes only the marker.",
341
+ note: "Google OAuth tokens stay in Antigravity-owned storage (~/.gemini/antigravity-acp or the macOS keychain). OMP stores only a non-secret marker. /antigravity-acp logout clears both sides in one command; OMP /logout also triggers the Antigravity-side cleanup automatically (set OMP_ACP_FOLLOW_LOGOUT=0 to disable).",
260
342
  }, null, 2), "info");
261
343
  return;
262
344
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omp-antigravity-acp-provider",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Google Antigravity ACP provider for Oh My Pi (OMP), with tool bridging and per-model thinking; derived from zacbemis/pi-antigravity-acp-provider",
5
5
  "type": "module",
6
6
  "license": "MIT",