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, 18:30 UTC
feat(antigravity): support native goals and managed CLI updates (#35409)
Yash Singh committed
Nov 12, 2026 at 14:12 UTC
4099e62767f725937aea6ab2f43ba44b8e4b651e
24 files changed
+1091
-858
apps/server/src/cli/pair.test.ts
+60
-55
@@ -39,6 +39,7 @@ import {
39
DevServerNotProxiableError,
40
resolveTailscaleLocalTarget,
41
ServePortOccupiedError,
42
+ TailscaleServeTargetRefusedError,
43
} from "./pair.ts";
44
45
import packageJson from "../../package.json" with { type: "json" };
@@ -557,63 +558,67 @@ describe("t3 pair", () => {
558
// regression: #35517 - the macOS Tailscale apps refuse Serve targets other than
559
// localhost, 127.0.0.1 and ::1, so a specific bind needs an explanation.
560
it.effect("names the bind address when Tailscale refuses it as a Serve target", () =>
560
- withDescriptorServer(
561
- (origin) =>
562
- Effect.gen(function* () {
563
- const baseDir = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-pair-remote-"));
564
- yield* persistServerRuntimeState({
565
- path: NodePath.join(baseDir, "userdata", "server-runtime.json"),
566
- state: yield* makePersistedServerRuntimeState({
567
- config: { host: "127.0.0.2", devUrl: undefined },
568
- port: Number(new URL(origin).port),
569
- }),
570
- });
571
- const spawner = ChildProcessSpawner.make((command) => {
572
- const { args } = command as unknown as { readonly args: ReadonlyArray<string> };
573
- const serve = args[0] === "serve" && args[1] !== "status";
574
- return Effect.succeed(
575
- ChildProcessSpawner.makeHandle({
576
- pid: ChildProcessSpawner.ProcessId(1),
577
- exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(serve ? 1 : 0)),
578
- isRunning: Effect.succeed(false),
579
- kill: () => Effect.void,
580
- unref: Effect.succeed(Effect.void),
581
- stdin: Sink.drain,
582
- stdout: Stream.make(
583
- new TextEncoder().encode(
584
- serve
585
- ? ""
586
- : args[0] === "serve"
587
- ? "{}"
588
- : '{"Self":{"DNSName":"pair-test.tail.ts.net."}}',
589
- ),
590
- ),
591
- stderr: Stream.make(
592
- new TextEncoder().encode(
593
- serve
594
- ? "Warning: the MacOS extension doesn't support connecting to remote destinations from non-default route\n"
595
- : "",
596
- ),
597
- ),
598
- all: Stream.empty,
599
- getInputFd: () => Sink.drain,
600
- getOutputFd: () => Stream.empty,
601
- }),
602
- );
603
- });
604
-
605
- const error = yield* provideCliTestLayers(
606
- runCli(["pair", "--base-dir", baseDir, "--tailscale"]).pipe(
607
- Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
608
- Effect.provideService(HostProcess.Platform, "darwin"),
609
- Effect.flip,
561
+ Effect.gen(function* () {
562
+ const baseDir = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-pair-remote-"));
563
+ yield* persistServerRuntimeState({
564
+ path: NodePath.join(baseDir, "userdata", "server-runtime.json"),
565
+ state: yield* makePersistedServerRuntimeState({
566
+ config: { host: "127.0.0.2", devUrl: undefined },
567
+ port: 3773,
568
+ }),
569
+ });
570
+ const spawner = ChildProcessSpawner.make((command) => {
571
+ const { args } = command as unknown as { readonly args: ReadonlyArray<string> };
572
+ const serve = args[0] === "serve" && args[1] !== "status";
573
+ return Effect.succeed(
574
+ ChildProcessSpawner.makeHandle({
575
+ pid: ChildProcessSpawner.ProcessId(1),
576
+ exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(serve ? 1 : 0)),
577
+ isRunning: Effect.succeed(false),
578
+ kill: () => Effect.void,
579
+ unref: Effect.succeed(Effect.void),
580
+ stdin: Sink.drain,
581
+ stdout: Stream.make(
582
+ new TextEncoder().encode(
583
+ serve
584
+ ? ""
585
+ : args[0] === "status"
586
+ ? '{"Self":{"DNSName":"pair-test.tail.ts.net."}}'
587
+ : "{}",
588
+ ),
589
),
611
- );
590
+ stderr: Stream.make(
591
+ new TextEncoder().encode(
592
+ serve
593
+ ? "Warning: the MacOS extension doesn't support connecting to remote destinations from non-default route\n"
594
+ : "",
595
+ ),
596
+ ),
597
+ all: Stream.empty,
598
+ getInputFd: () => Sink.drain,
599
+ getOutputFd: () => Stream.empty,
600
+ }),
601
+ );
602
+ });
603
613
- assert.include(String(error), "127.0.0.2");
614
- }),
615
- "127.0.0.2",
616
- ).pipe(Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
604
+ const error = yield* provideCliTestLayers(
605
+ runCli(["pair", "--base-dir", baseDir, "--tailscale"]).pipe(
606
+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
607
+ Effect.provideService(HostProcess.Platform, "darwin"),
608
+ Effect.provideService(FetchHttpClient.Fetch, async (input) => {
609
+ if (String(input) === "http://127.0.0.2:3773/.well-known/t3/environment") {
610
+ return Response.json(testDescriptor);
611
+ }
612
+ assert.equal(String(input), "https://pair-test.tail.ts.net/.well-known/t3/environment");
613
+ return new Response(null, { status: 503 });
614
+ }),
615
+ Effect.flip,
616
+ ),
617
+ );
618
+
619
+ assert.instanceOf(error, TailscaleServeTargetRefusedError);
620
+ assert.include(String(error), "127.0.0.2");
621
+ }).pipe(Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
622
);
623
});
624
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts
+69
-38
@@ -20,8 +20,10 @@ import * as Deferred from "effect/Deferred";
20
import * as Effect from "effect/Effect";
21
import * as Exit from "effect/Exit";
22
import * as FileSystem from "effect/FileSystem";
23
+import * as Fiber from "effect/Fiber";
24
import * as Layer from "effect/Layer";
25
import * as Path from "effect/Path";
26
+import * as Ref from "effect/Ref";
27
import * as Stream from "effect/Stream";
28
import { ChildProcessSpawner } from "effect/process";
29
import type * as EffectAcpSchema from "effect-acp/compat";
@@ -146,44 +148,73 @@ const layerSession = Layer.mergeAll(
148
);
149
150
describe("AntigravityAdapterV2 compaction", () => {
149
- it.effect("does not expose unsupported manual compaction on the provider session", () =>
150
- Effect.gen(function* () {
151
- const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
152
- const path = yield* Path.Path;
153
- const crypto = yield* SecureRandom.SecureRandom;
154
- const mockAgentPath = yield* path.fromFileUrl(
155
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
156
- );
157
- const instanceId = ProviderInstanceId.make("antigravity-compaction-test");
158
- const adapter = yield* makeAntigravityAdapterV2({
159
- instanceId,
160
- selfInvocation: yield* resolveSelfInvocation(),
161
- makeRuntime: (input) =>
162
- makeAntigravityAcpRuntime({
163
- ...input,
164
- childProcessSpawner,
165
- spawn: {
166
- command: process.execPath,
167
- args: [mockAgentPath],
168
- cwd: input.cwd,
169
- env: { T3_ACP_ANTIGRAVITY: "1" },
170
- },
171
- }).pipe(Effect.provideService(SecureRandom.SecureRandom, crypto)),
172
- withProcess: (_stop, task) => task,
173
- defaultModel: Effect.undefined,
174
- });
175
- const session = yield* adapter.openSession({
176
- threadId: ThreadId.make("thread-antigravity-compaction"),
177
- providerSessionId: ProviderSessionId.make("provider-session-antigravity-compaction"),
178
- modelSelection: { instanceId, model: "gemini-test-low" },
179
- runtimePolicy: ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
180
- runtimeMode: "full-access",
181
- interactionMode: "default",
182
- cwd: process.cwd(),
183
- }),
184
- });
185
- assert.isUndefined(session.compactThread);
186
- }).pipe(Effect.provide(layerSession), Effect.scoped),
151
+ it.live.each([false, true])(
152
+ "negotiates native goals (%s) without enabling manual compaction",
153
+ (nativeGoals) =>
154
+ Effect.gen(function* () {
155
+ const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
156
+ const path = yield* Path.Path;
157
+ const crypto = yield* SecureRandom.SecureRandom;
158
+ const mockAgentPath = yield* path.fromFileUrl(
159
+ new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
160
+ );
161
+ const instanceId = ProviderInstanceId.make("antigravity-compaction-test");
162
+ const goalSupport = yield* Ref.make(false);
163
+ const startupMilestone = yield* Deferred.make<void>();
164
+ const consumeStartupCommands = yield* Deferred.make<void>();
165
+ const adapter = yield* makeAntigravityAdapterV2({
166
+ instanceId,
167
+ selfInvocation: yield* resolveSelfInvocation(),
168
+ makeRuntime: (input) =>
169
+ makeAntigravityAcpRuntime({
170
+ ...input,
171
+ childProcessSpawner,
172
+ spawn: {
173
+ command: process.execPath,
174
+ args: [mockAgentPath],
175
+ cwd: input.cwd,
176
+ env: { T3_ACP_ANTIGRAVITY: "1" },
177
+ },
178
+ }).pipe(
179
+ Effect.provideService(SecureRandom.SecureRandom, crypto),
180
+ Effect.map((runtime) => ({
181
+ ...runtime,
182
+ drainEvents: Deferred.succeed(startupMilestone, undefined).pipe(
183
+ Effect.andThen(runtime.drainEvents),
184
+ ),
185
+ })),
186
+ ),
187
+ withProcess: (_stop, task) => task,
188
+ defaultModel: Effect.undefined,
189
+ supportsNativeGoals: Ref.get(goalSupport).pipe(
190
+ Effect.tap(() => Deferred.succeed(startupMilestone, undefined)),
191
+ ),
192
+ onSessionEvent: (event) =>
193
+ event._tag === "AvailableCommandsUpdated"
194
+ ? Deferred.await(consumeStartupCommands).pipe(
195
+ Effect.andThen(Ref.set(goalSupport, nativeGoals)),
196
+ )
197
+ : Effect.void,
198
+ });
199
+ const opening = yield* adapter
200
+ .openSession({
201
+ threadId: ThreadId.make("thread-antigravity-compaction"),
202
+ providerSessionId: ProviderSessionId.make("provider-session-antigravity-compaction"),
203
+ modelSelection: { instanceId, model: "gemini-test-low" },
204
+ runtimePolicy: ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
205
+ runtimeMode: "full-access",
206
+ interactionMode: "default",
207
+ cwd: process.cwd(),
208
+ }),
209
+ })
210
+ .pipe(Effect.forkScoped);
211
+ yield* Deferred.await(startupMilestone);
212
+ yield* Deferred.succeed(consumeStartupCommands, undefined);
213
+ const session = yield* Fiber.join(opening);
214
+ assert.isUndefined(session.compactThread);
215
+ assert.equal(session.providerSession.capabilities.turns.supportsNativeGoals, nativeGoals);
216
+ assert.equal((yield* adapter.getCapabilities()).turns.supportsNativeGoals, nativeGoals);
217
+ }).pipe(Effect.provide(layerSession), Effect.scoped),
218
);
219
});
220
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts
+2
@@ -82,6 +82,7 @@ export interface AntigravityAdapterV2Options {
82
>;
83
readonly withProcess: AntigravityAuth["withProcess"];
84
readonly defaultModel: Effect.Effect<string | undefined>;
85
+ readonly supportsNativeGoals?: Effect.Effect<boolean>;
86
readonly onSessionStarted?: (
87
started: AcpSessionRuntime.AcpSessionRuntimeStartResult,
88
cwd: string,
@@ -208,6 +209,7 @@ export function makeAntigravityAcpAdapterFlavor(
209
driver: ANTIGRAVITY_PROVIDER,
210
runtimeHarness: "Antigravity",
211
capabilities: AntigravityProviderCapabilitiesV2,
212
+ supportsNativeGoals: options.supportsNativeGoals ?? Effect.succeed(false),
213
// Agents that advertise HTTP MCP skip the stdio bridge process; others keep stdio.
214
mcpOverHttp: true,
215
sessionCarriesPullRequestLinking: antigravityAppendsSystemPrompt,
apps/server/src/orchestration-v2/Orchestrator.ts
+14
-4
@@ -1400,14 +1400,14 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
1400
) {
1401
const adapter = yield* providerAdapters.get(providerInstanceId).pipe(mapDispatchError(command));
1402
const { driver } = adapter;
1403
- if (driver === "opencode") {
1403
+ if (driver === "opencode" || driver === "antigravity") {
1404
const capabilities = yield* adapter.getCapabilities().pipe(mapDispatchError(command));
1405
return capabilities.turns.supportsNativeGoals === true ? driver : undefined;
1406
}
1407
return driver === "codex" || driver === "claudeAgent" ? driver : undefined;
1408
});
1409
1410
- /** Claude Code reads `/goal pause` and `/goal resume` as new goals named "pause" and "resume". */
1410
+ /** Unsupported goal controls can become new objectives in native providers. */
1411
const ensureGoalCommandSupported = Effect.fn("Orchestrator.ensureGoalCommandSupported")(
1412
function* (
1413
command: OrchestrationV2ServerCommand,
@@ -1415,8 +1415,18 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
1415
providerInstanceId: ProviderInstanceId,
1416
) {
1417
const goalCommand = parseGoalCommand(message);
1418
- if (goalCommand?.type !== "pause" && goalCommand?.type !== "resume") return;
1419
- if ((yield* goalDriverFor(command, providerInstanceId)) !== "claudeAgent") return;
1418
+ if (goalCommand === null || goalCommand.type === "set") return;
1419
+ const driver = yield* goalDriverFor(command, providerInstanceId);
1420
+ if (driver === "antigravity") {
1421
+ return yield* new OrchestratorDispatchError({
1422
+ commandId: command.commandId,
1423
+ commandType: command.type,
1424
+ cause:
1425
+ "Antigravity accepts /goal followed by an objective. Interrupt the running turn, then ask Antigravity to stop the current goal.",
1426
+ });
1427
+ }
1428
+ if (goalCommand.type !== "pause" && goalCommand.type !== "resume") return;
1429
+ if (driver !== "claudeAgent") return;
1430
return yield* new OrchestratorDispatchError({
1431
commandId: command.commandId,
1432
commandType: command.type,
apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts
+13
-4
@@ -272,6 +272,7 @@ it.each([
272
function makeLocalCommandHarness(input: {
273
readonly text: string;
274
readonly nativeGoals?: boolean;
275
+ readonly goalDriver?: "opencode" | "antigravity";
276
readonly worktreePath?: string;
277
readonly worktreesDir?: string;
278
readonly workspaceRoot?: string;
@@ -341,7 +342,9 @@ function makeLocalCommandHarness(input: {
342
};
343
const providerThread: OrchestrationV2ThreadProjection["providerThreads"][number] = {
344
id: providerThreadId,
344
- driver: ProviderDriverKind.make(input.nativeGoals === undefined ? "codex" : "opencode"),
345
+ driver: ProviderDriverKind.make(
346
+ input.nativeGoals === undefined ? "codex" : (input.goalDriver ?? "opencode"),
347
+ ),
348
providerInstanceId: newInstanceId,
349
providerSessionId,
350
appThreadId: threadId,
@@ -1366,12 +1369,18 @@ effectIt.effect.each([
1369
}),
1370
);
1371
1369
-effectIt.effect.each([false, true])(
1370
- "OpenCode goal prompts defer switched-provider history only with native support: %s",
1371
- (nativeGoals) =>
1372
+effectIt.effect.each([
1373
+ { goalDriver: "opencode", nativeGoals: false },
1374
+ { goalDriver: "opencode", nativeGoals: true },
1375
+ { goalDriver: "antigravity", nativeGoals: false },
1376
+ { goalDriver: "antigravity", nativeGoals: true },
1377
+] as const)(
1378
+ "$goalDriver goal prompts defer switched-provider history only with native support: $nativeGoals",
1379
+ ({ goalDriver, nativeGoals }) =>
1380
Effect.gen(function* () {
1381
const harness = makeLocalCommandHarness({
1382
text: "/goal all tests pass",
1383
+ goalDriver,
1384
nativeGoals,
1385
sideChat: { contextRun: "failed", switchedProvider: true },
1386
});
apps/server/src/orchestration-v2/ProviderTurnStartService.ts
+1
-2
@@ -873,8 +873,7 @@ export const layer: Layer.Layer<
873
const goalDriver =
874
session.driver === "codex" ||
875
session.driver === "claudeAgent" ||
876
- (session.driver === "opencode" &&
877
- session.providerSession.capabilities.turns.supportsNativeGoals === true);
876
+ session.providerSession.capabilities.turns.supportsNativeGoals === true;
877
const goalCommand = goalDriver && parseGoalCommand(message) !== null;
878
// The provider turn marks cancellation work delivered; restart continuations use their own text or resume natively.
879
const noteContinuation = isRestartNoteContinuation(
apps/server/src/orchestration-v2/runtimeLayer.test.ts
+70
-3
@@ -182,19 +182,43 @@ const claudeProviderInstance = {
182
},
183
} satisfies ProviderInstance;
184
185
+const antigravityInstanceId = ProviderInstanceId.make("antigravity_test");
186
+const antigravityDriver = ProviderDriverKind.make("antigravity");
187
+const antigravityProviderInstance = {
188
+ ...providerInstance,
189
+ instanceId: antigravityInstanceId,
190
+ driverKind: antigravityDriver,
191
+ continuationIdentity: { driverKind: antigravityDriver, continuationKey: "antigravity:test" },
192
+ displayName: "Antigravity test",
193
+ orchestrationAdapter: {
194
+ ...orchestrationAdapter,
195
+ instanceId: antigravityInstanceId,
196
+ driver: antigravityDriver,
197
+ getCapabilities: () =>
198
+ Effect.succeed({
199
+ ...CodexProviderCapabilitiesV2,
200
+ turns: { ...CodexProviderCapabilitiesV2.turns, supportsNativeGoals: true },
201
+ }),
202
+ },
203
+} satisfies ProviderInstance;
204
+
205
const layerTestProviderInstanceRegistry = Layer.succeed(
206
ProviderInstanceRegistry.ProviderInstanceRegistry,
207
{
208
getInstance: (instanceId) =>
209
Effect.succeed(
190
- [providerInstance, alternateProviderInstance, claudeProviderInstance].find(
191
- (instance) => instanceId === instance.instanceId,
192
- ),
210
+ [
211
+ providerInstance,
212
+ alternateProviderInstance,
213
+ claudeProviderInstance,
214
+ antigravityProviderInstance,
215
+ ].find((instance) => instanceId === instance.instanceId),
216
),
217
listInstances: Effect.succeed([
218
providerInstance,
219
alternateProviderInstance,
220
claudeProviderInstance,
221
+ antigravityProviderInstance,
222
]),
223
listUnavailable: Effect.succeed([]),
224
streamChanges: Stream.empty,
@@ -7963,6 +7987,49 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
7987
}),
7988
);
7989
7990
+ it.effect.each(["", "pause", "resume", "clear", "edit"])(
7991
+ "refuses unsupported Antigravity goal controls: %s",
7992
+ (control) =>
7993
+ Effect.gen(function* () {
7994
+ const orchestrator = yield* Orchestrator.OrchestratorV2;
7995
+ const threadId = ThreadId.make(`antigravity-goal-control-${control}`);
7996
+ yield* orchestrator.dispatch({
7997
+ type: "thread.create",
7998
+ commandId: CommandId.make(`${threadId}:create`),
7999
+ threadId,
8000
+ projectId: ProjectId.make(`${threadId}:project`),
8001
+ createdBy: "user",
8002
+ creationSource: "web",
8003
+ title: "Native goal",
8004
+ modelSelection: { ...modelSelection, instanceId: antigravityInstanceId },
8005
+ runtimeMode: "full-access",
8006
+ interactionMode: "default",
8007
+ branch: null,
8008
+ worktreePath: process.cwd(),
8009
+ });
8010
+ const sequence = yield* orchestrator.getThreadEventSequence(threadId);
8011
+ const refused = yield* Effect.flip(
8012
+ orchestrator.dispatch({
8013
+ type: "message.dispatch",
8014
+ commandId: CommandId.make(`${threadId}:goal`),
8015
+ threadId,
8016
+ messageId: MessageId.make(`${threadId}:goal`),
8017
+ text: `/goal ${control}`,
8018
+ attachments: [],
8019
+ dispatchMode: { type: "start_immediately" },
8020
+ createdBy: "user",
8021
+ creationSource: "web",
8022
+ }),
8023
+ );
8024
+ assert.instanceOf(refused, Orchestrator.OrchestratorDispatchError);
8025
+ assert.equal(
8026
+ refused.cause,
8027
+ "Antigravity accepts /goal followed by an objective. Interrupt the running turn, then ask Antigravity to stop the current goal.",
8028
+ );
8029
+ assert.equal(yield* orchestrator.getThreadEventSequence(threadId), sequence);
8030
+ }),
8031
+ );
8032
+
8033
it.effect("checks a queued goal pause against the model picked ahead of it", () =>
8034
Effect.gen(function* () {
8035
const orchestrator = yield* Orchestrator.OrchestratorV2;
apps/server/src/provider/AntigravityInstallation.test.ts
+296
-225
@@ -17,16 +17,13 @@ import * as Schema from "effect/Schema";
17
import * as Scope from "effect/Scope";
18
import * as Sink from "effect/Sink";
19
import * as Stream from "effect/Stream";
20
-import * as TestClock from "effect/testing/TestClock";
20
import { HttpClient, HttpClientError, HttpClientResponse } from "effect/http";
21
import * as ChildProcess from "effect/process/ChildProcess";
22
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
23
25
-import { ACP_REGISTRY_URL } from "@t3tools/provider-acp-registry/server/AcpRegistrySupport";
26
-
24
import * as AntigravityInstallation from "./AntigravityInstallation.ts";
28
-import { type AntigravityReleaseAsset } from "./antigravityRelease.ts";
25
import * as ModelManifest from "./ModelManifest.ts";
26
+import { type AntigravityReleaseAsset } from "./antigravityRelease.ts";
27
28
const serverContents = "antigravity runtime\n";
29
const harnessContents = "local harness\n";
@@ -130,12 +127,13 @@ interface HarnessOptions {
127
readonly spawner?: ChildProcessSpawner.ChildProcessSpawner["Service"];
128
readonly validate?: AntigravityInstallation.AntigravityInstallationOptions["validate"];
129
readonly useDefaultValidation?: boolean;
133
- /** Served for the ACP Registry index. */
134
- readonly registry?: unknown;
135
- /** Served by URL instead of the pinned archive. */
136
- readonly archives?: Readonly<Record<string, Uint8Array>>;
137
- readonly manifest?: Effect.Effect<ModelManifest.ModelManifestData>;
130
readonly connectTimeout?: boolean;
131
+ readonly manifest?: Effect.Effect<ModelManifest.ModelManifestData>;
132
+ readonly native?: boolean;
133
+ readonly nativeVersion?: string;
134
+ readonly nativeManifest?: (manifest: { version: string; url: string; sha512: string }) => unknown;
135
+ readonly beforeManifest?: Effect.Effect<void>;
136
+ readonly updateChecksEnabled?: Effect.Effect<boolean>;
137
}
138
139
const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
@@ -143,6 +141,7 @@ const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
141
) {
142
const fs = yield* FileSystem.FileSystem;
143
const path = yield* Path.Path;
144
+ const digest = yield* Digest.Digest;
145
const baseDir =
146
options.baseDir ?? (yield* fs.makeTempDirectoryScoped({ prefix: "t3-agy-test-" }));
147
const platform = options.platform ?? hostPlatform;
@@ -178,7 +177,10 @@ const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
177
});
178
const installation = yield* AntigravityInstallation.makeAntigravityInstallation({
179
baseDir,
181
- releaseAsset: asset,
180
+ ...(options.native ? {} : { releaseAsset: asset }),
181
+ ...(options.updateChecksEnabled === undefined
182
+ ? {}
183
+ : { updateChecksEnabled: options.updateChecksEnabled }),
184
...(options.useDefaultValidation
185
? {}
186
: {
@@ -207,19 +209,22 @@ const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
209
HttpClient.make((request) =>
210
Effect.suspend(() => {
211
requests.push(request.url);
210
- if (request.url === ACP_REGISTRY_URL) {
211
- return Effect.succeed(
212
- HttpClientResponse.fromWeb(
212
+ if (request.url.includes("/manifests/")) {
213
+ return Effect.gen(function* () {
214
+ yield* options.beforeManifest ?? Effect.void;
215
+ const version = options.nativeVersion ?? "1.5.7";
216
+ const folder = platform === "win32" ? "windows-x64" : "linux-x64";
217
+ const manifest = {
218
+ version,
219
+ url: `https://storage.googleapis.com/antigravity-public/antigravity-cli/${version}-123/${folder}/cli_${platform === "win32" ? "windows_x64.exe" : "linux_x64.tar.gz"}`,
220
+ sha512: Hex.encode(yield* digest.digest(Digest.sha512, archive).pipe(Effect.orDie)),
221
+ };
222
+ return HttpClientResponse.fromWeb(
223
request,
214
- options.registry === undefined
215
- ? new Response(null, { status: 503 })
216
- : Response.json(options.registry),
217
- ),
218
- );
224
+ new Response(JSON.stringify(options.nativeManifest?.(manifest) ?? manifest)),
225
+ );
226
+ });
227
}
220
- const served = options.archives?.[request.url];
221
- if (served)
222
- return Effect.succeed(HttpClientResponse.fromWeb(request, new Response(served)));
228
if (options.connectTimeout) {
229
return Effect.fail(
230
new HttpClientError.HttpClientError({
@@ -283,44 +288,257 @@ const expectPreviousRelease = Effect.fn("test.expectPreviousAntigravityRelease")
288
expect((yield* installation.state).installedVersion).toBe(previousVersion);
289
});
290
286
-// A zip comment changes the archive's hash without changing its members.
287
-const withZipComment = (archive: Buffer, comment: string) => {
288
- const bytes = Buffer.concat([archive, Buffer.from(comment)]);
289
- bytes.writeUInt16LE(Buffer.byteLength(comment), archive.byteLength - 2);
290
- return bytes;
291
-};
292
-const upstreamArchive = withZipComment(completeArchive, "upstream");
293
-const upstreamUrl = "https://dl.google.com/agy-extensions/releases/test/agy-acp-server-1.4.1.zip";
294
-const registryListing = (archive = upstreamUrl) => ({
295
- version: "1.0.0",
296
- agents: [
297
- { id: "other-agent", version: "9.9.9", distribution: { npx: { package: "other" } } },
291
+it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity installation", (it) => {
292
+ it.effect.each([...new Set(["win32", hostPlatform])] as NodeJS.Platform[])(
293
+ "migrates the legacy managed runtime to the native CLI on %s and retains the old release",
294
+ (platform) =>
295
+ Effect.gen(function* () {
296
+ const archive =
297
+ platform === "win32"
298
+ ? Buffer.from(serverContents)
299
+ : Buffer.from(
300
+ "H4sIAAAAAAACE+3RMQ7CQAwEQNe8Ik8wgYj3XIFQCiiOCxK/56CJRA9CYqZZrxsXLpc2n2q5ze0en5LdYZpe2b1n5rhf5+d+m+MuY8j4guXaSu3n4z+V9f9DXXo5HzcBAAAAAAAAAADAz3sA56lbdQAoAAA=",
301
+ "base64",
302
+ );
303
+ const { installation, validations, requests, fs, baseDir, stagingReleased } =
304
+ yield* makeHarness({ native: true, archive, platform, previous: true });
305
+ yield* installation.start;
306
+ expect(yield* terminalState(installation)).toMatchObject({
307
+ phase: "succeeded",
308
+ installedVersion: "1.5.7",
309
+ });
310
+ yield* Deferred.await(stagingReleased);
311
+ const resolved = yield* installation.resolve();
312
+ expect(resolved).toMatchObject({ source: "managed", version: "1.5.7", harnessPath: null });
313
+ expect(validations[0]?.executable.harnessPath).toBeNull();
314
+ expect(yield* fs.readFileString(resolved.executablePath)).toBe(serverContents);
315
+ expect(requests.some((url) => url.includes("/manifests/"))).toBe(true);
316
+ const restarted = yield* makeHarness({
317
+ baseDir,
318
+ native: true,
319
+ archive,
320
+ platform,
321
+ nativeVersion: "1.5.6",
322
+ });
323
+ expect(yield* restarted.installation.start).toMatchObject({
324
+ phase: "verifying",
325
+ message: "Checking the installed runtime.",
326
+ });
327
+ expect(yield* terminalState(restarted.installation)).toMatchObject({
328
+ phase: "succeeded",
329
+ installedVersion: "1.5.7",
330
+ });
331
+ expect(restarted.requests.filter((url) => url.includes("storage.googleapis.com"))).toEqual(
332
+ [],
333
+ );
334
+ expect((yield* restarted.installation.resolve()).executablePath).toBe(
335
+ resolved.executablePath,
336
+ );
337
+ }),
338
+ );
339
+
340
+ // These tar fixtures exercise the POSIX extraction path; Windows downloads one executable.
341
+ it.effect.skipIf(hostPlatform === "win32")(
342
+ "rejects unsafe native tar members before activation",
343
+ () =>
344
+ Effect.gen(function* () {
345
+ for (const archive of [
346
+ "H4sIAAAAAAACE+3OMQqDQBAFUI/iCYxZJPdZMIRtFHQN5PYOKbW2EN5j4P9iYCZPtXyW/C3111ylD69h+Gc45rk/U4r1NnXdI2be6lrG90XPbWvNS5xvAAAAAAAAAAAA4D523kNDtgAoAAA=",
347
+ "H4sIAAAAAAACE+3RMQ7CMBAEQNe8Ii8IBhzxHhcIpYDCcSLxewwNiJ4IiZlmb6+54vp+m691PJe8jPUWviI2x2F4ZvOZMe7Ta37sdzGlQ+hiWME81Vza+fCf3p7flbmVy2kTAAAAAAAAAAAA+Hl3jhn2/wAoAAA=",
348
+ "H4sIAAAAAAACE+3TPQrCQBAG0K09RY4wRoPn2UJCClOsG8Hbu6YJ2CtI3mvmp5li+PJcp7Hkx1Sf6VuiuQzDWpvPGtGft/69P0Z/itRF+oHlXnNp59M+5e3/XVnacLseEnv8v/zLv/wDAAAAAAAAAPyZF/c+VksAKAAA",
349
+ ]) {
350
+ const { installation, validations } = yield* makeHarness({
351
+ native: true,
352
+ archive: Buffer.from(archive, "base64"),
353
+ platform: "linux",
354
+ previous: true,
355
+ });
356
+ yield* installation.start;
357
+ expect((yield* terminalState(installation)).phase).toBe("failed");
358
+ expect(validations).toEqual([]);
359
+ yield* expectPreviousRelease(installation);
360
+ }
361
+ }),
362
+ );
363
+
364
+ it.effect.each([true, false])(
365
+ "respects background update checks (%s) while allowing explicit installation",
366
+ (enabled) =>
367
+ Effect.gen(function* () {
368
+ const { installation, requests } = yield* makeHarness({
369
+ native: true,
370
+ archive: Buffer.from(serverContents),
371
+ platform: "win32",
372
+ updateChecksEnabled: Effect.succeed(enabled),
373
+ });
374
+ yield* installation.checkForUpdate;
375
+ if (enabled) {
376
+ yield* installation.changes.pipe(
377
+ Stream.filter((value) => value.version === "1.5.7"),
378
+ Stream.runHead,
379
+ );
380
+ yield* installation.state;
381
+ expect(requests).toHaveLength(1);
382
+ } else {
383
+ yield* installation.changes.pipe(Stream.runHead);
384
+ expect(requests).toEqual([]);
385
+ }
386
+ yield* installation.start;
387
+ expect((yield* terminalState(installation)).phase).toBe("succeeded");
388
+ }),
389
+ );
390
+
391
+ it.effect("keeps withdrawn native releases from activating or launching", () =>
392
+ Effect.gen(function* () {
393
+ let withdrawn = false;
394
+ const manifest = Effect.sync(() =>
395
+ withdrawn
396
+ ? ({
397
+ ...ModelManifest.BUNDLED_MODEL_MANIFEST,
398
+ compatibility: [
399
+ {
400
+ driver: "antigravity",
401
+ t3CodeRange: ">=0.0.42",
402
+ ranges: [{ range: ">=1.5.7", status: "broken" }],
403
+ },
404
+ ],
405
+ } satisfies ModelManifest.ModelManifestData)
406
+ : ModelManifest.BUNDLED_MODEL_MANIFEST,
407
+ );
408
+ const first = yield* makeHarness({
409
+ native: true,
410
+ archive: Buffer.from(serverContents),
411
+ platform: "win32",
412
+ previous: true,
413
+ manifest,
414
+ validate: () =>
415
+ Effect.sync(() => {
416
+ withdrawn = true;
417
+ }),
418
+ });
419
+ yield* first.installation.start;
420
+ expect((yield* terminalState(first.installation)).phase).toBe("failed");
421
+ yield* expectPreviousRelease(first.installation);
422
+ withdrawn = false;
423
+ const retry = yield* makeHarness({
424
+ baseDir: first.baseDir,
425
+ native: true,
426
+ archive: Buffer.from(serverContents),
427
+ platform: "win32",
428
+ manifest,
429
+ });
430
+ yield* retry.installation.start;
431
+ expect((yield* terminalState(retry.installation)).phase).toBe("succeeded");
432
+ withdrawn = true;
433
+ expect(yield* retry.installation.resolve().pipe(Effect.flip)).toMatchObject({
434
+ operation: "resolve",
435
+ });
436
+ expect(yield* retry.installation.start.pipe(Effect.flip)).toMatchObject({
437
+ operation: "start",
438
+ });
439
+ const recovery = yield* makeHarness({
440
+ baseDir: first.baseDir,
441
+ native: true,
442
+ nativeVersion: "1.5.6",
443
+ archive: Buffer.from("recovery runtime"),
444
+ platform: "win32",
445
+ manifest,
446
+ });
447
+ yield* recovery.installation.checkForUpdate;
448
+ expect(yield* recovery.installation.state).toMatchObject({
449
+ installedVersion: "1.5.7",
450
+ version: "1.5.6",
451
+ });
452
+ yield* recovery.installation.start;
453
+ expect(yield* terminalState(recovery.installation)).toMatchObject({
454
+ phase: "succeeded",
455
+ installedVersion: "1.5.6",
456
+ });
457
+ }),
458
+ );
459
+
460
+ it.effect("discovers subsequent native releases from Google's CLI channel", () =>
461
+ Effect.gen(function* () {
462
+ const first = yield* makeHarness({
463
+ native: true,
464
+ archive: Buffer.from(serverContents),
465
+ platform: "win32",
466
+ });
467
+ yield* first.installation.start;
468
+ expect((yield* terminalState(first.installation)).phase).toBe("succeeded");
469
+ const initialPath = (yield* first.installation.resolve()).executablePath;
470
+ const next = yield* makeHarness({
471
+ baseDir: first.baseDir,
472
+ native: true,
473
+ nativeVersion: "1.5.8",
474
+ archive: Buffer.from("next runtime"),
475
+ platform: "win32",
476
+ });
477
+ yield* next.installation.start;
478
+ expect(yield* terminalState(next.installation)).toMatchObject({
479
+ phase: "succeeded",
480
+ installedVersion: "1.5.8",
481
+ });
482
+ const nextPath = (yield* next.installation.resolve()).executablePath;
483
+ expect(nextPath).not.toBe(initialPath);
484
+ const republished = yield* makeHarness({
485
+ baseDir: first.baseDir,
486
+ native: true,
487
+ nativeVersion: "1.5.8",
488
+ archive: Buffer.from("republished runtime"),
489
+ platform: "win32",
490
+ });
491
+ yield* republished.installation.start;
492
+ expect((yield* terminalState(republished.installation)).phase).toBe("succeeded");
493
+ expect((yield* republished.installation.resolve()).executablePath).not.toBe(nextPath);
494
+ const offline = yield* makeHarness({
495
+ baseDir: first.baseDir,
496
+ native: true,
497
+ nativeManifest: () => ({}),
498
+ archive: Buffer.from("unused"),
499
+ platform: "win32",
500
+ });
501
+ yield* offline.installation.start;
502
+ expect(yield* terminalState(offline.installation)).toMatchObject({
503
+ phase: "succeeded",
504
+ installedVersion: "1.5.8",
505
+ });
506
+ expect(offline.requests.filter((url) => url.includes("storage.googleapis.com"))).toEqual([]);
507
+ }),
508
+ );
509
+
510
+ it.effect.each([
511
{
299
- id: "antigravity-acp",
300
- version: "1.4.1",
301
- distribution: {
302
- binary: Object.fromEntries(
303
- ["linux-x86_64", "windows-x86_64"].map((target) => [target, { archive, cmd: "./agy" }]),
304
- ),
305
- },
512
+ name: "invalid checksum",
513
+ change: (manifest: { version: string; url: string; sha512: string }) => ({
514
+ ...manifest,
515
+ sha512: "0".repeat(128),
516
+ }),
517
},
307
- ],
308
-});
309
-const withdrawnManifest: ModelManifest.ModelManifestData = {
310
- ...ModelManifest.BUNDLED_MODEL_MANIFEST,
311
- compatibility: [
518
{
313
- driver: "antigravity",
314
- t3CodeRange: ">=0.0.42",
315
- ranges: [{ range: ">=1.4.0", status: "broken" }],
519
+ name: "foreign download",
520
+ change: (manifest: { version: string; url: string; sha512: string }) => ({
521
+ ...manifest,
522
+ url: "https://example.com/agy.exe",
523
+ }),
524
},
317
- ],
318
-};
319
-const pinnedAsset = Effect.fn("test.pinnedAntigravityAsset")(function* () {
320
- return { ...(yield* releaseAsset()), version: "1.3.0" };
321
-});
525
+ ])("rejects a native $name and preserves the legacy release", ({ change }) =>
526
+ Effect.gen(function* () {
527
+ const { installation, validations } = yield* makeHarness({
528
+ native: true,
529
+ nativeManifest: change,
530
+ archive: Buffer.from(serverContents),
531
+ platform: "win32",
532
+ previous: true,
533
+ });
534
+ const result = yield* Effect.result(installation.start);
535
+ if (result._tag === "Success")
536
+ expect((yield* terminalState(installation)).phase).toBe("failed");
537
+ expect(validations).toEqual([]);
538
+ yield* expectPreviousRelease(installation);
539
+ }),
540
+ );
541
323
-it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity installation", (it) => {
542
it.effect("reports missing Node before downloading the standalone provider runtime", () =>
543
Effect.gen(function* () {
544
const { installation, requests, validations } = yield* makeHarness();
@@ -830,14 +1048,15 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1048
});
1049
1050
const { installation: windows } = yield* makeHarness({ baseDir, platform: "win32" });
833
- for (const name of ["agy.EXE", "agy.CMD"]) {
1051
+ for (const name of ["agy.EXE", "agy.cmd"]) {
1052
const windowsDirectory = path.join(baseDir, `windows-${name}`);
1053
yield* fs.makeDirectory(windowsDirectory);
1054
yield* fs.writeFileString(path.join(windowsDirectory, name), "cli");
837
- expect(yield* windows.resolve("agy", { PATH: windowsDirectory })).toMatchObject({
838
- executablePath: path.join(windowsDirectory, name),
839
- harnessPath: null,
840
- });
1055
+ const selected = yield* windows.resolve("agy", { PATH: windowsDirectory });
1056
+ expect(selected.harnessPath).toBeNull();
1057
+ expect((yield* fs.realPath(selected.executablePath)).toLowerCase()).toBe(
1058
+ (yield* fs.realPath(path.join(windowsDirectory, name))).toLowerCase(),
1059
+ );
1060
}
1061
}),
1062
);
@@ -930,14 +1149,29 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1149
1150
it.effect("keeps leased releases available while new sessions resolve the new release", () =>
1151
Effect.gen(function* () {
933
- const { installation, fs, stagingReleased } = yield* makeHarness({ previous: true });
1152
+ const manifestEntered = yield* Deferred.make<void>();
1153
+ const releaseManifest = yield* Deferred.make<void>();
1154
+ const { installation, fs, stagingReleased } = yield* makeHarness({
1155
+ native: true,
1156
+ platform: "win32",
1157
+ archive: Buffer.from(serverContents),
1158
+ previous: true,
1159
+ beforeManifest: Deferred.succeed(manifestEntered, undefined).pipe(
1160
+ Effect.andThen(Deferred.await(releaseManifest)),
1161
+ ),
1162
+ });
1163
const processScope = yield* Scope.make();
1164
const oldExecutable = yield* installation.acquire().pipe(Scope.provide(processScope));
936
- yield* installation.start;
1165
+ const starting = yield* installation.start.pipe(Effect.forkScoped);
1166
+ yield* Deferred.await(manifestEntered);
1167
+ const concurrent = yield* installation.acquire().pipe(Scope.provide(processScope));
1168
+ expect(concurrent.executablePath).toBe(oldExecutable.executablePath);
1169
+ yield* Deferred.succeed(releaseManifest, undefined);
1170
+ yield* Fiber.join(starting);
1171
expect((yield* terminalState(installation)).phase).toBe("succeeded");
1172
yield* Deferred.await(stagingReleased);
1173
const current = yield* installation.resolve();
940
- expect(current.version).toBe("fixture-new");
1174
+ expect(current.version).toBe("1.5.7");
1175
expect(current.executablePath).not.toBe(oldExecutable.executablePath);
1176
expect(yield* fs.readFileString(oldExecutable.executablePath)).toBe(serverContents);
1177
expect(yield* installation.remove().pipe(Effect.flip)).toMatchObject({ operation: "remove" });
@@ -1084,167 +1318,4 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
1318
expect(requests).toEqual([]);
1319
}),
1320
);
1087
-
1088
- it.effect("updates past the pinned release to the registry release and never downgrades", () =>
1089
- Effect.gen(function* () {
1090
- const asset = yield* pinnedAsset();
1091
- const h = yield* makeHarness({
1092
- asset,
1093
- registry: registryListing(),
1094
- archives: { [upstreamUrl]: upstreamArchive },
1095
- });
1096
- yield* h.installation.checkForUpdate;
1097
- // A fresh install still gets the pinned release.
1098
- expect(yield* h.installation.state).toMatchObject({ version: "1.3.0" });
1099
- yield* h.installation.start;
1100
- expect(yield* terminalState(h.installation)).toMatchObject({
1101
- phase: "succeeded",
1102
- installedVersion: "1.3.0",
1103
- version: "1.4.1",
1104
- totalBytes: null,
1105
- });
1106
-
1107
- yield* h.installation.start;
1108
- expect(yield* terminalState(h.installation)).toMatchObject({
1109
- phase: "succeeded",
1110
- installedVersion: "1.4.1",
1111
- version: "1.4.1",
1112
- });
1113
- expect(h.validations.at(-1)?.version).toBe("1.4.1");
1114
- expect(h.requests).toEqual([ACP_REGISTRY_URL, asset.url, upstreamUrl]);
1115
- const selected = yield* h.installation.resolve();
1116
- expect(selected.version).toBe("1.4.1");
1117
- expect(yield* h.fs.readFileString(selected.executablePath)).toBe(serverContents);
1118
-
1119
- // Without registry information the older pin is not offered as a reinstall.
1120
- const restarted = yield* makeHarness({ baseDir: h.baseDir, asset });
1121
- expect(yield* restarted.installation.state).toMatchObject({
1122
- installedVersion: "1.4.1",
1123
- version: "1.4.1",
1124
- });
1125
- yield* restarted.installation.start;
1126
- expect(yield* terminalState(restarted.installation)).toMatchObject({
1127
- phase: "succeeded",
1128
- installedVersion: "1.4.1",
1129
- });
1130
- expect(restarted.requests).toEqual([]);
1131
- expect(restarted.validations.map((entry) => entry.version)).toEqual(["1.4.1"]);
1132
- }),
1133
- );
1134
-
1135
- it.effect.each([
1136
- {
1137
- name: "hosted outside Google's downloads",
1138
- registry: registryListing("https://example.com/agy.zip"),
1139
- },
1140
- {
1141
- name: "from an oversized registry index",
1142
- registry: { ...registryListing(), padding: "x".repeat(1024 * 1024) },
1143
- },
1144
- {
1145
- name: "escaping Google's releases path",
1146
- registry: registryListing(
1147
- "https://dl.google.com/agy-extensions/releases/%2e%2e/%2e%2e/other.zip",
1148
- ),
1149
- },
1150
- {
1151
- name: "withdrawn by the model manifest",
1152
- registry: registryListing(),
1153
- manifest: Effect.succeed(withdrawnManifest),
1154
- },
1155
- ])("does not offer a registry release $name", ({ registry, manifest }) =>
1156
- Effect.gen(function* () {
1157
- const h = yield* makeHarness({
1158
- asset: yield* pinnedAsset(),
1159
- registry,
1160
- ...(manifest ? { manifest } : {}),
1161
- });
1162
- yield* h.installation.start;
1163
- yield* terminalState(h.installation);
1164
- yield* h.installation.checkForUpdate;
1165
- expect(yield* h.installation.state).toMatchObject({
1166
- installedVersion: "1.3.0",
1167
- version: "1.3.0",
1168
- });
1169
- }),
1170
- );
1171
-
1172
- it.effect("does not retry a failed registry lookup within the hour", () =>
1173
- Effect.gen(function* () {
1174
- const h = yield* makeHarness();
1175
- yield* h.installation.checkForUpdate;
1176
- yield* h.installation.checkForUpdate;
1177
- expect(h.requests).toEqual([ACP_REGISTRY_URL]);
1178
- yield* TestClock.adjust("1 hour");
1179
- yield* h.installation.checkForUpdate;
1180
- expect(h.requests).toEqual([ACP_REGISTRY_URL, ACP_REGISTRY_URL]);
1181
- }),
1182
- );
1183
-
1184
- it.effect.each(["update", "reinstall"] as const)(
1185
- "rejects withdrawal during $0 validation",
1186
- (operation) =>
1187
- Effect.gen(function* () {
1188
- let manifest = ModelManifest.BUNDLED_MODEL_MANIFEST;
1189
- let withdraw = operation === "update";
1190
- const h = yield* makeHarness({
1191
- asset: yield* pinnedAsset(),
1192
- registry: registryListing(),
1193
- archives: { [upstreamUrl]: upstreamArchive },
1194
- manifest: Effect.sync(() => manifest),
1195
- validate: (_executable, version) =>
1196
- Effect.sync(() => {
1197
- if (withdraw && version === "1.4.1") manifest = withdrawnManifest;
1198
- }),
1199
- });
1200
- yield* h.installation.start;
1201
- yield* terminalState(h.installation);
1202
- yield* h.installation.checkForUpdate;
1203
- if (operation === "reinstall") {
1204
- yield* h.installation.start;
1205
- expect((yield* terminalState(h.installation)).phase).toBe("succeeded");
1206
- withdraw = true;
1207
- }
1208
- yield* h.installation.start;
1209
- expect((yield* terminalState(h.installation)).phase).toBe("failed");
1210
- if (operation === "update") {
1211
- expect((yield* h.installation.resolve()).version).toBe("1.3.0");
1212
- } else {
1213
- expect((yield* h.installation.state).version).toBe("1.3.0");
1214
- yield* Effect.flip(h.installation.resolve());
1215
- }
1216
- }),
1217
- );
1218
-
1219
- it.effect("returns an install the manifest withdraws to the pinned release", () =>
1220
- Effect.gen(function* () {
1221
- let manifest = ModelManifest.BUNDLED_MODEL_MANIFEST;
1222
- const h = yield* makeHarness({
1223
- asset: yield* pinnedAsset(),
1224
- registry: registryListing(),
1225
- archives: { [upstreamUrl]: upstreamArchive },
1226
- manifest: Effect.sync(() => manifest),
1227
- });
1228
- yield* h.installation.checkForUpdate;
1229
- yield* h.installation.start;
1230
- yield* terminalState(h.installation);
1231
- yield* h.installation.start;
1232
- expect(yield* terminalState(h.installation)).toMatchObject({ installedVersion: "1.4.1" });
1233
-
1234
- manifest = withdrawnManifest;
1235
- expect((yield* Effect.flip(h.installation.resolve())).detail).toContain("no longer works");
1236
- yield* h.installation.checkForUpdate;
1237
- expect(yield* h.installation.state).toMatchObject({
1238
- installedVersion: "1.4.1",
1239
- version: "1.3.0",
1240
- });
1241
- yield* h.installation.start;
1242
- expect(yield* terminalState(h.installation)).toMatchObject({
1243
- phase: "succeeded",
1244
- installedVersion: "1.3.0",
1245
- version: "1.3.0",
1246
- });
1247
- expect((yield* h.installation.resolve()).version).toBe("1.3.0");
1248
- }),
1249
- );
1321
});
apps/server/src/provider/AntigravityInstallation.ts
+340
-387
@@ -1,7 +1,11 @@
1
// @effect-diagnostics nodeBuiltinImport:off - Effect has no incremental digest or free-space query.
2
+import { expandHomePath } from "@t3tools/provider-core/server/pathExpansion";
3
+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";
4
-import { expandHomePath } from "@t3tools/provider-core/server/pathExpansion";
9
import * as HostProcess from "@t3tools/shared/HostProcess";
10
import { resolveNodeExecutable, nodeRuntimeUnavailableMessage } from "@t3tools/shared/nodeRuntime";
11
import { resolveCommandPath } from "@t3tools/shared/shell";
@@ -22,72 +26,38 @@ import * as Scope from "effect/Scope";
26
import * as Semaphore from "effect/Semaphore";
27
import * as Stream from "effect/Stream";
28
import * as SubscriptionRef from "effect/SubscriptionRef";
25
-import {
26
- FetchHttpClient,
27
- HttpClient,
28
- HttpClientError,
29
- HttpClientRequest,
30
- HttpClientResponse,
31
-} from "effect/http";
29
+import { HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse } from "effect/http";
30
import * as ChildProcess from "effect/process/ChildProcess";
31
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
32
import * as NodeCrypto from "node:crypto";
33
import * as NodeFSP from "node:fs/promises";
34
import * as EffectAcpErrors from "effect-acp/errors";
35
38
-import { collectUint8StreamText } from "@t3tools/provider-core/server/collectStreamText";
39
-import {
40
- ACP_REGISTRY_URL,
41
- MAX_REGISTRY_BYTES,
42
- resolveAcpRegistryPlatformTarget,
43
-} from "@t3tools/provider-acp-registry/server/AcpRegistrySupport";
44
-
36
import * as ServerConfig from "../config.ts";
37
+import * as ServerSettings from "../serverSettings.ts";
38
+import {
39
+ ANTIGRAVITY_CLI_MANIFEST_BASE,
40
+ antigravityCliTarget,
41
+ parseAntigravityCliRelease,
42
+ type AntigravityCliReleaseAsset,
43
+} from "./antigravityCliRelease.ts";
44
import { openZipArchive } from "../zipArchive.ts";
45
import { makeAntigravityAcpRuntime } from "./acp/AntigravityAcpSupport.ts";
46
import {
47
buildAntigravityAcpSpawnInput,
48
prepareAntigravityProfile,
49
} from "./antigravityAuthSupport.ts";
52
-import {
53
- resolveAntigravityReleaseAsset,
54
- type AntigravityRelease,
55
- type AntigravityReleaseAsset,
56
- type AntigravityUpstreamRelease,
57
-} from "./antigravityRelease.ts";
58
-import { selectManagedRelease } from "./managedRelease.ts";
59
-import * as ModelManifest from "./ModelManifest.ts";
60
-import { resolveProviderCompatibility } from "./providerCompatibility.ts";
50
+import { type AntigravityReleaseAsset } from "./antigravityRelease.ts";
51
52
const DRIVER = ProviderDriverKind.make("antigravity");
53
const DOWNLOAD_TIMEOUT = "45 minutes";
54
const VALIDATION_TIMEOUT = "90 seconds";
55
+const MAX_DOWNLOAD_BYTES = 512 * 1024 * 1024;
56
+const MAX_EXECUTABLE_BYTES = 512 * 1024 * 1024;
57
+const UPDATE_CHECK_INTERVAL = 60 * 60 * 1000;
58
const FREE_SPACE_MARGIN = 256 * 1024 * 1024;
59
const RECORD_MAX_BYTES = 8 * 1024;
60
const RELEASE_RECORD = ".install-complete.json";
68
-const UPDATE_CHECK_INTERVAL_MS = 60 * 60_000;
69
-const UPDATE_CHECK_TIMEOUT = "20 seconds";
70
-const UPSTREAM_AGENT_ID = "antigravity-acp";
71
-const UPSTREAM_DOWNLOAD_PREFIX = "https://dl.google.com/agy-extensions/releases/";
72
-// An upstream release has no pinned sizes. Current archives are about 340 MB
73
-// and extract to about 1.1 GB.
74
-const UPSTREAM_MAX_ARCHIVE_BYTES = 1024 * 1024 * 1024;
75
-const UPSTREAM_MAX_EXTRACTED_BYTES = 2 * 1024 * 1024 * 1024;
76
-
77
-const decodeRegistryIndex = Schema.decodeUnknownEffect(
78
- Schema.fromJsonString(Schema.Struct({ agents: Schema.Array(Schema.Unknown) })),
79
-);
80
-const isUpstreamAgent = Schema.is(Schema.Struct({ id: Schema.Literal(UPSTREAM_AGENT_ID) }));
81
-const decodeRegistryAgent = Schema.decodeUnknownEffect(
82
- Schema.Struct({
83
- version: Schema.String,
84
- distribution: Schema.Struct({
85
- binary: Schema.optionalKey(
86
- Schema.Record(Schema.String, Schema.Struct({ archive: Schema.String })),
87
- ),
88
- }),
89
- }),
90
-);
61
const LARGE_PAGE_KERNEL_MESSAGE =
62
"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.";
63
@@ -97,7 +67,7 @@ const InstalledRelease = Schema.Struct({
67
releaseId: ReleaseId,
68
version: Schema.String,
69
executable: Schema.Struct({ name: Schema.String, bytes: Schema.Number }),
100
- harness: Schema.Struct({ name: Schema.String, bytes: Schema.Number }),
70
+ harness: Schema.NullOr(Schema.Struct({ name: Schema.String, bytes: Schema.Number })),
71
});
72
type InstalledRelease = typeof InstalledRelease.Type;
73
const encodeActiveRelease = Schema.encodeEffect(Schema.fromJsonString(ActiveRelease));
@@ -144,10 +114,6 @@ interface AntigravityInstallationService {
114
) => Effect.Effect<ProviderInstallState, AntigravityInstallationError>;
115
readonly state: Effect.Effect<ProviderInstallState>;
116
readonly changes: Stream.Stream<ProviderInstallState>;
147
- /**
148
- * Looks up the newest release in the ACP Registry, at most hourly, and
149
- * offers it through `state.version` when it is newer than the install.
150
- */
117
readonly checkForUpdate: Effect.Effect<void>;
118
readonly remove: (
119
protectedBinaryPaths?: ReadonlyArray<string>,
@@ -162,14 +128,22 @@ export class AntigravityInstallation extends Context.Service<
128
AntigravityInstallation,
129
Effect.gen(function* () {
130
const config = yield* ServerConfig.ServerConfig;
165
- return yield* makeAntigravityInstallation({ baseDir: config.baseDir });
131
+ const settings = yield* ServerSettings.ServerSettingsService;
132
+ return yield* makeAntigravityInstallation({
133
+ baseDir: config.baseDir,
134
+ updateChecksEnabled: settings.getSettings.pipe(
135
+ Effect.map((value) => value.enableProviderUpdateChecks),
136
+ Effect.orElseSucceed(() => false),
137
+ ),
138
+ });
139
}),
140
);
141
}
142
143
export interface AntigravityInstallationOptions {
144
readonly baseDir: string;
172
- readonly releaseAsset?: AntigravityReleaseAsset | null;
145
+ readonly releaseAsset?: AntigravityReleaseAsset | AntigravityCliReleaseAsset | null;
146
+ readonly updateChecksEnabled?: Effect.Effect<boolean>;
147
readonly validate?: (
148
executable: AntigravityExecutable,
149
expectedVersion: string,
@@ -218,10 +192,11 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
192
const platform = yield* HostProcess.Platform;
193
const arch = yield* HostProcess.Architecture;
194
const environment = yield* HostProcess.Environment;
221
- const releaseAsset =
195
+ let releaseAsset = options.releaseAsset ?? null;
196
+ const supported =
197
options.releaseAsset === undefined
223
- ? resolveAntigravityReleaseAsset(platform, arch)
224
- : options.releaseAsset;
198
+ ? antigravityCliTarget(platform, arch) !== null
199
+ : options.releaseAsset !== null;
200
const names = executableNames(platform);
201
const managedDirectory = path.join(
202
options.baseDir,
@@ -232,38 +207,21 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
207
const versionsDirectory = path.join(managedDirectory, "versions");
208
const activePath = path.join(managedDirectory, "active.json");
209
const gate = yield* Semaphore.make(1);
235
- const updateCheckGate = yield* Semaphore.make(1);
210
const leases = new Map<string, number>();
211
let running: { readonly operationId: string; readonly fiber: Fiber.Fiber<void> } | undefined;
238
- let upstream: AntigravityUpstreamRelease | null = null;
239
- let upstreamCheckedAt: number | null = null;
240
-
241
- // What `start` installs next. Clients compare `version` with
242
- // `installedVersion` to offer an update.
243
- const offer = (installedVersion: string | null) => {
244
- const release = selectManagedRelease<AntigravityRelease>(
245
- installedVersion,
246
- releaseAsset,
247
- upstream,
248
- );
249
- return {
250
- version: release?.version ?? installedVersion,
251
- totalBytes: release && "archiveBytes" in release ? release.archiveBytes : null,
252
- };
253
- };
254
-
212
const state = yield* SubscriptionRef.make<ProviderInstallState>({
213
driver: DRIVER,
214
operationId: null,
215
phase: "idle",
216
downloadedBytes: 0,
260
- ...offer(null),
217
+ totalBytes:
218
+ releaseAsset !== null && "archiveBytes" in releaseAsset ? releaseAsset.archiveBytes : null,
219
+ version: releaseAsset?.version ?? null,
220
installedVersion: null,
221
canRemove: false,
222
message: null,
223
});
224
266
- // The model manifest can withdraw a bad upstream release without a T3 Code release.
225
const isWithdrawn = Effect.fn("AntigravityInstallation.isWithdrawn")(function* (version: string) {
226
const manifest = yield* manifestService.current;
227
const status = (
@@ -276,68 +234,16 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
234
)?.status;
235
return status === "broken" || status === "unsupported";
236
});
279
-
280
- // Forgets what the manifest withdrew after it was seen. A withdrawn install
281
- // is not kept either, so the pin replaces it rather than a re-check.
282
- const keptInstall = Effect.fn("AntigravityInstallation.keptInstall")(function* (
283
- installedVersion: string | null,
237
+ const ensureEligible = Effect.fn("AntigravityInstallation.ensureEligible")(function* (
238
+ version: string,
239
) {
285
- if (upstream && (yield* isWithdrawn(upstream.version))) upstream = null;
286
- return installedVersion !== null && !(yield* isWithdrawn(installedVersion))
287
- ? installedVersion
288
- : null;
289
- });
290
-
291
- const lookupUpstream = Effect.gen(function* () {
292
- const target = resolveAcpRegistryPlatformTarget(platform, arch);
293
- if (!target) return null;
294
- const response = yield* http
295
- .execute(HttpClientRequest.get(ACP_REGISTRY_URL))
296
- .pipe(Effect.flatMap(HttpClientResponse.filterStatusOk));
297
- const body = yield* collectUint8StreamText({
298
- stream: response.stream,
299
- maxBytes: MAX_REGISTRY_BYTES + 1,
300
- });
301
- if (body.truncated || body.bytes > MAX_REGISTRY_BYTES || body.invalidUtf8) return null;
302
- const index = yield* decodeRegistryIndex(body.text);
303
- const entry = index.agents.find(isUpstreamAgent);
304
- if (!entry) return null;
305
- const agent = yield* decodeRegistryAgent(entry);
306
- // Checked after normalization so an encoded `..` cannot leave the releases path.
307
- const archive = agent.distribution.binary?.[target]?.archive;
308
- const url = archive === undefined ? undefined : URL.parse(archive)?.href;
309
- if (!/^\d+\.\d+\.\d+$/u.test(agent.version) || !url?.startsWith(UPSTREAM_DOWNLOAD_PREFIX)) {
310
- return null;
311
- }
312
- if (yield* isWithdrawn(agent.version)) return null;
313
- return { version: agent.version, url } satisfies AntigravityUpstreamRelease;
240
+ if (yield* isWithdrawn(version))
241
+ return yield* installationError(
242
+ "verify",
243
+ "This Antigravity release was withdrawn. Check for updates and try again.",
244
+ );
245
});
246
316
- // A check already in flight covers concurrent subscribers, including when it fails.
317
- const checkForUpdate = updateCheckGate
318
- .withPermitsIfAvailable(1)(
319
- Effect.gen(function* () {
320
- const now = yield* Clock.currentTimeMillis;
321
- if (upstreamCheckedAt === null || now - upstreamCheckedAt >= UPDATE_CHECK_INTERVAL_MS) {
322
- // A failed lookup counts too, and keeps whatever release was offered before.
323
- upstreamCheckedAt = now;
324
- upstream = yield* lookupUpstream.pipe(
325
- Effect.timeout(UPDATE_CHECK_TIMEOUT),
326
- Effect.orElseSucceed(() => upstream),
327
- );
328
- }
329
- // A running install already published the release it is installing.
330
- yield* SubscriptionRef.updateEffect(state, (current) =>
331
- isRunning(current)
332
- ? Effect.succeed(current)
333
- : keptInstall(current.installedVersion).pipe(
334
- Effect.map((kept) => ({ ...current, ...offer(kept) })),
335
- ),
336
- );
337
- }),
338
- )
339
- .pipe(Effect.ignore);
340
-
247
const readRecord = Effect.fn("AntigravityInstallation.readRecord")(function* <A>(
248
filePath: string,
249
schema: Schema.Codec<A>,
@@ -373,15 +279,20 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
279
const record = yield* readRecord(path.join(directory, RELEASE_RECORD), InstalledRelease);
280
if (
281
record.releaseId !== releaseId ||
376
- record.executable.name !== names.executable ||
377
- record.harness.name !== names.harness ||
282
+ (record.harness === null
283
+ ? record.executable.name !== (platform === "win32" ? "agy.exe" : "antigravity")
284
+ : record.executable.name !== names.executable || record.harness.name !== names.harness) ||
285
!Number.isSafeInteger(record.executable.bytes) ||
286
record.executable.bytes <= 0 ||
380
- !Number.isSafeInteger(record.harness.bytes) ||
381
- record.harness.bytes <= 0 ||
287
+ (record.harness !== null &&
288
+ (!Number.isSafeInteger(record.harness.bytes) || record.harness.bytes <= 0)) ||
289
!record.version.trim() ||
383
- !(yield* executableFile(path.join(directory, names.executable), record.executable.bytes)) ||
384
- !(yield* executableFile(path.join(directory, names.harness), record.harness.bytes))
290
+ !(yield* executableFile(
291
+ path.join(directory, record.executable.name),
292
+ record.executable.bytes,
293
+ )) ||
294
+ (record.harness !== null &&
295
+ !(yield* executableFile(path.join(directory, record.harness.name), record.harness.bytes)))
296
) {
297
return yield* installationError(
298
"resolve",
@@ -389,8 +300,8 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
300
);
301
}
302
return {
392
- executablePath: path.join(directory, names.executable),
393
- harnessPath: path.join(directory, names.harness),
303
+ executablePath: path.join(directory, record.executable.name),
304
+ harnessPath: record.harness === null ? null : path.join(directory, record.harness.name),
305
source: "managed",
306
version: record.version,
307
managedVersionDirectory: directory,
@@ -403,6 +314,16 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
314
) {
315
if (!(yield* executableFile(candidate))) return null;
316
const executablePath = yield* fs.realPath(candidate);
317
+ const realVersions = yield* fs.realPath(versionsDirectory).pipe(Effect.option);
318
+ const directory = path.dirname(executablePath);
319
+ if (
320
+ Option.isSome(realVersions) &&
321
+ path.dirname(directory) === realVersions.value &&
322
+ /^[a-f0-9]{64}$/u.test(path.basename(directory))
323
+ ) {
324
+ const installed = yield* completedRelease(path.basename(directory));
325
+ return { ...installed, source };
326
+ }
327
// Keep launcher symlinks intact: version-manager shims dispatch by their invoked name.
328
if (isAntigravityCli(candidate, executablePath)) {
329
return {
@@ -413,18 +334,8 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
334
managedVersionDirectory: null,
335
} satisfies AntigravityExecutable;
336
}
416
- const directory = path.dirname(executablePath);
337
const harnessPath = path.join(directory, names.harness);
338
if (!(yield* executableFile(harnessPath))) return null;
419
- const realVersions = yield* fs.realPath(versionsDirectory).pipe(Effect.option);
420
- if (
421
- Option.isSome(realVersions) &&
422
- path.dirname(directory) === realVersions.value &&
423
- /^[a-f0-9]{64}$/u.test(path.basename(directory))
424
- ) {
425
- const installed = yield* completedRelease(path.basename(directory));
426
- return { ...installed, executablePath, harnessPath, source } satisfies AntigravityExecutable;
427
- }
339
return {
340
executablePath,
341
harnessPath,
@@ -483,13 +394,11 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
394
if (yield* fs.exists(activePath)) {
395
const active = yield* readRecord(activePath, ActiveRelease);
396
const installed = yield* completedRelease(active.releaseId);
486
- // Without this a withdrawn install keeps launching until its owner updates.
487
- if (yield* isWithdrawn(installed.version)) {
397
+ if (yield* isWithdrawn(installed.version))
398
return yield* installationError(
399
"resolve",
400
`Antigravity ${installed.version} no longer works with this T3 Code release. Update it in Antigravity setup.`,
401
);
492
- }
402
return installed;
403
}
404
for (const candidate of yield* commandCandidates(names.executable, processEnvironment)) {
@@ -498,7 +407,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
407
}
408
return yield* installationError(
409
"resolve",
501
- releaseAsset
410
+ supported
411
? "Antigravity ACP runtime is not installed. Install it in this environment's provider settings or set a custom ACP executable path. The Antigravity app, IDE, and CLI are separate installations."
412
: `Google does not publish an Antigravity runtime for ${platform}-${arch}. Use a supported environment or a custom executable.`,
413
);
@@ -587,8 +496,10 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
496
});
497
const initialized = yield* runtime.initialize();
498
if (
590
- initialized.agentInfo?.name !== "antigravity-acp" ||
591
- initialized.agentInfo.version !== expectedVersion ||
499
+ (executable.harnessPath === null
500
+ ? initialized.agentInfo?.name !== "Antigravity ACP Server"
501
+ : initialized.agentInfo?.name !== "antigravity-acp") ||
502
+ initialized.agentInfo?.version !== expectedVersion ||
503
// Antigravity 1.1.1 may report protocol 2 with legacy ACP; choose wire format from the response shape.
504
(initialized.protocolVersion !== 1 && initialized.protocolVersion !== 2) ||
505
initialized.agentCapabilities?.loadSession !== true ||
@@ -619,20 +530,12 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
530
);
531
532
const install = Effect.fn("AntigravityInstallation.install")(
622
- function* (release: AntigravityRelease) {
623
- // A pinned release is checked against its recorded hash and sizes. An
624
- // upstream release is bounded instead and identified by what downloads.
625
- const pin = "sha256" in release ? release : null;
626
- const ensureEligible = Effect.fn("AntigravityInstallation.ensureEligible")(function* () {
627
- if (!pin && (yield* isWithdrawn(release.version))) {
628
- return yield* installationError(
629
- "verify",
630
- "This Antigravity release was withdrawn. Check for updates and try again.",
631
- );
632
- }
633
- });
634
- const executable = pin?.executable ?? { name: names.executable, bytes: null };
635
- const harness = pin?.harness ?? { name: names.harness, bytes: null };
533
+ function* (asset: AntigravityReleaseAsset | AntigravityCliReleaseAsset) {
534
+ yield* ensureEligible(asset.version);
535
+ const cli = "sha512" in asset;
536
+ // Existing installation records use 64-character IDs, including native SHA-512 prefixes.
537
+ const releaseId = cli ? asset.sha512.slice(0, 64) : asset.sha256;
538
+ const archiveBytes = cli ? null : asset.archiveBytes;
539
yield* resolveNodeExecutable("Antigravity", environment).pipe(
540
Effect.provideService(FileSystem.FileSystem, fs),
541
Effect.provideService(Path.Path, path),
@@ -641,7 +544,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
544
installationError("verify", nodeRuntimeUnavailableMessage("Antigravity"), cause),
545
),
546
);
644
- if (platform === "linux" && arch === "arm64") {
547
+ if (!cli && platform === "linux" && arch === "arm64") {
548
const pageSize = yield* spawner
549
.string(ChildProcess.make("getconf", ["PAGESIZE"], { stdin: "ignore", stderr: "ignore" }))
550
.pipe(
@@ -657,8 +560,10 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
560
SubscriptionRef.update(state, (current) => ({ ...current, phase, message }));
561
yield* fs.makeDirectory(versionsDirectory, { recursive: true });
562
yield* SubscriptionRef.update(state, (current) => ({ ...current, canRemove: true }));
563
+ const destination = path.join(versionsDirectory, releaseId);
564
const activate = Effect.fn("AntigravityInstallation.activate")(
661
- function* (releaseId: string) {
565
+ function* () {
566
+ yield* ensureEligible(asset.version);
567
const pointerDirectory = yield* fs.makeTempDirectoryScoped({
568
directory: managedDirectory,
569
prefix: "active.json.",
@@ -668,16 +573,14 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
573
flag: "wx",
574
mode: 0o600,
575
});
671
- yield* ensureEligible();
576
yield* fs.rename(pointerPath, activePath);
577
yield* SubscriptionRef.update(
578
state,
579
(current) =>
580
({
581
...current,
678
- ...offer(release.version),
582
phase: "succeeded",
680
- installedVersion: release.version,
583
+ installedVersion: asset.version,
584
message: null,
585
}) satisfies ProviderInstallState,
586
);
@@ -691,52 +594,38 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
594
),
595
Effect.uninterruptible,
596
);
694
- const reuse = Effect.fn("AntigravityInstallation.reuse")(function* (releaseId: string) {
597
+
598
+ if (yield* fs.exists(destination)) {
599
const existing = yield* completedRelease(releaseId);
696
- if (existing.version !== release.version) {
600
+ if (existing.version !== asset.version) {
601
return yield* installationError(
602
"verify",
603
"The existing managed release has the wrong version. Remove it before reinstalling.",
604
);
605
}
606
yield* report("verifying", "Checking the installed runtime.");
703
- yield* ensureEligible();
704
- yield* validate(existing, release.version).pipe(
607
+ yield* validate(existing, asset.version).pipe(
608
Effect.scoped,
609
Effect.timeout(VALIDATION_TIMEOUT),
610
);
708
- yield* activate(releaseId);
709
- });
710
-
711
- if (pin && (yield* fs.exists(path.join(versionsDirectory, pin.sha256)))) {
712
- return yield* reuse(pin.sha256);
611
+ yield* activate();
612
+ return;
613
}
614
715
- const ensureFreeSpace = Effect.fn("AntigravityInstallation.ensureFreeSpace")(function* (
716
- operation: string,
717
- bytes: number,
615
+ const available = yield* Effect.tryPromise({
616
+ try: () => NodeFSP.statfs(versionsDirectory, { bigint: true }),
617
+ catch: (cause) => installationError("download", "Could not check free disk space.", cause),
618
+ }).pipe(Effect.option);
619
+ const required = cli
620
+ ? MAX_DOWNLOAD_BYTES + MAX_EXECUTABLE_BYTES + FREE_SPACE_MARGIN
621
+ : asset.archiveBytes + asset.executable.bytes + asset.harness.bytes + FREE_SPACE_MARGIN;
622
+ if (
623
+ Option.isSome(available) &&
624
+ available.value.bavail * available.value.bsize < BigInt(required)
625
) {
719
- const available = yield* Effect.tryPromise({
720
- try: () => NodeFSP.statfs(versionsDirectory, { bigint: true }),
721
- catch: (cause) => installationError(operation, "Could not check free disk space.", cause),
722
- }).pipe(Effect.option);
723
- const required = bytes + FREE_SPACE_MARGIN;
724
- if (
725
- Option.isSome(available) &&
726
- available.value.bavail * available.value.bsize < BigInt(required)
727
- ) {
728
- return yield* installationError(
729
- operation,
730
- `Antigravity needs at least ${Math.ceil(required / 1024 / 1024)} MiB of free space to install.`,
731
- );
732
- }
733
- });
734
- // An upstream release has no recorded sizes, so each member is checked
735
- // against free space once the archive declares it.
736
- if (pin) {
737
- yield* ensureFreeSpace(
626
+ return yield* installationError(
627
"download",
739
- pin.archiveBytes + pin.executable.bytes + pin.harness.bytes,
628
+ `Antigravity needs at least ${Math.ceil(required / 1024 / 1024)} MiB of free space to install.`,
629
);
630
}
631
const staging = yield* fs.makeTempDirectoryScoped({
@@ -746,63 +635,41 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
635
const archivePath = path.join(staging, "download.zip");
636
const pairDirectory = path.join(staging, "runtime");
637
yield* fs.makeDirectory(pairDirectory);
749
- const maxArchiveBytes = pin?.archiveBytes ?? UPSTREAM_MAX_ARCHIVE_BYTES;
750
- const hash = NodeCrypto.createHash("sha256");
638
+ const hash = NodeCrypto.createHash(cli ? "sha512" : "sha256");
639
let downloadedBytes = 0;
640
let lastProgressAt = yield* Clock.currentTimeMillis;
641
yield* Effect.gen(function* () {
754
- const request = http.execute(HttpClientRequest.get(release.url));
755
- // Only its URL vouches for an upstream release, so a redirect is
756
- // refused rather than followed somewhere that check never saw.
757
- const response = yield* (
758
- pin
759
- ? request
760
- : request.pipe(
761
- Effect.provideService(FetchHttpClient.RequestInit, { redirect: "error" }),
762
- )
763
- ).pipe(Effect.flatMap(HttpClientResponse.filterStatusOk));
764
- // dl.google.com gzips the zip when the client accepts it, so
765
- // `content-length` is the encoded size. The decoded stream is still
766
- // checked against the byte limit and, when pinned, the hash below.
642
+ const response = yield* http
643
+ .execute(HttpClientRequest.get(asset.url))
644
+ .pipe(Effect.flatMap(HttpClientResponse.filterStatusOk));
645
+ // dl.google.com may gzip the zip: content-length is encoded, while byte/hash checks use decoded data.
646
const contentLength = response.headers["content-length"];
647
const contentEncoding = response.headers["content-encoding"]?.trim().toLowerCase();
648
const identityBody = contentEncoding === undefined || contentEncoding === "identity";
770
- if (identityBody && contentLength !== undefined) {
771
- const declaredBytes = Number(contentLength);
772
- if (pin && declaredBytes !== pin.archiveBytes) {
773
- return yield* installationError(
774
- "download",
775
- "The Antigravity download size did not match the pinned release.",
776
- );
777
- }
778
- if (!pin && Number.isSafeInteger(declaredBytes) && declaredBytes > 0) {
779
- if (declaredBytes > maxArchiveBytes) {
780
- return yield* installationError(
781
- "download",
782
- "The Antigravity download is larger than T3 Code accepts.",
783
- );
784
- }
785
- yield* SubscriptionRef.update(state, (current) => ({
786
- ...current,
787
- totalBytes: declaredBytes,
788
- }));
789
- }
649
+ if (
650
+ identityBody &&
651
+ contentLength !== undefined &&
652
+ archiveBytes !== null &&
653
+ Number(contentLength) !== archiveBytes
654
+ ) {
655
+ return yield* installationError(
656
+ "download",
657
+ "The Antigravity download size did not match the pinned release.",
658
+ );
659
}
660
yield* response.stream.pipe(
661
Stream.tap((chunk) =>
662
Effect.gen(function* () {
663
downloadedBytes += chunk.byteLength;
795
- if (downloadedBytes > maxArchiveBytes) {
664
+ if (downloadedBytes > (archiveBytes ?? MAX_DOWNLOAD_BYTES)) {
665
return yield* installationError(
666
"download",
798
- pin
799
- ? "The Antigravity download exceeded the pinned release size."
800
- : "The Antigravity download is larger than T3 Code accepts.",
667
+ "The Antigravity download exceeded its allowed size.",
668
);
669
}
670
hash.update(chunk);
671
const now = yield* Clock.currentTimeMillis;
805
- if (now - lastProgressAt >= 250 || downloadedBytes === pin?.archiveBytes) {
672
+ if (now - lastProgressAt >= 250 || downloadedBytes === archiveBytes) {
673
lastProgressAt = now;
674
yield* SubscriptionRef.update(state, (current) => ({
675
...current,
@@ -825,109 +692,154 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
692
: cause,
693
),
694
);
828
- const releaseId = hash.digest("hex");
829
- if (pin && (downloadedBytes !== pin.archiveBytes || releaseId !== pin.sha256)) {
695
+ if (
696
+ (archiveBytes !== null && downloadedBytes !== archiveBytes) ||
697
+ hash.digest("hex") !== (cli ? asset.sha512 : asset.sha256)
698
+ ) {
699
return yield* installationError(
700
"download",
832
- "The Antigravity download failed its size or SHA-256 check. Nothing was installed.",
701
+ "The Antigravity download failed its size or checksum check. Nothing was installed.",
702
);
703
}
835
- const destination = path.join(versionsDirectory, releaseId);
836
- if (!pin && (yield* fs.exists(destination))) {
837
- return yield* reuse(releaseId);
838
- }
704
705
yield* report("extracting", "Extracting the verified runtime.");
841
- const extracted = new Map<string, number>();
842
- let extractedTotal = 0;
843
- yield* Effect.gen(function* () {
844
- const archive = yield* openZipArchive(archivePath, (detail, cause) =>
845
- installationError("extract", detail, cause),
846
- );
847
- if (archive.entryCount !== 2) {
848
- return yield* installationError(
849
- "extract",
850
- "The archive must contain exactly the Antigravity executable and its harness.",
851
- );
852
- }
853
- for (;;) {
854
- const entry = yield* archive.next;
855
- if (!entry) break;
856
- const expected = [executable, harness].find((file) => file.name === entry.fileName);
857
- const expectedBytes = expected?.bytes ?? entry.uncompressedSize;
858
- const unixType = (entry.externalFileAttributes >>> 16) & 0o170000;
706
+ if (cli) {
707
+ const executablePath = path.join(pairDirectory, asset.executable.name);
708
+ if (asset.format === "executable") {
709
+ yield* fs.copyFile(archivePath, executablePath);
710
+ } else {
711
+ const tar = cliArchiveTarCommand(platform, environment);
712
+ const list = yield* spawner.string(ChildProcess.make(tar, ["-tzf", archivePath]));
713
+ const types = yield* spawner.string(ChildProcess.make(tar, ["-tvzf", archivePath]));
714
if (
860
- !expected ||
861
- extracted.has(entry.fileName) ||
862
- entry.fileName.includes("/") ||
863
- entry.fileName.includes("\\") ||
864
- (unixType !== 0 && unixType !== 0o100000) ||
865
- (entry.externalFileAttributes & 0x10) !== 0 ||
866
- (entry.generalPurposeBitFlag & 1) !== 0 ||
867
- ![0, 8].includes(entry.compressionMethod) ||
868
- entry.uncompressedSize !== expectedBytes ||
869
- expectedBytes <= 0 ||
870
- extractedTotal + expectedBytes > UPSTREAM_MAX_EXTRACTED_BYTES
715
+ list.trim() !== asset.executable.name ||
716
+ types.trim().split(/\r?\n/u).length !== 1 ||
717
+ !types.startsWith("-")
718
) {
719
return yield* installationError(
720
"extract",
874
- "The archive contains an unexpected, unsafe, or incorrectly sized member.",
721
+ "The Antigravity archive must contain one regular executable.",
722
);
723
}
877
- if (!pin) yield* ensureFreeSpace("extract", expectedBytes);
878
- extracted.set(entry.fileName, expectedBytes);
879
- extractedTotal += expectedBytes;
724
yield* Effect.gen(function* () {
881
- const readable = yield* archive.streamEntry(entry);
725
+ const child = yield* spawner.spawn(
726
+ ChildProcess.make(tar, ["-xOzf", archivePath, asset.executable.name], {
727
+ stdout: "pipe",
728
+ stderr: "pipe",
729
+ }),
730
+ );
731
let extractedBytes = 0;
883
- yield* EffectNodeStream.fromReadable<Uint8Array, AntigravityInstallationError>({
884
- evaluate: () => readable,
885
- onError: wrapFailure("extract", "Could not extract the Antigravity runtime."),
886
- }).pipe(
732
+ yield* child.stdout.pipe(
733
Stream.tap((chunk) =>
734
Effect.gen(function* () {
735
extractedBytes += chunk.byteLength;
890
- if (extractedBytes > expectedBytes) {
736
+ if (extractedBytes > MAX_EXECUTABLE_BYTES)
737
return yield* installationError(
738
"extract",
893
- "An archive member exceeded its expected size.",
739
+ "The Antigravity executable exceeded its size limit.",
740
);
895
- }
741
}),
742
),
898
- Stream.run(
899
- fs.sink(path.join(pairDirectory, entry.fileName), { flag: "wx", mode: 0o700 }),
900
- ),
743
+ Stream.run(fs.sink(executablePath, { flag: "wx", mode: 0o700 })),
744
);
902
- if (extractedBytes !== expectedBytes) {
903
- return yield* installationError("extract", "An archive member was truncated.");
904
- }
745
+ if ((yield* child.exitCode) !== 0 || extractedBytes === 0)
746
+ return yield* installationError(
747
+ "extract",
748
+ "Could not extract the Antigravity executable.",
749
+ );
750
}).pipe(Effect.scoped);
751
}
907
- }).pipe(Effect.scoped);
908
- const executableBytes = extracted.get(executable.name);
909
- const harnessBytes = extracted.get(harness.name);
910
- if (executableBytes === undefined || harnessBytes === undefined) {
911
- return yield* installationError(
912
- "extract",
913
- "The archive is missing the Antigravity executable or its harness.",
914
- );
915
- }
752
+ } else
753
+ yield* Effect.gen(function* () {
754
+ const archive = yield* openZipArchive(archivePath, (detail, cause) =>
755
+ installationError("extract", detail, cause),
756
+ );
757
+ if (archive.entryCount !== 2) {
758
+ return yield* installationError(
759
+ "extract",
760
+ "The archive must contain exactly the Antigravity executable and its harness.",
761
+ );
762
+ }
763
+ const seen = new Set<string>();
764
+ for (;;) {
765
+ const entry = yield* archive.next;
766
+ if (!entry) break;
767
+ const expected = [asset.executable, asset.harness].find(
768
+ (file) => file.name === entry.fileName,
769
+ );
770
+ const unixType = (entry.externalFileAttributes >>> 16) & 0o170000;
771
+ if (
772
+ !expected ||
773
+ seen.has(entry.fileName) ||
774
+ entry.fileName.includes("/") ||
775
+ entry.fileName.includes("\\") ||
776
+ (unixType !== 0 && unixType !== 0o100000) ||
777
+ (entry.externalFileAttributes & 0x10) !== 0 ||
778
+ (entry.generalPurposeBitFlag & 1) !== 0 ||
779
+ ![0, 8].includes(entry.compressionMethod) ||
780
+ entry.uncompressedSize !== expected.bytes
781
+ ) {
782
+ return yield* installationError(
783
+ "extract",
784
+ "The archive contains an unexpected, unsafe, or incorrectly sized member.",
785
+ );
786
+ }
787
+ seen.add(entry.fileName);
788
+ yield* Effect.gen(function* () {
789
+ const readable = yield* archive.streamEntry(entry);
790
+ let extractedBytes = 0;
791
+ yield* EffectNodeStream.fromReadable<Uint8Array, AntigravityInstallationError>({
792
+ evaluate: () => readable,
793
+ onError: wrapFailure("extract", "Could not extract the Antigravity runtime."),
794
+ }).pipe(
795
+ Stream.tap((chunk) =>
796
+ Effect.gen(function* () {
797
+ extractedBytes += chunk.byteLength;
798
+ if (extractedBytes > expected.bytes) {
799
+ return yield* installationError(
800
+ "extract",
801
+ "An archive member exceeded its pinned size.",
802
+ );
803
+ }
804
+ }),
805
+ ),
806
+ Stream.run(
807
+ fs.sink(path.join(pairDirectory, entry.fileName), { flag: "wx", mode: 0o700 }),
808
+ ),
809
+ );
810
+ if (extractedBytes !== expected.bytes) {
811
+ return yield* installationError("extract", "An archive member was truncated.");
812
+ }
813
+ }).pipe(Effect.scoped);
814
+ }
815
+ if (!seen.has(asset.executable.name) || !seen.has(asset.harness.name)) {
816
+ return yield* installationError(
817
+ "extract",
818
+ "The archive is missing the Antigravity executable or its harness.",
819
+ );
820
+ }
821
+ }).pipe(Effect.scoped);
822
yield* fs.remove(archivePath);
917
- const executablePath = path.join(pairDirectory, executable.name);
918
- const harnessPath = path.join(pairDirectory, harness.name);
823
+ const executablePath = path.join(pairDirectory, asset.executable.name);
824
+ const harnessPath = cli ? null : path.join(pairDirectory, asset.harness.name);
825
if (platform !== "win32") {
826
yield* fs.chmod(executablePath, 0o755);
921
- yield* fs.chmod(harnessPath, 0o755);
827
+ if (harnessPath !== null) yield* fs.chmod(harnessPath, 0o755);
828
}
923
- if (platform === "darwin" && arch === "x64") {
829
+ if (!cli && platform === "darwin" && arch === "x64") {
830
// Google signs the Intel build with the hardened runtime but no JIT entitlement, so
831
// libffi's writable+executable trampolines spin forever. Re-sign ad hoc after the hash check.
832
const exitCode = yield* spawner
833
.spawn(
834
ChildProcess.make(
835
"/usr/bin/codesign",
930
- ["--force", "--sign", "-", executablePath, harnessPath],
836
+ [
837
+ "--force",
838
+ "--sign",
839
+ "-",
840
+ executablePath,
841
+ ...(harnessPath === null ? [] : [harnessPath]),
842
+ ],
843
{ stdout: "ignore", stderr: "ignore" },
844
),
845
)
@@ -943,25 +855,27 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
855
}
856
}
857
yield* report("verifying", "Checking the downloaded runtime.");
946
- yield* ensureEligible();
858
yield* validate(
859
{
860
executablePath,
861
harnessPath,
862
source: "managed",
952
- version: release.version,
863
+ version: asset.version,
864
managedVersionDirectory: pairDirectory,
865
},
955
- release.version,
866
+ asset.version,
867
).pipe(Effect.scoped, Effect.timeout(VALIDATION_TIMEOUT));
868
const record: InstalledRelease = {
869
releaseId,
959
- version: release.version,
870
+ version: asset.version,
871
executable: {
961
- name: executable.name,
872
+ name: asset.executable.name,
873
bytes: Number((yield* fs.stat(executablePath)).size),
874
},
964
- harness: { name: harness.name, bytes: Number((yield* fs.stat(harnessPath)).size) },
875
+ harness:
876
+ cli || harnessPath === null
877
+ ? null
878
+ : { name: asset.harness.name, bytes: Number((yield* fs.stat(harnessPath)).size) },
879
};
880
yield* fs.writeFileString(
881
path.join(pairDirectory, RELEASE_RECORD),
@@ -972,9 +886,8 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
886
Effect.catch((cause) =>
887
completedRelease(releaseId).pipe(
888
Effect.flatMap((existing) =>
975
- existing.version === release.version
976
- ? ensureEligible().pipe(
977
- Effect.andThen(validate(existing, release.version)),
889
+ existing.version === asset.version
890
+ ? validate(existing, asset.version).pipe(
891
Effect.scoped,
892
Effect.timeout(VALIDATION_TIMEOUT),
893
)
@@ -995,7 +908,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
908
),
909
),
910
);
998
- yield* activate(releaseId);
911
+ yield* activate();
912
},
913
Effect.scoped,
914
Effect.mapError(
@@ -1006,76 +919,119 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
919
),
920
);
921
1009
- // Nothing newer is known, so "reinstall" re-checks the active runtime rather
1010
- // than replacing it with an older pinned release.
1011
- const reverify = Effect.fn("AntigravityInstallation.reverify")(
1012
- function* () {
1013
- const active = yield* readRecord(activePath, ActiveRelease);
1014
- const installed = yield* completedRelease(active.releaseId);
1015
- yield* validate(installed, installed.version).pipe(
1016
- Effect.scoped,
1017
- Effect.timeout(VALIDATION_TIMEOUT),
1018
- );
1019
- const kept = yield* keptInstall(installed.version);
1020
- if (kept === null) {
1021
- yield* SubscriptionRef.update(state, (current) => ({ ...current, ...offer(kept) }));
1022
- return yield* installationError(
1023
- "verify",
1024
- "This Antigravity release was withdrawn. Check for updates and try again.",
1025
- );
1026
- }
1027
- yield* SubscriptionRef.update(
1028
- state,
1029
- (current) =>
1030
- ({
1031
- ...current,
1032
- ...offer(kept),
1033
- phase: "succeeded",
1034
- installedVersion: installed.version,
1035
- message: null,
1036
- }) satisfies ProviderInstallState,
1037
- );
1038
- },
1039
- Effect.mapError(
1040
- wrapFailure(
1041
- "verify",
1042
- "The installed Antigravity runtime could not start. Remove it and reinstall.",
1043
- ),
1044
- ),
1045
- );
922
+ let lastUpdateCheck: number | undefined;
923
+ const refreshRelease = Effect.fn("AntigravityInstallation.refreshRelease")(function* (
924
+ explicit = false,
925
+ ) {
926
+ if (options.releaseAsset !== undefined || !supported) return;
927
+ if (!explicit && !(yield* options.updateChecksEnabled ?? Effect.succeed(true))) return;
928
+ const now = yield* Clock.currentTimeMillis;
929
+ if (!explicit && lastUpdateCheck !== undefined && now - lastUpdateCheck < UPDATE_CHECK_INTERVAL)
930
+ return;
931
+ lastUpdateCheck = now;
932
+ const musl =
933
+ platform === "linux" &&
934
+ (yield* fs.exists(
935
+ arch === "arm64" ? "/lib/libc.musl-aarch64.so.1" : "/lib/libc.musl-x86_64.so.1",
936
+ ));
937
+ const target = antigravityCliTarget(platform, arch, musl);
938
+ const latest = yield* http.get(`${ANTIGRAVITY_CLI_MANIFEST_BASE}/${target}.json`).pipe(
939
+ Effect.flatMap(HttpClientResponse.filterStatusOk),
940
+ Effect.flatMap((response) => response.json),
941
+ Effect.map((json) => parseAntigravityCliRelease(json, platform, arch, musl)),
942
+ Effect.timeout("10 seconds"),
943
+ Effect.orElseSucceed(() => null),
944
+ );
945
+ if (latest === null) return;
946
+ if (yield* isWithdrawn(latest.version)) {
947
+ releaseAsset = null;
948
+ return;
949
+ }
950
+ releaseAsset = latest;
951
+ yield* SubscriptionRef.updateEffect(state, (value) =>
952
+ isRunning(value)
953
+ ? Effect.succeed(value)
954
+ : Effect.gen(function* () {
955
+ const keepInstalled =
956
+ value.installedVersion !== null &&
957
+ compareSemverVersions(value.installedVersion, latest.version) > 0 &&
958
+ !(yield* isWithdrawn(value.installedVersion));
959
+ return {
960
+ ...value,
961
+ version: keepInstalled ? value.installedVersion : latest.version,
962
+ totalBytes: null,
963
+ };
964
+ }),
965
+ );
966
+ });
967
1047
- const start = gate
1048
- .withPermit(
968
+ const start = Effect.gen(function* () {
969
+ const current = yield* SubscriptionRef.get(state);
970
+ if (isRunning(current)) return current;
971
+ yield* refreshRelease(true);
972
+ return yield* gate.withPermit(
973
Effect.gen(function* () {
974
const current = yield* SubscriptionRef.get(state);
975
if (isRunning(current)) return current;
1052
- const installedVersion = yield* keptInstall(current.installedVersion);
1053
- const release = selectManagedRelease<AntigravityRelease>(
1054
- installedVersion,
1055
- releaseAsset,
1056
- upstream,
1057
- );
1058
- if (!release && installedVersion === null) {
976
+ if (!supported) {
977
return yield* installationError(
978
"start",
979
`Google does not publish an Antigravity runtime for ${platform}-${arch}. Use a supported remote environment or a custom executable.`,
980
);
981
}
982
+ const asset =
983
+ releaseAsset !== null && !(yield* isWithdrawn(releaseAsset.version))
984
+ ? releaseAsset
985
+ : null;
986
+ const installed = yield* resolve().pipe(Effect.option);
987
+ const reuse =
988
+ Option.isSome(installed) &&
989
+ installed.value.source === "managed" &&
990
+ installed.value.harnessPath === null &&
991
+ (asset === null || compareSemverVersions(installed.value.version!, asset.version) > 0)
992
+ ? installed.value
993
+ : undefined;
994
+ if (asset === null && reuse === undefined)
995
+ return yield* installationError(
996
+ "start",
997
+ "Could not find a native Antigravity CLI release. Check the network connection and try again.",
998
+ );
999
const operationId = yield* random.uuidV4();
1000
const next: ProviderInstallState = {
1001
driver: DRIVER,
1002
operationId,
1068
- phase: release ? "downloading" : "verifying",
1003
+ phase: reuse === undefined ? "downloading" : "verifying",
1004
downloadedBytes: 0,
1070
- ...offer(installedVersion),
1005
+ totalBytes: asset !== null && "archiveBytes" in asset ? asset.archiveBytes : null,
1006
+ version: reuse?.version ?? asset?.version ?? null,
1007
installedVersion: current.installedVersion,
1008
canRemove: current.canRemove,
1073
- message: release
1074
- ? "Downloading Google's official Antigravity runtime."
1075
- : "Checking the installed runtime.",
1009
+ message:
1010
+ reuse === undefined
1011
+ ? "Downloading Google's official Antigravity runtime."
1012
+ : "Checking the installed runtime.",
1013
};
1014
yield* SubscriptionRef.set(state, next);
1078
- const work = (release ? install(release) : reverify()).pipe(
1015
+ const work = (
1016
+ reuse === undefined
1017
+ ? install(asset!)
1018
+ : validate(reuse, reuse.version!).pipe(
1019
+ Effect.scoped,
1020
+ Effect.timeout(VALIDATION_TIMEOUT),
1021
+ Effect.andThen(ensureEligible(reuse.version!)),
1022
+ Effect.andThen(
1023
+ SubscriptionRef.update(state, (value) => ({
1024
+ ...value,
1025
+ phase: "succeeded" as const,
1026
+ installedVersion: reuse.version,
1027
+ message: null,
1028
+ })),
1029
+ ),
1030
+ )
1031
+ ).pipe(
1032
+ Effect.mapError(
1033
+ wrapFailure("verify", "Could not verify the installed Antigravity runtime."),
1034
+ ),
1035
Effect.onExit((exit) =>
1036
Exit.isFailure(exit)
1037
? SubscriptionRef.update(state, (value) => {
@@ -1106,8 +1062,8 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
1062
running = { operationId, fiber };
1063
return next;
1064
}).pipe(Effect.uninterruptible),
1109
- )
1110
- .pipe(Effect.mapError(wrapFailure("start", "Could not start the Antigravity installation.")));
1065
+ );
1066
+ }).pipe(Effect.mapError(wrapFailure("start", "Could not start the Antigravity installation.")));
1067
1068
const cancel = Effect.fn("AntigravityInstallation.cancel")(function* (operationId: string) {
1069
return yield* gate.withPermit(
@@ -1164,7 +1120,6 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
1120
(current) =>
1121
({
1122
...current,
1167
- ...offer(null),
1123
operationId: null,
1124
phase: "idle",
1125
downloadedBytes: 0,
@@ -1190,10 +1145,8 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
1145
if (!(yield* fs.exists(activePath))) return;
1146
const active = yield* readRecord(activePath, ActiveRelease);
1147
const installed = yield* completedRelease(active.releaseId);
1193
- const kept = yield* keptInstall(installed.version);
1148
yield* SubscriptionRef.update(state, (current) => ({
1149
...current,
1196
- ...offer(kept),
1150
installedVersion: installed.version,
1151
}));
1152
}).pipe(
@@ -1218,7 +1171,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
1171
cancel,
1172
state: SubscriptionRef.get(state),
1173
changes: SubscriptionRef.changes(state),
1221
- checkForUpdate,
1174
+ checkForUpdate: refreshRelease().pipe(Effect.ignore),
1175
remove,
1176
});
1177
});
apps/server/src/provider/Drivers/AntigravityDriver.test.ts
+7
-1
@@ -426,7 +426,13 @@ it.layer(layerTest)("AntigravityDriver", (it) => {
426
modelSelection,
427
runtimePolicy: cliPolicy,
428
});
429
- expect(h.launches.at(-1)?.args).toEqual(["acp"]);
429
+ expect(h.launches.at(-1)?.args).toEqual([
430
+ "acp",
431
+ "--gemini-dir",
432
+ h.profileDirectory,
433
+ "--app-data-dir",
434
+ "antigravity-acp",
435
+ ]);
436
expect(
437
(yield* h.readRequests)
438
.slice(requestsBefore)
apps/server/src/provider/Drivers/AntigravityDriver.ts
+5
@@ -462,6 +462,11 @@ export const AntigravityDriver: ProviderDriver<
462
makeRuntime,
463
withProcess: authFlow.withProcess,
464
defaultModel,
465
+ supportsNativeGoals: provider.snapshot.getSnapshot.pipe(
466
+ Effect.map(
467
+ (snapshot) => snapshot.slashCommands?.some((command) => command.name === "goal") === true,
468
+ ),
469
+ ),
470
profileDirectory,
471
onSessionStarted: provider.onSessionStarted,
472
onSessionEvent: (event) => {
apps/server/src/provider/acp/AntigravityAcpSupport.test.ts
+20
-14
@@ -60,21 +60,25 @@ function makeModelRuntime(
60
61
describe("Antigravity release gates", () => {
62
it.each([
63
- { version: "1.4.1", filter: false, native: false, ownName: false },
64
- { version: "1.4.2", filter: true, native: false, ownName: false },
65
- { version: "1.4.4", filter: true, native: false, ownName: false },
66
- { version: "1.4.5", filter: true, native: true, ownName: false },
67
- { version: "1.4.6", filter: false, native: false, ownName: false },
68
- { version: "1.5.0", filter: false, native: false, ownName: false },
69
- { version: "1.5.1", filter: false, native: false, ownName: true },
70
- { version: "1.3.0", filter: false, native: false, ownName: false },
71
- { version: undefined, filter: false, native: false, ownName: false },
72
- { version: "unknown", filter: false, native: false, ownName: false },
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 },
74
])(
74
- "$version: workflow filter $filter, native reads and system prompt $native, own client name $ownName",
75
- ({ version, filter, native, ownName }) => {
75
+ "$version: workflow filter $filter, qualified reads $native, advertised system append $advertisedAppend, own client name $ownName",
76
+ ({ version, filter, native, ownName, advertisedAppend }) => {
77
const initialize = {
78
protocolVersion: 1,
79
+ ...(advertisedAppend
80
+ ? { agentCapabilities: { _meta: { antigravity: { systemPrompt: { append: true } } } } }
81
+ : {}),
82
...(version === undefined ? {} : { agentInfo: { name: "antigravity-acp", version } }),
83
};
84
// Helpers send no append, so only the workflow filter can apply.
@@ -83,10 +87,12 @@ describe("Antigravity release gates", () => {
87
);
88
const antigravity = {
89
...(filter ? { disabledTools: ["run_workflow"] } : {}),
86
- ...(native ? { systemPrompt: { append: "<pull_request_linking/>" } } : {}),
90
+ ...(native || advertisedAppend
91
+ ? { systemPrompt: { append: "<pull_request_linking/>" } }
92
+ : {}),
93
};
94
expect(antigravitySessionMeta(initialize, "<pull_request_linking/>")).toEqual(
89
- filter || native ? { antigravity } : undefined,
95
+ filter || native || advertisedAppend ? { antigravity } : undefined,
96
);
97
expect(isQualifiedAntigravityRelease(version)).toBe(native);
98
expect(antigravityClientInfo(version).name).toBe(ownName ? "t3-code" : "zed");
apps/server/src/provider/acp/AntigravityAcpSupport.ts
+10
-1
@@ -12,6 +12,7 @@ import * as Effect from "effect/Effect";
12
import * as FileSystem from "effect/FileSystem";
13
import * as Layer from "effect/Layer";
14
import * as Path from "effect/Path";
15
+import * as Predicate from "effect/Predicate";
16
import * as Scope from "effect/Scope";
17
import * as Stream from "effect/Stream";
18
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
@@ -94,7 +95,15 @@ const OPEN_MODEL_ACCESS_RELEASE = [1, 5, 1] as const;
95
*/
96
export const antigravityAppendsSystemPrompt = (
97
initializeResult: EffectAcpSchema.InitializeResponse,
97
-) => isQualifiedAntigravityRelease(initializeResult.agentInfo?.version);
98
+) => {
99
+ if (isQualifiedAntigravityRelease(initializeResult.agentInfo?.version)) return true;
100
+ const extension = initializeResult.agentCapabilities?._meta?.antigravity;
101
+ return (
102
+ Predicate.isObject(extension) &&
103
+ Predicate.isObject(extension.systemPrompt) &&
104
+ extension.systemPrompt.append === true
105
+ );
106
+};
107
108
export function antigravitySessionMeta(
109
initializeResult: EffectAcpSchema.InitializeResponse,
apps/server/src/provider/antigravityAuthSupport.test.ts
+7
-1
@@ -118,7 +118,13 @@ describe("Antigravity process environment", () => {
118
});
119
120
expect(spawn.command).toBe("/usr/bin/agy");
121
- expect(spawn.args).toEqual(["acp"]);
121
+ expect(spawn.args).toEqual([
122
+ "acp",
123
+ "--gemini-dir",
124
+ profile.geminiHome,
125
+ "--app-data-dir",
126
+ "antigravity-acp",
127
+ ]);
128
expect(spawn.env).not.toHaveProperty("ANTIGRAVITY_HARNESS_PATH");
129
expect(spawn.env).toMatchObject({ GEMINI_HOME: profile.geminiHome, PATH: "/usr/bin" });
130
});
apps/server/src/provider/antigravityAuthSupport.ts
+8
-1
@@ -467,7 +467,14 @@ export function buildAntigravityAcpSpawnInput(input: {
467
// The agy CLI has no harness sibling and serves ACP through its `acp` subcommand.
468
args:
469
input.installation.harnessPath === null
470
- ? ["acp"]
470
+ ? [
471
+ "acp",
472
+ "--gemini-dir",
473
+ input.profile.geminiHome,
474
+ "--app-data-dir",
475
+ // The CLI joins this beneath gemini-dir, including when the value is absolute.
476
+ "antigravity-acp",
477
+ ]
478
: input.profile.platform === "linux"
479
? ["--uid="]
480
: [],
apps/server/src/provider/antigravityCliRelease.test.ts
new
+51
@@ -0,0 +1,51 @@
1
+import { describe, expect, it } from "@effect/vitest";
2
+import { antigravityCliTarget, parseAntigravityCliRelease } from "./antigravityCliRelease.ts";
3
+
4
+const manifest = {
5
+ version: "1.5.7",
6
+ url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.7-123/darwin-arm/cli_mac_arm64.tar.gz",
7
+ sha512: "a".repeat(128),
8
+};
9
+
10
+describe("Antigravity CLI release manifests", () => {
11
+ it.each([
12
+ ["darwin", "arm64", false, "darwin_arm64", "darwin-arm/cli_mac_arm64.tar.gz"],
13
+ ["darwin", "x64", false, "darwin_amd64", "darwin-x64/cli_mac_x64.tar.gz"],
14
+ ["linux", "arm64", false, "linux_arm64", "linux-arm/cli_linux_arm64.tar.gz"],
15
+ ["linux", "x64", false, "linux_amd64", "linux-x64/cli_linux_x64.tar.gz"],
16
+ ["linux", "arm64", true, "linux_arm64_musl", "linux-arm-musl/cli_linux_arm64_musl.tar.gz"],
17
+ ["linux", "x64", true, "linux_amd64_musl", "linux-x64-musl/cli_linux_x64_musl.tar.gz"],
18
+ ["win32", "arm64", false, "windows_arm64", "windows-arm/cli_windows_arm64.exe"],
19
+ ["win32", "x64", false, "windows_amd64", "windows-x64/cli_windows_x64.exe"],
20
+ ] as const)("selects Google's %s-%s release (musl %s)", (platform, arch, musl, target, file) => {
21
+ expect(antigravityCliTarget(platform, arch, musl)).toBe(target);
22
+ expect(
23
+ parseAntigravityCliRelease(
24
+ {
25
+ ...manifest,
26
+ url: `https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.7-123/${file}`,
27
+ },
28
+ platform,
29
+ arch,
30
+ musl,
31
+ ),
32
+ ).toMatchObject({
33
+ version: "1.5.7",
34
+ format: platform === "win32" ? "executable" : "tar.gz",
35
+ executable: { name: platform === "win32" ? "agy.exe" : "antigravity" },
36
+ });
37
+ });
38
+
39
+ it.each([
40
+ { sha512: "invalid" },
41
+ { version: "1.4.5" },
42
+ { url: manifest.url.replace("https:", "http:") },
43
+ { url: manifest.url.replace("storage.googleapis.com", "storage.googleapis.com.evil.test") },
44
+ { url: manifest.url.replace("antigravity-public", "another-bucket") },
45
+ { url: manifest.url.replace("darwin-arm", "linux-arm") },
46
+ { url: `${manifest.url}?redirect=elsewhere` },
47
+ { url: manifest.url.replace("1.5.7-123", "1.5.6-123") },
48
+ ])("rejects invalid or mismatched release metadata: %j", (change) => {
49
+ expect(parseAntigravityCliRelease({ ...manifest, ...change }, "darwin", "arm64")).toBeNull();
50
+ });
51
+});
apps/server/src/provider/antigravityCliRelease.ts
new
+60
@@ -0,0 +1,60 @@
1
+import * as Schema from "effect/Schema";
2
+import { compareSemverVersions } from "@t3tools/shared/semver";
3
+
4
+export const ANTIGRAVITY_CLI_MANIFEST_BASE =
5
+ "https://antigravity-cli-auto-updater-974169037036.us-central1.run.app/manifests";
6
+
7
+const Manifest = Schema.Struct({
8
+ version: Schema.String.check(Schema.isPattern(/^\d+\.\d+\.\d+$/u)),
9
+ url: Schema.String,
10
+ sha512: Schema.String.check(Schema.isPattern(/^[a-fA-F0-9]{128}$/u)),
11
+});
12
+const decodeManifest = Schema.decodeUnknownOption(Manifest);
13
+
14
+export interface AntigravityCliReleaseAsset {
15
+ readonly version: string;
16
+ readonly url: string;
17
+ readonly sha512: string;
18
+ readonly executable: { readonly name: string };
19
+ readonly format: "tar.gz" | "executable";
20
+}
21
+
22
+export function antigravityCliTarget(platform: NodeJS.Platform, arch: string, musl = false) {
23
+ if (!["darwin", "linux", "win32"].includes(platform) || !["x64", "arm64"].includes(arch)) {
24
+ return null;
25
+ }
26
+ const os = platform === "win32" ? "windows" : platform;
27
+ return `${os}_${arch === "x64" ? "amd64" : arch}${platform === "linux" && musl ? "_musl" : ""}`;
28
+}
29
+
30
+export function parseAntigravityCliRelease(
31
+ value: unknown,
32
+ platform: NodeJS.Platform,
33
+ arch: string,
34
+ musl = false,
35
+): AntigravityCliReleaseAsset | null {
36
+ const decoded = decodeManifest(value);
37
+ if (decoded._tag === "None" || antigravityCliTarget(platform, arch, musl) === null) return null;
38
+ const manifest = decoded.value;
39
+ if (compareSemverVersions(manifest.version, "1.5.0") < 0) return null;
40
+ const os = platform === "darwin" ? "mac" : platform === "win32" ? "windows" : "linux";
41
+ const cpu = arch === "x64" ? "x64" : "arm64";
42
+ const suffix = platform === "linux" && musl ? "_musl" : "";
43
+ const extension = platform === "win32" ? "exe" : "tar.gz";
44
+ const folder = `${platform === "win32" ? "windows" : platform}-${arch === "arm64" ? "arm" : "x64"}${suffix ? "-musl" : ""}`;
45
+ const prefix = `https://storage.googleapis.com/antigravity-public/antigravity-cli/${manifest.version}-`;
46
+ const rest = manifest.url.startsWith(prefix) ? manifest.url.slice(prefix.length) : "";
47
+ if (
48
+ !/^\d+\//u.test(rest) ||
49
+ rest.replace(/^\d+\//u, "") !== `${folder}/cli_${os}_${cpu}${suffix}.${extension}`
50
+ ) {
51
+ return null;
52
+ }
53
+ return {
54
+ version: manifest.version,
55
+ url: manifest.url,
56
+ sha512: manifest.sha512.toLowerCase(),
57
+ executable: { name: platform === "win32" ? "agy.exe" : "antigravity" },
58
+ format: platform === "win32" ? "executable" : "tar.gz",
59
+ };
60
+}
apps/server/src/provider/antigravityRelease.ts
-92
@@ -1,7 +1,3 @@
1
-// Hashes and sizes match the official ACP registry release. Like 1.4.2 through 1.4.4, it writes a
2
-// run-workflow skill into the workspace unless T3 disables the tool (antigravitySessionMeta).
3
-const ANTIGRAVITY_RELEASE_VERSION = "1.4.5";
4
-
1
export interface AntigravityReleaseAsset {
2
readonly version: string;
3
readonly url: string;
@@ -16,91 +12,3 @@ export interface AntigravityReleaseAsset {
12
readonly bytes: number;
13
};
14
}
19
-
20
-/**
21
- * A newer release Google lists in the ACP Registry. The registry publishes no
22
- * hash or sizes, so the installer bounds the download, accepts only Google's
23
- * download host, and relies on the runtime's own handshake to identify it.
24
- */
25
-export interface AntigravityUpstreamRelease {
26
- readonly version: string;
27
- readonly url: string;
28
-}
29
-
30
-export type AntigravityRelease = AntigravityReleaseAsset | AntigravityUpstreamRelease;
31
-
32
-const releaseAssets = new Map<string, AntigravityReleaseAsset>([
33
- [
34
- "darwin-arm64",
35
- {
36
- version: ANTIGRAVITY_RELEASE_VERSION,
37
- url: "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-1.4.5-darwin-arm64.zip",
38
- sha256: "886fff7767d08994ca39eb02c3d01a7532c7325a94aa33aaf52d52068733284f",
39
- archiveBytes: 97_923_855,
40
- executable: { name: "agy_acp_server.par", bytes: 178_915_920 },
41
- harness: { name: "localharness_external", bytes: 122_957_936 },
42
- },
43
- ],
44
- [
45
- "darwin-x64",
46
- {
47
- version: ANTIGRAVITY_RELEASE_VERSION,
48
- url: "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-1.4.5-darwin-x86_64.zip",
49
- sha256: "b39f3573c03b9acb9df028853f647527f1f3133f32bd77e78b796e48a205114a",
50
- archiveBytes: 103_577_295,
51
- executable: { name: "agy_acp_server.par", bytes: 183_127_600 },
52
- harness: { name: "localharness_external", bytes: 127_612_208 },
53
- },
54
- ],
55
- [
56
- "linux-x64",
57
- {
58
- version: ANTIGRAVITY_RELEASE_VERSION,
59
- url: "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-1.4.5-linux-x86_64.zip",
60
- sha256: "923923a0d7dc8073f66cc6f78647a3107e3a7ee2b7e1a24df8b3927b5188013b",
61
- archiveBytes: 321_783_181,
62
- executable: { name: "agy_acp_server.par", bytes: 826_226_766 },
63
- harness: { name: "localharness_external", bytes: 133_926_136 },
64
- },
65
- ],
66
- [
67
- "linux-arm64",
68
- {
69
- version: ANTIGRAVITY_RELEASE_VERSION,
70
- url: "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-1.4.5-linux-arm64.zip",
71
- sha256: "7d64246633ae094f67e3bbcd2d679e89048f91346d5339313336e7483f40f056",
72
- archiveBytes: 307_829_008,
73
- executable: { name: "agy_acp_server.par", bytes: 831_194_025 },
74
- harness: { name: "localharness_external", bytes: 127_512_832 },
75
- },
76
- ],
77
- [
78
- "win32-x64",
79
- {
80
- version: ANTIGRAVITY_RELEASE_VERSION,
81
- url: "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-1.4.5-windows-x86_64.zip",
82
- sha256: "d24f4c73c9f96d4f44384e281c855a56c72d8eaa9c5b0fad7ccb1635c6b63f50",
83
- archiveBytes: 100_423_655,
84
- executable: { name: "agy_acp_server.exe", bytes: 55_839_864 },
85
- harness: { name: "localharness_external.exe", bytes: 147_843_736 },
86
- },
87
- ],
88
- [
89
- "win32-arm64",
90
- {
91
- version: ANTIGRAVITY_RELEASE_VERSION,
92
- url: "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-1.4.5-windows-arm64.zip",
93
- sha256: "ab0a9aac8349e08ef289be6d16da8f89e3abe60eba5158032ef78c4a1220261c",
94
- archiveBytes: 102_703_121,
95
- executable: { name: "agy_acp_server.exe", bytes: 62_293_488 },
96
- harness: { name: "localharness_external.exe", bytes: 139_322_008 },
97
- },
98
- ],
99
-]);
100
-
101
-export function resolveAntigravityReleaseAsset(
102
- platform: NodeJS.Platform,
103
- arch: string,
104
-): AntigravityReleaseAsset | null {
105
- return releaseAssets.get(`${platform}-${arch}`) ?? null;
106
-}
apps/server/src/provider/model-manifest.json
+3
-2
@@ -1,6 +1,6 @@
1
{
2
"version": 1,
3
- "updatedAt": "2026-11-10T17:25:47Z",
3
+ "updatedAt": "2026-11-12T18:25:36Z",
4
"compatibility": [
5
{
6
"driver": "codex",
@@ -75,8 +75,9 @@
75
{
76
"driver": "antigravity",
77
"t3CodeRange": ">=0.0.42",
78
- "recommendedRange": "=1.4.5 || =1.4.1",
78
+ "recommendedRange": ">=1.5.1 <2",
79
"ranges": [
80
+ { "range": ">=1.5.1 <2", "status": "supported" },
81
{ "range": "=1.4.5", "status": "supported" },
82
{ "range": "=1.4.1", "status": "supported" },
83
{ "range": "=1.3.0", "status": "supported" },
apps/server/src/provider/providerCompatibility.test.ts
+4
-9
@@ -22,7 +22,6 @@ import {
22
ProviderCompatibilityPolicy,
23
resolveProviderCompatibility,
24
} from "./providerCompatibility.ts";
25
-import { resolveAntigravityReleaseAsset } from "./antigravityRelease.ts";
25
import bundledManifest from "./model-manifest.json" with { type: "json" };
26
27
const decodeCompatibilityPolicies = Schema.decodeUnknownSync(
@@ -133,19 +132,15 @@ describe("provider compatibility", () => {
132
}
133
});
134
136
- it.each([
137
- ["darwin", "arm64"],
138
- ["win32", "x64"],
139
- ] as const)(
140
- "supports the managed Antigravity runtime for %s-%s in the bundled manifest",
141
- (platform, arch) => {
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);
143
- const release = resolveAntigravityReleaseAsset(platform, arch);
139
assert.strictEqual(
140
resolveProviderCompatibility(
141
policies,
142
ProviderDriverKind.make("antigravity"),
148
- `agy_acp_server_${release?.version}`,
143
+ `agy_acp_server_${version}`,
144
)?.status,
145
"supported",
146
);
apps/server/src/server.ts
+3
-1
@@ -713,7 +713,9 @@ const layerRuntimeCoreDependenciesBase = Layer.mergeAll(
713
Layer.provideMerge(layerPortScanner),
714
Layer.provideMerge(
715
Layer.mergeAll(
716
- AntigravityInstallation.AntigravityInstallation.layer,
716
+ AntigravityInstallation.AntigravityInstallation.layer.pipe(
717
+ Layer.provide(layerServerSettings),
718
+ ),
719
CodexInstallation.CodexInstallation.layer,
720
),
721
),
docs/user/providers-antigravity.md
+29
-11
@@ -1,7 +1,7 @@
1
# Antigravity
2
3
T3 Code runs Google's official Antigravity ACP agent on your selected environment.
4
-It has its own sign-in, separate from the Antigravity IDE or CLI. Google controls
4
+T3 manages its own CLI installation and sign-in, separate from your terminal or IDE. Google controls
5
which models and account access are available through this agent.
6
7
## Set up Antigravity
@@ -51,21 +51,29 @@ account.
51
52
## Runtime installation
53
54
-Managed installation supports Apple Silicon macOS, Linux x64 or ARM64, and Windows
55
-x64 or ARM64. Intel Macs can connect to a supported remote environment. Allow
56
-several GB of free disk space, especially on Linux.
54
+Managed installation supports Apple Silicon and Intel macOS, Linux x64 or ARM64
55
+with glibc or musl, and Windows x64 or ARM64. Allow at least 1.25 GiB of free disk
56
+space for downloading and staging an update.
57
58
### Use a manual installation
59
60
-Download the archive for your environment from the [official ACP Registry][registry].
61
-Extract the ACP executable and its `localharness_external` helper into the same
62
-directory, at the same version. Make both executable on macOS or Linux; Windows
63
-uses `.exe` files.
64
-
65
-Set **Binary path** to the ACP executable on the environment and update it yourself.
60
+Install [Antigravity CLI](https://antigravity.google/docs/getting-started) on the environment.
61
+Set **Binary path** to its `agy` executable and update it yourself.
62
Leave the field blank to use the managed runtime, or a compatible executable on
63
`PATH` if no managed runtime is installed.
64
65
+## Update the managed runtime
66
+
67
+In web or desktop provider settings, choose **Update Antigravity** when an update
68
+is available. T3 checks Google's CLI release channel while provider update checks
69
+are enabled. Installing or reinstalling also checks that channel. Updates keep
70
+your profile and existing runtime available if the new release fails validation.
71
+
72
+Updating an older 1.4.5 installation migrates it to the native CLI. You may need to
73
+sign in again after migration. Threads already running finish with their original
74
+runtime; new sessions use the updated release. Custom binary paths keep using the
75
+executable you selected.
76
+
77
## Models and threads
78
79
The model list comes from your Antigravity account, including Claude and GPT models
@@ -135,6 +143,17 @@ Before removing a managed runtime, disable its instances and cancel any active
143
installation. Clear any explicit binary path pointing into that runtime. Removal
144
is refused while the runtime is in use.
145
146
+## Run a native goal
147
+
148
+When your Antigravity runtime offers `/goal`, send `/goal` followed by a verifiable
149
+objective. Antigravity keeps working until it completes the goal or you cancel it.
150
+If you still use the older 1.4.5 runtime, update Antigravity in provider settings,
151
+then refresh provider status.
152
+
153
+Use Stop to interrupt a running goal, then ask Antigravity to stop pursuing it
154
+before starting more work. Ordinary follow-ups wait until the running turn ends.
155
+T3 does not support Antigravity goal status, pause, resume, or clear commands.
156
+
157
## Check access and troubleshoot
158
159
Open **Usage > Limits** to see the remaining Gemini and shared Claude/GPT allowances
@@ -152,5 +171,4 @@ If Google reports `SUBSCRIPTION_REQUIRED`, an account restriction, or a usage li
171
follow the provider's message and any retry time. See [Google's account plans][plans]
172
for eligibility.
173
155
-[registry]: https://github.com/agentclientprotocol/registry/blob/main/antigravity-acp/agent.json
174
[plans]: https://antigravity.google/docs/plans
packages/provider-acp-registry/src/server/AcpRegistrySupport.ts
+3
-4
@@ -48,10 +48,9 @@ import { collectUint8StreamText } from "@t3tools/provider-core/server/collectStr
48
import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
49
import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
50
51
-export const ACP_REGISTRY_URL =
52
- "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json";
51
+const ACP_REGISTRY_URL = "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json";
52
54
-export const MAX_REGISTRY_BYTES = 1024 * 1024;
53
+const MAX_REGISTRY_BYTES = 1024 * 1024;
54
const MAX_ARCHIVE_BYTES = 1024 * 1024 * 1024;
55
const MAX_COMMAND_OUTPUT_BYTES = 1024 * 1024;
56
// Archive listings can exceed the output of package-manager commands.
@@ -232,7 +231,7 @@ export type AcpRegistryPlatformTarget =
231
| "windows-aarch64"
232
| "windows-x86_64";
233
235
-export function resolveAcpRegistryPlatformTarget(
234
+function resolveAcpRegistryPlatformTarget(
235
platform: NodeJS.Platform,
236
architecture: NodeJS.Architecture,
237
): AcpRegistryPlatformTarget | undefined {
packages/provider-acp/src/server/adapter.ts
+16
-3
@@ -359,6 +359,7 @@ export interface AcpAdapterV2Flavor {
359
) => Effect.Effect<string, never, ChildProcessSpawner.ChildProcessSpawner>;
360
readonly driver: ProviderDriverKind;
361
readonly capabilities: OrchestrationV2ProviderCapabilities;
362
+ readonly supportsNativeGoals?: Effect.Effect<boolean>;
363
readonly clientCapabilitiesMeta?: NonNullable<
364
EffectAcpSchema.InitializeRequest["clientCapabilities"]
365
>["_meta"];
@@ -1754,11 +1755,22 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
1755
const postSettleContinuationEnabled =
1756
flavor.enablePostSettleContinuation === true && continuationRequests !== undefined;
1757
1758
+ const readCapabilities = Effect.gen(function* () {
1759
+ if (flavor.supportsNativeGoals === undefined) return flavor.capabilities;
1760
+ return {
1761
+ ...flavor.capabilities,
1762
+ turns: {
1763
+ ...flavor.capabilities.turns,
1764
+ supportsNativeGoals: yield* flavor.supportsNativeGoals,
1765
+ },
1766
+ };
1767
+ });
1768
+
1769
return ProviderAdapter.ProviderAdapterV2.of({
1770
instanceId: options.instanceId,
1771
driver,
1760
- getCapabilities: Effect.fn("AcpAdapter.getCapabilities")(function () {
1761
- return Effect.succeed(flavor.capabilities);
1772
+ getCapabilities: Effect.fn("AcpAdapter.getCapabilities")(function* () {
1773
+ return yield* readCapabilities;
1774
}),
1775
planSelectionTransition: Effect.fn("AcpAdapter.planSelectionTransition")(function (input) {
1776
return Effect.succeed(acpSelectionTransition(input));
@@ -7217,8 +7229,9 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
7229
yield* Ref.set(activeSessionId, started.sessionId);
7230
yield* setActiveSessionSetup(started);
7231
rememberTerminalEnvironment(started.sessionId, yield* readMcpContext(input.threadId));
7232
+ yield* runtime.drainEvents;
7233
const capabilities = negotiatedCapabilities(
7221
- flavor.capabilities,
7234
+ yield* readCapabilities,
7235
started,
7236
flavor.modelOptionArrivesLate === true,
7237
flavor.forkFromTurn?.supported(started.initializeResult) === true,