omp-antigravity-acp-provider 0.1.40 → 0.1.42
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 +4 -0
- package/extension/acp-runtime-source.ts +89 -6
- package/extension/commands.ts +7 -5
- package/extension/index.ts +31 -9
- package/extension/runtime.mjs +20 -2
- package/extension/tier-connection.ts +5 -1
- package/extension/tool-routing.ts +25 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,6 +114,10 @@ Session storage follows the server's own `--app_data_dir`. The generated wrapper
|
|
|
114
114
|
|
|
115
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
116
|
|
|
117
|
+
Permission IDs differ between the channels. Managed ACP 1.4.5 supports `default`, `auto_edit`, and `yolo` directly. CLI ACP 1.5.3 advertises `default`, `accept-edits`, and `plan` instead. The adapter maps `auto-edit` to `accept-edits`. For `yolo`, it selects wire mode `default` and passes the CLI's official `--dangerously-skip-permissions` flag. This preserves auto-approval instead of substituting `accept-edits`. Changing permission modes recreates the ACP runtime so a process with auto-approval cannot serve a later `default` or `auto-edit` request. An explicit `AGY_ACP_BIN` is left unchanged.
|
|
118
|
+
|
|
119
|
+
CLI ACP 1.5.3 omits `mcpCapabilities` from its initialization response, but it still discovers HTTP MCP servers and calls `tools/list`. The adapter normalizes this capability for that server identity so OMP tools remain available. CLI 1.5.3 reports no audio input, while the adapter's model catalog already limits input to text and images.
|
|
120
|
+
|
|
117
121
|
## Commands
|
|
118
122
|
|
|
119
123
|
| Command | Purpose |
|
|
@@ -26,25 +26,104 @@ export interface AcpRuntimePreference {
|
|
|
26
26
|
managedVersion?: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export type AcpRequestedPermissionMode = "default" | "auto_edit" | "yolo";
|
|
30
|
+
|
|
31
|
+
export interface AcpPermissionProfile {
|
|
32
|
+
requestedMode: AcpRequestedPermissionMode;
|
|
33
|
+
wireMode: "default" | "auto_edit" | "yolo" | "accept-edits";
|
|
34
|
+
autoApproveProcess: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function resolveAcpPermissionProfile(
|
|
38
|
+
preference: AcpRuntimePreference | undefined,
|
|
39
|
+
requestedMode: AcpRequestedPermissionMode,
|
|
40
|
+
): AcpPermissionProfile {
|
|
41
|
+
const modernCli = preference?.source === "cli" && preference.cliVersion !== undefined &&
|
|
42
|
+
compareVersions(preference.cliVersion, "1.5.3") >= 0;
|
|
43
|
+
return {
|
|
44
|
+
requestedMode,
|
|
45
|
+
wireMode: modernCli && requestedMode === "yolo" ? "default"
|
|
46
|
+
: modernCli && requestedMode === "auto_edit" ? "accept-edits" : requestedMode,
|
|
47
|
+
autoApproveProcess: modernCli && requestedMode === "yolo",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function assertSelectedAcpCliLaunch(
|
|
52
|
+
stateDir: string,
|
|
53
|
+
preference: AcpRuntimePreference | undefined,
|
|
54
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
55
|
+
): void {
|
|
56
|
+
if (preference?.source !== "cli") return;
|
|
57
|
+
const wrapper = path.join(stateDir, "agy-acp-cli.sh");
|
|
58
|
+
let intact = false;
|
|
59
|
+
try {
|
|
60
|
+
intact = preference.cliPath !== undefined && fs.readFileSync(wrapper, "utf8") === cliWrapperScript(preference.cliPath);
|
|
61
|
+
} catch {
|
|
62
|
+
// Missing and unreadable wrappers fail the same launch check.
|
|
63
|
+
}
|
|
64
|
+
if (env.AGY_ACP_BIN !== wrapper || !isExecutableFile(wrapper) || !intact) {
|
|
65
|
+
throw new Error(`Selected ACP CLI wrapper is missing, changed, not executable, or not selected by AGY_ACP_BIN: ${wrapper}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
29
69
|
export async function preferNewestAcpRuntime(
|
|
30
70
|
stateDir: string,
|
|
31
71
|
env: NodeJS.ProcessEnv = process.env,
|
|
32
72
|
home = os.homedir(),
|
|
33
73
|
): Promise<AcpRuntimePreference> {
|
|
34
|
-
|
|
74
|
+
const wrapper = path.join(stateDir, "agy-acp-cli.sh");
|
|
75
|
+
const configured = env.AGY_ACP_BIN?.trim();
|
|
76
|
+
// A wrapper written by this adapter is not a user override. A second
|
|
77
|
+
// extension instance can see the first instance's AGY_ACP_BIN and must
|
|
78
|
+
// recover the CLI profile instead of treating it as an explicit env runtime.
|
|
79
|
+
if (configured && path.resolve(configured) === path.resolve(wrapper)) {
|
|
80
|
+
const cli = await findAgyCli(env);
|
|
81
|
+
if (cli) {
|
|
82
|
+
const preference = { source: "cli", cliPath: cli.path, cliVersion: cli.version, managedVersion: readManagedVersion(home) } as const;
|
|
83
|
+
writeCliWrapper(wrapper, cli.path);
|
|
84
|
+
writeRuntimeSourceRecord(stateDir, preference);
|
|
85
|
+
env.AGY_ACP_BIN = wrapper;
|
|
86
|
+
return preference;
|
|
87
|
+
}
|
|
88
|
+
const recorded = readRuntimeSourceRecord(stateDir);
|
|
89
|
+
if (recorded) return recorded;
|
|
90
|
+
} else if (configured) {
|
|
91
|
+
return { source: "env" };
|
|
92
|
+
}
|
|
35
93
|
// The generated wrapper is a POSIX shell script that upstream launches
|
|
36
94
|
// directly; Windows cannot execute it, so it stays managed-only there.
|
|
37
95
|
if (process.platform === "win32") return { source: "managed" };
|
|
38
96
|
const cli = await findAgyCli(env);
|
|
39
97
|
const managedVersion = readManagedVersion(home);
|
|
40
98
|
if (!cli || (managedVersion && compareVersions(cli.version, managedVersion) <= 0)) {
|
|
99
|
+
if (configured) delete env.AGY_ACP_BIN;
|
|
41
100
|
return { source: "managed", cliPath: cli?.path, cliVersion: cli?.version, managedVersion };
|
|
42
101
|
}
|
|
43
|
-
const
|
|
102
|
+
const preference = { source: "cli", cliPath: cli.path, cliVersion: cli.version, managedVersion } as const;
|
|
44
103
|
writeCliWrapper(wrapper, cli.path);
|
|
104
|
+
writeRuntimeSourceRecord(stateDir, preference);
|
|
45
105
|
env.AGY_ACP_BIN = wrapper;
|
|
46
|
-
|
|
47
|
-
|
|
106
|
+
return preference;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function readRuntimeSourceRecord(stateDir: string): AcpRuntimePreference | undefined {
|
|
110
|
+
try {
|
|
111
|
+
const value = JSON.parse(fs.readFileSync(path.join(stateDir, "acp-runtime-source.json"), "utf8")) as {
|
|
112
|
+
source?: unknown;
|
|
113
|
+
cliPath?: unknown;
|
|
114
|
+
cliVersion?: unknown;
|
|
115
|
+
managedVersion?: unknown;
|
|
116
|
+
};
|
|
117
|
+
if (value.source !== "cli" || typeof value.cliPath !== "string" || typeof value.cliVersion !== "string") return undefined;
|
|
118
|
+
return {
|
|
119
|
+
source: "cli",
|
|
120
|
+
cliPath: value.cliPath,
|
|
121
|
+
cliVersion: value.cliVersion,
|
|
122
|
+
...(typeof value.managedVersion === "string" ? { managedVersion: value.managedVersion } : {}),
|
|
123
|
+
};
|
|
124
|
+
} catch {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
48
127
|
}
|
|
49
128
|
|
|
50
129
|
async function findAgyCli(env: NodeJS.ProcessEnv): Promise<{ path: string; version: string } | undefined> {
|
|
@@ -101,11 +180,15 @@ function compareVersions(left: string, right: string): number {
|
|
|
101
180
|
return 0;
|
|
102
181
|
}
|
|
103
182
|
|
|
104
|
-
function
|
|
183
|
+
function cliWrapperScript(agyPath: string): string {
|
|
105
184
|
// --app_data_dir=antigravity-acp is the managed .par's own default: the CLI
|
|
106
185
|
// binary would otherwise default to antigravity-cli, mixing ACP sessions
|
|
107
186
|
// with personal CLI chats outside session cleanup's tracked tree.
|
|
108
|
-
|
|
187
|
+
return `#!/bin/sh\nif [ -n "\${OMP_ACP_DANGEROUSLY_SKIP_PERMISSIONS:-}" ]; then\n set -- --dangerously-skip-permissions "$@"\nfi\nexec '${agyPath.replace(/'/g, "'\\''")}' acp --app_data_dir=antigravity-acp "$@"\n`;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function writeCliWrapper(file: string, agyPath: string): void {
|
|
191
|
+
const script = cliWrapperScript(agyPath);
|
|
109
192
|
try {
|
|
110
193
|
if (fs.readFileSync(file, "utf8") === script) return;
|
|
111
194
|
} catch {
|
package/extension/commands.ts
CHANGED
|
@@ -373,7 +373,7 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
|
373
373
|
// when a runtime for this session already exists.
|
|
374
374
|
const bundle = deps.peekRuntimeForSession(sessionIdOf(ctx));
|
|
375
375
|
const snapshot = await bundle?.runtime.snapshot();
|
|
376
|
-
const permissionMode =
|
|
376
|
+
const permissionMode = deps.getPermissionMode();
|
|
377
377
|
const omp = ompCredentialSummary(ctx);
|
|
378
378
|
const marker = omp.present === undefined ? "unknown (host did not expose the credential store)"
|
|
379
379
|
: omp.present ? `present, authorized ${omp.authorizedAt ?? "unknown time"}${omp.email ? ` as ${omp.email}` : ""} (${omp.record})`
|
|
@@ -428,9 +428,11 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
|
428
428
|
throw new Error("Usage: /antigravity-acp permissions default|auto-edit|yolo");
|
|
429
429
|
}
|
|
430
430
|
const mode = value.replace("-", "_");
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
431
|
+
if (mode !== deps.getPermissionMode()) {
|
|
432
|
+
savePermissionMode(mode, deps.configPath);
|
|
433
|
+
deps.setPermissionModeState(mode);
|
|
434
|
+
await deps.closeAllRuntimes();
|
|
435
|
+
}
|
|
434
436
|
}
|
|
435
437
|
const usageError = "Usage: /antigravity-acp [status|account|login|logout|tools|usage|context|cleanup|diagnostics|debug|native-tools|permissions|refresh]";
|
|
436
438
|
if (command && command !== "status" && command !== "tools" && command !== "permissions") {
|
|
@@ -455,7 +457,7 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
|
455
457
|
}
|
|
456
458
|
|
|
457
459
|
const policy = deps.getToolPolicy();
|
|
458
|
-
ctx.ui.notify(`Antigravity ACP (OMP adapter)\nAuth storage: ${(await authReady()) ? "configured (ACP-owned token file or macOS keychain)" : inspectAntigravityAuth().status}\
|
|
460
|
+
ctx.ui.notify(`Antigravity ACP (OMP adapter)\nAuth storage: ${(await authReady()) ? "configured (ACP-owned token file or macOS keychain)" : inspectAntigravityAuth().status}\nRequested permission mode: ${deps.getPermissionMode()}\nWire permission mode: ${snapshot.permissionMode}\nNative tools: ${policy.nativeTools}\nDebug tool updates: ${policy.debugToolUpdates ? "on" : "off"}\nTool routing: ${JSON.stringify([...deps.connections].map(connection => connection.toolRouting).filter(Boolean))}\nActive sessions: ${snapshot.bindings}\nConfirmed thinking: ${JSON.stringify([...deps.connections].map(connection => connection.confirmedThinking).filter(Boolean))}\nUsage: ${JSON.stringify(snapshot.metrics)}\n${JSON.stringify(snapshot.processes)}`, "info");
|
|
459
461
|
} finally {
|
|
460
462
|
lease.release();
|
|
461
463
|
}
|
package/extension/index.ts
CHANGED
|
@@ -4,7 +4,12 @@ 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 {
|
|
7
|
+
import {
|
|
8
|
+
assertSelectedAcpCliLaunch,
|
|
9
|
+
preferNewestAcpRuntime,
|
|
10
|
+
resolveAcpPermissionProfile,
|
|
11
|
+
type AcpRuntimePreference,
|
|
12
|
+
} from "./acp-runtime-source.ts";
|
|
8
13
|
import { SessionRuntimePool } from "./runtime-pool.ts";
|
|
9
14
|
import { createStructuredFingerprintMemo } from "./structured-fingerprint.ts";
|
|
10
15
|
import { Diagnostics, instrumentRuntime } from "./diagnostics.ts";
|
|
@@ -102,9 +107,14 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
|
|
|
102
107
|
|
|
103
108
|
// Loading this global extension must not start ACP or query Google.
|
|
104
109
|
let readiness: Promise<void> | undefined;
|
|
105
|
-
let runtimePreference: Promise<
|
|
110
|
+
let runtimePreference: Promise<AcpRuntimePreference | undefined> | undefined;
|
|
111
|
+
let selectedRuntimePreference: AcpRuntimePreference | undefined;
|
|
112
|
+
const currentPermissionProfile = () => resolveAcpPermissionProfile(selectedRuntimePreference, permissionMode);
|
|
106
113
|
function prepareRuntime() {
|
|
107
|
-
runtimePreference ??= preferNewestAcpRuntime(stateDir).
|
|
114
|
+
runtimePreference ??= preferNewestAcpRuntime(stateDir).then(preference => {
|
|
115
|
+
selectedRuntimePreference = preference;
|
|
116
|
+
return preference;
|
|
117
|
+
}).catch(() => undefined);
|
|
108
118
|
readiness ??= runtimePreference.then(() => ensureAntigravityAcpReady()).catch((error: unknown) => {
|
|
109
119
|
readiness = undefined;
|
|
110
120
|
throw error;
|
|
@@ -138,13 +148,24 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
|
|
|
138
148
|
audit: ToolAuditSummary;
|
|
139
149
|
} | undefined;
|
|
140
150
|
|
|
151
|
+
function spawnConnection(options: ConstructorParameters<typeof TierConnection>[0]): TierConnection {
|
|
152
|
+
const profile = currentPermissionProfile();
|
|
153
|
+
const env = {
|
|
154
|
+
...process.env,
|
|
155
|
+
...options.env,
|
|
156
|
+
OMP_ACP_DANGEROUSLY_SKIP_PERMISSIONS: profile.autoApproveProcess ? "1" : "",
|
|
157
|
+
};
|
|
158
|
+
assertSelectedAcpCliLaunch(stateDir, selectedRuntimePreference, env);
|
|
159
|
+
return createConnection({ ...options, env });
|
|
160
|
+
}
|
|
161
|
+
|
|
141
162
|
const lifecycle = new OmpSessionLifecycle(id => runtimes.close(id), async id => {
|
|
142
163
|
if (id) await cleanup.releaseSession(id);
|
|
143
164
|
});
|
|
144
165
|
const runtimes = new SessionRuntimePool<RuntimeBundleView>(() => {
|
|
145
166
|
const ownedConnections = new Set<TierConnection>();
|
|
146
167
|
const runtime = new AntigravityRuntime((options: ConstructorParameters<typeof TierConnection>[0]) => {
|
|
147
|
-
const connection =
|
|
168
|
+
const connection = spawnConnection({
|
|
148
169
|
...options,
|
|
149
170
|
ompNativeTools: toolPolicy.nativeTools,
|
|
150
171
|
ompDebugToolUpdates: toolPolicy.debugToolUpdates,
|
|
@@ -159,7 +180,7 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
|
|
|
159
180
|
ownedConnections.delete(connection);
|
|
160
181
|
});
|
|
161
182
|
return connection;
|
|
162
|
-
},
|
|
183
|
+
}, currentPermissionProfile().wireMode, sessionStore);
|
|
163
184
|
instrumentRuntime(runtime, diagnostics);
|
|
164
185
|
return {
|
|
165
186
|
runtime,
|
|
@@ -262,7 +283,7 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
|
|
|
262
283
|
prepareRuntime,
|
|
263
284
|
() => [...(FALLBACK_MODELS as PublicCatalogModel[])],
|
|
264
285
|
requireAcpAuth,
|
|
265
|
-
|
|
286
|
+
spawnConnection,
|
|
266
287
|
);
|
|
267
288
|
let initialModels = catalogStore.loadInitialOrCached(contextSettings);
|
|
268
289
|
|
|
@@ -365,7 +386,7 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
|
|
|
365
386
|
const routingId = options?.sessionId;
|
|
366
387
|
routing.noteStream(routingId);
|
|
367
388
|
let routingFailed = false;
|
|
368
|
-
const ticket = lifecycle.capture(
|
|
389
|
+
const ticket = lifecycle.capture(routingId, options?.providerSessionState);
|
|
369
390
|
void (async () => {
|
|
370
391
|
try {
|
|
371
392
|
if (options?.signal?.aborted) throw new Error("ACP request cancelled before startup");
|
|
@@ -377,11 +398,12 @@ export async function registerOmpAdapter(pi: OmpHostApi, stateDir: string,
|
|
|
377
398
|
const original = catalogStore.upstreamModels.get(model.id);
|
|
378
399
|
if (!original) throw new Error(`Antigravity model was not discovered: ${model.id}. Run /antigravity-acp refresh.`);
|
|
379
400
|
await lifecycle.ready(ticket);
|
|
380
|
-
const lease = runtimes.acquire(
|
|
401
|
+
const lease = runtimes.acquire(routingId);
|
|
381
402
|
const { runtime, provider } = lease.value;
|
|
382
403
|
try {
|
|
383
404
|
lifecycle.attach(ticket, lease.value);
|
|
384
|
-
|
|
405
|
+
await runtime.setPermissionMode(currentPermissionProfile().wireMode);
|
|
406
|
+
const stream = provider.streamSimple(selectRuntimeModel(original, options?.reasoning), routedContext, { ...options, sessionId: routingId });
|
|
385
407
|
for await (const event of stream) {
|
|
386
408
|
const message = event.message ?? event.partial;
|
|
387
409
|
if (message?.usage) applyApiCostEstimate(model.id, message.usage, message.timestamp ?? Date.now());
|
package/extension/runtime.mjs
CHANGED
|
@@ -24341,10 +24341,25 @@ function systemRouting(mode) {
|
|
|
24341
24341
|
return TOOL_ROUTING + (mode === "disabled" ? "\nAntigravity-native tools are disabled for this session. Report a missing capability instead of substituting one." : "");
|
|
24342
24342
|
}
|
|
24343
24343
|
var OFFICIAL_AGENT_NAMES = /* @__PURE__ */ new Set(["antigravity-acp", "Antigravity ACP Server"]);
|
|
24344
|
-
function
|
|
24344
|
+
function isOfficialAgentAtLeast(initialize, minor, patch) {
|
|
24345
24345
|
const name = initialize?.agentInfo?.name;
|
|
24346
24346
|
const version2 = initialize?.agentInfo?.version?.match(/^(\d+)\.(\d+)\.(\d+)$/);
|
|
24347
|
-
return typeof name === "string" && OFFICIAL_AGENT_NAMES.has(name) &&
|
|
24347
|
+
return typeof name === "string" && OFFICIAL_AGENT_NAMES.has(name) && !!version2 && Number(version2[1]) === 1 && (Number(version2[2]) > minor || Number(version2[2]) === minor && Number(version2[3]) >= patch);
|
|
24348
|
+
}
|
|
24349
|
+
function supportsSessionRouting(initialize) {
|
|
24350
|
+
return isOfficialAgentAtLeast(initialize, 4, 1) && initialize?.agentCapabilities?._meta?.antigravity?.systemPrompt?.append === true;
|
|
24351
|
+
}
|
|
24352
|
+
function normalizeInitializeResponse(initialize) {
|
|
24353
|
+
if (!isOfficialAgentAtLeast(initialize, 5, 3) || initialize.agentCapabilities?.mcpCapabilities?.http !== void 0) {
|
|
24354
|
+
return initialize;
|
|
24355
|
+
}
|
|
24356
|
+
return {
|
|
24357
|
+
...initialize,
|
|
24358
|
+
agentCapabilities: {
|
|
24359
|
+
...initialize.agentCapabilities,
|
|
24360
|
+
mcpCapabilities: { ...initialize.agentCapabilities?.mcpCapabilities, http: true }
|
|
24361
|
+
}
|
|
24362
|
+
};
|
|
24348
24363
|
}
|
|
24349
24364
|
function sessionRoutingRequest(request, initialize, mode) {
|
|
24350
24365
|
if (!supportsSessionRouting(initialize)) {
|
|
@@ -62482,6 +62497,9 @@ var TierConnection = class extends AntigravityAcpConnection {
|
|
|
62482
62497
|
});
|
|
62483
62498
|
}
|
|
62484
62499
|
}
|
|
62500
|
+
async initialize(signal) {
|
|
62501
|
+
return normalizeInitializeResponse(await super.initialize(signal));
|
|
62502
|
+
}
|
|
62485
62503
|
configureUsage(mode) {
|
|
62486
62504
|
this.usageMode = mode;
|
|
62487
62505
|
this.usageBaselines.clear();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// OMP effort -> vendored advertised legacy ID -> official model/thought selectors.
|
|
3
3
|
import { AntigravityAcpConnection } from "./vendor/pi-antigravity-acp-provider/src/acp/connection.ts";
|
|
4
4
|
import { choices, resolveSelection, selector } from "./selectors.ts";
|
|
5
|
-
import { installSessionRouting, type NativeToolMode } from "./tool-routing.ts";
|
|
5
|
+
import { installSessionRouting, normalizeInitializeResponse, type NativeToolMode } from "./tool-routing.ts";
|
|
6
6
|
import { showAcpUpdate } from "./activity-presentation.ts";
|
|
7
7
|
import { alignContextTokens, applyCompactionChunk, applyCompactionUpdate, isTerminalCompaction, type AcpCompactionNotice, type AcpCompactionRecord } from "./acp-compaction.ts";
|
|
8
8
|
import { AgentNoticeFilter } from "./agent-notices.ts";
|
|
@@ -143,6 +143,10 @@ export class TierConnection extends AntigravityAcpConnection {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
async initialize(signal?: AbortSignal) {
|
|
147
|
+
return normalizeInitializeResponse(await super.initialize(signal));
|
|
148
|
+
}
|
|
149
|
+
|
|
146
150
|
configureUsage(mode: "auto" | "off") {
|
|
147
151
|
this.usageMode = mode;
|
|
148
152
|
this.usageBaselines.clear();
|
|
@@ -19,11 +19,16 @@ const OFFICIAL_AGENT_NAMES = new Set(["antigravity-acp", "Antigravity ACP Server
|
|
|
19
19
|
export interface InitializeMetadata {
|
|
20
20
|
agentInfo?: { name?: string; version?: string };
|
|
21
21
|
agentCapabilities?: {
|
|
22
|
+
mcpCapabilities?: {
|
|
23
|
+
http?: boolean;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
22
26
|
_meta?: {
|
|
23
27
|
antigravity?: {
|
|
24
28
|
systemPrompt?: { append?: boolean };
|
|
25
29
|
};
|
|
26
30
|
};
|
|
31
|
+
[key: string]: unknown;
|
|
27
32
|
};
|
|
28
33
|
}
|
|
29
34
|
|
|
@@ -42,13 +47,30 @@ export interface SessionRpcRequest {
|
|
|
42
47
|
[key: string]: unknown;
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
function isOfficialAgentAtLeast(initialize: InitializeMetadata | undefined, minor: number, patch: number): boolean {
|
|
46
51
|
const name = initialize?.agentInfo?.name;
|
|
47
52
|
const version = initialize?.agentInfo?.version?.match(/^(\d+)\.(\d+)\.(\d+)$/);
|
|
48
53
|
return typeof name === "string" && OFFICIAL_AGENT_NAMES.has(name) &&
|
|
49
|
-
initialize.agentCapabilities?._meta?.antigravity?.systemPrompt?.append === true &&
|
|
50
54
|
!!version && Number(version[1]) === 1 &&
|
|
51
|
-
(Number(version[2]) >
|
|
55
|
+
(Number(version[2]) > minor || (Number(version[2]) === minor && Number(version[3]) >= patch));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function supportsSessionRouting(initialize: InitializeMetadata | undefined): boolean {
|
|
59
|
+
return isOfficialAgentAtLeast(initialize, 4, 1) &&
|
|
60
|
+
initialize?.agentCapabilities?._meta?.antigravity?.systemPrompt?.append === true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function normalizeInitializeResponse<T extends InitializeMetadata>(initialize: T): T {
|
|
64
|
+
if (!isOfficialAgentAtLeast(initialize, 5, 3) || initialize.agentCapabilities?.mcpCapabilities?.http !== undefined) {
|
|
65
|
+
return initialize;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
...initialize,
|
|
69
|
+
agentCapabilities: {
|
|
70
|
+
...initialize.agentCapabilities,
|
|
71
|
+
mcpCapabilities: { ...initialize.agentCapabilities?.mcpCapabilities, http: true },
|
|
72
|
+
},
|
|
73
|
+
};
|
|
52
74
|
}
|
|
53
75
|
|
|
54
76
|
export function sessionRoutingRequest<T extends SessionRpcRequest>(request: T, initialize: InitializeMetadata | undefined, mode: NativeToolMode): T {
|
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.42",
|
|
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",
|