@devries-cameron20 / t3code Mirror · read-only / commits / 90a86d5cb1
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

fix(server): refuse Antigravity runtimes below 1.5 (#38970)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 19, 2026 at 16:58 UTC 90a86d5cb1d70ea2a723608afd5e83f26ec7c637
21 files changed +495 -1391
apps/server/scripts/acp-mock-agent.ts
+1 -27
@@ -18,7 +18,6 @@ import { beginAcpMockPrompt } from "./acpMockCancellationState.ts";
18
19 const requestLogPath = process.env.T3_ACP_REQUEST_LOG_PATH;
20 const antigravityProfile = process.env.T3_ACP_ANTIGRAVITY === "1";
21 -const harnessFailure = process.env.T3_ACP_ANTIGRAVITY_HARNESS_FAILURE;
21 // GitHub Copilot CLI advertises URL-shaped session mode ids.
22 const copilotModesProfile = process.env.T3_ACP_COPILOT_MODES === "1";
23 const copilotModeId = (name: string) =>
@@ -522,16 +521,6 @@ const program = Effect.gen(function* () {
521 },
522 });
523
525 - const writeHarnessFailure = Effect.promise(
526 - () =>
527 - new Promise<void>((resolve) => {
528 - process.stderr.write(
529 - "I1022 11:04:37.910207 1865358 local_connection.py:551] harness stderr: Agent run failed: failed to handle call hook response: no pending hook for ID hook_request_2\n",
530 - () => resolve(),
531 - );
532 - }),
533 - );
534 -
524 const finishPrompt = (
525 targetSessionId: string,
526 stopReason: AcpSchema.StopReason,
@@ -1055,19 +1044,6 @@ const program = Effect.gen(function* () {
1044 );
1045 return {};
1046 }
1058 - if (
1059 - harnessFailure === "1" ||
1060 - harnessFailure === "pending" ||
1061 - harnessFailure === "after-end-turn"
1062 - ) {
1063 - if (harnessFailure === "after-end-turn") {
1064 - return yield* finishPrompt(requestedSessionId, "end_turn");
1065 - }
1066 - yield* writeHarnessFailure;
1067 - if (harnessFailure === "pending") return yield* Effect.never;
1068 - return yield* finishPrompt(requestedSessionId, "end_turn");
1069 - }
1070 -
1047 if (clientFsProbePath !== undefined && clientFsProbeLogPath !== undefined) {
1048 const probes = [
1049 [
@@ -2210,9 +2186,7 @@ const program = Effect.gen(function* () {
2186 typeof params === "object" && params !== null ? Reflect.get(params, "code") : undefined;
2187 process.exit(typeof code === "number" ? code : 19);
2188 })
2213 - : method === "_test/harness-failure"
2214 - ? writeHarnessFailure
2215 - : Effect.void,
2189 + : Effect.void,
2190 );
2191
2192 return yield* Effect.never;
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts
+4 -159
@@ -166,156 +166,6 @@ const layerSession = Layer.mergeAll(
166 ),
167 );
168
169 -describe("AntigravityAdapterV2 harness recovery", () => {
170 - const recoverHarnessFailure = (
171 - harnessFailure: "1" | "pending" | "after-end-turn",
172 - firstTurnStatuses: ReadonlyArray<"failed" | "completed">,
173 - ) => {
174 - let terminationCount = 0;
175 - return Effect.gen(function* () {
176 - const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
177 - const fileSystem = yield* FileSystem.FileSystem;
178 - const path = yield* Path.Path;
179 - const crypto = yield* SecureRandom.SecureRandom;
180 - const mockAgentPath = yield* path.fromFileUrl(
181 - new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
182 - );
183 - const workspace = yield* fileSystem.makeTempDirectoryScoped();
184 - const requestLogPath = path.join(workspace, "requests.jsonl");
185 - let processCount = 0;
186 - const firstRuntimeTerminated = yield* Deferred.make<void>();
187 - let firstRuntime: AcpSessionRuntime.AcpSessionRuntime["Service"] | undefined;
188 - const instanceId = ProviderInstanceId.make("antigravity-recovery-test");
189 - const adapter = yield* makeAntigravityAdapterV2({
190 - instanceId,
191 - selfInvocation: yield* resolveSelfInvocation(),
192 - makeRuntime: (input) =>
193 - Effect.suspend(() => {
194 - processCount += 1;
195 - const processNumber = processCount;
196 - return makeAntigravityAcpRuntime({
197 - ...input,
198 - onTermination: (error) =>
199 - (input.onTermination?.(error) ?? Effect.void).pipe(
200 - Effect.tap(
201 - Effect.sync(() => {
202 - terminationCount += 1;
203 - }),
204 - ),
205 - Effect.andThen(
206 - processNumber === 1
207 - ? Deferred.succeed(firstRuntimeTerminated, undefined)
208 - : Effect.void,
209 - ),
210 - ),
211 - childProcessSpawner,
212 - spawn: {
213 - command: process.execPath,
214 - args: [mockAgentPath],
215 - cwd: input.cwd,
216 - env: {
217 - T3_ACP_ANTIGRAVITY: "1",
218 - T3_ACP_REQUEST_LOG_PATH: requestLogPath,
219 - ...(processNumber === 1
220 - ? { T3_ACP_ANTIGRAVITY_HARNESS_FAILURE: harnessFailure }
221 - : {}),
222 - },
223 - },
224 - }).pipe(
225 - Effect.provideService(SecureRandom.SecureRandom, crypto),
226 - Effect.tap((runtime) =>
227 - Effect.sync(() => {
228 - if (processNumber === 1) firstRuntime = runtime;
229 - }),
230 - ),
231 - );
232 - }),
233 - withProcess: (_stop, task) => task,
234 - defaultModel: Effect.undefined,
235 - });
236 - const threadId = ThreadId.make("thread-antigravity-recovery");
237 - const modelSelection = { instanceId, model: "gemini-test-low" } as const;
238 - const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
239 - runtimeMode: "full-access",
240 - interactionMode: "default",
241 - cwd: workspace,
242 - });
243 - const session = yield* adapter.openSession({
244 - threadId,
245 - providerSessionId: ProviderSessionId.make("provider-session-antigravity-recovery"),
246 - modelSelection,
247 - runtimePolicy,
248 - });
249 - const events = yield* Queue.unbounded<ProviderAdapter.ProviderAdapterV2Event>();
250 - yield* session.events.pipe(
251 - Stream.runForEach((event) => Queue.offer(events, event)),
252 - Effect.forkScoped,
253 - );
254 - const providerThread = yield* session.ensureThread({
255 - threadId,
256 - modelSelection,
257 - runtimePolicy,
258 - });
259 - const now = yield* DateTime.now;
260 - const terminal = Stream.fromQueue(events).pipe(
261 - Stream.filter((event) => event.type === "turn.terminal"),
262 - Stream.runHead,
263 - );
264 - yield* session.startTurn(
265 - makeTurnInput({ threadId, providerThread, instanceId, runtimePolicy, modelSelection, now }),
266 - );
267 - const first = yield* terminal;
268 - assert.equal(first._tag, "Some");
269 - if (first._tag === "Some") assert.include(firstTurnStatuses, first.value.status);
270 - if (harnessFailure === "after-end-turn") {
271 - assert.exists(firstRuntime);
272 - yield* firstRuntime!.notify("_test/harness-failure", {});
273 - }
274 - // The adapter must retire the first process even when end_turn won the race.
275 - yield* Deferred.await(firstRuntimeTerminated);
276 - yield* session.startTurn(
277 - makeTurnInput({
278 - threadId,
279 - providerThread,
280 - instanceId,
281 - runtimePolicy,
282 - modelSelection,
283 - now,
284 - ordinal: 2,
285 - }),
286 - );
287 - const completed = yield* terminal;
288 - assert.equal(completed._tag, "Some");
289 - if (completed._tag === "Some") assert.equal(completed.value.status, "completed");
290 - assert.equal(processCount, 2);
291 - assert.equal(terminationCount, 1);
292 - const requests = (yield* fileSystem.readFileString(requestLogPath))
293 - .trim()
294 - .split("\n")
295 - .map((line) => JSON.parse(line) as { method?: string; params?: { sessionId?: string } });
296 - const resumeRequests = requests.filter((request) => request.method === "session/resume");
297 - assert.equal(resumeRequests.length, 1);
298 - assert.equal(resumeRequests[0]?.params?.sessionId, "mock-session-1");
299 - }).pipe(
300 - Effect.provide(layerSession),
301 - Effect.scoped,
302 - Effect.tap(Effect.sync(() => assert.equal(terminationCount, 1))),
303 - );
304 - };
305 -
306 - it.live("fails an open turn and resumes its saved session after a harness failure", () =>
307 - recoverHarnessFailure("pending", ["failed"]),
308 - );
309 -
310 - it.live("resumes the saved session after a harness failure races end_turn", () =>
311 - recoverHarnessFailure("1", ["failed", "completed"]),
312 - );
313 -
314 - it.live("resumes in a fresh process when the native failure arrives after end_turn", () =>
315 - recoverHarnessFailure("after-end-turn", ["completed"]),
316 - );
317 -});
318 -
169 describe("AntigravityAdapterV2 compaction", () => {
170 it.live.each([
171 { nativeGoals: false, compact: false },
@@ -2029,8 +1879,8 @@ describe("AntigravityAdapterV2 runtime mode ceiling", () => {
1879 });
1880
1881 describe("AntigravityAdapterV2 session system prompt", () => {
2032 - it.effect.each(["1.4.5", "1.4.1"])(
2033 - "carries PR linking once in the %s session setup or once per turn",
1882 + it.effect.each(["1.5.0"])(
1883 + "carries PR linking once per turn on %s, which does not advertise a system prompt append",
1884 (agentVersion) =>
1885 Effect.gen(function* () {
1886 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
@@ -2148,13 +1998,8 @@ describe("AntigravityAdapterV2 session system prompt", () => {
1998 const append = JSON.stringify(sessionNew?.params?._meta ?? null);
1999 // Identity stays per turn either way.
2000 assert.include(sent, "through the Antigravity harness, as gemini-test-low");
2151 - if (agentVersion === "1.4.5") {
2152 - assert.include(append, "pull_request_linking");
2153 - assert.notInclude(sent, "<pull_request_linking>");
2154 - } else {
2155 - assert.notInclude(append, "systemPrompt");
2156 - assert.include(sent, "<pull_request_linking>");
2157 - }
2001 + assert.notInclude(append, "systemPrompt");
2002 + assert.include(sent, "<pull_request_linking>");
2003 }).pipe(Effect.provide(layerSession)),
2004 );
2005 });
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts
+1 -11
@@ -222,21 +222,12 @@ export function makeAntigravityAcpAdapterFlavor(
222 mcpOverHttp: true,
223 sessionCarriesPullRequestLinking: antigravityAppendsSystemPrompt,
224 makeRuntime,
225 - buildAttachmentPrompt: ({
226 - text,
227 - attachments,
228 - resolveAttachmentPath,
229 - promptCapabilities,
230 - agentVersion,
231 - currentModel,
232 - }) =>
225 + buildAttachmentPrompt: ({ text, attachments, resolveAttachmentPath, promptCapabilities }) =>
226 buildAntigravityPrompt({
227 input: text,
228 attachments,
229 resolveAttachmentPath,
230 promptCapabilities,
238 - agentVersion,
239 - currentModel,
231 }).pipe(
232 Effect.map((blocks) => (text.trim() ? blocks.slice(1) : blocks)),
233 Effect.provideService(FileSystem.FileSystem, options.fileSystem),
@@ -297,7 +288,6 @@ export function makeAntigravityAcpAdapterFlavor(
288 requiresSignIn: isAntigravitySignInRequiredError,
289 // Antigravity can leave a prompt open without updates; long tools and approvals pause this.
290 promptInactivityTimeout: "15 minutes",
300 - // 1.4.5 returns the root trajectory's Gemini usageMetadata delta; 1.4.1 returns none.
291 reportsPerTurnPromptUsage: true,
292 geminiPromptUsage: true,
293 ...(profileDirectory === undefined
apps/server/src/provider/AntigravityInstallation.test.ts
+195 -467
@@ -1,5 +1,4 @@
1 import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
2 -import * as NodePath from "@effect/platform-node/NodePath";
2 import * as NodeServices from "@effect/platform-node/NodeServices";
3 import * as Layer from "effect/Layer";
4 import { expect, it } from "@effect/vitest";
@@ -25,41 +24,24 @@ import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
24
25 import * as AntigravityInstallation from "./AntigravityInstallation.ts";
26 import * as ModelManifest from "./ModelManifest.ts";
28 -import { type AntigravityReleaseAsset } from "./antigravityRelease.ts";
27 +import { type AntigravityCliReleaseAsset } from "./antigravityCliRelease.ts";
28
29 const serverContents = "antigravity runtime\n";
31 -const harnessContents = "local harness\n";
30 const previousReleaseId = "1".repeat(64);
33 -const previousVersion = "fixture-old";
31 +const previousVersion = "1.5.3";
32 +const assetVersion = "1.5.5";
33 const encodeJsonString = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
35 -
36 -const zipFixtures = {
37 - complete:
38 - "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXV9yAykQAAAADgAAABUAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWzLyU9OzFHISCzKSy0u5gIAUEsBAhQDFAAAAAgAAAAiXXMTL+gUAAAAFAAAABIAAAAAAAAAAAAAAO2BAAAAAGFneV9hY3Bfc2VydmVyLnBhclBLAQIUAxQAAAAIAAAAIl1fcgMpEAAAAA4AAAAVAAAAAAAAAAAAAADtgUQAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWxQSwUGAAAAAAIAAgCDAAAAhwAAAAAA",
39 - missingHarness:
40 - "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwECFAMUAAAACAAAACJdcxMv6BQAAAAUAAAAEgAAAAAAAAAAAAAA7YEAAAAAYWd5X2FjcF9zZXJ2ZXIucGFyUEsFBgAAAAABAAEAQAAAAEQAAAAAAA==",
41 - duplicate:
42 - "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXXMTL+gUAAAAFAAAABIAAABhZ3lfYWNwX3NlcnZlci5wYXJLzCvJTC9KLMssqVQoKgVyclO5AFBLAQIUAxQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAAAAAAAAAAADtgQAAAABhZ3lfYWNwX3NlcnZlci5wYXJQSwECFAMUAAAACAAAACJdcxMv6BQAAAAUAAAAEgAAAAAAAAAAAAAA7YFEAAAAYWd5X2FjcF9zZXJ2ZXIucGFyUEsFBgAAAAACAAIAgAAAAIgAAAAAAA==",
43 - traversal:
44 - "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAAVAAAALi5cYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXV9yAykQAAAADgAAABUAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWzLyU9OzFHISCzKSy0u5gIAUEsBAhQDFAAAAAgAAAAiXXMTL+gUAAAAFAAAABUAAAAAAAAAAAAAAO2BAAAAAC4uXGFneV9hY3Bfc2VydmVyLnBhclBLAQIUAxQAAAAIAAAAIl1fcgMpEAAAAA4AAAAVAAAAAAAAAAAAAADtgUcAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWxQSwUGAAAAAAIAAgCGAAAAigAAAAAA",
45 - symlink:
46 - "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXV9yAykQAAAADgAAABUAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWzLyU9OzFHISCzKSy0u5gIAUEsBAhQDFAAAAAgAAAAiXXMTL+gUAAAAFAAAABIAAAAAAAAAAAAAAO2BAAAAAGFneV9hY3Bfc2VydmVyLnBhclBLAQIUAxQAAAAIAAAAIl1fcgMpEAAAAA4AAAAVAAAAAAAAAAAAAAD/oUQAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWxQSwUGAAAAAAIAAgCDAAAAhwAAAAAA",
47 - oversizedMember:
48 - "UEsDBBQAAAAIAAAAIl0WGThFFQAAABUAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuSoAUEsDBBQAAAAIAAAAIl1fcgMpEAAAAA4AAAAVAAAAbG9jYWxoYXJuZXNzX2V4dGVybmFsy8lPTsxRyEgsykstLuYCAFBLAQIUAxQAAAAIAAAAIl0WGThFFQAAABUAAAASAAAAAAAAAAAAAADtgQAAAABhZ3lfYWNwX3NlcnZlci5wYXJQSwECFAMUAAAACAAAACJdX3IDKRAAAAAOAAAAFQAAAAAAAAAAAAAA7YFFAAAAbG9jYWxoYXJuZXNzX2V4dGVybmFsUEsFBgAAAAACAAIAgwAAAIgAAAAAAA==",
49 - windows:
50 - "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIuZXhlS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXV9yAykQAAAADgAAABkAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWwuZXhly8lPTsxRyEgsykstLuYCAFBLAQIUAxQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAAAAAAAAAAADtgQAAAABhZ3lfYWNwX3NlcnZlci5leGVQSwECFAMUAAAACAAAACJdX3IDKRAAAAAOAAAAGQAAAAAAAAAAAAAA7YFEAAAAbG9jYWxoYXJuZXNzX2V4dGVybmFsLmV4ZVBLBQYAAAAAAgACAIcAAACLAAAAAAA=",
51 -};
34 +// One regular member, `antigravity`, holding serverContents.
35 +const cliTarball = Buffer.from(
36 + "H4sIAAAAAAACE+3RMQ7CQAwEQNe8Ik8wgYj3XIFQCiiOCxK/56CJRA9CYqZZrxsXLpc2n2q5ze0en5LdYZpe2b1n5rhf5+d+m+MuY8j4guXaSu3n4z+V9f9DXXo5HzcBAAAAAAAAAADAz3sA56lbdQAoAAA=",
37 + "base64",
38 +);
39
40 // Linux platform mocks cannot enforce POSIX exec bits on NTFS; use the host platform.
41 const hostPlatform: NodeJS.Platform =
42 HostProcess.Platform.defaultValue() === "win32" ? "win32" : "linux";
56 -const completeArchive = Buffer.from(
57 - hostPlatform === "win32" ? zipFixtures.windows : zipFixtures.complete,
58 - "base64",
59 -);
60 -const executableName = hostPlatform === "win32" ? "agy_acp_server.exe" : "agy_acp_server.par";
61 -const harnessName =
62 - hostPlatform === "win32" ? "localharness_external.exe" : "localharness_external";
43 +const completeArchive = hostPlatform === "win32" ? Buffer.from(serverContents) : cliTarball;
44 +const executableName = hostPlatform === "win32" ? "agy.exe" : "antigravity";
45
46 const releaseAsset = Effect.fn("test.antigravityReleaseAsset")(function* (
47 archive: Uint8Array = completeArchive,
@@ -67,60 +49,51 @@ const releaseAsset = Effect.fn("test.antigravityReleaseAsset")(function* (
49 ) {
50 const digest = yield* Digest.Digest;
51 return {
70 - version: "fixture-new",
71 - url: "https://dl.google.com/antigravity-test.zip",
72 - sha256: Hex.encode(yield* digest.digest(Digest.sha256, archive).pipe(Effect.orDie)),
73 - archiveBytes: archive.byteLength,
74 - executable: {
75 - name: platform === "win32" ? "agy_acp_server.exe" : "agy_acp_server.par",
76 - bytes: Buffer.byteLength(serverContents),
77 - },
78 - harness: {
79 - name: platform === "win32" ? "localharness_external.exe" : "localharness_external",
80 - bytes: Buffer.byteLength(harnessContents),
81 - },
82 - } satisfies AntigravityReleaseAsset;
52 + version: assetVersion,
53 + url: "https://storage.googleapis.com/antigravity-test",
54 + sha512: Hex.encode(yield* digest.digest(Digest.sha512, archive).pipe(Effect.orDie)),
55 + executable: { name: platform === "win32" ? "agy.exe" : "antigravity" },
56 + format: platform === "win32" ? "executable" : "tar.gz",
57 + } satisfies AntigravityCliReleaseAsset;
58 });
59
60 const writeRelease = Effect.fn("test.writeAntigravityRelease")(function* (
61 managedDirectory: string,
87 - asset: AntigravityReleaseAsset,
62 + release: { readonly releaseId: string; readonly version: string; readonly name: string },
63 active = true,
64 ) {
65 const fs = yield* FileSystem.FileSystem;
66 const path = yield* Path.Path;
92 - const directory = path.join(managedDirectory, "versions", asset.sha256);
67 + const directory = path.join(managedDirectory, "versions", release.releaseId);
68 yield* fs.makeDirectory(directory, { recursive: true });
94 - yield* fs.writeFileString(path.join(directory, asset.executable.name), serverContents, {
95 - mode: 0o755,
96 - });
97 - yield* fs.writeFileString(path.join(directory, asset.harness.name), harnessContents, {
98 - mode: 0o755,
99 - });
69 + yield* fs.writeFileString(path.join(directory, release.name), serverContents, { mode: 0o755 });
70 yield* fs.writeFileString(
71 path.join(directory, ".install-complete.json"),
72 encodeJsonString({
103 - releaseId: asset.sha256,
104 - version: asset.version,
105 - executable: asset.executable,
106 - harness: asset.harness,
73 + releaseId: release.releaseId,
74 + version: release.version,
75 + executable: { name: release.name, bytes: Buffer.byteLength(serverContents) },
76 }),
77 );
78 if (active) {
79 yield* fs.writeFileString(
80 path.join(managedDirectory, "active.json"),
112 - encodeJsonString({ releaseId: asset.sha256 }),
81 + encodeJsonString({ releaseId: release.releaseId }),
82 );
83 }
84 });
85
86 +const assetRelease = (asset: AntigravityCliReleaseAsset) => ({
87 + releaseId: asset.sha512.slice(0, 64),
88 + version: asset.version,
89 + name: asset.executable.name,
90 +});
91 +
92 interface HarnessOptions {
93 readonly baseDir?: string;
119 - readonly asset?: AntigravityReleaseAsset | null;
94 + readonly asset?: AntigravityCliReleaseAsset | null;
95 readonly archive?: Buffer;
96 readonly body?: Stream.Stream<Uint8Array> | undefined;
122 - readonly contentLength?: number;
123 - readonly contentEncoding?: string;
97 readonly platform?: NodeJS.Platform;
98 readonly arch?: NodeJS.Architecture;
99 readonly path?: string;
@@ -154,9 +127,9 @@ const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
127 const managedDirectory = path.join(baseDir, "tools", "antigravity-acp", `${platform}-${arch}`);
128 if (options.previous) {
129 yield* writeRelease(managedDirectory, {
157 - ...(yield* releaseAsset(archive, platform)),
158 - sha256: previousReleaseId,
130 + releaseId: previousReleaseId,
131 version: previousVersion,
132 + name: platform === "win32" ? "agy.exe" : "antigravity",
133 });
134 }
135 const stagingReleased = yield* Deferred.make<void>();
@@ -237,19 +210,7 @@ const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
210 }),
211 );
212 }
240 - const response = HttpClientResponse.fromWeb(
241 - request,
242 - new Response(null, {
243 - headers: {
244 - ...(options.contentLength === undefined
245 - ? {}
246 - : { "content-length": String(options.contentLength) }),
247 - ...(options.contentEncoding === undefined
248 - ? {}
249 - : { "content-encoding": options.contentEncoding }),
250 - },
251 - }),
252 - );
213 + const response = HttpClientResponse.fromWeb(request, new Response(null));
214 return Effect.succeed(
215 Object.defineProperty(response, "stream", {
216 value:
@@ -286,24 +247,45 @@ const expectPreviousRelease = Effect.fn("test.expectPreviousAntigravityRelease")
247 path.join(installation.managedDirectory, "versions", previousReleaseId),
248 );
249 expect(yield* fs.readFileString(resolved.executablePath)).toBe(serverContents);
289 - expect(yield* fs.readFileString(resolved.harnessPath!)).toBe(harnessContents);
250 expect((yield* installation.state).installedVersion).toBe(previousVersion);
251 });
252
253 it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity installation", (it) => {
254 it.effect.each([...new Set(["win32", hostPlatform])] as NodeJS.Platform[])(
295 - "migrates the legacy managed runtime to the native CLI on %s and retains the old release",
255 + "replaces a managed runtime from before the Antigravity CLI on %s",
256 (platform) =>
257 Effect.gen(function* () {
298 - const archive =
299 - platform === "win32"
300 - ? Buffer.from(serverContents)
301 - : Buffer.from(
302 - "H4sIAAAAAAACE+3RMQ7CQAwEQNe8Ik8wgYj3XIFQCiiOCxK/56CJRA9CYqZZrxsXLpc2n2q5ze0en5LdYZpe2b1n5rhf5+d+m+MuY8j4guXaSu3n4z+V9f9DXXo5HzcBAAAAAAAAAADAz3sA56lbdQAoAAA=",
303 - "base64",
304 - );
305 - const { installation, validations, requests, fs, baseDir, stagingReleased } =
306 - yield* makeHarness({ native: true, archive, platform, previous: true });
258 + const archive = platform === "win32" ? Buffer.from(serverContents) : cliTarball;
259 + const { installation, validations, requests, fs, path, baseDir, stagingReleased } =
260 + yield* makeHarness({ native: true, archive, platform });
261 + // A 1.4.x install recorded agy_acp_server with its localharness_external sibling.
262 + const legacyId = "2".repeat(64);
263 + const legacyDirectory = path.join(installation.managedDirectory, "versions", legacyId);
264 + yield* fs.makeDirectory(legacyDirectory, { recursive: true });
265 + yield* fs.writeFileString(
266 + path.join(legacyDirectory, "agy_acp_server.par"),
267 + serverContents,
268 + {
269 + mode: 0o755,
270 + },
271 + );
272 + yield* fs.writeFileString(
273 + path.join(legacyDirectory, ".install-complete.json"),
274 + encodeJsonString({
275 + releaseId: legacyId,
276 + version: "1.4.5",
277 + executable: { name: "agy_acp_server.par", bytes: Buffer.byteLength(serverContents) },
278 + harness: { name: "localharness_external", bytes: 1 },
279 + }),
280 + );
281 + yield* fs.writeFileString(
282 + path.join(installation.managedDirectory, "active.json"),
283 + encodeJsonString({ releaseId: legacyId }),
284 + );
285 + expect(yield* installation.resolve().pipe(Effect.flip)).toMatchObject({
286 + operation: "resolve",
287 + detail: expect.stringContaining("Antigravity 1.4.5 predates the Antigravity CLI"),
288 + });
289 yield* installation.start;
290 expect(yield* terminalState(installation)).toMatchObject({
291 phase: "succeeded",
@@ -311,8 +293,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
293 });
294 yield* Deferred.await(stagingReleased);
295 const resolved = yield* installation.resolve();
314 - expect(resolved).toMatchObject({ source: "managed", version: "1.5.7", harnessPath: null });
315 - expect(validations[0]?.executable.harnessPath).toBeNull();
296 + expect(resolved).toMatchObject({ source: "managed", version: "1.5.7" });
297 + expect(validations).toHaveLength(1);
298 + expect(yield* fs.exists(legacyDirectory)).toBe(false);
299 expect(yield* fs.readFileString(resolved.executablePath)).toBe(serverContents);
300 expect(requests.some((url) => url.includes("/manifests/"))).toBe(true);
301 const restarted = yield* makeHarness({
@@ -524,9 +507,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
507 url: "https://example.com/agy.exe",
508 }),
509 },
527 - ])("rejects a native $name and preserves the legacy release", ({ change }) =>
510 + ])("rejects a native $name and preserves the previous release", ({ change }) =>
511 Effect.gen(function* () {
529 - const { installation, validations } = yield* makeHarness({
512 + const { installation, validations, requests } = yield* makeHarness({
513 native: true,
514 nativeManifest: change,
515 archive: Buffer.from(serverContents),
@@ -534,9 +517,10 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
517 previous: true,
518 });
519 const result = yield* Effect.result(installation.start);
537 - if (result._tag === "Success")
538 - expect((yield* terminalState(installation)).phase).toBe("failed");
539 - expect(validations).toEqual([]);
520 + // Without an acceptable release, start re-verifies the installed one.
521 + if (result._tag === "Success") yield* terminalState(installation);
522 + expect(validations.map(({ version }) => version)).not.toContain("1.5.7");
523 + expect(requests.some((url) => url.startsWith("https://example.com"))).toBe(false);
524 yield* expectPreviousRelease(installation);
525 }),
526 );
@@ -554,7 +538,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
538 }).pipe(Effect.provideService(HostProcess.IsExecutable, true)),
539 );
540
557 - it.effect("verifies both files before activating a streamed download", () =>
541 + it.effect("verifies the executable before activating a streamed download", () =>
542 Effect.gen(function* () {
543 const enteredValidation = yield* Deferred.make<void>();
544 const finishValidation = yield* Deferred.make<void>();
@@ -577,59 +561,35 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
561 yield* Deferred.await(enteredValidation);
562 yield* expectPreviousRelease(installation);
563 const validation = validations[0];
580 - expect(validation?.version).toBe("fixture-new");
564 + expect(validation?.version).toBe(assetVersion);
565 if (!validation) return yield* Effect.die("Expected runtime validation.");
566 expect(yield* fs.readFileString(validation.executable.executablePath)).toBe(serverContents);
583 - expect(yield* fs.readFileString(validation.executable.harnessPath!)).toBe(harnessContents);
567
568 yield* Deferred.succeed(finishValidation, undefined);
569 expect(yield* terminalState(installation)).toMatchObject({
570 phase: "succeeded",
571 operationId: started.operationId,
589 - downloadedBytes: completeArchive.byteLength,
590 - installedVersion: "fixture-new",
572 + installedVersion: assetVersion,
573 });
574 yield* Deferred.await(stagingReleased);
575 const selected = yield* installation.resolve();
594 - expect(selected).toMatchObject({ source: "managed", version: "fixture-new" });
595 - expect(path.dirname(selected.harnessPath!)).toBe(path.dirname(selected.executablePath));
576 + expect(selected).toMatchObject({ source: "managed", version: assetVersion });
577 expect(yield* fs.readFileString(selected.executablePath)).toBe(serverContents);
597 - expect(yield* fs.readFileString(selected.harnessPath!)).toBe(harnessContents);
578 expect(yield* fs.readDirectory(path.join(installation.managedDirectory, "versions"))).toEqual(
599 - [(yield* releaseAsset()).sha256],
579 + [assetRelease(yield* releaseAsset()).releaseId],
580 );
581 expect(requests).toEqual([(yield* releaseAsset()).url]);
582 }),
583 );
584
605 - it.effect("accepts an encoded Content-Length when the body is compressed", () =>
606 - Effect.gen(function* () {
607 - // dl.google.com reports the gzip-encoded size; byte and hash checks use the decoded stream.
608 - const { installation, validations } = yield* makeHarness({
609 - contentLength: completeArchive.byteLength - 1_000,
610 - contentEncoding: "gzip",
611 - });
612 - yield* installation.start;
613 - const state = yield* terminalState(installation);
614 - expect(state.phase).toBe("succeeded");
615 - expect(validations).toHaveLength(1);
616 - }),
617 - );
618 -
585 it.effect.each([
620 - { name: "checksum mismatch", completeAsset: { sha256: "2".repeat(64) } },
586 + { name: "checksum mismatch", completeAsset: { sha512: "2".repeat(128) } },
587 { name: "short download", archive: completeArchive.subarray(0, -1), completeAsset: {} },
588 {
589 name: "oversized download",
590 archive: Buffer.concat([completeArchive, Buffer.from("extra")]),
591 completeAsset: {},
592 },
627 - { name: "wrong Content-Length", contentLength: completeArchive.byteLength + 1 },
628 - { name: "missing harness", archive: Buffer.from(zipFixtures.missingHarness, "base64") },
629 - { name: "duplicate executable", archive: Buffer.from(zipFixtures.duplicate, "base64") },
630 - { name: "path traversal", archive: Buffer.from(zipFixtures.traversal, "base64") },
631 - { name: "symbolic link", archive: Buffer.from(zipFixtures.symlink, "base64") },
632 - { name: "oversized member", archive: Buffer.from(zipFixtures.oversizedMember, "base64") },
593 ])("rejects $name before runtime validation", ({ completeAsset, ...options }) =>
594 Effect.gen(function* () {
595 const asset =
@@ -700,25 +660,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
660 }),
661 );
662
703 - it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
704 - "refuses a 16 KiB-page linux-arm64 kernel before downloading the runtime",
705 - () =>
706 - Effect.gen(function* () {
707 - const realSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
708 - const spawner = ChildProcessSpawner.make((command) =>
709 - ChildProcess.isStandardCommand(command) && command.command === "getconf"
710 - ? realSpawner.spawn(ChildProcess.make("sh", ["-c", "echo 16384"], command.options))
711 - : realSpawner.spawn(command),
712 - );
713 - const { installation, requests } = yield* makeHarness({ arch: "arm64", spawner });
714 - yield* installation.start;
715 - const state = yield* terminalState(installation);
716 - expect(state.phase).toBe("failed");
717 - expect(state.message).toMatch(/4 KiB/);
718 - expect(requests).toEqual([]);
719 - }),
720 - );
721 -
663 it.effect.each(["downloaded", "existing", "concurrent"] as const)(
664 "reports a verification timeout for a %s runtime without changing the active release",
665 (source) =>
@@ -735,7 +676,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
676 ...fs,
677 rename: (from, to) =>
678 source === "concurrent" && path.basename(path.dirname(to)) === "versions"
738 - ? writeRelease(path.dirname(path.dirname(to)), asset, false).pipe(
679 + ? writeRelease(path.dirname(path.dirname(to)), assetRelease(asset), false).pipe(
680 Effect.provideService(FileSystem.FileSystem, fs),
681 Effect.provideService(Path.Path, path),
682 Effect.andThen(
@@ -759,7 +700,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
700 ),
701 });
702 if (source === "existing") {
762 - yield* writeRelease(installation.managedDirectory, asset, false);
703 + yield* writeRelease(installation.managedDirectory, assetRelease(asset), false);
704 }
705 yield* installation.start;
706 yield* Deferred.await(entered);
@@ -776,97 +717,100 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
717 }),
718 );
719
779 - it.effect.each(["download", "extract", "active pointer"] as const)(
780 - "preserves the old runtime after an ENOSPC error during %s",
781 - (stage) =>
782 - Effect.gen(function* () {
783 - const fs = yield* FileSystem.FileSystem;
784 - const noSpace = PlatformError.systemError({
785 - _tag: "Unknown",
786 - module: "FileSystem",
787 - method: "write",
788 - description: "ENOSPC: no space left on device",
789 - });
790 - const fileSystem = FileSystem.FileSystem.of({
720 + // Windows hosts copy the downloaded executable, so no extraction stream exists there.
721 + it.effect.each(
722 + hostPlatform === "win32"
723 + ? (["download", "active pointer"] as const)
724 + : (["download", "extract", "active pointer"] as const),
725 + )("preserves the old runtime after an ENOSPC error during %s", (stage) =>
726 + Effect.gen(function* () {
727 + const fs = yield* FileSystem.FileSystem;
728 + const noSpace = PlatformError.systemError({
729 + _tag: "Unknown",
730 + module: "FileSystem",
731 + method: "write",
732 + description: "ENOSPC: no space left on device",
733 + });
734 + const fileSystem = FileSystem.FileSystem.of({
735 + ...fs,
736 + sink: (target, options) =>
737 + (stage === "download" && target.endsWith("download")) ||
738 + (stage === "extract" && target.endsWith(executableName))
739 + ? fs.sink(target, options).pipe(Sink.mapInputEffect(() => Effect.fail(noSpace)))
740 + : fs.sink(target, options),
741 + writeFileString: (target, content, options) =>
742 + stage === "active pointer" && target.endsWith("contents.tmp")
743 + ? Effect.fail(noSpace)
744 + : fs.writeFileString(target, content, options),
745 + });
746 + const { installation, stagingReleased, path } = yield* makeHarness({
747 + previous: true,
748 + fileSystem,
749 + });
750 + yield* installation.start;
751 + expect((yield* terminalState(installation)).phase).toBe("failed");
752 + yield* Deferred.await(stagingReleased);
753 + yield* expectPreviousRelease(installation);
754 + expect(
755 + (yield* fs.readDirectory(path.join(installation.managedDirectory, "versions"))).some(
756 + (name) => name.startsWith(".install-"),
757 + ),
758 + ).toBe(false);
759 + expect(yield* fs.readDirectory(installation.managedDirectory)).toEqual([
760 + "active.json",
761 + "versions",
762 + ]);
763 + }),
764 + );
765 +
766 + it.effect.each(
767 + hostPlatform === "win32"
768 + ? (["downloading", "verifying"] as const)
769 + : (["downloading", "extracting", "verifying"] as const),
770 + )("cancels during %s and waits for open resources to close", (phase) =>
771 + Effect.gen(function* () {
772 + const fs = yield* FileSystem.FileSystem;
773 + const entered = yield* Deferred.make<void>();
774 + const release = yield* Deferred.make<void>();
775 + const interrupted = yield* Deferred.make<void>();
776 + const barrier = Deferred.succeed(entered, undefined).pipe(
777 + Effect.andThen(Deferred.await(release)),
778 + Effect.onInterrupt(() => Deferred.succeed(interrupted, undefined)),
779 + );
780 + const { installation, stagingReleased, path, validations } = yield* makeHarness({
781 + previous: true,
782 + body:
783 + phase === "downloading"
784 + ? Stream.concat(
785 + Stream.make(completeArchive.subarray(0, 31)),
786 + Stream.fromEffect(barrier.pipe(Effect.as(completeArchive.subarray(31)))),
787 + )
788 + : undefined,
789 + validate: phase === "verifying" ? () => barrier : undefined,
790 + fileSystem: FileSystem.FileSystem.of({
791 ...fs,
792 sink: (target, options) =>
793 - (stage === "download" && target.endsWith("download.zip")) ||
794 - (stage === "extract" && target.endsWith(executableName))
795 - ? fs.sink(target, options).pipe(Sink.mapInputEffect(() => Effect.fail(noSpace)))
793 + phase === "extracting" && target.endsWith(executableName)
794 + ? fs
795 + .sink(target, options)
796 + .pipe(Sink.mapInputEffect((chunk: Uint8Array) => barrier.pipe(Effect.as(chunk))))
797 : fs.sink(target, options),
797 - writeFileString: (target, content, options) =>
798 - stage === "active pointer" && target.endsWith("contents.tmp")
799 - ? Effect.fail(noSpace)
800 - : fs.writeFileString(target, content, options),
801 - });
802 - const { installation, stagingReleased, path } = yield* makeHarness({
803 - previous: true,
804 - fileSystem,
805 - });
806 - yield* installation.start;
807 - expect((yield* terminalState(installation)).phase).toBe("failed");
808 - yield* Deferred.await(stagingReleased);
809 - yield* expectPreviousRelease(installation);
810 - expect(
811 - (yield* fs.readDirectory(path.join(installation.managedDirectory, "versions"))).some(
812 - (name) => name.startsWith(".install-"),
813 - ),
814 - ).toBe(false);
815 - expect(yield* fs.readDirectory(installation.managedDirectory)).toEqual([
816 - "active.json",
817 - "versions",
818 - ]);
819 - }),
820 - );
821 -
822 - it.effect.each(["downloading", "extracting", "verifying"] as const)(
823 - "cancels during %s and waits for open resources to close",
824 - (phase) =>
825 - Effect.gen(function* () {
826 - const fs = yield* FileSystem.FileSystem;
827 - const entered = yield* Deferred.make<void>();
828 - const release = yield* Deferred.make<void>();
829 - const interrupted = yield* Deferred.make<void>();
830 - const barrier = Deferred.succeed(entered, undefined).pipe(
831 - Effect.andThen(Deferred.await(release)),
832 - Effect.onInterrupt(() => Deferred.succeed(interrupted, undefined)),
833 - );
834 - const { installation, stagingReleased, path, validations } = yield* makeHarness({
835 - previous: true,
836 - body:
837 - phase === "downloading"
838 - ? Stream.concat(
839 - Stream.make(completeArchive.subarray(0, 31)),
840 - Stream.fromEffect(barrier.pipe(Effect.as(completeArchive.subarray(31)))),
841 - )
842 - : undefined,
843 - validate: phase === "verifying" ? () => barrier : undefined,
844 - fileSystem: FileSystem.FileSystem.of({
845 - ...fs,
846 - sink: (target, options) =>
847 - phase === "extracting" && target.endsWith(executableName)
848 - ? fs
849 - .sink(target, options)
850 - .pipe(
851 - Sink.mapInputEffect((chunk: Uint8Array) => barrier.pipe(Effect.as(chunk))),
852 - )
853 - : fs.sink(target, options),
854 - }),
855 - });
856 - const started = yield* installation.start;
857 - yield* Deferred.await(entered);
858 - expect((yield* installation.state).phase).toBe(phase);
859 - expect(
860 - (yield* installation.cancel(started.operationId ?? "missing-operation-id")).phase,
861 - ).toBe("cancelled");
862 - yield* Deferred.await(interrupted);
863 - yield* Deferred.await(stagingReleased);
864 - yield* expectPreviousRelease(installation);
865 - expect(validations).toHaveLength(phase === "verifying" ? 1 : 0);
866 - expect(
867 - yield* fs.readDirectory(path.join(installation.managedDirectory, "versions")),
868 - ).toEqual([previousReleaseId]);
869 - }),
798 + }),
799 + });
800 + const started = yield* installation.start;
801 + yield* Deferred.await(entered);
802 + expect((yield* installation.state).phase).toBe(phase);
803 + expect(
804 + (yield* installation.cancel(started.operationId ?? "missing-operation-id")).phase,
805 + ).toBe("cancelled");
806 + yield* Deferred.await(interrupted);
807 + yield* Deferred.await(stagingReleased);
808 + yield* expectPreviousRelease(installation);
809 + expect(validations).toHaveLength(phase === "verifying" ? 1 : 0);
810 + expect(yield* fs.readDirectory(path.join(installation.managedDirectory, "versions"))).toEqual(
811 + [previousReleaseId],
812 + );
813 + }),
814 );
815
816 it.effect.each([
@@ -925,7 +869,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
869 expect(yield* installation.state).toMatchObject({
870 operationId: first.operationId,
871 phase: "succeeded",
928 - installedVersion: "fixture-new",
872 + installedVersion: assetVersion,
873 });
874 const current = testCase.restart ? yield* installation.start : first;
875 if (testCase.restart) yield* Deferred.await(nextValidationStarted);
@@ -936,15 +880,15 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
880 expect(yield* installation.state).toMatchObject({
881 operationId: current.operationId,
882 phase: testCase.restart ? "verifying" : "succeeded",
939 - installedVersion: "fixture-new",
883 + installedVersion: assetVersion,
884 });
941 - expect((yield* installation.resolve()).version).toBe("fixture-new");
885 + expect((yield* installation.resolve()).version).toBe(assetVersion);
886
887 yield* Deferred.succeed(releaseNextValidation, undefined);
888 expect(yield* terminalState(installation)).toMatchObject({
889 operationId: current.operationId,
890 phase: "succeeded",
947 - installedVersion: "fixture-new",
891 + installedVersion: assetVersion,
892 });
893 }).pipe(
894 Effect.ensuring(
@@ -1000,66 +944,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
944 }),
945 );
946
1003 - // A simulated Mac install needs POSIX execute bits, which Windows files lack.
1004 - it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
1005 - "re-signs the Intel Mac runtime ad hoc and records the signed sizes",
1006 - () =>
1007 - Effect.gen(function* () {
1008 - const fs = yield* FileSystem.FileSystem;
1009 - const signed: Array<ReadonlyArray<string>> = [];
1010 - const spawner = ChildProcessSpawner.make((command) =>
1011 - Effect.gen(function* () {
1012 - if (!ChildProcess.isStandardCommand(command))
1013 - return yield* Effect.die("Unexpected spawn.");
1014 - const args = command.args.map(String);
1015 - signed.push([String(command.command), ...args]);
1016 - // codesign rewrites the signature, which changes each file's size.
1017 - for (const file of args.slice(3)) {
1018 - yield* fs.writeFileString(file, "signature", { flag: "a" });
1019 - }
1020 - return ChildProcessSpawner.makeHandle({
1021 - pid: ChildProcessSpawner.ProcessId(900_000_301),
1022 - exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(0)),
1023 - isRunning: Effect.succeed(false),
1024 - kill: () => Effect.void,
1025 - unref: Effect.succeed(Effect.void),
1026 - stdin: Sink.drain,
1027 - stdout: Stream.empty,
1028 - stderr: Stream.empty,
1029 - all: Stream.empty,
1030 - getInputFd: () => Sink.drain,
1031 - getOutputFd: () => Stream.empty,
1032 - });
1033 - }).pipe(Effect.orDie),
1034 - );
1035 - const { installation, validations } = yield* makeHarness({
1036 - platform: "darwin",
1037 - arch: "x64",
1038 - spawner,
1039 - });
1040 - yield* installation.start;
1041 - expect((yield* terminalState(installation)).phase).toBe("succeeded");
1042 - const validated = validations[0]?.executable;
1043 - expect(signed).toEqual([
1044 - [
1045 - "/usr/bin/codesign",
1046 - "--force",
1047 - "--sign",
1048 - "-",
1049 - validated?.executablePath,
1050 - validated?.harnessPath,
1051 - ],
1052 - ]);
1053 - const selected = yield* installation.resolve();
1054 - expect(yield* fs.readFileString(selected.executablePath)).toBe(
1055 - `${serverContents}signature`,
1056 - );
1057 - }),
1058 - );
1059 -
947 // The mocked Linux PATH walk needs POSIX paths; Windows temp paths contain colons.
948 it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
1062 - "accepts the agy CLI without a harness sibling but still requires one for other binaries",
949 + "accepts only the agy CLI as a custom or PATH executable",
950 () =>
951 Effect.gen(function* () {
952 const fs = yield* FileSystem.FileSystem;
@@ -1082,21 +969,17 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
969
970 expect(yield* installation.resolve(cli)).toMatchObject({
971 executablePath: cli,
1085 - harnessPath: null,
972 source: "override",
973 version: null,
974 });
975 expect(yield* installation.resolve(alias)).toMatchObject({
976 executablePath: alias,
1091 - harnessPath: null,
977 });
978 expect(yield* installation.resolve("agy", { PATH: cliDirectory })).toMatchObject({
979 executablePath: alias,
1095 - harnessPath: null,
980 });
981 expect(yield* installation.resolve(undefined, { PATH: cliDirectory })).toMatchObject({
982 executablePath: alias,
1099 - harnessPath: null,
983 source: "path",
984 });
985 expect(yield* installation.resolve(other).pipe(Effect.flip)).toMatchObject({
@@ -1111,7 +994,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
994 yield* fs.symlink(mise, path.join(shims, "agy"));
995 expect(yield* installation.resolve("agy", { PATH: shims })).toMatchObject({
996 executablePath: path.join(shims, "agy"),
1114 - harnessPath: null,
997 });
998
999 const { installation: windows } = yield* makeHarness({ baseDir, platform: "win32" });
@@ -1120,7 +1002,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1002 yield* fs.makeDirectory(windowsDirectory);
1003 yield* fs.writeFileString(path.join(windowsDirectory, name), "cli");
1004 const selected = yield* windows.resolve("agy", { PATH: `"${windowsDirectory}"` });
1123 - expect(selected.harnessPath).toBeNull();
1005 expect((yield* fs.realPath(selected.executablePath)).toLowerCase()).toBe(
1006 (yield* fs.realPath(path.join(windowsDirectory, name))).toLowerCase(),
1007 );
@@ -1139,11 +1020,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1020 .makeTempDirectoryScoped({ prefix: "t3-agy-path-test-" })
1021 .pipe(Effect.flatMap((directory) => fs.realPath(directory)));
1022 const externalDirectory = path.join(baseDir, "external");
1142 - const externalExecutable = path.join(externalDirectory, executableName);
1143 - const externalHarness = path.join(externalDirectory, harnessName);
1023 + const externalExecutable = path.join(externalDirectory, "agy");
1024 yield* fs.makeDirectory(externalDirectory);
1145 - yield* fs.writeFileString(externalExecutable, "external server", { mode: 0o755 });
1146 - yield* fs.writeFileString(externalHarness, "external harness", { mode: 0o755 });
1025 + yield* fs.writeFileString(externalExecutable, "external cli", { mode: 0o755 });
1026 const { installation } = yield* makeHarness({
1027 baseDir,
1028 path: externalDirectory,
@@ -1159,25 +1038,18 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1038 source: "override",
1039 managedVersionDirectory: null,
1040 });
1162 - expect(yield* installation.resolve(executableName)).toMatchObject({
1163 - source: "override",
1164 - });
1041 + expect(yield* installation.resolve("agy")).toMatchObject({ source: "override" });
1042 expect(
1043 yield* installation
1167 - .resolve(`~/external/${executableName}`)
1044 + .resolve("~/external/agy")
1045 .pipe(Effect.provideService(HostProcess.HomeDirectory, baseDir)),
1046 ).toMatchObject({ source: "override", executablePath: externalExecutable });
1170 - yield* fs.remove(externalHarness);
1171 - expect(yield* installation.resolve(externalExecutable).pipe(Effect.flip)).toMatchObject({
1172 - operation: "resolve",
1173 - });
1047 expect(
1048 yield* installation.resolve(path.join(baseDir, "missing")).pipe(Effect.flip),
1049 ).toMatchObject({
1050 operation: "resolve",
1051 });
1052 yield* expectPreviousRelease(installation);
1180 - yield* fs.writeFileString(externalHarness, "external harness", { mode: 0o755 });
1053 yield* installation.remove();
1054 expect(yield* installation.resolve()).toMatchObject({
1055 source: "path",
@@ -1194,149 +1066,11 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1066 executablePath: externalExecutable,
1067 });
1068 expect(
1197 - yield* isolated.installation.resolve(executableName, { PATH: externalDirectory }),
1069 + yield* isolated.installation.resolve("agy", { PATH: externalDirectory }),
1070 ).toMatchObject({ source: "override", executablePath: externalExecutable });
1199 -
1200 - const incompleteDirectory = path.join(baseDir, "incomplete");
1201 - yield* fs.makeDirectory(incompleteDirectory);
1202 - yield* fs.writeFileString(path.join(incompleteDirectory, executableName), "no harness", {
1203 - mode: 0o755,
1204 - });
1205 - const shadowedPath = { PATH: `${incompleteDirectory}:${externalDirectory}` };
1206 - expect(yield* isolated.installation.resolve(undefined, shadowedPath)).toMatchObject({
1207 - source: "path",
1208 - executablePath: externalExecutable,
1209 - });
1210 - expect(yield* isolated.installation.resolve(executableName, shadowedPath)).toMatchObject({
1211 - source: "override",
1212 - executablePath: externalExecutable,
1213 - });
1071 }),
1072 );
1073
1217 - it.effect("pairs a Windows launcher script with the helper beside the executable it runs", () =>
1218 - Effect.gen(function* () {
1219 - const fs = yield* FileSystem.FileSystem;
1220 - const path = yield* Path.Path;
1221 - const baseDir = yield* fs
1222 - .makeTempDirectoryScoped({ prefix: "t3-agy-launcher-$$-test-" })
1223 - .pipe(Effect.flatMap((directory) => fs.realPath(directory)));
1224 - const runtimeDirectory = path.join(baseDir, "runtime (x64)");
1225 - const launcherDirectory = path.join(baseDir, "launchers");
1226 - const runtimeExecutable = path.join(runtimeDirectory, "agy_acp_server.exe");
1227 - const runtimeHarness = path.join(runtimeDirectory, "localharness_external.exe");
1228 - yield* fs.makeDirectory(runtimeDirectory);
1229 - yield* fs.makeDirectory(launcherDirectory);
1230 - yield* fs.writeFileString(runtimeExecutable, "external server");
1231 - yield* fs.writeFileString(runtimeHarness, "external harness");
1232 - const { installation } = yield* makeHarness({ baseDir, platform: "win32", previous: true });
1233 - const writeLauncher = Effect.fn("test.writeAntigravityLauncher")(function* (
1234 - name: string,
1235 - launch: string,
1236 - ) {
1237 - const launcher = path.join(launcherDirectory, name);
1238 - yield* fs.writeFileString(
1239 - launcher,
1240 - `@echo off\r\nrem Runtime launcher\r\n:: Keep environment setup\r\nset AGY_EXTRA=1\r\n${launch} %*\r\nexit /b\r\n`,
1241 - );
1242 - return launcher;
1243 - });
1244 -
1245 - const absolute = yield* writeLauncher("agy.cmd", `"${runtimeExecutable}"`);
1246 - expect(yield* installation.resolve(absolute)).toMatchObject({
1247 - executablePath: absolute,
1248 - harnessPath: runtimeHarness,
1249 - source: "override",
1250 - managedVersionDirectory: null,
1251 - });
1252 - const quoted = yield* writeLauncher(
1253 - "quoted.cmd",
1254 - `set "PATH=C:\\Program Files (x86)\\SDK;%PATH%"\r\n"${runtimeExecutable}"`,
1255 - );
1256 - expect(yield* installation.resolve(quoted)).toMatchObject({
1257 - executablePath: quoted,
1258 - harnessPath: runtimeHarness,
1259 - });
1260 - const relative = yield* writeLauncher(
1261 - "relative.BAT",
1262 - `"%~dp0../runtime (x64)/agy_acp_server.exe"`,
1263 - );
1264 - expect(yield* installation.resolve(relative)).toMatchObject({
1265 - executablePath: relative,
1266 - harnessPath: runtimeHarness,
1267 - });
1268 -
1269 - const managed = yield* installation.resolve();
1270 - const intoManaged = yield* writeLauncher("managed.cmd", `"${managed.executablePath}"`);
1271 - expect(yield* installation.resolve(intoManaged)).toMatchObject({
1272 - executablePath: intoManaged,
1273 - harnessPath: managed.harnessPath,
1274 - version: previousVersion,
1275 - managedVersionDirectory: managed.managedVersionDirectory,
1276 - });
1277 - expect(yield* installation.remove([intoManaged]).pipe(Effect.flip)).toMatchObject({
1278 - operation: "remove",
1279 - });
1280 -
1281 - const ambiguous = yield* writeLauncher(
1282 - "ambiguous.cmd",
1283 - `"${managed.executablePath}" --version\r\n"${runtimeExecutable}"`,
1284 - );
1285 - expect(yield* installation.resolve(ambiguous).pipe(Effect.flip)).toMatchObject({
1286 - operation: "resolve",
1287 - });
1288 -
1289 - for (const [name, launch] of [
1290 - ["comment.cmd", `rem Previous runtime: "${runtimeExecutable}"\r\n"%AGY_TARGET%"`],
1291 - ["label-comment.cmd", `:: "${runtimeExecutable}"\r\n"%AGY_TARGET%"`],
1292 - ["echo.cmd", `echo "${runtimeExecutable}"`],
1293 - [
1294 - "conditional.cmd",
1295 - `if defined AGY_TARGET "%AGY_TARGET%" %* & exit /b\r\n"${runtimeExecutable}"`,
1296 - ],
1297 - ["early-exit.cmd", `exit /b\r\n"${runtimeExecutable}"`],
1298 - ["continued-set.cmd", `set IGNORED=1^\r\n"${runtimeExecutable}"`],
1299 - [
1300 - "chained-comment.cmd",
1301 - `rem setup & "${managed.executablePath}"\r\n"${runtimeExecutable}"`,
1302 - ],
1303 - ["chained.cmd", `"${runtimeExecutable}" --version && "%AGY_TARGET%"`],
1304 - ["unquoted-parens.cmd", `set PATH=C:\\Program Files (x86)\\SDK\r\n"${runtimeExecutable}"`],
1305 - [
1306 - "quoted-chained.cmd",
1307 - `set "PATH=C:\\Program Files (x86)" & "${managed.executablePath}"\r\n"${runtimeExecutable}"`,
1308 - ],
1309 - ["quoted-redirect.cmd", `set "AGY_MODE=1" > nul\r\n"${runtimeExecutable}"`],
1310 - ["quoted-block.cmd", `(set "AGY_MODE=1")\r\n"${runtimeExecutable}"`],
1311 - ["quoted-expansion.cmd", `set Q="\r\nset "X=%Q%&exit /b&rem ()"\r\n"${runtimeExecutable}"`],
1312 - ] as const) {
1313 - const uncertain = yield* writeLauncher(name, launch);
1314 - expect(yield* installation.resolve(uncertain).pipe(Effect.flip)).toMatchObject({
1315 - operation: "resolve",
1316 - });
1317 - }
1318 -
1319 - const win32 = yield* Path.Path.pipe(Effect.provide(NodePath.layerWin32));
1320 - const serverOnC: Path.Path = {
1321 - ...win32,
1322 - resolve: (...segments) => win32.resolve("C:\\t3", ...segments),
1323 - };
1324 - const launcherOnD = "D:\\launchers\\agy.cmd";
1325 - for (const [written, expected] of [
1326 - ["\\runtime\\agy_acp_server.exe", null],
1327 - ["C:runtime\\agy_acp_server.exe", null],
1328 - ["%~dp0runtime\\agy_acp_server.exe", "D:\\launchers\\runtime\\agy_acp_server.exe"],
1329 - ["\\\\server\\share\\agy_acp_server.exe", "\\\\server\\share\\agy_acp_server.exe"],
1330 - ["D:/runtime/agy_acp_server.exe", "D:\\runtime\\agy_acp_server.exe"],
1331 - ["//server/share/agy_acp_server.exe", "\\\\server\\share\\agy_acp_server.exe"],
1332 - ] as const) {
1333 - expect(AntigravityInstallation.launcherTargetPath(serverOnC, launcherOnD, written)).toBe(
1334 - expected,
1335 - );
1336 - }
1337 - }),
1338 - );
1339 -
1074 it.effect("keeps leased releases available while new sessions resolve the new release", () =>
1075 Effect.gen(function* () {
1076 const manifestEntered = yield* Deferred.make<void>();
@@ -1380,13 +1114,10 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1114 Effect.gen(function* () {
1115 const { installation, baseDir, fs, path } = yield* makeHarness({ previous: true });
1116 const previous = yield* installation.resolve();
1383 - yield* fs.remove(previous.harnessPath!);
1117 + yield* fs.remove(previous.executablePath);
1118 const externalDirectory = path.join(baseDir, "external");
1119 yield* fs.makeDirectory(externalDirectory);
1386 - yield* fs.writeFileString(path.join(externalDirectory, executableName), "external server", {
1387 - mode: 0o755,
1388 - });
1389 - yield* fs.writeFileString(path.join(externalDirectory, harnessName), "external harness", {
1120 + yield* fs.writeFileString(path.join(externalDirectory, "agy"), "external cli", {
1121 mode: 0o755,
1122 });
1123 const restarted = yield* makeHarness({ baseDir, path: externalDirectory });
@@ -1407,7 +1138,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1138 yield* restarted.installation.start;
1139 expect(yield* terminalState(restarted.installation)).toMatchObject({
1140 phase: "succeeded",
1410 - installedVersion: "fixture-new",
1141 + installedVersion: assetVersion,
1142 canRemove: true,
1143 });
1144 yield* Deferred.await(restarted.stagingReleased);
@@ -1425,11 +1156,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1156 const profileDirectory = path.join(baseDir, "providers", "antigravity", "profile");
1157 yield* fs.makeDirectory(externalDirectory);
1158 yield* fs.makeDirectory(profileDirectory, { recursive: true });
1428 - const externalExecutable = path.join(externalDirectory, executableName);
1429 - const externalHarness = path.join(externalDirectory, harnessName);
1159 + const externalExecutable = path.join(externalDirectory, "agy");
1160 const profilePath = path.join(profileDirectory, "preferences.json");
1431 - yield* fs.writeFileString(externalExecutable, "external server", { mode: 0o755 });
1432 - yield* fs.writeFileString(externalHarness, "external harness", { mode: 0o755 });
1161 + yield* fs.writeFileString(externalExecutable, "external cli", { mode: 0o755 });
1162 yield* fs.writeFileString(profilePath, "{}");
1163 expect(
1164 yield* installation.remove([managed.executablePath]).pipe(Effect.flip),
@@ -1443,8 +1172,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1172 operationId: null,
1173 installedVersion: null,
1174 });
1446 - expect(yield* fs.readFileString(externalExecutable)).toBe("external server");
1447 - expect(yield* fs.readFileString(externalHarness)).toBe("external harness");
1175 + expect(yield* fs.readFileString(externalExecutable)).toBe("external cli");
1176 expect(yield* fs.readFileString(profilePath)).toBe("{}");
1177 }),
1178 );
@@ -1455,7 +1183,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1183 Effect.gen(function* () {
1184 const fs = yield* FileSystem.FileSystem;
1185 const path = yield* Path.Path;
1458 - const archive = Buffer.from(zipFixtures.windows, "base64");
1186 + const archive = Buffer.from(serverContents);
1187 const asset = yield* releaseAsset(archive, "win32");
1188 let denyPointerRename = true;
1189 const renameTargets: string[] = [];
@@ -1481,7 +1209,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1209 },
1210 }),
1211 });
1484 - yield* writeRelease(installation.managedDirectory, asset, false);
1212 + yield* writeRelease(installation.managedDirectory, assetRelease(asset), false);
1213 yield* installation.start;
1214 expect((yield* terminalState(installation)).phase).toBe("failed");
1215 yield* expectPreviousRelease(installation);
@@ -1490,7 +1218,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1218 denyPointerRename = false;
1219 yield* installation.start;
1220 expect((yield* terminalState(installation)).phase).toBe("succeeded");
1493 - expect((yield* installation.resolve()).version).toBe("fixture-new");
1221 + expect((yield* installation.resolve()).version).toBe(assetVersion);
1222 expect(requests).toEqual([]);
1223 expect(validations).toHaveLength(2);
1224 expect(renameTargets).toEqual([
@@ -1504,7 +1232,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1232 Effect.gen(function* () {
1233 const fs = yield* FileSystem.FileSystem;
1234 const path = yield* Path.Path;
1507 - const archive = Buffer.from(zipFixtures.windows, "base64");
1235 + const archive = Buffer.from(serverContents);
1236 const releaseRenameDenied = yield* Deferred.make<void>();
1237 let releaseRenameDenials = 3;
1238 const { installation } = yield* makeHarness({
@@ -1543,9 +1271,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1271 yield* TestClock.adjust("30 seconds");
1272 expect(yield* Fiber.join(terminal)).toMatchObject({
1273 phase: "succeeded",
1546 - installedVersion: "fixture-new",
1274 + installedVersion: assetVersion,
1275 });
1548 - expect((yield* installation.resolve()).version).toBe("fixture-new");
1276 + expect((yield* installation.resolve()).version).toBe(assetVersion);
1277 }),
1278 );
1279
apps/server/src/provider/AntigravityInstallation.ts
+90 -289
@@ -4,8 +4,11 @@ import * as ModelManifest from "./ModelManifest.ts";
4 import { resolveProviderCompatibility } from "./providerCompatibility.ts";
5 import { cliArchiveTarCommand } from "@t3tools/shared/cliRelease";
6 import { compareSemverVersions } from "@t3tools/shared/semver";
7 -import * as EffectNodeStream from "@effect/platform-node/NodeStream";
8 -import { ProviderDriverKind, type ProviderInstallState } from "@t3tools/contracts";
7 +import {
8 + ProviderDriverKind,
9 + type ProviderInstallState,
10 + type ServerProviderCompatibilityAdvisory,
11 +} from "@t3tools/contracts";
12 import * as HostProcess from "@t3tools/shared/HostProcess";
13 import { resolveNodeExecutable, nodeRuntimeUnavailableMessage } from "@t3tools/shared/nodeRuntime";
14 import { resolveCommandPath } from "@t3tools/shared/shell";
@@ -42,13 +45,11 @@ import {
45 parseAntigravityCliRelease,
46 type AntigravityCliReleaseAsset,
47 } from "./antigravityCliRelease.ts";
45 -import { openZipArchive } from "../zipArchive.ts";
48 import { makeAntigravityAcpRuntime } from "./acp/AntigravityAcpSupport.ts";
49 import {
50 buildAntigravityAcpSpawnInput,
51 prepareAntigravityProfile,
52 } from "./antigravityAuthSupport.ts";
51 -import { type AntigravityReleaseAsset } from "./antigravityRelease.ts";
53
54 const DRIVER = ProviderDriverKind.make("antigravity");
55 const DOWNLOAD_TIMEOUT = "45 minutes";
@@ -59,29 +60,15 @@ const UPDATE_CHECK_INTERVAL = 60 * 60 * 1000;
60 const FREE_SPACE_MARGIN = 256 * 1024 * 1024;
61 const RECORD_MAX_BYTES = 8 * 1024;
62 const RELEASE_RECORD = ".install-complete.json";
62 -const LAUNCHER_SETUP =
63 - /^[\s@]*(?:|::[^&|<>]*|rem(?:\s[^&|<>]*|$)|set\s+"[^"=&|<>]+=[^"&|<>]*"\s*|(?:echo|set|setlocal|endlocal)(?:\s[^&|<>()]*)?)$/iu;
64 -const LAUNCHER_COMMAND =
65 - /^[\s@]*(?:"([^"]*agy_acp_server\.exe)"|([^\s"&|<>()@]*agy_acp_server\.exe))(?:\s[^&|<>()]*)?$/iu;
63 const LARGE_PAGE_KERNEL_MESSAGE =
64 "Google's linux-arm64 Antigravity runtime needs a kernel with 4 KiB memory pages, and this kernel uses larger pages (as on Asahi Linux or Raspberry Pi 5). Use a remote environment or a custom Antigravity executable.";
65
69 -// The launcher runs in the project directory, so a target like `\x\agy_acp_server.exe`
70 -// whose drive comes from the working directory may not be the file resolved here.
71 -export const launcherTargetPath = (path: Path.Path, launcher: string, written: string) => {
72 - const target = written.replace(/%~dp0/giu, () => `${path.dirname(launcher)}${path.sep}`);
73 - if (/[%!]/u.test(target)) return null;
74 - const resolved = path.resolve(target);
75 - return path.parse(path.normalize(target)).root === path.parse(resolved).root ? resolved : null;
76 -};
77 -
66 const ReleaseId = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/u));
67 const ActiveRelease = Schema.Struct({ releaseId: ReleaseId });
68 const InstalledRelease = Schema.Struct({
69 releaseId: ReleaseId,
70 version: Schema.String,
71 executable: Schema.Struct({ name: Schema.String, bytes: Schema.Number }),
84 - harness: Schema.NullOr(Schema.Struct({ name: Schema.String, bytes: Schema.Number })),
72 });
73 type InstalledRelease = typeof InstalledRelease.Type;
74 const encodeActiveRelease = Schema.encodeEffect(Schema.fromJsonString(ActiveRelease));
@@ -104,8 +91,6 @@ const isAcpProcessExitedError = Schema.is(EffectAcpErrors.AcpProcessExitedError)
91
92 export interface AntigravityExecutable {
93 readonly executablePath: string;
107 - /** Null for the `agy` CLI, which embeds the harness and runs as `agy acp`. */
108 - readonly harnessPath: string | null;
94 readonly source: "override" | "managed" | "path";
95 readonly version: string | null;
96 readonly managedVersionDirectory: string | null;
@@ -122,6 +107,9 @@ interface AntigravityInstallationService {
107 binaryPath?: string,
108 environment?: NodeJS.ProcessEnv,
109 ) => Effect.Effect<AntigravityExecutable, AntigravityInstallationError, Scope.Scope>;
110 + readonly compatibility: (
111 + version: string,
112 + ) => Effect.Effect<ServerProviderCompatibilityAdvisory | undefined>;
113 readonly start: Effect.Effect<ProviderInstallState, AntigravityInstallationError>;
114 readonly cancel: (
115 operationId: string,
@@ -156,7 +144,7 @@ export class AntigravityInstallation extends Context.Service<
144
145 export interface AntigravityInstallationOptions {
146 readonly baseDir: string;
159 - readonly releaseAsset?: AntigravityReleaseAsset | AntigravityCliReleaseAsset | null;
147 + readonly releaseAsset?: AntigravityCliReleaseAsset | null;
148 readonly updateChecksEnabled?: Effect.Effect<boolean>;
149 readonly validate?: (
150 executable: AntigravityExecutable,
@@ -174,13 +162,6 @@ const installationError = (operation: string, detail: string, cause?: unknown) =
162 const wrapFailure = (operation: string, detail: string) => (cause: unknown) =>
163 isInstallationError(cause) ? cause : installationError(operation, detail, cause);
164
177 -function executableNames(platform: NodeJS.Platform) {
178 - return platform === "win32"
179 - ? { executable: "agy_acp_server.exe", harness: "localharness_external.exe" }
180 - : { executable: "agy_acp_server.par", harness: "localharness_external" };
181 -}
182 -
183 -/** Antigravity CLI 1.5.0+ serves ACP itself (`agy acp`), so it has no `localharness_external` sibling. */
165 function isAntigravityCli(...candidates: ReadonlyArray<string>) {
166 return candidates.some((candidate) =>
167 /^(?:agy|antigravity)(?:\.(?:exe|cmd|bat))?$/iu.test(candidate.split(/[\\/]/u).at(-1) ?? ""),
@@ -211,7 +192,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
192 options.releaseAsset === undefined
193 ? antigravityCliTarget(platform, arch) !== null
194 : options.releaseAsset !== null;
214 - const names = executableNames(platform);
195 + const cliExecutableName = platform === "win32" ? "agy.exe" : "antigravity";
196 const managedDirectory = path.join(
197 options.baseDir,
198 "tools",
@@ -240,24 +221,28 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
221 operationId: null,
222 phase: "idle",
223 downloadedBytes: 0,
243 - totalBytes:
244 - releaseAsset !== null && "archiveBytes" in releaseAsset ? releaseAsset.archiveBytes : null,
224 + totalBytes: null,
225 version: releaseAsset?.version ?? null,
226 installedVersion: null,
227 canRemove: false,
228 message: null,
229 });
230
251 - const isWithdrawn = Effect.fn("AntigravityInstallation.isWithdrawn")(function* (version: string) {
231 + const compatibility = Effect.fn("AntigravityInstallation.compatibility")(function* (
232 + version: string,
233 + ) {
234 const manifest = yield* manifestService.current;
253 - const status = (
235 + return (
236 resolveProviderCompatibility(manifest.compatibility, DRIVER, version) ??
237 resolveProviderCompatibility(
238 ModelManifest.BUNDLED_MODEL_MANIFEST.compatibility,
239 DRIVER,
240 version,
241 )
260 - )?.status;
242 + );
243 + });
244 + const isWithdrawn = Effect.fn("AntigravityInstallation.isWithdrawn")(function* (version: string) {
245 + const status = (yield* compatibility(version))?.status;
246 return status === "broken" || status === "unsupported";
247 });
248 const ensureEligible = Effect.fn("AntigravityInstallation.ensureEligible")(function* (
@@ -303,22 +288,21 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
288 ) {
289 const directory = path.join(versionsDirectory, releaseId);
290 const record = yield* readRecord(path.join(directory, RELEASE_RECORD), InstalledRelease);
291 + if (record.releaseId === releaseId && record.executable.name !== cliExecutableName) {
292 + return yield* installationError(
293 + "resolve",
294 + `Antigravity ${record.version} predates the Antigravity CLI and no longer works with this T3 Code release. Update it in Antigravity setup.`,
295 + );
296 + }
297 if (
298 record.releaseId !== releaseId ||
308 - (record.harness === null
309 - ? record.executable.name !== (platform === "win32" ? "agy.exe" : "antigravity")
310 - : record.executable.name !== names.executable || record.harness.name !== names.harness) ||
299 !Number.isSafeInteger(record.executable.bytes) ||
300 record.executable.bytes <= 0 ||
313 - (record.harness !== null &&
314 - (!Number.isSafeInteger(record.harness.bytes) || record.harness.bytes <= 0)) ||
301 !record.version.trim() ||
302 !(yield* executableFile(
303 path.join(directory, record.executable.name),
304 record.executable.bytes,
319 - )) ||
320 - (record.harness !== null &&
321 - !(yield* executableFile(path.join(directory, record.harness.name), record.harness.bytes)))
305 + ))
306 ) {
307 return yield* installationError(
308 "resolve",
@@ -327,69 +311,32 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
311 }
312 return {
313 executablePath: path.join(directory, record.executable.name),
330 - harnessPath: record.harness === null ? null : path.join(directory, record.harness.name),
314 source: "managed",
315 version: record.version,
316 managedVersionDirectory: directory,
317 } satisfies AntigravityExecutable;
318 });
319
337 - // Infer helper pairing only from a plain launcher with one literal executable path.
338 - const launcherTarget = Effect.fn("AntigravityInstallation.launcherTarget")(function* (
339 - launcher: string,
340 - ) {
341 - if (platform !== "win32" || !/\.(?:bat|cmd)$/iu.test(launcher)) return null;
342 - const contents = yield* fs.readFileString(launcher);
343 - const targets = new Set<string>();
344 - for (const line of contents.split(/\r?\n/u)) {
345 - if (line.includes("^")) return null;
346 - if (/^[\s@]*exit(?:\s+\/b)?(?:\s+-?\d+)?\s*$/iu.test(line)) break;
347 - if (LAUNCHER_SETUP.test(line)) continue;
348 - const match = LAUNCHER_COMMAND.exec(line);
349 - if (!match) return null;
350 - const target = launcherTargetPath(path, launcher, match[1] ?? match[2] ?? "");
351 - if (target === null) return null;
352 - targets.add(target);
353 - }
354 - const [target] = targets;
355 - if (targets.size !== 1 || !target || !(yield* executableFile(target))) return null;
356 - return yield* fs.realPath(target);
357 - });
358 -
320 const fromExternal = Effect.fn("AntigravityInstallation.fromExternal")(function* (
321 candidate: string,
322 source: "override" | "path",
323 ) {
324 if (!(yield* executableFile(candidate))) return null;
325 const executablePath = yield* fs.realPath(candidate);
365 - const launched = yield* launcherTarget(executablePath);
326 const realVersions = yield* fs.realPath(versionsDirectory).pipe(Effect.option);
367 - const directory = path.dirname(launched ?? executablePath);
327 + const directory = path.dirname(executablePath);
328 if (
329 Option.isSome(realVersions) &&
330 path.dirname(directory) === realVersions.value &&
331 /^[a-f0-9]{64}$/u.test(path.basename(directory))
332 ) {
333 const installed = yield* completedRelease(path.basename(directory));
374 - return launched === null
375 - ? { ...installed, source }
376 - : { ...installed, executablePath, source };
334 + return { ...installed, source };
335 }
336 // Keep launcher symlinks intact: version-manager shims dispatch by their invoked name.
379 - if (launched === null && isAntigravityCli(candidate, executablePath)) {
380 - return {
381 - executablePath: candidate,
382 - harnessPath: null,
383 - source,
384 - version: null,
385 - managedVersionDirectory: null,
386 - } satisfies AntigravityExecutable;
387 - }
388 - const harnessPath = path.join(directory, names.harness);
389 - if (!(yield* executableFile(harnessPath))) return null;
337 + if (!isAntigravityCli(candidate, executablePath)) return null;
338 return {
391 - executablePath,
392 - harnessPath,
339 + executablePath: candidate,
340 source,
341 version: null,
342 managedVersionDirectory: null,
@@ -404,7 +351,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
351 Effect.provideService(Path.Path, path),
352 );
353
407 - // Resolve per PATH entry so an executable without its harness falls through to later entries.
354 + // Resolve per PATH entry so a candidate that is not the CLI falls through to later entries.
355 const commandCandidates = Effect.fn("AntigravityInstallation.commandCandidates")(function* (
356 command: string,
357 processEnvironment = environment,
@@ -438,7 +385,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
385 }
386 return yield* installationError(
387 "resolve",
441 - "The custom Antigravity executable is missing or not executable, or it needs a localharness_external sibling. The agy CLI does not.",
388 + "The custom Antigravity executable is missing or not executable, or it is not the agy CLI.",
389 );
390 }
391 if (yield* fs.exists(activePath)) {
@@ -451,11 +398,9 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
398 );
399 return installed;
400 }
454 - for (const command of [names.executable, "agy"]) {
455 - for (const candidate of yield* commandCandidates(command, processEnvironment)) {
456 - const selected = yield* fromExternal(candidate, "path");
457 - if (selected) return selected;
458 - }
401 + for (const candidate of yield* commandCandidates("agy", processEnvironment)) {
402 + const selected = yield* fromExternal(candidate, "path");
403 + if (selected) return selected;
404 }
405 return yield* installationError(
406 "resolve",
@@ -549,11 +494,8 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
494 });
495 const initialized = yield* runtime.initialize();
496 if (
552 - (executable.harnessPath === null
553 - ? initialized.agentInfo?.name !== "Antigravity ACP Server"
554 - : initialized.agentInfo?.name !== "antigravity-acp") ||
497 + initialized.agentInfo?.name !== "Antigravity ACP Server" ||
498 initialized.agentInfo?.version !== expectedVersion ||
556 - // Antigravity 1.1.1 may report protocol 2 with legacy ACP; choose wire format from the response shape.
499 (initialized.protocolVersion !== 1 && initialized.protocolVersion !== 2) ||
500 initialized.agentCapabilities?.loadSession !== true ||
501 !initialized.agentCapabilities.sessionCapabilities?.resume ||
@@ -599,12 +541,10 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
541 );
542
543 const install = Effect.fn("AntigravityInstallation.install")(
602 - function* (asset: AntigravityReleaseAsset | AntigravityCliReleaseAsset) {
544 + function* (asset: AntigravityCliReleaseAsset) {
545 yield* ensureEligible(asset.version);
604 - const cli = "sha512" in asset;
605 - // Existing installation records use 64-character IDs, including native SHA-512 prefixes.
606 - const releaseId = cli ? asset.sha512.slice(0, 64) : asset.sha256;
607 - const archiveBytes = cli ? null : asset.archiveBytes;
546 + // Release IDs are 64 hex characters, so a release is named by its SHA-512's prefix.
547 + const releaseId = asset.sha512.slice(0, 64);
548 yield* resolveNodeExecutable("Antigravity", environment).pipe(
549 Effect.provideService(FileSystem.FileSystem, fs),
550 Effect.provideService(Path.Path, path),
@@ -613,18 +553,6 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
553 installationError("verify", nodeRuntimeUnavailableMessage("Antigravity"), cause),
554 ),
555 );
616 - if (!cli && platform === "linux" && arch === "arm64") {
617 - const pageSize = yield* spawner
618 - .string(ChildProcess.make("getconf", ["PAGESIZE"], { stdin: "ignore", stderr: "ignore" }))
619 - .pipe(
620 - Effect.map((output) => Number(output.trim())),
621 - Effect.timeout("5 seconds"),
622 - Effect.orElseSucceed(() => Number.NaN),
623 - );
624 - if (pageSize > 4096) {
625 - return yield* installationError("download", LARGE_PAGE_KERNEL_MESSAGE);
626 - }
627 - }
556 const report = (phase: ProviderInstallState["phase"], message: string | null) =>
557 SubscriptionRef.update(state, (current) => ({ ...current, phase, message }));
558 yield* fs.makeDirectory(versionsDirectory, { recursive: true });
@@ -683,9 +611,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
611 try: () => NodeFSP.statfs(versionsDirectory, { bigint: true }),
612 catch: (cause) => installationError("download", "Could not check free disk space.", cause),
613 }).pipe(Effect.option);
686 - const required = cli
687 - ? MAX_DOWNLOAD_BYTES + MAX_EXECUTABLE_BYTES + FREE_SPACE_MARGIN
688 - : asset.archiveBytes + asset.executable.bytes + asset.harness.bytes + FREE_SPACE_MARGIN;
614 + const required = MAX_DOWNLOAD_BYTES + MAX_EXECUTABLE_BYTES + FREE_SPACE_MARGIN;
615 if (
616 Option.isSome(available) &&
617 available.value.bavail * available.value.bsize < BigInt(required)
@@ -699,36 +625,21 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
625 directory: versionsDirectory,
626 prefix: ".install-",
627 });
702 - const archivePath = path.join(staging, "download.zip");
628 + const archivePath = path.join(staging, "download");
629 const pairDirectory = path.join(staging, "runtime");
630 yield* fs.makeDirectory(pairDirectory);
705 - const hash = NodeCrypto.createHash(cli ? "sha512" : "sha256");
631 + const hash = NodeCrypto.createHash("sha512");
632 let downloadedBytes = 0;
633 let lastProgressAt = yield* Clock.currentTimeMillis;
634 yield* Effect.gen(function* () {
635 const response = yield* http
636 .execute(HttpClientRequest.get(asset.url))
637 .pipe(Effect.flatMap(HttpClientResponse.filterStatusOk));
712 - // dl.google.com may gzip the zip: content-length is encoded, while byte/hash checks use decoded data.
713 - const contentLength = response.headers["content-length"];
714 - const contentEncoding = response.headers["content-encoding"]?.trim().toLowerCase();
715 - const identityBody = contentEncoding === undefined || contentEncoding === "identity";
716 - if (
717 - identityBody &&
718 - contentLength !== undefined &&
719 - archiveBytes !== null &&
720 - Number(contentLength) !== archiveBytes
721 - ) {
722 - return yield* installationError(
723 - "download",
724 - "The Antigravity download size did not match the pinned release.",
725 - );
726 - }
638 yield* response.stream.pipe(
639 Stream.tap((chunk) =>
640 Effect.gen(function* () {
641 downloadedBytes += chunk.byteLength;
731 - if (downloadedBytes > (archiveBytes ?? MAX_DOWNLOAD_BYTES)) {
642 + if (downloadedBytes > MAX_DOWNLOAD_BYTES) {
643 return yield* installationError(
644 "download",
645 "The Antigravity download exceeded its allowed size.",
@@ -736,7 +647,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
647 }
648 hash.update(chunk);
649 const now = yield* Clock.currentTimeMillis;
739 - if (now - lastProgressAt >= 250 || downloadedBytes === archiveBytes) {
650 + if (now - lastProgressAt >= 250) {
651 lastProgressAt = now;
652 yield* SubscriptionRef.update(state, (current) => ({
653 ...current,
@@ -759,10 +670,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
670 : cause,
671 ),
672 );
762 - if (
763 - (archiveBytes !== null && downloadedBytes !== archiveBytes) ||
764 - hash.digest("hex") !== (cli ? asset.sha512 : asset.sha256)
765 - ) {
673 + if (hash.digest("hex") !== asset.sha512) {
674 return yield* installationError(
675 "download",
676 "The Antigravity download failed its size or checksum check. Nothing was installed.",
@@ -770,162 +678,57 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
678 }
679
680 yield* report("extracting", "Extracting the verified runtime.");
773 - if (cli) {
774 - const executablePath = path.join(pairDirectory, asset.executable.name);
775 - if (asset.format === "executable") {
776 - yield* fs.copyFile(archivePath, executablePath);
777 - } else {
778 - const tar = cliArchiveTarCommand(platform, environment);
779 - const list = yield* spawner.string(ChildProcess.make(tar, ["-tzf", archivePath]));
780 - const types = yield* spawner.string(ChildProcess.make(tar, ["-tvzf", archivePath]));
781 - if (
782 - list.trim() !== asset.executable.name ||
783 - types.trim().split(/\r?\n/u).length !== 1 ||
784 - !types.startsWith("-")
785 - ) {
786 - return yield* installationError(
787 - "extract",
788 - "The Antigravity archive must contain one regular executable.",
789 - );
790 - }
791 - yield* Effect.gen(function* () {
792 - const child = yield* spawner.spawn(
793 - ChildProcess.make(tar, ["-xOzf", archivePath, asset.executable.name], {
794 - stdout: "pipe",
795 - stderr: "pipe",
796 - }),
797 - );
798 - let extractedBytes = 0;
799 - yield* child.stdout.pipe(
800 - Stream.tap((chunk) =>
801 - Effect.gen(function* () {
802 - extractedBytes += chunk.byteLength;
803 - if (extractedBytes > MAX_EXECUTABLE_BYTES)
804 - return yield* installationError(
805 - "extract",
806 - "The Antigravity executable exceeded its size limit.",
807 - );
808 - }),
809 - ),
810 - Stream.run(fs.sink(executablePath, { flag: "wx", mode: 0o700 })),
811 - );
812 - if ((yield* child.exitCode) !== 0 || extractedBytes === 0)
813 - return yield* installationError(
814 - "extract",
815 - "Could not extract the Antigravity executable.",
816 - );
817 - }).pipe(Effect.scoped);
681 + const executablePath = path.join(pairDirectory, asset.executable.name);
682 + if (asset.format === "executable") {
683 + yield* fs.copyFile(archivePath, executablePath);
684 + } else {
685 + const tar = cliArchiveTarCommand(platform, environment);
686 + const list = yield* spawner.string(ChildProcess.make(tar, ["-tzf", archivePath]));
687 + const types = yield* spawner.string(ChildProcess.make(tar, ["-tvzf", archivePath]));
688 + if (
689 + list.trim() !== asset.executable.name ||
690 + types.trim().split(/\r?\n/u).length !== 1 ||
691 + !types.startsWith("-")
692 + ) {
693 + return yield* installationError(
694 + "extract",
695 + "The Antigravity archive must contain one regular executable.",
696 + );
697 }
819 - } else
698 yield* Effect.gen(function* () {
821 - const archive = yield* openZipArchive(archivePath, (detail, cause) =>
822 - installationError("extract", detail, cause),
699 + const child = yield* spawner.spawn(
700 + ChildProcess.make(tar, ["-xOzf", archivePath, asset.executable.name], {
701 + stdout: "pipe",
702 + stderr: "pipe",
703 + }),
704 );
824 - if (archive.entryCount !== 2) {
825 - return yield* installationError(
826 - "extract",
827 - "The archive must contain exactly the Antigravity executable and its harness.",
828 - );
829 - }
830 - const seen = new Set<string>();
831 - for (;;) {
832 - const entry = yield* archive.next;
833 - if (!entry) break;
834 - const expected = [asset.executable, asset.harness].find(
835 - (file) => file.name === entry.fileName,
836 - );
837 - const unixType = (entry.externalFileAttributes >>> 16) & 0o170000;
838 - if (
839 - !expected ||
840 - seen.has(entry.fileName) ||
841 - entry.fileName.includes("/") ||
842 - entry.fileName.includes("\\") ||
843 - (unixType !== 0 && unixType !== 0o100000) ||
844 - (entry.externalFileAttributes & 0x10) !== 0 ||
845 - (entry.generalPurposeBitFlag & 1) !== 0 ||
846 - ![0, 8].includes(entry.compressionMethod) ||
847 - entry.uncompressedSize !== expected.bytes
848 - ) {
849 - return yield* installationError(
850 - "extract",
851 - "The archive contains an unexpected, unsafe, or incorrectly sized member.",
852 - );
853 - }
854 - seen.add(entry.fileName);
855 - yield* Effect.gen(function* () {
856 - const readable = yield* archive.streamEntry(entry);
857 - let extractedBytes = 0;
858 - yield* EffectNodeStream.fromReadable<Uint8Array, AntigravityInstallationError>({
859 - evaluate: () => readable,
860 - onError: wrapFailure("extract", "Could not extract the Antigravity runtime."),
861 - }).pipe(
862 - Stream.tap((chunk) =>
863 - Effect.gen(function* () {
864 - extractedBytes += chunk.byteLength;
865 - if (extractedBytes > expected.bytes) {
866 - return yield* installationError(
867 - "extract",
868 - "An archive member exceeded its pinned size.",
869 - );
870 - }
871 - }),
872 - ),
873 - Stream.run(
874 - fs.sink(path.join(pairDirectory, entry.fileName), { flag: "wx", mode: 0o700 }),
875 - ),
876 - );
877 - if (extractedBytes !== expected.bytes) {
878 - return yield* installationError("extract", "An archive member was truncated.");
879 - }
880 - }).pipe(Effect.scoped);
881 - }
882 - if (!seen.has(asset.executable.name) || !seen.has(asset.harness.name)) {
705 + let extractedBytes = 0;
706 + yield* child.stdout.pipe(
707 + Stream.tap((chunk) =>
708 + Effect.gen(function* () {
709 + extractedBytes += chunk.byteLength;
710 + if (extractedBytes > MAX_EXECUTABLE_BYTES)
711 + return yield* installationError(
712 + "extract",
713 + "The Antigravity executable exceeded its size limit.",
714 + );
715 + }),
716 + ),
717 + Stream.run(fs.sink(executablePath, { flag: "wx", mode: 0o700 })),
718 + );
719 + if ((yield* child.exitCode) !== 0 || extractedBytes === 0)
720 return yield* installationError(
721 "extract",
885 - "The archive is missing the Antigravity executable or its harness.",
722 + "Could not extract the Antigravity executable.",
723 );
887 - }
724 }).pipe(Effect.scoped);
889 - yield* fs.remove(archivePath);
890 - const executablePath = path.join(pairDirectory, asset.executable.name);
891 - const harnessPath = cli ? null : path.join(pairDirectory, asset.harness.name);
892 - if (platform !== "win32") {
893 - yield* fs.chmod(executablePath, 0o755);
894 - if (harnessPath !== null) yield* fs.chmod(harnessPath, 0o755);
895 - }
896 - if (!cli && platform === "darwin" && arch === "x64") {
897 - // Google signs the Intel build with the hardened runtime but no JIT entitlement, so
898 - // libffi's writable+executable trampolines spin forever. Re-sign ad hoc after the hash check.
899 - const exitCode = yield* spawner
900 - .spawn(
901 - ChildProcess.make(
902 - "/usr/bin/codesign",
903 - [
904 - "--force",
905 - "--sign",
906 - "-",
907 - executablePath,
908 - ...(harnessPath === null ? [] : [harnessPath]),
909 - ],
910 - { stdout: "ignore", stderr: "ignore" },
911 - ),
912 - )
913 - .pipe(
914 - Effect.flatMap((child) => child.exitCode),
915 - Effect.scoped,
916 - );
917 - if (exitCode !== 0) {
918 - return yield* installationError(
919 - "extract",
920 - "Could not prepare the Antigravity runtime for this Mac. Check that codesign is available.",
921 - );
922 - }
725 }
726 + yield* fs.remove(archivePath);
727 + if (platform !== "win32") yield* fs.chmod(executablePath, 0o755);
728 yield* report("verifying", "Checking the downloaded runtime.");
729 yield* validate(
730 {
731 executablePath,
928 - harnessPath,
732 source: "managed",
733 version: asset.version,
734 managedVersionDirectory: pairDirectory,
@@ -939,10 +742,6 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
742 name: asset.executable.name,
743 bytes: Number((yield* fs.stat(executablePath)).size),
744 },
942 - harness:
943 - cli || harnessPath === null
944 - ? null
945 - : { name: asset.harness.name, bytes: Number((yield* fs.stat(harnessPath)).size) },
745 };
746 yield* fs.writeFileString(
747 path.join(pairDirectory, RELEASE_RECORD),
@@ -1054,7 +853,6 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
853 const reuse =
854 Option.isSome(installed) &&
855 installed.value.source === "managed" &&
1057 - installed.value.harnessPath === null &&
856 (asset === null || compareSemverVersions(installed.value.version!, asset.version) > 0)
857 ? installed.value
858 : undefined;
@@ -1069,7 +867,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
867 operationId,
868 phase: reuse === undefined ? "downloading" : "verifying",
869 downloadedBytes: 0,
1072 - totalBytes: asset !== null && "archiveBytes" in asset ? asset.archiveBytes : null,
870 + totalBytes: null,
871 version: reuse?.version ?? asset?.version ?? null,
872 installedVersion: current.installedVersion,
873 canRemove: current.canRemove,
@@ -1217,14 +1015,16 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
1015 installedVersion: installed.version,
1016 }));
1017 }).pipe(
1220 - Effect.catch(() =>
1018 + Effect.catch((cause) =>
1019 SubscriptionRef.update(
1020 state,
1021 (current) =>
1022 ({
1023 ...current,
1024 phase: "failed",
1227 - message: "The managed Antigravity runtime is incomplete. Remove it and reinstall.",
1025 + message: isInstallationError(cause)
1026 + ? cause.detail
1027 + : "The managed Antigravity runtime is incomplete. Remove it and reinstall.",
1028 }) satisfies ProviderInstallState,
1029 ),
1030 ),
@@ -1237,6 +1037,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
1037 managedDirectory,
1038 resolve,
1039 acquire,
1040 + compatibility,
1041 start,
1042 cancel,
1043 state: SubscriptionRef.get(state),
apps/server/src/provider/AntigravityProvider.test.ts
+4 -4
@@ -47,7 +47,7 @@ const initializeResult = {
47 agentInfo: {
48 name: "antigravity-acp",
49 title: "Google Antigravity",
50 - version: "agy_acp_server_20260818_01_RC01",
50 + version: "1.5.12",
51 },
52 } satisfies EffectAcpSchema.InitializeResponse;
53
@@ -334,7 +334,7 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
334 expect(snapshot).toMatchObject({
335 installed: true,
336 status: "warning",
337 - version: "agy_acp_server_20260818_01_RC01",
337 + version: "1.5.12",
338 auth: { status: "unknown", ...(auth ? { type: auth.type } : {}) },
339 message:
340 auth?.type === "gemini-api-key" || auth?.type === "agent-platform"
@@ -495,7 +495,7 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
495 ...started,
496 initializeResult: {
497 ...initializeResult,
498 - agentInfo: { ...initializeResult.agentInfo, version: "1.4.0" },
498 + agentInfo: { ...initializeResult.agentInfo, version: "1.5.13" },
499 },
500 });
501 yield* Ref.set(
@@ -505,7 +505,7 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
505 agentInfo: { ...initializeResult.agentInfo, version: "unknown" },
506 }),
507 );
508 - expect((yield* harness.provider.snapshot.refresh).version).toBe("1.4.0");
508 + expect((yield* harness.provider.snapshot.refresh).version).toBe("1.5.13");
509 }),
510 );
511
apps/server/src/provider/Drivers/AntigravityDriver.test.ts
+62 -23
@@ -4,6 +4,7 @@ import { expect, it } from "@effect/vitest";
4 import {
5 ANTIGRAVITY_DEFAULT_MODEL,
6 EnvironmentId,
7 + ProviderDriverKind,
8 ProviderInstanceId,
9 ProviderSessionId,
10 ThreadId,
@@ -32,6 +33,8 @@ import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderS
33 import * as ModelManifest from "../ModelManifest.ts";
34 import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
35 import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
36 +import { knownProviderFailureMessage } from "@t3tools/provider-core/server/failure";
37 +import { resolveProviderCompatibility } from "../providerCompatibility.ts";
38 import { AntigravityDriver } from "./AntigravityDriver.ts";
39 import * as ProviderHostLive from "../ProviderHostLive.ts";
40 import * as ServerSecretStore from "../../auth/ServerSecretStore.ts";
@@ -81,6 +84,7 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* (
84 const profileDirectory = directories.profile;
85 const instancePath = `${path.join(root, "instance-bin")}:${baseEnv.PATH ?? ""}`;
86
87 + const agentExecutables = new Set<string>();
88 const makeExecutable = Effect.fn("AntigravityDriverTest.makeExecutable")(function* (
89 name: string,
90 options: {
@@ -88,11 +92,11 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* (
92 /** `data` of the agent's "Internal error" response to `session/new`. */
93 readonly newSessionErrorData?: unknown;
94 readonly initialMode?: string;
95 + readonly agentVersion?: string;
96 } = {},
97 ) {
98 const directory = path.join(root, name);
94 - const executablePath = path.join(directory, "agy_acp_server.par");
95 - const harnessPath = path.join(directory, "localharness_external");
99 + const executablePath = path.join(directory, "agy");
100 yield* fs.makeDirectory(directory, { recursive: true });
101 const authorizationUrl =
102 "https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1%3A51234%2F&state=fixture-state";
@@ -111,16 +115,15 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* (
115 ...(options.initialMode === undefined
116 ? []
117 : [`export T3_ACP_INITIAL_MODE=${shellQuote(options.initialMode)}`]),
118 + `export T3_ACP_AGENT_VERSION=${shellQuote(options.agentVersion ?? "1.5.12")}`,
119 `exec ${shellQuote(nodePath)} ${shellQuote(mockAgentPath)} "$@"`,
120 "",
121 ].join("\n"),
122 );
118 - yield* fs.writeFileString(harnessPath, "#!/bin/sh\nexit 99\n");
123 yield* fs.chmod(executablePath, 0o755);
120 - yield* fs.chmod(harnessPath, 0o755);
124 + agentExecutables.add(executablePath);
125 return {
126 executablePath,
123 - harnessPath,
127 source: "managed",
128 version: name,
129 managedVersionDirectory: directory,
@@ -144,7 +147,6 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* (
147 extendEnv: boolean | undefined;
148 environment: Record<string, string | undefined>;
149 profileDirectory: string | undefined;
147 - harnessPath: string | undefined;
150 forceFileStorage: string | undefined;
151 credentialKeys: ReadonlyArray<string>;
152 geminiApiKey: string | undefined;
@@ -154,6 +156,14 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* (
156
157 const layerInstallation = Layer.mock(AntigravityInstallation.AntigravityInstallation)({
158 managedDirectory: root,
159 + compatibility: (version) =>
160 + Effect.succeed(
161 + resolveProviderCompatibility(
162 + ModelManifest.BUNDLED_MODEL_MANIFEST.compatibility,
163 + ProviderDriverKind.make("antigravity"),
164 + version,
165 + ),
166 + ),
167 resolve: () =>
168 Effect.gen(function* () {
169 if (controls.failResolution) {
@@ -200,14 +210,12 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* (
210 extendEnv: command.options.extendEnv,
211 environment: Object.fromEntries(Object.keys(environment).map((name) => [name, env(name)])),
212 profileDirectory: env("GEMINI_HOME"),
203 - harnessPath: env("ANTIGRAVITY_HARNESS_PATH"),
213 forceFileStorage: env("AGY_ACP_FORCE_FILE_STORAGE"),
214 credentialKeys: Object.keys(environment).filter((key) =>
215 blockedCredentialKeys.has(key.toUpperCase()),
216 ),
217 geminiApiKey: env("GEMINI_API_KEY"),
209 - tempDirectory:
210 - environment.ANTIGRAVITY_HARNESS_PATH === undefined ? undefined : env("TMPDIR"),
218 + tempDirectory: agentExecutables.has(command.command) ? env("TMPDIR") : undefined,
219 handle,
220 });
221 return handle;
@@ -227,7 +235,6 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* (
235 { name: "GOOGLE_APPLICATION_CREDENTIALS", value: "/must-not-be-used.json" },
236 { name: "GOOGLE_GENAI_USE_VERTEXAI", value: "true" },
237 { name: "GEMINI_HOME", value: "/must-not-be-used" },
230 - { name: "ANTIGRAVITY_HARNESS_PATH", value: "/must-not-be-used" },
238 { name: "BROWSER", value: "must-not-run" },
239 ...(options.environment ?? []),
240 ].map((variable) => ({ ...variable, sensitive: false })),
@@ -329,19 +336,18 @@ it.layer(layerTest)("AntigravityDriver", (it) => {
336 { binaryPath: "", path: h.instancePath },
337 { binaryPath: "", path: h.instancePath },
338 ]);
332 - const nativeLaunches = h.launches.filter((launch) => launch.harnessPath !== undefined);
333 - expect(nativeLaunches.map((launch) => launch.command)).toEqual([
339 + const agentLaunches = h.launches.filter((launch) => launch.tempDirectory !== undefined);
340 + expect(agentLaunches.map((launch) => launch.command)).toEqual([
341 h.first.executablePath,
342 h.second.executablePath,
343 ]);
337 - expect(nativeLaunches.map((launch) => launch.harnessPath)).toEqual([
338 - h.first.harnessPath,
339 - h.second.harnessPath,
340 - ]);
341 - for (const launch of nativeLaunches) {
344 + for (const launch of agentLaunches) {
345 expect(launch.args).toEqual([
343 - ...(hostPlatform === "linux" ? ["--uid="] : []),
344 - "--alsologtostderr",
346 + "acp",
347 + "--gemini-dir",
348 + h.profileDirectory,
349 + "--app-data-dir",
350 + "antigravity-acp",
351 ]);
352 expect(launch.profileDirectory).toBe(h.profileDirectory);
353 expect(launch.forceFileStorage).toBe("1");
@@ -415,10 +421,7 @@ it.layer(layerTest)("AntigravityDriver", (it) => {
421 ]);
422
423 // The agy CLI rejects `yolo` and `auto_edit`; it stays in `default` and T3 answers its requests.
418 - h.controls.selected = {
419 - ...(yield* h.makeExecutable("runtime cli", { initialMode: "auto_edit" })),
420 - harnessPath: null,
421 - };
424 + h.controls.selected = yield* h.makeExecutable("runtime cli", { initialMode: "auto_edit" });
425 for (const runtimeMode of ["full-access", "auto-accept-edits"] as const) {
426 const requestsBefore = (yield* h.readRequests).length;
427 const cliThreadId = ThreadId.make(`thread-antigravity-cli-${runtimeMode}`);
@@ -532,6 +535,42 @@ it.layer(layerTest)("AntigravityDriver", (it) => {
535 }),
536 );
537
538 + it.effect.skipIf(windowsHost)(
539 + "refuses to open a session on a PATH executable older than 1.5",
540 + () =>
541 + Effect.gen(function* () {
542 + const h = yield* makeHarness();
543 + const old = yield* h.makeExecutable("runtime old", { agentVersion: "1.4.5" });
544 + h.controls.selected = { ...old, source: "path", version: null };
545 + const threadId = ThreadId.make("thread-antigravity-old-runtime");
546 + const modelSelection = { instanceId: h.instance.instanceId, model: "gemini-test-low" };
547 + const error = yield* Effect.scoped(
548 + Effect.gen(function* () {
549 + const workspace = yield* h.fs.makeTempDirectoryScoped({ prefix: "t3-ag-old-runtime-" });
550 + const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
551 + runtimeMode: "approval-required",
552 + interactionMode: "default",
553 + cwd: workspace,
554 + });
555 + const session = yield* h.instance.orchestrationAdapter.openSession({
556 + threadId,
557 + providerSessionId: ProviderSessionId.make("provider-session-antigravity-old-runtime"),
558 + modelSelection,
559 + runtimePolicy,
560 + });
561 + yield* session.ensureThread({ threadId, modelSelection, runtimePolicy });
562 + }),
563 + ).pipe(Effect.flip);
564 + const message = `Antigravity 1.4.5 does not work with this T3 Code release. Update the Antigravity executable at ${old.executablePath} to >=1.5.12 <2, then retry.`;
565 + expect(knownProviderFailureMessage(error)).toBe(message);
566 + expect((yield* h.refresh().pipe(Effect.flip)).detail).toBe(message);
567 + const methods = (yield* h.readRequests).map((request) => request.method);
568 + expect(methods).toContain("initialize");
569 + expect(methods).not.toContain("session/new");
570 + yield* h.assertClosed;
571 + }),
572 + );
573 +
574 it.effect.skipIf(windowsHost)(
575 "closes refresh processes and clears account metadata when Google sign-in is required",
576 () =>
apps/server/src/provider/Drivers/AntigravityDriver.ts
+35 -20
@@ -18,7 +18,6 @@ import * as Effect from "effect/Effect";
18 import * as Exit from "effect/Exit";
19 import * as Fiber from "effect/Fiber";
20 import * as FileSystem from "effect/FileSystem";
21 -import * as Option from "effect/Option";
21 import * as Path from "effect/Path";
22 import * as Schema from "effect/Schema";
23 import * as Scope from "effect/Scope";
@@ -84,6 +83,7 @@ const DRIVER = ProviderDriverKind.make("antigravity");
83 const decodeSettings = Schema.decodeSync(AntigravitySettings);
84 const isNodeRuntimeUnavailableError = Schema.is(NodeRuntimeUnavailableError);
85 const isAcpRequestError = Schema.is(AcpErrors.AcpRequestError);
86 +const isProviderSetupError = Schema.is(ProviderSetupError);
87 const isAcpErrorDetails = Schema.is(Schema.Struct({ details: Schema.String }));
88 const REFRESH_FAILED =
89 "Could not refresh Antigravity models. The previous model list is unchanged.";
@@ -313,22 +313,38 @@ export const AntigravityDriver: ProviderDriver<
313 childProcessSpawner: spawner,
314 spawn,
315 }).pipe(Effect.provideService(SecureRandom.SecureRandom, random));
316 + // A custom or PATH executable has no version until it answers initialize.
317 + const startCompatible = Effect.fn("AntigravityDriver.startCompatible")(function* () {
318 + const version = (yield* runtime.initialize()).agentInfo?.version;
319 + const advisory = version ? yield* installation.compatibility(version) : undefined;
320 + if (advisory?.status === "broken") {
321 + const target =
322 + advisory.recommendedVersion ?? advisory.recommendedRange ?? "a newer version";
323 + const update =
324 + executable.source === "managed"
325 + ? `Update it in Antigravity setup to ${target}`
326 + : `Update the Antigravity executable at ${executable.executablePath} to ${target}`;
327 + const cause = new ProviderSetupError({
328 + instanceId,
329 + operation: "runtime",
330 + detail: `Antigravity ${version} does not work with this T3 Code release. ${update}, then retry.`,
331 + });
332 + return yield* new AcpErrors.AcpTransportError({ detail: cause.detail, cause });
333 + }
334 + return yield* runtime.start();
335 + });
336 return {
337 ...runtime,
318 - ...(executable.harnessPath === null
319 - ? { setMode: (modeId: string) => runtime.setMode(antigravityCliSessionMode(modeId)) }
320 - : {}),
338 + setMode: (modeId: string) => runtime.setMode(antigravityCliSessionMode(modeId)),
339 start: () =>
322 - runtime
323 - .start()
324 - .pipe(
325 - Effect.tapError((cause): Effect.Effect<void> =>
326 - runtimeInput.onAuthorizationUrl === undefined &&
327 - isAntigravitySignInRequiredError(cause)
328 - ? provider.onAuthRequired
329 - : Effect.void,
330 - ),
340 + startCompatible().pipe(
341 + Effect.tapError((cause): Effect.Effect<void> =>
342 + runtimeInput.onAuthorizationUrl === undefined &&
343 + isAntigravitySignInRequiredError(cause)
344 + ? provider.onAuthRequired
345 + : Effect.void,
346 ),
347 + ),
348 };
349 });
350
@@ -382,10 +398,6 @@ export const AntigravityDriver: ProviderDriver<
398 readonly onAuthorizationUrl: (url: string) => Effect.Effect<void, AcpErrors.AcpError>;
399 }) {
400 if (auth.authMethod !== "oauth-personal") return undefined;
385 - const resolved = yield* installation
386 - .resolve(settings.binaryPath, processEnvironment)
387 - .pipe(Effect.option);
388 - if (Option.isSome(resolved) && resolved.value.harnessPath !== null) return undefined;
401 const cwd = yield* fileSystem
402 .makeTempDirectoryScoped({ prefix: "t3-antigravity-login-" })
403 .pipe(
@@ -398,8 +410,7 @@ export const AntigravityDriver: ProviderDriver<
410 }),
411 ),
412 );
401 - const { executable, spawn } = yield* prepareSpawn(cwd, processEnvironment);
402 - if (executable.harnessPath !== null) return undefined;
413 + const { spawn } = yield* prepareSpawn(cwd, processEnvironment);
414 const failed = (detail: string, cause?: unknown) =>
415 new ProviderSetupError({ instanceId, operation: "start", detail, cause });
416 // Without a display it prints the link only, instead of opening a browser on this machine.
@@ -651,7 +662,11 @@ export const AntigravityDriver: ProviderDriver<
662 : cause._tag === "ProviderSetupError" &&
663 (cause.operation === "configure" || cause.operation === "start")
664 ? cause.detail
654 - : refreshFailureDetail(cause),
665 + : cause._tag === "AcpTransportError" &&
666 + isProviderSetupError(cause.cause) &&
667 + cause.cause.operation === "runtime"
668 + ? cause.cause.detail
669 + : refreshFailureDetail(cause),
670 cause,
671 }),
672 ),
apps/server/src/provider/ModelManifest.test.ts
+2
@@ -377,6 +377,8 @@ describe("ModelManifest service", () => {
377 for (const stale of [
378 undatedManifest,
379 { ...REMOTE_MANIFEST, updatedAt: "2000-01-01T00:00:00Z" },
380 + // The last bundle before Antigravity below 1.5 became broken.
381 + { ...REMOTE_MANIFEST, updatedAt: "2026-11-14T15:58:47Z" },
382 ]) {
383 yield* fs.writeFileString(
384 cachePath,
apps/server/src/provider/ProviderRegistry.test.ts
+1 -1
@@ -2094,7 +2094,7 @@ it.layer(
2094 installed: true,
2095 auth: { status: "authenticated", type: "oauth-personal", label: "Google account" },
2096 checkedAt: "2026-09-05T00:00:00.000Z",
2097 - version: "agy_acp_server_1.1.1",
2097 + version: "1.5.12",
2098 models: [
2099 {
2100 slug: "gemini-3.7-flash-high",
apps/server/src/provider/acp/AntigravityAcpSupport.test.ts
+15 -111
@@ -5,7 +5,6 @@ import {
5 PROVIDER_SEND_TURN_MAX_IMAGE_BYTES,
6 type ChatAttachment,
7 } from "@t3tools/contracts";
8 -import * as HostProcess from "@t3tools/shared/HostProcess";
8 import * as Effect from "effect/Effect";
9 import * as FileSystem from "effect/FileSystem";
10 import * as Path from "effect/Path";
@@ -19,7 +18,6 @@ import {
18 antigravityClientInfo,
19 antigravitySessionMeta,
20 buildAntigravityPrompt,
22 - isQualifiedAntigravityRelease,
21 } from "./AntigravityAcpSupport.ts";
22
23 const modelConfig = {
@@ -60,41 +58,30 @@ function makeModelRuntime(
58
59 describe("Antigravity release gates", () => {
60 it.each([
63 - { version: "1.4.1", filter: false, native: false, ownName: false, advertisedAppend: false },
64 - { version: "1.4.2", filter: true, native: false, ownName: false, advertisedAppend: false },
65 - { version: "1.4.4", filter: true, native: false, ownName: false, advertisedAppend: false },
66 - { version: "1.4.5", filter: true, native: true, ownName: false, advertisedAppend: false },
67 - { version: "1.4.6", filter: false, native: false, ownName: false, advertisedAppend: false },
68 - { version: "1.5.0", filter: false, native: false, ownName: false, advertisedAppend: false },
69 - { version: "1.5.1", filter: false, native: false, ownName: true, advertisedAppend: false },
70 - { version: "1.5.7", filter: false, native: false, ownName: true, advertisedAppend: true },
71 - { version: "1.3.0", filter: false, native: false, ownName: false, advertisedAppend: false },
72 - { version: undefined, filter: false, native: false, ownName: false, advertisedAppend: false },
73 - { version: "unknown", filter: false, native: false, ownName: false, advertisedAppend: false },
61 + { version: "1.5.0", ownName: false, advertisedAppend: false },
62 + { version: "1.5.1", ownName: true, advertisedAppend: false },
63 + { version: "1.5.7", ownName: true, advertisedAppend: true },
64 + { version: undefined, ownName: false, advertisedAppend: false },
65 + { version: "unknown", ownName: false, advertisedAppend: false },
66 ])(
75 - "$version: workflow filter $filter, qualified reads $native, advertised system append $advertisedAppend, own client name $ownName",
76 - ({ version, filter, native, ownName, advertisedAppend }) => {
67 + "$version: advertised system append $advertisedAppend, own client name $ownName",
68 + ({ version, ownName, advertisedAppend }) => {
69 const initialize = {
70 protocolVersion: 1,
71 ...(advertisedAppend
72 ? { agentCapabilities: { _meta: { antigravity: { systemPrompt: { append: true } } } } }
73 : {}),
82 - ...(version === undefined ? {} : { agentInfo: { name: "antigravity-acp", version } }),
83 - };
84 - // Helpers send no append, so only the workflow filter can apply.
85 - expect(antigravitySessionMeta(initialize)).toEqual(
86 - filter ? { antigravity: { disabledTools: ["run_workflow"] } } : undefined,
87 - );
88 - const antigravity = {
89 - ...(filter ? { disabledTools: ["run_workflow"] } : {}),
90 - ...(native || advertisedAppend
91 - ? { systemPrompt: { append: "<pull_request_linking/>" } }
92 - : {}),
74 + ...(version === undefined
75 + ? {}
76 + : { agentInfo: { name: "Antigravity ACP Server", version } }),
77 };
78 + // Helpers send no append.
79 + expect(antigravitySessionMeta(initialize)).toBeUndefined();
80 expect(antigravitySessionMeta(initialize, "<pull_request_linking/>")).toEqual(
95 - filter || native || advertisedAppend ? { antigravity } : undefined,
81 + advertisedAppend
82 + ? { antigravity: { systemPrompt: { append: "<pull_request_linking/>" } } }
83 + : undefined,
84 );
97 - expect(isQualifiedAntigravityRelease(version)).toBe(native);
85 expect(antigravityClientInfo(version).name).toBe(ownName ? "t3-code" : "zed");
86 },
87 );
@@ -380,89 +367,6 @@ it.layer(NodeServices.layer)("buildAntigravityPrompt", (it) => {
367 }),
368 );
369
383 - it.effect.each([
384 - {
385 - case: "a Gemini model id",
386 - model: { id: "gemini-3.8-flash", name: "Gemini 3.8 Flash" },
387 - linked: true,
388 - },
389 - {
390 - case: "an opaque id named Gemini",
391 - model: { id: "agy-model", name: "Gemini 4 Carbon" },
392 - linked: true,
393 - },
394 - { case: "an unknown model", model: { id: "agy-custom", name: "Custom" }, linked: false },
395 - { case: "an unlisted opaque id", model: { id: "agy-custom", name: undefined }, linked: false },
396 - { case: "an unresolved model", model: undefined, linked: false },
397 - {
398 - case: "a Claude model",
399 - model: { id: "claude-opus-5-5", name: "Claude Opus 5.5" },
400 - linked: false,
401 - },
402 - {
403 - case: "an unqualified runtime",
404 - agentVersion: "1.4.1",
405 - model: { id: "gemini-3.8-flash", name: "Gemini 3.8 Flash" },
406 - linked: false,
407 - },
408 - {
409 - case: "a Windows host",
410 - platform: "win32" as const,
411 - model: { id: "gemini-3.8-flash", name: "Gemini 3.8 Flash" },
412 - linked: false,
413 - },
414 - {
415 - case: "a clip over 20 MiB",
416 - model: { id: "gemini-3.8-flash", name: "Gemini 3.8 Flash" },
417 - linked: false,
418 - sizeBytes: 20 * 1024 * 1024 + 1,
419 - },
420 - ])(
421 - "links an MP4 for $case only when supported",
422 - ({ agentVersion = "1.4.5", platform = "linux", model, linked, ...size }) =>
423 - Effect.gen(function* () {
424 - const fixture = yield* makeAttachmentFixture();
425 - const clip = {
426 - ...textAttachment,
427 - id: "clip",
428 - name: "clip.mp4",
429 - mimeType: "video/mp4",
430 - sizeBytes: 6 * 1024 * 1024,
431 - ...size,
432 - };
433 - const upload = yield* fixture.write(clip, "");
434 - yield* fixture.fs.truncate(upload.filePath, clip.sizeBytes);
435 - const prompt = yield* buildAntigravityPrompt({
436 - input: "What colors appear?",
437 - attachments: [clip],
438 - resolveAttachmentPath: fixture.resolve,
439 - promptCapabilities: { image: true, audio: true, embeddedContext: true },
440 - agentVersion,
441 - currentModel: model,
442 - }).pipe(
443 - Effect.provideService(HostProcess.Platform, platform),
444 - Effect.provideService(FileSystem.FileSystem, {
445 - ...fixture.fs,
446 - stream: () => Effect.die("Linked video is read by the agent").pipe(Stream.fromEffect),
447 - }),
448 - );
449 - expect(prompt).toEqual([
450 - { type: "text", text: "What colors appear?" },
451 - ...(linked
452 - ? [
453 - {
454 - type: "resource_link",
455 - uri: upload.uri,
456 - name: "clip.mp4",
457 - mimeType: "video/mp4",
458 - size: clip.sizeBytes,
459 - },
460 - ]
461 - : []),
462 - ]);
463 - }),
464 - );
465 -
370 it.effect.each([undefined, {}, { image: false, audio: false, embeddedContext: false }])(
371 "keeps attachments path-only when native prompt capabilities are absent: %s",
372 (promptCapabilities) =>
apps/server/src/provider/acp/AntigravityAcpSupport.ts
+9 -72
@@ -6,7 +6,6 @@ import {
6 type ProviderSendTurnInput,
7 type RuntimeMode,
8 } from "@t3tools/contracts";
9 -import * as HostProcess from "@t3tools/shared/HostProcess";
9 import * as SecureRandom from "effect/crypto/SecureRandom";
10 import * as Effect from "effect/Effect";
11 import * as FileSystem from "effect/FileSystem";
@@ -42,10 +41,10 @@ export interface AntigravityAcpRuntimeInput extends Omit<
41 > {
42 readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
43 readonly onAuthorizationUrl?: (url: string) => Effect.Effect<void, EffectAcpErrors.AcpError>;
45 - /** Serve `fs/read_text_file` for runtimes whose native reader is not qualified. */
44 + /** Serve `fs/read_text_file` from T3 instead of the agent's native reader. */
45 readonly clientFileReads?: boolean;
46 readonly clientCapabilities?: AcpSessionRuntime.AcpSessionRuntimeOptions["clientCapabilities"];
48 - /** The installed version, known before `initialize`; it picks the file reader and client name. */
47 + /** The installed version, known before `initialize`; it picks the client name. */
48 readonly runtimeVersion?: string | null;
49 /** Conversational sessions only; helpers and probes leave the system prompt untouched. */
50 readonly sessionSystemPromptAppend?: string;
@@ -65,27 +64,6 @@ function compareVersions(left: ReadonlyArray<number>, right: ReadonlyArray<numbe
64 return 0;
65 }
66
68 -/**
69 - * 1.4.2 through 1.4.5 create or overwrite skills/system/run-workflow/SKILL.md in the workspace
70 - * unless `run_workflow` is disabled. Older builds offer the tool and leave the file alone.
71 - */
72 -function antigravityWritesRunWorkflowSkill(version: string | null | undefined): boolean {
73 - const parsed = parseAntigravityVersion(version);
74 - return (
75 - parsed !== undefined &&
76 - compareVersions(parsed, [1, 4, 2]) >= 0 &&
77 - compareVersions(parsed, [1, 4, 5]) <= 0
78 - );
79 -}
80 -
81 -/**
82 - * Releases T3 qualified for native range reads and linked video. On 1.4.5 the client-read path
83 - * sends a whole file to serve one line, and the native reader keeps diff edits.
84 - */
85 -export function isQualifiedAntigravityRelease(version: string | null | undefined): boolean {
86 - return version?.trim() === "1.4.5";
87 -}
88 -
67 // `agy acp` 1.5.1 offers every model to every ACP client; older runtimes allowlist editors.
68 const OPEN_MODEL_ACCESS_RELEASE = [1, 5, 1] as const;
69 // `agy acp` 1.5.0 steers a running turn with the next prompt; the 1.4 harness queues it.
@@ -98,14 +76,9 @@ export const antigravitySteersWithPrompt = (
76 return parsed !== undefined && compareVersions(parsed, PROMPT_STEERING_RELEASE) >= 0;
77 };
78
101 -/**
102 - * 1.4.5 appends `systemPrompt.append` to its system instructions on new, load and resume, and
103 - * keeps none of it between processes, so every activation sends it again.
104 - */
79 export const antigravityAppendsSystemPrompt = (
80 initializeResult: EffectAcpSchema.InitializeResponse,
81 ) => {
108 - if (isQualifiedAntigravityRelease(initializeResult.agentInfo?.version)) return true;
82 const extension = initializeResult.agentCapabilities?._meta?.antigravity;
83 return (
84 Predicate.isObject(extension) &&
@@ -118,15 +91,9 @@ export function antigravitySessionMeta(
91 initializeResult: EffectAcpSchema.InitializeResponse,
92 systemPromptAppend?: string,
93 ): EffectAcpSchema.NewSessionRequest["_meta"] | undefined {
121 - const antigravity = {
122 - ...(antigravityWritesRunWorkflowSkill(initializeResult.agentInfo?.version)
123 - ? { disabledTools: ["run_workflow"] }
124 - : {}),
125 - ...(systemPromptAppend !== undefined && antigravityAppendsSystemPrompt(initializeResult)
126 - ? { systemPrompt: { append: systemPromptAppend } }
127 - : {}),
128 - };
129 - return Object.keys(antigravity).length === 0 ? undefined : { antigravity };
94 + return systemPromptAppend !== undefined && antigravityAppendsSystemPrompt(initializeResult)
95 + ? { antigravity: { systemPrompt: { append: systemPromptAppend } } }
96 + : undefined;
97 }
98
99 /** Older releases offer non-Gemini models only to allowlisted clients such as Zed. */
@@ -158,8 +125,7 @@ export const makeAntigravityAcpRuntime = Effect.fn("makeAntigravityAcpRuntime")(
125 ...input.clientCapabilities,
126 // Advertising writes swaps the agent's diff edits for whole-file client_edit_file.
127 fs: {
161 - readTextFile:
162 - input.clientFileReads === true && !isQualifiedAntigravityRelease(input.runtimeVersion),
128 + readTextFile: input.clientFileReads === true,
129 writeTextFile: false,
130 },
131 terminal: false,
@@ -321,18 +287,6 @@ const AUDIO_MIME_TYPES = new Set([
287 "audio/webm",
288 ]);
289 const ANTIGRAVITY_MAX_AUDIO_ATTACHMENT_BYTES = 20 * 1024 * 1024;
324 -// The agent inlines linked video bytes into one model request, so keep it under the inline limit.
325 -const ANTIGRAVITY_MAX_VIDEO_ATTACHMENT_BYTES = 20 * 1024 * 1024;
326 -
327 -/**
328 - * Only Gemini takes video. The evidence is the session's resolved model, so an account default
329 - * counts once the agent reports it; opaque ids such as `agy-model` need a Gemini display name.
330 - */
331 -function antigravityModelAcceptsVideo(
332 - model: { readonly id: string; readonly name: string | undefined } | undefined,
333 -): boolean {
334 - return model !== undefined && (/^gemini-/i.test(model.id) || /^gemini\b/i.test(model.name ?? ""));
335 -}
290 const TEXT_MIME_TYPES = new Set([
291 "application/json",
292 "application/ld+json",
@@ -402,9 +356,6 @@ export const buildAntigravityPrompt = Effect.fn("buildAntigravityPrompt")(functi
356 attachment: NonNullable<ProviderSendTurnInput["attachments"]>[number],
357 ) => string | null;
358 readonly promptCapabilities: EffectAcpSchema.AgentCapabilities["promptCapabilities"];
405 - /** Linked video needs a runtime whose `resource_link` handling is qualified and a Gemini model. */
406 - readonly agentVersion?: string | undefined;
407 - readonly currentModel?: { readonly id: string; readonly name: string | undefined } | undefined;
359 }): Effect.fn.Return<
360 ReadonlyArray<EffectAcpSchema.ContentBlock>,
361 EffectAcpErrors.AcpError,
@@ -412,8 +363,6 @@ export const buildAntigravityPrompt = Effect.fn("buildAntigravityPrompt")(functi
363 > {
364 const fileSystem = yield* FileSystem.FileSystem;
365 const path = yield* Path.Path;
415 - // The agent runs on this host.
416 - const platform = yield* HostProcess.Platform;
366 const blocks: Array<EffectAcpSchema.ContentBlock> = [];
367 const text = input.input?.trim();
368 if (text) blocks.push({ type: "text", text });
@@ -429,14 +378,6 @@ export const buildAntigravityPrompt = Effect.fn("buildAntigravityPrompt")(functi
378 const image = attachment.type === "image" && IMAGE_MIME_TYPES.has(mimeType);
379 const audio = attachment.type === "file" && AUDIO_MIME_TYPES.has(mimeType);
380 const pdf = attachment.type === "file" && mimeType === "application/pdf";
432 - const video =
433 - attachment.type === "file" &&
434 - mimeType === "video/mp4" &&
435 - isQualifiedAntigravityRelease(input.agentVersion) &&
436 - // The agent turns a file URI into a path with unquote(urlparse(uri).path), which drops
437 - // Windows drives and UNC hosts. Keep the saved path there until Google fixes it.
438 - platform !== "win32" &&
439 - antigravityModelAcceptsVideo(input.currentModel);
381 const textFile =
382 attachment.type === "file" &&
383 (mimeType.startsWith("text/") ||
@@ -448,9 +389,7 @@ export const buildAntigravityPrompt = Effect.fn("buildAntigravityPrompt")(functi
389 (isPastedText ||
390 (audio
391 ? input.promptCapabilities?.audio !== true
451 - : pdf || textFile
452 - ? input.promptCapabilities?.embeddedContext !== true
453 - : !video)));
392 + : !(pdf || textFile) || input.promptCapabilities?.embeddedContext !== true)));
393 const attachmentPath = input.resolveAttachmentPath(attachment);
394 if (!attachmentPath) {
395 return yield* EffectAcpErrors.AcpRequestError.invalidParams(
@@ -479,9 +418,7 @@ export const buildAntigravityPrompt = Effect.fn("buildAntigravityPrompt")(functi
418 ? ANTIGRAVITY_MAX_AUDIO_ATTACHMENT_BYTES
419 : pdf
420 ? MAX_TOTAL_ATTACHMENT_BYTES
482 - : video
483 - ? ANTIGRAVITY_MAX_VIDEO_ATTACHMENT_BYTES
484 - : ANTIGRAVITY_MAX_TEXT_ATTACHMENT_BYTES;
421 + : ANTIGRAVITY_MAX_TEXT_ATTACHMENT_BYTES;
422 if (
423 attachment.type === "file" &&
424 (size > limit || totalBytes + size > MAX_TOTAL_ATTACHMENT_BYTES)
@@ -500,7 +437,7 @@ export const buildAntigravityPrompt = Effect.fn("buildAntigravityPrompt")(functi
437 EffectAcpErrors.AcpRequestError.invalidParams(`Invalid attachment '${attachment.name}'.`),
438 ),
439 );
503 - if (pdf || video) {
440 + if (pdf) {
441 blocks.push({ type: "resource_link", uri, name: attachment.name, mimeType, size });
442 continue;
443 }
apps/server/src/provider/antigravityAuthSupport.test.ts
+7 -63
@@ -56,7 +56,7 @@ describe("Antigravity process environment", () => {
56 browserCommand: "managed-browser-helper",
57 };
58
59 - it("isolates the profile and harness after merging overrides without changing the base environment", () => {
59 + it("runs `agy acp` with an isolated profile without changing the base environment", () => {
60 const baseEnv = {
61 HOME: "/home/developer",
62 PATH: "/usr/bin",
@@ -72,7 +72,6 @@ describe("Antigravity process environment", () => {
72 GEMINI_HOME: "/shared-gemini-home",
73 gemini_home: "/alias-shared-home",
74 AGY_ACP_FORCE_FILE_STORAGE: "0",
75 - ANTIGRAVITY_HARNESS_PATH: "/wrong-version/harness",
75 BROWSER: "open-real-browser",
76 browser: "another-real-browser",
77 PYTHONUNBUFFERED: "0",
@@ -83,7 +82,7 @@ describe("Antigravity process environment", () => {
82 };
83 const original = { ...baseEnv };
84 const spawn = buildAntigravityAcpSpawnInput({
86 - installation: { executablePath: "/release/acp", harnessPath: "/release/harness" },
85 + installation: { executablePath: "/usr/bin/agy" },
86 profile,
87 cwd: "/project",
88 baseEnv,
@@ -91,8 +90,8 @@ describe("Antigravity process environment", () => {
90
91 expect(baseEnv).toEqual(original);
92 expect(spawn).toEqual({
94 - command: "/release/acp",
95 - args: ["--uid=", "--alsologtostderr"],
93 + command: "/usr/bin/agy",
94 + args: ["acp", "--gemini-dir", profile.geminiHome, "--app-data-dir", "antigravity-acp"],
95 cwd: "/project",
96 extendEnv: false,
97 env: {
@@ -101,7 +100,6 @@ describe("Antigravity process environment", () => {
100 CUSTOM_SETTING: "keep-this",
101 GEMINI_HOME: profile.geminiHome,
102 AGY_ACP_FORCE_FILE_STORAGE: "1",
104 - ANTIGRAVITY_HARNESS_PATH: "/release/harness",
103 BROWSER: profile.browserCommand,
104 PYTHONUNBUFFERED: "1",
105 ELECTRON_RUN_AS_NODE: "1",
@@ -110,31 +108,11 @@ describe("Antigravity process environment", () => {
108 });
109 });
110
113 - it("runs the agy CLI as `agy acp` without a harness", () => {
114 - const spawn = buildAntigravityAcpSpawnInput({
115 - installation: { executablePath: "/usr/bin/agy", harnessPath: null },
116 - profile,
117 - cwd: "/project",
118 - baseEnv: { PATH: "/usr/bin", ANTIGRAVITY_HARNESS_PATH: "/stale/harness" },
119 - });
120 -
121 - expect(spawn.command).toBe("/usr/bin/agy");
122 - expect(spawn.args).toEqual([
123 - "acp",
124 - "--gemini-dir",
125 - profile.geminiHome,
126 - "--app-data-dir",
127 - "antigravity-acp",
128 - ]);
129 - expect(spawn.env).not.toHaveProperty("ANTIGRAVITY_HARNESS_PATH");
130 - expect(spawn.env).toMatchObject({ GEMINI_HOME: profile.geminiHome, PATH: "/usr/bin" });
131 - });
132 -
111 it("passes only the configured method's credential and keeps the GCP pair out of the environment", () => {
112 const baseEnv = { PATH: "/usr/bin", GOOGLE_API_KEY: "ambient-key" };
113 const spawnFor = (auth: AntigravityAuthConfig) =>
114 buildAntigravityAcpSpawnInput({
137 - installation: { executablePath: "/release/acp", harnessPath: "/release/harness" },
115 + installation: { executablePath: "/usr/bin/agy" },
116 profile,
117 cwd: "/project",
118 baseEnv,
@@ -180,10 +158,7 @@ describe("Antigravity process environment", () => {
158 browserCommand: "managed-browser-helper",
159 };
160 const input = {
183 - installation: {
184 - executablePath: "C:\\release\\agy_acp_server.exe",
185 - harnessPath: "C:\\release\\localharness_external.exe",
186 - },
161 + installation: { executablePath: "C:\\release\\agy.exe" },
162 profile: windowsProfile,
163 cwd: "C:\\project",
164 baseEnv: { PATH: "C:\\Windows\\system32", TEMP: "C:\\Users\\user\\AppData\\Local\\Temp" },
@@ -442,37 +417,6 @@ describe("Antigravity stdout compatibility", () => {
417 });
418
419 describe("Antigravity stderr compatibility", () => {
445 - it.effect.each([
446 - "I1022 11:04:37.910207 1865358 local_connection.py:551] harness stderr: Agent run failed: failed to handle call hook response: no pending hook for ID hook_request_2",
447 - "E1022 11:04:37.910207 1865358 server.py:5275] Failed to rebuild agent for session native-session; connection unrecoverable",
448 - "E1022 11:04:37.910207 1865358 server.py:5266] Agent connection lost for session native-session after rebuild retry",
449 - ])("retires the transport on a native harness failure: %s", (line) =>
450 - Effect.gen(function* () {
451 - const handleStderr = makeAntigravityStderrHandler();
452 - yield* handleStderr(line.slice(0, 70));
453 - const error = yield* handleStderr(`${line.slice(70)}\r\n`).pipe(Effect.flip);
454 - expect(error._tag).toBe("AcpTransportError");
455 - expect(error.message).not.toContain("native-session");
456 - expect(error.message).not.toContain("hook_request_2");
457 - }),
458 - );
459 -
460 - it.effect(
461 - "does not classify task prose or unrelated native warnings as a transport failure",
462 - () =>
463 - Effect.gen(function* () {
464 - const handleStderr = makeAntigravityStderrHandler();
465 - yield* handleStderr("Agent run failed: example from a task\n");
466 - yield* handleStderr("Agent connection was lost and could not be re-established\n");
467 - yield* handleStderr(
468 - "I1022 11:04:37.910207 1865358 server.py:5142] Agent connection closed for session native-session; rebuilding agent and retrying the turn once.\n",
469 - );
470 - yield* handleStderr(
471 - "W1022 11:04:37.910207 1865358 telemetry.py:431] No business auth manager configured\n",
472 - );
473 - }),
474 - );
475 -
420 it.effect("forwards fragmented native sign-in URLs from runtime 1.1.1", () =>
421 Effect.gen(function* () {
422 const urls: string[] = [];
@@ -574,7 +518,7 @@ it.layer(NodeServices.layer)("Antigravity profile preparation", (it) => {
518 }),
519 );
520 return buildAntigravityAcpSpawnInput({
577 - installation: { executablePath: "/release/acp", harnessPath: "/release/harness" },
521 + installation: { executablePath: "/usr/bin/agy" },
522 profile,
523 cwd: directory,
524 baseEnv,
apps/server/src/provider/antigravityAuthSupport.ts
+16 -43
@@ -72,7 +72,6 @@ const removedEnvironmentKeys = new Set([
72 "AGY_ACP_ENABLE_OAUTH",
73 "GEMINI_HOME",
74 "AGY_ACP_FORCE_FILE_STORAGE",
75 - "ANTIGRAVITY_HARNESS_PATH",
75 "BROWSER",
76 "PYTHONUNBUFFERED",
77 "ELECTRON_RUN_AS_NODE",
@@ -457,10 +456,7 @@ export const prepareAntigravityProfile = Effect.fn("prepareAntigravityProfile")(
456 });
457
458 export function buildAntigravityAcpSpawnInput(input: {
460 - readonly installation: {
461 - readonly executablePath: string;
462 - readonly harnessPath: string | null;
463 - };
459 + readonly installation: { readonly executablePath: string };
460 readonly profile: AntigravityProfile;
461 readonly cwd: string;
462 readonly baseEnv?: NodeJS.ProcessEnv;
@@ -469,32 +465,21 @@ export function buildAntigravityAcpSpawnInput(input: {
465 }): AcpSessionRuntime.AcpSpawnInput {
466 return {
467 command: input.installation.executablePath,
472 - // The agy CLI has no harness sibling and serves ACP through its `acp` subcommand.
473 - // The harness can survive a failed local agent and return end_turn; its native
474 - // logs are the failure signal, so the transport must receive them.
475 - args:
476 - input.installation.harnessPath === null
477 - ? [
478 - "acp",
479 - "--gemini-dir",
480 - input.profile.geminiHome,
481 - "--app-data-dir",
482 - // The CLI joins this beneath gemini-dir, including when the value is absolute.
483 - "antigravity-acp",
484 - ]
485 - : [...(input.profile.platform === "linux" ? ["--uid="] : []), "--alsologtostderr"],
468 + args: [
469 + "acp",
470 + "--gemini-dir",
471 + input.profile.geminiHome,
472 + "--app-data-dir",
473 + // The CLI joins this beneath gemini-dir, including when the value is absolute.
474 + "antigravity-acp",
475 + ],
476 cwd: input.cwd,
487 - env: {
488 - ...antigravityEnvironment(
489 - input.profile,
490 - input.baseEnv ?? process.env,
491 - input.auth ?? ANTIGRAVITY_PERSONAL_AUTH,
492 - input.runtimeTempDirectory,
493 - ),
494 - ...(input.installation.harnessPath === null
495 - ? {}
496 - : { ANTIGRAVITY_HARNESS_PATH: input.installation.harnessPath }),
497 - },
477 + env: antigravityEnvironment(
478 + input.profile,
479 + input.baseEnv ?? process.env,
480 + input.auth ?? ANTIGRAVITY_PERSONAL_AUTH,
481 + input.runtimeTempDirectory,
482 + ),
483 extendEnv: false,
484 };
485 }
@@ -636,10 +621,6 @@ export function makeAntigravityStdoutTransform(
621 });
622 }
623
639 -// glog records from the managed harness after which its ACP process can no longer run a turn.
640 -const ANTIGRAVITY_HARNESS_FAILURE_LOG =
641 - /^[IWEF]\d{4} \d{2}:\d{2}:\d{2}\.\d+ +\d+ (?:local_connection\.py:\d+\] harness stderr: Agent run failed:|server\.py:\d+\] (?:Failed to rebuild agent for session |Agent connection lost for session ))/;
642 -
624 export function makeAntigravityStderrHandler(
625 input: {
626 readonly onAuthorizationUrl?: (
@@ -648,18 +629,10 @@ export function makeAntigravityStderrHandler(
629 } = {},
630 ) {
631 let pending = "";
651 - // Untraced: with native logs on stderr this runs for every harness log line.
632 + // Untraced: this runs for every stderr line.
633 const handleLine = Effect.fnUntraced(function* (line: string) {
634 const message = line.endsWith("\r") ? line.slice(0, -1) : line;
635 if (message.length > maxBrowserHelperLineLength) return;
655 - if (ANTIGRAVITY_HARNESS_FAILURE_LOG.test(message)) {
656 - return yield* new AcpErrors.AcpTransportError({
657 - method: "session/prompt",
658 - detail:
659 - "Antigravity's local agent connection failed. Send a follow-up to resume with a fresh process.",
660 - cause: undefined,
661 - });
662 - }
636 const url = message.startsWith(ANTIGRAVITY_AUTH_STDOUT_PREFIX)
637 ? Effect.succeed(message.slice(ANTIGRAVITY_AUTH_STDOUT_PREFIX.length))
638 : message.startsWith(ANTIGRAVITY_AUTH_BROWSER_MARKER)
apps/server/src/provider/antigravityRelease.ts deleted
-14
@@ -1,14 +0,0 @@
1 -export interface AntigravityReleaseAsset {
2 - readonly version: string;
3 - readonly url: string;
4 - readonly sha256: string;
5 - readonly archiveBytes: number;
6 - readonly executable: {
7 - readonly name: string;
8 - readonly bytes: number;
9 - };
10 - readonly harness: {
11 - readonly name: string;
12 - readonly bytes: number;
13 - };
14 -}
apps/server/src/provider/managedRelease.ts
+1 -2
@@ -1,7 +1,6 @@
1 import { compareSemverVersions, parseSemver } from "@t3tools/shared/semver";
2
3 -// Older pins recorded non-semver versions such as `agy_acp_server_1.1.1`; any
4 -// other release is an update from those.
3 +// A non-semver installed version counts any other release as an update.
4 const isNewer = (candidate: string, current: string) =>
5 parseSemver(candidate) && parseSemver(current)
6 ? compareSemverVersions(candidate, current) > 0
apps/server/src/provider/model-manifest.json
+12 -4
@@ -1,6 +1,6 @@
1 {
2 "version": 1,
3 - "updatedAt": "2026-11-14T15:58:47Z",
3 + "updatedAt": "2026-11-19T00:00:00Z",
4 "compatibility": [
5 {
6 "driver": "codex",
@@ -74,16 +74,24 @@
74 },
75 {
76 "driver": "antigravity",
77 - "t3CodeRange": ">=0.0.42",
78 - "recommendedRange": ">=1.5.1 <2",
77 + "t3CodeRange": ">=0.0.42 <0.1.10",
78 + "recommendedRange": "=1.4.5 || =1.4.1",
79 "ranges": [
80 - { "range": ">=1.5.1 <2", "status": "supported" },
80 { "range": "=1.4.5", "status": "supported" },
81 { "range": "=1.4.1", "status": "supported" },
82 { "range": "=1.3.0", "status": "supported" },
83 { "range": "=1.1.1", "status": "supported" }
84 ]
85 },
86 + {
87 + "driver": "antigravity",
88 + "t3CodeRange": ">=0.1.10",
89 + "recommendedRange": ">=1.5.12 <2",
90 + "ranges": [
91 + { "range": ">=1.5.0 <2", "status": "supported" },
92 + { "range": "<1.5.0", "status": "broken" }
93 + ]
94 + },
95 {
96 "driver": "kiro",
97 "t3CodeRange": ">=0.0.46",
apps/server/src/provider/providerCompatibility.test.ts
+21 -33
@@ -111,42 +111,31 @@ describe("provider compatibility", () => {
111 );
112 });
113
114 - it("recognizes Antigravity semver release tags while keeping dated candidates unknown", () => {
114 + it("marks Antigravity below 1.5 broken and recommends 1.5.12 in the bundled manifest", () => {
115 + const policies = decodeCompatibilityPolicies(bundledManifest.compatibility);
116 const antigravity = ProviderDriverKind.make("antigravity");
116 - const taggedPolicy = {
117 - ...policy,
118 - driver: antigravity,
119 - ranges: [{ range: "=2.0.0", status: "supported" as const }],
120 - };
121 - for (const [version, expected] of [
122 - ["agy_acp_server_2.0.0", "supported"],
123 - ["2.0.0", "supported"],
124 - ["agy_acp_server_2.0.1", "unknown"],
125 - ["agy_acp_server_2.0.0-beta.1", "unknown"],
126 - ["agy_acp_server_20260818_01_RC01", "unknown"],
127 - ] as const) {
128 - assert.strictEqual(
129 - resolveProviderCompatibility([taggedPolicy], antigravity, version)?.status,
130 - expected,
131 - );
117 + for (const version of [
118 + "1.1.1",
119 + "1.3.0",
120 + "1.4.1",
121 + "1.4.5",
122 + "1.4.9",
123 + "agy_acp_server_1.4.5",
124 + "1.4.5-beta",
125 + ]) {
126 + const advisory = resolveProviderCompatibility(policies, antigravity, version);
127 + assert.strictEqual(advisory?.status, "broken", version);
128 }
129 + const supported = resolveProviderCompatibility(policies, antigravity, "1.5.11");
130 + assert.strictEqual(supported?.status, "supported");
131 + assert.strictEqual(supported?.recommendedRange, ">=1.5.12 <2");
132 + // Stable releases before 0.1.10 cannot install the CLI, so they keep the policy they shipped with.
133 + assert.strictEqual(
134 + resolveProviderCompatibility(policies, antigravity, "1.4.5", "0.1.9")?.status,
135 + "supported",
136 + );
137 });
138
135 - it.each(["1.4.5", "1.5.7"])(
136 - "supports the legacy and native Antigravity runtime %s in the bundled manifest",
137 - (version) => {
138 - const policies = decodeCompatibilityPolicies(bundledManifest.compatibility);
139 - assert.strictEqual(
140 - resolveProviderCompatibility(
141 - policies,
142 - ProviderDriverKind.make("antigravity"),
143 - `agy_acp_server_${version}`,
144 - )?.status,
145 - "supported",
146 - );
147 - },
148 - );
149 -
139 it("classifies boundaries and treats unlisted versions and release tags as unknown", () => {
140 for (const [version, expected] of [
141 ["0.9.9", "broken"],
@@ -156,7 +145,6 @@ describe("provider compatibility", () => {
145 ["v2.0.0", "supported"],
146 ["3.0.0", "unknown"],
147 ["2.0.0-beta.1", "unknown"],
159 - ["agy_acp_server_20260818_01_RC01", "unknown"],
148 [null, "unknown"],
149 ] as const) {
150 assert.strictEqual(resolveProviderCompatibility([policy], driver, version)?.status, expected);
apps/server/src/provider/providerCompatibility.ts
+6 -5
@@ -65,14 +65,15 @@ export function resolveProviderCompatibility(
65 );
66 if (!policy) return undefined;
67 const unprefixed = version?.replace(/^v/, "");
68 - // Strip Cursor build hashes, Google ACP release prefixes and Muse revisions; leave semver prereleases unknown.
68 + // Strip Cursor build hashes and Muse revisions; leave other prereleases unknown. Antigravity
69 + // drops its pre-CLI prefix and prerelease suffix, so a custom launcher below 1.5 resolves broken.
70 const stable =
71 driver === "cursor"
72 ? unprefixed?.replace(/^(\d{4}\.\d{2}\.\d{2})-[a-f0-9]+$/, "$1")
72 - : driver === "antigravity"
73 - ? unprefixed?.replace(/^agy_acp_server_(\d+\.\d+\.\d+)$/, "$1")
74 - : driver === "muse"
75 - ? unprefixed?.replace(/^(\d+\.\d+\.\d+)-R\d+(?:\.\d+)?$/, "$1")
73 + : driver === "muse"
74 + ? unprefixed?.replace(/^(\d+\.\d+\.\d+)-R\d+(?:\.\d+)?$/, "$1")
75 + : driver === "antigravity"
76 + ? unprefixed?.replace(/^(?:agy_acp_server_)?(\d+\.\d+\.\d+)(?:-[0-9A-Za-z.-]+)?$/, "$1")
77 : unprefixed;
78 const status =
79 stable && /^\d+\.\d+\.\d+$/.test(stable)
docs/user/providers-antigravity.md
+13 -28
@@ -18,23 +18,12 @@ Antigravity setup.
18
19 ### Sign in from a remote device
20
21 -With the native CLI, Google finishes on an Antigravity page that shows a code. Paste that
22 -code, or the page's full address, into the code field in the client where you started
23 -sign-in. This works the same from any device.
21 +Google finishes on an Antigravity page that shows a code. Paste that code, or the
22 +page's full address, into the code field in the client where you started sign-in.
23 +This works the same from any device.
24
25 -With the older 1.4.5 runtime, Google returns to a `127.0.0.1` address. It can finish directly when your browser is
26 -on the environment's machine. From another device, the final page will usually
27 -fail to load because the sign-in listener is on the environment.
28 -
29 -Copy the full return address, including everything after `?`, into the return URL
30 -field in the client where you started sign-in, then choose
31 -**Continue**. Keep the original address; do not replace it with the server's
32 -hostname. Only that T3 Code sign-in session can finish the attempt. If it expires,
33 -retry sign-in and use the new link.
34 -
35 -The return URL contains a temporary sign-in code. Paste it only into the setup
36 -field. A successful callback page alone does not confirm account access; wait for
37 -T3 Code's confirmation.
25 +The code is temporary. Paste it only into the setup field. The page alone does not
26 +confirm account access; wait for T3 Code's confirmation.
27
28 ### Other sign-in methods
29
@@ -65,9 +54,6 @@ Install [Antigravity CLI](https://antigravity.google/docs/getting-started) on th
54 Set **Binary path** to its `agy` executable and update it yourself.
55 Leave the field blank to use the managed runtime, or a compatible executable on
56 `PATH` if no managed runtime is installed.
68 -On Windows, **Binary path** can also be a `.cmd` or `.bat` script that only sets
69 -variables and then runs `agy_acp_server.exe` by its full path or a `%~dp0`-relative
70 -path; keep `localharness_external.exe` beside that executable.
57
58 ## Update the managed runtime
59
@@ -76,10 +62,12 @@ is available. T3 checks Google's CLI release channel while provider update check
62 are enabled. Installing or reinstalling also checks that channel. Updates keep
63 your profile and existing runtime available if the new release fails validation.
64
79 -Updating an older 1.4.5 installation migrates it to the native CLI. You may need to
80 -sign in again after migration. Threads already running finish with their original
81 -runtime; new sessions use the updated release. Custom binary paths keep using the
82 -executable you selected.
65 +T3 needs Antigravity 1.5 or newer and recommends 1.5.12 or newer. Sessions do not
66 +start on an older runtime: update the managed runtime here, or update the executable
67 +a custom binary path or `PATH` points at. You may need to sign in again after
68 +updating from a runtime older than 1.5. Threads already running finish with their
69 +original runtime; new sessions use the updated release. Custom binary paths keep
70 +using the executable you selected.
71
72 ## Models and threads
73
@@ -118,9 +106,8 @@ Skills for every project go in `~/.gemini/config/skills` or
106 so a skill there only appears when the project itself is your home directory.
107
108 Antigravity receives images and audio directly, and reads PDFs and text files as
121 -documents. With the managed runtime on macOS and Linux, an MP4 video up to 20 MiB
122 -is sent as video to Gemini models. Other attachments, and videos for other models, are passed as a
123 -saved file path for the agent to inspect with its tools.
109 +documents. Other attachments, including videos, are passed as a saved file path for
110 +the agent to inspect with its tools.
111
112 ### Subagents
113
@@ -158,8 +145,6 @@ is refused while the runtime is in use.
145
146 When your Antigravity runtime offers `/goal`, send `/goal` followed by a verifiable
147 objective. Antigravity keeps working until it completes the goal or you cancel it.
161 -If you still use the older 1.4.5 runtime, update Antigravity in provider settings,
162 -then refresh provider status.
148
149 Use Stop to interrupt a running goal, then ask Antigravity to stop pursuing it
150 before starting more work. Ordinary follow-ups wait until the running turn ends.
packages/provider-acp/src/server/adapter.ts
-15
@@ -378,9 +378,6 @@ export interface AcpAdapterV2Flavor {
378 readonly attachments: ReadonlyArray<ChatAttachment>;
379 readonly resolveAttachmentPath: (attachment: ChatAttachment) => string | null;
380 readonly promptCapabilities: EffectAcpSchema.AgentCapabilities["promptCapabilities"];
381 - readonly agentVersion: string | undefined;
382 - /** The session's model after selection, with its display name when the agent lists it. */
383 - readonly currentModel: { readonly id: string; readonly name: string | undefined } | undefined;
381 }) => Effect.Effect<ReadonlyArray<EffectAcpSchema.ContentBlock>, EffectAcpErrors.AcpError>;
382 readonly promptFailure?: (cause: unknown) => OrchestrationV2ProviderFailure;
383 /**
@@ -8833,24 +8830,12 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
8830 }
8831 if (!flavor.buildAttachmentPrompt) return yield* imageAttachmentBlocks(attachments);
8832 const setup = yield* Ref.get(activeSessionSetup);
8836 - const modelOption = findModelConfigOption(yield* runtime.getConfigOptions);
8837 - const currentModelId = modelOption?.currentValue;
8833 return yield* flavor
8834 .buildAttachmentPrompt({
8835 text: messageText,
8836 attachments,
8837 resolveAttachmentPath: host.resolveAttachmentPath,
8838 promptCapabilities: setup?.initializeResult.agentCapabilities?.promptCapabilities,
8844 - agentVersion: setup?.initializeResult.agentInfo?.version,
8845 - currentModel:
8846 - typeof currentModelId !== "string" || modelOption === undefined
8847 - ? undefined
8848 - : {
8849 - id: currentModelId,
8850 - name: flattenSelectChoices(modelOption.options).find(
8851 - (choice) => choice.value === currentModelId,
8852 - )?.name,
8853 - },
8839 })
8840 .pipe(
8841 Effect.mapError(