omp-antigravity-acp-provider 0.1.36 → 0.1.38
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/AGENT_INSTALL.md +4 -0
- package/README.md +20 -1
- package/extension/acp-runtime-source.ts +126 -0
- package/extension/commands.ts +144 -0
- package/extension/index.ts +13 -3
- package/package.json +3 -2
package/AGENT_INSTALL.md
CHANGED
|
@@ -18,5 +18,9 @@ Steps:
|
|
|
18
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
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
20
|
|
|
21
|
+
Notes:
|
|
22
|
+
- The adapter auto-selects the newer of the `agy` CLI's bundled server and its managed registry runtime; no channel configuration is required. An explicit `AGY_ACP_BIN` environment variable overrides the choice — do not set it unless the user asks.
|
|
23
|
+
- ACP sessions are stored under `~/.gemini/antigravity-acp/`. The user's personal `agy` CLI chats under `~/.gemini/antigravity-cli/` are never read or deleted by the adapter.
|
|
24
|
+
|
|
21
25
|
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
26
|
```
|
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ This is an independent adaptation, **NOT** an official Google or OMP integration
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
19
|
- All server-advertised models, including Claude, GPT-OSS and future IDs when the ACP endpoint advertises them.
|
|
20
|
+
- Newest-server auto-selection. When the `agy` CLI on PATH bundles a newer ACP server than the registry-installed runtime, the adapter launches it through a generated `AGY_ACP_BIN` wrapper, so CLI-first models appear without manual setup. An explicit `AGY_ACP_BIN` always wins.
|
|
20
21
|
- Per-model thinking levels, exposed only when the server confirms them.
|
|
21
22
|
- OMP tools through an authenticated loopback MCP bridge.
|
|
22
23
|
- Optional `disabled` native-tool mode for strict OMP-only sessions.
|
|
@@ -96,6 +97,23 @@ This shows the runtime, native-tool mode and usage state. Send a short prompt to
|
|
|
96
97
|
|
|
97
98
|
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.`
|
|
98
99
|
|
|
100
|
+
## ACP server channels and selection
|
|
101
|
+
|
|
102
|
+
Google ships the same ACP server through two channels; the adapter picks between them automatically at every OMP startup.
|
|
103
|
+
|
|
104
|
+
- **`agy` CLI** — the self-updating command-line product. When its bundled server is newer than the registry runtime, the adapter launches it through a generated `AGY_ACP_BIN` wrapper, so CLI-first models (for example Claude and GPT-OSS) appear without manual setup.
|
|
105
|
+
- **Managed runtime** — the registry-signed release downloaded and verified into `~/.local/opt/agy-acp/`. Used when the CLI is missing or not newer, and installed automatically when neither channel exists.
|
|
106
|
+
|
|
107
|
+
Selection order:
|
|
108
|
+
|
|
109
|
+
1. An explicit `AGY_ACP_BIN` always wins. Point it at an `agy acp`-capable executable or wrapper to force a channel.
|
|
110
|
+
2. Otherwise the newer server version wins; ties go to the managed runtime.
|
|
111
|
+
3. With neither present, the managed runtime is downloaded from Google's registry on next use.
|
|
112
|
+
|
|
113
|
+
Session storage follows the server's own `--app_data_dir`. The generated wrapper pins `antigravity-acp` — the managed runtime's own default — so CLI-launched ACP sessions land in `~/.gemini/antigravity-acp/`, where `/antigravity-acp cleanup` and session ownership tracking operate. Personal `agy` CLI chats stay in `~/.gemini/antigravity-cli/` and are never read or deleted by the adapter. `GEMINI_HOME` relocates the managed runtime's tree (upstream behavior); the `agy` CLI stores under `~/.gemini` regardless.
|
|
114
|
+
|
|
115
|
+
The active channel and its versions are recorded in `~/.omp/agent/antigravity-acp-provider/acp-runtime-source.json` whenever the CLI is chosen.
|
|
116
|
+
|
|
99
117
|
## Commands
|
|
100
118
|
|
|
101
119
|
| Command | Purpose |
|
|
@@ -108,12 +126,13 @@ The installation runbook is in [AGENT_INSTALL.md](AGENT_INSTALL.md). Hand that f
|
|
|
108
126
|
| `/antigravity-acp usage [auto\|off]` | Context occupancy and supplemental usage queries |
|
|
109
127
|
| `/antigravity-acp context` | Per-model context budgets |
|
|
110
128
|
| `/antigravity-acp cleanup [mode]` | Session-file cleanup policy |
|
|
129
|
+
| `/antigravity-acp diagnostics [on\|off\|reset]` | Adapter stage timing samples |
|
|
111
130
|
| `/antigravity-acp native-tools prefer\|disabled` | Native built-in tool policy |
|
|
112
131
|
| `/antigravity-acp tools` | Available and omitted OMP tool schemas |
|
|
113
132
|
| `/antigravity-acp debug on\|off` | ACP tool-status lines |
|
|
114
133
|
| `/antigravity-acp permissions default\|auto-edit\|yolo` | Permission mode |
|
|
115
134
|
|
|
116
|
-
|
|
135
|
+
The OMP input autocompletes this command. Type `/antigravity-acp ` to list the subcommands, and keep typing to filter them. Fixed values such as `permissions` modes and `context set` targets (default plus the cached model IDs) complete the same way.
|
|
117
136
|
|
|
118
137
|
## Steering and queued messages
|
|
119
138
|
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Google ships the same ACP server through two channels: the registry-signed
|
|
2
|
+
// runtime installed under ~/.local/opt/agy-acp, and the agy CLI, which bundles
|
|
3
|
+
// the server and self-updates on its own. The registry has lagged the CLI
|
|
4
|
+
// (Claude and GPT-OSS models arrived in the CLI's server first), so when the
|
|
5
|
+
// CLI on PATH is newer the adapter routes the launch through upstream's
|
|
6
|
+
// AGY_ACP_BIN override instead of modifying vendored code. An explicit
|
|
7
|
+
// AGY_ACP_BIN always wins, and every OMP process re-evaluates the choice so a
|
|
8
|
+
// registry release that moves back ahead reclaims the launch.
|
|
9
|
+
|
|
10
|
+
import { execFile } from "node:child_process";
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import os from "node:os";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import { promisify } from "node:util";
|
|
15
|
+
|
|
16
|
+
import { writeJsonAtomic } from "./fs-atomic.ts";
|
|
17
|
+
|
|
18
|
+
const execFileAsync = promisify(execFile);
|
|
19
|
+
|
|
20
|
+
const CLI_VERSION_TIMEOUT_MS = 5000;
|
|
21
|
+
|
|
22
|
+
export interface AcpRuntimePreference {
|
|
23
|
+
source: "env" | "cli" | "managed";
|
|
24
|
+
cliPath?: string;
|
|
25
|
+
cliVersion?: string;
|
|
26
|
+
managedVersion?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function preferNewestAcpRuntime(
|
|
30
|
+
stateDir: string,
|
|
31
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
32
|
+
home = os.homedir(),
|
|
33
|
+
): Promise<AcpRuntimePreference> {
|
|
34
|
+
if (env.AGY_ACP_BIN?.trim()) return { source: "env" };
|
|
35
|
+
// The generated wrapper is a POSIX shell script that upstream launches
|
|
36
|
+
// directly; Windows cannot execute it, so it stays managed-only there.
|
|
37
|
+
if (process.platform === "win32") return { source: "managed" };
|
|
38
|
+
const cli = await findAgyCli(env);
|
|
39
|
+
const managedVersion = readManagedVersion(home);
|
|
40
|
+
if (!cli || (managedVersion && compareVersions(cli.version, managedVersion) <= 0)) {
|
|
41
|
+
return { source: "managed", cliPath: cli?.path, cliVersion: cli?.version, managedVersion };
|
|
42
|
+
}
|
|
43
|
+
const wrapper = path.join(stateDir, "agy-acp-cli.sh");
|
|
44
|
+
writeCliWrapper(wrapper, cli.path);
|
|
45
|
+
env.AGY_ACP_BIN = wrapper;
|
|
46
|
+
writeRuntimeSourceRecord(stateDir, { source: "cli", cliPath: cli.path, cliVersion: cli.version, managedVersion });
|
|
47
|
+
return { source: "cli", cliPath: cli.path, cliVersion: cli.version, managedVersion };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function findAgyCli(env: NodeJS.ProcessEnv): Promise<{ path: string; version: string } | undefined> {
|
|
51
|
+
const agy = findExecutableOnPath("agy", env) ?? findExecutableOnPath("agy.exe", env);
|
|
52
|
+
if (!agy) return undefined;
|
|
53
|
+
try {
|
|
54
|
+
// `acp --version` both proves the subcommand exists and reports the
|
|
55
|
+
// bundled server version; a CLI without it must not be selected.
|
|
56
|
+
const { stdout } = await execFileAsync(agy, ["acp", "--version"], { timeout: CLI_VERSION_TIMEOUT_MS });
|
|
57
|
+
const version = /\d+\.\d+\.\d+/.exec(stdout)?.[0];
|
|
58
|
+
return version ? { path: agy, version } : undefined;
|
|
59
|
+
} catch {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function findExecutableOnPath(name: string, env: NodeJS.ProcessEnv): string | undefined {
|
|
65
|
+
for (const directory of (env.PATH ?? "").split(path.delimiter)) {
|
|
66
|
+
if (!directory) continue;
|
|
67
|
+
const candidate = path.join(directory, name);
|
|
68
|
+
if (isExecutableFile(candidate)) return candidate;
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function isExecutableFile(file: string): boolean {
|
|
74
|
+
try {
|
|
75
|
+
fs.accessSync(file, fs.constants.X_OK);
|
|
76
|
+
return fs.statSync(file).isFile();
|
|
77
|
+
} catch {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function readManagedVersion(home: string): string | undefined {
|
|
83
|
+
try {
|
|
84
|
+
const record = JSON.parse(
|
|
85
|
+
fs.readFileSync(path.join(home, ".local", "opt", "agy-acp", "current", "install-integrity.json"), "utf8"),
|
|
86
|
+
) as { version?: unknown };
|
|
87
|
+
return typeof record.version === "string" ? record.version : undefined;
|
|
88
|
+
} catch {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function compareVersions(left: string, right: string): number {
|
|
94
|
+
const parse = (value: string) => value.split(".").map(part => Number.parseInt(part, 10) || 0);
|
|
95
|
+
const a = parse(left);
|
|
96
|
+
const b = parse(right);
|
|
97
|
+
for (let index = 0; index < Math.max(a.length, b.length); index += 1) {
|
|
98
|
+
const difference = (a[index] ?? 0) - (b[index] ?? 0);
|
|
99
|
+
if (difference) return Math.sign(difference);
|
|
100
|
+
}
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function writeCliWrapper(file: string, agyPath: string): void {
|
|
105
|
+
// --app_data_dir=antigravity-acp is the managed .par's own default: the CLI
|
|
106
|
+
// binary would otherwise default to antigravity-cli, mixing ACP sessions
|
|
107
|
+
// with personal CLI chats outside session cleanup's tracked tree.
|
|
108
|
+
const script = `#!/bin/sh\nexec '${agyPath.replace(/'/g, "'\\''")}' acp --app_data_dir=antigravity-acp "$@"\n`;
|
|
109
|
+
try {
|
|
110
|
+
if (fs.readFileSync(file, "utf8") === script) return;
|
|
111
|
+
} catch {
|
|
112
|
+
// Absent or unreadable; write a fresh copy below.
|
|
113
|
+
}
|
|
114
|
+
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
115
|
+
const temporary = `${file}.${process.pid}.tmp`;
|
|
116
|
+
try {
|
|
117
|
+
fs.writeFileSync(temporary, script, { mode: 0o755 });
|
|
118
|
+
fs.renameSync(temporary, file);
|
|
119
|
+
} finally {
|
|
120
|
+
fs.rmSync(temporary, { force: true });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function writeRuntimeSourceRecord(stateDir: string, record: AcpRuntimePreference): void {
|
|
125
|
+
writeJsonAtomic(path.join(stateDir, "acp-runtime-source.json"), { ...record, decidedAt: new Date().toISOString() });
|
|
126
|
+
}
|
package/extension/commands.ts
CHANGED
|
@@ -84,6 +84,150 @@ export interface CommandControllerDeps {
|
|
|
84
84
|
onModelsUpdated: (models: ConfiguredCatalogModel[]) => void;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
// OMP's TUI forwards an extension command's getArgumentCompletions into its
|
|
88
|
+
// slash-command autocomplete (same wiring the built-in autoresearch command
|
|
89
|
+
// uses). Items replace the argument text after "/antigravity-acp ", so values
|
|
90
|
+
// carry a trailing space to keep chained completion flowing.
|
|
91
|
+
export interface AntigravityCompletionItem {
|
|
92
|
+
value: string;
|
|
93
|
+
label: string;
|
|
94
|
+
description: string;
|
|
95
|
+
hint?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface AntigravityCompletionDeps {
|
|
99
|
+
catalog: { currentModels: ReadonlyArray<{ id: string }> };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface SubcommandSpec {
|
|
103
|
+
name: string;
|
|
104
|
+
description: string;
|
|
105
|
+
usage?: string;
|
|
106
|
+
values?: Array<[label: string, description: string]>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const CONTEXT_SETTING_KEYS: Array<[label: string, description: string]> = [
|
|
110
|
+
["contextWindow", "Total context window in tokens"],
|
|
111
|
+
["maxTokens", "Maximum output tokens"],
|
|
112
|
+
["inputTokenBudget", "Maximum input tokens per request"],
|
|
113
|
+
["reserveTokens", "Tokens reserved for replies"],
|
|
114
|
+
["maxTransferBytes", "Context transfer byte budget"],
|
|
115
|
+
["maxImageBytes", "Per-image byte budget"],
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
const SUBCOMMANDS: SubcommandSpec[] = [
|
|
119
|
+
{ name: "status", description: "Runtime, permissions and usage report (default)" },
|
|
120
|
+
{ name: "account", description: "Signed-in Google account and credential state" },
|
|
121
|
+
{ name: "login", description: "Start a fresh Antigravity Google authorization" },
|
|
122
|
+
{ name: "logout", description: "Clear Antigravity credentials, saved sessions and the OMP marker" },
|
|
123
|
+
{ name: "tools", description: "Inspect the OMP↔ACP tool bridge" },
|
|
124
|
+
{
|
|
125
|
+
name: "usage",
|
|
126
|
+
description: "Usage accounting and connection state",
|
|
127
|
+
usage: "[auto|off]",
|
|
128
|
+
values: [["auto", "Query usage after each reply"], ["off", "Skip supplemental usage queries"]],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "context",
|
|
132
|
+
description: "Context window and transfer settings",
|
|
133
|
+
usage: "[set default|MODEL KEY NUMBER]",
|
|
134
|
+
values: [["set", "Override one setting for default or a model"]],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "cleanup",
|
|
138
|
+
description: "Collect saved ACP sessions now",
|
|
139
|
+
usage: "[off|conservative|timeout|balanced [DAYS]] | budget MAX_SESSIONS MAX_MIB",
|
|
140
|
+
values: [
|
|
141
|
+
["off", "Keep every saved session"],
|
|
142
|
+
["conservative", "Remove idle sessions (default)"],
|
|
143
|
+
["timeout", "Remove sessions idle for DAYS"],
|
|
144
|
+
["balanced", "Timeout cleanup plus budget enforcement"],
|
|
145
|
+
["budget", "Cap MAX_SESSIONS and MAX_MIB"],
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "diagnostics",
|
|
150
|
+
description: "Diagnostics collection status",
|
|
151
|
+
usage: "[on|off|reset]",
|
|
152
|
+
values: [
|
|
153
|
+
["on", "Enable diagnostics collection"],
|
|
154
|
+
["off", "Disable diagnostics collection"],
|
|
155
|
+
["reset", "Clear collected diagnostics"],
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "debug",
|
|
160
|
+
description: "Raw ACP tool-status display",
|
|
161
|
+
usage: "on|off",
|
|
162
|
+
values: [["on", "Show raw tool-status updates"], ["off", "Hide raw tool-status updates"]],
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "native-tools",
|
|
166
|
+
description: "Native ACP tool exposure",
|
|
167
|
+
usage: "prefer|disabled",
|
|
168
|
+
values: [["prefer", "Let OMP tools shadow ACP natives (default)"], ["disabled", "Expose ACP-native tools only"]],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "permissions",
|
|
172
|
+
description: "Requested ACP permission mode",
|
|
173
|
+
usage: "default|auto-edit|yolo",
|
|
174
|
+
values: [
|
|
175
|
+
["default", "Confirm edits and commands"],
|
|
176
|
+
["auto-edit", "Auto-accept edits"],
|
|
177
|
+
["yolo", "Auto-accept everything"],
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
{ name: "refresh", description: "Discover and cache advertised models" },
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
function completeValues(typed: string, values: Array<[label: string, description: string]>,
|
|
184
|
+
valueOf: (label: string) => string): AntigravityCompletionItem[] | null {
|
|
185
|
+
const prefix = typed.toLowerCase();
|
|
186
|
+
const matched = values.filter(([label]) => label.toLowerCase().startsWith(prefix));
|
|
187
|
+
return matched.length ? matched.map(([label, description]) => ({ value: valueOf(label), label, description })) : null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function createAntigravityArgumentCompletions(deps: AntigravityCompletionDeps) {
|
|
191
|
+
return function getArgumentCompletions(args: string): AntigravityCompletionItem[] | null {
|
|
192
|
+
const firstSpace = args.indexOf(" ");
|
|
193
|
+
if (firstSpace === -1) {
|
|
194
|
+
const typed = args.toLowerCase();
|
|
195
|
+
const matched = SUBCOMMANDS.filter(spec => spec.name.startsWith(typed));
|
|
196
|
+
return matched.length ? matched.map(spec => ({
|
|
197
|
+
value: `${spec.name} `,
|
|
198
|
+
label: spec.name,
|
|
199
|
+
description: spec.description,
|
|
200
|
+
hint: spec.usage ? `${spec.name.slice(typed.length)} ${spec.usage}` : undefined,
|
|
201
|
+
})) : null;
|
|
202
|
+
}
|
|
203
|
+
const name = args.slice(0, firstSpace).toLowerCase();
|
|
204
|
+
const spec = SUBCOMMANDS.find(entry => entry.name === name);
|
|
205
|
+
const rest = args.slice(firstSpace + 1);
|
|
206
|
+
if (!spec?.values) return null;
|
|
207
|
+
if (spec.name === "context") {
|
|
208
|
+
const restSpace = rest.indexOf(" ");
|
|
209
|
+
if (restSpace === -1) return completeValues(rest, spec.values, label => `context ${label} `);
|
|
210
|
+
if (rest.slice(0, restSpace).toLowerCase() !== "set") return null;
|
|
211
|
+
const target = rest.slice(restSpace + 1);
|
|
212
|
+
const targetSpace = target.indexOf(" ");
|
|
213
|
+
if (targetSpace === -1) {
|
|
214
|
+
const targets: Array<[label: string, description: string]> = [
|
|
215
|
+
["default", "Applied to every model"],
|
|
216
|
+
...deps.catalog.currentModels.map(model => [model.id, "Per-model override"] as [string, string]),
|
|
217
|
+
];
|
|
218
|
+
return completeValues(target, targets, label => `context set ${label} `);
|
|
219
|
+
}
|
|
220
|
+
const targetName = target.slice(0, targetSpace);
|
|
221
|
+
const settingKey = target.slice(targetSpace + 1);
|
|
222
|
+
if (settingKey.includes(" ")) return null;
|
|
223
|
+
const keys = [...CONTEXT_SETTING_KEYS];
|
|
224
|
+
if (targetName === "default") keys.push(["usageMode", "auto or off"]);
|
|
225
|
+
return completeValues(settingKey, keys, label => `context set ${targetName} ${label} `);
|
|
226
|
+
}
|
|
227
|
+
return completeValues(rest, spec.values, label => `${spec.name} ${label} `);
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
87
231
|
export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
88
232
|
const sessionIdOf = (ctx: OmpCommandContext | undefined): string | undefined => ctx?.sessionManager?.getSessionId?.();
|
|
89
233
|
|
package/extension/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import fs from "node:fs";
|
|
|
4
4
|
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { applyApiCostEstimate } from "./pricing.ts";
|
|
7
|
+
import { preferNewestAcpRuntime } from "./acp-runtime-source.ts";
|
|
7
8
|
import { SessionRuntimePool } from "./runtime-pool.ts";
|
|
8
9
|
import { createStructuredFingerprintMemo } from "./structured-fingerprint.ts";
|
|
9
10
|
import { Diagnostics, instrumentRuntime } from "./diagnostics.ts";
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
type OmpCommandContext,
|
|
26
27
|
} from "./auth-sync.ts";
|
|
27
28
|
import { CatalogStore } from "./catalog-store.ts";
|
|
28
|
-
import { createAntigravityCommandHandler, type RuntimeBundleView, type ToolAuditSummary } from "./commands.ts";
|
|
29
|
+
import { createAntigravityArgumentCompletions, createAntigravityCommandHandler, type AntigravityCompletionItem, type RuntimeBundleView, type ToolAuditSummary } from "./commands.ts";
|
|
29
30
|
import { formatCompactionNotice } from "./acp-compaction.ts";
|
|
30
31
|
import { classifyAcpFailure } from "./acp-errors.ts";
|
|
31
32
|
import {
|
|
@@ -52,7 +53,13 @@ interface OmpHostApi {
|
|
|
52
53
|
registerProvider: (name: string, config: unknown) => void;
|
|
53
54
|
unregisterProvider?: (name: string) => void;
|
|
54
55
|
registerTool: (tool: unknown) => void;
|
|
55
|
-
registerCommand: (name: string, command: {
|
|
56
|
+
registerCommand: (name: string, command: {
|
|
57
|
+
description: string;
|
|
58
|
+
handler: (args: string, ctx: OmpCommandContext) => Promise<void>;
|
|
59
|
+
// OMP's autocomplete calls this with the text after "/<name> " and renders
|
|
60
|
+
// the returned items; optional so older hosts simply skip completion.
|
|
61
|
+
getArgumentCompletions?: (args: string) => AntigravityCompletionItem[] | null | Promise<AntigravityCompletionItem[] | null>;
|
|
62
|
+
}) => void;
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
export function resolveAdapterStateDir(env: NodeJS.ProcessEnv = process.env, home = os.homedir()): string {
|
|
@@ -95,8 +102,10 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
|
|
|
95
102
|
|
|
96
103
|
// Loading this global extension must not start ACP or query Google.
|
|
97
104
|
let readiness: Promise<void> | undefined;
|
|
105
|
+
let runtimePreference: Promise<void> | undefined;
|
|
98
106
|
function prepareRuntime() {
|
|
99
|
-
|
|
107
|
+
runtimePreference ??= preferNewestAcpRuntime(stateDir).catch(() => undefined);
|
|
108
|
+
readiness ??= runtimePreference.then(() => ensureAntigravityAcpReady()).catch((error: unknown) => {
|
|
100
109
|
readiness = undefined;
|
|
101
110
|
throw error;
|
|
102
111
|
});
|
|
@@ -287,6 +296,7 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
|
|
|
287
296
|
adapted.registerProvider();
|
|
288
297
|
},
|
|
289
298
|
}),
|
|
299
|
+
getArgumentCompletions: createAntigravityArgumentCompletions({ catalog: catalogStore }),
|
|
290
300
|
});
|
|
291
301
|
|
|
292
302
|
const adapted = new Proxy(pi, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omp-antigravity-acp-provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
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",
|
|
@@ -46,11 +46,12 @@
|
|
|
46
46
|
"test:continuity": "node scripts/test-request-continuity.ts && node scripts/test-graceful-cancellation.ts",
|
|
47
47
|
"test:omp-compaction": "bun scripts/test-omp-compaction.ts",
|
|
48
48
|
"test:omp-sessions": "node scripts/test-omp-session-switch.ts",
|
|
49
|
-
"check": "npm run build && npm test && npm run test:cleanup && npm run test:continuity && npm run test:tools && npm run test:wire && npm run test:wire-tools && npm run test:wire-relay && npm run test:wire-tools-list && npm run test:graph && npm run test:commands && npm run test:auth",
|
|
49
|
+
"check": "npm run build && npm test && npm run test:cleanup && npm run test:continuity && npm run test:tools && npm run test:wire && npm run test:wire-tools && npm run test:wire-relay && npm run test:wire-tools-list && npm run test:graph && npm run test:commands && npm run test:auth && npm run test:runtime-source",
|
|
50
50
|
"prepack": "npm run build",
|
|
51
51
|
"prepublishOnly": "npm run check",
|
|
52
52
|
"test:graph": "bun scripts/test-load-graph.ts",
|
|
53
53
|
"test:tools": "node scripts/test-tool-set-sync.ts",
|
|
54
|
+
"test:runtime-source": "node scripts/test-acp-runtime-source.ts",
|
|
54
55
|
"probe:agy": "node scripts/probe-agy-limits.ts",
|
|
55
56
|
"test:wire": "node scripts/test-wire-acp.ts",
|
|
56
57
|
"test:wire-tools": "node scripts/test-wire-tools.ts",
|