omp-antigravity-acp-provider 0.2.2 → 0.2.4
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 +9 -11
- package/THIRD_PARTY_LICENSES.txt +70 -39
- package/extension/acp-compaction.ts +14 -2
- package/extension/acp-errors.ts +11 -3
- package/extension/adapter-config.ts +1 -1
- package/extension/ambient.d.ts +23 -0
- package/extension/assets/zip-archive.mjs +10839 -0
- package/extension/auth-sync.ts +88 -7
- package/extension/commands.ts +12 -15
- package/extension/context-settings.ts +2 -2
- package/extension/index.ts +71 -35
- package/extension/model-catalog.ts +1 -1
- package/extension/omp-context.ts +14 -3
- package/extension/quota-usage.ts +2 -1
- package/extension/runtime/acp/bounded-stream.ts +78 -24
- package/extension/runtime/acp/connection.ts +18 -6
- package/extension/runtime/binding.ts +2 -2
- package/extension/runtime/config.ts +1 -1
- package/extension/runtime/managed.ts +2 -1
- package/extension/runtime/models.ts +15 -8
- package/extension/runtime/prompt.ts +90 -50
- package/extension/runtime/provider.ts +38 -10
- package/extension/runtime/runtime.ts +74 -44
- package/extension/runtime/stream/pi-events.ts +3 -3
- package/extension/runtime/tools/bridge.ts +20 -8
- package/extension/runtime/tools/relay.ts +2 -2
- package/extension/runtime/zip-archive.ts +1 -0
- package/extension/runtime.d.mts +1 -0
- package/extension/runtime.mjs +18311 -35376
- package/extension/secret-service.ts +28 -0
- package/extension/selectors.ts +8 -7
- package/extension/session-store.ts +7 -7
- package/extension/tier-connection.ts +39 -8
- package/extension/tool-policy.ts +2 -2
- package/extension/tool-relay-protocol.d.mts +5 -0
- package/extension/tool-routing.ts +40 -23
- package/extension/transcript-routing.ts +16 -3
- package/extension/turn-cancellation.ts +1 -1
- package/extension/usage-db.ts +42 -22
- package/extension/usage.ts +1 -1
- package/licenses/{pi-ai-1.3.0.txt → pi-mit.txt} +1 -2
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
Google Antigravity's official ACP server, adapted for **Oh My Pi (OMP)**.
|
|
12
12
|
|
|
13
|
-
Current version: `0.2.2`.
|
|
14
|
-
|
|
15
13
|
**An OMP-focused derivative fork of [zacbemis/pi-antigravity-acp-provider](https://github.com/zacbemis/pi-antigravity-acp-provider).** Original project by [zacbemis](https://github.com/zacbemis) and contributors, licensed under MIT.
|
|
16
14
|
|
|
17
15
|
This is an independent adaptation, **NOT** an official Google or OMP integration. It uses ACP over stdio. The local HTTP MCP bridge carries tool calls; it is not a model API reverse proxy.
|
|
@@ -22,7 +20,7 @@ This is an independent adaptation, **NOT** an official Google or OMP integration
|
|
|
22
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.
|
|
23
21
|
- Per-model thinking levels, exposed only when the server confirms them. The offline catalog includes Gemini 4 Hydrogen through `xhigh` and known partner models; the first inference after an empty cache attempts real server discovery.
|
|
24
22
|
- OMP tools through an authenticated loopback MCP bridge.
|
|
25
|
-
-
|
|
23
|
+
- ACP-native tools are disabled by default for strict OMP-only sessions; `/antigravity-acp native-tools prefer` restores them.
|
|
26
24
|
- Standby ACP initialization coordinated with discovery, plus warm session reuse and guarded oldest-image history continuity.
|
|
27
25
|
- `/login` plus `/antigravity-acp` account, usage and cleanup commands.
|
|
28
26
|
- API-equivalent cost estimates from a model-ID rate table, not subscription billing. Native response usage takes precedence, with a read-only SQLite fallback for completed model steps when no supplemental usage query runs.
|
|
@@ -80,7 +78,7 @@ Or install the published npm package directly:
|
|
|
80
78
|
omp plugin install npm:omp-antigravity-acp-provider
|
|
81
79
|
```
|
|
82
80
|
|
|
83
|
-
To pin this version, use `omp plugin install npm:omp-antigravity-acp-provider@0.2.
|
|
81
|
+
To pin this version, use `omp plugin install npm:omp-antigravity-acp-provider@0.2.4`.
|
|
84
82
|
|
|
85
83
|
Do not install both. Remove or disable any older Antigravity ACP adapter first.
|
|
86
84
|
|
|
@@ -125,7 +123,7 @@ To remove the installed plugin, use `omp plugin uninstall omp-antigravity-acp-pr
|
|
|
125
123
|
| No models after `/antigravity-acp refresh` | Run `/antigravity-acp account` to confirm both sides are signed in, then retry with internet access. ACP can advertise fewer models than the Antigravity app. |
|
|
126
124
|
| Two Antigravity providers appear | Remove the older adapter (`antigravity-acp-omp`, the upstream Pi extension, or a duplicate npm install), then restart OMP. |
|
|
127
125
|
| Login opens the wrong Google account | Both login paths always start a fresh sign-in. Choose the intended account (or "Use another account") on Google's consent screen. |
|
|
128
|
-
| `disabled` native-tool mode rejects the session | The official runtime must advertise system-append support (1.4.1+). Upgrade the runtime or run `/antigravity-acp native-tools prefer`. |
|
|
126
|
+
| Default `disabled` native-tool mode rejects the session | The official runtime must advertise system-append support (1.4.1+). Upgrade the runtime or run `/antigravity-acp native-tools prefer`. |
|
|
129
127
|
| The first request is slow | Runtime download and cold ACP start happen once; later turns reuse the warm session. |
|
|
130
128
|
| A tool call returns a relay notice | The model should call `pi_omp_await_result` with the notice's `call_id`. Lower `OMP_ACP_TOOL_RELAY_MS` or set it to `0` to disable relay. |
|
|
131
129
|
|
|
@@ -139,7 +137,7 @@ Google ships the same ACP server through two channels. The adapter chooses one a
|
|
|
139
137
|
|
|
140
138
|
- **`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.
|
|
141
139
|
- **Managed runtime.** The registry-signed release in `~/.local/opt/agy-acp/`. It is the fallback when the CLI is missing or unusable.
|
|
142
|
-
The bundled signed manifest may select 1.3.0 until Google's newer release is approved. System-append routing and `native-tools disabled` require 1.4.1 or newer.
|
|
140
|
+
The bundled signed manifest may select 1.3.0 until Google's newer release is approved. System-append routing and the default `native-tools disabled` require 1.4.1 or newer; on 1.3.0, upgrade or run `/antigravity-acp native-tools prefer`.
|
|
143
141
|
|
|
144
142
|
Selection order:
|
|
145
143
|
|
|
@@ -167,14 +165,14 @@ Create or edit `~/.omp/agent/antigravity-acp-provider/config.json`:
|
|
|
167
165
|
{
|
|
168
166
|
"permissions": "follow",
|
|
169
167
|
"runtimeSource": "auto",
|
|
170
|
-
"nativeTools": "
|
|
168
|
+
"nativeTools": "disabled",
|
|
171
169
|
"debugToolUpdates": false,
|
|
172
170
|
"usageMode": "off",
|
|
173
171
|
"diagnostics": false
|
|
174
172
|
}
|
|
175
173
|
```
|
|
176
174
|
|
|
177
|
-
`permissions` accepts `default`, `auto_edit`, `yolo`, or `follow`. `runtimeSource` accepts `auto`, `cli`, or `managed`. `nativeTools` accepts `prefer` or `disabled`. `usageMode` accepts `auto` or `off`. `debugToolUpdates` and `diagnostics` are config-only booleans. Missing fields use these defaults: `permissions: "follow"`, `runtimeSource: "auto"`, `nativeTools: "
|
|
175
|
+
`permissions` accepts `default`, `auto_edit`, `yolo`, or `follow`. `runtimeSource` accepts `auto`, `cli`, or `managed`. `nativeTools` accepts `prefer` or `disabled`. `usageMode` accepts `auto` or `off`. `debugToolUpdates` and `diagnostics` are config-only booleans. Missing fields use these defaults: `permissions: "follow"`, `runtimeSource: "auto"`, `nativeTools: "disabled"`, `debugToolUpdates: false`, `usageMode: "off"`, and `diagnostics: false`. `follow` reads OMP's effective approval mode at plugin startup: OMP CLI `--approval-mode` and `--auto-approve` take precedence, then the project `.omp` override, then the active agent config. It maps `yolo` to `yolo`, `write` to `auto_edit`, and both ask modes to `default`. Restart OMP after changing OMP's approval mode so the ACP process is recreated with the matching auto-approval policy. 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`.
|
|
178
176
|
|
|
179
177
|
- `auto` uses the CLI first and falls back to the managed runtime. If no usable CLI exists, it downloads the managed runtime.
|
|
180
178
|
- `cli` requires a usable `agy` CLI. If the CLI is missing or unusable, the first ACP use fails and nothing is downloaded.
|
|
@@ -247,8 +245,8 @@ OMP's built-in `omp usage`, interactive `/usage`, and the statusline `usage` seg
|
|
|
247
245
|
| `cleanup timeout [DAYS]` | Apply timeout collection, optionally with a custom idle retention in days. |
|
|
248
246
|
| `cleanup balanced [DAYS]` | Apply timeout and soft-budget cleanup with recovery protection, optionally with custom idle days. |
|
|
249
247
|
| `cleanup budget MAX_SESSIONS MAX_MIB` | Set soft session/byte limits; `0` disables either limit. Active and recently used sessions can remain above a soft budget. Timeout deletion loses ACP-only state but retains OMP history. |
|
|
250
|
-
| `native-tools
|
|
251
|
-
| `native-tools
|
|
248
|
+
| `native-tools disabled` | Disable ACP-native built-ins for strict OMP-tool sessions while retaining MCP configuration; this is the default and requires ACP 1.4.1+. Connections are recreated on the next request. |
|
|
249
|
+
| `native-tools prefer` | Retain ACP-native built-ins and let OMP tools shadow matching native tools. |
|
|
252
250
|
| `permissions default` | Confirm edits and commands. |
|
|
253
251
|
| `permissions follow` | Follow OMP's `tools.approvalMode`; this is the default. |
|
|
254
252
|
| `permissions auto-edit` | Auto-accept edits. |
|
|
@@ -299,7 +297,7 @@ Detailed behavior, advanced settings and limitations: [docs/](docs/) and [CHANGE
|
|
|
299
297
|
|
|
300
298
|
For a prepared release, first update `CHANGELOG.md`, then run `npm run release:bump -- X.Y.Z`. The helper updates all six supported version declarations and runs the version consistency checker; it does not commit, tag, push or publish. `npm run check:versions` verifies the current metadata, and `node scripts/check-release-versions.mjs --release --tag vX.Y.Z` additionally checks the tag and changelog heading.
|
|
301
299
|
|
|
302
|
-
The `Release` workflow runs only for pushed `v*` tags. It reruns the offline check, validates the packed tarball against the tag and commit, then uses npm trusted publishing with provenance before creating or reusing the GitHub release. The tag run is the only publishing path; do not publish from a local checkout.
|
|
300
|
+
The `Release` workflow runs only for pushed `v*` tags. It reruns the offline check and marketplace check, validates the packed tarball against the tag and commit, then uses npm trusted publishing with provenance before creating or reusing the GitHub release. The tag run is the only publishing path; do not publish from a local checkout. A separate `Release dry run` workflow can verify an existing tag without publishing.
|
|
303
301
|
|
|
304
302
|
## Contributors
|
|
305
303
|
|
package/THIRD_PARTY_LICENSES.txt
CHANGED
|
@@ -197,12 +197,11 @@ LICENSE
|
|
|
197
197
|
|
|
198
198
|
============================================================
|
|
199
199
|
|
|
200
|
-
@earendil-works/pi-ai@1.
|
|
200
|
+
@earendil-works/pi-ai@1.5.2
|
|
201
201
|
License: MIT
|
|
202
202
|
|
|
203
203
|
Source: https://github.com/earendil-works/pi/blob/main/LICENSE
|
|
204
|
-
|
|
205
|
-
Retrieved: 2026-10-19
|
|
204
|
+
Retrieved: 2026-11-14
|
|
206
205
|
|
|
207
206
|
MIT License
|
|
208
207
|
|
|
@@ -229,7 +228,69 @@ SOFTWARE.
|
|
|
229
228
|
|
|
230
229
|
============================================================
|
|
231
230
|
|
|
232
|
-
@
|
|
231
|
+
@earendil-works/pi-schema@1.5.2
|
|
232
|
+
License: MIT
|
|
233
|
+
|
|
234
|
+
Source: https://github.com/earendil-works/pi/blob/main/LICENSE
|
|
235
|
+
Retrieved: 2026-11-14
|
|
236
|
+
|
|
237
|
+
MIT License
|
|
238
|
+
|
|
239
|
+
Copyright (c) 2025 Mario Zechner
|
|
240
|
+
|
|
241
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
242
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
243
|
+
in the Software without restriction, including without limitation the rights
|
|
244
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
245
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
246
|
+
furnished to do so, subject to the following conditions:
|
|
247
|
+
|
|
248
|
+
The above copyright notice and this permission notice shall be included in all
|
|
249
|
+
copies or substantial portions of the Software.
|
|
250
|
+
|
|
251
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
252
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
253
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
254
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
255
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
256
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
257
|
+
SOFTWARE.
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
============================================================
|
|
261
|
+
|
|
262
|
+
@earendil-works/pi-telemetry@1.5.2
|
|
263
|
+
License: MIT
|
|
264
|
+
|
|
265
|
+
Source: https://github.com/earendil-works/pi/blob/main/LICENSE
|
|
266
|
+
Retrieved: 2026-11-14
|
|
267
|
+
|
|
268
|
+
MIT License
|
|
269
|
+
|
|
270
|
+
Copyright (c) 2025 Mario Zechner
|
|
271
|
+
|
|
272
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
273
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
274
|
+
in the Software without restriction, including without limitation the rights
|
|
275
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
276
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
277
|
+
furnished to do so, subject to the following conditions:
|
|
278
|
+
|
|
279
|
+
The above copyright notice and this permission notice shall be included in all
|
|
280
|
+
copies or substantial portions of the Software.
|
|
281
|
+
|
|
282
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
283
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
284
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
285
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
286
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
287
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
288
|
+
SOFTWARE.
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
============================================================
|
|
292
|
+
|
|
293
|
+
@hono/node-server@2.1.8
|
|
233
294
|
License: MIT
|
|
234
295
|
|
|
235
296
|
LICENSE
|
|
@@ -258,7 +319,7 @@ SOFTWARE.
|
|
|
258
319
|
|
|
259
320
|
============================================================
|
|
260
321
|
|
|
261
|
-
@modelcontextprotocol/sdk@1.32.
|
|
322
|
+
@modelcontextprotocol/sdk@1.32.2
|
|
262
323
|
License: MIT
|
|
263
324
|
|
|
264
325
|
LICENSE
|
|
@@ -495,7 +556,7 @@ SOFTWARE.
|
|
|
495
556
|
|
|
496
557
|
============================================================
|
|
497
558
|
|
|
498
|
-
fast-uri@3.1.
|
|
559
|
+
fast-uri@3.1.9
|
|
499
560
|
License: BSD-3-Clause
|
|
500
561
|
|
|
501
562
|
LICENSE
|
|
@@ -578,7 +639,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
578
639
|
|
|
579
640
|
============================================================
|
|
580
641
|
|
|
581
|
-
hono@4.13.
|
|
642
|
+
hono@4.13.18
|
|
582
643
|
License: MIT
|
|
583
644
|
|
|
584
645
|
LICENSE
|
|
@@ -1046,37 +1107,7 @@ IN THE SOFTWARE.
|
|
|
1046
1107
|
|
|
1047
1108
|
============================================================
|
|
1048
1109
|
|
|
1049
|
-
typebox@1.
|
|
1050
|
-
License: MIT
|
|
1051
|
-
|
|
1052
|
-
license
|
|
1053
|
-
TypeBox
|
|
1054
|
-
|
|
1055
|
-
The MIT License (MIT)
|
|
1056
|
-
|
|
1057
|
-
Copyright (c) 2017-2026 Haydn Paterson
|
|
1058
|
-
|
|
1059
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1060
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
1061
|
-
in the Software without restriction, including without limitation the rights
|
|
1062
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1063
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
1064
|
-
furnished to do so, subject to the following conditions:
|
|
1065
|
-
|
|
1066
|
-
The above copyright notice and this permission notice shall be included in
|
|
1067
|
-
all copies or substantial portions of the Software.
|
|
1068
|
-
|
|
1069
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1070
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1071
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1072
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1073
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1074
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1075
|
-
THE SOFTWARE.
|
|
1076
|
-
|
|
1077
|
-
============================================================
|
|
1078
|
-
|
|
1079
|
-
typebox@1.3.27
|
|
1110
|
+
typebox@1.4.6
|
|
1080
1111
|
License: MIT
|
|
1081
1112
|
|
|
1082
1113
|
license
|
|
@@ -1198,7 +1229,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
|
1198
1229
|
|
|
1199
1230
|
============================================================
|
|
1200
1231
|
|
|
1201
|
-
zod@4.6.
|
|
1232
|
+
zod@4.6.7
|
|
1202
1233
|
License: MIT
|
|
1203
1234
|
|
|
1204
1235
|
LICENSE
|
|
@@ -53,6 +53,18 @@ export function compactionSummary(value: unknown): string | undefined {
|
|
|
53
53
|
if (value === null) return "";
|
|
54
54
|
return contentText(value);
|
|
55
55
|
}
|
|
56
|
+
const MAX_COMPACTION_SUMMARY_CHARS = 4096;
|
|
57
|
+
|
|
58
|
+
function boundedCompactionSummary(value: string): string {
|
|
59
|
+
return value.length > MAX_COMPACTION_SUMMARY_CHARS ? value.slice(0, MAX_COMPACTION_SUMMARY_CHARS) : value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function appendCompactionSummary(previous: string, text: string): string {
|
|
63
|
+
const remaining = MAX_COMPACTION_SUMMARY_CHARS - previous.length;
|
|
64
|
+
if (remaining <= 0) return previous;
|
|
65
|
+
return previous + (text.length > remaining ? text.slice(0, remaining) : text);
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
|
|
57
69
|
export function applyCompactionUpdate(
|
|
58
70
|
previous: AcpCompactionRecord | undefined,
|
|
@@ -69,7 +81,7 @@ export function applyCompactionUpdate(
|
|
|
69
81
|
sessionId,
|
|
70
82
|
compactionId: update.compactionId,
|
|
71
83
|
status: update.status,
|
|
72
|
-
summary: summary === undefined ? previous?.summary ?? "" : summary,
|
|
84
|
+
summary: summary === undefined ? previous?.summary ?? "" : boundedCompactionSummary(summary),
|
|
73
85
|
...(errorProvided ? (error !== undefined ? { error } : {}) : previous?.error !== undefined ? { error: previous.error } : {}),
|
|
74
86
|
updatedAt: now,
|
|
75
87
|
notified: previous?.notified ?? false,
|
|
@@ -89,7 +101,7 @@ export function applyCompactionChunk(
|
|
|
89
101
|
sessionId,
|
|
90
102
|
compactionId: chunk.compactionId,
|
|
91
103
|
status: previous?.status ?? "in_progress",
|
|
92
|
-
summary: (previous?.summary ?? ""
|
|
104
|
+
summary: appendCompactionSummary(previous?.summary ?? "", text),
|
|
93
105
|
...(previous?.error !== undefined ? { error: previous.error } : {}),
|
|
94
106
|
updatedAt: now,
|
|
95
107
|
notified: previous?.notified ?? false,
|
package/extension/acp-errors.ts
CHANGED
|
@@ -34,7 +34,7 @@ const AUTH_RULE: FailureRule = {
|
|
|
34
34
|
code: "auth",
|
|
35
35
|
match: /authentication required|not logged in|not signed in|unauthenticated|sign in|invalid_grant|401 unauthorized/i,
|
|
36
36
|
ensure: /run `agy`|terminal/i,
|
|
37
|
-
append: "run `agy` once in a terminal to sign in",
|
|
37
|
+
append: "run `agy` once in a terminal to sign in, or verify HTTP_PROXY/HTTPS_PROXY if token refresh timed out",
|
|
38
38
|
};
|
|
39
39
|
const QUOTA_RULE: FailureRule = {
|
|
40
40
|
code: "quota",
|
|
@@ -75,9 +75,10 @@ const SERVER_RULE: FailureRule = {
|
|
|
75
75
|
const TRANSPORT_RULE: FailureRule = {
|
|
76
76
|
code: "transport",
|
|
77
77
|
match: /network|connection|fetch failed|socket|stream ended|closed|ENOTFOUND|EAI_AGAIN|broken pipe|EPIPE|failed to bind|process exited/i,
|
|
78
|
-
ensure: /connection|network|socket|stream|bind|process/i,
|
|
79
|
-
append: "connection error",
|
|
78
|
+
ensure: /connection|network|socket|stream|bind|process|proxy/i,
|
|
79
|
+
append: "connection/network error — check network or HTTP_PROXY/HTTPS_PROXY",
|
|
80
80
|
};
|
|
81
|
+
const OAUTH_NETWORK_REFRESH = /(?:token refresh failed due to network|oauth2\.googleapis\.com\/token[^:]*:\s*(?:EOF|unexpected EOF|context deadline exceeded|timeout|ENOTFOUND|EAI_AGAIN|connection|network))/i;
|
|
81
82
|
const RULES: FailureRule[] = [
|
|
82
83
|
AUTH_RULE,
|
|
83
84
|
QUOTA_RULE,
|
|
@@ -133,11 +134,18 @@ export function classifyAcpFailure(error: unknown): Error {
|
|
|
133
134
|
if (error.code === "quota") return new AcpFailure("quota", redactSensitiveText(appendHint(error.message, QUOTA_RULE)), cause);
|
|
134
135
|
if (error.code === "timeout") return new AcpFailure("timeout", redactSensitiveText(appendHint(error.message, TIMEOUT_RULE)), cause);
|
|
135
136
|
if (error.code === "spawn" || error.code === "process_exit") return new AcpFailure("transport", redactSensitiveText(appendHint(error.message, TRANSPORT_RULE)), cause);
|
|
137
|
+
if ((error.code === "protocol" || error.code === "invalid_input")
|
|
138
|
+
&& OAUTH_NETWORK_REFRESH.test(error.message) && !/invalid_grant/i.test(error.message)) {
|
|
139
|
+
return new AcpFailure("transport", redactSensitiveText(appendHint(error.message, TRANSPORT_RULE)), cause);
|
|
140
|
+
}
|
|
136
141
|
if (error.code === "protocol" || error.code === "invalid_input") return new AcpFailure("protocol", redactSensitiveText(appendHint(error.message, PROTOCOL_RULE)), cause);
|
|
137
142
|
if (error.code === "model") return new AcpFailure("model", redactSensitiveText(error.message), cause);
|
|
138
143
|
}
|
|
139
144
|
const message = error instanceof Error ? error.message : String(error);
|
|
140
145
|
if (!message.trim()) return needsSanitization(error) ? sanitizedError(error) : error instanceof Error ? error : new Error(message);
|
|
146
|
+
if (OAUTH_NETWORK_REFRESH.test(message) && !/invalid_grant/i.test(message)) {
|
|
147
|
+
return new AcpFailure("transport", redactSensitiveText(appendHint(message, TRANSPORT_RULE)), { cause: sanitizedCause(error) });
|
|
148
|
+
}
|
|
141
149
|
for (const rule of RULES) {
|
|
142
150
|
if (rule.match.test(message)) {
|
|
143
151
|
return new AcpFailure(rule.code, redactSensitiveText(appendHint(message, rule)), { cause: sanitizedCause(error) });
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare module "proper-lockfile" {
|
|
2
|
+
export interface LockOptions {
|
|
3
|
+
realpath?: boolean;
|
|
4
|
+
stale?: number;
|
|
5
|
+
retries?: number;
|
|
6
|
+
onCompromised?: (error: Error) => void;
|
|
7
|
+
}
|
|
8
|
+
export function lock(file: string, options?: LockOptions): Promise<() => Promise<void>>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module "unzipper" {
|
|
12
|
+
export interface File {
|
|
13
|
+
type: string;
|
|
14
|
+
path: string;
|
|
15
|
+
compressionMethod: number;
|
|
16
|
+
uncompressedSize: number;
|
|
17
|
+
stream(): import("node:stream").Readable;
|
|
18
|
+
}
|
|
19
|
+
export function Extract(options?: { path?: string }): import("node:stream").Writable;
|
|
20
|
+
export const Open: {
|
|
21
|
+
file(archivePath: string): Promise<{ files: File[] }>;
|
|
22
|
+
};
|
|
23
|
+
}
|