omp-antigravity-acp-provider 0.1.8 → 0.1.9
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 +41 -4
- package/extension/index.ts +21 -4
- package/extension/runtime.mjs +759 -492
- package/extension/session-cleanup.ts +156 -0
- package/extension/tier-connection.ts +52 -2
- package/package.json +4 -2
- package/scripts/build.mjs +7 -1
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.
|
|
22
|
+
Version 0.1.9 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
|
|
|
@@ -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.
|
|
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.9** 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.
|
|
83
|
+
omp plugin install npm:omp-antigravity-acp-provider@0.1.9
|
|
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.
|
|
@@ -154,6 +154,10 @@ After upgrading from an older adapter, run `/antigravity-acp refresh` once to re
|
|
|
154
154
|
| `/antigravity-acp context` | Show saved settings and effective per-model budgets |
|
|
155
155
|
| `/antigravity-acp context set default KEY NUMBER` | Set a default token or payload setting |
|
|
156
156
|
| `/antigravity-acp context set MODEL KEY NUMBER` | Override one advertised model ID |
|
|
157
|
+
| `/antigravity-acp cleanup` | Show cleanup mode/deadline and check eligible local sessions |
|
|
158
|
+
| `/antigravity-acp cleanup off` | Disable automatic session-file deletion |
|
|
159
|
+
| `/antigravity-acp cleanup conservative` | Delete confirmed replaced/disposable sessions only (default) |
|
|
160
|
+
| `/antigravity-acp cleanup timeout DAYS` | Also delete inactive owned sessions after DAYS (default 7) |
|
|
157
161
|
| `/antigravity-acp tools` | Available and omitted OMP tool schemas after a request |
|
|
158
162
|
| `/antigravity-acp refresh` | Explicit network discovery and local catalog refresh |
|
|
159
163
|
| `/antigravity-acp native-tools prefer` | Prefer OMP tools; retain native built-ins (default) |
|
|
@@ -194,7 +198,7 @@ Never include those user data directories, OAuth callback URLs, account identifi
|
|
|
194
198
|
|
|
195
199
|
## Context continuity and local performance
|
|
196
200
|
|
|
197
|
-
The adapter now transfers complete replay history within a bounded budget, including historical image attachments. It no longer silently keeps only a 32,000-character history tail. If a transfer does not fit, it stops with an explicit error requesting OMP `/compact` or smaller attachments. This is a local transfer limit, not Antigravity's model context window or its internal compaction threshold. Active requests, history text and system instructions share the
|
|
201
|
+
The adapter now transfers complete replay history within a bounded budget, including historical image attachments. It no longer silently keeps only a 32,000-character history tail. If a transfer does not fit, it stops with an explicit error requesting OMP `/compact` or smaller attachments. This is a local transfer limit, not Antigravity's model context window or its internal compaction threshold. Active requests, history text and system instructions share the token and wire budgets; images also have a separate decoded-data limit. No automatic summarization or extra inference is added by the transfer layer.
|
|
198
202
|
|
|
199
203
|
Token budgets and wire payload size are independent; the former 500,000-byte clamp is removed. The default wire payload limit is 16 MiB, configurable up to 128 MiB. Image data additionally defaults to an 8 MiB decoded payload limit. 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.
|
|
200
204
|
|
|
@@ -234,6 +238,37 @@ Merge that map with existing model-specific entries before running the command.
|
|
|
234
238
|
|
|
235
239
|
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.
|
|
236
240
|
|
|
241
|
+
### Local ACP session cleanup
|
|
242
|
+
|
|
243
|
+
Session-file deletion is separate from the five-minute idle process shutdown. Configure one of three modes:
|
|
244
|
+
|
|
245
|
+
| Mode | Behavior |
|
|
246
|
+
| --- | --- |
|
|
247
|
+
| `off` | Keep session files, including replaced sessions. Ownership/lease bookkeeping remains enabled so cleanup can be enabled later. |
|
|
248
|
+
| `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. |
|
|
249
|
+
| `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. |
|
|
250
|
+
|
|
251
|
+
```text
|
|
252
|
+
/antigravity-acp cleanup
|
|
253
|
+
/antigravity-acp cleanup off
|
|
254
|
+
/antigravity-acp cleanup conservative
|
|
255
|
+
/antigravity-acp cleanup timeout 7
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Settings persist in `~/.omp/agent/antigravity-acp-provider/cleanup.json`:
|
|
259
|
+
|
|
260
|
+
```json
|
|
261
|
+
{ "mode": "conservative", "idleDays": 7 }
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
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.
|
|
265
|
+
|
|
266
|
+
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.
|
|
267
|
+
|
|
268
|
+
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.
|
|
269
|
+
|
|
270
|
+
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.
|
|
271
|
+
|
|
237
272
|
Optional environment settings, applied when OMP starts:
|
|
238
273
|
|
|
239
274
|
| Setting | Default | Effect |
|
|
@@ -244,6 +279,8 @@ Optional environment settings, applied when OMP starts:
|
|
|
244
279
|
|
|
245
280
|
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.
|
|
246
281
|
|
|
282
|
+
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.
|
|
283
|
+
|
|
247
284
|
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.
|
|
248
285
|
|
|
249
286
|
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.
|
package/extension/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { EFFORTS, projectCatalog, readModels, selectRuntimeModel } from "./model
|
|
|
12
12
|
import { advertisedRecord, choices, selector } from "./selectors.ts";
|
|
13
13
|
import { TOOL_ROUTING, parseNativeToolMode } from "./tool-routing.ts";
|
|
14
14
|
import { loadNativeToolMode, loadToolPolicy, saveNativeToolMode, saveDebugToolUpdates } from "./tool-policy.ts";
|
|
15
|
-
import { Type, createAntigravityProvider, AntigravityRuntime, PERMISSION_TOOL_NAME, PERMISSION_RESULT_KIND, loadConfig, savePermissionMode, inspectAntigravityAuth, hasAntigravityAuth, AcpSessionStore, ensureAntigravityAcpReady, TierConnection, planToolProjection, PiEventWriter } from "./runtime.mjs";
|
|
15
|
+
import { Type, createAntigravityProvider, AntigravityRuntime, PERMISSION_TOOL_NAME, PERMISSION_RESULT_KIND, loadConfig, savePermissionMode, inspectAntigravityAuth, hasAntigravityAuth, AcpSessionStore, ensureAntigravityAcpReady, TierConnection, planToolProjection, PiEventWriter, SessionCleanup } from "./runtime.mjs";
|
|
16
16
|
|
|
17
17
|
const MARKER = "pi-antigravity-acp:managed-by-antigravity";
|
|
18
18
|
|
|
@@ -37,6 +37,7 @@ export async function registerOmpAdapter(pi: any, stateDir: string) {
|
|
|
37
37
|
const toolPolicyPath = path.join(stateDir, "omp-tools.json");
|
|
38
38
|
const contextPath = path.join(stateDir, "context.json");
|
|
39
39
|
let contextSettings = loadContextSettings(contextPath);
|
|
40
|
+
const cleanup = new SessionCleanup(stateDir);
|
|
40
41
|
// Loading this global extension must not start ACP or query Google.
|
|
41
42
|
let readiness: Promise<void> | undefined;
|
|
42
43
|
function prepareRuntime() {
|
|
@@ -57,7 +58,7 @@ export async function registerOmpAdapter(pi: any, stateDir: string) {
|
|
|
57
58
|
const runtime = new AntigravityRuntime((options: any) => {
|
|
58
59
|
const policy = loadToolPolicy(toolPolicyPath);
|
|
59
60
|
const connection = new TierConnection({ ...options, ompNativeTools: policy.nativeTools, ompDebugToolUpdates: policy.debugToolUpdates,
|
|
60
|
-
ompUsageMode: contextSettings.defaults.usageMode ?? "auto" });
|
|
61
|
+
ompUsageMode: contextSettings.defaults.usageMode ?? "auto", ompCleanup: cleanup });
|
|
61
62
|
connections.add(connection);
|
|
62
63
|
ownedConnections.add(connection);
|
|
63
64
|
void connection.process.exited.finally(() => connections.delete(connection));
|
|
@@ -94,10 +95,23 @@ export async function registerOmpAdapter(pi: any, stateDir: string) {
|
|
|
94
95
|
},
|
|
95
96
|
});
|
|
96
97
|
pi.registerCommand("antigravity-acp", {
|
|
97
|
-
description: "Inspect ACP status/tools/usage/context, configure budgets, toggle debug, refresh models or set tool policies",
|
|
98
|
+
description: "Inspect ACP status/tools/usage/context/cleanup, configure budgets, toggle debug, refresh models or set tool policies",
|
|
98
99
|
async handler(args: string, ctx: any) {
|
|
99
100
|
const parts = args.trim().split(/\s+/);
|
|
100
101
|
const [command, value] = parts;
|
|
102
|
+
if (command === "cleanup") {
|
|
103
|
+
if (value) {
|
|
104
|
+
if (!["off", "conservative", "timeout"].includes(value) || parts.length > 3 || (parts[2] !== undefined && value !== "timeout")) {
|
|
105
|
+
throw new Error("Usage: /antigravity-acp cleanup [off|conservative|timeout [DAYS]]");
|
|
106
|
+
}
|
|
107
|
+
cleanup.configure(value, parts[2] === undefined ? undefined : Number(parts[2]));
|
|
108
|
+
cleanup.start();
|
|
109
|
+
}
|
|
110
|
+
const removed = cleanup.collect();
|
|
111
|
+
ctx.ui.notify(JSON.stringify({ ...cleanup.status(), removed,
|
|
112
|
+
note: "Active sessions are protected. Timeout cleanup loses ACP-only state; OMP history is retained." }, null, 2), "info");
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
101
115
|
if (command === "context") {
|
|
102
116
|
if (value === "set") {
|
|
103
117
|
const [, , target, key, raw] = parts;
|
|
@@ -193,10 +207,12 @@ export async function registerOmpAdapter(pi: any, stateDir: string) {
|
|
|
193
207
|
}
|
|
194
208
|
async function discoverModels() {
|
|
195
209
|
await prepareRuntime();
|
|
196
|
-
const connection = new TierConnection({ cwd: process.cwd() });
|
|
210
|
+
const connection = new TierConnection({ cwd: process.cwd(), ompCleanup: cleanup });
|
|
211
|
+
let discoveredSession: string | undefined;
|
|
197
212
|
try {
|
|
198
213
|
await connection.initialize();
|
|
199
214
|
const session = await connection.newSession(process.cwd());
|
|
215
|
+
discoveredSession = session.sessionId;
|
|
200
216
|
const modern = choices(selector(session, "model"));
|
|
201
217
|
if (modern.length) {
|
|
202
218
|
const models = [];
|
|
@@ -212,6 +228,7 @@ export async function registerOmpAdapter(pi: any, stateDir: string) {
|
|
|
212
228
|
if (!models.length) throw new Error("Antigravity did not advertise any models");
|
|
213
229
|
return models;
|
|
214
230
|
} finally {
|
|
231
|
+
if (discoveredSession) connection.discardSession(discoveredSession);
|
|
215
232
|
await connection.close();
|
|
216
233
|
}
|
|
217
234
|
}
|