omp-antigravity-acp-provider 0.1.43 → 0.1.44
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 +2 -1
- package/README.md +46 -14
- package/extension/acp-errors.ts +12 -8
- package/extension/acp-runtime-source.ts +129 -50
- package/extension/adapter-config.ts +104 -0
- package/extension/assets/src/acp/supervisor.mjs +17 -8
- package/extension/commands.ts +11 -3
- package/extension/diagnostics.ts +5 -1
- package/extension/index.ts +78 -12
- package/extension/lock-release.ts +13 -0
- package/extension/pricing.ts +92 -16
- package/extension/proxy-env.ts +23 -0
- package/extension/quota-usage.ts +254 -0
- package/extension/redact.ts +51 -0
- package/extension/runtime.mjs +420 -185
- package/extension/session-cleanup.ts +25 -6
- package/extension/session-store.ts +12 -2
- package/extension/tier-connection.ts +9 -6
- package/extension/tool-args.ts +96 -0
- package/extension/tool-relay.ts +16 -8
- package/extension/turn-cancellation.ts +11 -3
- package/extension/usage-accounting.ts +69 -1
- package/package.json +4 -2
package/AGENT_INSTALL.md
CHANGED
|
@@ -19,7 +19,8 @@ Steps:
|
|
|
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
21
|
Notes:
|
|
22
|
-
- The adapter
|
|
22
|
+
- The adapter prefers a usable `agy` CLI and falls back to the managed registry runtime. It never installs the CLI. An explicit `AGY_ACP_BIN` environment variable overrides the choice. Do not set it unless the user asks.
|
|
23
|
+
- To pin a channel, set `runtimeSource` in `~/.omp/agent/antigravity-acp-provider/config.json` to `auto`, `cli`, or `managed`. A pinned source fails instead of downloading the other channel.
|
|
23
24
|
- 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
25
|
|
|
25
26
|
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.
|
package/README.md
CHANGED
|
@@ -17,27 +17,30 @@ 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
|
-
-
|
|
20
|
+
- CLI-first selection. When a usable `agy` CLI is on `PATH`, the adapter launches it through a generated `AGY_ACP_BIN` wrapper. The managed runtime is the fallback. An explicit `AGY_ACP_BIN` always wins.
|
|
21
21
|
- Per-model thinking levels, exposed only when the server confirms them.
|
|
22
22
|
- OMP tools through an authenticated loopback MCP bridge.
|
|
23
23
|
- Optional `disabled` native-tool mode for strict OMP-only sessions.
|
|
24
24
|
- Lazy ACP startup and warm session reuse.
|
|
25
25
|
- `/login` plus `/antigravity-acp` account, usage and cleanup commands.
|
|
26
|
-
- API-equivalent cost estimates, not subscription billing.
|
|
26
|
+
- API-equivalent cost estimates from a model-ID rate table, not subscription billing. ACP model records do not include price fields.
|
|
27
27
|
- Long-running OMP tools survive the MCP request window through a relay. The model resumes the same result with `pi_omp_await_result`; the control tool is a separate MCP server and never appears in OMP's tool list.
|
|
28
28
|
- Permission requests are tied to the originating session, turn and tool call. Forged, conflicting or previous-turn identities fail closed, while normal requests still use OMP's human review.
|
|
29
29
|
- The MCP `tools/list` reflects the current OMP tool set. The offline wire test covers add, remove and restore on one warm ACP session.
|
|
30
|
+
- Tool-argument hardening on the MCP bridge. Habitual alias mistakes such as `path` for `file_path` are corrected only when the tool schema makes the mapping unambiguous, and rejected calls return the missing required keys plus the tool's expected signature instead of a bare schema failure.
|
|
31
|
+
- Loopback traffic always bypasses proxied environments. When `HTTP(S)_PROXY` or `ALL_PROXY` is set for the ACP child process, the adapter appends `localhost`, `127.0.0.1` and `::1` to `NO_PROXY`/`no_proxy` so the loopback MCP bridge is never routed through an external proxy.
|
|
32
|
+
- OAuth material is redacted from failure text. Authorization URLs, sensitive query values, `Bearer` tokens and OAuth pairs such as `code_challenge` or `access_token` are masked before messages reach OMP, while ordinary diagnostics like `exit code=1` stay intact.
|
|
30
33
|
|
|
31
34
|
## Install: for human
|
|
32
35
|
|
|
33
|
-
Follow these steps in order. The whole flow takes a few minutes, plus Google's sign-in
|
|
36
|
+
Follow these steps in order. The whole flow takes a few minutes, plus Google's sign-in. A runtime download is only needed when no usable `agy` CLI is installed.
|
|
34
37
|
|
|
35
38
|
### 1. Check prerequisites
|
|
36
39
|
|
|
37
40
|
- OMP is installed and `omp --version` works.
|
|
38
41
|
- Node.js 22.19 or newer (`node --version`) and npm are on `PATH`; the marketplace launcher uses them on first load.
|
|
39
42
|
- A supported platform: macOS, Linux or Windows. Live testing has been on macOS.
|
|
40
|
-
- Internet access
|
|
43
|
+
- Internet access when no usable `agy` CLI is installed. The managed fallback downloads separately (about 383 MiB on macOS) into `~/.local/opt/agy-acp/`.
|
|
41
44
|
|
|
42
45
|
### 2. Install exactly one adapter
|
|
43
46
|
|
|
@@ -99,16 +102,43 @@ The installation runbook is in [AGENT_INSTALL.md](AGENT_INSTALL.md). Hand that f
|
|
|
99
102
|
|
|
100
103
|
## ACP server channels and selection
|
|
101
104
|
|
|
102
|
-
Google ships the same ACP server through two channels
|
|
105
|
+
Google ships the same ACP server through two channels. The adapter chooses one at every OMP startup.
|
|
103
106
|
|
|
104
|
-
- **`agy` CLI
|
|
105
|
-
- **Managed runtime
|
|
107
|
+
- **`agy` CLI.** Preferred whenever `agy` or `agy.exe` is on `PATH` and `agy acp --version` returns a semantic version. The adapter writes `agy-acp-cli.sh` or `agy-acp-cli.cmd` and points `AGY_ACP_BIN` at that wrapper.
|
|
108
|
+
- **Managed runtime.** The registry-signed release in `~/.local/opt/agy-acp/`. It is the fallback when the CLI is missing or unusable.
|
|
106
109
|
|
|
107
110
|
Selection order:
|
|
108
111
|
|
|
109
|
-
1. An explicit `AGY_ACP_BIN`
|
|
110
|
-
2.
|
|
111
|
-
3.
|
|
112
|
+
1. An explicit non-wrapper `AGY_ACP_BIN` wins. The adapter's generated wrapper is not a user override.
|
|
113
|
+
2. If `runtimeSource` is `cli` or `managed`, the adapter uses that source exclusively. A missing pinned source fails the first ACP use and is not downloaded.
|
|
114
|
+
3. If `runtimeSource` is `auto`, a usable CLI wins, even when its version is older than the managed runtime.
|
|
115
|
+
4. In `auto`, if the CLI is missing or unusable, the adapter uses the managed runtime. If the managed runtime is missing, it downloads it from Google's registry.
|
|
116
|
+
5. In `auto`, if writing the CLI wrapper or runtime record fails, the adapter falls back to the managed runtime.
|
|
117
|
+
|
|
118
|
+
The adapter never installs the `agy` CLI. It downloads the managed runtime only in `auto` when no usable CLI is selected. Inference and quota use the same selection.
|
|
119
|
+
|
|
120
|
+
On the first session start after OMP launches, the adapter attempts one background model refresh. A successful refresh re-registers the provider so newly advertised models and their API-equivalent rates become available. If login or ACP startup fails, the cached catalog remains usable and `/antigravity-acp refresh` still forces a refresh.
|
|
121
|
+
|
|
122
|
+
Create or edit `~/.omp/agent/antigravity-acp-provider/config.json`:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"permissions": "yolo",
|
|
127
|
+
"runtimeSource": "auto",
|
|
128
|
+
"nativeTools": "prefer",
|
|
129
|
+
"debugToolUpdates": false,
|
|
130
|
+
"usageMode": "off",
|
|
131
|
+
"diagnostics": false
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`permissions` accepts `default`, `auto_edit`, or `yolo`. `runtimeSource` accepts `auto`, `cli`, or `managed`. `nativeTools` accepts `prefer` or `disabled`. `usageMode` accepts `auto` or `off`. `debugToolUpdates` and `diagnostics` are booleans. Missing fields use these defaults: `permissions: "yolo"`, `runtimeSource: "auto"`, `nativeTools: "prefer"`, `debugToolUpdates: false`, `usageMode: "off"`, and `diagnostics: false`. Slash commands write the command-backed fields and keep the legacy setting files in sync. Context budgets remain in `context.json`; cleanup policy remains in `cleanup.json`.
|
|
136
|
+
|
|
137
|
+
- `auto` uses the CLI first and falls back to the managed runtime. If no usable CLI exists, it downloads the managed runtime.
|
|
138
|
+
- `cli` requires a usable `agy` CLI. If the CLI is missing or unusable, the first ACP use fails and nothing is downloaded.
|
|
139
|
+
- `managed` requires the managed runtime. If it is missing, the first ACP use fails and nothing is downloaded.
|
|
140
|
+
|
|
141
|
+
A pinned source never falls back to the other channel and never downloads it. An explicit non-wrapper `AGY_ACP_BIN` still wins over this setting. If `PI_CODING_AGENT_DIR` is set, use its actual path for `config.json`. Other `runtimeSource` values fail provider startup.
|
|
112
142
|
|
|
113
143
|
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
144
|
|
|
@@ -122,7 +152,7 @@ CLI ACP 1.5.3 omits `mcpCapabilities` from its initialization response, but it s
|
|
|
122
152
|
|
|
123
153
|
ACP may report live occupancy with `usage_update`. When it does, the adapter forwards that server value. When a runtime (for example CLI ACP 1.5.4) reports only cumulative billable usage, the adapter estimates the full OMP context from the system prompt, retained messages and tool schemas with `estimateTransferTokens`, then sets `usage.contextTokens` and marks `contextTokensSource: "estimate"`. The billable `input`, `cacheRead` and `output` counters are left untouched.
|
|
124
154
|
|
|
125
|
-
The estimate is a heuristic, not a server measurement.
|
|
155
|
+
The estimate is a heuristic, not a server measurement. To use managed ACP when exact occupancy matters, set `AGY_ACP_BIN` to the managed binary. CLI-first selection does not switch automatically. In this source checkout, `scripts/with-managed-context.sh` starts OMP with the installed managed binary while preserving an explicit `AGY_ACP_BIN`. Run `/antigravity-acp refresh` afterward to inspect the models that runtime actually advertises.
|
|
126
156
|
|
|
127
157
|
Keep `compaction.autoContinue` enabled for normal long-running work. The false context rollover was fixed at the occupancy signal, not by disabling automatic continuation.
|
|
128
158
|
|
|
@@ -144,7 +174,9 @@ Use the `/antigravity-acp ` prefix once, followed by a row below. For example, `
|
|
|
144
174
|
| `usage auto` | Query supplemental usage after each reply. Context occupancy updates remain enabled. |
|
|
145
175
|
| `usage off` | Skip supplemental queries without disabling context occupancy updates. |
|
|
146
176
|
|
|
147
|
-
Quota results use a
|
|
177
|
+
Quota results use a 60-second cache. When the adapter selects the CLI, the quota command runs the CLI's print-mode `/usage` command with the same `--app_data_dir` as the CLI ACP wrapper. When it selects managed ACP, the quota command uses a short-lived ACP session. An explicit `AGY_ACP_BIN` remains authoritative. If an ACP runtime does not advertise `usage`, the adapter reports the limitation without sending a model prompt. The quota display excludes usage counters for temporary ACP sessions.
|
|
178
|
+
|
|
179
|
+
OMP's built-in `omp usage`, interactive `/usage`, and the statusline `usage` segment read the same quota through the provider's registered usage source. The adapter uses the CLI `/usage` command first and queries an installed managed runtime only when the user is signed in. A usage probe never downloads a runtime. Statusline selects the active model's limit group when that group maps to one model. Multi-model groups remain visible in `/usage`. The custom `/antigravity-acp quota` command remains the detailed text view.
|
|
148
180
|
|
|
149
181
|
### Advanced maintenance
|
|
150
182
|
|
|
@@ -177,7 +209,7 @@ The OMP input autocompletes this command. Type `/antigravity-acp ` to list the s
|
|
|
177
209
|
|
|
178
210
|
## Steering and queued messages
|
|
179
211
|
|
|
180
|
-
By default a new user message waits for the active ACP turn to finish (`OMP_ACP_STEER_MODE=queue`) and then continues on the warm session, avoiding a full replay and OMP auto-compaction. Set `OMP_ACP_STEER_MODE=steer` to restore immediate interruption. At tool/permission boundaries the adapter falls back to steer and waits for the ACP terminal response; `OMP_ACP_STEER_GRACE_MS` (default 60000) and `OMP_ACP_STEER_GRACE_MAX_MS` (default 300000) bound that wait.
|
|
212
|
+
By default a new user message waits for the active ACP turn to finish (`OMP_ACP_STEER_MODE=queue`) and then continues on the warm session, avoiding a full replay and OMP auto-compaction. Set `OMP_ACP_STEER_MODE=steer` to restore immediate interruption. At tool/permission boundaries the adapter falls back to steer and waits for the ACP terminal response; `OMP_ACP_STEER_GRACE_MS` (default 60000) and `OMP_ACP_STEER_GRACE_MAX_MS` (default 300000) bound that wait. Explicit user cancellation is never held: the adapter aborts the upstream prompt immediately, so the ACP server receives `session/cancel` at once. Queue steering still holds the active turn, and the graceful drain and checkpoint reuse semantics are unchanged.
|
|
181
213
|
|
|
182
214
|
ACP runtimes stay warm for 15 minutes by default. Set `OMP_ACP_IDLE_TIMEOUT_MS=0` to keep them until OMP exits, or lower the value to reclaim memory sooner.
|
|
183
215
|
|
|
@@ -207,7 +239,7 @@ A `refusal` stop reason is reported as an explicit provider refusal. An empty `e
|
|
|
207
239
|
- No guaranteed prompt-cache hits, cache discounts, or identical tokenization.
|
|
208
240
|
- No full native history or hidden reasoning across a cold rebuild; server-side compaction is outside adapter control.
|
|
209
241
|
- No per-tool native allowlist; `native-tools` supports only `prefer` and `disabled`, and global MCP servers remain.
|
|
210
|
-
- No standalone client;
|
|
242
|
+
- No standalone client; a usable ACP server, either the `agy` CLI or the managed runtime, is required.
|
|
211
243
|
|
|
212
244
|
Detailed behavior, advanced settings and limitations: [docs/](docs/) and [CHANGELOG.md](CHANGELOG.md).
|
|
213
245
|
|
package/extension/acp-errors.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// OMP decides whether to retry from the assistant error text. Keep the
|
|
2
2
|
// transport's distinction between account exhaustion and a transient throttle
|
|
3
3
|
// visible instead of collapsing both into "protocol".
|
|
4
|
+
import { redactSensitiveText } from "./redact.ts";
|
|
5
|
+
|
|
4
6
|
export type AcpFailureCode =
|
|
5
7
|
| "auth"
|
|
6
8
|
| "quota"
|
|
@@ -103,17 +105,19 @@ function isAntigravityAcpError(error: unknown): error is AntigravityAcpErrorLike
|
|
|
103
105
|
export function classifyAcpFailure(error: unknown): Error {
|
|
104
106
|
if (isAntigravityAcpError(error)) {
|
|
105
107
|
if (error.code === "aborted") return error;
|
|
106
|
-
if (error.code === "auth") return new AcpFailure("auth", appendHint(error.message, AUTH_RULE), { cause: error });
|
|
107
|
-
if (error.code === "quota") return new AcpFailure("quota", appendHint(error.message, QUOTA_RULE), { cause: error });
|
|
108
|
-
if (error.code === "timeout") return new AcpFailure("timeout", appendHint(error.message, TIMEOUT_RULE), { cause: error });
|
|
109
|
-
if (error.code === "spawn" || error.code === "process_exit") return new AcpFailure("transport", appendHint(error.message, TRANSPORT_RULE), { cause: error });
|
|
110
|
-
if (error.code === "invalid_input") return new AcpFailure("protocol", appendHint(error.message, PROTOCOL_RULE), { cause: error });
|
|
111
|
-
if (error.code === "model") return new AcpFailure("model", error.message, { cause: error });
|
|
108
|
+
if (error.code === "auth") return new AcpFailure("auth", redactSensitiveText(appendHint(error.message, AUTH_RULE)), { cause: error });
|
|
109
|
+
if (error.code === "quota") return new AcpFailure("quota", redactSensitiveText(appendHint(error.message, QUOTA_RULE)), { cause: error });
|
|
110
|
+
if (error.code === "timeout") return new AcpFailure("timeout", redactSensitiveText(appendHint(error.message, TIMEOUT_RULE)), { cause: error });
|
|
111
|
+
if (error.code === "spawn" || error.code === "process_exit") return new AcpFailure("transport", redactSensitiveText(appendHint(error.message, TRANSPORT_RULE)), { cause: error });
|
|
112
|
+
if (error.code === "invalid_input") return new AcpFailure("protocol", redactSensitiveText(appendHint(error.message, PROTOCOL_RULE)), { cause: error });
|
|
113
|
+
if (error.code === "model") return new AcpFailure("model", redactSensitiveText(error.message), { cause: error });
|
|
112
114
|
}
|
|
113
115
|
const message = error instanceof Error ? error.message : String(error);
|
|
114
116
|
if (!message.trim()) return error instanceof Error ? error : new Error(message);
|
|
115
117
|
for (const rule of RULES) {
|
|
116
|
-
if (rule.match.test(message)) return new AcpFailure(rule.code, appendHint(message, rule), { cause: error });
|
|
118
|
+
if (rule.match.test(message)) return new AcpFailure(rule.code, redactSensitiveText(appendHint(message, rule)), { cause: error });
|
|
117
119
|
}
|
|
118
|
-
|
|
120
|
+
const redacted = redactSensitiveText(message);
|
|
121
|
+
if (redacted === message) return error instanceof Error ? error : new Error(message);
|
|
122
|
+
return new Error(redacted);
|
|
119
123
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
// Google ships the same ACP server through two channels: the registry-signed
|
|
2
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
3
|
|
|
10
4
|
import { execFile } from "node:child_process";
|
|
11
5
|
import fs from "node:fs";
|
|
@@ -13,6 +7,7 @@ import os from "node:os";
|
|
|
13
7
|
import path from "node:path";
|
|
14
8
|
import { promisify } from "node:util";
|
|
15
9
|
|
|
10
|
+
import { loadRuntimeSourcePreference } from "./adapter-config.ts";
|
|
16
11
|
import { writeJsonAtomic } from "./fs-atomic.ts";
|
|
17
12
|
|
|
18
13
|
const execFileAsync = promisify(execFile);
|
|
@@ -34,6 +29,43 @@ export interface AcpPermissionProfile {
|
|
|
34
29
|
autoApproveProcess: boolean;
|
|
35
30
|
}
|
|
36
31
|
|
|
32
|
+
export type AcpQuotaSource =
|
|
33
|
+
| { kind: "cli"; cliPath: string }
|
|
34
|
+
| { kind: "acp"; command: string; args: string[] };
|
|
35
|
+
|
|
36
|
+
export async function resolveAcpQuotaSource(
|
|
37
|
+
stateDir: string,
|
|
38
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
39
|
+
home = os.homedir(),
|
|
40
|
+
platform: NodeJS.Platform = process.platform,
|
|
41
|
+
signal?: AbortSignal,
|
|
42
|
+
preference?: AcpRuntimePreference,
|
|
43
|
+
): Promise<AcpQuotaSource | undefined> {
|
|
44
|
+
const wrapper = cliWrapperPath(stateDir, platform);
|
|
45
|
+
const configured = env.AGY_ACP_BIN?.trim();
|
|
46
|
+
const configuredIsWrapper = configured !== undefined && path.resolve(configured) === path.resolve(wrapper);
|
|
47
|
+
if (configured && !configuredIsWrapper) return { kind: "acp", ...resolveExplicitAcpCommand(configured, home, platform) };
|
|
48
|
+
if (preference?.source === "env") return configured ? { kind: "acp", ...resolveExplicitAcpCommand(configured, home, platform) } : undefined;
|
|
49
|
+
if (preference?.source === "cli") return preference.cliPath ? { kind: "cli", cliPath: preference.cliPath } : undefined;
|
|
50
|
+
if (preference?.source === "managed") {
|
|
51
|
+
const managed = resolveManagedAcpCommand(home, platform);
|
|
52
|
+
return managed ? { kind: "acp", ...managed } : undefined;
|
|
53
|
+
}
|
|
54
|
+
const runtimeSource = loadRuntimeSourcePreference(stateDir);
|
|
55
|
+
if (runtimeSource === "managed") {
|
|
56
|
+
const managed = resolveManagedAcpCommand(home, platform);
|
|
57
|
+
return managed ? { kind: "acp", ...managed } : undefined;
|
|
58
|
+
}
|
|
59
|
+
const recorded = configuredIsWrapper ? readRuntimeSourceRecord(stateDir) : undefined;
|
|
60
|
+
const recordedCli = recorded?.cliPath !== undefined && isExecutableFile(recorded.cliPath)
|
|
61
|
+
? recorded.cliPath : undefined;
|
|
62
|
+
const cli = recordedCli ?? (await findAgyCli(env, signal))?.path;
|
|
63
|
+
if (cli) return { kind: "cli", cliPath: cli };
|
|
64
|
+
if (runtimeSource === "cli") return undefined;
|
|
65
|
+
const managed = resolveManagedAcpCommand(home, platform);
|
|
66
|
+
return managed ? { kind: "acp", ...managed } : undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
37
69
|
export function resolveAcpPermissionProfile(
|
|
38
70
|
preference: AcpRuntimePreference | undefined,
|
|
39
71
|
requestedMode: AcpRequestedPermissionMode,
|
|
@@ -48,6 +80,28 @@ export function resolveAcpPermissionProfile(
|
|
|
48
80
|
};
|
|
49
81
|
}
|
|
50
82
|
|
|
83
|
+
function resolveExplicitAcpCommand(
|
|
84
|
+
configured: string,
|
|
85
|
+
home: string,
|
|
86
|
+
platform: NodeJS.Platform,
|
|
87
|
+
): { command: string; args: string[] } {
|
|
88
|
+
const command = configured === "~" ? home
|
|
89
|
+
: configured.startsWith("~/") ? path.join(home, configured.slice(2)) : configured;
|
|
90
|
+
if (platform !== "linux") return { command, args: [] };
|
|
91
|
+
try {
|
|
92
|
+
const fd = fs.openSync(command, "r");
|
|
93
|
+
try {
|
|
94
|
+
const prefix = Buffer.alloc(2);
|
|
95
|
+
const count = fs.readSync(fd, prefix, 0, prefix.length, 0);
|
|
96
|
+
return { command, args: prefix.subarray(0, count).toString("utf8") === "#!" ? [] : ["--uid="] };
|
|
97
|
+
} finally {
|
|
98
|
+
fs.closeSync(fd);
|
|
99
|
+
}
|
|
100
|
+
} catch {
|
|
101
|
+
return { command, args: [] };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
51
105
|
export function resolveManagedAcpCommand(
|
|
52
106
|
home = os.homedir(), platform: NodeJS.Platform = process.platform,
|
|
53
107
|
): { command: string; args: string[] } | undefined {
|
|
@@ -63,66 +117,80 @@ export function assertSelectedAcpCliLaunch(
|
|
|
63
117
|
stateDir: string,
|
|
64
118
|
preference: AcpRuntimePreference | undefined,
|
|
65
119
|
env: NodeJS.ProcessEnv = process.env,
|
|
66
|
-
|
|
67
|
-
home = os.homedir(),
|
|
120
|
+
platform: NodeJS.Platform = process.platform,
|
|
68
121
|
): { command: string; args: string[] } | undefined {
|
|
69
|
-
const automaticWrapper = path.join(stateDir, "agy-acp-cli.sh");
|
|
70
|
-
const configured = env.AGY_ACP_BIN?.trim();
|
|
71
|
-
if (purpose === "quota" && configured && path.resolve(configured) !== path.resolve(automaticWrapper)) return undefined;
|
|
72
|
-
if (purpose === "quota") {
|
|
73
|
-
const managed = resolveManagedAcpCommand(home);
|
|
74
|
-
if (!managed) throw new Error("Managed ACP binary is missing or not executable for quota");
|
|
75
|
-
env.AGY_ACP_BIN = managed.command;
|
|
76
|
-
return managed;
|
|
77
|
-
}
|
|
78
122
|
if (preference?.source !== "cli") return;
|
|
79
|
-
const wrapper =
|
|
123
|
+
const wrapper = cliWrapperPath(stateDir, platform);
|
|
124
|
+
const configured = env.AGY_ACP_BIN?.trim();
|
|
80
125
|
let intact = false;
|
|
81
126
|
try {
|
|
82
|
-
intact = preference.cliPath !== undefined && fs.readFileSync(wrapper, "utf8") === cliWrapperScript(preference.cliPath);
|
|
127
|
+
intact = preference.cliPath !== undefined && fs.readFileSync(wrapper, "utf8") === cliWrapperScript(preference.cliPath, platform);
|
|
83
128
|
} catch {
|
|
84
129
|
// Missing and unreadable wrappers fail the same launch check.
|
|
85
130
|
}
|
|
86
|
-
if (
|
|
131
|
+
if (!configured || path.resolve(configured) !== path.resolve(wrapper) || !isExecutableFile(wrapper) || !intact) {
|
|
87
132
|
throw new Error(`Selected ACP CLI wrapper is missing, changed, not executable, or not selected by AGY_ACP_BIN: ${wrapper}`);
|
|
88
133
|
}
|
|
89
134
|
}
|
|
90
135
|
|
|
91
|
-
export async function
|
|
136
|
+
export async function selectAcpRuntime(
|
|
92
137
|
stateDir: string,
|
|
93
138
|
env: NodeJS.ProcessEnv = process.env,
|
|
94
139
|
home = os.homedir(),
|
|
140
|
+
platform: NodeJS.Platform = process.platform,
|
|
95
141
|
): Promise<AcpRuntimePreference> {
|
|
96
|
-
const wrapper =
|
|
142
|
+
const wrapper = cliWrapperPath(stateDir, platform);
|
|
97
143
|
const configured = env.AGY_ACP_BIN?.trim();
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
144
|
+
const configuredIsWrapper = configured !== undefined && path.resolve(configured) === path.resolve(wrapper);
|
|
145
|
+
if (configured && !configuredIsWrapper) return { source: "env" };
|
|
146
|
+
const runtimeSource = loadRuntimeSourcePreference(stateDir);
|
|
147
|
+
const managedVersion = readManagedVersion(home);
|
|
148
|
+
if (runtimeSource === "cli") {
|
|
149
|
+
if (configuredIsWrapper) delete env.AGY_ACP_BIN;
|
|
102
150
|
const cli = await findAgyCli(env);
|
|
103
|
-
if (cli)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
151
|
+
if (!cli) throw new Error('runtimeSource is "cli" in config.json, but no usable agy CLI was found. Install the CLI or set runtimeSource to "auto".');
|
|
152
|
+
return selectCli(stateDir, wrapper, env, platform, cli, managedVersion);
|
|
153
|
+
}
|
|
154
|
+
if (runtimeSource === "managed") {
|
|
155
|
+
if (configuredIsWrapper) delete env.AGY_ACP_BIN;
|
|
156
|
+
if (!resolveManagedAcpCommand(home, platform)) {
|
|
157
|
+
throw new Error('runtimeSource is "managed" in config.json, but the managed ACP runtime is missing. Install it or set runtimeSource to "auto".');
|
|
109
158
|
}
|
|
110
|
-
|
|
111
|
-
if (recorded) return recorded;
|
|
112
|
-
} else if (configured) {
|
|
113
|
-
return { source: "env" };
|
|
159
|
+
return { source: "managed", managedVersion };
|
|
114
160
|
}
|
|
115
|
-
// The generated wrapper is a POSIX shell script that upstream launches
|
|
116
|
-
// directly; Windows cannot execute it, so it stays managed-only there.
|
|
117
|
-
if (process.platform === "win32") return { source: "managed" };
|
|
118
161
|
const cli = await findAgyCli(env);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
162
|
+
if (cli) {
|
|
163
|
+
try {
|
|
164
|
+
return selectCli(stateDir, wrapper, env, platform, cli, managedVersion);
|
|
165
|
+
} catch {
|
|
166
|
+
// Fall through to recorded CLI or managed runtime when wrapper persistence fails.
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (configuredIsWrapper) {
|
|
170
|
+
const recorded = readRuntimeSourceRecord(stateDir);
|
|
171
|
+
if (recorded && isExecutableFile(recorded.cliPath)) {
|
|
172
|
+
try {
|
|
173
|
+
writeCliWrapper(wrapper, recorded.cliPath, platform);
|
|
174
|
+
return recorded;
|
|
175
|
+
} catch {
|
|
176
|
+
// Fall through to managed runtime when wrapper persistence fails.
|
|
177
|
+
}
|
|
178
|
+
}
|
|
123
179
|
}
|
|
180
|
+
if (configured) delete env.AGY_ACP_BIN;
|
|
181
|
+
return { source: "managed", cliPath: cli?.path, cliVersion: cli?.version, managedVersion };
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function selectCli(
|
|
185
|
+
stateDir: string,
|
|
186
|
+
wrapper: string,
|
|
187
|
+
env: NodeJS.ProcessEnv,
|
|
188
|
+
platform: NodeJS.Platform,
|
|
189
|
+
cli: { path: string; version: string },
|
|
190
|
+
managedVersion: string | undefined,
|
|
191
|
+
): AcpRuntimePreference {
|
|
124
192
|
const preference = { source: "cli", cliPath: cli.path, cliVersion: cli.version, managedVersion } as const;
|
|
125
|
-
writeCliWrapper(wrapper, cli.path);
|
|
193
|
+
writeCliWrapper(wrapper, cli.path, platform);
|
|
126
194
|
writeRuntimeSourceRecord(stateDir, preference);
|
|
127
195
|
env.AGY_ACP_BIN = wrapper;
|
|
128
196
|
return preference;
|
|
@@ -148,13 +216,16 @@ function readRuntimeSourceRecord(stateDir: string): AcpRuntimePreference | undef
|
|
|
148
216
|
}
|
|
149
217
|
}
|
|
150
218
|
|
|
151
|
-
async function findAgyCli(env: NodeJS.ProcessEnv): Promise<{ path: string; version: string } | undefined> {
|
|
219
|
+
async function findAgyCli(env: NodeJS.ProcessEnv, signal?: AbortSignal): Promise<{ path: string; version: string } | undefined> {
|
|
152
220
|
const agy = findExecutableOnPath("agy", env) ?? findExecutableOnPath("agy.exe", env);
|
|
153
221
|
if (!agy) return undefined;
|
|
154
222
|
try {
|
|
155
223
|
// `acp --version` both proves the subcommand exists and reports the
|
|
156
224
|
// bundled server version; a CLI without it must not be selected.
|
|
157
|
-
const { stdout } = await execFileAsync(agy, ["acp", "--version"], {
|
|
225
|
+
const { stdout } = await execFileAsync(agy, ["acp", "--version"], {
|
|
226
|
+
timeout: CLI_VERSION_TIMEOUT_MS,
|
|
227
|
+
...(signal ? { signal } : {}),
|
|
228
|
+
});
|
|
158
229
|
const version = /\d+\.\d+\.\d+/.exec(stdout)?.[0];
|
|
159
230
|
return version ? { path: agy, version } : undefined;
|
|
160
231
|
} catch {
|
|
@@ -202,15 +273,23 @@ function compareVersions(left: string, right: string): number {
|
|
|
202
273
|
return 0;
|
|
203
274
|
}
|
|
204
275
|
|
|
205
|
-
function
|
|
276
|
+
function cliWrapperPath(stateDir: string, platform: NodeJS.Platform): string {
|
|
277
|
+
return path.join(stateDir, platform === "win32" ? "agy-acp-cli.cmd" : "agy-acp-cli.sh");
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function cliWrapperScript(agyPath: string, platform: NodeJS.Platform = process.platform): string {
|
|
281
|
+
if (platform === "win32") {
|
|
282
|
+
const escaped = agyPath.replace(/%/g, "%%");
|
|
283
|
+
return `@echo off\r\nsetlocal\r\nset "OMP_ACP_EXTRA="\r\nif "%OMP_ACP_DANGEROUSLY_SKIP_PERMISSIONS%"=="1" set "OMP_ACP_EXTRA=--dangerously-skip-permissions"\r\n"${escaped}" acp --app_data_dir=antigravity-acp %OMP_ACP_EXTRA% %*\r\nexit /b %ERRORLEVEL%\r\n`;
|
|
284
|
+
}
|
|
206
285
|
// --app_data_dir=antigravity-acp is the managed .par's own default: the CLI
|
|
207
286
|
// binary would otherwise default to antigravity-cli, mixing ACP sessions
|
|
208
287
|
// with personal CLI chats outside session cleanup's tracked tree.
|
|
209
|
-
return `#!/bin/sh\nif [
|
|
288
|
+
return `#!/bin/sh\nif [ "\${OMP_ACP_DANGEROUSLY_SKIP_PERMISSIONS:-}" = "1" ]; then\n set -- --dangerously-skip-permissions "$@"\nfi\nexec '${agyPath.replace(/'/g, "'\\''")}' acp --app_data_dir=antigravity-acp "$@"\n`;
|
|
210
289
|
}
|
|
211
290
|
|
|
212
|
-
function writeCliWrapper(file: string, agyPath: string): void {
|
|
213
|
-
const script = cliWrapperScript(agyPath);
|
|
291
|
+
function writeCliWrapper(file: string, agyPath: string, platform: NodeJS.Platform = process.platform): void {
|
|
292
|
+
const script = cliWrapperScript(agyPath, platform);
|
|
214
293
|
try {
|
|
215
294
|
if (fs.readFileSync(file, "utf8") === script) return;
|
|
216
295
|
} catch {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { writeJsonAtomic } from "./fs-atomic.ts";
|
|
4
|
+
|
|
5
|
+
export type AdapterPermissionMode = "default" | "auto_edit" | "yolo";
|
|
6
|
+
export type AdapterRuntimeUpdateMode = "automatic" | "notify" | "manual";
|
|
7
|
+
export type RuntimeSourcePreference = "auto" | "cli" | "managed";
|
|
8
|
+
export type AdapterUsageMode = "auto" | "off";
|
|
9
|
+
export type AdapterNativeToolMode = "prefer" | "disabled";
|
|
10
|
+
|
|
11
|
+
export interface AdapterConfig {
|
|
12
|
+
permissions: AdapterPermissionMode;
|
|
13
|
+
runtimeUpdates: AdapterRuntimeUpdateMode;
|
|
14
|
+
runtimeSource: RuntimeSourcePreference;
|
|
15
|
+
nativeTools: AdapterNativeToolMode;
|
|
16
|
+
debugToolUpdates: boolean;
|
|
17
|
+
usageMode: AdapterUsageMode;
|
|
18
|
+
diagnostics: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AdapterConfigSeed {
|
|
22
|
+
nativeTools?: AdapterNativeToolMode;
|
|
23
|
+
debugToolUpdates?: boolean;
|
|
24
|
+
usageMode?: AdapterUsageMode;
|
|
25
|
+
diagnostics?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const DEFAULTS: AdapterConfig = {
|
|
29
|
+
permissions: "yolo",
|
|
30
|
+
runtimeUpdates: "automatic",
|
|
31
|
+
runtimeSource: "auto",
|
|
32
|
+
nativeTools: "prefer",
|
|
33
|
+
debugToolUpdates: false,
|
|
34
|
+
usageMode: "off",
|
|
35
|
+
diagnostics: false,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function seeded(seed: AdapterConfigSeed): AdapterConfig {
|
|
39
|
+
return {
|
|
40
|
+
...DEFAULTS,
|
|
41
|
+
nativeTools: seed.nativeTools ?? DEFAULTS.nativeTools,
|
|
42
|
+
debugToolUpdates: seed.debugToolUpdates ?? DEFAULTS.debugToolUpdates,
|
|
43
|
+
usageMode: seed.usageMode ?? DEFAULTS.usageMode,
|
|
44
|
+
diagnostics: seed.diagnostics ?? DEFAULTS.diagnostics,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function loadAdapterConfig(file: string, seed: AdapterConfigSeed = {}): AdapterConfig {
|
|
49
|
+
let parsed: unknown;
|
|
50
|
+
try {
|
|
51
|
+
parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
52
|
+
} catch {
|
|
53
|
+
return seeded(seed);
|
|
54
|
+
}
|
|
55
|
+
if (!parsed || typeof parsed !== "object") return seeded(seed);
|
|
56
|
+
const record = parsed as Record<string, unknown>;
|
|
57
|
+
const runtimeSource = record.runtimeSource;
|
|
58
|
+
if (runtimeSource !== undefined && runtimeSource !== "auto" && runtimeSource !== "cli" && runtimeSource !== "managed") {
|
|
59
|
+
throw new Error('runtimeSource must be "auto", "cli", or "managed"');
|
|
60
|
+
}
|
|
61
|
+
if (record.nativeTools !== undefined && record.nativeTools !== "prefer" && record.nativeTools !== "disabled") {
|
|
62
|
+
throw new Error("nativeTools must be prefer or disabled");
|
|
63
|
+
}
|
|
64
|
+
if (record.debugToolUpdates !== undefined && typeof record.debugToolUpdates !== "boolean") {
|
|
65
|
+
throw new Error("debugToolUpdates must be boolean");
|
|
66
|
+
}
|
|
67
|
+
if (record.usageMode !== undefined && record.usageMode !== "auto" && record.usageMode !== "off") {
|
|
68
|
+
throw new Error("usageMode must be auto or off");
|
|
69
|
+
}
|
|
70
|
+
if (record.diagnostics !== undefined && typeof record.diagnostics !== "boolean") {
|
|
71
|
+
throw new Error("diagnostics must be boolean");
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
permissions: record.permissions === "default" || record.permissions === "auto_edit" || record.permissions === "yolo"
|
|
75
|
+
? record.permissions : DEFAULTS.permissions,
|
|
76
|
+
runtimeUpdates: record.runtimeUpdates === "automatic" || record.runtimeUpdates === "notify" || record.runtimeUpdates === "manual"
|
|
77
|
+
? record.runtimeUpdates : DEFAULTS.runtimeUpdates,
|
|
78
|
+
runtimeSource: runtimeSource ?? DEFAULTS.runtimeSource,
|
|
79
|
+
nativeTools: record.nativeTools ?? seed.nativeTools ?? DEFAULTS.nativeTools,
|
|
80
|
+
debugToolUpdates: record.debugToolUpdates ?? seed.debugToolUpdates ?? DEFAULTS.debugToolUpdates,
|
|
81
|
+
usageMode: record.usageMode ?? seed.usageMode ?? DEFAULTS.usageMode,
|
|
82
|
+
diagnostics: record.diagnostics ?? seed.diagnostics ?? DEFAULTS.diagnostics,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function updateAdapterConfig(file: string, patch: Partial<AdapterConfig>): AdapterConfig {
|
|
87
|
+
let raw: Record<string, unknown> = {};
|
|
88
|
+
try {
|
|
89
|
+
const parsed: unknown = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
90
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) raw = parsed as Record<string, unknown>;
|
|
91
|
+
} catch {
|
|
92
|
+
// A missing or malformed file starts from an empty object.
|
|
93
|
+
}
|
|
94
|
+
writeJsonAtomic(file, { ...raw, ...patch });
|
|
95
|
+
return loadAdapterConfig(file);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function saveAdapterPermissionMode(mode: AdapterPermissionMode, file: string): void {
|
|
99
|
+
updateAdapterConfig(file, { permissions: mode });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function loadRuntimeSourcePreference(stateDir: string): RuntimeSourcePreference {
|
|
103
|
+
return loadAdapterConfig(path.join(stateDir, "config.json")).runtimeSource;
|
|
104
|
+
}
|
|
@@ -18,14 +18,23 @@ const agentCommand = genericCommand ? entryOrCommand : process.execPath;
|
|
|
18
18
|
const agentArgs = genericCommand ? forwardedArgs : [entryOrCommand, ...forwardedArgs];
|
|
19
19
|
|
|
20
20
|
const parentPid = process.ppid;
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
const windowsBatch = process.platform === "win32" && /\.(?:cmd|bat)$/iu.test(agentCommand);
|
|
22
|
+
const agent = windowsBatch
|
|
23
|
+
? spawn(process.env.ComSpec || "cmd.exe", ["/d", "/s", "/c", `call "${agentCommand}"`, ...agentArgs], {
|
|
24
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
25
|
+
windowsHide: true,
|
|
26
|
+
windowsVerbatimArguments: true,
|
|
27
|
+
detached: false,
|
|
28
|
+
env: process.env,
|
|
29
|
+
})
|
|
30
|
+
: spawn(agentCommand, agentArgs, {
|
|
31
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
32
|
+
shell: false,
|
|
33
|
+
windowsHide: true,
|
|
34
|
+
// Give Antigravity and every tool it starts a group separate from the watchdog.
|
|
35
|
+
detached: process.platform !== "win32",
|
|
36
|
+
env: process.env,
|
|
37
|
+
});
|
|
29
38
|
|
|
30
39
|
let shuttingDown = false;
|
|
31
40
|
let hardKillTimer;
|
package/extension/commands.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { describeCredentialStorage, inspectAntigravityAuth
|
|
1
|
+
import { describeCredentialStorage, inspectAntigravityAuth } from "./runtime.mjs";
|
|
2
|
+
import { saveAdapterPermissionMode, updateAdapterConfig, type AdapterPermissionMode } from "./adapter-config.ts";
|
|
2
3
|
import { antigravityAccountEmail, authReady, formatLogoutSummary, keychain, ompCredentialSummary, type OmpAuthCoordinator, type OmpCommandContext } from "./auth-sync.ts";
|
|
3
4
|
import { parseNativeToolMode, type NativeToolMode } from "./tool-routing.ts";
|
|
4
5
|
import { saveToolPolicy, type ToolPolicy } from "./tool-policy.ts";
|
|
@@ -376,7 +377,10 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
|
376
377
|
if (command === "diagnostics") {
|
|
377
378
|
if (parts.length > 2 || (value !== undefined && !["on", "off", "reset"].includes(value))) throw new Error("Usage: /antigravity-acp diagnostics [on|off|reset]");
|
|
378
379
|
if (value === "reset") deps.diagnostics?.reset();
|
|
379
|
-
else if (value)
|
|
380
|
+
else if (value) {
|
|
381
|
+
updateAdapterConfig(deps.configPath, { diagnostics: value === "on" });
|
|
382
|
+
deps.diagnostics?.configure(value === "on");
|
|
383
|
+
}
|
|
380
384
|
ctx.ui.notify(formatDiagnostics(deps.diagnostics?.status()), "info");
|
|
381
385
|
return;
|
|
382
386
|
}
|
|
@@ -408,6 +412,7 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
|
408
412
|
const next = updateContextSettings(currentSettings, target, key, key === "usageMode" ? raw : Number(raw));
|
|
409
413
|
for (const model of deps.catalog.currentModels) resolveContextOptions(model, next);
|
|
410
414
|
saveContextSettings(deps.contextPath, next);
|
|
415
|
+
if (key === "usageMode") updateAdapterConfig(deps.configPath, { usageMode: raw as "auto" | "off" });
|
|
411
416
|
deps.setContextSettings(next);
|
|
412
417
|
if (key === "usageMode") {
|
|
413
418
|
for (const connection of deps.connections) connection.configureUsage(raw as "auto" | "off");
|
|
@@ -446,6 +451,7 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
|
446
451
|
if (parts.length !== 2 || (value !== "auto" && value !== "off")) throw new Error("Usage: /antigravity-acp usage [auto|off]");
|
|
447
452
|
const next = updateContextSettings(deps.getContextSettings(), "default", "usageMode", value);
|
|
448
453
|
saveContextSettings(deps.contextPath, next);
|
|
454
|
+
updateAdapterConfig(deps.configPath, { usageMode: value });
|
|
449
455
|
deps.setContextSettings(next);
|
|
450
456
|
for (const connection of deps.connections) connection.configureUsage(value);
|
|
451
457
|
ctx.ui.notify(`Supplemental ACP usage queries: ${value}${process.env.OMP_ACP_USAGE === "off" ? " (environment override keeps queries off)" : ""}. Context occupancy updates remain enabled.`, "info");
|
|
@@ -457,6 +463,7 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
|
457
463
|
const enabled = value === "on";
|
|
458
464
|
const next = { ...deps.getToolPolicy(), debugToolUpdates: enabled };
|
|
459
465
|
saveToolPolicy(deps.toolPolicyPath, next);
|
|
466
|
+
updateAdapterConfig(deps.configPath, { debugToolUpdates: enabled });
|
|
460
467
|
deps.setToolPolicy(next);
|
|
461
468
|
for (const connection of deps.connections) connection.debugToolUpdates = enabled;
|
|
462
469
|
ctx.ui.notify(`ACP tool-status debug display: ${value}. Normal OMP tool results and thought summaries are preserved.`, "info");
|
|
@@ -468,6 +475,7 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
|
468
475
|
const mode: NativeToolMode = parseNativeToolMode(value);
|
|
469
476
|
const next = { ...deps.getToolPolicy(), nativeTools: mode };
|
|
470
477
|
saveToolPolicy(deps.toolPolicyPath, next);
|
|
478
|
+
updateAdapterConfig(deps.configPath, { nativeTools: mode });
|
|
471
479
|
await deps.closeAllRuntimes();
|
|
472
480
|
deps.setToolPolicy(next);
|
|
473
481
|
ctx.ui.notify(`Native tools: ${mode}. ACP connections will be recreated on the next request with the new policy.`, "info");
|
|
@@ -613,7 +621,7 @@ export function createAntigravityCommandHandler(deps: CommandControllerDeps) {
|
|
|
613
621
|
}
|
|
614
622
|
const mode = value.replace("-", "_");
|
|
615
623
|
if (mode !== deps.getPermissionMode()) {
|
|
616
|
-
|
|
624
|
+
saveAdapterPermissionMode(mode as AdapterPermissionMode, deps.configPath);
|
|
617
625
|
deps.setPermissionModeState(mode);
|
|
618
626
|
await deps.closeAllRuntimes();
|
|
619
627
|
}
|