@timmyjl12/pi-agy-bridge 0.2.1 → 0.3.0
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/ARCHITECTURE.md +2 -2
- package/README.md +7 -6
- package/UPGRADING.md +6 -4
- package/compat/baselines/agy-1.5.16.json +284 -0
- package/compat/baselines/sdk-0.1.24.json +4343 -0
- package/compat/matrix.json +2 -2
- package/compat/probe.ts +1 -1
- package/compat/sdk-canary/pyproject.toml +1 -1
- package/compat/sdk-canary/uv.lock +8 -8
- package/package.json +1 -1
- package/src/accounts.ts +26 -1
- package/src/acp/connection.ts +1 -1
- package/src/runtime.ts +2 -2
- package/src/session-pool.ts +10 -1
- package/src/stream.ts +16 -0
package/compat/matrix.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"agy": {
|
|
4
|
-
"tested": ["1.5.3", "1.5.8", "1.5.9", "1.5.12", "1.5.14"],
|
|
4
|
+
"tested": ["1.5.3", "1.5.8", "1.5.9", "1.5.12", "1.5.14", "1.5.16"],
|
|
5
5
|
"minimum": "1.5.1",
|
|
6
6
|
"knownBad": []
|
|
7
7
|
},
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
},
|
|
11
11
|
"sdk": {
|
|
12
12
|
"package": "google-antigravity",
|
|
13
|
-
"tested": ["0.1.23"]
|
|
13
|
+
"tested": ["0.1.23", "0.1.24"]
|
|
14
14
|
}
|
|
15
15
|
}
|
package/compat/probe.ts
CHANGED
|
@@ -40,7 +40,7 @@ export const PROBE_PROTOCOL_VERSION = 1;
|
|
|
40
40
|
export const PROBE_CLIENT_INFO = {
|
|
41
41
|
name: "pi-agy-bridge-compat-probe",
|
|
42
42
|
title: "pi-agy-bridge zero-cost compat probe",
|
|
43
|
-
version: "0.
|
|
43
|
+
version: "0.3.0",
|
|
44
44
|
} as const;
|
|
45
45
|
|
|
46
46
|
/** One failed probe step. `step` names the command or exchange. */
|
|
@@ -3,7 +3,7 @@ name = "pi-agy-sdk-canary"
|
|
|
3
3
|
version = "0.1.0"
|
|
4
4
|
description = "Protocol drift canary for the google-antigravity harness contract (pi-agy-bridge upgrade path)"
|
|
5
5
|
requires-python = ">=3.10"
|
|
6
|
-
dependencies = ["google-antigravity==0.1.
|
|
6
|
+
dependencies = ["google-antigravity==0.1.24"]
|
|
7
7
|
|
|
8
8
|
[tool.uv]
|
|
9
9
|
package = false
|
|
@@ -434,7 +434,7 @@ wheels = [
|
|
|
434
434
|
|
|
435
435
|
[[package]]
|
|
436
436
|
name = "google-antigravity"
|
|
437
|
-
version = "0.1.
|
|
437
|
+
version = "0.1.24"
|
|
438
438
|
source = { registry = "https://pypi.org/simple" }
|
|
439
439
|
dependencies = [
|
|
440
440
|
{ name = "absl-py" },
|
|
@@ -448,12 +448,12 @@ dependencies = [
|
|
|
448
448
|
{ name = "websockets", version = "17.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
|
|
449
449
|
]
|
|
450
450
|
wheels = [
|
|
451
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
452
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
453
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
454
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
455
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
456
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
451
|
+
{ url = "https://files.pythonhosted.org/packages/71/60/d276f00361ddedb6f9d3f2618775a909acff006279fb7bc6a64e23c75fcf/google_antigravity-0.1.24-py3-none-macosx_11_0_arm64.whl", hash = "sha256:9c359bfa7b752ad3417da1a455a114dca643d02bdea7281e8de8d0d0f44c9cca", size = 38296783, upload-time = "2026-11-19T15:44:26.497Z" },
|
|
452
|
+
{ url = "https://files.pythonhosted.org/packages/32/e5/23dca5b02fe92b5e4b2516ee41b1fd762de501d931aff2be6893472d60a4/google_antigravity-0.1.24-py3-none-macosx_11_0_x86_64.whl", hash = "sha256:ff368c84cc712b822c87dd2ac99b8fac47716c44ffa39bd1caf823e62f00a18f", size = 40384370, upload-time = "2026-11-19T15:44:22.022Z" },
|
|
453
|
+
{ url = "https://files.pythonhosted.org/packages/3d/2b/8ae68143e638cd7ac4db9824cc9b0fb6036b2ad92f8a15c4467602d53dfd/google_antigravity-0.1.24-py3-none-manylinux_2_17_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:55c95c04b00c417667d37a000931638c23479d0f1fa0fbe6e89abb8c60057cda", size = 39805700, upload-time = "2026-11-19T15:44:19.1Z" },
|
|
454
|
+
{ url = "https://files.pythonhosted.org/packages/bc/4f/c697485a4fabffd38947eab670485fbcf7e24add178a64c6982f72c4708a/google_antigravity-0.1.24-py3-none-manylinux_2_17_x86_64.musllinux_1_1_x86_64.whl", hash = "sha256:678c5c56a4efa8d94b90df808a93b339cf3ead498b01898272d5833c8c9ad13f", size = 43525848, upload-time = "2026-11-19T15:44:16.144Z" },
|
|
455
|
+
{ url = "https://files.pythonhosted.org/packages/37/63/de80a45b2fad18f5e97cfc12a25436b6498669fe5eb8c6694e386b48d6d8/google_antigravity-0.1.24-py3-none-win_amd64.whl", hash = "sha256:cc2d2af2cbc260d9a9f6c95e7b844185dad29b44760c1e3884d2cb001f55adb8", size = 42817643, upload-time = "2026-11-19T15:44:13.137Z" },
|
|
456
|
+
{ url = "https://files.pythonhosted.org/packages/37/0a/b209a4339870016cfc23ec44d87151677972fd9ab5e83de0f87f7ad6f40e/google_antigravity-0.1.24-py3-none-win_arm64.whl", hash = "sha256:28837e53cf361fca8c63edee1d3cc0ba22c08eae3dec594d7f332e320fdcc9b7", size = 39222454, upload-time = "2026-11-19T15:44:10.04Z" },
|
|
457
457
|
]
|
|
458
458
|
|
|
459
459
|
[[package]]
|
|
@@ -744,7 +744,7 @@ dependencies = [
|
|
|
744
744
|
]
|
|
745
745
|
|
|
746
746
|
[package.metadata]
|
|
747
|
-
requires-dist = [{ name = "google-antigravity", specifier = "==0.1.
|
|
747
|
+
requires-dist = [{ name = "google-antigravity", specifier = "==0.1.24" }]
|
|
748
748
|
|
|
749
749
|
[[package]]
|
|
750
750
|
name = "protobuf"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timmyjl12/pi-agy-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "pi provider for Google Antigravity (agy) models over the official ACP server, modelled on pi-claude-code: pi keeps the loop, history and tool execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/accounts.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// which account a process serves, and refuses to use an extra-account process that is not the expected account.
|
|
11
11
|
|
|
12
12
|
import { spawn, type ChildProcess } from "node:child_process";
|
|
13
|
-
import { mkdir, readFile, rm, stat } from "node:fs/promises";
|
|
13
|
+
import { mkdir, readFile, rename, rm, stat } from "node:fs/promises";
|
|
14
14
|
import path from "node:path";
|
|
15
15
|
import { writeFileAtomic } from "./atomic-write.ts";
|
|
16
16
|
|
|
@@ -76,6 +76,8 @@ export interface AccountPaths {
|
|
|
76
76
|
root: string;
|
|
77
77
|
geminiDir: string;
|
|
78
78
|
logFile: string;
|
|
79
|
+
/** The previous process's agy log, kept so a failure (a stall, a timeout) can be read after the restart. */
|
|
80
|
+
prevLogFile: string;
|
|
79
81
|
loginLog: string;
|
|
80
82
|
tokenFile: string;
|
|
81
83
|
}
|
|
@@ -87,11 +89,34 @@ export function accountPaths(home: string, id: string): AccountPaths {
|
|
|
87
89
|
root,
|
|
88
90
|
geminiDir,
|
|
89
91
|
logFile: path.join(root, "acp.log"),
|
|
92
|
+
prevLogFile: path.join(root, "acp.prev.log"),
|
|
90
93
|
loginLog: path.join(root, "login.log"),
|
|
91
94
|
tokenFile: path.join(geminiDir, "antigravity-cli", "antigravity-oauth-token"),
|
|
92
95
|
};
|
|
93
96
|
}
|
|
94
97
|
|
|
98
|
+
/** Before an extra-account process starts: move its last log to `acp.prev.log` (replacing the older one) so the new
|
|
99
|
+
* process starts with an empty log for the identity guard, while the previous run stays readable. */
|
|
100
|
+
export async function rotateAccountLog(
|
|
101
|
+
paths: Pick<AccountPaths, "logFile" | "prevLogFile">,
|
|
102
|
+
io: { rename: typeof rename; rm: typeof rm } = { rename, rm },
|
|
103
|
+
): Promise<void> {
|
|
104
|
+
// On Windows a process that is still exiting can hold the log for a moment (EBUSY/EPERM/EACCES): retry briefly.
|
|
105
|
+
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
106
|
+
try {
|
|
107
|
+
await io.rename(paths.logFile, paths.prevLogFile);
|
|
108
|
+
return;
|
|
109
|
+
} catch (error) {
|
|
110
|
+
const code = (error as NodeJS.ErrnoException).code ?? "";
|
|
111
|
+
if (code === "ENOENT") return;
|
|
112
|
+
if (!["EBUSY", "EPERM", "EACCES"].includes(code)) break;
|
|
113
|
+
await new Promise((resolve) => setTimeout(resolve, 50 * (attempt + 1)));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Still cannot move it: drop it (as before 0.3.0), the identity guard needs a fresh log.
|
|
117
|
+
await io.rm(paths.logFile, { force: true, maxRetries: 5, retryDelay: 100 });
|
|
118
|
+
}
|
|
119
|
+
|
|
95
120
|
/** Is a saved login present for this extra account (existence only; the file is never read)? */
|
|
96
121
|
export async function hasSavedLogin(home: string, id: string): Promise<boolean> {
|
|
97
122
|
try {
|
package/src/acp/connection.ts
CHANGED
|
@@ -194,7 +194,7 @@ export class AcpProcess {
|
|
|
194
194
|
const result = await this.#rpc.request("initialize", {
|
|
195
195
|
protocolVersion: 1,
|
|
196
196
|
clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false },
|
|
197
|
-
clientInfo: { name: "pi-agy-bridge", title: "pi-agy-bridge", version: "0.
|
|
197
|
+
clientInfo: { name: "pi-agy-bridge", title: "pi-agy-bridge", version: "0.3.0" },
|
|
198
198
|
});
|
|
199
199
|
return (result ?? {}) as AcpInitializeResult;
|
|
200
200
|
}
|
package/src/runtime.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// The per-extension runtime: configuration, the shared session pool, agy compatibility state and facts learned
|
|
2
2
|
// while running (observed context windows). One instance per extension load; tests build their own.
|
|
3
3
|
|
|
4
|
-
import { rm } from "node:fs/promises";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
import {
|
|
7
6
|
accountPaths,
|
|
8
7
|
DEFAULT_ACCOUNT,
|
|
9
8
|
FILE_STORAGE_ENV,
|
|
10
9
|
maskEmail,
|
|
10
|
+
rotateAccountLog,
|
|
11
11
|
waitForIdentity,
|
|
12
12
|
type AccountRecord,
|
|
13
13
|
type Identity,
|
|
@@ -164,7 +164,7 @@ export class AgyRuntime {
|
|
|
164
164
|
extraArgs: (staging) =>
|
|
165
165
|
// The real argv already names the gemini dir through the staging override; a test argv may not.
|
|
166
166
|
this.#options.pool?.buildArgs ? ["--gemini-dir", staging.geminiDir, "--log-file", paths.logFile] : ["--log-file", paths.logFile],
|
|
167
|
-
beforeStart: () =>
|
|
167
|
+
beforeStart: () => rotateAccountLog(paths),
|
|
168
168
|
verifyProcess: (proc, sessionFailure) => this.#checkIdentity(paths.logFile, proc, sessionFailure),
|
|
169
169
|
}
|
|
170
170
|
: {}),
|
package/src/session-pool.ts
CHANGED
|
@@ -209,7 +209,16 @@ export class SessionPool {
|
|
|
209
209
|
: ["acp", "--add-dir", staging.addDir, "--agent", staging.agentName, "--gemini-dir", staging.geminiDir]),
|
|
210
210
|
...(this.#options.extraArgs?.(staging) ?? []),
|
|
211
211
|
];
|
|
212
|
-
|
|
212
|
+
try {
|
|
213
|
+
await this.#options.beforeStart?.();
|
|
214
|
+
} catch (error) {
|
|
215
|
+
// A local file problem (for example a log still locked by the previous process) is a start failure, retryable
|
|
216
|
+
// for fallback chains. Only the error code goes into the message: the OS text (`EACCES: permission denied`)
|
|
217
|
+
// would be read as a sign-in problem by the classifiers. The full error stays in `cause` and the trace.
|
|
218
|
+
const code = (error as NodeJS.ErrnoException | undefined)?.code ?? "unknown";
|
|
219
|
+
this.#options.log?.(`beforeStart failed: ${describeError(error)}`);
|
|
220
|
+
throw new AgyError("spawn", `agy spawn failed: could not prepare the account log (${code}); retry`, { cause: error });
|
|
221
|
+
}
|
|
213
222
|
const proc = AcpProcess.start({
|
|
214
223
|
command,
|
|
215
224
|
args,
|
package/src/stream.ts
CHANGED
|
@@ -489,6 +489,12 @@ async function runTurn(
|
|
|
489
489
|
let silenceTimer: NodeJS.Timeout | undefined;
|
|
490
490
|
let probeTimer: NodeJS.Timeout | undefined;
|
|
491
491
|
let settled = false;
|
|
492
|
+
// Diagnostics for stalls and timeouts (PI_AGY_TRACE=1): what agy last sent, and when.
|
|
493
|
+
const startedAt = Date.now();
|
|
494
|
+
let updates = 0;
|
|
495
|
+
let firstUpdateAt: number | undefined;
|
|
496
|
+
let lastUpdateAt: number | undefined;
|
|
497
|
+
let lastUpdateKind = "none";
|
|
492
498
|
let expire: () => void = () => undefined;
|
|
493
499
|
const graceExpired = new Promise<"grace">((resolve) => {
|
|
494
500
|
expire = () => resolve("grace");
|
|
@@ -497,6 +503,12 @@ async function runTurn(
|
|
|
497
503
|
const requestCancel = (reason: CancelReason): void => {
|
|
498
504
|
if (cancelReason || settled) return;
|
|
499
505
|
cancelReason = reason;
|
|
506
|
+
if (reason === "stall" || reason === "timeout" || reason === "refused") {
|
|
507
|
+
const now = Date.now();
|
|
508
|
+
runtime.trace(
|
|
509
|
+
`turn: ${reason} model=${model.id} after ${now - startedAt}ms; updates=${updates} first=${firstUpdateAt === undefined ? "none" : `${firstUpdateAt - startedAt}ms`} last=${lastUpdateKind}${lastUpdateAt === undefined ? "" : ` ${now - lastUpdateAt}ms ago`} text=${translator.producedOutput}`,
|
|
510
|
+
);
|
|
511
|
+
}
|
|
500
512
|
if (silenceTimer) clearTimeout(silenceTimer);
|
|
501
513
|
if (totalTimer) clearTimeout(totalTimer);
|
|
502
514
|
if (probeTimer) clearTimeout(probeTimer);
|
|
@@ -519,6 +531,10 @@ async function runTurn(
|
|
|
519
531
|
|
|
520
532
|
const stop = proc.listen(acpSessionId, (update) => {
|
|
521
533
|
arm();
|
|
534
|
+
updates += 1;
|
|
535
|
+
lastUpdateAt = Date.now();
|
|
536
|
+
firstUpdateAt ??= lastUpdateAt;
|
|
537
|
+
lastUpdateKind = update.sessionUpdate ?? "unknown";
|
|
522
538
|
switch (update.sessionUpdate) {
|
|
523
539
|
case "agent_message_chunk":
|
|
524
540
|
if (cancelReason) break;
|