Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Antigravity: Google's native CLI end to end, chosen per account (carries #7140) (#7271)

Milind Soni1b7f33c39acb
diff --git a/apps/docs/content/docs/providers/antigravity.mdx b/apps/docs/content/docs/providers/antigravity.mdx
index 6ecfec9578..aeacf4e9f0 100644
--- a/apps/docs/content/docs/providers/antigravity.mdx
+++ b/apps/docs/content/docs/providers/antigravity.mdx
@@ -39,17 +39,22 @@ Antigravity uses the same MausBot approval cards as other ACP engines. Connected
The normal mode asks before protected actions. Full access maps to Antigravity's native `yolo` mode, but native questions still wait for a person instead of being guessed automatically.
-## Trying Google's native Antigravity CLI (opt-in)
+## Google Antigravity CLI or Classic runtime
-MausBot can run Google's newer native Antigravity CLI (1.5 or later, `agy acp`) instead of the packaged 1.4.3 runtime. It is one program of about 220 MB on a Mac and 275 MB on Linux, instead of about 400 MB and 1 GB, and starts much faster. It is **off by default** for two reasons: its Google sign-in has not yet been tried with a real account in MausBot, and it keeps the sign-in in a different file, so **every Antigravity account signs in with Google once more** after the switch.
+MausBot runs Antigravity on one of two runtimes, chosen for each Antigravity account under **Runs on** on its card in Settings:
-To try it on one server or computer:
+- **Google Antigravity CLI**: Google's native CLI (1.5 or later). One program of about 220 MB on a Mac and 275 MB on Linux, which starts much faster.
+- **Classic runtime**: the packaged 1.4.3 runtime MausBot has used so far, about 400 MB on a Mac and 1 GB on Linux.
-1. Start MausBot with `OMB_ANTIGRAVITY_NATIVE_CLI=1` in its environment, then restart it. (The setting is read when MausBot starts.)
-2. A few minutes later, while no bot is working, the engine updater installs the CLI from Google's update channel, checked against the SHA-512 that channel names. On a computer with no Antigravity runtime yet, **Install official Antigravity** on the account card installs the CLI instead.
-3. The account card shows **Sign in with Google**. Sign in in your browser. Google's Antigravity page then shows a code: paste it into **Code from the Antigravity page** on the card and select **Send code**.
-4. Send a bot on that account a message and check that it answers.
+A new install takes the Google Antigravity CLI. A computer that already has the Classic runtime keeps it, and nothing changes for its accounts until you choose the CLI under **Runs on**. The two runtimes keep their Google sign-ins in different files, so an account signs in with Google once more the first time it runs on the other one; switching back finds its earlier sign-in.
-With the CLI on, MausBot updates it itself (a few minutes after it starts, then once a day), keeps its release folder read-only, turns the CLI's own self-update off, and starts it so that each account keeps its sign-in in its own folder. The CLI always runs in its `default` mode and MausBot answers its requests by the bot's approval level. Once an account on that computer has signed in on the CLI, the 1.4.3 runtime is removed from disk.
+To move an account to the CLI:
+
+1. Choose **Google Antigravity CLI** under **Runs on**, then **Install Google Antigravity CLI** if the card offers it. The CLI comes from Google's update channel, checked against the SHA-512 that channel names.
+2. Select **Sign in with Google** and sign in in your browser. Google's page then shows a code: paste it, or the full address of that page, into the card and select **Send code**.
+3. Send a bot on that account a message and check that it answers.
+
+MausBot updates the CLI itself (a few minutes after it starts, then once a day), keeps its release folder read-only, turns the CLI's own self-update off, and starts it so that each account keeps its sign-in in its own folder: two accounts can be two Google accounts, and a sign-in of the Antigravity CLI in a terminal is neither used nor signed out. The CLI always runs in its `default` mode and MausBot answers its requests by the bot's approval level. The Classic runtime stays on disk.
+
+A server or Cloud started with `OMB_ANTIGRAVITY_NATIVE_CLI=1` in its environment runs the CLI for every account that has not chosen a runtime, even where the Classic runtime is installed: the engine updater installs the CLI there while no bot is working. An account set to **Classic runtime** keeps it. The setting is read when MausBot starts.
-To go back, remove `OMB_ANTIGRAVITY_NATIVE_CLI` and restart. Accounts use their 1.4.3 sign-in again if it is still there; MausBot keeps it during the switch. If 1.4.3 was already removed, **Install official Antigravity** downloads it again (about 340 MB on Linux).
diff --git a/docs/approval-levels.md b/docs/approval-levels.md
index 1a00d4d1eb..f9a9e0a671 100644
--- a/docs/approval-levels.md
+++ b/docs/approval-levels.md
@@ -333,11 +333,21 @@ inside the turn's folder: one that names a command, gives no location, or
reaches outside that folder is asked as usual. A turn fails rather than start
when the CLI offers no mode or does not confirm `default`.
-A computer that already has the pinned runtime keeps it. To move an
-Antigravity account to the native CLI, set its **CLI path** to `antigravity`
-and choose **Install official Antigravity**; to move back, set the CLI path to
-`agy`. New installs get the native CLI when Google's channel can be reached and
-the pinned runtime otherwise.
+A new install takes the native CLI; a computer that already has the pinned
+runtime keeps it. To move an Antigravity account to the native CLI, choose
+**Google Antigravity CLI** under **Runs on** (its CLI path becomes `antigravity`)
+and **Install Google Antigravity CLI**; to move back, choose **Classic runtime**
+(`agy_acp_server`), which runs the pinned runtime alone. An account with no CLI
+path, or `agy`, runs the pinned runtime when it is installed, and the native CLI
+otherwise. The native CLI signs in through its own
+`acp --login`: the link opens Google, and the code or address the page ends on
+is pasted back into the sign-in card. The app starts the native CLI as if over
+SSH, so each account keeps its own Google sign-in in its own folder, as on the
+pinned runtime, and the OS keyring and the Antigravity CLI in a terminal are
+never touched. Signing out or removing an account ends that account's sign-in
+alone. A server started with `OMB_ANTIGRAVITY_NATIVE_CLI=1` runs the native CLI
+for every account with no CLI path, or `agy`, even where the pinned runtime is
+installed; an account set under **Runs on** keeps its choice.
A new Antigravity bot starts on Auto, the default. Old Antigravity
`auto` / `autoApprove` settings still behave as Ask and are displayed as Ask;
diff --git a/docs/pr-screenshots/antigravity-native-cli/1-after-card-daylight.png b/docs/pr-screenshots/antigravity-native-cli/1-after-card-daylight.png
new file mode 100644
index 0000000000..c7caafa1ff
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/1-after-card-daylight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/1-after-card-midnight.png b/docs/pr-screenshots/antigravity-native-cli/1-after-card-midnight.png
new file mode 100644
index 0000000000..c28eba44cc
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/1-after-card-midnight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/1-before-card-daylight.png b/docs/pr-screenshots/antigravity-native-cli/1-before-card-daylight.png
new file mode 100644
index 0000000000..d0a34723aa
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/1-before-card-daylight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/1-before-card-midnight.png b/docs/pr-screenshots/antigravity-native-cli/1-before-card-midnight.png
new file mode 100644
index 0000000000..0e0b590a5f
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/1-before-card-midnight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/2-after-install-daylight.png b/docs/pr-screenshots/antigravity-native-cli/2-after-install-daylight.png
new file mode 100644
index 0000000000..88eb5fcc49
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/2-after-install-daylight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/2-after-install-midnight.png b/docs/pr-screenshots/antigravity-native-cli/2-after-install-midnight.png
new file mode 100644
index 0000000000..db7b3da809
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/2-after-install-midnight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/2-before-install-daylight.png b/docs/pr-screenshots/antigravity-native-cli/2-before-install-daylight.png
new file mode 100644
index 0000000000..a7aad89902
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/2-before-install-daylight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/2-before-install-midnight.png b/docs/pr-screenshots/antigravity-native-cli/2-before-install-midnight.png
new file mode 100644
index 0000000000..7951a3383f
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/2-before-install-midnight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/3-after-signin-daylight.png b/docs/pr-screenshots/antigravity-native-cli/3-after-signin-daylight.png
new file mode 100644
index 0000000000..df30b6ff9c
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/3-after-signin-daylight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/3-after-signin-midnight.png b/docs/pr-screenshots/antigravity-native-cli/3-after-signin-midnight.png
new file mode 100644
index 0000000000..fb9afe2a6d
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/3-after-signin-midnight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/3-before-signin-daylight.png b/docs/pr-screenshots/antigravity-native-cli/3-before-signin-daylight.png
new file mode 100644
index 0000000000..1645f8a34b
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/3-before-signin-daylight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/3-before-signin-midnight.png b/docs/pr-screenshots/antigravity-native-cli/3-before-signin-midnight.png
new file mode 100644
index 0000000000..8a90c90176
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/3-before-signin-midnight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/4-after-signedin-daylight.png b/docs/pr-screenshots/antigravity-native-cli/4-after-signedin-daylight.png
new file mode 100644
index 0000000000..58756282ca
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/4-after-signedin-daylight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/4-after-signedin-midnight.png b/docs/pr-screenshots/antigravity-native-cli/4-after-signedin-midnight.png
new file mode 100644
index 0000000000..4c6653b683
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/4-after-signedin-midnight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/4-before-signedin-daylight.png b/docs/pr-screenshots/antigravity-native-cli/4-before-signedin-daylight.png
new file mode 100644
index 0000000000..1659e22bb0
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/4-before-signedin-daylight.png differ
diff --git a/docs/pr-screenshots/antigravity-native-cli/4-before-signedin-midnight.png b/docs/pr-screenshots/antigravity-native-cli/4-before-signedin-midnight.png
new file mode 100644
index 0000000000..3e9adfd72d
Binary files /dev/null and b/docs/pr-screenshots/antigravity-native-cli/4-before-signedin-midnight.png differ
diff --git a/server/cli-probe-antigravity.test.ts b/server/cli-probe-antigravity.test.ts
new file mode 100644
index 0000000000..7fe9148d0f
--- /dev/null
+++ b/server/cli-probe-antigravity.test.ts
@@ -0,0 +1,21 @@
+import { rmSync } from "node:fs";
+import { join } from "node:path";
+import { afterEach, expect, it } from "vitest";
+
+import { testCliBinary } from "./cli-probe.ts";
+import { DATA_DIR } from "./config.ts";
+import { AntigravityDriver } from "./drivers/antigravity.ts";
+import { antigravityRuntimesRoot } from "./engine-roots.ts";
+import { installFakeManagedCli } from "./testing/antigravity-native-fixture.ts";
+
+afterEach(() => rmSync(join(antigravityRuntimesRoot(DATA_DIR), `${process.platform}-${process.arch}`), { recursive: true, force: true }));
+
+it("accepts the path antigravity for an Antigravity account before the app installs the CLI, and reports its version after", async () => {
+ await expect(testCliBinary("antigravity", AntigravityDriver)).resolves.toEqual({ ok: true });
+ installFakeManagedCli(DATA_DIR);
+ await expect(testCliBinary("antigravity", AntigravityDriver)).resolves.toEqual({ ok: true, version: "1.5.14" });
+});
+
+it("accepts the path that asks for the pinned runtime for an Antigravity account before the app installs it", async () => {
+ await expect(testCliBinary("agy_acp_server", AntigravityDriver)).resolves.toEqual({ ok: true });
+});
diff --git a/server/cli-probe.ts b/server/cli-probe.ts
index 9275f93e91..3fafb3a8aa 100644
--- a/server/cli-probe.ts
+++ b/server/cli-probe.ts
@@ -6,10 +6,20 @@ import { notThisCli } from "./drivers/acp/version-probe.ts";
import { augmentedPath } from "./env-path.ts";
import { describeSpawnFailure, execCli } from "./procs.ts";
-export async function testCliBinary(
- cli: string,
- driver: (typeof BUILT_IN_DRIVERS)[number] | undefined,
-): Promise<{ ok: boolean; version?: string; message?: string; install?: (typeof BUILT_IN_DRIVERS)[number]["install"] }> {
+type CliTestResult = { ok: boolean; version?: string; message?: string; install?: (typeof BUILT_IN_DRIVERS)[number]["install"] };
+
+export async function testCliBinary(cli: string, driver: (typeof BUILT_IN_DRIVERS)[number] | undefined): Promise<CliTestResult> {
+ if (driver?.driverKind === "antigravityAgent") {
+ const antigravity = await import("./drivers/antigravity-runtime.ts");
+ if (antigravity.isAntigravityNativeAlias(cli) || antigravity.isAntigravityPinnedAlias(cli)) {
+ const appInstalled = await antigravity.resolveAntigravityRuntime(cli, cliProbeEnvironment()).catch(() => null);
+ return { ok: true, ...(appInstalled?.version ? { version: appInstalled.version } : {}) };
+ }
+ }
+ return runVersion(cli, driver);
+}
+
+function runVersion(cli: string, driver: (typeof BUILT_IN_DRIVERS)[number] | undefined): Promise<CliTestResult> {
return new Promise((resolve) => {
execCli(
cli,
diff --git a/server/cloud-home-start.ts b/server/cloud-home-start.ts
index f0ebf8a912..d0f8c2d7d9 100644
--- a/server/cloud-home-start.ts
+++ b/server/cloud-home-start.ts
@@ -34,6 +34,9 @@ export function passwdIds(passwd: string, name: string): { uid: number; gid: num
* gives the server belongs here too (docker-image.test.ts checks): without OMB_DUCKDB_DIR the server found neither the
* 1Password SDK nor DuckDB, which the image keeps in /app/duckdb, and said 1Password was "not available in this build". */
const SERVER_ENV_NAMES = new Set([
+ // Antigravity accounts with no runtime of their own run Google's native CLI (server/drivers/antigravity-cli-install.ts):
+ // the Admin or a test home sets it, and without the name here a Cloud home could never turn it on.
+ "OMB_ANTIGRAVITY_NATIVE_CLI",
"PATH", "SHELL", "HOSTNAME", "LANG", "LANGUAGE", "TZ", "TERM", "TMPDIR", "NO_COLOR", "NODE_ENV", "NODE_EXTRA_CA_CERTS", "SSL_CERT_FILE", "SSL_CERT_DIR",
"AGENT_BROWSER_EXECUTABLE_PATH", "OMB_STATIC_DIR", "OMB_DATA_DIR", "OMB_DUCKDB_DIR",
"OMB_CLOUD_ROLE", "OMB_CLOUD_MACHINE_ID", "OMB_CLOUD_ADMIN_URL", "OMB_CLOUD_IMAGE", "OMB_PUBLIC_URL", "OMB_WEBHOOK_PUBLIC_URL",
diff --git a/server/cloud-home.test.ts b/server/cloud-home.test.ts
index 7e8cfed2d8..534fb4f4cc 100644
--- a/server/cloud-home.test.ts
+++ b/server/cloud-home.test.ts
@@ -396,6 +396,8 @@ it("gives the edge only its routing name and the server the contract, never a ga
// The bot box and image-engines switches reach the server; an unknown name does not.
expect(cloudHomeChildEnvironments(config, { ...withGateway(), PATH: "/usr/bin", OMB_BOT_BOX: "0", OMB_IMAGE_ENGINES: "1", OMB_SOMETHING_ELSE: "x" }, "/data").server).toMatchObject({ OMB_BOT_BOX: "0", OMB_IMAGE_ENGINES: "1" });
expect(cloudHomeChildEnvironments(config, { ...withGateway(), PATH: "/usr/bin", OMB_SOMETHING_ELSE: "x" }, "/data").server).not.toHaveProperty("OMB_SOMETHING_ELSE");
+ // So does the switch that gives Antigravity accounts Google's native CLI, which a Cloud home could otherwise never turn on.
+ expect(cloudHomeChildEnvironments(config, { ...withGateway(), PATH: "/usr/bin", OMB_ANTIGRAVITY_NATIVE_CLI: "1" }, "/data").server).toMatchObject({ OMB_ANTIGRAVITY_NATIVE_CLI: "1" });
expect(JSON.stringify(server)).not.toContain(token);
expect(secrets).toEqual({ OMB_CLOUD_BOOTSTRAP_SECRET: secret, ...relay });
for (const value of Object.values(secrets)) {
diff --git a/server/contracts.ts b/server/contracts.ts
index 7f98a9b416..e170a19a02 100644
--- a/server/contracts.ts
+++ b/server/contracts.ts
@@ -393,6 +393,8 @@ export interface ProviderSnapshot {
authenticated?: boolean;
/** The CLI path runs another program: it answered --version as something other than this engine's own CLI. */
notEngineCli?: true;
+ /** The account runs Google's native Antigravity CLI, not the pinned (Classic) runtime. */
+ nativeCli?: true;
/** Display identity from the provider CLI, never credentials; `method` is a personal login or the workspace API key. */
account?: { email?: string; organization?: string; method?: "login" | "api-key" };
version?: string | null;
@@ -504,8 +506,9 @@ export interface ProviderAuthenticationStart {
expiresAt: string | null;
/** A short-lived code to enter only at the provider's authorization URL. */
userCode?: string;
- /** The provider's page shows a code after the sign-in, which the person pastes back (Antigravity's native CLI). */
- pasteCode?: boolean;
+ /** `pasted-code`: the page the link leads to ends on a code (or an address holding it) that the person pastes back, and
+ * not on a redirect to this computer. */
+ kind?: "pasted-code";
}
export interface ProviderAuthenticationStatus extends Omit<ProviderAuthenticationStart, "phase"> {
@@ -628,6 +631,8 @@ export interface ProviderInstance {
readonly cancelAuthentication?: () => Promise<void>;
/** Remove the provider CLI's stored sign-in on this server; never touches another instance's home. */
readonly signOut?: () => Promise<void>;
+ /** Drops what was last learned about this instance's sign-in, so the next read asks the engine again. */
+ readonly forgetAuthentication?: () => void;
readonly adapter: ProviderAdapter;
snapshot(): Promise<ProviderSnapshot>;
/** Cheap one-shot text call (titles, summaries); the signal is a best-effort cap. */
diff --git a/server/drivers/acp/background-text.ts b/server/drivers/acp/background-text.ts
index 289164b071..b72a419616 100644
--- a/server/drivers/acp/background-text.ts
+++ b/server/drivers/acp/background-text.ts
@@ -61,6 +61,8 @@ export interface AcpOneShotInput {
pickAuthMethod: (methods: Array<{ id?: string }>) => string | null;
authRequired: boolean | "if-requested";
loginNote: string;
+ /** Whether a session/new refusal asks for a sign-in; it then fails with `loginNote`. */
+ signInRefused?: (error: unknown) => boolean;
clientCapabilitiesMeta?: Record<string, unknown>;
configure?: (ctx: { request: (method: string, params: unknown, timeoutMs?: number) => Promise<any>; sessionId: string; session: any }) => Promise<void>;
options?: TextGenerationOptions;
@@ -127,7 +129,7 @@ export function runAcpOneShot(input: AcpOneShotInput): Promise<string> {
const waiter = pending.get(msg.id);
pending.delete(msg.id);
if (!waiter) return;
- if (msg.error) waiter.reject(new Error(`${name} background ${typeof msg.error?.message === "string" ? msg.error.message.slice(0, 200) : "request failed"}`));
+ if (msg.error) waiter.reject(Object.assign(new Error(`${name} background ${typeof msg.error?.message === "string" ? msg.error.message.slice(0, 200) : "request failed"}`), { code: msg.error?.code, data: msg.error?.data }));
else waiter.resolve(msg.result);
return;
}
@@ -201,7 +203,7 @@ export function runAcpOneShot(input: AcpOneShotInput): Promise<string> {
} else if (input.authRequired === true) {
throw new Error(input.loginNote);
}
- const session = await request("session/new", { cwd: input.cwd, mcpServers: [] });
+ const session = await request("session/new", { cwd: input.cwd, mcpServers: [] }).catch((error: unknown) => { throw input.signInRefused?.(error) ? new Error(input.loginNote) : error; });
if (typeof session?.sessionId !== "string") throw new Error(`${name} background session/new returned no sessionId`);
sessionId = session.sessionId;
model = typeof session?.models?.currentModelId === "string" ? session.models.currentModelId
diff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.ts
index e81ab88c47..ec0392a794 100644
--- a/server/drivers/acp/core.ts
+++ b/server/drivers/acp/core.ts
@@ -18,7 +18,8 @@ import { acpDiscoveryProblem } from "./custom-model-catalog.ts";
import { decodeInjectId } from "../local-inject.ts";
import { DeviceAuthController, deviceAuthInstanceSurface, type DeviceSignIn } from "../device-auth.ts";
import { AcpBrowserAuth, acpBrowserAuthInstanceSurface, type AcpBrowserSignInSpec } from "./browser-auth.ts";
-import { deletePromptSplitReceipt, promptHalves, readPromptSplitReceipt, splitSessionPrompt, writePromptSplitReceipt } from "../prompt-split.ts";
+import { deletePromptSplitReceipt, writePromptSplitReceipt } from "../prompt-split.ts";
+import { liveSessionKey, sessionSystem, turnPrompt } from "./session-system.ts";
import type { PromptSplitReceipt } from "../prompt-split.ts";
import { boxAudienceKey, describeSpawnFailure, execCli, killCliTree, sharedBoxScope, spawnCli } from "../../procs.ts"; import { stopEngineTree, stopEngineTrees } from "../../engine-stop.ts";
import { applyOneShotEnv, runAcpOneShot } from "./background-text.ts"; import type { AcpBackgroundWork } from "./background-work.ts";
@@ -956,7 +957,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
const pooled = sessions.get(threadId);
let session: AcpSession;
if (pooled && !pooled.dead && !pooled.closing && pooled.contractKey === contractKey && !stderrFailureOf(pooled.host)
- && (!support.restartOnMcpChange || pooled.sessionKey === sessionKey)) {
+ && (!support.restartOnMcpChange || pooled.sessionKey === liveSessionKey(sessionKey, sessionSystem(support, pooled.initResult, instanceId, turn)))) {
stopIdleClose(`${instanceId}\0${threadId}`, pooled.idleTimer); // busy again: no longer idle
pooled.idleTimer = null;
session = pooled;
@@ -1088,7 +1089,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
INIT_TIMEOUT,
));
}
- if (!skipSubscriptionAuthForLocalInject(turn.model) && !session.authenticated) {
+ if (!skipSubscriptionAuthForLocalInject(turn.model) && !session.authenticated && !support.skipsAuthenticate?.(instanceId)) {
const methods: Array<{ id?: string }> = Array.isArray(session.initResult?.authMethods)
? session.initResult.authMethods
: [];
@@ -1116,13 +1117,14 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
};
let runtimeAcceptsImages = await handshake();
let init = session.initResult;
+ const heldSystem = () => sessionSystem(support, init, instanceId, turn);
await backgroundEnds.get(threadId); const cursor = turn.sessionReset ? null : support.backgroundWork ? support.backgroundWork.resumeCursor(turn.resumeCursor, session.sessionId, session) : typeof turn.resumeCursor === "string" ? turn.resumeCursor : null;
let promptTurn = turn;
let rebuiltFromReplay = false;
for (;;) {
const liveSessionId = session.sessionId;
- if (liveSessionId !== null && session.sessionKey === sessionKey && (cursor === null || cursor === liveSessionId)) {
+ if (liveSessionId !== null && session.sessionKey === liveSessionKey(sessionKey, heldSystem()) && (cursor === null || cursor === liveSessionId)) {
break;
}
const selectionParams = narrowsNativeTools(turn.toolScope)
@@ -1134,13 +1136,13 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
link: session.acp, sessionId: cursor, quietMs: support.loadReplayQuietMs?.(turn), replayed: () => session.sessionConfigResult ?? {},
send: (receive) => request(
support.resumeMethod === "resume" ? "session/resume" : "session/load",
- { sessionId: cursor, cwd, mcpServers: support.mcpServersFromLaunch ? [] : acpSessionMcpServers(mcpServers, ownMcp, init), ...selectionParams, ...support.sessionSetupParams?.(init) },
+ { sessionId: cursor, cwd, mcpServers: support.mcpServersFromLaunch ? [] : acpSessionMcpServers(mcpServers, ownMcp, init), ...selectionParams, ...support.sessionSetupParams?.(init, heldSystem()) },
support.sessionSetupTimeoutMs ?? LOAD_SESSION_TIMEOUT, receive),
receive: (result) => {
if (result) {
loaded = true;
session.sessionId = cursor;
- session.sessionKey = sessionKey;
+ session.sessionKey = liveSessionKey(sessionKey, heldSystem());
receiveModelVariants(result, true);
}
},
@@ -1177,9 +1179,9 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
promptTurn = { ...turn, text: recovery.text };
rebuiltFromReplay = recovery.replayed;
}
- await request("session/new", { cwd, mcpServers: support.mcpServersFromLaunch ? [] : acpSessionMcpServers(mcpServers, ownMcp, init), ...selectionParams, ...support.sessionSetupParams?.(init) }, support.sessionSetupTimeoutMs ?? NEW_SESSION_TIMEOUT, (result) => {
+ await request("session/new", { cwd, mcpServers: support.mcpServersFromLaunch ? [] : acpSessionMcpServers(mcpServers, ownMcp, init), ...selectionParams, ...support.sessionSetupParams?.(init, heldSystem()) }, support.sessionSetupTimeoutMs ?? NEW_SESSION_TIMEOUT, (result) => {
session.sessionId = typeof result?.sessionId === "string" ? result.sessionId : null;
- session.sessionKey = sessionKey;
+ session.sessionKey = liveSessionKey(sessionKey, heldSystem());
receiveModelVariants(result, true);
});
break;
@@ -1268,24 +1270,8 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
throw error;
}
emitSessionStarted();
- const halves = promptHalves(turn);
- let promptInput = promptTurn;
- if (halves.stable !== null) {
- const receiptKey = JSON.stringify([threadId, sessionId]);
- const previousReceipt = readPromptSplitReceipt(DRIVER_KIND, receiptKey);
- state.usagePeak = previousReceipt?.peakUsed ?? previousReceipt?.lastUsed ?? null;
- const composed = splitSessionPrompt(
- halves.stable,
- halves.volatile,
- previousReceipt,
- promptTurn.system,
- promptTurn.text,
- Boolean(turn.mentionTurn),
- ACP_PROMPT_RE_ANCHOR_TURNS,
- );
- promptInput = { ...promptTurn, system: "", text: composed.text };
- pendingSplitReceipt = { key: receiptKey, receipt: composed.receipt, previous: previousReceipt };
- }
+ const { input: promptInput, note: contextNote, split } = turnPrompt(DRIVER_KIND, { threadId, sessionId }, turn, promptTurn, heldSystem(), ACP_PROMPT_RE_ANCHOR_TURNS);
+ if (split) { state.usagePeak = split.previous?.peakUsed ?? split.previous?.lastUsed ?? null; pendingSplitReceipt = split; }
const text = support.buildPromptText
? support.buildPromptText(promptInput)
: promptInput.system
@@ -1307,7 +1293,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
const quiet = startQuietWatch(threadId, session, current);
const result = await request(
"session/prompt",
- { sessionId, prompt: [{ type: "text", text: text + media.note }, ...imageBlocks, ...media.blocks] },
+ { sessionId, prompt: [{ type: "text", text: text + media.note }, ...imageBlocks, ...media.blocks, ...(contextNote ? [{ type: "text", text: contextNote }] : [])] },
undefined,
undefined,
promptIdleMs,
@@ -1480,16 +1466,16 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
const spawnEnv = launch.env ?? env;
return await runAcpOneShot({
displayName: support.displayName,
- spawn: spawnCli, kill: killCliTree, box: { allowEnv: instanceEnvNames(input.environment, spawnEnv), ro: launch.ro },
+ spawn: (...args) => { const child = spawnCli(...args); support.processStarted?.(child, instanceId); return child; }, kill: killCliTree, box: { allowEnv: instanceEnvNames(input.environment, spawnEnv), ro: launch.ro },
command: launch.command,
argv: [...(launch.args ?? []), ...support.spawnArgs(turnConfig, turn)],
env: spawnEnv,
cwd,
prompt,
defaultModel: catalog.models.default, model,
- pickAuthMethod: (methods) => support.pickAuthMethod(methods, spawnEnv),
- authRequired: support.authFailure === "fail-request" ? "if-requested" : support.authFailure === "fail",
- loginNote: support.loginNote,
+ pickAuthMethod: (methods) => support.skipsAuthenticate?.(instanceId) ? null : support.pickAuthMethod(methods, spawnEnv),
+ authRequired: !support.skipsAuthenticate?.(instanceId) && (support.authFailure === "fail-request" ? "if-requested" : support.authFailure === "fail"),
+ loginNote: support.loginNote, signInRefused: support.skipsAuthenticate?.(instanceId) && support.signInRequest ? (error) => { const refused = support.signInRequest!.rpcError(error, instanceId); if (refused) support.signInRequest!.required(instanceId); return refused; } : undefined,
clientCapabilitiesMeta: support.clientCapabilitiesMeta,
...(support.configureSession ? {
configure: ({ request, sessionId, session }) => support.configureSession!({
diff --git a/server/drivers/acp/driver-hooks.ts b/server/drivers/acp/driver-hooks.ts
index bf3cd14157..3b399ce4b1 100644
--- a/server/drivers/acp/driver-hooks.ts
+++ b/server/drivers/acp/driver-hooks.ts
@@ -17,18 +17,26 @@ export interface AcpDriverHooks {
/** Whether a whole stderr line announces the request. */
stderrLine(line: string): boolean;
/** Whether a request's error means the same. */
- rpcError(error: unknown): boolean;
+ rpcError(error: unknown, instanceId: string): boolean;
required(instanceId: string): void;
};
- /** Every agent process the driver starts for turns. */
+ /** Whether this instance's agent is never sent `authenticate`, because it answers by opening a browser nobody sees: its
+ * turns, background text and model discovery start the session directly, and a session it refuses for want of a sign-in
+ * fails as a sign-in request. */
+ skipsAuthenticate?(instanceId: string): boolean;
+ /** Every agent process the driver starts for turns and background text. */
processStarted?(child: ChildProcess, instanceId: string): void;
- /** Extra session/new, session/load and session/resume parameters, from the agent's initialize answer. */
- sessionSetupParams?(initializeResult: unknown): Record<string, unknown>;
+ /** Extra session/new, session/load and session/resume parameters, from the agent's initialize answer. `system` is the
+ * session's system prompt when sessionSystemPrompt holds. */
+ sessionSetupParams?(initializeResult: unknown, system?: string): Record<string, unknown>;
+ /** Whether this instance's agent takes the system prompt through sessionSetupParams instead of in the prompt text, where
+ * it would read words of it as the person's commands. A changed system prompt then loads the live session again. */
+ sessionSystemPrompt?(initializeResult: unknown, instanceId: string): boolean;
/** The `clientInfo` of initialize, for an agent that reads it; the app's own name when unset or undefined. */
clientInfo?(instanceId: string): { name: string; version: string } | undefined;
/** Whether the driver answers this permission request with "allow" itself, with no card: for an agent that asks
* about actions the turn's approval level already covers. Never consulted for a question or a never-list command. */
- allowsAlone?(instanceId: string, turn: { approvalMode?: string; cwd?: string }, toolCall: { kind?: unknown; rawInput?: unknown; locations?: unknown }): boolean;
+ allowsAlone?(instanceId: string, turn: { approvalMode?: string; approvalModeNow?: () => string; cwd?: string }, toolCall: { kind?: unknown; rawInput?: unknown; locations?: unknown }): boolean;
/** Called before each session/prompt. The check it returns gets that prompt's result and names the failure the agent
* reported as an ordinary reply, which then fails the turn. Neither may throw. */
promptOutcome?(instanceId: string, sessionId: string): Promise<(result: unknown) => Promise<Error | undefined>>;
@@ -107,7 +115,7 @@ export class SignInRequests {
/** The sign-in failure `error` stands for, or null when it is some other failure. */
asked(error: unknown): Error | null {
if (this.is(error)) return error as Error;
- if (!this.#support.signInRequest?.rpcError(error)) return null;
+ if (!this.#support.signInRequest?.rpcError(error, this.#instanceId)) return null;
this.#support.signInRequest.required(this.#instanceId);
return this.#error();
}
diff --git a/server/drivers/acp/session-system.ts b/server/drivers/acp/session-system.ts
new file mode 100644
index 0000000000..b171d2418d
--- /dev/null
+++ b/server/drivers/acp/session-system.ts
@@ -0,0 +1,45 @@
+import { createHash } from "node:crypto";
+import type { SendTurnInput } from "../../contracts.ts";
+import { promptHalves, readPromptSplitReceipt, splitSessionNote, splitSessionPrompt, type PromptSplitReceipt } from "../prompt-split.ts";
+import type { AcpDriverHooks } from "./driver-hooks.ts";
+
+type SystemHooks = Pick<AcpDriverHooks, "sessionSystemPrompt">;
+
+/** The system prompt the session holds, or undefined when the prompt text carries it. */
+export function sessionSystem(support: SystemHooks, init: unknown, instanceId: string, turn: SendTurnInput): string | undefined {
+ if (!support.sessionSystemPrompt?.(init, instanceId)) return undefined;
+ return promptHalves(turn).stable ?? turn.system ?? "";
+}
+
+/** What a live session must match for a turn to reuse it: a session holding another system prompt is loaded again. */
+export function liveSessionKey(sessionKey: string, system: string | undefined): string {
+ return system === undefined ? sessionKey : JSON.stringify([sessionKey, createHash("sha256").update(system).digest("hex")]);
+}
+
+export interface TurnPrompt {
+ input: SendTurnInput;
+ /** Sent as the prompt's last block: Antigravity 1.5.14 reads commands only in a prompt's first block. */
+ note: string;
+ split: { key: string; receipt: PromptSplitReceipt; previous: PromptSplitReceipt | null } | null;
+}
+
+export function turnPrompt(
+ scope: string,
+ key: { threadId: string; sessionId: string },
+ turn: SendTurnInput,
+ promptTurn: SendTurnInput,
+ system: string | undefined,
+ reAnchorAfterTurns: number,
+): TurnPrompt {
+ const halves = promptHalves(turn);
+ if (halves.stable === null) return { input: system === undefined ? promptTurn : { ...promptTurn, system: "" }, note: "", split: null };
+ const receiptKey = JSON.stringify([key.threadId, key.sessionId]);
+ const previous = readPromptSplitReceipt(scope, receiptKey);
+ const perTurnVolatile = Boolean(turn.mentionTurn);
+ if (system !== undefined) {
+ const { note, receipt } = splitSessionNote(halves.stable, halves.volatile, previous, perTurnVolatile, reAnchorAfterTurns);
+ return { input: { ...promptTurn, system: "" }, note, split: { key: receiptKey, receipt, previous } };
+ }
+ const composed = splitSessionPrompt(halves.stable, halves.volatile, previous, promptTurn.system, promptTurn.text, perTurnVolatile, reAnchorAfterTurns);
+ return { input: { ...promptTurn, system: "", text: composed.text }, note: "", split: { key: receiptKey, receipt: composed.receipt, previous } };
+}
diff --git a/server/drivers/antigravity-acp.ts b/server/drivers/antigravity-acp.ts
index 1b1740ecb3..fee3f138ac 100644
--- a/server/drivers/antigravity-acp.ts
+++ b/server/drivers/antigravity-acp.ts
@@ -17,10 +17,9 @@
// apps/server/src/provider/acp/AntigravityAcpSupport.ts:186-193 and
// apps/server/src/provider/AntigravityInstallation.ts:501-503 at
// b732621b51 (the native CLI's launch, its session mode and its name);
-// - apps/server/src/provider/antigravityAuthSupport.ts:167-177, 222-244,
-// 575-644 at 38067630229 (the native CLI's environment: no self-update and
-// the SSH_CONNECTION value that keeps each profile's sign-in in its own
-// file; the `--login` link and the code pasted back).
+// - apps/server/src/provider/antigravityAuthSupport.ts:167-177, 222-244 at
+// 38067630229 (the native CLI's environment: no self-update and the
+// SSH_CONNECTION value that keeps each profile's sign-in in its own file).
// The temp folder stays one per instance, the redirect can go through a relay into a boxed runtime, and startup waits
// while a Windows unpack is still growing.
import { execFile } from "node:child_process";
@@ -215,7 +214,7 @@ export function antigravityCliTokenPath(instanceId: string, baseDir = DATA_DIR):
return join(antigravityProfileDirectory(instanceId, baseDir), "antigravity-acp", ANTIGRAVITY_CLI_TOKEN_FILE);
}
-/** Both runtimes' sign-in files. The pinned runtime's stays when an account moves to the CLI, so a rollback finds it. */
+/** Both runtimes' sign-in files. An account switched to the other runtime under Runs on keeps the first one's file. */
export function antigravitySignInPaths(instanceId: string, baseDir = DATA_DIR): string[] {
return [antigravityCliTokenPath(instanceId, baseDir), antigravityTokenPath(instanceId, baseDir)];
}
@@ -297,9 +296,11 @@ export async function prepareAntigravityProfile(input: {
? {
// Updates come only through this app's updater; the release folder is read-only besides.
AGY_CLI_DISABLE_AUTO_UPDATE: "1",
- // The CLI ignores AGY_ACP_FORCE_FILE_STORAGE and keeps every profile's Google sign-in in one OS keyring entry
- // unless it believes it runs over SSH: then it uses the profile's own file. A fixed value, so no address of
- // the host reaches the box.
+ // The CLI ignores AGY_ACP_FORCE_FILE_STORAGE and keeps one Google sign-in per computer in the OS keyring,
+ // whatever --gemini-dir says (1.5.14), unless it believes it runs over SSH: then each profile keeps its own in
+ // its file (1.5.15, signed in for real). So every account here has its own sign-in, the keychain and the CLI
+ // in a terminal are never touched, and a box without a keyring works the same. A fixed value, so no address
+ // of the host reaches the box.
SSH_CONNECTION: ANTIGRAVITY_SSH_CONNECTION,
}
: { ANTIGRAVITY_HARNESS_PATH: input.runtime.harnessPath! }),
@@ -317,7 +318,7 @@ export async function prepareAntigravityProfile(input: {
}
return {
directory,
- tokenPath: join(acpDirectory, nativeCli ? ANTIGRAVITY_CLI_TOKEN_FILE : "acp_token.json"),
+ tokenPath: join(acpDirectory, "acp_token.json"),
environment,
...(tempDirectory ? { tempDirectory } : {}),
};
@@ -579,12 +580,7 @@ export class AntigravityAcpClient {
}
}
-/** Where `agy acp --login` sends Google; the page shows a code the person pastes back. */
-export const ANTIGRAVITY_CODE_REDIRECT_URI = "https://antigravity.google/oauth-callback";
-
-/** `loopback`: the pinned runtime's link, which redirects to its listener on 127.0.0.1. `code`: the native CLI's
- * `--login` link, which redirects to Google's Antigravity page that shows a code. */
-export function parseAntigravityAuthorizationUrl(authorizationUrl: string, kind: "loopback" | "code" = "loopback"): {
+export function parseAntigravityAuthorizationUrl(authorizationUrl: string): {
authorizationUrl: string;
redirectUri: string;
state: string;
@@ -597,16 +593,15 @@ export function parseAntigravityAuthorizationUrl(authorizationUrl: string, kind:
const redirectUri = url.searchParams.get("redirect_uri");
if (
url.origin !== "https://accounts.google.com" ||
- url.pathname !== (kind === "loopback" ? "/o/oauth2/v2/auth" : "/o/oauth2/auth") ||
+ url.pathname !== "/o/oauth2/v2/auth" ||
url.username || url.password || url.hash ||
url.searchParams.getAll("state").length !== 1 ||
url.searchParams.getAll("redirect_uri").length !== 1 ||
url.searchParams.getAll("response_type").length !== 1 ||
url.searchParams.get("response_type") !== "code" ||
!state || state.length > 512 || /\s/u.test(state) ||
- !redirectUri || (kind === "loopback" ? !/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}\/$/u.test(redirectUri) : redirectUri !== ANTIGRAVITY_CODE_REDIRECT_URI)
+ !redirectUri || !/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}\/$/u.test(redirectUri)
) throw new Error("Antigravity returned an invalid Google sign-in URL.");
- if (kind === "code") return { authorizationUrl, redirectUri, state };
const redirect = new URL(redirectUri);
if (Number(redirect.port) < 1024 || Number(redirect.port) > 65535) {
throw new Error("Antigravity returned an invalid Google sign-in URL.");
@@ -614,21 +609,6 @@ export function parseAntigravityAuthorizationUrl(authorizationUrl: string, kind:
return { authorizationUrl, redirectUri, state };
}
-/** What `agy acp --login` reads after its link: the code the Antigravity page shows, or that page's URL, which must answer
- * this sign-in. Undefined for anything else, including any line break. */
-export function antigravityLoginResponse(pending: { redirectUri: string; state: string }, response: string): string | undefined {
- const value = response.trim();
- if (/^[\w./~-]{1,2048}$/u.test(value)) return value;
- if (value.length > 16_384 || /\s/u.test(value)) return undefined;
- const url = URL.parse(value);
- if (
- url === null || `${url.origin}${url.pathname}` !== pending.redirectUri || url.username || url.password ||
- url.searchParams.getAll("state").length !== 1 || url.searchParams.get("state") !== pending.state ||
- url.searchParams.getAll("code").length !== 1 || !url.searchParams.get("code")
- ) return undefined;
- return value;
-}
-
export function validateAntigravityCallbackUrl(
pending: { redirectUri: string; state: string },
callbackUrl: string,
@@ -722,6 +702,7 @@ export async function probeAntigravityModels(input: {
cwd?: string;
fallbackDefault: string;
timeoutMs?: number;
+ onProcess?: (child: ChildProcess) => void;
}): Promise<ModelCatalog> {
const deadline = Date.now() + (input.timeoutMs ?? STARTUP_CAP_MS);
const remaining = () => {
@@ -731,8 +712,10 @@ export async function probeAntigravityModels(input: {
};
const client = new AntigravityAcpClient(input.runtime, input.profile, input.cwd ?? input.profile.directory);
try {
+ input.onProcess?.(client.child);
const initialized = await client.initialize(remaining(), deadline);
- await client.request("authenticate", { methodId: "oauth-personal" }, remaining());
+ // Native CLI 1.5.14 opens the system browser on `authenticate` and waits 300 s for it; its sign-in is `acp --login`.
+ if (input.runtime.harnessPath !== null) await client.request("authenticate", { methodId: "oauth-personal" }, remaining());
const session = await client.request(
"session/new",
{ cwd: input.cwd ?? input.profile.directory, mcpServers: [], ...antigravitySessionSetup(initialized) },
@@ -775,10 +758,24 @@ const runtimeVersion = (value: unknown) => typeof value === "string" ? value.rep
/** agy_acp_server 1.4.2 to 1.4.5 create or overwrite skills/system/run-workflow/SKILL.md in the session's folder unless
* the session turns its `run_workflow` tool off. Sent with session/new, session/load and session/resume. */
-export function antigravitySessionSetup(initialized: any): { _meta?: { antigravity: { disabledTools: string[] } } } {
+export function antigravitySessionSetup(
+ initialized: any,
+ system?: string,
+): { _meta?: { antigravity: { disabledTools?: string[]; systemPrompt?: { append: string } } } } {
const match = /^1\.4\.(\d+)(?!\d)/u.exec(runtimeVersion(initialized?.agentInfo?.version));
const patch = match ? Number(match[1]) : -1;
- return patch >= 2 && patch <= 5 ? { _meta: { antigravity: { disabledTools: ["run_workflow"] } } } : {};
+ const antigravity = {
+ ...(patch >= 2 && patch <= 5 ? { disabledTools: ["run_workflow"] } : {}),
+ ...(system === undefined ? {} : { systemPrompt: { append: system } }),
+ };
+ return Object.keys(antigravity).length > 0 ? { _meta: { antigravity } } : {};
+}
+
+/** The native CLI (1.5.14) advertises `_meta.antigravity.systemPrompt.append` in initialize: session/new, session/load and
+ * session/resume then take the system prompt there, kept with the conversation, and it never reaches the scan that turns
+ * a `/word` anywhere in a prompt's first text block into that command. */
+export function antigravityTakesSystemPrompt(initialized: any): boolean {
+ return initialized?.agentCapabilities?._meta?.antigravity?.systemPrompt?.append === true;
}
/** The agy CLI has no harness sibling and serves ACP through its `acp` subcommand. It joins `--app-data-dir` beneath
diff --git a/server/drivers/antigravity-auth.ts b/server/drivers/antigravity-auth.ts
index e72909b4e9..ba5cc63282 100644
--- a/server/drivers/antigravity-auth.ts
+++ b/server/drivers/antigravity-auth.ts
@@ -1,5 +1,5 @@
-// One Google sign-in at a time for an Antigravity account: the pinned runtime's own `authenticate`, or the native
-// CLI's `--login`.
+// One Google sign-in at a time for an Antigravity account on the pinned runtime, run by its own `authenticate`. The native
+// CLI signs in through `acp --login` (antigravity-native-login.ts).
//
// Adapted from pingdotgg/t3code@b9bc03869e, MIT License, Copyright (c) 2026
// T3 Tools Inc. (full text in third_party/t3-code/LICENSE); modified:
@@ -7,25 +7,14 @@
// 321-333, 434-480 (the sign-in's phases, its fixed failure lines, expiry,
// and one accepted redirect per sign-in), on promises instead of fibers;
// the link is returned by `start` and the redirect can go through a
-// relay into a boxed runtime;
-// - apps/server/src/provider/Drivers/AntigravityDriver.ts:422-494 and
-// apps/server/src/provider/AntigravityAuth.ts:330-345, 540-568 at
-// 38067630229 (the native CLI's `--login`: a separate process that prints
-// Google's link and reads the code the Antigravity page shows on stdin,
-// with no display so it opens no browser here).
+// relay into a boxed runtime.
import { randomUUID } from "node:crypto";
-import { stat } from "node:fs/promises";
-import { join } from "node:path";
import { botBox } from "../bot-box/box.ts";
import type { ProviderAuthenticationStart, ProviderAuthenticationStatus } from "../contracts.ts";
-import { killCliTree, spawnCli } from "../procs.ts";
import {
AntigravityAcpClient,
STARTUP_TIMEOUT_MS,
- antigravityLaunchArgs,
- antigravityLoginResponse,
- authorizationUrlFromLine,
forwardAntigravityCallback,
parseAntigravityAuthorizationUrl,
validateAntigravityCallbackUrl,
@@ -34,7 +23,6 @@ import {
import type { AntigravityRuntime } from "./antigravity-runtime.ts";
const AUTH_TIMEOUT_MS = 5 * 60_000;
-const LOGIN_LINE_MAX_CHARS = 64 * 1024;
const EXPIRED = "Google sign-in expired. Start sign-in again.";
const CANCELLED = "Google sign-in was cancelled.";
@@ -43,7 +31,6 @@ const NOT_APPROVED = "Google sign-in was not approved. Start sign-in again.";
const NOT_ELIGIBLE = "Google requires an eligible Antigravity subscription for this account.";
const NOT_DELIVERED = "Could not deliver the sign-in response. If Google already finished in your browser, wait a moment. Otherwise send it again.";
const ALREADY_SENT = "The sign-in response was already sent. Wait for Google to finish.";
-const NOT_A_CODE = "Paste the code from the Antigravity page, or that page's full address.";
class SignInExpired extends Error {}
@@ -81,12 +68,7 @@ export class AntigravityAuthController {
this.onSignedIn = onSignedIn;
}
- /** The native CLI signs in through `--login`; the pinned runtime through `authenticate` and its loopback listener. */
- start(runtime: AntigravityRuntime, profile: AntigravityProfile): Promise<ProviderAuthenticationStart> {
- return runtime.harnessPath === null ? this.startCodeLogin(runtime, profile) : this.startLoopback(runtime, profile);
- }
-
- private async startLoopback(runtime: AntigravityRuntime, profile: AntigravityProfile): Promise<ProviderAuthenticationStart> {
+ async start(runtime: AntigravityRuntime, profile: AntigravityProfile): Promise<ProviderAuthenticationStart> {
this.cancel();
let foundUrl!: (value: ReturnType<typeof parseAntigravityAuthorizationUrl>) => void;
let failUrl!: (error: Error) => void;
@@ -142,98 +124,6 @@ export class AntigravityAuthController {
}
}
- /** `agy acp --login`: Google's link on its output, then the code the Antigravity page shows on its input. It needs no
- * listener here, so a sign-in from another computer and one inside a bot box work the same way. */
- private async startCodeLogin(runtime: AntigravityRuntime, profile: AntigravityProfile): Promise<ProviderAuthenticationStart> {
- this.cancel();
- // Without a display it prints the link only, instead of opening a browser on this machine.
- const { DISPLAY: _display, WAYLAND_DISPLAY: _wayland, ...env } = profile.environment;
- const child = spawnCli(
- runtime.executablePath,
- [...antigravityLaunchArgs(runtime, profile.directory), "--login"],
- { cwd: profile.directory, env, stdio: ["pipe", "pipe", "pipe"], box: { ro: [join(profile.directory, "omb-skills")] } },
- "bot",
- );
- let foundUrl!: (value: ReturnType<typeof parseAntigravityAuthorizationUrl>) => void;
- const urlPromise = new Promise<ReturnType<typeof parseAntigravityAuthorizationUrl>>((resolveUrl) => { foundUrl = resolveUrl; });
- const exited = new Promise<number | null>((resolveExit) => {
- child.once("close", (code) => resolveExit(code));
- child.once("error", () => resolveExit(null));
- });
- // Nothing the CLI prints reaches the person or a log: only a Google link is taken out of it.
- const watch = (stream: NodeJS.ReadableStream) => {
- let buffer = "";
- stream.setEncoding("utf8");
- stream.on("data", (chunk: string) => {
- const lines = (buffer + chunk).split("\n");
- buffer = lines.pop() ?? "";
- if (buffer.length > LOGIN_LINE_MAX_CHARS) buffer = "";
- for (const raw of lines) {
- const line = raw.replace(/\r$/u, "").trim();
- const candidate = line.startsWith("https://accounts.google.com/") ? line : authorizationUrlFromLine(line);
- if (!candidate) continue;
- try { foundUrl(parseAntigravityAuthorizationUrl(candidate, "code")); } catch {}
- }
- });
- };
- watch(child.stdout!);
- watch(child.stderr!);
- const stop = () => {
- try { child.stdin?.end(); } catch {}
- void killCliTree(child).catch(() => false);
- };
- try {
- const outcome = await raceStartup([
- urlPromise.then((request) => ({ kind: "url" as const, request })),
- exited.then((code) => ({ kind: "exit" as const, code })),
- ]);
- if (outcome.kind === "exit") {
- // Exiting at once with success means it found a sign-in it could use.
- if (outcome.code === 0 && await signInFile(profile)) {
- this.onSignedIn();
- return { phase: "succeeded", flowId: null, authorizationUrl: null, expiresAt: null };
- }
- throw new Error("Antigravity could not start Google sign-in. Start sign-in again.");
- }
- const expiresAt = Date.now() + AUTH_TIMEOUT_MS;
- let timer: ReturnType<typeof setTimeout> | undefined;
- const finished = new Promise<void>((resolveFinished, reject) => {
- timer = setTimeout(() => reject(new SignInExpired()), AUTH_TIMEOUT_MS);
- timer.unref?.();
- void exited.then(async (code) => {
- if (code === 0 && await signInFile(profile)) resolveFinished();
- else reject(new Error("The Antigravity CLI did not finish the sign-in."));
- });
- }).finally(() => clearTimeout(timer));
- const pending = { redirectUri: outcome.request.redirectUri, state: outcome.request.state };
- const flow: AuthFlow = {
- id: randomUUID(),
- completed: this.settle(() => flow, finished).finally(stop),
- pending,
- expiresAt,
- callbackSent: false,
- accept: (pasted) => {
- const response = antigravityLoginResponse(pending, pasted);
- if (response === undefined) throw new Error(NOT_A_CODE);
- return response;
- },
- send: (accepted) => new Promise<void>((resolveWrite, reject) => {
- child.stdin!.write(`${accepted}\n`, (error) => error ? reject(error) : resolveWrite());
- }),
- close: stop,
- };
- flow.completed.catch(() => {});
- this.flow = flow;
- return {
- phase: "waiting", flowId: flow.id, authorizationUrl: outcome.request.authorizationUrl,
- expiresAt: new Date(flow.expiresAt).toISOString(), pasteCode: true,
- };
- } catch (error) {
- stop();
- throw error;
- }
- }
-
/** The flow's end: signed in, or one of the fixed lines. */
private settle(flow: () => AuthFlow, signedIn: Promise<unknown>): Promise<void> {
return signedIn.then(
@@ -294,11 +184,6 @@ export class AntigravityAuthController {
}
}
-async function signInFile(profile: AntigravityProfile): Promise<boolean> {
- const info = await stat(profile.tokenPath).catch(() => null);
- return info !== null && info.isFile() && info.size > 0;
-}
-
async function raceStartup<A, B>(outcomes: [Promise<A>, Promise<B>]): Promise<A | B> {
let startupTimer: ReturnType<typeof setTimeout> | undefined;
const startupTimeout = new Promise<never>((_resolve, reject) => {
diff --git a/server/drivers/antigravity-cli-install.ts b/server/drivers/antigravity-cli-install.ts
index 81d4061d99..5994f5ed5d 100644
--- a/server/drivers/antigravity-cli-install.ts
+++ b/server/drivers/antigravity-cli-install.ts
@@ -20,21 +20,29 @@ import { writeFileAtomic } from "../atomic.ts";
import type { AntigravityCliReleaseAsset } from "./antigravity-cli-release.ts";
import type { AntigravityRuntime } from "./antigravity-runtime.ts";
-/** The one switch: `OMB_ANTIGRAVITY_NATIVE_CLI=1` in the server's environment, read at start. */
+/** Whether the native CLI's channel is used at all. Off, installs and updates use the pinned runtime only, and a CLI
+ * this app installed earlier is left where it is and not started. */
+export const ANTIGRAVITY_NATIVE_CLI = true;
+
export const ANTIGRAVITY_NATIVE_CLI_ENV = "OMB_ANTIGRAVITY_NATIVE_CLI";
-/** Whether the native CLI is the runtime. Off (the default), everything is as before the CLI: the pinned 1.4.3 runtime
- * is installed and run, Google's CLI channel is never asked, and a CLI this app installed earlier is left where it is
- * and not started. On, the CLI is installed and run wherever the channel has a build, a computer that has the pinned
- * runtime moves to it, and the pinned one is removed once an account there signed in on the CLI. Opt-in because the
- * CLI's `--login` sign-in has not been run against Google, and every signed-in account signs in again after the move. */
-export const ANTIGRAVITY_NATIVE_CLI = process.env[ANTIGRAVITY_NATIVE_CLI_ENV] === "1";
+/** `OMB_ANTIGRAVITY_NATIVE_CLI=1` in the server's environment, read at start: an account whose CLI path names no runtime
+ * (none, or `agy`) runs the native CLI even where the pinned runtime is installed, and the engine updater installs the
+ * CLI there. An account set to a runtime under Runs on keeps it; nothing is removed. Off (the default), such an account
+ * keeps the pinned runtime where it is installed, and only a new install takes the CLI. */
+export const ANTIGRAVITY_CLI_FIRST = process.env[ANTIGRAVITY_NATIVE_CLI_ENV] === "1";
/** Where the CLI keeps a Google sign-in, under `<profile>/antigravity-acp/`, when it does not use the OS keyring (which
* it skips while SSH_CONNECTION is set). It never writes the pinned runtime's `acp_token.json`, and stores no OAuth
* client, so this app cannot refresh it. */
export const ANTIGRAVITY_CLI_TOKEN_FILE = "antigravity-oauth-token";
+/** Whether a configuration that does not name the native CLI (no path, or `agy`) runs it on `platform` when no pinned
+ * runtime is installed to go first. The path `antigravity` always asks for the native CLI. */
+export function antigravityNativeByDefault(_platform: NodeJS.Platform = process.platform): boolean {
+ return true;
+}
+
const DOWNLOAD_TIMEOUT_MS = 45 * 60_000;
const MAX_DOWNLOAD_BYTES = 512 * 1024 * 1024;
const MAX_EXECUTABLE_BYTES = 512 * 1024 * 1024;
diff --git a/server/drivers/antigravity-cli-login.test.ts b/server/drivers/antigravity-cli-login.test.ts
index f9ab715a52..5344487ea7 100644
--- a/server/drivers/antigravity-cli-login.test.ts
+++ b/server/drivers/antigravity-cli-login.test.ts
@@ -1,33 +1,27 @@
-// The native CLI's launch environment, its own sign-in file, and its `--login` Google sign-in, against a fake CLI.
+// The native CLI's launch environment, its own sign-in file, and the environment of its `--login` Google sign-in, against
+// a fake CLI.
//
// Adapted from pingdotgg/t3code@38067630229, MIT License, Copyright (c) 2026
// T3 Tools Inc. (full text in third_party/t3-code/LICENSE); modified:
// - apps/server/src/provider/antigravityAuthSupport.test.ts and
// apps/server/src/provider/Drivers/AntigravityDriver.test.ts (the
-// environment's SSH_CONNECTION and self-update cases, the code link and
-// the pasted code or page address), on a fake program instead of a stub.
+// environment's SSH_CONNECTION and self-update cases), on a fake program
+// instead of a stub.
import { chmodSync, existsSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { removeTempDir } from "../testing/cleanup.ts";
-import {
- ANTIGRAVITY_CODE_REDIRECT_URI,
- ANTIGRAVITY_SSH_CONNECTION,
- antigravityLoginResponse,
- antigravityProfileAuthenticated,
- parseAntigravityAuthorizationUrl,
- prepareAntigravityProfile,
-} from "./antigravity-acp.ts";
+import { ANTIGRAVITY_SSH_CONNECTION, prepareAntigravityProfile } from "./antigravity-acp.ts";
import { antigravityCliAccessToken } from "./antigravity-account.ts";
-import { AntigravityAuthController } from "./antigravity-auth.ts";
+import { ANTIGRAVITY_LOGIN_REDIRECT, AntigravityCliLogin } from "./antigravity-native-login.ts";
import type { AntigravityRuntime } from "./antigravity-runtime.ts";
import { antigravitySignInError } from "./antigravity.ts";
const WINDOWS = process.platform === "win32";
const scratch: string[] = [];
-const controllers: AntigravityAuthController[] = [];
+const logins: AntigravityCliLogin[] = [];
function folder(): string {
const directory = mkdtempSync(join(tmpdir(), "omb-antigravity-login-"));
@@ -36,11 +30,11 @@ function folder(): string {
}
afterEach(async () => {
- for (const controller of controllers.splice(0)) controller.cancel();
+ for (const login of logins.splice(0)) await login.cancel();
while (scratch.length) await removeTempDir(scratch.pop()!);
});
-const LINK = `https://accounts.google.com/o/oauth2/auth?client_id=fixture&redirect_uri=${encodeURIComponent(ANTIGRAVITY_CODE_REDIRECT_URI)}&response_type=code&scope=openid&state=fixture-state`;
+const LINK = `https://accounts.google.com/o/oauth2/auth?client_id=fixture&redirect_uri=${encodeURIComponent(ANTIGRAVITY_LOGIN_REDIRECT)}&response_type=code&scope=openid&state=fixture-state`;
/** A program named `antigravity` that, with `--login`, prints a Google link among other lines, reads one line, and on
* `good-code` (or the page's address carrying it) writes the CLI's sign-in file and exits 0. */
@@ -82,7 +76,8 @@ describe("the native CLI's environment and sign-in file", () => {
});
expect(cli.environment.AGY_CLI_DISABLE_AUTO_UPDATE).toBe("1");
expect(cli.environment.SSH_CONNECTION).toBe(ANTIGRAVITY_SSH_CONNECTION);
- expect(cli.tokenPath).toBe(join(cli.directory, "antigravity-acp", "antigravity-oauth-token"));
+ // `tokenPath` is the pinned runtime's file on either runtime: the CLI's sign-in is asked of the CLI itself.
+ expect(cli.tokenPath).toBe(join(cli.directory, "antigravity-acp", "acp_token.json"));
const pinned = await prepareAntigravityProfile({
instanceId: "pinned", baseDir, runtime: pinnedRuntime, baseEnv: { PATH: "/usr/bin", SSH_CONNECTION: "203.0.113.9 52144 10.0.0.2 22" },
});
@@ -92,15 +87,6 @@ describe("the native CLI's environment and sign-in file", () => {
expect(pinned.tokenPath).toBe(join(pinned.directory, "antigravity-acp", "acp_token.json"));
});
- it("counts an account as signed in on the CLI by the CLI's own file, never by the pinned runtime's", async () => {
- const baseDir = folder();
- const profile = await prepareAntigravityProfile({ instanceId: "moved", baseDir, runtime: cliRuntime("/cli/antigravity") });
- writeFileSync(join(profile.directory, "antigravity-acp", "acp_token.json"), "{\"refresh_token\":\"r\"}");
- expect(await antigravityProfileAuthenticated(profile)).toBe(false);
- writeFileSync(profile.tokenPath, "{\"token\":{}}");
- expect(await antigravityProfileAuthenticated(profile)).toBe(true);
- });
-
it("reads the CLI file's access token only while it has more than a minute left", () => {
const now = Date.parse("2026-11-23T12:00:00Z");
expect(antigravityCliAccessToken({ token: { access_token: "a", expiry: "2026-11-23T12:05:00Z" } }, now)).toEqual({ accessToken: "a", expiresAt: Date.parse("2026-11-23T12:05:00Z") });
@@ -114,72 +100,26 @@ describe("the native CLI's environment and sign-in file", () => {
});
});
-describe("the code link and what is pasted back", () => {
- it("takes the `--login` link only with Google's Antigravity page as its redirect", () => {
- expect(parseAntigravityAuthorizationUrl(LINK, "code")).toMatchObject({ redirectUri: ANTIGRAVITY_CODE_REDIRECT_URI, state: "fixture-state" });
- expect(() => parseAntigravityAuthorizationUrl(LINK)).toThrow("invalid Google sign-in URL");
- expect(() => parseAntigravityAuthorizationUrl(LINK.replace(encodeURIComponent(ANTIGRAVITY_CODE_REDIRECT_URI), encodeURIComponent("https://example.com/cb")), "code")).toThrow("invalid Google sign-in URL");
- });
-
- it("accepts the code or that page's address for this sign-in, and nothing with a line break", () => {
- const pending = { redirectUri: ANTIGRAVITY_CODE_REDIRECT_URI, state: "fixture-state" };
- expect(antigravityLoginResponse(pending, " 4/0Ab-c_d.e~f ")).toBe("4/0Ab-c_d.e~f");
- expect(antigravityLoginResponse(pending, `${ANTIGRAVITY_CODE_REDIRECT_URI}?state=fixture-state&code=xyz`)).toBe(`${ANTIGRAVITY_CODE_REDIRECT_URI}?state=fixture-state&code=xyz`);
- expect(antigravityLoginResponse(pending, `${ANTIGRAVITY_CODE_REDIRECT_URI}?state=other&code=xyz`)).toBeUndefined();
- expect(antigravityLoginResponse(pending, "https://evil.example/oauth-callback?state=fixture-state&code=xyz")).toBeUndefined();
- expect(antigravityLoginResponse(pending, "code\nmore")).toBeUndefined();
- });
-});
-
-describe.skipIf(WINDOWS)("signing in with `agy acp --login`", () => {
- async function started() {
+describe.skipIf(WINDOWS)("signing in with `antigravity acp --login`", () => {
+ it("starts the CLI with no display, the fixed SSH_CONNECTION and no self-update, so it prints its link and keeps the sign-in in the profile", async () => {
const fake = fakeCli();
const profile = await prepareAntigravityProfile({
- instanceId: `login-${scratch.length}`, baseDir: folder(), runtime: cliRuntime(fake.executable),
- baseEnv: { ...process.env, DISPLAY: ":0", WAYLAND_DISPLAY: "wayland-0" },
+ instanceId: "login", baseDir: folder(), runtime: cliRuntime(fake.executable),
+ baseEnv: { ...process.env, DISPLAY: ":0", WAYLAND_DISPLAY: "wayland-0", SSH_CONNECTION: "203.0.113.9 52144 10.0.0.2 22" },
});
let signedIn = 0;
- const controller = new AntigravityAuthController(() => { signedIn += 1; });
- controllers.push(controller);
- const flow = await controller.start(cliRuntime(fake.executable), profile);
- return { fake, profile, controller, flow, signedIn: () => signedIn };
- }
-
- it("hands over the link it prints, with no display, then finishes with the code pasted back", async () => {
- const { fake, profile, controller, flow, signedIn } = await started();
- expect(flow).toMatchObject({ phase: "waiting", authorizationUrl: LINK, pasteCode: true });
+ const login = new AntigravityCliLogin({ signedIn: () => { signedIn += 1; } });
+ logins.push(login);
+ const flow = await login.start(cliRuntime(fake.executable), profile);
+ expect(flow).toMatchObject({ phase: "waiting", authorizationUrl: LINK, kind: "pasted-code" });
const launch = JSON.parse(readFileSync(fake.dump, "utf8"));
- expect(launch.argv).toEqual(["acp", "--gemini-dir", profile.directory, "--app-data-dir", "antigravity-acp", "--login"]);
+ expect(launch.argv).toEqual(["acp", "--login", "--gemini-dir", profile.directory, "--app-data-dir", "antigravity-acp"]);
expect(launch.env.DISPLAY).toBeUndefined();
expect(launch.env.WAYLAND_DISPLAY).toBeUndefined();
expect(launch.env.SSH_CONNECTION).toBe(ANTIGRAVITY_SSH_CONNECTION);
expect(launch.env.AGY_CLI_DISABLE_AUTO_UPDATE).toBe("1");
- // What does not answer this sign-in is refused before anything reaches the CLI.
- await expect(controller.complete(flow.flowId!, "https://evil.example/x?code=good-code")).rejects.toThrow("Paste the code from the Antigravity page");
- expect((await controller.get(flow.flowId!)).phase).toBe("waiting");
- await controller.complete(flow.flowId!, "good-code");
- expect(await controller.get(flow.flowId!)).toMatchObject({ phase: "succeeded" });
- expect(signedIn()).toBe(1);
- expect(await antigravityProfileAuthenticated(profile)).toBe(true);
- }, 30_000);
-
- it("finishes with the Antigravity page's address pasted instead of the code", async () => {
- const { controller, flow, profile } = await started();
- await controller.complete(flow.flowId!, `${ANTIGRAVITY_CODE_REDIRECT_URI}?state=fixture-state&code=good-code`);
- expect(existsSync(profile.tokenPath)).toBe(true);
- }, 30_000);
-
- it("fails with a fixed line when the CLI does not accept the code", async () => {
- const { controller, flow, signedIn } = await started();
- await expect(controller.complete(flow.flowId!, "wrong-code")).rejects.toThrow("Google sign-in failed. Start sign-in again.");
- expect(await controller.get(flow.flowId!)).toMatchObject({ phase: "failed" });
- expect(signedIn()).toBe(0);
- }, 30_000);
-
- it("stops the CLI when the sign-in is cancelled", async () => {
- const { controller, flow } = await started();
- controller.cancel();
- expect(await controller.get(flow.flowId!)).toMatchObject({ phase: "cancelled" });
- await expect(controller.complete(flow.flowId!, "good-code")).rejects.toThrow("no longer active");
+ await login.complete(flow.flowId!, `${ANTIGRAVITY_LOGIN_REDIRECT}?state=fixture-state&code=good-code`);
+ expect(signedIn).toBe(1);
+ expect(existsSync(join(profile.directory, "antigravity-acp", "antigravity-oauth-token"))).toBe(true);
}, 30_000);
});
diff --git a/server/drivers/antigravity-native-cli.test.ts b/server/drivers/antigravity-native-cli.test.ts
index f9c4c34d23..44fd17b667 100644
--- a/server/drivers/antigravity-native-cli.test.ts
+++ b/server/drivers/antigravity-native-cli.test.ts
@@ -1,5 +1,5 @@
import { createHash } from "node:crypto";
-import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, symlinkSync, truncateSync, utimesSync, writeFileSync } from "node:fs";
+import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, truncateSync, utimesSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
@@ -14,9 +14,7 @@ import { removeTempDir } from "../testing/cleanup.ts";
import { recordEvents } from "../testing/events.ts";
import {
antigravityCliSessionMode,
- antigravityCliTokenPath,
antigravityLaunchArgs,
- antigravityTokenPath,
isValidAntigravityInitializeResult,
prepareAntigravityProfile,
validateAntigravityRuntime,
@@ -24,7 +22,9 @@ import {
import { activeAntigravityCli, isAntigravityCliName } from "./antigravity-cli-install.ts";
import type { AntigravityCliReleaseAsset } from "./antigravity-cli-release.ts";
import { resolveAntigravityReleaseAsset } from "./antigravity-release.ts";
-import { antigravityCliUpdate, installAntigravityRuntime, resolveAntigravityRuntime, retirePinnedAntigravityRuntime } from "./antigravity-runtime.ts";
+import { antigravityCliUpdate, installAntigravityRuntime, resolveAntigravityRuntime } from "./antigravity-runtime.ts";
+import { antigravityManagedRuntime } from "../engine-updates-host.ts";
+import { createEngineUpdater } from "../engine-updates.ts";
import { AntigravityDriver } from "./antigravity.ts";
// The opt-in, before any module reads it: this file tests the native CLI switched on.
@@ -97,10 +97,12 @@ describe("installing the native CLI from Google's channel", () => {
const root = join(antigravityRuntimesRoot(baseDir), `${process.platform}-${process.arch}`);
expect(await activeAntigravityCli(root)).toEqual(installed);
expect(readdirSync(join(root, "versions")).filter((name) => name.startsWith(".install-"))).toEqual([]);
+ // The first runtime on this computer: accounts that name none keep the CLI even once the pinned one is installed beside it.
+ expect(existsSync(join(root, "cli-first.json"))).toBe(true);
await expect(resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir)).resolves.toEqual(installed);
- await expect(resolveAntigravityRuntime("agy", { PATH: "" }, baseDir)).resolves.toEqual(installed);
- await expect(resolveAntigravityRuntime(undefined, { PATH: "" }, baseDir)).resolves.toEqual(installed);
+ await expect(resolveAntigravityRuntime("agy", { PATH: "" }, baseDir, { nativeByDefault: true })).resolves.toEqual(installed);
+ await expect(resolveAntigravityRuntime(undefined, { PATH: "" }, baseDir, { nativeByDefault: true })).resolves.toEqual(installed);
await installAntigravityRuntime({ baseDir, fetchImpl, validate, native: true, cliRelease: one.asset });
expect(asked).toEqual([one.asset.url]);
@@ -112,7 +114,7 @@ describe("installing the native CLI from Google's channel", () => {
const [older, newer] = [await release("1.5.6"), await release("1.5.8")];
const { fetchImpl, asked } = serving([older, newer]);
const first = await installAntigravityRuntime({ baseDir, fetchImpl, cliRelease: older.asset, native: true });
- const second = await installAntigravityRuntime({ baseDir, fetchImpl, cliRelease: newer.asset });
+ const second = await installAntigravityRuntime({ baseDir, fetchImpl, cliRelease: newer.asset, native: true });
expect(second.version).toBe("1.5.8");
// Pruned once the newer one is active and nothing runs the older one (T3 Code 68ea2220c12).
expect(existsSync(dirname(first.executablePath))).toBe(false);
@@ -122,7 +124,7 @@ describe("installing the native CLI from Google's channel", () => {
expect(statSync(second.executablePath).mode & 0o777).toBe(0o555);
}
await expect(resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: "1.5.8" });
- expect((await installAntigravityRuntime({ baseDir, fetchImpl, cliRelease: older.asset })).version).toBe("1.5.8");
+ expect((await installAntigravityRuntime({ baseDir, fetchImpl, cliRelease: older.asset, native: true })).version).toBe("1.5.8");
expect(asked).toEqual([older.asset.url, newer.asset.url]);
});
@@ -136,7 +138,7 @@ describe("installing the native CLI from Google's channel", () => {
.rejects.toThrow("redirected away from Google's release folder");
await expect(installAntigravityRuntime({ baseDir, fetchImpl: serving([]).fetchImpl, native: true, cliRelease: one.asset })).rejects.toThrow("Google download failed (404).");
await expect(installAntigravityRuntime({ baseDir, native: true, cliRelease: null })).rejects.toThrow("Could not find a native Antigravity CLI release.");
- await expect(resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir)).rejects.toThrow(/native CLI is not installed.*set the CLI path back to agy/u);
+ await expect(resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir)).rejects.toThrow(/Google Antigravity CLI is not installed yet.*choose Classic runtime under Runs on/u);
const root = join(antigravityRuntimesRoot(baseDir), `${process.platform}-${process.arch}`);
expect(existsSync(join(root, "active.json"))).toBe(false);
expect(readdirSync(join(root, "versions"))).toEqual([]);
@@ -188,7 +190,7 @@ describe("installing the native CLI from Google's channel", () => {
const one = await release("1.5.7");
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
const { fetchImpl, asked } = serving([]);
- await expect(installAntigravityRuntime({ baseDir, fetchImpl, cliRelease: one.asset })).rejects.toThrow("Google download failed (404).");
+ await expect(installAntigravityRuntime({ baseDir, fetchImpl, cliRelease: one.asset, nativeByDefault: true })).rejects.toThrow("Google download failed (404).");
expect(asked).toEqual([one.asset.url, pinned.url]);
expect(warn).toHaveBeenCalledWith(expect.stringContaining("using the pinned runtime instead"));
warn.mockRestore();
@@ -200,20 +202,20 @@ describe("installing the native CLI from Google's channel", () => {
await installAntigravityRuntime({ baseDir, fetchImpl: serving([current]).fetchImpl, cliRelease: current.asset, native: true });
const latest = vi.fn(async () => newer.asset);
const hour = 60 * 60 * 1000, start = Date.now() + 10 * hour;
- expect(await antigravityCliUpdate({ baseDir, now: start, latest, asset: null })).toBe("1.5.7");
+ expect(await antigravityCliUpdate({ baseDir, now: start, latest, asset: null, nativeByDefault: true })).toBe("1.5.7");
// The engine was busy: the next look, minutes later, still finds the update without asking again.
- expect(await antigravityCliUpdate({ baseDir, now: start + 5 * 60_000, latest, asset: null })).toBe("1.5.7");
- expect(await antigravityCliUpdate({ baseDir, now: start + hour - 1, latest, asset: null })).toBe("1.5.7");
+ expect(await antigravityCliUpdate({ baseDir, now: start + 5 * 60_000, latest, asset: null, nativeByDefault: true })).toBe("1.5.7");
+ expect(await antigravityCliUpdate({ baseDir, now: start + hour - 1, latest, asset: null, nativeByDefault: true })).toBe("1.5.7");
expect(latest).toHaveBeenCalledTimes(1);
- expect(await antigravityCliUpdate({ baseDir, now: start + hour, latest: async () => current.asset, asset: null })).toBeNull();
+ expect(await antigravityCliUpdate({ baseDir, now: start + hour, latest: async () => current.asset, asset: null, nativeByDefault: true })).toBeNull();
// A channel that did not answer is asked again on the next look.
const silent = vi.fn(async () => null);
- expect(await antigravityCliUpdate({ baseDir, now: start + 2 * hour, latest: silent, asset: null })).toBeNull();
- expect(await antigravityCliUpdate({ baseDir, now: start + 2 * hour + 1, latest, asset: null })).toBe("1.5.7");
- expect(await antigravityCliUpdate({ baseDir: folder(), now: start + 4 * hour, latest, asset: null })).toBeNull();
+ expect(await antigravityCliUpdate({ baseDir, now: start + 2 * hour, latest: silent, asset: null, nativeByDefault: true })).toBeNull();
+ expect(await antigravityCliUpdate({ baseDir, now: start + 2 * hour + 1, latest, asset: null, nativeByDefault: true })).toBe("1.5.7");
+ expect(await antigravityCliUpdate({ baseDir: folder(), now: start + 4 * hour, latest, asset: null, nativeByDefault: true })).toBeNull();
});
- it.skipIf(!resolveAntigravityReleaseAsset() || WINDOWS)("runs and updates the CLI where the pinned runtime is also installed, and removes the pinned one once an account signed in on the CLI", async () => {
+ it.skipIf(!resolveAntigravityReleaseAsset() || WINDOWS)("with the switch on, runs and updates the CLI where the pinned runtime is also installed, and leaves the pinned one for an account set to it", async () => {
const pinned = resolveAntigravityReleaseAsset()!;
const baseDir = folder();
const [current, newer] = [await release("1.5.7"), await release("1.5.8")];
@@ -232,18 +234,9 @@ describe("installing the native CLI from Google's channel", () => {
await expect(resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: "1.5.7" });
const latest = async () => newer.asset, at = Date.now() + 100 * 60 * 60 * 1000;
expect(await antigravityCliUpdate({ baseDir, now: at, latest })).toBe("1.5.7");
- // Kept until an account here has signed in on the CLI, and while a process still runs it.
- expect(await retirePinnedAntigravityRuntime({ baseDir, inUse: () => false })).toEqual([]);
- const cliToken = antigravityCliTokenPath("moved", baseDir), pinnedToken = antigravityTokenPath("moved", baseDir);
- mkdirSync(dirname(cliToken), { recursive: true });
- writeFileSync(cliToken, "{}");
- writeFileSync(pinnedToken, "{}");
- expect(await retirePinnedAntigravityRuntime({ baseDir, inUse: () => true })).toEqual([]);
+ // Nothing removes the pinned runtime: an account set to the Classic runtime keeps running it.
expect(existsSync(directory)).toBe(true);
- expect(await retirePinnedAntigravityRuntime({ baseDir, inUse: () => false })).toEqual([pinned.sha256]);
- expect(existsSync(directory)).toBe(false);
- // The pinned runtime's sign-in stays for a rollback.
- expect(existsSync(pinnedToken)).toBe(true);
+ await expect(resolveAntigravityRuntime("agy_acp_server", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: pinned.version, harnessPath: expect.any(String) });
await expect(resolveAntigravityRuntime("agy", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: "1.5.7" });
});
@@ -274,8 +267,8 @@ describe("installing the native CLI from Google's channel", () => {
const baseDir = folder();
const [current, newer] = [await release("1.5.7"), await release("1.5.8")];
await installAntigravityRuntime({ baseDir, fetchImpl: serving([current]).fetchImpl, cliRelease: current.asset, native: true });
- await expect(installAntigravityRuntime({ baseDir, fetchImpl: serving([]).fetchImpl, cliRelease: newer.asset })).rejects.toThrow("Google download failed (404).");
- await expect(installAntigravityRuntime({ baseDir, cliRelease: null })).rejects.toThrow("Could not find a native Antigravity CLI release.");
+ await expect(installAntigravityRuntime({ baseDir, fetchImpl: serving([]).fetchImpl, cliRelease: newer.asset, native: true })).rejects.toThrow("Google download failed (404).");
+ await expect(installAntigravityRuntime({ baseDir, cliRelease: null, native: true })).rejects.toThrow("Could not find a native Antigravity CLI release.");
await expect(resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: "1.5.7" });
});
@@ -301,6 +294,82 @@ describe("installing the native CLI from Google's channel", () => {
});
});
+describe("which CLI an instance that names none runs", () => {
+ it("is the native CLI when no pinned runtime is installed to go first, and with the default off only for the path that asks for it", async () => {
+ const baseDir = folder();
+ const one = await release("1.5.7");
+ const installed = await installAntigravityRuntime({ baseDir, fetchImpl: serving([one]).fetchImpl, native: true, cliRelease: one.asset });
+ for (const cli of ["agy", undefined]) {
+ await expect(resolveAntigravityRuntime(cli, { PATH: "" }, baseDir)).resolves.toEqual(installed);
+ await expect(resolveAntigravityRuntime(cli, { PATH: "" }, baseDir, { nativeByDefault: false })).rejects.toThrow();
+ await expect(resolveAntigravityRuntime(cli, { PATH: "" }, baseDir, { nativeByDefault: false })).rejects.not.toMatchObject({ message: expect.stringContaining("Antigravity CLI is not installed") });
+ }
+ await expect(resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir, { nativeByDefault: false })).resolves.toEqual(installed);
+ for (const pinned of ["agy_acp_server", "AGY_ACP_SERVER"]) {
+ await expect(resolveAntigravityRuntime(pinned, { PATH: "" }, baseDir)).rejects.not.toMatchObject({ message: expect.stringContaining("custom Antigravity ACP executable") });
+ await expect(resolveAntigravityRuntime(pinned, { PATH: "" }, baseDir)).rejects.toThrow();
+ }
+ });
+
+ it.skipIf(!resolveAntigravityReleaseAsset())("installs the native CLI on a new computer, and with the default off only the pinned runtime unless the path asks for the CLI", async () => {
+ const pinned = resolveAntigravityReleaseAsset()!;
+ const one = await release("1.5.7");
+ const fresh = serving([one]);
+ await installAntigravityRuntime({ baseDir: folder(), fetchImpl: fresh.fetchImpl, cliRelease: one.asset });
+ expect(fresh.asked).toEqual([one.asset.url]);
+ const off = serving([one]);
+ await expect(installAntigravityRuntime({ baseDir: folder(), fetchImpl: off.fetchImpl, cliRelease: one.asset, nativeByDefault: false })).rejects.toThrow("Google download failed (404).");
+ expect(off.asked).toEqual([pinned.url]);
+ const asked = serving([one]);
+ await installAntigravityRuntime({ baseDir: folder(), fetchImpl: asked.fetchImpl, cliRelease: one.asset, native: true, nativeByDefault: false });
+ expect(asked.asked).toEqual([one.asset.url]);
+ });
+
+ it("updates the native CLI where it is the default, and with the default off only for a path that asks for it", async () => {
+ const baseDir = folder();
+ const [current, newer] = [await release("1.5.7"), await release("1.5.8")];
+ await installAntigravityRuntime({ baseDir, fetchImpl: serving([current]).fetchImpl, cliRelease: current.asset, native: true });
+ const latest = async () => newer.asset, at = Date.now() + 100 * 60 * 60 * 1000;
+ expect(await antigravityCliUpdate({ baseDir, now: at, latest, asset: null, configuredClis: ["agy"] })).toBe("1.5.7");
+ expect(await antigravityCliUpdate({ baseDir, now: at, latest, asset: null, configuredClis: ["agy"], nativeByDefault: false })).toBeNull();
+ expect(await antigravityCliUpdate({ baseDir, now: at, latest, asset: null, nativeByDefault: false })).toBeNull();
+ expect(await antigravityCliUpdate({ baseDir, now: at, latest, asset: null, configuredClis: ["agy", "antigravity"], nativeByDefault: false })).toBe("1.5.7");
+ });
+
+});
+
+describe("the updater with an agy instance and an antigravity instance on one machine", () => {
+ it.skipIf(!resolveAntigravityReleaseAsset() || WINDOWS)("installs each runtime from its own channel and reports the version that really replaced the old one", async () => {
+ const pinned = resolveAntigravityReleaseAsset()!;
+ const baseDir = folder();
+ const [current, newer] = [await release("1.5.7"), await release("1.5.8")];
+ await installAntigravityRuntime({ baseDir, fetchImpl: serving([current]).fetchImpl, cliRelease: current.asset, native: true });
+ // A pinned release an earlier app version left (older than the pinned one), whole enough to count as installed.
+ const earlier = "f".repeat(64);
+ const directory = join(antigravityRuntimesRoot(baseDir), `${process.platform}-${process.arch}`, "versions", earlier);
+ mkdirSync(directory, { recursive: true });
+ writeFileSync(join(directory, ".install-complete.json"), JSON.stringify({ sha256: earlier, version: "1.1.1" }));
+
+ const { fetchImpl, asked } = serving([newer]);
+ const lines: string[] = [];
+ const managed = antigravityManagedRuntime(() => ["agy", "antigravity"], { baseDir, fetchImpl, cliRelease: newer.asset, latest: async () => newer.asset, validate: async () => {} });
+ const updater = createEngineUpdater({
+ plans: [{ driverKind: "antigravityAgent", name: "Antigravity", pin: { target: pinned.version, minimum: pinned.version }, managed }],
+ baseDir, statePath: join(folder(), "state.json"), turnRunning: () => false, log: (line) => lines.push(line), liveCommands: () => [],
+ steps: { sweep: async () => {}, npmVersion: () => null, standaloneVersion: () => null },
+ });
+ await updater.check();
+ // The native CLI moved on, and the pinned runtime was asked of its own channel, not of the CLI's.
+ expect(asked).toEqual([newer.asset.url, pinned.url]);
+ expect(lines[0]).toBe("Engine update: Antigravity 1.5.7 → 1.5.8");
+ // The fake channel serves no pinned archive, so that update fails on its own and is retried, the CLI's kept.
+ expect(lines[1]).toMatch(/^Engine update: Antigravity stays on 1\.1\.1; .+ could not be installed/u);
+ await expect(resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: "1.5.8" });
+ expect(updater.shown("antigravityAgent").autoUpdated?.version).toBe("1.5.8");
+ }, 60_000);
+
+});
+
describe("starting the native CLI", () => {
it("launches through its acp subcommand with the profile folder, and without a harness", async () => {
const directory = folder();
@@ -344,10 +413,6 @@ describe.skipIf(WINDOWS)("a native CLI set as the engine's own path", () => {
async function create(instanceId: string, executable: string, environment: Record<string, string>) {
ensureDirs();
- // The CLI's own sign-in file: the pinned runtime's acp_token.json does not sign in the CLI.
- const token = antigravityCliTokenPath(instanceId);
- mkdirSync(dirname(token), { recursive: true });
- writeFileSync(token, "{}", { mode: 0o600 });
const instance = await AntigravityDriver.create({
instanceId, displayName: "Antigravity", enabled: true, config: { cli: executable, fullAuto: false },
environment: { FAKE_ACP_AUTH_METHOD: "oauth-personal", FAKE_ACP_MODELS: "gemini-3.8-flash", FAKE_ACP_AGENT_NAME: "Antigravity ACP Server", FAKE_ACP_VERSION: "1.5.7", ...environment },
@@ -370,6 +435,17 @@ describe.skipIf(WINDOWS)("a native CLI set as the engine's own path", () => {
expect(existsSync(started)).toBe(false);
});
+ it("is asked its version without the server's, the workspace's or a provider's credentials", async () => {
+ const directory = folder(), seen = join(directory, "env"), program = join(directory, "antigravity");
+ writeFileSync(program, `#!/bin/sh\n/usr/bin/env > ${JSON.stringify(seen)}\necho 1.5.7\n`);
+ chmodSync(program, 0o755);
+ await expect(resolveAntigravityRuntime(program, { PATH: "/usr/bin:/bin", ANTHROPIC_API_KEY: "provider-key", OMB_CLOUD_TOKEN: "control-plane", anthropic_api_key: "lower-provider", xai_api_key: "lower-workspace", KEEP_ME: "kept" }, folder()))
+ .resolves.toMatchObject({ harnessPath: null, version: "1.5.7" });
+ const env = readFileSync(seen, "utf8");
+ expect(env).toContain("KEEP_ME=kept");
+ expect(env).not.toMatch(/provider-key|control-plane|lower-provider|lower-workspace/u);
+ });
+
it("is not started for its version from a folder the bots can write", async () => {
const directory = folder(), started = join(directory, "started"), program = join(directory, "antigravity");
writeFileSync(program, `#!/bin/sh\ntouch ${JSON.stringify(started)}\necho 1.5.7\n`);
@@ -427,8 +503,62 @@ describe.skipIf(WINDOWS)("a native CLI set as the engine's own path", () => {
expect(recorder.events.some((event) => event.type === "runtime.error" && /did not report its permission mode/u.test(event.message))).toBe(true);
}, 90_000);
+ const RULES = "Rules. If the user sends /learn or asks you to save a procedure, use skill_manage.";
+ const MEMORY = " Memory: likes /plan mode.";
+
+ /** Turns on one thread, each returning the prompt the CLI received, with the thread's session/new and session/resume calls. */
+ async function systemThread(name: string, environment: Record<string, string>) {
+ const fake = cli();
+ const rpc = join(fake.directory, "rpc.jsonl");
+ const instance = await create(`antigravity-cli-${name}`, fake.executable, {
+ FAKE_ACP_MODES: "default,plan", FAKE_ACP_DUMP: fake.dump, FAKE_ACP_DUMP_PROMPT: "1", FAKE_ACP_RPC_APPEND_FILE: rpc, ...environment,
+ });
+ const recorder = recordEvents(instance.adapter);
+ let resumeCursor: string | undefined;
+ const send = async (text: string, stable: string, volatile: string) => {
+ const { turnId } = await instance.adapter.sendTurn({
+ threadId: name, text, cwd: fake.directory, system: stable + volatile, systemStable: stable, systemVolatile: volatile, resumeCursor,
+ });
+ expect(await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId)).toMatchObject({ ok: true });
+ resumeCursor ??= (recorder.events.find((event) => event.type === "session.started") as { sessionId: string }).sessionId;
+ return JSON.parse(readFileSync(`${fake.dump}.prompt.json`, "utf8")) as Array<{ type: string; text: string }>;
+ };
+ const setups = () => readFileSync(rpc, "utf8").trim().split("\n").map((line) => JSON.parse(line) as { method: string; cwd: string; sessionId?: string; meta?: unknown })
+ .filter((call) => call.cwd === realpathSync(fake.directory) && (call.method === "session/new" || call.method === "session/resume"));
+ return { send, setups, sessionId: () => resumeCursor };
+ }
+
+ it("gives the session its system prompt where the CLI takes one, so no /word in it runs as a command", async () => {
+ const thread = await systemThread("system-prompt", { FAKE_ACP_CAPABILITIES_META: JSON.stringify({ antigravity: { systemPrompt: { append: true } } }) });
+ expect(await thread.send("/learn what we did", RULES, MEMORY)).toEqual([
+ { type: "text", text: "/learn what we did" },
+ { type: "text", text: expect.stringContaining(MEMORY.trim()) },
+ ]);
+ expect(thread.setups()).toEqual([expect.objectContaining({ method: "session/new", meta: { antigravity: { systemPrompt: { append: RULES } } } })]);
+
+ expect(await thread.send("again", RULES, MEMORY)).toEqual([{ type: "text", text: "again" }]);
+ expect(thread.setups()).toHaveLength(1);
+
+ const revised = RULES + " Reply in French.";
+ expect(await thread.send("third", revised, MEMORY)).toEqual([
+ { type: "text", text: "third" },
+ { type: "text", text: expect.stringContaining(MEMORY.trim()) },
+ ]);
+ expect(thread.setups().at(-1)).toEqual(expect.objectContaining({
+ method: "session/resume", sessionId: thread.sessionId(), meta: { antigravity: { systemPrompt: { append: revised } } },
+ }));
+ }, 90_000);
+
+ it("keeps the system prompt in the text for a CLI that does not say it takes one", async () => {
+ const thread = await systemThread("system-in-text", {});
+ const [first, ...rest] = await thread.send("hello", RULES, MEMORY);
+ expect(first.text).toBe(`${RULES}${MEMORY}\n\nhello`);
+ expect(rest).toEqual([]);
+ expect(thread.setups()).toEqual([expect.not.objectContaining({ meta: expect.anything() })]);
+ }, 90_000);
+
/** One turn at `approvalMode` whose runtime asks about `toolCall`; a card that opens is denied. */
- async function asked(name: string, approvalMode: "edits" | "full", toolCall: (directory: string) => object) {
+ async function asked(name: string, approvalMode: "edits" | "full", toolCall: (directory: string) => object, approvalNow?: "ask") {
const fake = cli();
const answer = join(fake.directory, "answer");
const instance = await create(`antigravity-cli-${name}`, fake.executable, {
@@ -436,7 +566,7 @@ describe.skipIf(WINDOWS)("a native CLI set as the engine's own path", () => {
FAKE_ACP_PERMISSION_TOOL_CALL: JSON.stringify(toolCall(fake.directory)),
});
const recorder = recordEvents(instance.adapter);
- const { turnId } = await instance.adapter.sendTurn({ threadId: name, text: "hello", approvalMode, cwd: fake.directory });
+ const { turnId } = await instance.adapter.sendTurn({ threadId: name, text: "hello", approvalMode, cwd: fake.directory, ...(approvalNow ? { approvalModeNow: () => approvalNow } : {}) });
const first = await recorder.until((event) => event.turnId === turnId && (event.type === "request.opened" || event.type === "turn.completed"));
if (first.type === "request.opened") await instance.adapter.respondToRequest(name, (first as { requestId: string }).requestId, { behavior: "deny" });
await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId);
@@ -451,6 +581,11 @@ describe.skipIf(WINDOWS)("a native CLI set as the engine's own path", () => {
.toMatchObject({ card: false, answer: "allow-once" });
}, 90_000);
+ it("asks about a file edit on a turn whose level was lowered to Ask after it began", async () => {
+ expect(await asked("edits-lowered", "edits", (directory) => ({ kind: "edit", title: "Edit notes.md", locations: [{ path: join(directory, "notes.md") }] }), "ask"))
+ .toMatchObject({ card: true, answer: "reject" });
+ }, 90_000);
+
it.each([
["a command", () => ({ kind: "execute", rawInput: { command: "echo hi" }, title: "echo hi" })],
["an edit that names a command", (directory: string) => ({ kind: "edit", rawInput: { CommandLine: "rm -rf ~" }, locations: [{ path: join(directory, "notes.md") }] })],
diff --git a/server/drivers/antigravity-native-login.test.ts b/server/drivers/antigravity-native-login.test.ts
new file mode 100644
index 0000000000..e8f34650ea
--- /dev/null
+++ b/server/drivers/antigravity-native-login.test.ts
@@ -0,0 +1,252 @@
+import { mkdtempSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import * as procs from "../procs.ts";
+import { removeTempDir } from "../testing/cleanup.ts";
+import { nativeFixture, type NativeFixture } from "../testing/antigravity-native-fixture.ts";
+import { prepareAntigravityProfile } from "./antigravity-acp.ts";
+import {
+ ANTIGRAVITY_LOGIN_REDIRECT,
+ AntigravityCliLogin,
+ antigravityLoginArgs,
+ antigravityLoginInput,
+ antigravityLoginLink,
+} from "./antigravity-native-login.ts";
+import type { AntigravityRuntime } from "./antigravity-runtime.ts";
+
+const WINDOWS = process.platform === "win32";
+const LINK = `https://accounts.google.com/o/oauth2/auth?client_id=abc&redirect_uri=${encodeURIComponent(ANTIGRAVITY_LOGIN_REDIRECT)}&response_type=code&scope=openid&state=s-1`;
+const scratch: string[] = [];
+const logins: AntigravityCliLogin[] = [];
+
+class TrackedLogin extends AntigravityCliLogin {
+ constructor(...args: ConstructorParameters<typeof AntigravityCliLogin>) {
+ super(...args);
+ logins.push(this);
+ }
+}
+
+afterEach(async () => {
+ vi.restoreAllMocks();
+ for (const login of logins.splice(0)) await login.cancel();
+ while (scratch.length) await removeTempDir(scratch.pop()!);
+});
+
+describe("the sign-in link in the CLI's output", () => {
+ it("is found by its shape, with the prompt lines around it in whatever words", () => {
+ const output = `Open this link in a browser to log in with Google:\n\n ${LINK}\nThen paste the authorization code, or the full URL, and press Enter:\n`;
+ expect(antigravityLoginLink(output)).toEqual({ authorizationUrl: LINK, state: "s-1" });
+ expect(antigravityLoginLink(`Sign in here -> ${LINK}\r\nthen paste what you get\r\n`)).toEqual({ authorizationUrl: LINK, state: "s-1" });
+ expect(antigravityLoginLink(LINK.replace("&state=s-1", "") + "\n")).toEqual({ authorizationUrl: LINK.replace("&state=s-1", ""), state: null });
+ });
+
+ it("is not there until the line is whole", () => {
+ expect(antigravityLoginLink("Open this link in a browser to log in with Google:\n")).toBeNull();
+ expect(antigravityLoginLink(` ${LINK.slice(0, 60)}`)).toBeNull();
+ expect(antigravityLoginLink("")).toBeNull();
+ });
+
+ it.each([
+ ["another host", LINK.replace("accounts.google.com", "accounts.example.test")],
+ ["a host that only starts like Google's", LINK.replace("accounts.google.com", "accounts.google.com.example.test")],
+ ["plain http", LINK.replace("https:", "http:")],
+ ["another redirect", LINK.replace(encodeURIComponent(ANTIGRAVITY_LOGIN_REDIRECT), encodeURIComponent("http://127.0.0.1:9/"))],
+ ["a second redirect", `${LINK}&redirect_uri=${encodeURIComponent("https://evil.example/")}`],
+ ["a token response", LINK.replace("response_type=code", "response_type=token")],
+ ["a path that is not an OAuth one", LINK.replace("/o/oauth2/auth", "/signin")],
+ ["a fragment", `${LINK}#x`],
+ ["user information", LINK.replace("https://", "https://user:pw@")],
+ ["a link that is too long", `${LINK}&x=${"a".repeat(17_000)}`],
+ ])("is refused for %s", (_name, link) => {
+ expect(() => antigravityLoginLink(`${link}\n`)).toThrow("invalid Google sign-in link");
+ });
+});
+
+describe("what a person pastes", () => {
+ const pending = { state: "s-1" };
+
+ it("is handed on as it is when it is an authorization code", () => {
+ expect(antigravityLoginInput(pending, " 4/0AeaYSHB-x_y.z~1 \n")).toBe("4/0AeaYSHB-x_y.z~1");
+ expect(antigravityLoginInput({ state: null }, "plain-code")).toBe("plain-code");
+ });
+
+ it("is handed on when it is the callback page's address with a code and this sign-in's state", () => {
+ const page = `${ANTIGRAVITY_LOGIN_REDIRECT}?code=4%2F0Abc&state=s-1&scope=openid`;
+ expect(antigravityLoginInput(pending, page)).toBe(page);
+ expect(antigravityLoginInput(pending, `${ANTIGRAVITY_LOGIN_REDIRECT}?code=abc`)).toBe(`${ANTIGRAVITY_LOGIN_REDIRECT}?code=abc`);
+ expect(antigravityLoginInput({ state: null }, `${ANTIGRAVITY_LOGIN_REDIRECT}?code=abc&state=anything`)).toContain("code=abc");
+ });
+
+ it.each([
+ ["nothing", " ", "Paste the authorization code"],
+ ["two lines", "abc\ndef", "only the authorization code"],
+ ["a code with spaces", "abc def", "does not look like an authorization code"],
+ ["a code that is too long", "a".repeat(2_049), "does not look like an authorization code"],
+ ["an address that is not the callback page", "https://example.test/oauth-callback?code=abc", "not the page Google ends on"],
+ ["the callback page on another path", "https://antigravity.google/other?code=abc", "not the page Google ends on"],
+ ["the callback page over http", "http://antigravity.google/oauth-callback?code=abc", "not the page Google ends on"],
+ ["an address with no code", `${ANTIGRAVITY_LOGIN_REDIRECT}?state=s-1`, "no sign-in code"],
+ ["an address with two codes", `${ANTIGRAVITY_LOGIN_REDIRECT}?code=a&code=b`, "no sign-in code"],
+ ["an address Google ended with an error", `${ANTIGRAVITY_LOGIN_REDIRECT}?error=access_denied&state=s-1`, "was not approved"],
+ ["an address of another sign-in", `${ANTIGRAVITY_LOGIN_REDIRECT}?code=abc&state=other`, "another sign-in"],
+ ["an address that is not one", "https://", "full address"],
+ ])("is refused as %s", (_name, pasted, line) => {
+ expect(() => antigravityLoginInput(pending, pasted)).toThrow(line);
+ });
+});
+
+describe("the sign-in's command", () => {
+ it("is `acp --login` on the profile's folder and the app data folder the runtime uses", () => {
+ expect(antigravityLoginArgs("/profile")).toEqual(["acp", "--login", "--gemini-dir", "/profile", "--app-data-dir", "antigravity-acp"]);
+ });
+});
+
+describe.skipIf(WINDOWS)("a sign-in run by the CLI", () => {
+ function setup(env: Record<string, string> = {}) {
+ const directory = mkdtempSync(join(tmpdir(), "omb-antigravity-login-"));
+ scratch.push(directory);
+ const fixture: NativeFixture = nativeFixture(join(directory, "cli"));
+ const runtime: AntigravityRuntime = { executablePath: fixture.executable, harnessPath: null, source: "override", version: "1.5.14" };
+ return { directory, fixture, runtime, env: { FAKE_AGY_LOG: fixture.log, ...env } };
+ }
+ async function profileOf(directory: string, runtime: AntigravityRuntime, env: Record<string, string>) {
+ return prepareAntigravityProfile({ instanceId: `login-${directory}`, runtime, baseDir: directory, baseEnv: { ...process.env, ...env } });
+ }
+
+ it("waits for the code with the link in hand, and ends signed in when the CLI exits 0", async () => {
+ const { directory, runtime, env, fixture } = setup();
+ const hooks = { signedIn: vi.fn() };
+ const login = new TrackedLogin(hooks);
+ const started = await login.start(runtime, await profileOf(directory, runtime, env));
+ expect(started).toMatchObject({ phase: "waiting", kind: "pasted-code" });
+ expect(started.authorizationUrl).toContain("accounts.google.com");
+ expect(await login.get(started.flowId!)).toMatchObject({ phase: "waiting" });
+ await login.complete(started.flowId!, "fixture-code");
+ expect(hooks.signedIn).toHaveBeenCalledTimes(1);
+ expect(await login.get(started.flowId!)).toMatchObject({ phase: "succeeded" });
+ expect(fixture.entries().find((entry) => entry.event === "login-code")).toMatchObject({ accepted: true, asAddress: false });
+ }, 60_000);
+
+ it("hands the CLI the page's address when that is what was pasted", async () => {
+ const { directory, runtime, env, fixture } = setup();
+ const login = new TrackedLogin({ signedIn: () => {} });
+ const started = await login.start(runtime, await profileOf(directory, runtime, env));
+ await login.complete(started.flowId!, `${ANTIGRAVITY_LOGIN_REDIRECT}?code=fixture-code&state=fixture-state`);
+ expect(fixture.entries().find((entry) => entry.event === "login-code")).toMatchObject({ accepted: true, asAddress: true });
+ }, 60_000);
+
+ it("fails with one fixed line, never the CLI's own words, when the CLI refuses the code", async () => {
+ const { directory, runtime, env } = setup();
+ const hooks = { signedIn: vi.fn() };
+ const login = new TrackedLogin(hooks);
+ const started = await login.start(runtime, await profileOf(directory, runtime, env));
+ const failure = await login.complete(started.flowId!, "secret-wrong-code").then(() => null, (error: Error) => error);
+ expect(failure!.message).toBe("Google sign-in failed. Start sign-in again.");
+ expect(JSON.stringify(await login.get(started.flowId!))).not.toContain("secret-wrong-code");
+ expect(await login.get(started.flowId!)).toMatchObject({ phase: "failed", message: "Google sign-in failed. Start sign-in again." });
+ expect(hooks.signedIn).not.toHaveBeenCalled();
+ await expect(login.complete(started.flowId!, "fixture-code")).rejects.toThrow("no longer active");
+ }, 60_000);
+
+ it("takes a second paste of a code already sent as already sent, and does not write it twice", async () => {
+ const { directory, runtime, env, fixture } = setup({ FAKE_AGY_LOGIN: "stay" });
+ const login = new TrackedLogin({ signedIn: () => {} }, { submitMs: 400 });
+ const started = await login.start(runtime, await profileOf(directory, runtime, env));
+ const first = login.complete(started.flowId!, "fixture-code").catch((error: Error) => error);
+ await vi.waitFor(async () => expect(await login.get(started.flowId!)).toMatchObject({ phase: "verifying" }));
+ await expect(login.complete(started.flowId!, "fixture-code")).rejects.toThrow("already sent");
+ await first;
+ expect(fixture.entries().filter((entry) => entry.event === "login-code")).toHaveLength(1);
+ }, 60_000);
+
+ it("is signed in when the CLI stays up after taking the code and a session is then accepted", async () => {
+ const { directory, runtime, env } = setup({ FAKE_AGY_LOGIN: "stay" });
+ const hooks = { signedIn: vi.fn(), confirm: vi.fn(async () => true) };
+ const login = new TrackedLogin(hooks, { submitMs: 400 });
+ const started = await login.start(runtime, await profileOf(directory, runtime, env));
+ await login.complete(started.flowId!, "fixture-code");
+ expect(hooks.confirm).toHaveBeenCalledTimes(1);
+ expect(hooks.signedIn).toHaveBeenCalledTimes(1);
+ expect(await login.get(started.flowId!)).toMatchObject({ phase: "succeeded" });
+ expect(login.active).toBe(false);
+ }, 60_000);
+
+ it("fails when the CLI stays up and no session is accepted", async () => {
+ const { directory, runtime, env } = setup({ FAKE_AGY_LOGIN: "stay" });
+ const hooks = { signedIn: vi.fn(), confirm: vi.fn(async () => false) };
+ const login = new TrackedLogin(hooks, { submitMs: 400 });
+ const started = await login.start(runtime, await profileOf(directory, runtime, env));
+ await expect(login.complete(started.flowId!, "fixture-code")).rejects.toThrow("failed");
+ expect(hooks.confirm).toHaveBeenCalledTimes(1);
+ expect(hooks.signedIn).not.toHaveBeenCalled();
+ }, 60_000);
+
+ it("fails to start, with its process gone, when no link comes in time", async () => {
+ const { directory, runtime, env, fixture } = setup({ FAKE_AGY_LOGIN: "no-link" });
+ const login = new TrackedLogin({ signedIn: () => {} }, { startupMs: 3_000 });
+ await expect(login.start(runtime, await profileOf(directory, runtime, env))).rejects.toThrow("did not return a link");
+ const pid = fixture.entries().find((entry) => entry.event === "login-start")!.pid as number;
+ await vi.waitFor(() => expect(() => process.kill(pid, 0)).toThrow());
+ }, 60_000);
+
+ it("expires when the code is not pasted in time, and the CLI is stopped", async () => {
+ const { directory, runtime, env, fixture } = setup({ FAKE_AGY_LOGIN: "hold" });
+ const login = new TrackedLogin({ signedIn: () => {} }, { lifetimeMs: 300 });
+ const started = await login.start(runtime, await profileOf(directory, runtime, env));
+ await vi.waitFor(async () => expect(await login.get(started.flowId!)).toMatchObject({ phase: "expired", message: "Google sign-in expired. Start sign-in again." }));
+ const pid = fixture.entries().find((entry) => entry.event === "login-start")!.pid as number;
+ await vi.waitFor(() => expect(() => process.kill(pid, 0)).toThrow());
+ await expect(login.complete(started.flowId!, "fixture-code")).rejects.toThrow("no longer active");
+ }, 60_000);
+
+ it("is cancelled with the CLI's process gone before cancel returns, and a cancel with nothing to cancel is done at once", async () => {
+ const { directory, runtime, env, fixture } = setup({ FAKE_AGY_LOGIN: "hold" });
+ const login = new TrackedLogin({ signedIn: () => {} });
+ expect(await login.cancel()).toBe(true);
+ const started = await login.start(runtime, await profileOf(directory, runtime, env));
+ expect(await login.cancel()).toBe(true);
+ const pid = fixture.entries().find((entry) => entry.event === "login-start")!.pid as number;
+ expect(() => process.kill(pid, 0)).toThrow();
+ expect(await login.get(started.flowId!)).toMatchObject({ phase: "cancelled" });
+ }, 60_000);
+
+ it("keeps reporting a cancelled sign-in's process until it is gone, so a later sign-out cannot pass it by", async () => {
+ const { directory, runtime, env, fixture } = setup({ FAKE_AGY_LOGIN: "hold" });
+ const login = new TrackedLogin({ signedIn: () => {} }, { exitConfirmMs: 200 });
+ await login.start(runtime, await profileOf(directory, runtime, env));
+ const pid = fixture.entries().find((entry) => entry.event === "login-start")!.pid as number;
+ const kill = vi.spyOn(procs, "killCliTree").mockResolvedValue(false);
+ try {
+ expect(await login.cancel()).toBe(false);
+ expect(await login.cancel()).toBe(false);
+ await expect(login.start(runtime, await profileOf(directory, runtime, env))).rejects.toThrow("could not be stopped");
+ } finally {
+ kill.mockRestore();
+ }
+ expect(await login.cancel()).toBe(true);
+ expect(() => process.kill(pid, 0)).toThrow();
+ }, 60_000);
+
+ it("opens no flow for a start that a cancel overtook, and leaves no process of its own", async () => {
+ const { directory, runtime, env } = setup({ FAKE_AGY_LOGIN: "hold" });
+ const login = new TrackedLogin({ signedIn: () => {} });
+ const starting = login.start(runtime, await profileOf(directory, runtime, env));
+ await login.cancel();
+ await expect(starting).rejects.toThrow("cancelled");
+ expect(login.active).toBe(false);
+ expect(await login.cancel()).toBe(true);
+ }, 60_000);
+
+ it("never reports another sign-in's id as its own", async () => {
+ const { directory, runtime, env } = setup({ FAKE_AGY_LOGIN: "hold" });
+ const login = new TrackedLogin({ signedIn: () => {} });
+ const first = await login.start(runtime, await profileOf(directory, runtime, env));
+ const second = await login.start(runtime, await profileOf(directory, runtime, env));
+ expect(await login.get(first.flowId!)).toMatchObject({ phase: "cancelled" });
+ expect(await login.get(second.flowId!)).toMatchObject({ phase: "waiting" });
+ await expect(login.complete(first.flowId!, "fixture-code")).rejects.toThrow("no longer active");
+ await login.cancel();
+ }, 60_000);
+});
diff --git a/server/drivers/antigravity-native-login.ts b/server/drivers/antigravity-native-login.ts
new file mode 100644
index 0000000000..f72ffc5efb
--- /dev/null
+++ b/server/drivers/antigravity-native-login.ts
@@ -0,0 +1,295 @@
+// One Google sign-in at a time for an instance run by the native Antigravity CLI's `acp --login`.
+//
+// With piped output the CLI prints Google's authorization link, then reads one line from stdin: the authorization
+// code, or the full address of the page Google ends on (https://antigravity.google/oauth-callback). It opens no
+// browser and needs no listener on this machine, so a boxed runtime, a remote server and a desktop all sign in the
+// same way. Nothing the CLI prints after the link reaches the person: it can carry the code.
+import { randomUUID } from "node:crypto";
+import { join } from "node:path";
+
+import { killCliTree, spawnCli } from "../procs.ts";
+import type { ProviderAuthenticationStart, ProviderAuthenticationStatus } from "../contracts.ts";
+import { STARTUP_TIMEOUT_MS, type AntigravityProfile } from "./antigravity-acp.ts";
+import type { AntigravityRuntime } from "./antigravity-runtime.ts";
+
+export const ANTIGRAVITY_LOGIN_REDIRECT = "https://antigravity.google/oauth-callback";
+
+const LOGIN_TIMEOUT_MS = 10 * 60_000;
+const SUBMIT_TIMEOUT_MS = 60_000;
+const EXIT_CONFIRM_MS = 10_000;
+const MAX_LINK_CHARS = 16_384;
+const MAX_OUTPUT_BEFORE_LINK = 64 * 1024;
+const MAX_CODE_CHARS = 2_048;
+const MAX_PASTED_ADDRESS_CHARS = 16_384;
+
+const EXPIRED = "Google sign-in expired. Start sign-in again.";
+const CANCELLED = "Google sign-in was cancelled.";
+const FAILED = "Google sign-in failed. Start sign-in again.";
+const NOT_APPROVED = "Google sign-in was not approved. Start sign-in again.";
+const NO_LINK = "Google sign-in did not return a link. Start sign-in again.";
+const BAD_LINK = "Antigravity returned an invalid Google sign-in link.";
+const ALREADY_SENT = "The sign-in code was already sent. Wait for Google to finish.";
+const INACTIVE = "This Google sign-in is no longer active. Start again.";
+const STILL_RUNNING = "The Antigravity sign-in in progress could not be stopped. Try again.";
+
+export function antigravityLoginArgs(profileDirectory: string): string[] {
+ return ["acp", "--login", "--gemini-dir", profileDirectory, "--app-data-dir", "antigravity-acp"];
+}
+
+/** The authorization link in what the CLI printed, found by its shape and not its wording: the first address in full,
+ * which must be Google's own host with the callback page as the redirect and a code response. Null while none has been
+ * printed in full; throws when the first is not the sign-in's. */
+export function antigravityLoginLink(output: string): { authorizationUrl: string; state: string | null } | null {
+ const token = /https?:\/\/\S+(?=\s)/u.exec(output)?.[0];
+ if (token === undefined) return null;
+ if (token.length > MAX_LINK_CHARS) throw new Error(BAD_LINK);
+ let url: URL;
+ try { url = new URL(token); } catch { throw new Error(BAD_LINK); }
+ const state = url.searchParams.get("state");
+ if (
+ url.origin !== "https://accounts.google.com" || !url.pathname.startsWith("/o/oauth2/")
+ || url.username || url.password || url.hash
+ || url.searchParams.getAll("redirect_uri").length !== 1 || url.searchParams.get("redirect_uri") !== ANTIGRAVITY_LOGIN_REDIRECT
+ || url.searchParams.getAll("response_type").length !== 1 || url.searchParams.get("response_type") !== "code"
+ || (state !== null && (state.length > 512 || /\s/u.test(state)))
+ ) throw new Error(BAD_LINK);
+ return { authorizationUrl: token, state };
+}
+
+/** The one line to hand the CLI for what the person pasted: an authorization code, or the callback page's address with a
+ * code in it (and this sign-in's `state`, when both name one). Throws the line to show when it is neither. */
+export function antigravityLoginInput(pending: { state: string | null }, pasted: string): string {
+ const text = pasted.trim();
+ if (!text) throw new Error("Paste the authorization code, or the full address of the page Google ended on.");
+ if (/[\r\n\0]/u.test(text)) throw new Error("Paste only the authorization code, or the full address of the page Google ended on.");
+ if (!/^https?:\/\//iu.test(text)) {
+ if (text.length > MAX_CODE_CHARS || !/^[\w./~+=%-]+$/u.test(text)) throw new Error("That does not look like an authorization code. Paste the code Google shows, or the page's full address.");
+ return text;
+ }
+ if (text.length > MAX_PASTED_ADDRESS_CHARS) throw new Error("The pasted address is too long.");
+ let url: URL;
+ try { url = new URL(text); } catch { throw new Error("Paste the full address of the page Google ended on."); }
+ if (url.origin !== new URL(ANTIGRAVITY_LOGIN_REDIRECT).origin || url.pathname !== new URL(ANTIGRAVITY_LOGIN_REDIRECT).pathname || url.username || url.password) {
+ throw new Error("That address is not the page Google ends on after sign-in. Paste the code Google shows, or that page's full address.");
+ }
+ const codes = url.searchParams.getAll("code");
+ if (url.searchParams.has("error")) throw new Error(NOT_APPROVED);
+ if (codes.length !== 1 || !codes[0]) throw new Error("That address has no sign-in code. Paste the page's full address after Google finishes.");
+ const states = url.searchParams.getAll("state");
+ if (states.length > 1 || (states.length === 1 && pending.state !== null && states[0] !== pending.state)) {
+ throw new Error("That address belongs to another sign-in. Start again from the link above.");
+ }
+ return text;
+}
+
+interface LoginFlow {
+ id: string;
+ child: ReturnType<typeof spawnCli>;
+ state: string | null;
+ expiresAt: number;
+ submitted: boolean;
+ exited: Promise<number | null>;
+ /** Resolves when the sign-in succeeded; rejects with one of the fixed lines. */
+ settled: Promise<void>;
+ settle: { resolve(): void; reject(error: Error): void };
+ timer: ReturnType<typeof setTimeout>;
+}
+
+export interface NativeLoginHooks {
+ signedIn(): void;
+ /** Whether the CLI accepts a session after it gave no exit in time. */
+ confirm?(): Promise<boolean>;
+}
+
+/** Every `--login` process started that has not exited yet, ended flows included: one that outlived its kill can still
+ * write the sign-in it was given. */
+export type LoginProcesses = Map<ReturnType<typeof spawnCli>, Promise<number | null>>;
+
+export class AntigravityCliLogin {
+ #flow: LoginFlow | null = null;
+ readonly #alive: LoginProcesses;
+ #ended: ProviderAuthenticationStatus | null = null;
+ #cancels = 0;
+ readonly #hooks: NativeLoginHooks;
+ readonly #timing: { startupMs: number; submitMs: number; lifetimeMs: number; exitConfirmMs: number };
+
+ /** `alive`: the instance's `--login` processes, shared with a controller the instance is rebuilt with. */
+ constructor(
+ hooks: NativeLoginHooks,
+ timing: Partial<{ startupMs: number; submitMs: number; lifetimeMs: number; exitConfirmMs: number }> = {},
+ alive: LoginProcesses = new Map(),
+ ) {
+ this.#hooks = hooks;
+ this.#alive = alive;
+ this.#timing = { startupMs: STARTUP_TIMEOUT_MS, submitMs: SUBMIT_TIMEOUT_MS, lifetimeMs: LOGIN_TIMEOUT_MS, exitConfirmMs: EXIT_CONFIRM_MS, ...timing };
+ }
+
+ get active(): boolean {
+ return this.#flow !== null;
+ }
+
+ async start(runtime: AntigravityRuntime, profile: AntigravityProfile): Promise<ProviderAuthenticationStart & { kind: "pasted-code" }> {
+ const cancels = this.#cancels + 1;
+ if (!(await this.cancel())) throw new Error(STILL_RUNNING);
+ if (this.#cancels !== cancels) throw new Error(CANCELLED);
+ // Without a display it can only print the link, as it does with piped output: no browser opens on this machine.
+ const { DISPLAY: _display, WAYLAND_DISPLAY: _wayland, ...env } = profile.environment;
+ const child = spawnCli(
+ runtime.executablePath,
+ antigravityLoginArgs(profile.directory),
+ { cwd: profile.directory, env, stdio: ["pipe", "pipe", "pipe"], box: { ro: [join(profile.directory, "omb-skills")] } },
+ "bot",
+ );
+ child.stdin.on("error", () => {});
+ child.stderr.resume();
+ const exited = new Promise<number | null>((resolveExit) => {
+ child.once("close", (code) => resolveExit(code));
+ child.once("error", () => { if (child.pid === undefined) resolveExit(null); });
+ });
+ this.#alive.set(child, exited);
+ void exited.then(() => this.#alive.delete(child));
+ let output = "";
+ let found: ReturnType<typeof antigravityLoginLink> = null;
+ let onLink!: (link: NonNullable<ReturnType<typeof antigravityLoginLink>>) => void;
+ let onBad!: (error: Error) => void;
+ const linked = new Promise<NonNullable<ReturnType<typeof antigravityLoginLink>>>((resolveLink, rejectLink) => { onLink = resolveLink; onBad = rejectLink; });
+ linked.catch(() => {});
+ child.stdout.setEncoding("utf8");
+ child.stdout.on("data", (chunk: string) => {
+ if (found) return;
+ output += chunk;
+ try {
+ found = antigravityLoginLink(output);
+ } catch (error) {
+ output = "";
+ found = null;
+ return onBad(error as Error);
+ }
+ if (found) { output = ""; onLink(found); }
+ else if (output.length > MAX_OUTPUT_BEFORE_LINK) { output = ""; onBad(new Error(NO_LINK)); }
+ });
+ let startupTimer: ReturnType<typeof setTimeout> | undefined;
+ try {
+ const link = await Promise.race([
+ linked,
+ exited.then(() => { throw new Error(NO_LINK); }),
+ new Promise<never>((_resolve, reject) => {
+ startupTimer = setTimeout(() => reject(new Error(NO_LINK)), this.#timing.startupMs);
+ startupTimer.unref?.();
+ }),
+ ]);
+ if (startupTimer) clearTimeout(startupTimer);
+ if (this.#cancels !== cancels) throw new Error(CANCELLED);
+ const flow = this.#open(child, exited, link.state);
+ return { phase: "waiting", flowId: flow.id, authorizationUrl: link.authorizationUrl, expiresAt: new Date(flow.expiresAt).toISOString(), kind: "pasted-code" };
+ } catch (error) {
+ if (startupTimer) clearTimeout(startupTimer);
+ await killCliTree(child).catch(() => false);
+ throw this.#cancels !== cancels ? new Error(CANCELLED) : error;
+ }
+ }
+
+ #open(child: LoginFlow["child"], exited: Promise<number | null>, state: string | null): LoginFlow {
+ let settle!: LoginFlow["settle"];
+ const settled = new Promise<void>((resolveDone, rejectDone) => { settle = { resolve: resolveDone, reject: rejectDone }; });
+ settled.catch(() => {});
+ const flow: LoginFlow = {
+ id: randomUUID(), child, state, expiresAt: Date.now() + this.#timing.lifetimeMs, submitted: false, exited, settled, settle,
+ timer: setTimeout(() => {
+ if (flow.submitted || !this.#end(flow, "expired", EXPIRED)) return;
+ flow.settle.reject(new Error(EXPIRED));
+ void killCliTree(child).catch(() => false);
+ }, this.#timing.lifetimeMs),
+ };
+ flow.timer.unref?.();
+ this.#flow = flow;
+ void exited.then((code) => {
+ clearTimeout(flow.timer);
+ if (this.#flow !== flow) return;
+ if (flow.submitted && code === 0) {
+ this.#end(flow, "succeeded");
+ this.#hooks.signedIn();
+ flow.settle.resolve();
+ } else {
+ this.#end(flow, "failed", FAILED);
+ flow.settle.reject(new Error(FAILED));
+ }
+ });
+ return flow;
+ }
+
+ #end(flow: LoginFlow, phase: Exclude<ProviderAuthenticationStatus["phase"], "waiting" | "verifying">, message?: string): boolean {
+ if (this.#flow !== flow) return false;
+ this.#flow = null;
+ this.#ended = { phase, flowId: flow.id, authorizationUrl: null, expiresAt: null, ...(message ? { message } : {}) };
+ return true;
+ }
+
+ async get(flowId: string): Promise<ProviderAuthenticationStatus> {
+ const flow = this.#flow;
+ if (flow && flow.id === flowId) {
+ return { phase: flow.submitted ? "verifying" : "waiting", flowId, authorizationUrl: null, expiresAt: new Date(flow.expiresAt).toISOString() };
+ }
+ if (this.#ended?.flowId === flowId) return { ...this.#ended };
+ return { phase: "expired", flowId, authorizationUrl: null, expiresAt: null, message: EXPIRED };
+ }
+
+ /** Gives the CLI what the person pasted and waits for it to finish: exit 0 is signed in. */
+ async complete(flowId: string, pasted: string): Promise<void> {
+ const flow = this.#flow;
+ if (!flow || flow.id !== flowId || Date.now() >= flow.expiresAt) throw new Error(INACTIVE);
+ if (flow.submitted) throw new Error(ALREADY_SENT);
+ const line = antigravityLoginInput(flow, pasted);
+ flow.submitted = true;
+ try {
+ await new Promise<void>((resolveWrite, rejectWrite) => flow.child.stdin.write(`${line}\n`, (error) => error ? rejectWrite(error) : resolveWrite()));
+ } catch {
+ if (this.#end(flow, "failed", FAILED)) flow.settle.reject(new Error(FAILED));
+ await killCliTree(flow.child).catch(() => false);
+ throw new Error(FAILED);
+ }
+ let timer: ReturnType<typeof setTimeout> | undefined;
+ const late = new Promise<"late">((resolveLate) => {
+ timer = setTimeout(() => resolveLate("late"), this.#timing.submitMs);
+ timer.unref?.();
+ });
+ try {
+ if ((await Promise.race([flow.settled.then(() => "done" as const), late])) === "done") return;
+ } finally {
+ if (timer) clearTimeout(timer);
+ }
+ // No exit in time: a CLI that signed in and stayed up is told apart from one that is stuck.
+ const accepted = await this.#hooks.confirm?.().catch(() => false);
+ if (this.#flow === flow) {
+ if (accepted) {
+ this.#end(flow, "succeeded");
+ this.#hooks.signedIn();
+ flow.settle.resolve();
+ } else {
+ this.#end(flow, "failed", FAILED);
+ flow.settle.reject(new Error(FAILED));
+ }
+ await killCliTree(flow.child).catch(() => false);
+ }
+ await flow.settled;
+ }
+
+ /** Ends the sign-in in progress and resolves true once every `--login` process started here is gone. */
+ async cancel(): Promise<boolean> {
+ this.#cancels += 1;
+ const flow = this.#flow;
+ if (flow) {
+ this.#end(flow, "cancelled", CANCELLED);
+ clearTimeout(flow.timer);
+ flow.settle.reject(new Error(CANCELLED));
+ try { flow.child.stdin.end(); } catch {}
+ }
+ await Promise.all([...this.#alive].map(async ([child, exited]) => {
+ await killCliTree(child).catch(() => false);
+ let timer: ReturnType<typeof setTimeout> | undefined;
+ await Promise.race([exited, new Promise((resolveWait) => { timer = setTimeout(resolveWait, this.#timing.exitConfirmMs); timer.unref?.(); })]);
+ if (timer) clearTimeout(timer);
+ }));
+ return this.#alive.size === 0;
+ }
+}
diff --git a/server/drivers/antigravity-native-sign-in.test.ts b/server/drivers/antigravity-native-sign-in.test.ts
new file mode 100644
index 0000000000..346c98784e
--- /dev/null
+++ b/server/drivers/antigravity-native-sign-in.test.ts
@@ -0,0 +1,97 @@
+import { join } from "node:path";
+import { describe, expect, it, vi } from "vitest";
+
+import type { PlanFetch } from "../plan-usage.ts";
+import { antigravityProfileDirectory } from "./antigravity-acp.ts";
+import { defaultNativeSignInStore, nativeAccessToken, readNativeAccessToken, type NativeSignInStore } from "./antigravity-native-sign-in.ts";
+import { antigravityNativePlanUsage } from "./antigravity-usage-limits.ts";
+
+const NOW = Date.parse("2026-11-23T04:40:00Z");
+
+const stored = (expiry: string, accessToken = "native-access") => JSON.stringify({
+ token: { access_token: accessToken, token_type: "Bearer", refresh_token: "native-refresh", expiry, expires_in: 3599 },
+ auth_method: "consumer",
+ id_token_email: "[email protected]",
+});
+const valid = stored("2026-11-23T13:36:53.008002+08:00");
+
+describe("the access token of the native CLI's stored sign-in", () => {
+ it("is read from the profile's plain file", () => {
+ expect(nativeAccessToken(valid, NOW)).toBe("native-access");
+ });
+
+ it("is none once it has expired or has a minute or less left", () => {
+ expect(nativeAccessToken(stored("2026-11-23T04:39:00Z"), NOW)).toBeNull();
+ expect(nativeAccessToken(stored("2026-11-23T04:41:00Z"), NOW)).toBeNull();
+ expect(nativeAccessToken(stored("2026-11-23T04:41:01Z"), NOW)).toBe("native-access");
+ });
+
+ it("is none for a sign-in without a token or an expiry, or that is not JSON", () => {
+ expect(nativeAccessToken(null, NOW)).toBeNull();
+ expect(nativeAccessToken("not json", NOW)).toBeNull();
+ expect(nativeAccessToken("{}", NOW)).toBeNull();
+ expect(nativeAccessToken(JSON.stringify({ token: { access_token: "native-access" } }), NOW)).toBeNull();
+ expect(nativeAccessToken(stored("2026-11-23T13:36:53Z", ""), NOW)).toBeNull();
+ });
+});
+
+// The app starts the CLI as over SSH (antigravity-acp.ts), so each account's sign-in is its profile's file, on every
+// system: the OS keychain is never asked.
+describe("which stored sign-in's access token is used", () => {
+ const profileFile = join(antigravityProfileDirectory("native"), "antigravity-acp", "antigravity-oauth-token");
+ const store = (file: string | null) => {
+ const readText = vi.fn(async (path: string) => path === profileFile ? file : null);
+ const value: NativeSignInStore = { readText };
+ return { value, readText };
+ };
+ const live = (accessToken: string) => stored("2026-11-23T05:30:00Z", accessToken);
+ const dead = (accessToken: string) => stored("2026-11-23T04:30:00Z", accessToken);
+
+ it("is the account's own profile file's, whatever the server's environment says", async () => {
+ for (const env of [{ HOME: "/Users/person" }, { HOME: "/Users/person", SSH_CONNECTION: "10.0.0.2 50000 10.0.0.1 22" }]) {
+ const { value, readText } = store(live("file-access"));
+ expect(await readNativeAccessToken("native", env, NOW, value)).toBe("file-access");
+ expect(readText).toHaveBeenCalledWith(profileFile);
+ }
+ expect(Object.keys(defaultNativeSignInStore())).toEqual(["readText"]);
+ });
+
+ it("is none when the stored token has expired or there is none, so a file the CLI stopped writing soon shows nothing", async () => {
+ expect(await readNativeAccessToken("native", {}, NOW, store(dead("file-access")).value)).toBeNull();
+ expect(await readNativeAccessToken("native", {}, NOW, store(null).value)).toBeNull();
+ });
+});
+
+describe("a native-CLI account's limits", () => {
+ const summary = { groups: [{ displayName: "Gemini Models", buckets: [
+ { bucketId: "gemini-5h", window: "5h", remainingFraction: 0.75, resetTime: "2026-11-23T08:21:16Z", description: "used" },
+ { bucketId: "gemini-weekly", window: "weekly", remainingFraction: 0.5, resetTime: "2026-11-28T09:29:26Z", description: "used" },
+ ] }] };
+ const fixture = () => {
+ const requests: Array<{ url: string; authorization: string | undefined; body: string | undefined }> = [];
+ const fetch: PlanFetch = async (url, init) => {
+ requests.push({ url, authorization: init.headers.Authorization, body: init.body });
+ return { ok: true, status: 200, text: async () => JSON.stringify(summary) };
+ };
+ return { requests, deps: { fetch, now: () => NOW } };
+ };
+
+ it("are Google's quota summary for the CLI's access token, asked without a project and without refreshing", async () => {
+ const { requests, deps } = fixture();
+ const readAccessToken = vi.fn(async () => "native-access");
+ const usage = await antigravityNativePlanUsage("native", { HOME: "/Users/person" }, deps, readAccessToken);
+ expect(usage).toMatchObject({ fiveHour: { available: true, usedPercent: 25 }, weekly: { available: true, usedPercent: 50 } });
+ expect(readAccessToken).toHaveBeenCalledWith("native", expect.objectContaining({ HOME: "/Users/person" }), NOW);
+ expect(requests.map((request) => new URL(request.url).pathname)).toEqual(["/v1internal:retrieveUserQuotaSummary", "/v1internal:retrieveUserQuotaSummary"]);
+ expect(requests.every((request) => request.authorization === "Bearer native-access" && request.body === "{}")).toBe(true);
+ expect(JSON.stringify(usage)).not.toMatch(/native-access|native-refresh|person@example\.com/);
+ });
+
+ it("are no row, and ask Google nothing, without a live token or once the switch is off", async () => {
+ const { requests, deps } = fixture();
+ expect(await antigravityNativePlanUsage("native", {}, deps, async () => null)).toBeNull();
+ expect(await antigravityNativePlanUsage("native", {}, deps, async () => { throw new Error("keychain"); })).toBeNull();
+ expect(await antigravityNativePlanUsage("native", {}, deps, async () => "native-access", false)).toBeNull();
+ expect(requests).toEqual([]);
+ });
+});
diff --git a/server/drivers/antigravity-native-sign-in.ts b/server/drivers/antigravity-native-sign-in.ts
new file mode 100644
index 0000000000..aa190bc1f1
--- /dev/null
+++ b/server/drivers/antigravity-native-sign-in.ts
@@ -0,0 +1,46 @@
+// The access token of the Google sign-in the native Antigravity CLI keeps, for the plan-usage report.
+//
+// Security: only the access token is taken, and it stays in memory and request headers: never logged, written or
+// returned in a result. The stored sign-in also holds the refresh token; it is never used, and nothing here refreshes
+// or rewrites the sign-in.
+import { readFile, stat } from "node:fs/promises";
+
+import { antigravityProfileDirectory } from "./antigravity-acp.ts";
+import { antigravityCliAccessToken } from "./antigravity-account.ts";
+import { antigravityNativeTokenPath } from "./antigravity-native-status.ts";
+
+// Antigravity CLI 1.5.14 keeps one sign-in per computer in the OS keyring (on macOS the login keychain), unless it runs
+// over SSH: then each profile's is the file in that profile. This app always starts it as over SSH
+// (antigravity-acp.ts), so the profile's file is the account's sign-in, and the keychain is never read.
+const STORED_MAX_BYTES = 1024 * 1024;
+
+export interface NativeSignInStore {
+ readText: (path: string) => Promise<string | null>;
+}
+
+async function readSmallFile(path: string): Promise<string | null> {
+ try {
+ const info = await stat(path);
+ return info.isFile() && info.size <= STORED_MAX_BYTES ? await readFile(path, "utf8") : null;
+ } catch {
+ return null;
+ }
+}
+
+export const defaultNativeSignInStore = (): NativeSignInStore => ({ readText: readSmallFile });
+
+/** The live access token of the sign-in the CLI keeps for this instance, in its profile's file; null when there is none
+ * or it is stale. A file the CLI no longer writes is dead within the hour. */
+export async function readNativeAccessToken(instanceId: string, _env: NodeJS.ProcessEnv, now: number, store: NativeSignInStore = defaultNativeSignInStore()): Promise<string | null> {
+ return nativeAccessToken(await store.readText(antigravityNativeTokenPath({ directory: antigravityProfileDirectory(instanceId) })), now);
+}
+
+/** The stored sign-in's access token while it has more than a minute left, else null. */
+export function nativeAccessToken(stored: string | null, now: number): string | null {
+ if (!stored) return null;
+ try {
+ return antigravityCliAccessToken(JSON.parse(stored), now)?.accessToken ?? null;
+ } catch {
+ return null;
+ }
+}
diff --git a/server/drivers/antigravity-native-signin.test.ts b/server/drivers/antigravity-native-signin.test.ts
new file mode 100644
index 0000000000..5d14240b8e
--- /dev/null
+++ b/server/drivers/antigravity-native-signin.test.ts
@@ -0,0 +1,438 @@
+import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { DATA_DIR, ensureDirs } from "../config.ts";
+import type { ProviderInstance } from "../contracts.ts";
+import { antigravityRuntimesRoot } from "../engine-roots.ts";
+import { ProviderAuthSessions } from "../provider-auth-sessions.ts";
+import { removeTempDir } from "../testing/cleanup.ts";
+import { installFakeManagedCli, loginAt, nativeFixture, sessionAcceptedAt, type NativeFixture } from "../testing/antigravity-native-fixture.ts";
+import { recordEvents } from "../testing/events.ts";
+import { antigravityProfileDirectory, antigravityTokenPath } from "./antigravity-acp.ts";
+import { AntigravityDriver } from "./antigravity.ts";
+
+const WINDOWS = process.platform === "win32";
+const LOGIN_NOTE = "Antigravity needs a Google account";
+const scratch: string[] = [];
+const instances: ProviderInstance[] = [];
+
+const FAKE_ACP = join(dirname(fileURLToPath(import.meta.url)), "..", "testing", "fake-acp-cli.ts");
+
+function folder(): string {
+ const directory = mkdtempSync(join(tmpdir(), "omb-antigravity-native-"));
+ scratch.push(directory);
+ return directory;
+}
+
+/** A pinned runtime at a custom path: the ACP server with its harness beside it. */
+function pinnedRuntime(name = "agy_acp_server"): string {
+ const directory = folder();
+ const executable = join(directory, name);
+ const harness = join(directory, WINDOWS ? "localharness_external.exe" : "localharness_external");
+ copyFileSync(FAKE_ACP, executable);
+ copyFileSync(FAKE_ACP, harness);
+ if (!WINDOWS) {
+ chmodSync(executable, 0o755);
+ chmodSync(harness, 0o755);
+ }
+ return executable;
+}
+
+afterEach(async () => {
+ for (const instance of instances.splice(0)) await instance.dispose();
+ rmSync(join(antigravityRuntimesRoot(DATA_DIR), `${process.platform}-${process.arch}`), { recursive: true, force: true });
+ while (scratch.length) await removeTempDir(scratch.pop()!);
+});
+
+async function create(instanceId: string, fixture: NativeFixture, env: Record<string, string> = {}, cli: string = fixture.executable) {
+ ensureDirs();
+ const instance = await AntigravityDriver.create({
+ instanceId, displayName: "Antigravity", enabled: true, config: { cli, fullAuto: false },
+ environment: { FAKE_AGY_LOG: fixture.log, ...env },
+ });
+ instances.push(instance);
+ return instance;
+}
+
+const credentials = (instanceId: string) => join(antigravityProfileDirectory(instanceId), "antigravity-acp", "antigravity-oauth-token");
+
+async function turn(instance: ProviderInstance, threadId: string, cwd: string) {
+ const recorder = recordEvents(instance.adapter);
+ const { turnId } = await instance.adapter.sendTurn({ threadId, text: "hello", approvalMode: "ask", cwd });
+ const done = await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId, 30_000);
+ recorder.stop();
+ return { done, events: recorder.events.filter((event) => event.turnId === turnId) };
+}
+
+describe.skipIf(WINDOWS)("signing in to the native Antigravity CLI", () => {
+ it("gets a link from the sign-in button and ends signed in, with a session started for the turn and no authenticate sent", async () => {
+ const fixture = nativeFixture(folder());
+ const instance = await create("antigravity-native-loop", fixture);
+
+ expect(await instance.snapshot()).toMatchObject({ state: "available", authenticated: false, version: "1.5.14" });
+
+ const started = await instance.startAuthentication!();
+ expect(started).toMatchObject({ phase: "waiting", kind: "pasted-code" });
+ expect(started.authorizationUrl).toMatch(/^https:\/\/accounts\.google\.com\/o\/oauth2\/auth\?/u);
+ expect(await instance.getAuthentication!(started.flowId!)).toMatchObject({ phase: "waiting" });
+ await instance.completeAuthentication!(started.flowId!, "fixture-code");
+ expect(await instance.getAuthentication!(started.flowId!)).toMatchObject({ phase: "succeeded" });
+
+ expect(await instance.snapshot()).toMatchObject({ authenticated: true });
+ await instance.refreshModels!();
+ expect(instance.models.options.map((option) => option.id)).toContain("fixture-account-model");
+ expect(instance.modelsUnconfirmed).toBe(false);
+
+ const { done } = await turn(instance, "native-loop", fixture.directory);
+ expect(done).toMatchObject({ ok: true });
+ expect(fixture.methods()).toContain("session/prompt");
+
+ await instance.signOut!();
+ expect(existsSync(credentials("antigravity-native-loop"))).toBe(false);
+ expect(fixture.methods()).toContain("logout");
+ expect(await instance.snapshot()).toMatchObject({ authenticated: false });
+ const after = await turn(instance, "native-loop-again", fixture.directory);
+ expect(after.events).toContainEqual(expect.objectContaining({ type: "runtime.error", message: expect.stringContaining(LOGIN_NOTE), setup: true }));
+ expect(after.done).toMatchObject({ ok: false, stopReason: "auth_required" });
+
+ expect(fixture.methods()).not.toContain("authenticate");
+ }, 120_000);
+
+ it("reads a CLI signed in through --login as signed in, and runs the turn", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-terminal";
+ const instance = await create(instanceId, fixture);
+ expect(await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code")).toBe(0);
+ expect(existsSync(credentials(instanceId))).toBe(true);
+ // The CLI itself accepts a session: the sign-in is valid, whatever file MausBot looks at.
+ expect(await sessionAcceptedAt(fixture, antigravityProfileDirectory(instanceId))).toBe(true);
+ expect(await instance.snapshot()).toMatchObject({ authenticated: true });
+ const { done } = await turn(instance, "native-terminal", fixture.directory);
+ expect(done).toMatchObject({ ok: true });
+ expect(fixture.methods()).toContain("session/prompt");
+ expect(fixture.methods()).not.toContain("authenticate");
+ }, 120_000);
+
+ it("forgets a signed-out answer when the instance is rebuilt, so a sign-in made meanwhile at a terminal is used at once", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-rebuilt";
+ const first = await create(instanceId, fixture);
+ expect(await first.snapshot()).toMatchObject({ authenticated: false });
+ await first.dispose();
+ instances.splice(instances.indexOf(first), 1);
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ const rebuilt = await create(instanceId, fixture);
+ const { done } = await turn(rebuilt, "native-rebuilt", fixture.directory);
+ expect(done).toMatchObject({ ok: true });
+ }, 120_000);
+
+ it("starts no process of its own to ask about the sign-in before a turn", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-one-process";
+ const instance = await create(instanceId, fixture);
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ const before = fixture.methods().filter((method) => method === "initialize").length;
+ const { done } = await turn(instance, "native-one-process", fixture.directory);
+ expect(done).toMatchObject({ ok: true });
+ expect(fixture.methods().filter((method) => method === "initialize").length - before).toBe(1);
+ }, 120_000);
+
+ it("sends no authenticate for model discovery, background text or a refused turn, and fails each as a sign-in request", async () => {
+ const fixture = nativeFixture(folder());
+ const instance = await create("antigravity-native-no-authenticate", fixture);
+ await instance.refreshModels!();
+ expect(instance.modelsUnconfirmed).toBe(true);
+ expect(instance.modelsUnreadable).toBe("signedOut");
+ await expect(instance.generateMemoryText!("hello")).rejects.toThrow(LOGIN_NOTE);
+ const { done } = await turn(instance, "native-no-authenticate", fixture.directory);
+ expect(done).toMatchObject({ ok: false, stopReason: "auth_required" });
+ expect(fixture.methods()).not.toContain("authenticate");
+ expect(fixture.methods()).toContain("session/new");
+ }, 120_000);
+
+ it("keeps a sign-in the CLI already held when the instance has never signed in here", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-background";
+ const instance = await create(instanceId, fixture);
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ expect(await instance.generateMemoryText!("hello")).toBe("fixture reply");
+ expect(fixture.methods()).not.toContain("authenticate");
+ }, 120_000);
+
+ it("reads a background session the CLI refuses as a sign-out, so the status stops saying signed in", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-background-refused";
+ const instance = await create(instanceId, fixture);
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ expect(await instance.snapshot()).toMatchObject({ authenticated: true });
+ rmSync(credentials(instanceId), { force: true });
+ expect(await instance.snapshot()).toMatchObject({ authenticated: true });
+ await expect(instance.generateMemoryText!("hello")).rejects.toThrow(LOGIN_NOTE);
+ expect(await instance.snapshot()).toMatchObject({ authenticated: false });
+ }, 120_000);
+
+ describe("a CLI that cannot say", () => {
+ it("is not read as signed out: the status leaves the answer out and a turn or check fails as an ordinary error", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-crash";
+ const instance = await create(instanceId, fixture, { FAKE_AGY_HANG: "crash" });
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ const snapshot = await instance.snapshot();
+ expect(snapshot.state).toBe("available");
+ expect("authenticated" in snapshot).toBe(false);
+ const { done, events } = await turn(instance, "crash", fixture.directory);
+ expect(done).toMatchObject({ ok: false });
+ expect(done).not.toMatchObject({ stopReason: "auth_required" });
+ expect(events.some((event) => event.type === "runtime.error" && (event as { setup?: boolean }).setup === true)).toBe(false);
+ await expect(instance.generateMemoryText!("hello")).rejects.toThrow(/exited/u);
+ }, 120_000);
+ });
+
+ describe("what was last read of the sign-in", () => {
+ it("holds a signed-out answer for a while, and a check asks the CLI again at once", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-cache";
+ const instance = await create(instanceId, fixture);
+ expect(await instance.snapshot()).toMatchObject({ authenticated: false });
+ const asked = () => fixture.methods().filter((method) => method === "session/new").length;
+ const before = asked();
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ expect(await instance.snapshot()).toMatchObject({ authenticated: false });
+ expect(asked()).toBe(before);
+ instance.forgetAuthentication!();
+ expect(await instance.snapshot()).toMatchObject({ authenticated: true });
+ expect(await instance.generateMemoryText!("hello")).toBe("fixture reply");
+ }, 120_000);
+
+ });
+
+ describe("signing out", () => {
+ it("asks the CLI to log out and removes what it kept", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-sign-out";
+ const instance = await create(instanceId, fixture);
+ const started = await instance.startAuthentication!();
+ await instance.completeAuthentication!(started.flowId!, "fixture-code");
+ await instance.signOut!();
+ expect(fixture.methods()).toContain("logout");
+ expect(existsSync(credentials(instanceId))).toBe(false);
+ }, 120_000);
+
+ // The app starts the CLI as over SSH (antigravity-acp.ts), so each account keeps its own sign-in in its own profile.
+ it("signs this account alone out: another account on the native CLI keeps its own sign-in", async () => {
+ const fixture = nativeFixture(folder());
+ const [one, two] = ["antigravity-native-file-one", "antigravity-native-file-two"];
+ const first = await create(one, fixture);
+ const second = await create(two, fixture);
+ for (const instanceId of [one, two]) await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ expect(await second.snapshot()).toMatchObject({ authenticated: true });
+ await first.signOut!();
+ expect(existsSync(credentials(one))).toBe(false);
+ expect(existsSync(credentials(two))).toBe(true);
+ expect(await first.snapshot()).toMatchObject({ authenticated: false });
+ expect(await second.snapshot()).toMatchObject({ authenticated: true });
+ }, 120_000);
+
+ it("signs out an account on agy that runs the native CLI", async () => {
+ installFakeManagedCli(DATA_DIR);
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-agy-signs-out";
+ const agy = await create(instanceId, fixture, {}, "agy");
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ await agy.signOut!();
+ expect(fixture.methods()).toContain("logout");
+ expect(existsSync(credentials(instanceId))).toBe(false);
+ }, 120_000);
+
+ it("leaves the pinned sign-in of an account that ran the native CLI and was moved back to the pinned runtime", async () => {
+ const fixture = nativeFixture(folder());
+ const [moved, native] = ["antigravity-native-moved-back", "antigravity-native-moved-other"];
+ const before = await create(moved, fixture);
+ await loginAt(fixture, antigravityProfileDirectory(moved), "fixture-code");
+ expect((await turn(before, "moved-native", fixture.directory)).done).toMatchObject({ ok: true });
+ await before.dispose();
+ instances.splice(instances.indexOf(before), 1);
+ await create(moved, fixture, {}, pinnedRuntime());
+ const token = antigravityTokenPath(moved);
+ mkdirSync(dirname(token), { recursive: true });
+ writeFileSync(token, "{}", { mode: 0o600 });
+ const signingOut = await create(native, fixture);
+ await loginAt(fixture, antigravityProfileDirectory(native), "fixture-code");
+ await signingOut.signOut!();
+ expect(existsSync(token)).toBe(true);
+ }, 120_000);
+
+ it("leaves the sign-in of an account whose program is called antigravity but runs the pinned runtime beside its harness", async () => {
+ const fixture = nativeFixture(folder());
+ const [pinned, native] = ["antigravity-native-named-pinned", "antigravity-native-named-native"];
+ await create(pinned, fixture, {}, pinnedRuntime("antigravity"));
+ const token = antigravityTokenPath(pinned);
+ mkdirSync(dirname(token), { recursive: true });
+ writeFileSync(token, "{}", { mode: 0o600 });
+ const signingOut = await create(native, fixture);
+ await loginAt(fixture, antigravityProfileDirectory(native), "fixture-code");
+ await signingOut.signOut!();
+ expect(existsSync(token)).toBe(true);
+ }, 120_000);
+
+ it("leaves another account's sign-in in progress alone", async () => {
+ installFakeManagedCli(DATA_DIR);
+ const fixture = nativeFixture(folder());
+ const signingIn = await create("antigravity-native-agy-login", fixture, {}, "agy");
+ const started = await signingIn.startAuthentication!();
+ expect(started).toMatchObject({ phase: "waiting", kind: "pasted-code" });
+ const other = await create("antigravity-native-agy-other", fixture);
+ await loginAt(fixture, antigravityProfileDirectory("antigravity-native-agy-other"), "fixture-code");
+ await other.signOut!();
+ expect(await signingIn.getAuthentication!(started.flowId!)).toMatchObject({ phase: "waiting" });
+ }, 120_000);
+
+ // 1.5.14 keeps one keyring entry per computer unless it runs over SSH; started as over SSH it never uses the keyring.
+ it.each([["answers logout and keeps the sign-in", "ignore"], ["refuses logout", "refuse"]])("signs out, never touching the keyring, when the CLI %s", async (_name, logout) => {
+ const fixture = nativeFixture(folder());
+ const keyring = folder();
+ const instanceId = `antigravity-native-keyring-${logout}`;
+ const instance = await create(instanceId, fixture, { FAKE_AGY_KEYRING: keyring, FAKE_AGY_LOGOUT: logout });
+ const started = await instance.startAuthentication!();
+ await instance.completeAuthentication!(started.flowId!, "fixture-code");
+ expect(existsSync(credentials(instanceId))).toBe(true);
+ await instance.signOut!();
+ expect(await instance.snapshot()).toMatchObject({ authenticated: false });
+ expect(readdirSync(keyring)).toEqual([]);
+ }, 120_000);
+
+ it("fails, with the account kept, when the CLI cannot be asked to confirm", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-unconfirmed";
+ const instance = await create(instanceId, fixture, { FAKE_AGY_HANG: "crash" });
+ const started = await instance.startAuthentication!();
+ await instance.completeAuthentication!(started.flowId!, "fixture-code");
+ await expect(instance.signOut!()).rejects.toThrow("could not confirm the sign-out");
+ }, 120_000);
+
+ it("fails, rather than pass as done, when an account set to the native CLI cannot start it", async () => {
+ const instance = await create("antigravity-native-missing-cli", nativeFixture(folder()), {}, "antigravity");
+ await expect(instance.signOut!()).rejects.toThrow(/Antigravity CLI is not installed/u);
+ const agy = await create("antigravity-native-agy-missing-cli", nativeFixture(folder()), { PATH: "/usr/bin:/bin" }, "agy");
+ await expect(agy.signOut!()).rejects.toThrow();
+ const moved = nativeFixture(folder());
+ const custom = await create("antigravity-native-moved-cli", moved);
+ renameSync(moved.executable, join(moved.directory, "moved-away"));
+ await expect(custom.signOut!()).rejects.toThrow();
+ }, 60_000);
+
+ it("starts no native process of the account while its sign-in is being removed, so none reads the old sign-in", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-gated";
+ const instance = await create(instanceId, fixture, { FAKE_AGY_LOGOUT_MS: "1500" });
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ const signingOut = instance.signOut!();
+ await vi.waitFor(() => expect(fixture.entries().some((entry) => entry.event === "logout-start")).toBe(true), { timeout: 30_000 });
+ instance.forgetAuthentication!();
+ const during = instance.snapshot();
+ await signingOut;
+ expect(await during).toMatchObject({ authenticated: false });
+ }, 60_000);
+
+ it("signs an account on the pinned runtime out of both runtimes' sign-ins in its profile, without starting the CLI", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-pinned-signout";
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ const pinned = await create(instanceId, fixture, {}, pinnedRuntime());
+ await pinned.signOut!();
+ expect(fixture.methods()).not.toContain("logout");
+ expect(existsSync(credentials(instanceId))).toBe(false);
+ }, 120_000);
+
+ it("does not ask for a sign-in when the CLI's sign-in service is down, in a turn or background text", async () => {
+ const fixture = nativeFixture(folder());
+ const instanceId = "antigravity-native-service-down";
+ const instance = await create(instanceId, fixture, { FAKE_AGY_SESSION_ERROR: "Authentication service unavailable" });
+ await loginAt(fixture, antigravityProfileDirectory(instanceId), "fixture-code");
+ const { done, events } = await turn(instance, "native-service-down", fixture.directory);
+ expect(done).toMatchObject({ ok: false });
+ expect(done).not.toMatchObject({ stopReason: "auth_required" });
+ expect(events.some((event) => event.type === "runtime.error" && (event as { setup?: boolean }).setup === true)).toBe(false);
+ await expect(instance.generateMemoryText!("hello")).rejects.not.toThrow(LOGIN_NOTE);
+ }, 120_000);
+ });
+
+ describe("which CLI an instance starts, with only the native CLI installed", () => {
+ it.each(["antigravity", "agy"])("starts the native CLI for the path %s and says it runs it", async (cli) => {
+ installFakeManagedCli(DATA_DIR);
+ const asked = nativeFixture(folder());
+ const native = await create(`antigravity-policy-${cli}`, asked, {}, cli);
+ expect(await native.snapshot()).toMatchObject({ state: "available", version: "1.5.14", authenticated: false, nativeCli: true });
+ expect(asked.methods()).toContain("initialize");
+ }, 120_000);
+ });
+
+ describe("pasting into a sign-in", () => {
+ it("refuses a second paste, one for another sign-in and one that is not a code, and ends on a wrong code", async () => {
+ const fixture = nativeFixture(folder());
+ const instance = await create("antigravity-native-paste", fixture);
+ const started = await instance.startAuthentication!();
+ await expect(instance.completeAuthentication!("another-flow", "fixture-code")).rejects.toThrow("no longer active");
+ await expect(instance.completeAuthentication!(started.flowId!, "two\nlines")).rejects.toThrow("only the authorization code");
+ await expect(instance.completeAuthentication!(started.flowId!, "https://example.test/oauth-callback?code=abc")).rejects.toThrow("not the page Google ends on");
+ await expect(instance.completeAuthentication!(started.flowId!, "wrong-code")).rejects.toThrow("sign-in failed");
+ expect(await instance.getAuthentication!(started.flowId!)).toMatchObject({ phase: "failed" });
+ }, 120_000);
+
+ it("accepts the callback page's full address, and a new sign-in replaces one that was never finished", async () => {
+ const fixture = nativeFixture(folder());
+ const instance = await create("antigravity-native-address", fixture);
+ const first = await instance.startAuthentication!();
+ const second = await instance.startAuthentication!();
+ expect(second.flowId).not.toBe(first.flowId);
+ expect(await instance.getAuthentication!(first.flowId!)).toMatchObject({ phase: "cancelled" });
+ await expect(instance.completeAuthentication!(first.flowId!, "fixture-code")).rejects.toThrow("no longer active");
+ await instance.completeAuthentication!(second.flowId!, "https://antigravity.google/oauth-callback?code=fixture-code&state=fixture-state");
+ await expect(instance.completeAuthentication!(second.flowId!, "fixture-code")).rejects.toThrow("no longer active");
+ expect(await instance.snapshot()).toMatchObject({ authenticated: true });
+ }, 120_000);
+
+ it("is cancelled with its process gone", async () => {
+ const fixture = nativeFixture(folder());
+ const instance = await create("antigravity-native-cancel", fixture);
+ const started = await instance.startAuthentication!();
+ const pid = fixture.entries().find((entry) => entry.event === "login-start")!.pid as number;
+ await instance.cancelAuthentication!();
+ expect(() => process.kill(pid, 0)).toThrow();
+ expect(await instance.getAuthentication!(started.flowId!)).toMatchObject({ phase: "cancelled" });
+ }, 120_000);
+ });
+
+ describe("signing out while a sign-in waits", () => {
+ it("ends the sign-in's process before the CLI is asked to log out, through the sign-out the app offers", async () => {
+ const fixture = nativeFixture(folder());
+ const instance = await create("antigravity-native-waiting", fixture);
+ const sessions = new ProviderAuthSessions();
+ const started = await sessions.start(instance, "browser");
+ expect(started).toMatchObject({ phase: "waiting", kind: "pasted-code" });
+ const pid = fixture.entries().find((entry) => entry.event === "login-start")!.pid as number;
+ await sessions.signOut(instance, "browser");
+ expect(() => process.kill(pid, 0)).toThrow();
+ expect(fixture.entries().some((entry) => entry.event === "login-code")).toBe(false);
+ // The sign-in ended; nobody was signed in, so there was nothing for the CLI to log out of.
+ expect(await instance.getAuthentication!(started.flowId!)).toMatchObject({ phase: "cancelled" });
+ expect(await instance.snapshot()).toMatchObject({ authenticated: false });
+ }, 120_000);
+ });
+
+ describe("a sign-in that never gets as far as a link", () => {
+ it.each([
+ ["a link to another host", { FAKE_AGY_LOGIN: "bad-domain" }],
+ ["a link that redirects elsewhere", { FAKE_AGY_LOGIN: "bad-redirect" }],
+ ])("fails with a fixed line for %s", async (_name, env) => {
+ const fixture = nativeFixture(folder());
+ const instance = await create(`antigravity-native-${_name.replaceAll(" ", "-")}`, fixture, env);
+ const failure = await instance.startAuthentication!().then(() => null, (error: Error) => error);
+ expect(failure).not.toBeNull();
+ expect(failure!.message).toMatch(/invalid Google sign-in link/u);
+ }, 120_000);
+ });
+});
diff --git a/server/drivers/antigravity-native-status.test.ts b/server/drivers/antigravity-native-status.test.ts
new file mode 100644
index 0000000000..35a8b79a1f
--- /dev/null
+++ b/server/drivers/antigravity-native-status.test.ts
@@ -0,0 +1,200 @@
+import { existsSync, mkdtempSync, readdirSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { removeTempDir } from "../testing/cleanup.ts";
+import { loginAt, nativeFixture, type NativeFixture } from "../testing/antigravity-native-fixture.ts";
+import { prepareAntigravityProfile, type AntigravityProfile } from "./antigravity-acp.ts";
+import { NativeSignInCache, antigravityCliRefusedSession, antigravityCliSignIn, antigravityNativeTokenPath, signOutAntigravityCli } from "./antigravity-native-status.ts";
+import type { AntigravityRuntime } from "./antigravity-runtime.ts";
+import { acpRpcError } from "./acp/rpc-error.ts";
+
+const WINDOWS = process.platform === "win32";
+const scratch: string[] = [];
+
+afterEach(async () => {
+ while (scratch.length) await removeTempDir(scratch.pop()!);
+});
+
+describe("the native CLI's sign-in state, asked of the CLI", () => {
+ async function setup(env: Record<string, string> = {}) {
+ const directory = mkdtempSync(join(tmpdir(), "omb-antigravity-status-"));
+ scratch.push(directory);
+ const fixture: NativeFixture = nativeFixture(join(directory, "cli"));
+ const runtime: AntigravityRuntime = { executablePath: fixture.executable, harnessPath: null, source: "override", version: "1.5.14" };
+ const profile: AntigravityProfile = await prepareAntigravityProfile({
+ instanceId: "status", runtime, baseDir: directory, baseEnv: { ...process.env, FAKE_AGY_LOG: fixture.log, ...env },
+ });
+ return { fixture, runtime, profile };
+ }
+
+ describe.skipIf(WINDOWS)("by whether a session is accepted", () => {
+ it("is out on `Authentication required`, in once signed in, and closes the session it opened", async () => {
+ const { fixture, runtime, profile } = await setup();
+ expect(await antigravityCliSignIn(runtime, profile)).toBe("out");
+ expect(await loginAt(fixture, profile.directory, "fixture-code")).toBe(0);
+ expect(await antigravityCliSignIn(runtime, profile)).toBe("in");
+ await vi.waitFor(() => expect(fixture.methods()).toEqual(expect.arrayContaining(["initialize", "session/new", "session/close"])));
+ expect(fixture.methods()).not.toContain("authenticate");
+ }, 60_000);
+
+ it("says nothing, by throwing, when the CLI crashes or takes too long, and never says out", async () => {
+ const crashing = await setup({ FAKE_AGY_HANG: "crash" });
+ await expect(antigravityCliSignIn(crashing.runtime, crashing.profile)).rejects.toThrow(/exited/u);
+ const hung = await setup({ FAKE_AGY_HANG: "session-new" });
+ await expect(antigravityCliSignIn(hung.runtime, hung.profile, { requestMs: 300 })).rejects.toThrow(/timed out/u);
+ const silent = await setup({ FAKE_AGY_HANG: "initialize" });
+ await expect(antigravityCliSignIn(silent.runtime, silent.profile, { initializeMs: 300, capMs: 600 })).rejects.toThrow(/timed out/u);
+ }, 60_000);
+
+ it("does not take a refusal for another reason as a sign-in request", async () => {
+ const { runtime, profile } = await setup();
+ const missing = { ...runtime, executablePath: join(profile.directory, "no-such-cli") };
+ await expect(antigravityCliSignIn(missing, profile)).rejects.toThrow();
+ }, 60_000);
+ });
+
+ describe.skipIf(WINDOWS)("signing out", () => {
+ it("logs out, removes the file store, and checks with a new process that no session is accepted", async () => {
+ const { fixture, runtime, profile } = await setup();
+ await loginAt(fixture, profile.directory, "fixture-code");
+ expect(existsSync(antigravityNativeTokenPath(profile))).toBe(true);
+ await signOutAntigravityCli(runtime, profile);
+ expect(existsSync(antigravityNativeTokenPath(profile))).toBe(false);
+ expect(fixture.methods()).toContain("logout");
+ expect(await antigravityCliSignIn(runtime, profile)).toBe("out");
+ }, 60_000);
+
+ // The app starts the CLI as over SSH, so its sign-in is the profile's file; a CLI that kept it in its keyring all the
+ // same (here: started without SSH_CONNECTION) must not pass as signed out.
+ it("fails when the CLI still accepts a session, even though logout was refused or ignored", async () => {
+ for (const logout of ["refuse", "ignore"]) {
+ const keyring = mkdtempSync(join(tmpdir(), "omb-antigravity-keyring-"));
+ scratch.push(keyring);
+ const { fixture, runtime, profile } = await setup({ FAKE_AGY_KEYRING: keyring, FAKE_AGY_LOGOUT: logout });
+ const { SSH_CONNECTION: _ssh, ...environment } = profile.environment;
+ await loginAt(fixture, profile.directory, "fixture-code", { FAKE_AGY_KEYRING: keyring });
+ await expect(signOutAntigravityCli(runtime, { ...profile, environment })).rejects.toThrow("still reports a Google sign-in");
+ }
+ }, 60_000);
+
+ it("ends a sign-in the CLI keeps in the profile's file whatever logout answers, and never touches the keyring", async () => {
+ for (const logout of ["refuse", "ignore"]) {
+ const keyring = mkdtempSync(join(tmpdir(), "omb-antigravity-keyring-"));
+ scratch.push(keyring);
+ const { fixture, runtime, profile } = await setup({ FAKE_AGY_KEYRING: keyring, FAKE_AGY_LOGOUT: logout });
+ await loginAt(fixture, profile.directory, "fixture-code", { FAKE_AGY_KEYRING: keyring, SSH_CONNECTION: profile.environment.SSH_CONNECTION! });
+ expect(existsSync(antigravityNativeTokenPath(profile))).toBe(true);
+ await signOutAntigravityCli(runtime, profile);
+ expect(await antigravityCliSignIn(runtime, profile)).toBe("out");
+ expect(readdirSync(keyring)).toEqual([]);
+ }
+ }, 60_000);
+
+ it("fails when the check cannot be made", async () => {
+ const { fixture, runtime, profile } = await setup({ FAKE_AGY_HANG: "crash" });
+ await loginAt(fixture, profile.directory, "fixture-code");
+ await expect(signOutAntigravityCli(runtime, profile)).rejects.toThrow("could not confirm the sign-out");
+ }, 60_000);
+ });
+});
+
+describe("what was last read", () => {
+ const runtime = "/cli/antigravity\u00001.5.14";
+ const answers = (...states: Array<"in" | "out" | Error>) => {
+ let calls = 0;
+ return { read: async () => { const next = states[Math.min(calls++, states.length - 1)]!; if (next instanceof Error) throw next; return next; }, calls: () => calls };
+ };
+
+ it("keeps a signed-out answer for its time, and a signed-in one until forget", async () => {
+ let now = 1_000;
+ const cache = new NativeSignInCache({ ttlMs: 30_000, now: () => now });
+ const source = answers("out", "in", "out");
+ expect(await cache.state("a", runtime, source.read)).toBe("out");
+ now += 29_999;
+ expect(await cache.state("a", runtime, source.read)).toBe("out");
+ expect(source.calls()).toBe(1);
+ now += 1;
+ expect(await cache.state("a", runtime, source.read)).toBe("in");
+ now += 24 * 60 * 60_000;
+ expect(await cache.state("a", runtime, source.read)).toBe("in");
+ expect(cache.known("a", runtime)).toBe("in");
+ expect(source.calls()).toBe(2);
+ cache.forget("a");
+ expect(cache.known("a", runtime)).toBeUndefined();
+ expect(await cache.state("a", runtime, source.read)).toBe("out");
+ expect(source.calls()).toBe(3);
+ });
+
+ it("keeps what another request learned, unless forget came after that request began", async () => {
+ const cache = new NativeSignInCache();
+ cache.seen("a", runtime)("in");
+ expect(await cache.state("a", runtime, async () => { throw new Error("must be kept"); })).toBe("in");
+ const late = cache.seen("b", runtime);
+ cache.forget("b");
+ late("in");
+ expect(cache.known("b", runtime)).toBeUndefined();
+ });
+
+ it("is kept for each instance apart", async () => {
+ const cache = new NativeSignInCache();
+ expect(await cache.state("a", runtime, async () => "in")).toBe("in");
+ expect(await cache.state("b", runtime, async () => "out")).toBe("out");
+ });
+
+ it("shares a read in flight, and does not keep a failed one", async () => {
+ const cache = new NativeSignInCache();
+ let release!: () => void;
+ const held = new Promise<void>((resolve) => { release = resolve; });
+ let calls = 0;
+ const slow = async () => { calls += 1; await held; return "in" as const; };
+ const one = cache.state("a", runtime, slow);
+ const two = cache.state("a", runtime, slow);
+ release();
+ expect(await Promise.all([one, two])).toEqual(["in", "in"]);
+ expect(calls).toBe(1);
+ const failing = answers(new Error("exited 3"), "out");
+ await expect(cache.state("b", runtime, failing.read)).rejects.toThrow("exited 3");
+ expect(await cache.state("b", runtime, failing.read)).toBe("out");
+ });
+
+ it("asks again after forget, and a read that began before it never writes its answer back", async () => {
+ const cache = new NativeSignInCache();
+ let release!: () => void;
+ const held = new Promise<void>((resolve) => { release = resolve; });
+ const early = cache.state("a", runtime, async () => { await held; return "in" as const; });
+ cache.forget("a");
+ release();
+ expect(await early).toBe("in");
+ // The early read was before the sign-out: what it saw stands for nothing now.
+ const next = answers("out");
+ expect(await cache.state("a", runtime, next.read)).toBe("out");
+ expect(next.calls()).toBe(1);
+ expect(await cache.state("a", runtime, async () => { throw new Error("must be cached"); })).toBe("out");
+ cache.forget("a");
+ expect(await cache.state("a", runtime, async () => "in")).toBe("in");
+ });
+
+ it("is a new question for another runtime", async () => {
+ const cache = new NativeSignInCache();
+ expect(await cache.state("a", runtime, async () => "in")).toBe("in");
+ expect(await cache.state("a", "/other/antigravity\u00001.5.15", async () => "out")).toBe("out");
+ });
+});
+
+describe("the native CLI's refusal of a session for want of a sign-in", () => {
+ it("is its own answer, and not another -32000 such as a sign-in service that is down", () => {
+ expect(antigravityCliRefusedSession({ code: -32000, message: "Authentication required" })).toBe(true);
+ expect(antigravityCliRefusedSession({ code: -32000, message: "Sign-in required" })).toBe(true);
+ expect(antigravityCliRefusedSession({ code: -32000, message: "Authentication required." })).toBe(true);
+ expect(antigravityCliRefusedSession(acpRpcError({ code: -32000, message: "Authentication required" }, "session/new"))).toBe(true);
+ expect(antigravityCliRefusedSession(acpRpcError({ code: -32000, message: "Authentication required check failed" }, "session/new"))).toBe(false);
+ expect(antigravityCliRefusedSession({ code: -32000, message: "Authentication required check failed" })).toBe(false);
+ expect(antigravityCliRefusedSession({ code: -32000, message: "Google Gemini (Antigravity) background Authentication required" })).toBe(true);
+ expect(antigravityCliRefusedSession({ code: -32000, message: "Authentication service unavailable" })).toBe(false);
+ expect(antigravityCliRefusedSession({ code: -32000, message: "Unable to determine whether authentication is required" })).toBe(false);
+ expect(antigravityCliRefusedSession({ code: -32603, message: "Authentication required" })).toBe(false);
+ expect(antigravityCliRefusedSession(new Error("Authentication required"))).toBe(false);
+ });
+});
diff --git a/server/drivers/antigravity-native-status.ts b/server/drivers/antigravity-native-status.ts
new file mode 100644
index 0000000000..ea61f3b308
--- /dev/null
+++ b/server/drivers/antigravity-native-status.ts
@@ -0,0 +1,188 @@
+// What the native Antigravity CLI says about the Google account an instance is signed in with, and signing it out.
+//
+// The CLI keeps its sign-in in the profile's file (antigravity-acp.ts starts it as over SSH) and has no status command,
+// and the file says nothing of whether Google still honours it: the answer is
+// whether `session/new` is accepted. `-32000 Authentication required` is signed out; anything else that stops the
+// answer (a timeout, a crash) says nothing, and is thrown, never counted as signed out.
+import type { ChildProcess } from "node:child_process";
+import { rm } from "node:fs/promises";
+import { join } from "node:path";
+
+import {
+ AntigravityAcpClient,
+ antigravitySessionSetup,
+ type AntigravityProfile,
+} from "./antigravity-acp.ts";
+import type { AntigravityRuntime } from "./antigravity-runtime.ts";
+import { ANTIGRAVITY_CLI_TOKEN_FILE } from "./antigravity-cli-install.ts";
+import { acpVendorMessage } from "./acp/rpc-error.ts";
+
+export type NativeSignIn = "in" | "out";
+
+export interface NativeProbeTiming {
+ initializeMs?: number;
+ capMs?: number;
+ requestMs?: number;
+ /** Every CLI process started, so a sign-out can wait for it. */
+ onProcess?: (child: ChildProcess) => void;
+}
+
+const INITIALIZE_WINDOW_MS = 20_000;
+const INITIALIZE_CAP_MS = 60_000;
+const REQUEST_MS = 30_000;
+const SESSION_CLOSE_MS = 5_000;
+/** How long a signed-out answer stands, so a sign-in made at a terminal shows. */
+export const SIGN_IN_CACHE_MS = 30_000;
+
+/** The native CLI's own answer to a session it will not start without a sign-in (1.5.14: `-32000 Authentication
+ * required`). Another `-32000`, such as a sign-in service that is down, says nothing about the sign-in. */
+export function antigravityCliRefusedSession(error: unknown): boolean {
+ const value = error as { code?: unknown; message?: unknown } | null;
+ const message = acpVendorMessage(error) ?? value?.message;
+ return value?.code === -32000 && typeof message === "string" && /^\s*(?:.*?\bbackground\s+)?(?:authentication|sign[- ]?in|log[- ]?in) (?:is )?required[.!]?\s*$/iu.test(message);
+}
+
+const advertised = (value: unknown) => value === true || (typeof value === "object" && value !== null && !Array.isArray(value));
+
+/** The CLI's own file store for the sign-in: the only one it uses as this app starts it. */
+export const antigravityNativeTokenPath = (profile: Pick<AntigravityProfile, "directory">) =>
+ join(profile.directory, "antigravity-acp", ANTIGRAVITY_CLI_TOKEN_FILE);
+
+/** Runs `work` on a new CLI process and ends it; with `waitForExit` the process is gone before this resolves, or it throws. */
+async function withCli<T>(
+ runtime: AntigravityRuntime,
+ profile: AntigravityProfile,
+ timing: NativeProbeTiming & { waitForExit?: boolean },
+ work: (client: AntigravityAcpClient) => Promise<T>,
+): Promise<T> {
+ const client = new AntigravityAcpClient(runtime, profile, profile.directory);
+ timing.onProcess?.(client.child);
+ const result = await work(client).then((value) => ({ value }), (error: unknown) => ({ error }));
+ if (!timing.waitForExit) client.close();
+ else if (!(await client.closeAndWait())) throw new Error("Antigravity did not shut down when asked to.");
+ if ("error" in result) throw result.error;
+ return result.value;
+}
+
+/** `waitForExit`: the process is gone before this resolves, for a check that must not race what the CLI may still write. */
+export async function antigravityCliSignIn(
+ runtime: AntigravityRuntime,
+ profile: AntigravityProfile,
+ timing: NativeProbeTiming & { waitForExit?: boolean } = {},
+): Promise<NativeSignIn> {
+ return await withCli(runtime, profile, timing, async (client) => {
+ const initialized = await client.initialize(timing.initializeMs ?? INITIALIZE_WINDOW_MS, Date.now() + (timing.capMs ?? INITIALIZE_CAP_MS));
+ let session: { sessionId?: unknown } | undefined;
+ try {
+ session = await client.request(
+ "session/new",
+ { cwd: profile.directory, mcpServers: [], ...antigravitySessionSetup(initialized) },
+ timing.requestMs ?? REQUEST_MS,
+ );
+ } catch (error) {
+ if (antigravityCliRefusedSession(error)) return "out";
+ throw error;
+ }
+ if (advertised(initialized?.agentCapabilities?.sessionCapabilities?.close) && typeof session?.sessionId === "string") {
+ await client.request("session/close", { sessionId: session.sessionId }, SESSION_CLOSE_MS).catch(() => {});
+ }
+ return "in";
+ });
+}
+
+/** Asks the CLI to forget its sign-in, then removes the file store it may have used, and with `files: "all"` the pinned
+ * runtime's token file too. A refused `logout` is not final: the sign-out is judged by a new session afterwards. */
+async function logoutAndForget(runtime: AntigravityRuntime, profile: AntigravityProfile, timing: NativeProbeTiming, files: NativeSignOutFiles): Promise<void> {
+ await withCli(runtime, profile, { ...timing, waitForExit: true }, async (client) => {
+ const initialized = await client.initialize(timing.initializeMs ?? INITIALIZE_WINDOW_MS, Date.now() + (timing.capMs ?? INITIALIZE_CAP_MS));
+ if (advertised(initialized?.agentCapabilities?.auth?.logout)) await client.request("logout", {}, timing.requestMs ?? REQUEST_MS).catch(() => {});
+ });
+ for (const file of files === "all" ? [antigravityNativeTokenPath(profile), profile.tokenPath] : [antigravityNativeTokenPath(profile)]) {
+ await rm(file, { force: true, recursive: true, maxRetries: 4, retryDelay: 250 });
+ }
+}
+
+/** Signs the profile out through the CLI and confirms with a new process that it no longer accepts a session. */
+export type NativeSignOutFiles = "all" | "native";
+
+export async function signOutAntigravityCli(runtime: AntigravityRuntime, profile: AntigravityProfile, timing: NativeProbeTiming = {}, files: NativeSignOutFiles = "all"): Promise<void> {
+ await logoutAndForget(runtime, profile, timing, files);
+ let state: NativeSignIn | "unknown";
+ try {
+ state = await antigravityCliSignIn(runtime, profile, { ...timing, waitForExit: true });
+ } catch {
+ state = "unknown";
+ }
+ if (state === "in") throw new Error("Antigravity still reports a Google sign-in for this account. Update Antigravity and check its sign-in before trying again.");
+ if (state === "unknown") throw new Error("Antigravity could not confirm the sign-out for this account. Update Antigravity and check its sign-in before trying again.");
+}
+
+interface Entry {
+ state: NativeSignIn;
+ at: number;
+ generation: number;
+ runtime: string;
+}
+
+/** What the CLI last said about each instance. Signed out is kept for `ttlMs`; signed in stands until `forget`, since
+ * asking starts a whole CLI that opens a conversation with Google (1.5.14). A read that began before `forget` never
+ * writes back after it, so a sign-out cannot be undone by a check that started earlier. */
+export class NativeSignInCache {
+ readonly #entries = new Map<string, Entry>();
+ readonly #generations = new Map<string, number>();
+ readonly #reading = new Map<string, { generation: number; runtime: string; read: Promise<NativeSignIn> }>();
+ readonly #ttlMs: number;
+ readonly #now: () => number;
+
+ constructor(options: { ttlMs?: number; now?: () => number } = {}) {
+ this.#ttlMs = options.ttlMs ?? SIGN_IN_CACHE_MS;
+ this.#now = options.now ?? (() => Date.now());
+ }
+
+ #generation(instanceId: string): number {
+ return this.#generations.get(instanceId) ?? 0;
+ }
+
+ #fresh(instanceId: string, runtime: string): Entry | undefined {
+ const known = this.#entries.get(instanceId);
+ const age = known ? this.#now() - known.at : -1;
+ const standing = known?.state === "in" || (age >= 0 && age < this.#ttlMs);
+ return known && known.generation === this.#generation(instanceId) && known.runtime === runtime && standing ? known : undefined;
+ }
+
+ /** What the CLI last said, while it still stands; undefined when it has to be asked. */
+ known(instanceId: string, runtime: string): NativeSignIn | undefined {
+ return this.#fresh(instanceId, runtime)?.state;
+ }
+
+ /** Keeps what another request to the CLI learned, such as a session it accepted, unless `forget` came after `seen` was
+ * made. */
+ seen(instanceId: string, runtime: string): (state: NativeSignIn) => void {
+ const generation = this.#generation(instanceId);
+ return (state) => {
+ if (this.#generation(instanceId) === generation) this.#entries.set(instanceId, { state, at: this.#now(), generation, runtime });
+ };
+ }
+
+ /** `runtime` names the executable and version asked, so a switch of runtime is a new question. A failed read is not kept. */
+ async state(instanceId: string, runtime: string, read: () => Promise<NativeSignIn>): Promise<NativeSignIn> {
+ const generation = this.#generation(instanceId);
+ const known = this.#fresh(instanceId, runtime);
+ if (known) return known.state;
+ const running = this.#reading.get(instanceId);
+ if (running && running.generation === generation && running.runtime === runtime) return running.read;
+ const keep = this.seen(instanceId, runtime);
+ const current = { generation, runtime, read: read().then((state) => { keep(state); return state; }) };
+ this.#reading.set(instanceId, current);
+ const clear = () => { if (this.#reading.get(instanceId) === current) this.#reading.delete(instanceId); };
+ current.read.then(clear, clear);
+ return current.read;
+ }
+
+ /** The next question asks the CLI again: a sign-in, sign-out, runtime switch or refusal changed the answer. */
+ forget(instanceId: string): void {
+ this.#generations.set(instanceId, this.#generation(instanceId) + 1);
+ this.#entries.delete(instanceId);
+ this.#reading.delete(instanceId);
+ }
+}
diff --git a/server/drivers/antigravity-opt-in.test.ts b/server/drivers/antigravity-opt-in.test.ts
index a26e21e2df..2431c48b1b 100644
--- a/server/drivers/antigravity-opt-in.test.ts
+++ b/server/drivers/antigravity-opt-in.test.ts
@@ -1,6 +1,7 @@
-// The native CLI is opt-in (OMB_ANTIGRAVITY_NATIVE_CLI=1). Off, the default, Antigravity behaves as before the CLI: the
-// pinned 1.4.3 runtime is kept and run, Google's CLI channel is never asked, a CLI release is never started, the
-// signed-in check reads acp_token.json, and the updater offers nothing new. On, a computer with the pinned runtime moves.
+// Which runtime an Antigravity account runs. Its CLI path (Settings, Runs on) decides: `antigravity` the native CLI,
+// `agy_acp_server` the pinned (Classic) runtime. With neither, a computer that has the pinned runtime keeps it, nothing
+// is moved, removed or offered, and a new install takes the CLI. OMB_ANTIGRAVITY_NATIVE_CLI=1 gives such an account the
+// CLI even where the pinned runtime is installed; an account set to a runtime keeps it, and nothing is removed.
import { chmodSync, existsSync, mkdirSync, mkdtempSync, statSync, truncateSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
@@ -71,60 +72,51 @@ function recordingFetch() {
return { asked, fetchImpl };
}
-describe.skipIf(!pinned || WINDOWS)("with the native CLI off (the default), Antigravity behaves as before it", () => {
- it("is off unless OMB_ANTIGRAVITY_NATIVE_CLI is exactly 1", async () => {
- expect((await import("./antigravity-cli-install.ts")).ANTIGRAVITY_NATIVE_CLI).toBe(false);
+describe.skipIf(!pinned || WINDOWS)("by default, a computer that has the pinned runtime", () => {
+ it("is not switched by OMB_ANTIGRAVITY_NATIVE_CLI unless it is exactly 1", async () => {
+ expect((await import("./antigravity-cli-install.ts")).ANTIGRAVITY_CLI_FIRST).toBe(false);
for (const value of ["0", "true", "yes", ""]) {
vi.stubEnv("OMB_ANTIGRAVITY_NATIVE_CLI", value);
vi.resetModules();
- expect((await import("./antigravity-cli-install.ts")).ANTIGRAVITY_NATIVE_CLI, value).toBe(false);
+ expect((await import("./antigravity-cli-install.ts")).ANTIGRAVITY_CLI_FIRST, value).toBe(false);
}
});
- it("keeps a computer on the pinned runtime, even beside a CLI release, never starts the CLI, and the updater offers nothing new", async () => {
+ it("keeps running it for an account that names no runtime, even beside a CLI release and a CLI sign-in, and the updater offers no move", async () => {
const runtime = await import("./antigravity-runtime.ts");
const { baseDir, pinnedDir, started } = computer({ cli: true, cliSignIn: true });
- for (const cli of ["agy", undefined]) {
- await expect(runtime.resolveAntigravityRuntime(cli, { PATH: "" }, baseDir)).resolves.toMatchObject({ version: pinned!.version, source: "managed" });
+ for (const cli of ["agy", undefined, "agy_acp_server"]) {
+ await expect(runtime.resolveAntigravityRuntime(cli, { PATH: "" }, baseDir), String(cli)).resolves.toMatchObject({ version: pinned!.version, source: "managed" });
}
- // `antigravity` is no alias for the CLI when off: a custom name looked up on PATH, as on main.
- await expect(runtime.resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir)).rejects.toThrow("sibling is missing.");
const latest = vi.fn(latestRelease);
- expect(await runtime.antigravityCliUpdate({ baseDir, now: Date.now() + 1e9, latest })).toBeNull();
+ expect(await runtime.antigravityCliUpdate({ baseDir, now: Date.now() + 1e9, latest, configuredClis: ["agy"] })).toBeNull();
expect(latest).not.toHaveBeenCalled();
- // The updater's own question, as main asks it: is an older pinned release installed? No.
expect(await runtime.antigravityOlderRuntime(baseDir)).toBeNull();
- expect(await runtime.retirePinnedAntigravityRuntime({ baseDir, inUse: () => false })).toEqual([]);
expect(existsSync(pinnedDir)).toBe(true);
expect(existsSync(started)).toBe(false);
});
- it("never asks Google's CLI channel: an install over the pinned runtime reuses it, and a fresh install downloads the pinned runtime", async () => {
+ it("runs the CLI for an account set to it, and updates the CLI for it", async () => {
+ const runtime = await import("./antigravity-runtime.ts");
+ const { baseDir, pinnedDir } = computer({ cli: true });
+ await expect(runtime.resolveAntigravityRuntime("antigravity", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: "1.5.15", harnessPath: null });
+ const newer = async () => ({ ...(await latestRelease()), version: "1.5.16" });
+ expect(await runtime.antigravityCliUpdate({ baseDir, now: Date.now() + 2e9, latest: newer, configuredClis: ["antigravity"] })).toBe("1.5.15");
+ expect(existsSync(pinnedDir)).toBe(true);
+ });
+
+ it("is reused by an install for an account that names no runtime, and Google's CLI channel is not asked", async () => {
const runtime = await import("./antigravity-runtime.ts");
const existing = computer();
const reuse = recordingFetch();
await expect(runtime.installAntigravityRuntime({ baseDir: existing.baseDir, fetchImpl: reuse.fetchImpl })).resolves.toMatchObject({ version: pinned!.version });
expect(reuse.asked).toEqual([]);
- const fresh = recordingFetch();
- await expect(runtime.installAntigravityRuntime({ baseDir: dataFolder(), fetchImpl: fresh.fetchImpl })).rejects.toThrow("Google download failed (404).");
- expect(fresh.asked).toEqual([pinned!.url]);
- expect(fresh.asked.some((url) => url.startsWith(CHANNEL))).toBe(false);
- expect(runtime.isAntigravityNativeAlias("antigravity")).toBe(false);
});
- it("does not start a custom program named antigravity, and says what it said before", async () => {
- const runtime = await import("./antigravity-runtime.ts");
- const directory = dataFolder(), started = join(directory, "started"), program = join(directory, "antigravity");
- writeFileSync(program, `#!/bin/sh\ntouch ${JSON.stringify(started)}\necho 1.5.15\n`, { mode: 0o755 });
- await expect(runtime.resolveAntigravityRuntime(program, { PATH: "" }, dataFolder()))
- .rejects.toThrow(/^The custom Antigravity ACP executable or its localharness_external sibling is missing\.$/u);
- expect(existsSync(started)).toBe(false);
- });
-
- it("reads the signed-in state from acp_token.json and starts the runtime with the environment it had", async () => {
+ it("reads an account's sign-in from acp_token.json and starts the runtime with the environment it had", async () => {
const acp = await import("./antigravity-acp.ts");
const profile = await acp.prepareAntigravityProfile({
- instanceId: "off", baseDir: dataFolder(), runtime: { executablePath: "/r/agy_acp_server.par", harnessPath: "/r/localharness_external", source: "managed", version: pinned!.version },
+ instanceId: "classic", baseDir: dataFolder(), runtime: { executablePath: "/r/agy_acp_server.par", harnessPath: "/r/localharness_external", source: "managed", version: pinned!.version },
baseEnv: { PATH: "/usr/bin", SSH_CONNECTION: "203.0.113.9 52144 10.0.0.2 22" },
});
expect(profile.tokenPath).toBe(join(profile.directory, "antigravity-acp", "acp_token.json"));
@@ -137,10 +129,31 @@ describe.skipIf(!pinned || WINDOWS)("with the native CLI off (the default), Anti
writeFileSync(profile.tokenPath, "{\"refresh_token\":\"r\"}");
expect(await acp.antigravityProfileAuthenticated(profile)).toBe(true);
});
+});
- it("offers the pinned install card with its download size, as before", async () => {
- const { AntigravityDriver } = await import("./antigravity.ts");
- expect(AntigravityDriver.install?.managed).toEqual({ label: "Install official Antigravity", downloadBytes: pinned!.archiveBytes });
+describe.skipIf(!pinned || WINDOWS)("a new install", () => {
+ it("keeps an account that names no runtime on the CLI once an account set to the Classic runtime installs it beside it", async () => {
+ const runtime = await import("./antigravity-runtime.ts");
+ const { baseDir } = computer({ cli: true });
+ // What installing the CLI on a computer with no pinned runtime leaves behind (antigravity-native-cli.test.ts).
+ writeFileSync(join(baseDir, "tools", "antigravity-acp", `${process.platform}-${process.arch}`, "cli-first.json"), "{}\n");
+ for (const cli of ["agy", undefined]) {
+ await expect(runtime.resolveAntigravityRuntime(cli, { PATH: "" }, baseDir), String(cli)).resolves.toMatchObject({ version: "1.5.15", harnessPath: null });
+ }
+ await expect(runtime.resolveAntigravityRuntime("agy_acp_server", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: pinned!.version, source: "managed" });
+ const newer = async () => ({ ...(await latestRelease()), version: "1.5.16" });
+ expect(await runtime.antigravityCliUpdate({ baseDir, now: Date.now() + 3e9, latest: newer, configuredClis: ["agy_acp_server"] })).toBe("1.5.15");
+ });
+
+ it("takes the CLI from Google's channel for an account that names no runtime, and the pinned runtime for one set to it", async () => {
+ const runtime = await import("./antigravity-runtime.ts");
+ const fresh = recordingFetch();
+ await expect(runtime.installAntigravityRuntime({ baseDir: dataFolder(), fetchImpl: fresh.fetchImpl })).rejects.toThrow();
+ expect(fresh.asked.some((url) => url.startsWith(CHANNEL))).toBe(true);
+ const classic = recordingFetch();
+ await expect(runtime.installAntigravityRuntime({ baseDir: dataFolder(), fetchImpl: classic.fetchImpl, nativeByDefault: false })).rejects.toThrow("Google download failed (404).");
+ expect(classic.asked).toEqual([pinned!.url]);
+ await expect(runtime.resolveAntigravityRuntime(undefined, { PATH: "" }, dataFolder())).rejects.toThrow("The Google Antigravity CLI is not installed yet.");
});
});
@@ -156,15 +169,15 @@ describe.skipIf(!pinned || WINDOWS)("with OMB_ANTIGRAVITY_NATIVE_CLI=1", () => {
const { baseDir } = computer();
await expect(runtime.resolveAntigravityRuntime("agy", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: pinned!.version });
expect(await runtime.antigravityCliUpdate({ baseDir, now: Date.now() + 1e9, latest: latestRelease })).toBe(pinned!.version);
- expect(await runtime.retirePinnedAntigravityRuntime({ baseDir, inUse: () => false })).toEqual([]);
});
- it("runs the CLI once it is installed, and removes the pinned runtime only after an account signed in on it", async () => {
+ it("runs the CLI once it is installed for an account that names no runtime, keeps an account set to the pinned runtime on it, and removes nothing", async () => {
const runtime = await optedIn();
- const before = computer({ cli: true });
- await expect(runtime.resolveAntigravityRuntime("agy", { PATH: "" }, before.baseDir)).resolves.toMatchObject({ version: "1.5.15", harnessPath: null });
- expect(await runtime.retirePinnedAntigravityRuntime({ baseDir: before.baseDir, inUse: () => false })).toEqual([]);
- const after = computer({ cli: true, cliSignIn: true });
- expect(await runtime.retirePinnedAntigravityRuntime({ baseDir: after.baseDir, inUse: () => false })).toEqual([pinned!.sha256]);
+ const { baseDir, pinnedDir } = computer({ cli: true, cliSignIn: true });
+ for (const cli of ["agy", undefined]) {
+ await expect(runtime.resolveAntigravityRuntime(cli, { PATH: "" }, baseDir), String(cli)).resolves.toMatchObject({ version: "1.5.15", harnessPath: null });
+ }
+ await expect(runtime.resolveAntigravityRuntime("agy_acp_server", { PATH: "" }, baseDir)).resolves.toMatchObject({ version: pinned!.version, source: "managed" });
+ expect(existsSync(pinnedDir)).toBe(true);
});
});
diff --git a/server/drivers/antigravity-processes.test.ts b/server/drivers/antigravity-processes.test.ts
new file mode 100644
index 0000000000..f3e169a92e
--- /dev/null
+++ b/server/drivers/antigravity-processes.test.ts
@@ -0,0 +1,37 @@
+import { spawn } from "node:child_process";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import * as procs from "../procs.ts";
+import { AntigravityProcesses } from "./antigravity-processes.ts";
+
+const children: ReturnType<typeof spawn>[] = [];
+
+afterEach(() => {
+ vi.restoreAllMocks();
+ for (const child of children.splice(0)) child.kill("SIGKILL");
+});
+
+function idle() {
+ const child = spawn(process.execPath, ["-e", "setInterval(() => {}, 1000)"], { stdio: "ignore" });
+ children.push(child);
+ return child;
+}
+
+describe("waiting for an account's runtime processes to end", () => {
+ it("is true once every process is gone", async () => {
+ const processes = new AntigravityProcesses();
+ const child = spawn(process.execPath, ["-e", "setTimeout(() => {}, 200)"], { stdio: "ignore" });
+ processes.track("a", child);
+ expect(await processes.stopped("a", 60_000)).toBe(true);
+ expect(processes.count("a")).toBe(0);
+ });
+
+ it("is false while a process outlives its kill, and the process is still tracked", async () => {
+ const kill = vi.spyOn(procs, "killCliTree").mockResolvedValue(false);
+ const processes = new AntigravityProcesses();
+ processes.track("a", idle());
+ expect(await processes.stopped("a", 50)).toBe(false);
+ expect(kill).toHaveBeenCalledOnce();
+ expect(processes.count("a")).toBe(1);
+ });
+});
diff --git a/server/drivers/antigravity-processes.ts b/server/drivers/antigravity-processes.ts
index 3b835a0f60..7f6ec5c77f 100644
--- a/server/drivers/antigravity-processes.ts
+++ b/server/drivers/antigravity-processes.ts
@@ -24,14 +24,28 @@ export class AntigravityProcesses {
return this.#running.get(instanceId)?.size ?? 0;
}
- /** Resolves once this account's processes are gone: each was asked to exit and gets `waitMs` before it is killed. */
- async stopped(instanceId: string, waitMs = EXIT_WAIT_MS): Promise<void> {
+ /** Each of this account's processes was asked to exit and gets `waitMs` before it is killed, then `waitMs` more to go.
+ * Resolves false when one is still there. */
+ async stopped(instanceId: string, waitMs = EXIT_WAIT_MS): Promise<boolean> {
const children = [...this.#running.get(instanceId) ?? []];
- await Promise.all(children.map((child) => new Promise<void>((resolve) => {
- if (child.exitCode !== null || child.signalCode !== null) return resolve();
- const timer = setTimeout(() => void killCliTree(child).catch(() => false).then(() => resolve()), waitMs);
+ const gone = await Promise.all(children.map((child) => new Promise<boolean>((resolve) => {
+ if (child.exitCode !== null || child.signalCode !== null) return resolve(true);
+ let giveUp: ReturnType<typeof setTimeout> | undefined;
+ const finish = (gone: boolean) => {
+ clearTimeout(timer);
+ clearTimeout(giveUp);
+ child.off("close", closed);
+ resolve(gone);
+ };
+ const closed = () => finish(true);
+ const timer = setTimeout(() => {
+ void killCliTree(child).catch(() => false);
+ giveUp = setTimeout(() => finish(false), waitMs);
+ giveUp.unref?.();
+ }, waitMs);
timer.unref?.();
- child.once("close", () => { clearTimeout(timer); resolve(); });
+ child.once("close", closed);
})));
+ return gone.every(Boolean);
}
}
diff --git a/server/drivers/antigravity-runtime.ts b/server/drivers/antigravity-runtime.ts
index ecff5004e8..88051aeb17 100644
--- a/server/drivers/antigravity-runtime.ts
+++ b/server/drivers/antigravity-runtime.ts
@@ -5,10 +5,11 @@
// - apps/server/src/provider/AntigravityInstallation.ts:57, 311-345, 922-966,
// 985-999 (a CLI needs no harness sibling, the hourly look at the channel,
// and keeping an installed CLI that is newer than the channel's).
-// By default the pinned runtime, as before. With OMB_ANTIGRAVITY_NATIVE_CLI=1 (ANTIGRAVITY_NATIVE_CLI) the native CLI is
-// the runtime wherever Google's channel has a build: a computer that has the pinned runtime moves to it through the engine
-// updater, and the pinned one is removed once an account here has signed in on the CLI; the pinned runtime stays the
-// fallback where the channel has no build or cannot be reached. A saved `agy` path is never started.
+// Each account's CLI path chooses its runtime (Settings, Runs on): `antigravity` the native CLI, `agy_acp_server` the
+// pinned runtime. With neither, a computer that has the pinned runtime keeps it and a new install takes the CLI, with the
+// pinned runtime as the fallback where the channel has no build or cannot be reached; OMB_ANTIGRAVITY_NATIVE_CLI=1 gives
+// such an account the CLI even where the pinned runtime is installed. Nothing removes the pinned runtime. A saved `agy`
+// path is never started.
import { createHash, randomUUID } from "node:crypto";
import {
access,
@@ -29,20 +30,22 @@ import { delimiter, dirname, isAbsolute, join, resolve } from "node:path";
import { execFile } from "node:child_process";
-import { DATA_DIR } from "../config.ts";
+import { DATA_DIR, PROVIDER_CREDENTIAL_ENV, WORKSPACE_CREDENTIAL_ENV, stripControlPlaneEnv } from "../config.ts";
import { liveCliCommands, outsideBoxOptions } from "../procs.ts";
import { antigravityRuntimesRoot } from "../engine-roots.ts";
import { extractZipMember, readZipDirectory } from "../zip-archive.ts";
import { augmentedPath } from "../env-path.ts";
+import { writeFileAtomic } from "../atomic.ts";
import {
resolveAntigravityReleaseAsset,
type AntigravityReleaseAsset,
} from "./antigravity-release.ts";
import { parseVersionTriple, versionAtLeast } from "./acp/version-probe.ts";
import {
- ANTIGRAVITY_CLI_TOKEN_FILE,
+ ANTIGRAVITY_CLI_FIRST,
ANTIGRAVITY_NATIVE_CLI,
activeAntigravityCli,
+ antigravityNativeByDefault,
installAntigravityCli,
isAntigravityCliName,
pruneAntigravityCliReleases,
@@ -118,6 +121,8 @@ export interface AntigravityInstallOptions {
asset?: AntigravityReleaseAsset | null;
/** The engine's CLI path asks for the native CLI: install it or fail, with no pinned runtime in its place. */
native?: boolean;
+ /** Whether a configuration that names no CLI runs the native one; the platform's own rule when unset. */
+ nativeByDefault?: boolean;
/** The native CLI release to install, instead of asking Google's channel. */
cliRelease?: AntigravityCliReleaseAsset | null;
fetchImpl?: typeof fetch;
@@ -182,6 +187,17 @@ function pathCandidates(binary: string, env: NodeJS.ProcessEnv): string[] {
const cliVersions = new Map<string, { stamp: string; version: string | null }>();
+const CLI_NOT_INSTALLED = "The Google Antigravity CLI is not installed yet. Install it here, or choose Classic runtime under Runs on.";
+
+/** Security: a program a path names never gets the server's, the workspace's or a provider's credentials. */
+function versionProbeEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
+ const probe = { ...env };
+ stripControlPlaneEnv(probe);
+ const credentials = new Set([...WORKSPACE_CREDENTIAL_ENV, ...PROVIDER_CREDENTIAL_ENV].map((key) => key.toUpperCase()));
+ for (const key of Object.keys(probe)) if (credentials.has(key.toUpperCase())) delete probe[key];
+ return probe;
+}
+
/** The version a custom `antigravity` executable reports, when it is 1.5.0 or newer: only those serve ACP themselves. */
async function nativeCliVersion(executablePath: string, env: NodeJS.ProcessEnv): Promise<string | null> {
const info = await stat(executablePath);
@@ -189,7 +205,7 @@ async function nativeCliVersion(executablePath: string, env: NodeJS.ProcessEnv):
const known = cliVersions.get(executablePath);
if (known?.stamp === stamp) return known.version;
// Security: the probe runs outside the bot box, so the program-trust rule decides whether it may run at all.
- const options = outsideBoxOptions(executablePath, { env, timeout: CLI_VERSION_PROBE_MS, killSignal: "SIGKILL" as const, maxBuffer: 64 * 1024, windowsHide: true, encoding: "utf8" as const });
+ const options = outsideBoxOptions(executablePath, { env: versionProbeEnv(env), timeout: CLI_VERSION_PROBE_MS, killSignal: "SIGKILL" as const, maxBuffer: 64 * 1024, windowsHide: true, encoding: "utf8" as const });
const output = await new Promise<string>((done) => {
execFile(executablePath, ["--version"], options, (error, stdout, stderr) => done(error ? "" : `${stdout}\n${stderr}`));
});
@@ -217,16 +233,54 @@ export function isAntigravityNativeAlias(cli: string | undefined): boolean {
return ANTIGRAVITY_NATIVE_CLI && !/[\\/]/u.test(name) && isAntigravityCliName(name);
}
+/** Whether the engine's CLI path asks for the pinned runtime this app installs and never the native CLI: the runtime's
+ * name with no extension, which names no program on PATH. */
+export function isAntigravityPinnedAlias(cli: string | undefined): boolean {
+ return /^agy_acp_server$/iu.test(cli?.trim() ?? "");
+}
+
+const LEGACY_AGY = /(?:^|[\\/])agy(?:\.(?:cmd|bat|exe|ps1))?$/iu;
+
+/** Whether an instance with this CLI path runs the native CLI, or would once installed, told from files alone: unlike
+ * resolving it, this starts no program. */
+export async function antigravityPathRunsNativeCli(cli: string | undefined, env: NodeJS.ProcessEnv, baseDir = DATA_DIR): Promise<boolean> {
+ const override = cli?.trim();
+ if (isAntigravityNativeAlias(override)) return true;
+ if (isAntigravityPinnedAlias(override)) return false;
+ if (override && override !== "agy" && !LEGACY_AGY.test(override)) {
+ for (const candidate of pathCandidates(override, env)) {
+ const executablePath = resolve(candidate);
+ if (!(await executableFile(executablePath))) continue;
+ return isAntigravityCliName(executablePath) && !(await executableFile(join(dirname(executablePath), executableNames().harness)));
+ }
+ return isAntigravityCliName(override);
+ }
+ const runtime = await resolveAntigravityRuntime(override, env, baseDir).catch(() => null);
+ return runtime ? runtime.harnessPath === null : antigravityNativeByDefault();
+}
+
+/** Written when the native CLI is installed on a computer with no pinned runtime: this computer's accounts that name no
+ * runtime run the CLI from then on, even after an account set to the Classic runtime installs that one beside it. A
+ * computer that had the pinned runtime first never gets it, so its accounts keep the pinned runtime until each chooses. */
+const CLI_FIRST_MARKER = "cli-first.json";
+
+async function cliCameFirst(root: string): Promise<boolean> {
+ return access(join(root, CLI_FIRST_MARKER)).then(() => true, () => false);
+}
+
/** Legacy `agy` commands (saved absolute paths, Windows shims) migrate without editing user config. */
export async function resolveAntigravityRuntime(
binaryPath?: string,
env: NodeJS.ProcessEnv = process.env,
baseDir = DATA_DIR,
+ options: { nativeByDefault?: boolean } = {},
): Promise<AntigravityRuntime> {
const override = binaryPath?.trim();
- const legacyCli = override !== undefined && /(?:^|[\\/])agy(?:\.(?:cmd|bat|exe|ps1))?$/iu.test(override);
+ const pinnedOnly = isAntigravityPinnedAlias(override);
+ const nativeDefault = !pinnedOnly && (options.nativeByDefault ?? antigravityNativeByDefault());
+ const legacyCli = override !== undefined && LEGACY_AGY.test(override);
const native = isAntigravityNativeAlias(override);
- if (override && override !== "agy" && !native) {
+ if (override && override !== "agy" && !native && !pinnedOnly) {
for (const candidate of pathCandidates(override, env)) {
const found = await externalRuntime(candidate, "override", env);
if (found) return found;
@@ -238,19 +292,22 @@ export async function resolveAntigravityRuntime(
}
}
- const installedCli = ANTIGRAVITY_NATIVE_CLI ? await activeAntigravityCli(runtimeRoot(baseDir)) : null;
- if (installedCli) return installedCli;
+ const installedCli = ANTIGRAVITY_NATIVE_CLI && (native || nativeDefault) ? await activeAntigravityCli(runtimeRoot(baseDir)) : null;
if (native) {
- throw new AntigravitySetupError("Antigravity's native CLI is not installed. Install the official Google runtime to continue, or set the CLI path back to agy.");
+ if (installedCli) return installedCli;
+ throw new AntigravitySetupError(CLI_NOT_INSTALLED);
}
- // Until the CLI is installed, a computer that has the pinned runtime keeps running it.
+ // OMB_ANTIGRAVITY_NATIVE_CLI=1: an account with no runtime of its own runs the CLI once it is installed here.
+ if (installedCli && (ANTIGRAVITY_CLI_FIRST || await cliCameFirst(runtimeRoot(baseDir)))) return installedCli;
+ // A computer that has the pinned runtime keeps running it for an account with no runtime of its own.
const asset = resolveAntigravityReleaseAsset();
if (asset) {
const managed = await completedRelease(join(runtimeRoot(baseDir), "versions", asset.sha256), asset);
if (managed) return managed;
}
+ if (installedCli) return installedCli;
const names = executableNames();
- for (const candidate of pathCandidates(names.executable, env)) {
+ for (const candidate of pinnedOnly ? [] : pathCandidates(names.executable, env)) {
const found = await externalRuntime(candidate, "path");
if (found) return found;
}
@@ -259,6 +316,10 @@ export async function resolveAntigravityRuntime(
? `Antigravity no longer runs the agy command, and Google does not publish its official runtime for ${process.platform}-${process.arch}. Set the custom executable path to ${names.executable}, with ${names.harness} in the same folder.`
: `Google does not publish an Antigravity runtime for ${process.platform}-${process.arch}. Set a custom executable path.`);
}
+ if (!asset && !nativeDefault) {
+ throw new AntigravitySetupError(`Google does not publish the pinned Antigravity runtime for ${process.platform}-${process.arch}. Set the CLI path to antigravity to use Google's native CLI.`);
+ }
+ if (ANTIGRAVITY_NATIVE_CLI && nativeDefault) throw new AntigravitySetupError(CLI_NOT_INSTALLED);
throw new AntigravitySetupError(legacyCli
? "Antigravity now uses Google's official runtime. Choose Install official Antigravity, then Sign in with Google. Your previous agy login is not copied."
: "Antigravity is not installed. Install the official Google runtime to continue.");
@@ -289,13 +350,16 @@ async function extractPinnedArchive(
if (seen.size !== 2) throw new Error("The archive is missing an expected file.");
}
-/** Every install takes the native CLI, including on a computer that has the pinned runtime. Null when the pinned
- * runtime is the one to install or keep: the CLI's own failure is thrown unless the pinned runtime can stand in (no
- * CLI here yet, and Google publishes the pinned runtime for this platform). */
+/** A computer the app already put a pinned runtime on keeps it: only a new install, one that already runs the native
+ * CLI, a CLI path that asks for it, or OMB_ANTIGRAVITY_NATIVE_CLI=1 takes the CLI. Null when the pinned runtime is the
+ * one to install: the CLI's own failure is thrown unless this is a new install the pinned runtime can stand in for. */
async function installNativeCli(options: AntigravityInstallOptions, root: string): Promise<AntigravityRuntime | null> {
if (!ANTIGRAVITY_NATIVE_CLI || options.asset !== undefined) return null;
+ if (!options.native && !(options.nativeByDefault ?? antigravityNativeByDefault())) return null;
const pinned = resolveAntigravityReleaseAsset();
const active = await activeAntigravityCli(root);
+ if (!options.native && !ANTIGRAVITY_CLI_FIRST && !active && pinned
+ && ((await completedRelease(join(root, "versions", pinned.sha256), pinned)) || (await antigravityOlderRuntime(options.baseDir, pinned)) !== null)) return null;
try {
const release = options.cliRelease !== undefined ? options.cliRelease : await latestAntigravityCliRelease({ fetchImpl: options.fetchImpl });
if (!release) throw new Error("Could not find a native Antigravity CLI release. Check the network connection and try again.");
@@ -303,7 +367,9 @@ async function installNativeCli(options: AntigravityInstallOptions, root: string
await options.validate?.(active, active.version);
return active;
}
+ const pinnedHere = pinned ? (await completedRelease(join(root, "versions", pinned.sha256), pinned)) !== null : false;
const installed = await installAntigravityCli(release, { root, fetchImpl: options.fetchImpl, validate: options.validate, retry: retryOnWindowsFileLock });
+ if (!active && !pinnedHere && !(await cliCameFirst(root))) writeFileAtomic(join(root, CLI_FIRST_MARKER), "{}\n", { mode: 0o600 });
await pruneAntigravityCliReleases(root, runningFrom).catch(() => []);
return installed;
} catch (error) {
@@ -323,7 +389,9 @@ async function installOnce(options: AntigravityInstallOptions): Promise<Antigrav
const cli = await installNativeCli(options, root);
if (cli) return cli;
const asset = options.asset === undefined ? resolveAntigravityReleaseAsset() : options.asset;
- if (!asset) throw new Error(`Google does not publish an Antigravity runtime for ${process.platform}-${process.arch}.`);
+ if (!asset) {
+ throw new Error(`Google does not publish an Antigravity runtime for ${process.platform}-${process.arch}.${ANTIGRAVITY_NATIVE_CLI && antigravityCliTarget(process.platform, process.arch) ? " Set the CLI path to antigravity to use Google's native CLI." : ""}`);
+ }
const versions = join(root, "versions");
const destination = join(versions, asset.sha256);
await mkdir(versions, { recursive: true, mode: 0o700 });
@@ -436,7 +504,8 @@ async function installOnce(options: AntigravityInstallOptions): Promise<Antigrav
}
export function installAntigravityRuntime(options: AntigravityInstallOptions = {}): Promise<AntigravityRuntime> {
- const key = `${runtimeRoot(options.baseDir)}\0${options.asset !== undefined ? "pinned" : options.native ? "native" : "default"}`;
+ const channel = options.asset !== undefined ? "pinned" : options.native ? "native" : options.nativeByDefault === false ? "pinned-only" : "default";
+ const key = `${runtimeRoot(options.baseDir)}\0${channel}`;
const existing = installs.get(key);
if (existing) return existing;
const running = installOnce(options).finally(() => installs.delete(key));
@@ -446,28 +515,36 @@ export function installAntigravityRuntime(options: AntigravityInstallOptions = {
let channelAnswer: { at: number; version: string } | undefined;
-/** The version installed here when the engine updater has something to install: a newer native CLI on Google's
- * channel, or, on a computer that still runs the pinned runtime, the move to the CLI. The channel's answer is kept for
- * an hour, so an update found while the engine is busy is still there on the next look; a channel that did not answer
- * is asked again. */
+/** The native CLI's version when an account here runs it and Google's channel has a newer one. An account runs it when
+ * its CLI path asks for it, or when no pinned runtime is installed to go first. With OMB_ANTIGRAVITY_NATIVE_CLI=1 a
+ * computer that runs the pinned runtime is also offered the move to the CLI, from the version it runs. The channel's
+ * answer is kept for an hour, so an update found while the engine is busy is still there on the next look; a channel
+ * that did not answer is asked again. */
export async function antigravityCliUpdate(options: {
baseDir?: string; now?: number; latest?: () => Promise<AntigravityCliReleaseAsset | null>; asset?: AntigravityReleaseAsset | null;
+ /** Every engine's configured CLI path. */
+ configuredClis?: readonly string[];
+ nativeByDefault?: boolean;
} = {}): Promise<string | null> {
if (!ANTIGRAVITY_NATIVE_CLI) return null;
+ const asked = (options.configuredClis ?? []).some(isAntigravityNativeAlias);
+ if (!asked && !(options.nativeByDefault ?? antigravityNativeByDefault())) return null;
const root = runtimeRoot(options.baseDir);
const active = await activeAntigravityCli(root);
const pinned = options.asset === undefined ? resolveAntigravityReleaseAsset() : options.asset;
- const current = active?.version
- ?? (pinned && (await completedRelease(join(root, "versions", pinned.sha256), pinned)) ? pinned.version : null)
- ?? await antigravityOlderRuntime(options.baseDir, pinned);
- if (!current) return null;
+ const pinnedHere = pinned ? (await completedRelease(join(root, "versions", pinned.sha256), pinned)) !== null : false;
+ // The move from the pinned runtime is offered only with the switch on; an account chooses it itself under Runs on.
+ const from = active?.version
+ ?? (ANTIGRAVITY_CLI_FIRST ? (pinnedHere ? pinned!.version : await antigravityOlderRuntime(options.baseDir, pinned)) : null);
+ if (!from) return null;
+ if (active && pinnedHere && !ANTIGRAVITY_CLI_FIRST && !asked && !(await cliCameFirst(root))) return null;
const now = options.now ?? Date.now();
if (channelAnswer === undefined || now - channelAnswer.at >= UPDATE_CHECK_INTERVAL_MS || now < channelAnswer.at) {
const latest = await (options.latest ?? latestAntigravityCliRelease)();
if (!latest) return null;
channelAnswer = { at: now, version: latest.version };
}
- if (!active) return current;
+ if (!active) return from;
return active.version && isNewer(channelAnswer.version, active.version) ? active.version : null;
}
@@ -480,45 +557,6 @@ function runningFrom(directory: string): boolean {
return false;
}
-/** Whether an account here holds a sign-in the native CLI wrote: proof the CLI signs in on this computer. */
-async function cliSignedInHere(baseDir: string): Promise<boolean> {
- const profiles = join(baseDir, "providers", "antigravity");
- for (const name of await readdir(profiles).catch(() => [] as string[])) {
- const info = await stat(join(profiles, name, "antigravity-acp", ANTIGRAVITY_CLI_TOKEN_FILE)).catch(() => null);
- if (info?.isFile() && info.size > 0) return true;
- }
- return false;
-}
-
-/** Removes the pinned runtime (about 1 GB on Linux) once the switch to the native CLI has worked here: the switch is on,
- * the CLI is installed and whole, an account signed in on it, and no process runs the pinned runtime. Nothing is removed
- * with the switch off; turning it off later downloads the pinned runtime again. The folders it removed. */
-export async function retirePinnedAntigravityRuntime(options: { baseDir?: string; inUse?: (directory: string) => boolean } = {}): Promise<string[]> {
- if (!ANTIGRAVITY_NATIVE_CLI) return [];
- const baseDir = options.baseDir ?? DATA_DIR;
- const root = runtimeRoot(baseDir);
- if (!(await activeAntigravityCli(root)) || !(await cliSignedInHere(baseDir))) return [];
- const versions = join(root, "versions");
- const removed: string[] = [];
- for (const name of await readdir(versions).catch(() => [] as string[])) {
- const directory = join(versions, name);
- let record: Partial<InstallRecord> | null = null;
- try {
- record = JSON.parse(await readFile(join(directory, INSTALL_RECORD), "utf8")) as Partial<InstallRecord>;
- } catch {}
- // Only a pinned runtime: its record names its harness and its folder is its SHA-256.
- if (!record || record.sha256 !== name || !record.harness || (options.inUse ?? runningFrom)(directory)) continue;
- try {
- await retryOnWindowsFileLock(() => rm(directory, { recursive: true, force: true }));
- removed.push(name);
- console.warn(`antigravity: removed the pinned ${record.version ?? ""} runtime now that the native CLI runs here`);
- } catch (error) {
- console.warn(`antigravity: could not remove the pinned runtime (${error instanceof Error ? error.message : String(error)})`);
- }
- }
- return removed;
-}
-
/** The newest runtime the app installed here, when it is not the pinned one; null when the pinned one is installed or none is. */
export async function antigravityOlderRuntime(baseDir = DATA_DIR, asset = resolveAntigravityReleaseAsset()): Promise<string | null> {
if (!asset) return null;
diff --git a/server/drivers/antigravity-sign-in.test.ts b/server/drivers/antigravity-sign-in.test.ts
index 28ddeec666..25298f24cb 100644
--- a/server/drivers/antigravity-sign-in.test.ts
+++ b/server/drivers/antigravity-sign-in.test.ts
@@ -16,6 +16,7 @@ import {
antigravityBrowserHelperProblem,
antigravityProfileAuthenticated,
antigravitySessionSetup,
+ antigravityTakesSystemPrompt,
antigravityTokenPath,
linuxCaBundle,
prepareAntigravityProfile,
@@ -264,6 +265,13 @@ describe("the session setup for releases that write a workflow skill file", () =
expect(antigravitySessionSetup({ agentInfo: { version } })).toEqual({});
});
+ it("carries the system prompt beside the tools it turns off", () => {
+ expect(antigravitySessionSetup({ agentInfo: { version: "1.5.14" } }, "Rules.")).toEqual({ _meta: { antigravity: { systemPrompt: { append: "Rules." } } } });
+ expect(antigravitySessionSetup({ agentInfo: { version: "1.4.3" } }, "")).toEqual({
+ _meta: { antigravity: { disabledTools: ["run_workflow"], systemPrompt: { append: "" } } },
+ });
+ });
+
it("rides the turn's session/new on the pinned release and not on another", async () => {
ensureDirs();
for (const [version, meta] of [["1.4.3", { antigravity: { disabledTools: ["run_workflow"] } }], ["1.1.1", undefined]] as const) {
@@ -458,3 +466,12 @@ describe("the runtime's launch environment", () => {
}, 60_000);
});
});
+
+describe("a CLI that takes the system prompt in its session", () => {
+ it("is one whose initialize advertises appending to it", () => {
+ expect(antigravityTakesSystemPrompt({ agentCapabilities: { _meta: { antigravity: { tier: true, systemPrompt: { append: true } } } } })).toBe(true);
+ for (const capabilities of [undefined, {}, { _meta: { antigravity: { tier: true } } }, { _meta: { antigravity: { systemPrompt: { append: "yes" } } } }]) {
+ expect(antigravityTakesSystemPrompt({ agentCapabilities: capabilities })).toBe(false);
+ }
+ });
+});
diff --git a/server/drivers/antigravity-usage-limits.test.ts b/server/drivers/antigravity-usage-limits.test.ts
index bd3a533462..dbea65901a 100644
--- a/server/drivers/antigravity-usage-limits.test.ts
+++ b/server/drivers/antigravity-usage-limits.test.ts
@@ -103,26 +103,6 @@ afterEach(async () => {
});
describe("Antigravity subscription limits", () => {
- it("reads the native CLI's sign-in with its own access token while it is fresh, and nothing once it is stale", async () => {
- const directory = mkdtempSync(join(tmpdir(), "omb-antigravity-usage-cli-"));
- scratch.push(directory);
- const tokenPath = join(directory, "antigravity-oauth-token");
- const now = at("2026-11-23T12:00:00Z");
- writeFileSync(tokenPath, JSON.stringify({ token: { access_token: "cli-access", refresh_token: "cli-refresh", expiry: "2026-11-23T12:30:00Z" } }));
- const asked: Array<{ url: string; authorization?: string; body?: string }> = [];
- const fetch: PlanFetch = async (url, init) => {
- asked.push({ url, authorization: init.headers?.Authorization, body: init.body });
- return { ok: true, status: 200, text: async () => JSON.stringify(summary) };
- };
- expect((await readAntigravityUsageWindows(tokenPath, { fetch, now: () => now })).map((window) => window.id)).toContain("gemini-5h");
- // No refresh: the file names no OAuth client. The CLI refreshes it itself.
- expect(asked.some((request) => request.url.endsWith("/token"))).toBe(false);
- expect(asked.every((request) => request.authorization === "Bearer cli-access" && request.body === "{}")).toBe(true);
- asked.length = 0;
- expect(await readAntigravityUsageWindows(tokenPath, { fetch, now: () => at("2026-11-23T12:29:30Z") })).toEqual([]);
- expect(asked).toEqual([]);
- });
-
it("omits rolling resets for untouched summary buckets and keeps used Gemini resets", async () => {
const { windows } = fixture({
now: at("2026-10-21T10:16:04Z"),
@@ -419,8 +399,8 @@ describe("the Antigravity row of the usage report", () => {
it("joins the report beside the other engines, and is left out when it cannot be read", async () => {
const instanceId = "antigravity-usage-row";
- const accounts = planAccountsFromInstances({ [instanceId]: { driver: "antigravityAgent", displayName: "", enabled: true, config: {}, environment: {} } } as never);
- expect(accounts).toEqual([{ id: instanceId, name: "Antigravity", driver: "antigravity", environment: {} }]);
+ const accounts = planAccountsFromInstances({ [instanceId]: { driver: "antigravityAgent", displayName: "", enabled: true, config: { cli: "agy_acp_server" }, environment: {} } } as never);
+ expect(accounts).toEqual([{ id: instanceId, name: "Antigravity", driver: "antigravity", environment: {}, antigravityCli: "agy_acp_server" }]);
const { deps } = fixture();
const credentials = { read: () => { throw new Error("the report's own credential reader is not used for Antigravity"); } };
expect((await fetchPlanUsage(accounts, { ...deps, credentials })).providers).toEqual([]);
diff --git a/server/drivers/antigravity-usage-limits.ts b/server/drivers/antigravity-usage-limits.ts
index b2a58b00f7..e4f0f9186e 100644
--- a/server/drivers/antigravity-usage-limits.ts
+++ b/server/drivers/antigravity-usage-limits.ts
@@ -5,9 +5,6 @@
// - apps/server/src/provider/antigravityUsageLimits.ts (the endpoints and
// their order, the request's client line, the summary and per-model
// quota readers, the untouched-bucket reset rule, and the access cache).
-// - apps/server/src/provider/antigravityUsageLimits.ts:43-51, 331-392 at
-// 38067630229 (the native CLI's sign-in file, read only while its access
-// token is fresh, since it stores no OAuth client to refresh it with).
// Only the personal Google sign-in is read, the account fingerprint is left out, and every failure is no row at all.
//
// Security: the access token lives in this module's memory and in request headers only. It is never logged, written or
@@ -15,16 +12,22 @@
import { createHash } from "node:crypto";
import { readFile, stat } from "node:fs/promises";
-import { ANTIGRAVITY_NATIVE_CLI } from "./antigravity-cli-install.ts";
-
import type { PlanExtra, PlanFetch, PlanModelUsage, PlanWindow, PlanWindows } from "../plan-usage.ts";
-import { antigravityCliTokenPath, antigravityTokenPath } from "./antigravity-acp.ts";
-import { antigravityCliAccessToken, refreshAntigravityAccess } from "./antigravity-account.ts";
+import { antigravityTokenPath } from "./antigravity-acp.ts";
+import { refreshAntigravityAccess } from "./antigravity-account.ts";
import { antigravityQuotaFamily } from "./antigravity-turn-outcome.ts";
+import { readNativeAccessToken } from "./antigravity-native-sign-in.ts";
/** Whether Antigravity accounts are asked for their limits at all. Off, they have no row in the usage report. */
export const ANTIGRAVITY_USAGE_LIMITS = true;
+/** Whether an instance with this CLI path runs the native CLI, or would once installed. Its limits come from the sign-in
+ * that CLI keeps: a token file left from the pinned runtime must not stand for its account. */
+export async function antigravityRunsNativeCli(cli: string | undefined, env: NodeJS.ProcessEnv): Promise<boolean> {
+ const { antigravityPathRunsNativeCli } = await import("./antigravity-runtime.ts");
+ return antigravityPathRunsNativeCli(cli, env);
+}
+
export function antigravityUserAgent(platform: NodeJS.Platform, architecture: string): string {
return `antigravity/hub/2.24.0 (aidev_client; os_type=${platform}; arch=${architecture}; cl=963137146)`;
}
@@ -231,13 +234,10 @@ interface StoredSignIn {
project_id?: string;
}
-async function storedSignIn(tokenPath: string, now: number): Promise<{ signIn: StoredSignIn; fingerprint: string } | { cliAccess: string } | null> {
+async function storedSignIn(tokenPath: string): Promise<{ signIn: StoredSignIn; fingerprint: string } | null> {
const info = await stat(tokenPath);
if (!info.isFile() || info.size > TOKEN_FILE_MAX_BYTES) return null;
- const parsed = JSON.parse(await readFile(tokenPath, "utf8"));
- const cli = antigravityCliAccessToken(parsed, now);
- if (cli) return { cliAccess: cli.accessToken };
- const fields = record(parsed);
+ const fields = record(JSON.parse(await readFile(tokenPath, "utf8")));
if (!fields || !["client_id", "client_secret", "refresh_token"].every((key) => typeof fields[key] === "string" && fields[key])) return null;
const signIn: StoredSignIn = {
client_id: fields.client_id as string, client_secret: fields.client_secret as string, refresh_token: fields.refresh_token as string,
@@ -285,17 +285,15 @@ const refreshHolds = new Map<string, { fingerprint: string; until: number }>();
/** The windows Google reports for the sign-in stored at `tokenPath`; empty when it reports none. Throws on any failure.
* Every request shares `signal`, the one deadline of the whole read. */
export async function readAntigravityUsageWindows(tokenPath: string, deps: AntigravityUsageDeps, signal: AbortSignal = AbortSignal.timeout(deps.timeoutMs ?? READ_DEADLINE_MS)): Promise<AntigravityUsageWindow[]> {
- const now = deps.now ?? Date.now;
- const stored = await storedSignIn(tokenPath, now()).catch(() => null);
+ const stored = await storedSignIn(tokenPath).catch(() => null);
if (!stored) {
cachedAccess.delete(tokenPath);
return [];
}
- // The native CLI's token is used as it is: the CLI refreshes it while it runs.
- const signIn: StoredSignIn | null = "cliAccess" in stored ? null : stored.signIn;
- let cached = "cliAccess" in stored ? { fingerprint: "", accessToken: stored.cliAccess, expiresAt: Infinity } : cachedAccess.get(tokenPath);
- if (signIn && "fingerprint" in stored && (cached?.fingerprint !== stored.fingerprint || cached.expiresAt <= now() + 60_000)) {
- const { fingerprint } = stored;
+ const now = deps.now ?? Date.now;
+ const { signIn, fingerprint } = stored;
+ let cached = cachedAccess.get(tokenPath);
+ if (cached?.fingerprint !== fingerprint || cached.expiresAt <= now() + 60_000) {
cachedAccess.delete(tokenPath);
const held = refreshHolds.get(tokenPath);
if (held?.fingerprint === fingerprint && now() < held.until) throw new Error("held");
@@ -316,9 +314,14 @@ export async function readAntigravityUsageWindows(tokenPath: string, deps: Antig
if (cachedAccess.size >= 128) cachedAccess.delete(cachedAccess.keys().next().value!);
cachedAccess.set(tokenPath, cached);
}
- const { accessToken } = cached!;
+ return antigravityQuotaWindows(cached.accessToken, signIn.project_id, deps, signal);
+}
+
+/** The windows Google reports to the holder of `accessToken`; empty when it reports none. Every request shares `signal`. */
+export async function antigravityQuotaWindows(accessToken: string, projectId: string | undefined, deps: AntigravityUsageDeps, signal: AbortSignal): Promise<AntigravityUsageWindow[]> {
+ const now = deps.now ?? Date.now;
const headers = { Authorization: `Bearer ${accessToken}`, "User-Agent": antigravityUserAgent(process.platform, process.arch), "content-type": "application/json" };
- const body = JSON.stringify(signIn?.project_id ? { project: signIn.project_id } : {});
+ const body = JSON.stringify(projectId ? { project: projectId } : {});
// Merge endpoints because quota groups differ; the metered host's reading of a bucket wins.
const fetchWindows = async (operation: string, parse: (response: unknown, requestedAt: number) => AntigravityUsageWindow[]) => {
const responses = await Promise.all(PERSONAL_ENDPOINTS.map(async (endpoint) => {
@@ -343,14 +346,10 @@ export async function readAntigravityUsageWindows(tokenPath: string, deps: Antig
export async function antigravityPlanUsage(
instanceId: string,
deps: AntigravityUsageDeps,
- tokenPath?: string,
+ tokenPath = antigravityTokenPath(instanceId),
enabled = ANTIGRAVITY_USAGE_LIMITS,
): Promise<PlanWindows | null> {
if (!enabled) return null;
- // The sign-in of the runtime in use: the native CLI's while it runs, else the pinned runtime's.
- tokenPath ??= ANTIGRAVITY_NATIVE_CLI && await stat(antigravityCliTokenPath(instanceId)).then((info) => info.size > 0, () => false)
- ? antigravityCliTokenPath(instanceId)
- : antigravityTokenPath(instanceId);
try {
// One deadline for the refresh, the summary and the fallback together.
const windows = await readAntigravityUsageWindows(tokenPath, deps, AbortSignal.timeout(deps.timeoutMs ?? READ_DEADLINE_MS));
@@ -359,3 +358,23 @@ export async function antigravityPlanUsage(
return null;
}
}
+
+/** A native-CLI instance's limits for the usage report, read with the access token of the sign-in that CLI keeps for
+ * `environment`; null for no row, as for the pinned runtime, and also while no stored token is live. */
+export async function antigravityNativePlanUsage(
+ instanceId: string,
+ environment: Record<string, string | undefined>,
+ deps: AntigravityUsageDeps,
+ readAccessToken: (instanceId: string, env: NodeJS.ProcessEnv, now: number) => Promise<string | null> = readNativeAccessToken,
+ enabled = ANTIGRAVITY_USAGE_LIMITS,
+): Promise<PlanWindows | null> {
+ if (!enabled) return null;
+ try {
+ const accessToken = await readAccessToken(instanceId, { ...process.env, ...environment }, (deps.now ?? Date.now)());
+ if (!accessToken) return null;
+ const windows = await antigravityQuotaWindows(accessToken, undefined, deps, AbortSignal.timeout(deps.timeoutMs ?? READ_DEADLINE_MS));
+ return windows.length ? antigravityPlanWindows(windows) : null;
+ } catch {
+ return null;
+ }
+}
diff --git a/server/drivers/antigravity.test.ts b/server/drivers/antigravity.test.ts
index 97b66c7f72..9b91dddf5e 100644
--- a/server/drivers/antigravity.test.ts
+++ b/server/drivers/antigravity.test.ts
@@ -543,10 +543,12 @@ describe("official Antigravity runtime", () => {
expect(runtime).toMatchObject({ executablePath: officialExecutable, source: "path" });
});
- it("explains the official setup when a legacy CLI has no replacement installed", async () => {
+ it("explains the setup when a legacy CLI has no replacement installed: the Google Antigravity CLI a new install takes, or the pinned runtime alone", async () => {
if (!resolveAntigravityReleaseAsset()) return;
const fake = fakeRuntime();
await expect(resolveAntigravityRuntime("/old/bin/agy", { PATH: "" }, fake.directory))
+ .rejects.toThrow(/Google Antigravity CLI is not installed yet/);
+ await expect(resolveAntigravityRuntime("/old/bin/agy", { PATH: "" }, fake.directory, { nativeByDefault: false }))
.rejects.toThrow(/Install official Antigravity, then Sign in with Google/);
});
@@ -884,7 +886,7 @@ describe("Antigravity driver over shared ACP", () => {
expect(AntigravityDriver.defaultConfig()).toEqual({ cli: "agy", fullAuto: false, workspace: undefined });
expect(AntigravityDriver.install?.docsUrl).toContain("antigravity-acp");
// The native CLI is opt-in: by default the card offers the pinned runtime with its download size, as before it.
- expect(AntigravityDriver.install?.managed).toEqual({ label: "Install official Antigravity", downloadBytes: resolveAntigravityReleaseAsset()?.archiveBytes ?? 0 });
+ expect(AntigravityDriver.install?.managed).toEqual({ label: "Install official Antigravity", downloadBytes: resolveAntigravityReleaseAsset()?.archiveBytes ?? 0, sizeUnknown: true });
expect(antigravityPermissionMode(false)).toBe("default");
expect(antigravityPermissionMode(false, "ask")).toBe("default");
expect(antigravityPermissionMode(false, "auto")).toBe("default");
diff --git a/server/drivers/antigravity.ts b/server/drivers/antigravity.ts
index 7fb8960b0b..e9b6a398b1 100644
--- a/server/drivers/antigravity.ts
+++ b/server/drivers/antigravity.ts
@@ -1,5 +1,6 @@
// Google Antigravity through its official ACP server: managed runtime, isolated Google profile,
// model/mode configuration and OAuth.
+import type { ChildProcess } from "node:child_process";
import type { ApprovalMode } from "../../shared/approval-mode.ts";
import { dirname, join } from "node:path";
import { stageAntigravitySkills } from "./antigravity-skills.ts";
@@ -24,12 +25,15 @@ import {
antigravityProfileAuthenticated,
antigravityProfileDirectory,
antigravitySessionSetup,
- antigravitySignInPaths,
+ antigravityTakesSystemPrompt,
+ antigravityCliTokenPath,
+ antigravityTokenPath,
authorizationUrlFromLine,
noteAntigravitySignedIn,
noteAntigravitySignInRequired,
prepareAntigravityProfile,
probeAntigravityModels,
+ type AntigravityProfile,
removeAntigravitySignIn,
validateAntigravityRuntime,
verifyAntigravityBrowserHelper,
@@ -37,12 +41,17 @@ import {
import { antigravityLimitFacts, watchAntigravityPromptOutcome } from "./antigravity-turn-outcome.ts";
import { splitAntigravityThinking } from "./antigravity-models.ts";
import { AntigravityAuthController } from "./antigravity-auth.ts";
+import { AntigravityCliLogin, type LoginProcesses } from "./antigravity-native-login.ts";
+import { NativeSignInCache, antigravityCliRefusedSession, antigravityCliSignIn, signOutAntigravityCli } from "./antigravity-native-status.ts";
+import { AcpDiscoveryRpcError, AcpDiscoveryTimeoutError } from "./acp/custom-model-catalog.ts";
import {
antigravityManagedInstallAvailable,
isAntigravityNativeAlias,
+ isAntigravityPinnedAlias,
+ antigravityPathRunsNativeCli,
installAntigravityRuntime,
resolveAntigravityRuntime,
- retirePinnedAntigravityRuntime,
+ type AntigravityRuntime,
} from "./antigravity-runtime.ts";
import { ANTIGRAVITY_NATIVE_CLI } from "./antigravity-cli-install.ts";
import { acpFileEditWithin } from "./permission-command.ts";
@@ -50,6 +59,7 @@ import { resolveAntigravityReleaseAsset } from "./antigravity-release.ts";
import { AntigravityProcesses } from "./antigravity-processes.ts";
import { VERIFICATION_TEMP_KEY, scheduleAntigravityTempSweep } from "./antigravity-temp.ts";
import { augmentedPath } from "../env-path.ts";
+import { killCliTree } from "../procs.ts";
import { bundledEngineCatalog } from "../model-manifest/bundled.ts";
import { currentEngineCatalog } from "../model-manifest/manifest.ts";
@@ -123,6 +133,43 @@ const offeredModels = new Set<string>();
/** The runtime each instance's turns were last started on, known before it answers initialize. */
const launched = new Map<string, { version: string | null; nativeCli: boolean }>();
+const nativeSignIn = new NativeSignInCache();
+const loginProcesses = new Map<string, LoginProcesses>();
+/** While an account's native sign-in is being removed, no native process of that account starts: it would hold the old
+ * sign-in, and could write it back. Each account's is its own (antigravity-acp.ts starts the CLI so it keeps one per
+ * profile). */
+const nativeSigningOut = new Map<string, Promise<void>>();
+const nativeSignOutDone = async (instanceId: string) => {
+ for (let running = nativeSigningOut.get(instanceId); running; running = nativeSigningOut.get(instanceId)) await running.catch(() => {});
+};
+
+/** A native process of an account whose sign-in is being removed was let in before that began: it is ended at once,
+ * before it can use or write back the old sign-in. */
+function trackNative(instanceId: string, child: ChildProcess): void {
+ runtimeProcesses.track(instanceId, child);
+ if (nativeSigningOut.has(instanceId)) void killCliTree(child).catch(() => false);
+}
+const tracked = (instanceId: string) => (child: ChildProcess) => trackNative(instanceId, child);
+
+const nativeRuntimeKey = (runtime: AntigravityRuntime) => `${runtime.executablePath}\0${runtime.version}`;
+
+/** Whether the native CLI accepts a session for this instance, as last learned. Throws when the CLI could not say: that
+ * is not "signed out". */
+async function nativeSignedIn(instanceId: string, runtime: AntigravityRuntime, profile: AntigravityProfile): Promise<boolean> {
+ await nativeSignOutDone(instanceId);
+ return await nativeSignIn.state(instanceId, nativeRuntimeKey(runtime), () => antigravityCliSignIn(runtime, profile, { onProcess: tracked(instanceId) })) === "in";
+}
+
+/** Model discovery's failure as the shared catalog classifies it: a refused session is "signedOut", a slow CLI "timedOut". */
+function nativeDiscoveryError(instanceId: string, error: unknown): unknown {
+ if (antigravityCliRefusedSession(error)) {
+ nativeSignIn.forget(instanceId);
+ const refusal = error as { code: unknown; message: unknown };
+ return new AcpDiscoveryRpcError(refusal.code, typeof refusal.message === "string" ? refusal.message : "");
+ }
+ return error instanceof Error && /timed out/iu.test(error.message) ? new AcpDiscoveryTimeoutError(error.message) : error;
+}
+
const support: AcpSupport = {
driverKind: "antigravityAgent",
// Named for what people look for: Google moved personal Gemini subscriptions (free, AI Pro, AI Ultra) from Gemini CLI to Antigravity on 2026-06-18.
@@ -165,6 +212,7 @@ const support: AcpSupport = {
resolveCommand: async (env, config, instanceId) => {
const runtime = await resolveAntigravityRuntime(config.cli, env);
+ if (runtime.harnessPath === null) await nativeSignOutDone(instanceId);
launched.set(instanceId, { version: runtime.version, nativeCli: runtime.harnessPath === null });
const profile = await prepareAntigravityProfile({ instanceId, runtime, baseEnv: env });
if (profile.tempDirectory) scheduleAntigravityTempSweep(instanceId);
@@ -178,13 +226,18 @@ const support: AcpSupport = {
resolveModels: async (env, config, instanceId) => {
const runtime = await resolveAntigravityRuntime(config.cli, env);
+ if (runtime.harnessPath === null) await nativeSignOutDone(instanceId);
const profile = await prepareAntigravityProfile({ instanceId, runtime, baseEnv: env });
- if (!(await antigravityProfileAuthenticated(profile))) throw new Error(support.loginNote);
+ const native = runtime.harnessPath === null;
+ if (!native && !(await antigravityProfileAuthenticated(profile))) throw new Error(support.loginNote);
+ const accepted = native ? nativeSignIn.seen(instanceId, nativeRuntimeKey(runtime)) : undefined;
const catalog = await probeAntigravityModels({
runtime,
profile,
fallbackDefault: currentEngineCatalog("antigravity").default,
- });
+ ...(native ? { onProcess: tracked(instanceId) } : {}),
+ }).catch((error: unknown) => { throw native ? nativeDiscoveryError(instanceId, error) : error; });
+ accepted?.("in");
for (const option of catalog.options) offeredModels.add(option.id);
return catalog;
},
@@ -193,36 +246,54 @@ const support: AcpSupport = {
? "oauth-personal"
: null,
authFailure: "fail",
+ // The native CLI answers `authenticate` by opening a browser on its own machine, so only `acp --login` signs it in.
+ skipsAuthenticate: (instanceId) => launched.get(instanceId)?.nativeCli === true,
+ classifyError: (error) => antigravityCliRefusedSession(error) ? "invalid_credentials" : undefined,
// With a stored token Google no longer honours, agy_acp_server 1.4.3 prints its sign-in link and waits on
// `authenticate`.
signInRequest: {
stderrLine: (line) => authorizationUrlFromLine(line) !== null,
- rpcError: antigravitySignInError,
- required: (instanceId) => antigravitySignInPaths(instanceId).forEach(noteAntigravitySignInRequired),
+ rpcError: (error, instanceId) => launched.get(instanceId)?.nativeCli === true ? antigravityCliRefusedSession(error) : antigravitySignInError(error),
+ required: (instanceId) => {
+ nativeSignIn.forget(instanceId);
+ noteAntigravitySignInRequired(antigravityTokenPath(instanceId));
+ },
},
- processStarted: (child, instanceId) => runtimeProcesses.track(instanceId, child),
+ processStarted: (child, instanceId) => launched.get(instanceId)?.nativeCli === true ? trackNative(instanceId, child) : runtimeProcesses.track(instanceId, child),
sessionSetupParams: antigravitySessionSetup,
+ sessionSystemPrompt: (initialized, instanceId) => launched.get(instanceId)?.nativeCli === true && antigravityTakesSystemPrompt(initialized),
// One model family's quota is not the account's: Gemini and the models that share another allowance keep running.
limitFacts: (_text, model) => antigravityLimitFacts(model, [...support.models.options.map((option) => option.id), ...offeredModels]),
clientInfo: (instanceId) => antigravityClientInfo(launched.get(instanceId)?.version),
// In `default` the native CLI asks before every edit; Auto-accept edits answers those, as `auto_edit` did.
// Security: only a file edit inside the turn's folder is answered; one that names a command or another place is asked.
- allowsAlone: (instanceId, turn, toolCall) => launched.get(instanceId)?.nativeCli === true && turn.approvalMode === "edits" && acpFileEditWithin(toolCall, turn.cwd),
+ allowsAlone: (instanceId, turn, toolCall) => launched.get(instanceId)?.nativeCli === true
+ && (turn.approvalModeNow?.() ?? turn.approvalMode) === "edits" && acpFileEditWithin(toolCall, turn.cwd),
promptOutcome: (instanceId, sessionId) => watchAntigravityPromptOutcome(support.displayName, antigravityProfileDirectory(instanceId), sessionId),
requireAuthenticationBeforeSpawn: true,
+ // Before a native turn only a refusal the CLI gave recently stops it: otherwise the turn's own session/new is the
+ // question, and its refusal ends the turn as a sign-in request.
isAuthenticated: async (env, config, instanceId) => {
+ let runtime: AntigravityRuntime;
+ let profile: AntigravityProfile;
try {
- const runtime = await resolveAntigravityRuntime(config.cli, env);
- const profile = await prepareAntigravityProfile({ instanceId, runtime, baseEnv: env });
- return antigravityProfileAuthenticated(profile);
+ runtime = await resolveAntigravityRuntime(config.cli, env);
+ profile = await prepareAntigravityProfile({ instanceId, runtime, baseEnv: env });
} catch {
return false;
}
+ return runtime.harnessPath === null ? nativeSignIn.known(instanceId, nativeRuntimeKey(runtime)) !== "out" : antigravityProfileAuthenticated(profile);
},
snapshot: async (env, config, instanceId): Promise<ProviderSnapshot> => {
try {
const runtime = await resolveAntigravityRuntime(config.cli, env);
const profile = await prepareAntigravityProfile({ instanceId, runtime, baseEnv: env });
+ if (runtime.harnessPath === null) {
+ // A CLI that could not answer leaves `authenticated` out, which no caller reads as signed out.
+ const authenticated = await nativeSignedIn(instanceId, runtime, profile).catch(() => undefined);
+ const account = authenticated ? await antigravityAccount(antigravityCliTokenPath(instanceId)) : undefined;
+ return { state: "available", version: runtime.version, nativeCli: true, ...(authenticated === undefined ? {} : { authenticated }), ...(account ? { account } : {}) };
+ }
return {
state: "available",
version: runtime.version,
@@ -263,23 +334,22 @@ const AcpAntigravityDriver = createAcpDriver(support);
export const AntigravityDriver: ProviderDriver<AcpConfig> = {
...AcpAntigravityDriver,
async create(input: DriverCreateInput<AcpConfig>): Promise<ProviderInstance> {
+ // A rebuilt instance may run another CLI, or the same one after a sign-in made outside MausBot.
+ nativeSignIn.forget(input.instanceId);
const base = await AcpAntigravityDriver.create(input);
scheduleAntigravityTempSweep(input.instanceId);
scheduleAntigravityTempSweep(VERIFICATION_TEMP_KEY);
- // Once an account here signed in on the native CLI, the pinned runtime it replaced is removed.
- const retirePinned = () => void retirePinnedAntigravityRuntime().catch(() => []);
- retirePinned();
const auth = new AntigravityAuthController(() => {
- antigravitySignInPaths(input.instanceId).forEach(noteAntigravitySignedIn);
+ noteAntigravitySignedIn(antigravityTokenPath(input.instanceId));
void base.refreshModels?.();
- retirePinned();
});
let signingOut: Promise<void> = Promise.resolve();
let installFailure: string | undefined;
- const runtimeAndProfile = async () => {
- // A GUI launch's raw PATH may omit the official runtime the model picker found.
- const environment = { ...process.env, ...input.environment, PATH: augmentedPath() };
- const runtime = await resolveAntigravityRuntime(input.config.cli, environment);
+ // A GUI launch's raw PATH may omit the official runtime the model picker found.
+ const environmentNow = () => ({ ...process.env, ...input.environment, PATH: augmentedPath() });
+ const runtimeAndProfile = async (cli: string | undefined = input.config.cli) => {
+ const environment = environmentNow();
+ const runtime = await resolveAntigravityRuntime(cli, environment);
const profile = await prepareAntigravityProfile({
instanceId: input.instanceId,
runtime,
@@ -287,6 +357,50 @@ export const AntigravityDriver: ProviderDriver<AcpConfig> = {
});
return { runtime, profile };
};
+ const alive = loginProcesses.get(input.instanceId) ?? new Map();
+ loginProcesses.set(input.instanceId, alive);
+ const login = new AntigravityCliLogin({
+ signedIn: () => {
+ nativeSignIn.forget(input.instanceId);
+ void base.refreshModels?.();
+ },
+ confirm: async () => {
+ await nativeSignOutDone(input.instanceId);
+ const { runtime, profile } = await runtimeAndProfile();
+ return (await antigravityCliSignIn(runtime, profile, { onProcess: tracked(input.instanceId) })) === "in";
+ },
+ }, {}, alive);
+ const runtimeAndProfileUnlessNativeFails = () => runtimeAndProfile().catch(async (error: unknown) => {
+ if (await antigravityPathRunsNativeCli(input.config.cli, environmentNow())) throw error;
+ return null;
+ });
+ let nativeFlow = false;
+ /** Starting a sign-in and signing out never overlap: a sign-in begun while the sign-in is being removed would be
+ * removed with it, or put it back. */
+ let exclusive: Promise<unknown> = Promise.resolve();
+ const alone = <T>(work: () => Promise<T>): Promise<T> => {
+ const run = exclusive.then(work, work);
+ exclusive = run.catch(() => {});
+ return run;
+ };
+ /** Signs this account out of the native CLI, which keeps its sign-in in this account's profile alone. Throws, keeping
+ * the sign-in, when the CLI still accepts a session or cannot say. */
+ const signOutNative = async (runtime: AntigravityRuntime, profile: AntigravityProfile) => {
+ let done!: () => void;
+ nativeSigningOut.set(input.instanceId, new Promise<void>((resolveDone) => { done = resolveDone; }));
+ try {
+ // A process still running keeps the account it started with, and may write it back when it refreshes it.
+ if (!(await runtimeProcesses.stopped(input.instanceId)) || runtimeProcesses.count(input.instanceId)) {
+ throw new Error("Antigravity is still running and could not be stopped. Try again.");
+ }
+ nativeSignIn.forget(input.instanceId);
+ await signOutAntigravityCli(runtime, profile, { onProcess: (child) => runtimeProcesses.track(input.instanceId, child) });
+ } finally {
+ nativeSignIn.forget(input.instanceId);
+ nativeSigningOut.delete(input.instanceId);
+ done();
+ }
+ };
return {
...base,
adapter: {
@@ -314,7 +428,11 @@ export const AntigravityDriver: ProviderDriver<AcpConfig> = {
installRuntime: async () => {
installFailure = undefined;
try {
- await installAntigravityRuntime({ validate: validateAntigravityRuntime, native: isAntigravityNativeAlias(input.config.cli) });
+ await installAntigravityRuntime({
+ validate: validateAntigravityRuntime,
+ native: isAntigravityNativeAlias(input.config.cli),
+ ...(isAntigravityPinnedAlias(input.config.cli) ? { nativeByDefault: false } : {}),
+ });
} catch (error) {
installFailure = error instanceof Error ? error.message : String(error);
throw error;
@@ -323,29 +441,44 @@ export const AntigravityDriver: ProviderDriver<AcpConfig> = {
}
: {}),
authenticationMethod: "callback-url",
- startAuthentication: async () => {
+ startAuthentication: () => alone(async () => {
await signingOut;
const { runtime, profile } = await runtimeAndProfile();
- // The native CLI's `--login` hands its link over itself; only the pinned runtime needs the browser helper.
- if (runtime.harnessPath !== null) await verifyAntigravityBrowserHelper(profile);
+ if (!(await login.cancel())) throw new Error("The Antigravity sign-in in progress could not be stopped. Try again.");
+ auth.cancel();
+ nativeFlow = runtime.harnessPath === null;
+ if (nativeFlow) return login.start(runtime, profile);
+ await verifyAntigravityBrowserHelper(profile);
return auth.start(runtime, profile);
+ }),
+ getAuthentication: async (flowId) => nativeFlow ? login.get(flowId) : auth.get(flowId),
+ completeAuthentication: async (flowId, pasted) => nativeFlow ? login.complete(flowId, pasted) : auth.complete(flowId, pasted),
+ cancelAuthentication: async () => {
+ auth.cancel();
+ await login.cancel();
},
- getAuthentication: async (flowId) => auth.get(flowId),
- completeAuthentication: async (flowId, callbackUrl) => auth.complete(flowId, callbackUrl),
- cancelAuthentication: async () => auth.cancel(),
+ forgetAuthentication: () => nativeSignIn.forget(input.instanceId),
// A runtime process keeps the account it started with, and can write the token file again as it exits: the
// sign-in is removed at once, and once more when those processes are gone. A new sign-in waits for that.
- signOut: async () => {
+ signOut: () => alone(async () => {
auth.cancel();
+ if (!(await login.cancel())) throw new Error("The Antigravity sign-in in progress could not be stopped. Try again.");
await base.adapter.stopAll();
+ // An account set to the native CLI that cannot be started cannot be signed out of it: that must not pass as done.
+ const current = await runtimeAndProfileUnlessNativeFails();
+ if (current?.runtime.harnessPath === null) return await signOutNative(current.runtime, current.profile);
await removeAntigravitySignIn(input.instanceId);
if (!runtimeProcesses.count(input.instanceId)) return;
signingOut = runtimeProcesses.stopped(input.instanceId)
- .then(() => removeAntigravitySignIn(input.instanceId))
+ .then((gone) => {
+ if (!gone) console.warn("antigravity: a runtime process outlived its kill; its sign-in is removed again, but it may write it back");
+ return removeAntigravitySignIn(input.instanceId);
+ })
.catch((error) => console.warn(`antigravity: could not finish the sign-out: ${error instanceof Error ? error.message : String(error)}`));
- },
+ }),
dispose: async () => {
auth.cancel();
+ await login.cancel();
await base.dispose();
},
};
diff --git a/server/drivers/permission-command.test.ts b/server/drivers/permission-command.test.ts
index a806d00ced..631fd475fe 100644
--- a/server/drivers/permission-command.test.ts
+++ b/server/drivers/permission-command.test.ts
@@ -1,4 +1,8 @@
-import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import { mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+
+import { afterEach, beforeEach, describe, expect, it, onTestFinished } from "vitest";
import { bindSafetyFloor } from "../safety-floor-gate.ts";
@@ -87,7 +91,8 @@ describe("the never-list on an ACP request", () => {
});
it("takes a request for a file edit only when it is one, inside the folder", () => {
- const root = process.cwd();
+ const root = mkdtempSync(join(tmpdir(), "omb-edit-within-"));
+ onTestFinished(() => rmSync(root, { recursive: true, force: true }));
const inside = { kind: "edit", locations: [{ path: `${root}/notes.md` }] };
expect(acpFileEditWithin(inside, root)).toBe(true);
expect(acpFileEditWithin(inside, undefined)).toBe(false);
@@ -99,4 +104,32 @@ describe("the never-list on an ACP request", () => {
expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/a\0b` }] }, root)).toBe(false);
expect(acpFileEditWithin({ kind: "edit", locations: [{}] }, root)).toBe(false);
});
+
+ it.skipIf(process.platform === "win32")("asks for a folder, and for a path that goes through any link, one that climbs out of the folder or one it cannot follow", () => {
+ const root = realpathSync(mkdtempSync(join(tmpdir(), "omb-edit-root-")));
+ const outside = realpathSync(mkdtempSync(join(tmpdir(), "omb-edit-outside-")));
+ try {
+ mkdirSync(join(outside, "deep"));
+ symlinkSync(join(outside, "deep"), join(root, "link"));
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/link/../x` }] }, root)).toBe(false);
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/x` }] }, root)).toBe(true);
+ symlinkSync(join(outside, "not-yet"), join(root, "dangling"));
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/dangling` }] }, root)).toBe(false);
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/dangling/x` }] }, root)).toBe(false);
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/new-folder/x` }] }, root)).toBe(true);
+ writeFileSync(join(root, "file.txt"), "");
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/file.txt/x` }] }, root)).toBe(false);
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/file.txt` }] }, root)).toBe(true);
+ mkdirSync(join(root, "sub"));
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/sub` }] }, root)).toBe(false);
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: "/dev/null" }] }, "/dev")).toBe(false);
+ symlinkSync(join(root, "file.txt"), join(root, "alias"));
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/alias` }] }, root)).toBe(false);
+ symlinkSync(join(root, "sub"), join(root, "inner"));
+ expect(acpFileEditWithin({ kind: "edit", locations: [{ path: `${root}/inner/x` }] }, root)).toBe(false);
+ } finally {
+ rmSync(root, { recursive: true, force: true });
+ rmSync(outside, { recursive: true, force: true });
+ }
+ });
});
diff --git a/server/drivers/permission-command.ts b/server/drivers/permission-command.ts
index dbad798e82..c3b77e8a1d 100644
--- a/server/drivers/permission-command.ts
+++ b/server/drivers/permission-command.ts
@@ -1,4 +1,4 @@
-import { realpathSync } from "node:fs";
+import { lstatSync, realpathSync, statSync } from "node:fs";
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
import { safetyFloorClears } from "../safety-floor-gate.ts";
@@ -88,6 +88,8 @@ function realTarget(path: string): string | undefined {
try {
return join(realpathSync(existing), ...rest);
} catch {
+ // A link whose target is missing is there but cannot be followed here, while a write would follow it.
+ try { if (lstatSync(existing, { throwIfNoEntry: false })) return undefined; } catch { return undefined; }
const parent = dirname(existing);
if (parent === existing) return undefined;
rest.unshift(basename(existing));
@@ -97,7 +99,7 @@ function realTarget(path: string): string | undefined {
}
/** Whether an ACP permission request is only a file edit inside `root`: its kind is `edit`, it names no command, and
- * every location it gives is an absolute path that stays inside `root` once links are resolved. A request that gives
+ * every location it gives is an absolute path to a file inside `root` that goes through no link. A request that gives
* no location cannot be placed, so it is not one. */
export function acpFileEditWithin(toolCall: { kind?: unknown; rawInput?: unknown; locations?: unknown }, root: string | undefined): boolean {
if (toolCall.kind !== "edit" || !root || acpCarriesCommand(toolCall.rawInput)) return false;
@@ -105,13 +107,25 @@ export function acpFileEditWithin(toolCall: { kind?: unknown; rawInput?: unknown
if (!realRoot || !Array.isArray(toolCall.locations) || !toolCall.locations.length) return false;
return toolCall.locations.every((location) => {
const path = (location as { path?: unknown } | null)?.path;
- if (typeof path !== "string" || !isAbsolute(path) || path.includes("\0")) return false;
+ // A `..` after a link climbs from the link's target, not from where the path's text says: such a path is asked.
+ if (typeof path !== "string" || !isAbsolute(path) || path.includes("\0") || path.split(/[\\/]/u).includes("..")) return false;
const target = realTarget(path);
- const inside = target === undefined ? "" : relative(realRoot, target);
- return inside !== "" && !inside.startsWith("..") && !isAbsolute(inside);
+ if (target === undefined || !fileOrNothing(target)) return false;
+ const inside = relative(realRoot, target);
+ const written = [relative(resolve(root), resolve(path)), relative(realRoot, resolve(path))];
+ return inside !== "" && !inside.startsWith("..") && !isAbsolute(inside) && written.includes(inside);
});
}
+function fileOrNothing(path: string): boolean {
+ try {
+ const info = statSync(path, { throwIfNoEntry: false });
+ return info === undefined || info.isFile();
+ } catch {
+ return false;
+ }
+}
+
/** An ACP permission request's exact operation, for the driver's own session allow; null for a generic title with no input. */
export function acpSessionOperationKey(toolCall: any): string | null {
const rawInput = toolCall?.rawInput;
diff --git a/server/drivers/prompt-split.test.ts b/server/drivers/prompt-split.test.ts
index 08a2c5796d..3a8948e467 100644
--- a/server/drivers/prompt-split.test.ts
+++ b/server/drivers/prompt-split.test.ts
@@ -5,6 +5,7 @@ import {
promptHalves,
promptSplitFingerprints,
readPromptSplitReceipt,
+ splitSessionNote,
splitSessionPrompt,
volatileContextNote,
withContextNote,
@@ -166,3 +167,33 @@ describe("splitSessionPrompt", () => {
expect(state.text).toBe(fullSystem + "\n\nsecond");
});
});
+
+describe("splitSessionNote", () => {
+ it("sends the whole volatile half where the full prompt would go, then only its changes", () => {
+ const first = splitSessionNote("stable rules.", "memory", null);
+ expect(first.note).toBe(volatileContextNote("memory", false));
+ const same = splitSessionNote("stable rules.", "memory", first.receipt);
+ expect(same.note).toBe("");
+ const moved = splitSessionNote("stable rules.", "moved to Toronto", same.receipt);
+ expect(moved.note).toBe(volatileContextNote("moved to Toronto", true));
+ const revised = splitSessionNote("revised rules.", "moved to Toronto", moved.receipt);
+ expect(revised.note).toBe(volatileContextNote("moved to Toronto", false));
+ expect(revised.receipt.turnsSinceFull).toBe(0);
+ });
+
+ it("keeps the receipt splitSessionPrompt would keep, so a session can move between the two", () => {
+ const previous = splitSessionPrompt("stable rules.", "memory", null, "stable rules.\n\nmemory", "first").receipt;
+ expect(splitSessionNote("stable rules.", "memory", previous, true, 8))
+ .toEqual({ note: volatileContextNote("memory", true), receipt: splitSessionPrompt("stable rules.", "memory", previous, "", "", true, 8).receipt });
+ });
+
+ it("has no note for a session with no volatile half", () => {
+ expect(splitSessionNote("stable rules.", "", null).note).toBe("");
+ });
+});
+
+it("tells a session that holds the stable half that the volatile half was cleared when a changed stable half resends it empty", () => {
+ const previous = promptSplitFingerprints("stable one", "the open task");
+ expect(splitSessionNote("stable two", "", previous).note).toContain("have been cleared");
+ expect(splitSessionNote("stable two", "", promptSplitFingerprints("stable one", "")).note).toBe("");
+});
diff --git a/server/drivers/prompt-split.ts b/server/drivers/prompt-split.ts
index e5bbb7c83b..70b2e563f6 100644
--- a/server/drivers/prompt-split.ts
+++ b/server/drivers/prompt-split.ts
@@ -88,26 +88,58 @@ export function deletePromptSplitReceipt(scope: string, key: string): void {
} catch {}
}
-/** reAnchorAfterTurns re-sends the full prompt after that many bare turns, for history rewrites no event reports. */
-export function splitSessionPrompt(
+interface SplitTurn {
+ full: boolean;
+ note: string;
+ receipt: PromptSplitReceipt;
+}
+
+function splitTurn(
stable: string,
volatile: string,
previous: PromptSplitReceipt | null,
- fullSystem: string | undefined,
- text: string,
- perTurnVolatile = false,
- reAnchorAfterTurns = 0,
-): { text: string; receipt: PromptSplitReceipt } {
+ perTurnVolatile: boolean,
+ reAnchorAfterTurns: number,
+): SplitTurn {
const fingerprints = promptSplitFingerprints(stable, volatile);
const turnsSinceFull = typeof previous?.turnsSinceFull === "number" ? previous.turnsSinceFull : 0;
const reAnchor = reAnchorAfterTurns > 0 && previous !== null && turnsSinceFull >= reAnchorAfterTurns;
if (previous === null || previous.stable !== fingerprints.stable || reAnchor) {
- return { text: fullSystem ? fullSystem + "\n\n" + text : text, receipt: { ...fingerprints, turnsSinceFull: 0 } };
+ const hadVolatile = previous !== null && previous.volatile !== EMPTY_FINGERPRINT;
+ return { full: true, note: volatileContextNote(volatile, hadVolatile), receipt: { ...fingerprints, turnsSinceFull: 0 } };
}
const note = previous.volatile === fingerprints.volatile && !perTurnVolatile
? ""
: volatileContextNote(volatile, previous.volatile !== EMPTY_FINGERPRINT);
- return { text: withContextNote(note, text), receipt: { ...fingerprints, turnsSinceFull: turnsSinceFull + 1 } };
+ return { full: false, note, receipt: { ...fingerprints, turnsSinceFull: turnsSinceFull + 1 } };
+}
+
+/** reAnchorAfterTurns re-sends the full prompt after that many bare turns, for history rewrites no event reports. */
+export function splitSessionPrompt(
+ stable: string,
+ volatile: string,
+ previous: PromptSplitReceipt | null,
+ fullSystem: string | undefined,
+ text: string,
+ perTurnVolatile = false,
+ reAnchorAfterTurns = 0,
+): { text: string; receipt: PromptSplitReceipt } {
+ const turn = splitTurn(stable, volatile, previous, perTurnVolatile, reAnchorAfterTurns);
+ if (!turn.full) return { text: withContextNote(turn.note, text), receipt: turn.receipt };
+ return { text: fullSystem ? fullSystem + "\n\n" + text : text, receipt: turn.receipt };
+}
+
+/** splitSessionPrompt for an agent that holds the stable half as its session's system prompt: what the turn carries is
+ * the volatile half's note alone, the whole volatile half wherever splitSessionPrompt would send the full prompt. */
+export function splitSessionNote(
+ stable: string,
+ volatile: string,
+ previous: PromptSplitReceipt | null,
+ perTurnVolatile = false,
+ reAnchorAfterTurns = 0,
+): { note: string; receipt: PromptSplitReceipt } {
+ const { note, receipt } = splitTurn(stable, volatile, previous, perTurnVolatile, reAnchorAfterTurns);
+ return { note, receipt };
}
/** The stable half a per-thread process is keyed on: without the team roster (`systemRoster`), which a warm process takes
diff --git a/server/engine-updates-host.ts b/server/engine-updates-host.ts
index dfe2f9c178..758f8a328a 100644
--- a/server/engine-updates-host.ts
+++ b/server/engine-updates-host.ts
@@ -3,25 +3,38 @@ import { join } from "node:path";
import { DATA_DIR } from "./config.ts";
import type { AnyProviderDriver } from "./contracts.ts";
import { validateAntigravityRuntime } from "./drivers/antigravity-acp.ts";
-import { antigravityCliUpdate, antigravityManagedInstallAvailable, antigravityOlderRuntime, installAntigravityRuntime, retirePinnedAntigravityRuntime } from "./drivers/antigravity-runtime.ts";
+import { antigravityCliUpdate, antigravityManagedInstallAvailable, antigravityOlderRuntime, installAntigravityRuntime, type AntigravityInstallOptions } from "./drivers/antigravity-runtime.ts";
+import { resolveAntigravityReleaseAsset } from "./drivers/antigravity-release.ts";
import { antigravityRuntimesRoot } from "./engine-roots.ts";
import { createEngineUpdater, enginePlans, type EngineUpdater, type ManagedRuntime } from "./engine-updates.ts";
-function managedRuntimes(): Record<string, ManagedRuntime> {
- if (!antigravityManagedInstallAvailable()) return {};
+/** The channel whose copy is older is the one installed, and what it installed is reported by that copy's own version. */
+export function antigravityManagedRuntime(
+ configuredClis: () => readonly string[],
+ options: Pick<AntigravityInstallOptions, "baseDir" | "fetchImpl" | "cliRelease" | "validate"> & { latest?: NonNullable<Parameters<typeof antigravityCliUpdate>[0]>["latest"] } = {},
+): ManagedRuntime {
return {
- antigravityAgent: {
- older: async () => (await antigravityCliUpdate()) ?? antigravityOlderRuntime(),
- install: async () => {
- const installed = await installAntigravityRuntime({ validate: validateAntigravityRuntime });
- await retirePinnedAntigravityRuntime().catch(() => []);
- return installed.version ?? undefined;
- },
- folder: antigravityRuntimesRoot(DATA_DIR),
+ older: async (skip = []) => {
+ const cli = skip.includes("native") ? null : await antigravityCliUpdate({ configuredClis: configuredClis(), baseDir: options.baseDir, latest: options.latest });
+ if (cli) return { version: cli, channel: "native" };
+ const pinned = skip.includes("pinned") ? null : await antigravityOlderRuntime(options.baseDir);
+ return pinned ? { version: pinned, channel: "pinned" } : null;
},
+ install: async (channel) => (await installAntigravityRuntime({
+ validate: options.validate ?? validateAntigravityRuntime,
+ baseDir: options.baseDir,
+ fetchImpl: options.fetchImpl,
+ ...(channel === "native" ? { native: true, cliRelease: options.cliRelease } : channel === "pinned" ? { asset: resolveAntigravityReleaseAsset() } : {}),
+ })).version ?? undefined,
+ folder: antigravityRuntimesRoot(options.baseDir ?? DATA_DIR),
};
}
+function managedRuntimes(configuredClis: () => readonly string[]): Record<string, ManagedRuntime> {
+ if (!antigravityManagedInstallAvailable()) return {};
+ return { antigravityAgent: antigravityManagedRuntime(configuredClis) };
+}
+
/** The server's engine updater; `start()` it once the server is up. */
export function engineUpdatesFor(deps: {
drivers: readonly AnyProviderDriver[];
@@ -30,7 +43,7 @@ export function engineUpdatesFor(deps: {
updated(): void;
}): EngineUpdater {
return createEngineUpdater({
- plans: enginePlans(deps.drivers, managedRuntimes()),
+ plans: enginePlans(deps.drivers, managedRuntimes(deps.configuredClis)),
statePath: join(DATA_DIR, "providers", "engine-updates.json"),
turnRunning: deps.turnRunning,
configuredClis: deps.configuredClis,
diff --git a/server/engine-updates.test.ts b/server/engine-updates.test.ts
index 38b6958224..1a866d9306 100644
--- a/server/engine-updates.test.ts
+++ b/server/engine-updates.test.ts
@@ -372,6 +372,151 @@ describe("a runtime the app manages itself", () => {
});
});
+describe("a runtime with more than one release channel", () => {
+ const setup = (older: Array<string | { version: string; channel: string } | null>, install: (channel?: string) => Promise<string | void>) => {
+ const scratch = mkdtempSync(join(tmpdir(), "omb-engine-updates-"));
+ const lines: string[] = [];
+ const queue = [...older];
+ const managed = { older: async () => queue.shift() ?? null, install, folder: join(scratch, "runtimes") };
+ const engines = createEngineUpdater({
+ plans: [{ driverKind: "managedEngine", name: "Managed", pin: { target: "1.4.3", minimum: "1.4.3" }, managed }],
+ baseDir: scratch, statePath: join(scratch, "state.json"), turnRunning: () => false, log: (line) => lines.push(line),
+ liveCommands: () => [], steps: noSteps(),
+ });
+ return { engines, lines, done: () => removeTempDir(scratch) };
+ };
+
+ it("installs from the channel whose copy is older, then looks for another channel's update in the same pass, and says each to the instances that run it", async () => {
+ const asked: Array<string | undefined> = [];
+ const run = setup([{ version: "1.5.7", channel: "native" }, { version: "1.1.1", channel: "pinned" }, null], async (channel) => {
+ asked.push(channel);
+ return channel === "native" ? "1.5.8" : "1.4.3";
+ });
+ try {
+ await run.engines.check();
+ expect(asked).toEqual(["native", "pinned"]);
+ expect(run.lines).toEqual(["Engine update: Managed 1.5.7 → 1.5.8", "Engine update: Managed 1.1.1 → 1.4.3"]);
+ expect(run.engines.shown("managedEngine").autoUpdated?.version).toBe("1.4.3");
+ expect(run.engines.shown("managedEngine", "1.5.8").autoUpdated?.version).toBe("1.5.8");
+ expect(run.engines.shown("managedEngine", "1.4.3").autoUpdated?.version).toBe("1.4.3");
+ expect(run.engines.shown("managedEngine", "1.4.2")).toEqual({});
+ } finally {
+ await run.done();
+ }
+ });
+
+ it("keeps the first channel's update when the second channel's cannot be installed, and retries the second sooner than a day", async () => {
+ const run = setup([{ version: "1.5.7", channel: "native" }, { version: "1.1.1", channel: "pinned" }], async (channel) => {
+ if (channel === "pinned") throw new Error("Google download failed (404).");
+ return "1.5.8";
+ });
+ try {
+ const started = Date.now();
+ await run.engines.check();
+ expect(run.lines).toEqual([
+ "Engine update: Managed 1.5.7 → 1.5.8",
+ "Engine update: Managed stays on 1.1.1; 1.4.3 could not be installed (Google download failed (404).). Trying again later.",
+ ]);
+ expect(run.engines.shown("managedEngine").autoUpdated?.version).toBe("1.5.8");
+ expect(run.engines.dueAt() - started).toBeLessThan(2 * 60 * 60_000);
+ } finally {
+ await run.done();
+ }
+ });
+
+ it("keeps the first channel's update and comes back in minutes for the second when a turn starts in between", async () => {
+ const scratch = mkdtempSync(join(tmpdir(), "omb-engine-updates-"));
+ try {
+ const lines: string[] = [];
+ let busy = false;
+ const asked: Array<string | undefined> = [];
+ const queue: Array<{ version: string; channel: string }> = [{ version: "1.5.7", channel: "native" }, { version: "1.1.1", channel: "pinned" }];
+ const managed = {
+ older: async (skip: readonly string[] = []) => queue.find((entry) => !skip.includes(entry.channel)) ?? null,
+ install: async (channel?: string) => { asked.push(channel); busy = true; return "1.5.8"; },
+ folder: join(scratch, "runtimes"),
+ };
+ const engines = createEngineUpdater({
+ plans: [{ driverKind: "managedEngine", name: "Managed", pin: { target: "1.4.3", minimum: "1.4.3" }, managed }],
+ baseDir: scratch, statePath: join(scratch, "state.json"), turnRunning: () => busy, log: (line) => lines.push(line),
+ liveCommands: () => [], steps: noSteps(),
+ });
+ const started = Date.now();
+ await engines.check();
+ expect(asked).toEqual(["native"]);
+ expect(lines).toEqual(["Engine update: Managed 1.5.7 → 1.5.8"]);
+ expect(engines.dueAt() - started).toBeLessThanOrEqual(6 * 60_000);
+ } finally {
+ await removeTempDir(scratch);
+ }
+ });
+
+ it("comes back in minutes for a channel a turn kept it from, even after the first channel failed", async () => {
+ const scratch = mkdtempSync(join(tmpdir(), "omb-engine-updates-"));
+ try {
+ let busy = false;
+ const queue: Array<{ version: string; channel: string }> = [{ version: "1.5.7", channel: "native" }, { version: "1.1.1", channel: "pinned" }];
+ const managed = {
+ older: async (skip: readonly string[] = []) => queue.find((entry) => !skip.includes(entry.channel)) ?? null,
+ install: async () => { busy = true; throw new Error("Google download failed (500)."); },
+ folder: join(scratch, "runtimes"),
+ };
+ const engines = createEngineUpdater({
+ plans: [{ driverKind: "managedEngine", name: "Managed", pin: { target: "1.4.3", minimum: "1.4.3" }, managed }],
+ baseDir: scratch, statePath: join(scratch, "state.json"), turnRunning: () => busy, log: () => {},
+ liveCommands: () => [], steps: noSteps(),
+ });
+ const started = Date.now();
+ await engines.check();
+ expect(engines.dueAt() - started).toBeLessThanOrEqual(6 * 60_000);
+ } finally {
+ await removeTempDir(scratch);
+ }
+ });
+
+ it("still tries the other channel when the first channel's install fails", async () => {
+ const asked: Array<string | undefined> = [];
+ const run = setup([{ version: "1.5.7", channel: "native" }, { version: "1.1.1", channel: "pinned" }, null], async (channel) => {
+ asked.push(channel);
+ if (channel === "native") throw new Error("Google download failed (500).");
+ return "1.4.3";
+ });
+ try {
+ await run.engines.check();
+ expect(asked).toEqual(["native", "pinned"]);
+ expect(run.lines).toEqual([
+ "Engine update: Managed 1.1.1 → 1.4.3",
+ "Engine update: Managed stays on 1.5.7; 1.4.3 could not be installed (Google download failed (500).). Trying again later.",
+ ]);
+ } finally {
+ await run.done();
+ }
+ });
+
+ it("counts a channel whose install left its own version in place as failed, whatever the other channel has", async () => {
+ const run = setup([{ version: "1.5.7", channel: "native" }], async () => "1.5.7");
+ try {
+ await run.engines.check();
+ expect(run.lines[0]).toContain("Managed stays on 1.5.7");
+ expect(run.lines[0]).toContain("the install left the same version in place");
+ } finally {
+ await run.done();
+ }
+ });
+
+ it("still takes an older that names only a version, as a runtime with one channel does", async () => {
+ const asked: Array<string | undefined> = [];
+ const run = setup(["1.4.2", null], async (channel) => { asked.push(channel); return undefined; });
+ try {
+ await run.engines.check();
+ expect(asked).toEqual([undefined]);
+ expect(run.lines).toEqual(["Engine update: Managed 1.4.2 → 1.4.3"]);
+ } finally {
+ await run.done();
+ }
+ });
+});
+
describe.skipIf(process.platform === "win32")("the ACP handshake", () => {
let scratch = "";
beforeEach(() => { scratch = mkdtempSync(join(tmpdir(), "omb-handshake-")); });
diff --git a/server/engine-updates.ts b/server/engine-updates.ts
index 39f80dbe72..b773eff22c 100644
--- a/server/engine-updates.ts
+++ b/server/engine-updates.ts
@@ -32,10 +32,12 @@ const SWITCH_POLL_MS = 15_000;
/** A runtime the app manages itself (Antigravity): it installs each version beside the others and checks it. */
export interface ManagedRuntime {
- /** The version installed when a newer one is to be installed, else null. */
- older(): Promise<string | null>;
- /** Resolves with the version it installed when that is not the pinned one. */
- install(): Promise<string | void>;
+ /** The version installed when a newer one is to be installed, else null; with the release channel that version came
+ * from when the runtime has more than one. `skip` names the channels this pass already tried. */
+ older(skip?: readonly string[]): Promise<string | { version: string; channel: string } | null>;
+ /** Installs from `channel` (the one `older` named). Resolves with the version of the runtime it installed when that
+ * is not the pinned one. */
+ install(channel?: string): Promise<string | void>;
folder: string;
}
@@ -118,6 +120,8 @@ interface EngineState {
failures?: number;
retryAt?: number;
updatedTo?: string;
+ /** Every version a pass moved this engine's channels to, `updatedTo` last. */
+ updatedVersions?: string[];
updatedAt?: number;
}
@@ -128,14 +132,17 @@ interface UpdaterState {
type Outcome =
| { kind: "absent" | "current" | "busy" | "waiting" }
- | { kind: "updated"; from: string; to: string }
- | { kind: "failed"; from: string; to: string; reason: string };
+ | { kind: "updated"; from: string; to: string; moves?: Move[]; busyAfter?: true }
+ | { kind: "failed"; from: string; to: string; reason: string; moves?: Move[]; busyAfter?: true };
+
+type Move = { from: string; to: string };
export interface EngineUpdater {
/** One pass over every engine now; resolves when it has finished. */
check(): Promise<void>;
- /** `autoUpdated` for an engine updated in the last week, for its row in Settings. */
- shown(driverKind: string): { autoUpdated?: { version: string; at: number } };
+ /** `autoUpdated` for an engine updated in the last week, for its row in Settings: the version it runs, when a pass moved
+ * more than one of its channels. */
+ shown(driverKind: string, running?: string | null): { autoUpdated?: { version: string; at: number } };
/** The earliest time a pass is due. */
dueAt(): number;
start(): DueTimer;
@@ -288,13 +295,10 @@ export function createEngineUpdater(options: EngineUpdaterOptions): EngineUpdate
return { kind: "updated", from: current, to: target };
}
- async function updateManaged(plan: EnginePlan, managed: ManagedRuntime): Promise<Outcome> {
- const older = await managed.older();
- if (older === null) return { kind: "absent" };
- if (engineBusy(plan)) return { kind: "busy" };
+ async function installManaged(plan: EnginePlan, managed: ManagedRuntime, older: string, channel: string | undefined): Promise<Outcome> {
let installed: string | void;
try {
- installed = await managed.install();
+ installed = await managed.install(channel);
} catch (error) {
return { kind: "failed", from: older, to: plan.pin.target, reason: error instanceof Error ? error.message : String(error) };
}
@@ -302,6 +306,34 @@ export function createEngineUpdater(options: EngineUpdaterOptions): EngineUpdate
return to === older ? { kind: "failed", from: older, to, reason: "the install left the same version in place" } : { kind: "updated", from: older, to };
}
+ /** Each channel is tried once a pass; one channel's failure is the pass's outcome (so it is retried), and never keeps
+ * another channel from updating. */
+ async function updateManaged(plan: EnginePlan, managed: ManagedRuntime): Promise<Outcome> {
+ const tried: string[] = [];
+ const moves: Move[] = [];
+ let failed: Extract<Outcome, { kind: "failed" }> | undefined;
+ let busyAfter = false;
+ for (;;) {
+ const found = await managed.older(tried);
+ if (found === null) break;
+ if (engineBusy(plan)) {
+ if (!moves.length && !failed) return { kind: "busy" };
+ busyAfter = true;
+ break;
+ }
+ const { version: older, channel } = typeof found === "string" ? { version: found, channel: undefined } : found;
+ const outcome = await installManaged(plan, managed, older, channel);
+ if (outcome.kind === "updated") moves.push({ from: outcome.from, to: outcome.to });
+ else if (outcome.kind === "failed") failed ??= outcome;
+ if (channel === undefined || tried.includes(channel)) break;
+ tried.push(channel);
+ }
+ const busy = busyAfter ? { busyAfter: true as const } : {};
+ if (failed) return { ...failed, ...(moves.length ? { moves } : {}), ...busy };
+ const last = moves.at(-1);
+ return last ? { kind: "updated", ...last, moves, ...busy } : { kind: "absent" };
+ }
+
const updateOne = (plan: EnginePlan): Promise<Outcome> => {
if (plan.standalone) return updateStandalone(plan, plan.standalone);
if (plan.npm) return updateNpm(plan, plan.npm);
@@ -327,17 +359,21 @@ export function createEngineUpdater(options: EngineUpdaterOptions): EngineUpdate
} catch (error) {
outcome = { kind: "failed", from: "?", to: plan.pin.target, reason: error instanceof Error ? error.message : String(error) };
}
- if (outcome.kind === "busy" || outcome.kind === "waiting") waiting = true;
+ if (outcome.kind === "busy" || outcome.kind === "waiting" || ("busyAfter" in outcome && outcome.busyAfter)) waiting = true;
+ const moves = outcome.kind === "updated" ? outcome.moves ?? [{ from: outcome.from, to: outcome.to }] : outcome.kind === "failed" ? outcome.moves ?? [] : [];
+ for (const move of moves) log(`Engine update: ${plan.name} ${move.from} → ${move.to}`);
+ const moved = moves.length ? { updatedTo: moves.at(-1)!.to, updatedVersions: moves.map((move) => move.to), updatedAt: now() } : {};
+ if (moves.length) changed = true;
if (outcome.kind === "updated") {
- state.engines[plan.driverKind] = { updatedTo: outcome.to, updatedAt: now() };
- log(`Engine update: ${plan.name} ${outcome.from} → ${outcome.to}`);
- changed = true;
+ state.engines[plan.driverKind] = moved;
} else if (outcome.kind === "failed") {
const failures = (engine.failures ?? 0) + 1;
- state.engines[plan.driverKind] = { ...engine, failures, retryAt: now() + retryDelay(plan, outcome.from, failures) };
+ // A channel the pass did not reach for a turn is due in minutes, not on the failed channel's backoff.
+ const retryAt = now() + (outcome.busyAfter ? ENGINE_UPDATE_BUSY_RETRY_MS : retryDelay(plan, outcome.from, failures));
+ state.engines[plan.driverKind] = { ...engine, ...moved, failures, retryAt };
log(`Engine update: ${plan.name} stays on ${outcome.from}; ${outcome.to} could not be installed (${outcome.reason.split("\n")[0]}). Trying again later.`);
} else if (engine.failures) {
- state.engines[plan.driverKind] = { updatedTo: engine.updatedTo, updatedAt: engine.updatedAt };
+ state.engines[plan.driverKind] = { updatedTo: engine.updatedTo, updatedVersions: engine.updatedVersions, updatedAt: engine.updatedAt };
}
}
passed = true;
@@ -363,11 +399,12 @@ export function createEngineUpdater(options: EngineUpdaterOptions): EngineUpdate
return {
check,
dueAt,
- shown(driverKind) {
+ shown(driverKind, running) {
const engine = state.engines[driverKind];
- return engine?.updatedTo && engine.updatedAt !== undefined && now() - engine.updatedAt < SHOW_UPDATED_MS
- ? { autoUpdated: { version: engine.updatedTo, at: engine.updatedAt } }
- : {};
+ if (!engine?.updatedTo || engine.updatedAt === undefined || now() - engine.updatedAt >= SHOW_UPDATED_MS) return {};
+ const versions = engine.updatedVersions ?? [engine.updatedTo];
+ const version = running ? versions.find((one) => one === running) : engine.updatedTo;
+ return version ? { autoUpdated: { version, at: engine.updatedAt } } : {};
},
start() {
return startDueTimer({
diff --git a/server/index.ts b/server/index.ts
index 147c97916c..b576f1a734 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -11708,7 +11708,7 @@ async function describeInstances() {
return engines.map((instance) => {
const entry = configs[instance.instanceId];
const described = {
- ...instance, ...testedAi.info(instance), ...engineUpdates.shown(instance.driverKind),
+ ...instance, ...testedAi.info(instance), ...engineUpdates.shown(instance.driverKind, "version" in instance.snapshot ? instance.snapshot.version : null),
...instanceLook(entry),
...(entry?.access ? { access: entry.access } : {}), ...(entry?.driver === "openai-compat" && typeof (entry.config as { replyWaitMinutes?: unknown } | undefined)?.replyWaitMinutes === "number" ? { replyWaitMinutes: (entry.config as { replyWaitMinutes: number }).replyWaitMinutes } : {}), ...(heldKeys?.refusal(instance.instanceId) ? { snapshot: { state: "unavailable" as const, reason: TRIAL_KEY_HELD } } : {}),
};
diff --git a/server/plan-usage-antigravity-native.test.ts b/server/plan-usage-antigravity-native.test.ts
new file mode 100644
index 0000000000..1ff5e85cdf
--- /dev/null
+++ b/server/plan-usage-antigravity-native.test.ts
@@ -0,0 +1,94 @@
+import { existsSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { DATA_DIR } from "./config.ts";
+import { antigravityRuntimesRoot } from "./engine-roots.ts";
+import { installFakeManagedCli } from "./testing/antigravity-native-fixture.ts";
+
+const NOW = Date.parse("2026-10-19T10:00:00Z");
+const HOUR = 3_600_000;
+
+vi.mock("./drivers/antigravity-usage-limits.ts", async (importOriginal) => {
+ const real = await importOriginal<typeof import("./drivers/antigravity-usage-limits.ts")>();
+ const iso = (at: number) => new Date(at).toISOString();
+ const windows = (remaining: number) => real.antigravityPlanWindows(real.antigravitySummaryWindows({ groups: [
+ { displayName: "Gemini Models", buckets: [
+ { bucketId: "gemini-5h", window: "5h", remainingFraction: remaining, resetTime: iso(NOW + 2 * HOUR), description: "used" },
+ { bucketId: "gemini-weekly", window: "weekly", remainingFraction: 0.75, resetTime: iso(NOW + 60 * HOUR), description: "used" },
+ ] },
+ ] }, NOW));
+ return {
+ ...real,
+ antigravityPlanUsage: vi.fn(async () => windows(0.5)),
+ antigravityNativePlanUsage: vi.fn(async () => windows(0.2)),
+ };
+});
+
+const { antigravityNativePlanUsage, antigravityPlanUsage, antigravityRunsNativeCli } = await import("./drivers/antigravity-usage-limits.ts");
+const { clearPlanUsageCache, loadPlanUsage, planAccountsFromInstances } = await import("./plan-usage.ts");
+
+const accountOf = (cli?: string) => planAccountsFromInstances({ antigravity: { driver: "antigravityAgent", environment: { HOME: "/Users/person" }, ...(cli === undefined ? {} : { config: { cli } }) } });
+const fiveHourUsed = (report: Awaited<ReturnType<typeof loadPlanUsage>>) => report.providers.map((provider) => [provider.id, provider.fiveHour.usedPercent]);
+
+afterEach(() => {
+ rmSync(join(antigravityRuntimesRoot(DATA_DIR), `${process.platform}-${process.arch}`), { recursive: true, force: true });
+ clearPlanUsageCache();
+ vi.mocked(antigravityPlanUsage).mockClear();
+ vi.mocked(antigravityNativePlanUsage).mockClear();
+});
+
+describe("an Antigravity account's limits when it runs the native CLI", () => {
+ it.each([
+ ["antigravity", true],
+ ["Antigravity.exe", true],
+ ["/opt/tools/antigravity", true],
+ ["agy", true],
+ ["/usr/local/bin/agy", true],
+ ["/opt/tools/agy_acp_server.par", false],
+ ["agy_acp_server", false],
+ [undefined, true],
+ ])("is told from the CLI path %s while nothing is installed, a new install taking the native CLI", async (cli, native) => {
+ await expect(antigravityRunsNativeCli(cli, { PATH: "" })).resolves.toBe(native);
+ expect(accountOf(cli)[0]!.antigravityCli).toBe(cli);
+ expect(accountOf(cli)[0]!.noUsage).toBeUndefined();
+ });
+
+ it("is told from the CLI it runs: no path or agy on a computer with only the native CLI", async () => {
+ installFakeManagedCli(DATA_DIR);
+ for (const cli of [undefined, "agy"]) await expect(antigravityRunsNativeCli(cli, { PATH: "" })).resolves.toBe(true);
+ await expect(antigravityRunsNativeCli("agy_acp_server", { PATH: "" })).resolves.toBe(false);
+ await expect(antigravityRunsNativeCli("/usr/local/bin/agy", { PATH: "" })).resolves.toBe(true);
+ });
+
+ it.skipIf(process.platform === "win32")("is told from files alone, starting no program: an antigravity beside a pinned harness is pinned", async () => {
+ const folder = mkdtempSync(join(tmpdir(), "omb-usage-native-"));
+ try {
+ const ran = join(folder, "ran");
+ const program = `#!/bin/sh\n/usr/bin/touch ${JSON.stringify(ran)}\necho 1.5.14\n`;
+ writeFileSync(join(folder, "antigravity"), program, { mode: 0o755 });
+ await expect(antigravityRunsNativeCli(join(folder, "antigravity"), { PATH: "" })).resolves.toBe(true);
+ writeFileSync(join(folder, "localharness_external"), program, { mode: 0o755 });
+ await expect(antigravityRunsNativeCli(join(folder, "antigravity"), { PATH: "" })).resolves.toBe(false);
+ expect(existsSync(ran)).toBe(false);
+ } finally {
+ rmSync(folder, { recursive: true, force: true });
+ }
+ });
+
+ it("are read from the native CLI's own sign-in, not the pinned token file a switch from a pinned account leaves", async () => {
+ const pinned = await loadPlanUsage({ accounts: accountOf("agy_acp_server"), now: NOW });
+ expect(fiveHourUsed(pinned)).toEqual([["antigravity", 50]]);
+
+ // The same instance, now on the native CLI, read straight away: the report cached for 45 s is not its answer.
+ const native = await loadPlanUsage({ accounts: accountOf("antigravity"), now: NOW + 1_000 });
+ expect(fiveHourUsed(native)).toEqual([["antigravity", 80]]);
+ expect(antigravityPlanUsage).toHaveBeenCalledTimes(1);
+ expect(antigravityNativePlanUsage).toHaveBeenCalledWith("antigravity", { HOME: "/Users/person" }, expect.anything());
+
+ const back = await loadPlanUsage({ accounts: accountOf("agy_acp_server"), now: NOW + 2_000 });
+ expect(fiveHourUsed(back)).toEqual([["antigravity", 50]]);
+ expect(antigravityNativePlanUsage).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/server/plan-usage.ts b/server/plan-usage.ts
index fd6aa67147..002ee47bd3 100644
--- a/server/plan-usage.ts
+++ b/server/plan-usage.ts
@@ -8,7 +8,7 @@ import type { InstanceConfigMap } from "./contracts.ts";
import { resolveClaudeConfigDir } from "./drivers/claude.ts";
import { codexHome } from "./drivers/codex-identity.ts";
import { codexHasCredits } from "./codex-credits.ts";
-import { antigravityPlanUsage } from "./drivers/antigravity-usage-limits.ts";
+import { antigravityNativePlanUsage, antigravityPlanUsage, antigravityRunsNativeCli } from "./drivers/antigravity-usage-limits.ts";
import { harnessHome, sealedFixture } from "./env-path.ts";
export type PlanDriver = "claude" | "codex" | "grok" | "opencode" | "antigravity";
@@ -72,6 +72,8 @@ export interface PlanAccount {
configDir?: string;
/** No usage reading: a ChatGPT plan signed in through OpenMausBot has no CLI login on disk, and a Claude instance whose config sets `usageMeter: false` keeps its login unread (a refused turn still fails over). */
noUsage?: true;
+ /** An Antigravity account's CLI path: whether it runs the native CLI is read when its limits are. */
+ antigravityCli?: string;
}
export interface PlanCredential {
@@ -158,7 +160,7 @@ export function planAccountsFromInstances(instances: InstanceConfigMap): PlanAcc
environment: { ...entry.environment },
...(configDir ? { configDir } : {}),
// Reading ~/.codex/auth.json for a ChatGPT-plan provider would report (and hold it on) another account's limit.
- ...(config?.authMode === "chatgpt-plan" || (driver === "claude" && config?.usageMeter === false) ? { noUsage: true as const } : {}),
+ ...(config?.authMode === "chatgpt-plan" || (driver === "claude" && config?.usageMeter === false) ? { noUsage: true as const } : driver === "antigravity" && typeof config?.cli === "string" ? { antigravityCli: config.cli } : {}),
});
}
return accounts;
@@ -328,12 +330,7 @@ function closedWindow(): PlanWindow {
function openWindow(usedPercent: number, resetsAt: string | null): PlanWindow {
const used = clampPercent(usedPercent);
- return {
- available: true,
- usedPercent: used,
- remainingPercent: clampPercent(100 - used),
- resetsAt,
- };
+ return { available: true, usedPercent: used, remainingPercent: clampPercent(100 - used), resetsAt };
}
function extraLine(label: string, window: PlanWindow): PlanExtra {
@@ -704,7 +701,7 @@ function planUsageCacheKey(accounts: PlanAccount[]): string {
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
.map(([name, value]) => `${name}=${value}`)
.join("\n");
- return [account.id, account.driver, account.name, account.configDir ?? "", environment, account.noUsage ? "no-usage" : "usage"].join("\u0000");
+ return [account.id, account.driver, account.name, account.configDir ?? "", environment, account.noUsage ? "no-usage" : "usage", account.antigravityCli ?? ""].join("\u0000");
}).join("\n");
}
@@ -916,7 +913,7 @@ function okRow(account: PlanAccount, windows: PlanWindows): PlanProviderRow {
async function fetchProvider(account: PlanAccount, deps: PlanUsageDeps): Promise<PlanProviderRow | null> { // null: OpenCode, in every fleet, with no key of its own
let credential: PlanCredential;
- if (account.driver === "antigravity") { const windows = await antigravityPlanUsage(account.id, deps); return windows && okRow(account, windows); } // null: no sign-in, or Google gave nothing
+ if (account.driver === "antigravity") { const native = await antigravityRunsNativeCli(account.antigravityCli, { ...process.env, ...account.environment }); const windows = await (native ? antigravityNativePlanUsage(account.id, account.environment, deps) : antigravityPlanUsage(account.id, deps)); return windows && okRow(account, windows); } // null: no sign-in, or Google gave nothing
try {
credential = await deps.credentials.read(account);
} catch {
diff --git a/server/routes/instances-antigravity-native.test.ts b/server/routes/instances-antigravity-native.test.ts
new file mode 100644
index 0000000000..04a20a4dc2
--- /dev/null
+++ b/server/routes/instances-antigravity-native.test.ts
@@ -0,0 +1,286 @@
+// The native Antigravity CLI through the server's own instance routes, with a real registry and driver and a fake CLI
+// on disk: the sign-in, the status, a turn, the check and the sign-out the app offers, and removing the account.
+import { existsSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
+import { createServer, type Server } from "node:http";
+import type { AddressInfo } from "node:net";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import type { AppConfig } from "../config.ts";
+import type { InstanceConfigMap } from "../contracts.ts";
+import { antigravityProfileDirectory } from "../drivers/antigravity-acp.ts";
+import { AntigravityDriver } from "../drivers/antigravity.ts";
+import { ENGINE_LIST_REUSE_MS, ProviderRegistry } from "../harness/registry.ts";
+import { json, readBody } from "../harness/http.ts";
+import { ProviderAuthSessions } from "../provider-auth-sessions.ts";
+import { removeTempDir } from "../testing/cleanup.ts";
+import { nativeFixture, loginAt } from "../testing/antigravity-native-fixture.ts";
+import { recordEvents } from "../testing/events.ts";
+import { makeFakeDriver } from "../testing/fake-driver.ts";
+import { createInstanceRoutes, type InstanceRouteDeps } from "./instances.ts";
+import { dispatchRoutes } from "./table.ts";
+
+const WINDOWS = process.platform === "win32";
+const servers: Server[] = [];
+const scratch: string[] = [];
+const registries: ProviderRegistry[] = [];
+
+afterEach(async () => {
+ vi.restoreAllMocks();
+ await Promise.all(servers.splice(0).map((server) => new Promise((done) => server.close(done))));
+ for (const registry of registries.splice(0)) await registry.disposeAll();
+ while (scratch.length) await removeTempDir(scratch.pop()!);
+});
+
+function folder(): string {
+ const directory = mkdtempSync(join(tmpdir(), "omb-antigravity-routes-"));
+ scratch.push(directory);
+ return directory;
+}
+
+async function serve(registry: ProviderRegistry, cfg: AppConfig, extra: Partial<InstanceRouteDeps> = {}) {
+ registries.push(registry);
+ let busy = false;
+ const persisted: InstanceConfigMap[] = [];
+ const deps = {
+ store: { bots: [], tasks: () => [] },
+ cfg,
+ registry,
+ sessions: { isLive: () => true },
+ providerAuthSessions: new ProviderAuthSessions(),
+ hostedModels: false,
+ providerConfigBusy: { get: () => busy, set: (value: boolean) => { busy = value; } },
+ providerInstancesChanging: new Set<string>(),
+ describeInstances: () => registry.describe(),
+ persistProviderInstance: async (_id: string, instances: InstanceConfigMap) => {
+ await new Promise((resolve) => setImmediate(resolve));
+ cfg.instances = instances;
+ persisted.push(structuredClone(instances));
+ },
+ threadBusy: () => false,
+ botForThread: () => null,
+ activeGroupTurnForBot: () => null,
+ ...extra,
+ } as unknown as InstanceRouteDeps;
+ const routes = [createInstanceRoutes(deps)];
+ const server = createServer(async (req, res) => {
+ const url = new URL(req.url ?? "/", "http://localhost");
+ const handled = await dispatchRoutes(routes, { req, res, url, path: url.pathname, method: req.method ?? "GET", auth: { kind: "loopback", scopes: ["admin"] }, json, readBody });
+ if (!handled) json(res, 404, { from: "inline routes" });
+ });
+ servers.push(server);
+ await new Promise<void>((ready) => server.listen(0, "127.0.0.1", ready));
+ const base = `http://127.0.0.1:${(server.address() as AddressInfo).port}`;
+ const request = async (method: string, path: string, body?: unknown) => {
+ const response = await fetch(`${base}${path}`, { method, headers: { "content-type": "application/json" }, body: body === undefined ? undefined : JSON.stringify(body) });
+ return { status: response.status, body: await response.json() as any };
+ };
+ const call = async (method: string, path: string, body?: unknown) => {
+ const answered = await request(method, path, body);
+ expect(answered.status, `${method} ${path} ${JSON.stringify(answered.body)}`).toBe(200);
+ return answered.body;
+ };
+ const status = async (instanceId: string) => (await call("GET", "/api/instances?fresh=1")).instances.find((entry: any) => entry.instanceId === instanceId).snapshot;
+ return { request, call, status, persisted, setBusy: (value: boolean) => { busy = value; } };
+}
+
+async function nativeSetup(extraIds: string[] = [], environment: Record<string, string> = {}) {
+ const fixture = nativeFixture(folder());
+ const entry = { driver: "antigravityAgent", config: { cli: fixture.executable }, environment: { FAKE_AGY_LOG: fixture.log, ...environment } };
+ const instances = { antigravity: entry, ...Object.fromEntries(extraIds.map((id) => [id, structuredClone(entry)])) } as InstanceConfigMap;
+ const cfg = { instances: structuredClone(instances) } as unknown as AppConfig;
+ const registry = new ProviderRegistry([AntigravityDriver]);
+ await registry.load(instances);
+ return { fixture, cfg, registry };
+}
+
+describe.skipIf(WINDOWS)("the native Antigravity CLI through the instance routes", () => {
+ it("signs in, reports signed in with the account's models, runs a turn, and signs out, from the UI's own calls", async () => {
+ const { fixture, cfg, registry } = await nativeSetup();
+ const { call, status } = await serve(registry, cfg);
+
+ expect(await status("antigravity")).toMatchObject({ state: "available", authenticated: false });
+
+ const started = (await call("POST", "/api/instances/antigravity/auth/start", {})).auth;
+ expect(started).toMatchObject({ phase: "waiting", kind: "pasted-code" });
+ expect(started.authorizationUrl).toContain("https://accounts.google.com/o/oauth2/auth?");
+ expect((await call("GET", `/api/instances/antigravity/auth/status?flowId=${started.flowId}`)).auth).toMatchObject({ phase: "waiting" });
+ await call("POST", "/api/instances/antigravity/auth/complete", { flowId: started.flowId, callbackUrl: "fixture-code" });
+
+ expect(await status("antigravity")).toMatchObject({ authenticated: true });
+ await call("POST", "/api/instances/antigravity/refresh-models", {});
+ const listed = (await call("GET", "/api/instances")).instances.find((entry: any) => entry.instanceId === "antigravity");
+ expect(listed.models.options.map((option: any) => option.id)).toContain("fixture-account-model");
+ expect(listed.modelsUnconfirmed).toBeUndefined();
+
+ const instance = registry.get("antigravity")!;
+ const recorder = recordEvents(instance.adapter);
+ const { turnId } = await instance.adapter.sendTurn({ threadId: "routes-loop", text: "hello", approvalMode: "ask", cwd: fixture.directory });
+ expect(await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId, 30_000)).toMatchObject({ ok: true });
+ recorder.stop();
+ expect(fixture.methods()).toContain("session/prompt");
+
+ await call("POST", "/api/instances/antigravity/auth/sign-out", {});
+ expect(await status("antigravity")).toMatchObject({ authenticated: false });
+ const again = recordEvents(instance.adapter);
+ const second = await instance.adapter.sendTurn({ threadId: "routes-loop-2", text: "hello", approvalMode: "ask", cwd: fixture.directory });
+ expect(await again.until((event) => event.type === "turn.completed" && event.turnId === second.turnId, 30_000)).toMatchObject({ ok: false, stopReason: "auth_required" });
+ again.stop();
+ expect(fixture.methods()).not.toContain("authenticate");
+ }, 180_000);
+
+ it("asks the CLI again when the person checks, though a signed-out answer was read a moment ago", async () => {
+ const { fixture, cfg, registry } = await nativeSetup();
+ const { call, status } = await serve(registry, cfg, {
+ checkInstance: async (instance) => ({ ok: (await instance.snapshot()).authenticated === true } as never),
+ });
+ expect(await status("antigravity")).toMatchObject({ authenticated: false });
+ // A person signs in at a terminal: no call of ours saw it.
+ await loginAt(fixture, antigravityProfileDirectory("antigravity"), "fixture-code");
+ expect((await call("GET", "/api/instances")).instances.find((entry: any) => entry.instanceId === "antigravity").snapshot.authenticated).toBe(false);
+ expect(await call("POST", "/api/instances/antigravity/check", {})).toEqual({ ok: true });
+ }, 120_000);
+
+ it("starts the CLI once for a signed-in account however often the engine list is read, until a turn is refused", async () => {
+ const { fixture, cfg, registry } = await nativeSetup();
+ await loginAt(fixture, antigravityProfileDirectory("antigravity"), "fixture-code");
+ let clock = Date.now();
+ vi.spyOn(Date, "now").mockImplementation(() => clock);
+ const { call } = await serve(registry, cfg, {
+ describeInstances: () => registry.describe({ reuse: { ms: ENGINE_LIST_REUSE_MS, changed: () => {} } }),
+ });
+ const listed = async (path = "/api/instances") => (await call("GET", path)).instances.find((entry: any) => entry.instanceId === "antigravity").snapshot;
+ const instance = registry.get("antigravity")!;
+ await instance.refreshModels!();
+ const started = () => fixture.methods().filter((method) => method === "initialize").length;
+ expect(await listed()).toMatchObject({ authenticated: true });
+ const settled = started();
+
+ // An open window reads the list on every focus, at most every 30 s, and setup screens ask for a fresh one.
+ for (let step = 1; step <= 40; step += 1) {
+ clock += 30_000;
+ expect(await listed(step % 5 === 0 ? "/api/instances?fresh=1" : "/api/instances")).toMatchObject({ authenticated: true });
+ expect(await instance.snapshot()).toMatchObject({ authenticated: true });
+ }
+ await new Promise((resolve) => setTimeout(resolve, 500));
+ expect(started()).toBe(settled);
+
+ // The sign-in is removed outside the app: the next turn is refused, and the status says so.
+ rmSync(join(antigravityProfileDirectory("antigravity"), "antigravity-acp", "antigravity-oauth-token"));
+ const recorder = recordEvents(instance.adapter);
+ const { turnId } = await instance.adapter.sendTurn({ threadId: "refused", text: "hello", approvalMode: "ask", cwd: fixture.directory });
+ expect(await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId, 30_000)).toMatchObject({ ok: false, stopReason: "auth_required" });
+ recorder.stop();
+ expect(await listed("/api/instances?fresh=1")).toMatchObject({ authenticated: false });
+ }, 180_000);
+
+ it("removes an added account with its profile, and so its own sign-in, without asking the CLI to log out", async () => {
+ const { fixture, cfg, registry } = await nativeSetup(["antigravity-added"]);
+ const { request, call } = await serve(registry, cfg);
+ const flow = (await call("POST", "/api/instances/antigravity-added/auth/start", {})).auth;
+ await call("POST", "/api/instances/antigravity-added/auth/complete", { flowId: flow.flowId, callbackUrl: "fixture-code" });
+
+ expect((await request("DELETE", "/api/instances/antigravity-added")).status).toBe(200);
+ expect(fixture.methods()).not.toContain("logout");
+ expect(existsSync(join(antigravityProfileDirectory("antigravity-added"), "antigravity-acp", "antigravity-oauth-token"))).toBe(false);
+ expect(Object.keys(cfg.instances!)).not.toContain("antigravity-added");
+ }, 180_000);
+
+ // 1.5.14 keeps one keyring entry per computer unless it runs over SSH; the app always starts it so, so every account
+ // keeps its own sign-in in its own profile, even where the CLI's keyring would be shared.
+ it("keeps each account's sign-in its own: another account is not signed in by it, and a sign-out or removal ends only its own", async () => {
+ const keyring = folder();
+ const { cfg, registry } = await nativeSetup(["antigravity-a", "antigravity-b"], { FAKE_AGY_KEYRING: keyring, FAKE_AGY_KEYRING_SHARED: "1" });
+ const { request, call, status } = await serve(registry, cfg);
+ for (const id of ["antigravity-a", "antigravity-b"]) {
+ const flow = (await call("POST", `/api/instances/${id}/auth/start`, {})).auth;
+ await call("POST", `/api/instances/${id}/auth/complete`, { flowId: flow.flowId, callbackUrl: "fixture-code" });
+ }
+ expect(await status("antigravity")).toMatchObject({ authenticated: false });
+ expect(readdirSync(keyring)).toEqual([]);
+
+ expect((await request("DELETE", "/api/instances/antigravity-a")).status).toBe(200);
+ await call("POST", "/api/instances/antigravity-b/check", {});
+ expect(await status("antigravity-b")).toMatchObject({ authenticated: true });
+
+ const waiting = (await call("POST", "/api/instances/antigravity/auth/start", {})).auth;
+ expect((await request("POST", "/api/instances/antigravity-b/auth/sign-out", {})).status).toBe(200);
+ expect(await registry.get("antigravity")!.getAuthentication!(waiting.flowId)).toMatchObject({ phase: "waiting" });
+ await call("POST", "/api/instances/antigravity-b/check", {});
+ expect(await status("antigravity-b")).toMatchObject({ authenticated: false });
+ }, 180_000);
+
+ it("ends a sign-in that waits for its code, with the CLI's process gone, when the person signs out", async () => {
+ const { fixture, cfg, registry } = await nativeSetup();
+ const { call } = await serve(registry, cfg);
+ const started = (await call("POST", "/api/instances/antigravity/auth/start", {})).auth;
+ const pid = fixture.entries().find((entry) => entry.event === "login-start")!.pid as number;
+ await call("POST", "/api/instances/antigravity/auth/sign-out", {});
+ expect(() => process.kill(pid, 0)).toThrow();
+ expect(await registry.get("antigravity")!.getAuthentication!(started.flowId)).toMatchObject({ phase: "cancelled" });
+ expect(fixture.entries().some((entry) => entry.event === "login-code")).toBe(false);
+ }, 120_000);
+});
+
+describe("removing accounts while a ChatGPT account's sign-out waits", () => {
+ async function setup() {
+ const fake = makeFakeDriver();
+ const registry = new ProviderRegistry([fake.driver]);
+ await registry.load({ "chatgpt-1": { driver: "fake" }, "chatgpt-2": { driver: "fake" }, "antigravity-1": { driver: "fake" } });
+ const gates = new Map<string, { entered: Promise<void>; release: () => void }>();
+ for (const id of ["chatgpt-1", "chatgpt-2"]) {
+ let enter!: () => void;
+ let release!: () => void;
+ const entered = new Promise<void>((resolve) => { enter = resolve; });
+ const held = new Promise<void>((resolve) => { release = resolve; });
+ gates.set(id, { entered, release });
+ Object.assign(registry.get(id)!, { signOut: async () => { enter(); await held; } });
+ }
+ const cfg = { instances: {
+ keep: { driver: "fake" },
+ "chatgpt-1": { driver: "codex" },
+ "chatgpt-2": { driver: "codex" },
+ "antigravity-1": { driver: "antigravityAgent" },
+ } } as unknown as AppConfig;
+ return { registry, cfg, gates };
+ }
+
+ it.each([["antigravity-1"], ["chatgpt-2"]])("refuses %s while the first waits, and every removal that succeeded is still there when the config is read again", async (second) => {
+ const { registry, cfg, gates } = await setup();
+ const { request, persisted } = await serve(registry, cfg);
+ const one = request("DELETE", "/api/instances/chatgpt-1");
+ try {
+ await gates.get("chatgpt-1")!.entered;
+ const crossed = await request("DELETE", `/api/instances/${second}`);
+ expect(crossed.status).toBe(409);
+ expect(crossed.body.error).toContain("already being updated");
+ expect((await request("PATCH", "/api/instances/keep", { hidden: true })).status).toBe(409);
+ gates.get("chatgpt-1")!.release();
+ expect((await one).status).toBe(200);
+ const two = request("DELETE", `/api/instances/${second}`);
+ const gate = gates.get(second);
+ if (gate) { await gate.entered; gate.release(); }
+ expect((await two).status).toBe(200);
+ expect(Object.keys(cfg.instances!).sort()).toEqual(["keep", ...["chatgpt-2", "antigravity-1"].filter((id) => id !== second)].sort());
+ expect(persisted.at(-1) && Object.keys(persisted.at(-1)!)).not.toContain("chatgpt-1");
+ } finally {
+ for (const gate of gates.values()) gate.release();
+ await one.catch(() => {});
+ }
+ }, 30_000);
+
+ it("reads the config after the lock is taken, so a removal that finished before is not undone", async () => {
+ const { registry, cfg, gates } = await setup();
+ const { request, setBusy } = await serve(registry, cfg);
+ setBusy(true);
+ expect((await request("DELETE", "/api/instances/chatgpt-1")).status).toBe(409);
+ setBusy(false);
+ expect((await request("DELETE", "/api/instances/antigravity-1")).status).toBe(200);
+ const next = request("DELETE", "/api/instances/chatgpt-1");
+ await gates.get("chatgpt-1")!.entered;
+ gates.get("chatgpt-1")!.release();
+ expect((await next).status).toBe(200);
+ expect(Object.keys(cfg.instances!).sort()).toEqual(["chatgpt-2", "keep"]);
+ }, 30_000);
+});
diff --git a/server/routes/instances.ts b/server/routes/instances.ts
index 3ab2170301..e1342008c9 100644
--- a/server/routes/instances.ts
+++ b/server/routes/instances.ts
@@ -341,6 +341,9 @@ export function createInstanceRoutes(deps: InstanceRouteDeps): RouteHandler {
const instance = registry.get(instanceId);
if (!instance) return json(res, 404, { error: "unknown instance" });
res.setHeader("cache-control", "no-store");
+ // A check is the person asking again: what was last read of the sign-in does not stand in for it.
+ instance.forgetAuthentication?.();
+ registry.forgetSnapshots();
return json(res, 200, await (deps.checkInstance ?? checkEngine)(instance));
}
if (action === "refresh-models") {
@@ -562,29 +565,32 @@ export function createInstanceRoutes(deps: InstanceRouteDeps): RouteHandler {
if (method === "DELETE" && instancePatch) {
const instanceId = instancePatch[1];
if (providerConfigBusy.get()) return json(res, 409, { error: "provider settings are already being updated" });
- const instances = persistableInstanceConfigs(cfg);
- if (!Object.hasOwn(instances, instanceId)) return json(res, 404, { error: "unknown instance" });
- const addedChatgpt = instances[instanceId].driver === "codex" && instanceId.startsWith("chatgpt-");
- const addedAntigravity = instances[instanceId].driver === "antigravityAgent" && instanceId.startsWith("antigravity-");
- if (!addedChatgpt && !addedAntigravity && !isCodexEndpoint(instances[instanceId]) && !isAddedEndpoint(instanceId, instances[instanceId]) && (instances[instanceId].driver !== "claudeAgent" || instanceId === "claude")) {
- return json(res, 400, { error: "Only added accounts and custom endpoints can be removed here." });
- }
- if (providerInUse(instanceId)) {
- return json(res, 409, { error: "Choose another account for the bots and default model using this account before removing it." });
- }
- // OpenMausBot keeps a ChatGPT account's sign-in in its own data folder: removing the account clears it.
- const live = addedChatgpt ? registry.get(instanceId) : undefined;
- if (live?.signOut) {
- try { await providerAuthSessions.signOut(live, auth.kind === "session" ? auth.session.id : "loopback"); }
- catch (error) {
- if ((error as { code?: unknown }).code !== "chatgpt_revocation_unconfirmed") {
- return json(res, 409, { error: error instanceof Error ? error.message : String(error), ...userErrorFields(error) });
- }
- }
- }
+ // Held from before the config is read until it is saved: a sign-out waits on a CLI, and another account added or
+ // removed meanwhile would be overwritten by this one's older copy.
providerConfigBusy.set(true);
providerInstancesChanging.add(instanceId);
try {
+ const instances = persistableInstanceConfigs(cfg);
+ if (!Object.hasOwn(instances, instanceId)) return json(res, 404, { error: "unknown instance" });
+ const addedChatgpt = instances[instanceId].driver === "codex" && instanceId.startsWith("chatgpt-");
+ const addedAntigravity = instances[instanceId].driver === "antigravityAgent" && instanceId.startsWith("antigravity-");
+ if (!addedChatgpt && !addedAntigravity && !isCodexEndpoint(instances[instanceId]) && !isAddedEndpoint(instanceId, instances[instanceId]) && (instances[instanceId].driver !== "claudeAgent" || instanceId === "claude")) {
+ return json(res, 400, { error: "Only added accounts and custom endpoints can be removed here." });
+ }
+ if (providerInUse(instanceId)) {
+ return json(res, 409, { error: "Choose another account for the bots and default model using this account before removing it." });
+ }
+ // OpenMausBot keeps a ChatGPT account's sign-in in its own data folder: removing the account clears it. An added
+ // Antigravity account's sign-in, on either runtime, is in its profile, which is removed below.
+ const live = addedChatgpt ? registry.get(instanceId) : undefined;
+ if (live?.signOut) {
+ try { await providerAuthSessions.signOut(live, auth.kind === "session" ? auth.session.id : "loopback"); }
+ catch (error) {
+ if ((error as { code?: unknown }).code !== "chatgpt_revocation_unconfirmed") {
+ return json(res, 409, { error: error instanceof Error ? error.message : String(error), ...userErrorFields(error) });
+ }
+ }
+ }
delete instances[instanceId];
await persistProviderInstance(instanceId, instances);
// An added Antigravity account's Google sign-in lives in OpenMausBot's data folder too: removing the account deletes it.
diff --git a/server/testing/antigravity-native-fixture.ts b/server/testing/antigravity-native-fixture.ts
new file mode 100644
index 0000000000..ec64aa19aa
--- /dev/null
+++ b/server/testing/antigravity-native-fixture.ts
@@ -0,0 +1,94 @@
+// A native Antigravity CLI on disk for tests: a program named `antigravity` that runs the fake CLI
+// (server/testing/fake-antigravity-cli.ts), and the log that fake writes.
+import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+
+import { antigravityRuntimesRoot } from "../engine-roots.ts";
+import { spawnCli } from "../procs.ts";
+
+const FAKE_CLI = join(dirname(fileURLToPath(import.meta.url)), "fake-antigravity-cli.ts");
+
+export interface NativeFixture {
+ directory: string;
+ executable: string;
+ log: string;
+ /** Every request and login event the fake logged, in order. */
+ entries(): Array<Record<string, any>>;
+ /** The ACP methods the fake received. */
+ methods(): string[];
+}
+
+const shellQuoted = (value: string) => `'${value.replaceAll("'", "'\\''")}'`;
+export const fakeAntigravityScript = () => `#!/bin/sh\nexec ${shellQuoted(process.execPath)} ${shellQuoted(FAKE_CLI)} "$@"\n`;
+
+export function nativeFixture(directory: string): NativeFixture {
+ mkdirSync(directory, { recursive: true });
+ const executable = join(directory, "antigravity");
+ writeFileSync(executable, fakeAntigravityScript());
+ chmodSync(executable, 0o755);
+ const log = join(directory, "fake-antigravity.log");
+ const entries = () => existsSync(log)
+ ? readFileSync(log, "utf8").split("\n").filter(Boolean).map((line) => JSON.parse(line) as Record<string, any>)
+ : [];
+ return { directory, executable, log, entries, methods: () => entries().flatMap((entry) => typeof entry.method === "string" ? [entry.method] : []) };
+}
+
+/** The managed install the app makes under `baseDir`, laid down by hand: the same files, with no download. */
+export function installFakeManagedCli(baseDir: string, releaseId = "a".repeat(64), version = "1.5.14"): string {
+ const root = join(antigravityRuntimesRoot(baseDir), `${process.platform}-${process.arch}`);
+ const directory = join(root, "versions", releaseId);
+ mkdirSync(directory, { recursive: true });
+ const name = process.platform === "win32" ? "agy.exe" : "antigravity";
+ const script = fakeAntigravityScript();
+ writeFileSync(join(directory, name), script, { mode: 0o755 });
+ chmodSync(join(directory, name), 0o755);
+ writeFileSync(join(directory, ".install-complete.json"), JSON.stringify({ releaseId, version, executable: { name, bytes: Buffer.byteLength(script) }, harness: null }));
+ writeFileSync(join(root, "active.json"), JSON.stringify({ releaseId }));
+ return join(directory, name);
+}
+
+/** Runs the fake's `acp --login` for a profile directory the way a person at a terminal would, and pastes `code`. */
+export function loginAt(fixture: NativeFixture, profileDirectory: string, code: string, env: Record<string, string> = {}): Promise<number | null> {
+ return new Promise((done) => {
+ const child = spawnCli(fixture.executable, ["acp", "--login", "--gemini-dir", profileDirectory, "--app-data-dir", "antigravity-acp"], {
+ env: { ...process.env, FAKE_AGY_LOG: fixture.log, ...env },
+ stdio: ["pipe", "pipe", "pipe"],
+ });
+ child.stdout.resume();
+ child.stderr.resume();
+ child.stdin.end(`${code}\n`);
+ child.once("close", (exit) => done(exit));
+ });
+}
+
+/** Whether the CLI accepts a session for the profile directory, asked directly over ACP and by nothing of the app's. */
+export function sessionAcceptedAt(fixture: NativeFixture, profileDirectory: string): Promise<boolean> {
+ return new Promise((done, fail) => {
+ const child = spawnCli(fixture.executable, ["acp", "--gemini-dir", profileDirectory, "--app-data-dir", "antigravity-acp"], {
+ env: { ...process.env, FAKE_AGY_LOG: fixture.log },
+ stdio: ["pipe", "pipe", "pipe"],
+ });
+ child.stderr.resume();
+ let buffer = "";
+ let answered = false;
+ child.stdout.setEncoding("utf8");
+ child.stdout.on("data", (chunk: string) => {
+ buffer += chunk;
+ const lines = buffer.split("\n");
+ buffer = lines.pop() ?? "";
+ for (const line of lines.filter(Boolean)) {
+ const message = JSON.parse(line) as { id?: number; error?: unknown };
+ if (message.id === 2 && !answered) {
+ answered = true;
+ child.kill();
+ done(message.error === undefined);
+ }
+ }
+ });
+ child.once("error", fail);
+ child.once("close", (code) => { if (!answered) fail(new Error(`the CLI exited (${code}) before it answered session/new`)); });
+ child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id: 1, method: "initialize", params: { protocolVersion: 1 } })}\n`);
+ child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id: 2, method: "session/new", params: { cwd: profileDirectory, mcpServers: [] } })}\n`);
+ });
+}
diff --git a/server/testing/fake-acp-cli.ts b/server/testing/fake-acp-cli.ts
index 485f7e2cd4..7a68b62f5c 100755
--- a/server/testing/fake-acp-cli.ts
+++ b/server/testing/fake-acp-cli.ts
@@ -38,6 +38,7 @@
// FAKE_ACP_LATE_UPDATE=1: a tool_call_update of the finished prompt arrives 50 ms after its answer)
// FAKE_ACP_GROK_NATIVE_MCP _x.ai/mcp/list reports these comma-separated native servers after the session's accepted ones
// FAKE_ACP_MCP_TRANSPORTS remote MCP transports advertised in initialize, e.g. "http,sse"
+// FAKE_ACP_CAPABILITIES_META JSON initialize advertises as agentCapabilities._meta
// FAKE_ACP_MCP_HOLD=1 every session connects its MCP servers at once and keeps the stdio ones running, as Grok does
// FAKE_ACP_PERMISSION_OPTIONS JSON options override in permission mode
// FAKE_ACP_DUMP path for {argv, env}; with FAKE_ACP_MODES or FAKE_ACP_MODELS also <dump>.prompts.jsonl
@@ -1019,6 +1020,7 @@ function handle(msg: any) {
}
const authMethods = mode === "no-auth" ? [] : [{ id: process.env.FAKE_ACP_AUTH_METHOD ?? "cached_token" }];
const agentName = process.env.FAKE_ACP_AGENT_NAME;
+ const capabilityMeta = process.env.FAKE_ACP_CAPABILITIES_META;
const acceptsImages = process.env.FAKE_ACP_IMAGE_CAPABILITY === "1";
const mcpTransports = (process.env.FAKE_ACP_MCP_TRANSPORTS ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
const closesSessions = ["1", "error"].includes(process.env.FAKE_ACP_SESSION_CLOSE ?? "");
@@ -1032,9 +1034,10 @@ function handle(msg: any) {
agentInfo: agentName
? { name: agentName, version: process.env.FAKE_ACP_AGENT_VERSION ?? "test" }
: undefined,
- agentCapabilities: agentName || acceptsImages || mcpTransports.length || closesSessions || deletesSessions || mode === "devin-steer"
+ agentCapabilities: agentName || acceptsImages || mcpTransports.length || closesSessions || deletesSessions || mode === "devin-steer" || capabilityMeta
? {
...(mode === "devin-steer" && process.env.FAKE_ACP_STEERING !== "off" ? { _meta: { "cognition.ai/midTurnPrompts": true } } : {}),
+ ...(capabilityMeta ? { _meta: JSON.parse(capabilityMeta) } : {}),
...(agentName ? { loadSession: true, sessionCapabilities: { resume: true }, auth: { logout: true } } : {}),
...(closesSessions || deletesSessions
? { sessionCapabilities: { ...(closesSessions ? { close: {} } : {}), ...(deletesSessions ? { delete: {} } : {}),
diff --git a/server/testing/fake-antigravity-cli.ts b/server/testing/fake-antigravity-cli.ts
new file mode 100644
index 0000000000..b55ff7ab49
--- /dev/null
+++ b/server/testing/fake-antigravity-cli.ts
@@ -0,0 +1,169 @@
+#!/usr/bin/env node
+// Offline stand-in for Google's native Antigravity CLI (1.5.x), as measured against 1.5.14, started as `antigravity acp
+// --gemini-dir <dir> --app-data-dir antigravity-acp [--login]`, or `--version`. Its sign-in is the file
+// <gemini-dir>/antigravity-acp/antigravity-oauth-token, which stands for the OS keyring.
+// - ACP over stdio: `initialize` names "Antigravity ACP Server" and offers `logout` and `session/close`; `authenticate`
+// always fails; `session/new` answers -32000 "Authentication required" until signed in, then offers a mode and the
+// models (one is specific to the account); `session/prompt` streams one reply; `logout` forgets the sign-in.
+// - `acp --login`: prints the sign-in link and the paste prompt on stdout, reads one line from stdin, and exits 0 after
+// writing the sign-in when the line is (or its `code` is) the accepted code, 1 otherwise. It opens no browser.
+// Env knobs (all optional):
+// FAKE_AGY_LOG file each request and login event is appended to, as JSON lines
+// FAKE_AGY_VERSION what `--version` and initialize say (default 1.5.14)
+// FAKE_AGY_ACCEPT the authorization code `--login` accepts (default fixture-code)
+// FAKE_AGY_ACCOUNT_MODEL the model id only a signed-in account is offered (default fixture-account-model)
+// FAKE_AGY_LOGIN no-link | hold | stay | bad-domain | bad-redirect | state-less: how `--login` misbehaves
+// FAKE_AGY_LOGOUT refuse | ignore: `logout` fails, or answers and forgets nothing
+// FAKE_AGY_HANG initialize | session-new: never answers that request; crash: exits on session/new
+// FAKE_AGY_LOGOUT_MS how long `logout` takes before it answers
+// FAKE_AGY_KEYRING_SHARED with FAKE_AGY_KEYRING: one entry for every --gemini-dir, as the macOS keyring holds in 1.5.14
+// FAKE_AGY_SESSION_ERROR a message session/new fails with as -32000, signed in or not
+// FAKE_AGY_KEYRING a folder that stands for the OS keyring: the sign-in is kept there, one entry per --gemini-dir,
+// and only `logout` removes it; ignored while SSH_CONNECTION is set, as the real CLI ignores the
+// keyring then
+import { createHash } from "node:crypto";
+import { appendFileSync, existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
+import { join, resolve } from "node:path";
+import { createInterface } from "node:readline";
+
+const argv = process.argv.slice(2);
+const version = process.env.FAKE_AGY_VERSION ?? "1.5.14";
+const log = (entry: Record<string, unknown>) => {
+ if (process.env.FAKE_AGY_LOG) appendFileSync(process.env.FAKE_AGY_LOG, `${JSON.stringify({ pid: process.pid, ...entry })}\n`);
+};
+
+if (argv.includes("--version")) {
+ console.log(`antigravity ${version}`);
+ process.exit(0);
+}
+if (argv[0] !== "acp") {
+ console.error("fake antigravity: only `acp` and `--version` exist");
+ process.exit(2);
+}
+
+const flag = (name: string) => argv.includes(name) ? argv[argv.indexOf(name) + 1] : undefined;
+const geminiDir = resolve(flag("--gemini-dir") ?? ".");
+const stateDir = join(geminiDir, flag("--app-data-dir") ?? "antigravity-acp");
+// As 1.5.14 and 1.5.15 do: over SSH (SSH_CONNECTION set, as the app always starts it) the profile's file, never the keyring.
+const credentialFile = process.env.FAKE_AGY_KEYRING && !process.env.SSH_CONNECTION
+ ? join(process.env.FAKE_AGY_KEYRING, process.env.FAKE_AGY_KEYRING_SHARED ? "shared" : createHash("sha256").update(geminiDir).digest("hex"))
+ : join(stateDir, "antigravity-oauth-token");
+const accountModel = process.env.FAKE_AGY_ACCOUNT_MODEL ?? "fixture-account-model";
+const signedIn = () => existsSync(credentialFile);
+
+function signIn(): void {
+ mkdirSync(join(credentialFile, ".."), { recursive: true });
+ writeFileSync(credentialFile, `${JSON.stringify({ fixture: "offline, not a credential" })}\n`, { mode: 0o600 });
+}
+
+if (argv.includes("--login")) {
+ const mode = process.env.FAKE_AGY_LOGIN ?? "";
+ log({ event: "login-start" });
+ if (mode === "no-link") {
+ setInterval(() => {}, 1_000);
+ await new Promise(() => {});
+ }
+ const host = mode === "bad-domain" ? "https://accounts.example.test" : "https://accounts.google.com";
+ const redirect = encodeURIComponent(mode === "bad-redirect" ? "http://127.0.0.1:1/" : "https://antigravity.google/oauth-callback");
+ const state = mode === "state-less" ? "" : "&state=fixture-state";
+ process.stdout.write([
+ "Open this link in a browser to log in with Google:",
+ "",
+ ` ${host}/o/oauth2/auth?client_id=fixture&redirect_uri=${redirect}&response_type=code&scope=openid${state}`,
+ "Then paste the authorization code, or the full URL of the page you land on, and press Enter:",
+ "",
+ ].join("\n"));
+ if (mode === "hold") {
+ setInterval(() => {}, 1_000);
+ await new Promise(() => {});
+ }
+ const line = await new Promise<string>((done) => {
+ const reader = createInterface({ input: process.stdin });
+ reader.once("line", (text) => { done(text.trim()); reader.close(); });
+ process.stdin.once("end", () => done(""));
+ });
+ let code = line;
+ if (/^https?:\/\//u.test(line)) code = new URL(line).searchParams.get("code") ?? "";
+ const accepted = code === (process.env.FAKE_AGY_ACCEPT ?? "fixture-code");
+ log({ event: "login-code", accepted, asAddress: /^https?:\/\//u.test(line) });
+ if (!accepted) {
+ process.stderr.write("fake antigravity: the authorization code was not accepted\n");
+ process.exit(1);
+ }
+ signIn();
+ if (mode === "stay") {
+ process.stdout.write("Signed in.\n");
+ setInterval(() => {}, 1_000);
+ await new Promise(() => {});
+ }
+ process.exit(0);
+}
+
+const out = (message: unknown) => process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", ...(message as object) })}\n`);
+const result = (id: unknown, value: unknown) => out({ id, result: value });
+const failure = (id: unknown, code: number, message: string) => out({ id, error: { code, message } });
+let mode = "default";
+let model = "fixture-base-model";
+let sessions = 0;
+
+const configOptions = () => [
+ { id: "mode", name: "Mode", type: "select", currentValue: mode, options: [{ value: "default", name: "Default" }, { value: "plan", name: "Plan" }] },
+ {
+ id: "model", name: "Model", type: "select", currentValue: model,
+ options: [{ value: "fixture-base-model", name: "Fixture base" }, { value: accountModel, name: "Fixture account model" }],
+ },
+];
+
+createInterface({ input: process.stdin }).on("line", async (line) => {
+ let message: { id?: unknown; method?: string; params?: { sessionId?: string; configId?: string; value?: string } };
+ try { message = JSON.parse(line); } catch { return; }
+ if (!message.method) return;
+ log({ method: message.method, signedIn: signedIn() });
+ switch (message.method) {
+ case "initialize":
+ if (process.env.FAKE_AGY_HANG === "initialize") return;
+ result(message.id, {
+ protocolVersion: 1,
+ authMethods: [{ id: "oauth-personal", name: "Log in with Google" }],
+ agentInfo: { name: "Antigravity ACP Server", version },
+ agentCapabilities: {
+ loadSession: true,
+ promptCapabilities: { image: true },
+ sessionCapabilities: { resume: {}, close: {} },
+ auth: { logout: {} },
+ },
+ });
+ break;
+ case "authenticate":
+ failure(message.id, -32603, "fake antigravity does not sign in through authenticate; use acp --login");
+ break;
+ case "logout":
+ log({ event: "logout-start" });
+ if (process.env.FAKE_AGY_LOGOUT_MS) await new Promise((resolveWait) => setTimeout(resolveWait, Number(process.env.FAKE_AGY_LOGOUT_MS)));
+ if (process.env.FAKE_AGY_LOGOUT === "refuse") failure(message.id, -32603, "logout refused");
+ else {
+ if (process.env.FAKE_AGY_LOGOUT !== "ignore") rmSync(credentialFile, { force: true });
+ result(message.id, {});
+ }
+ break;
+ case "session/new":
+ if (process.env.FAKE_AGY_HANG === "session-new") return;
+ if (process.env.FAKE_AGY_HANG === "crash") process.exit(3);
+ if (process.env.FAKE_AGY_SESSION_ERROR) return failure(message.id, -32000, process.env.FAKE_AGY_SESSION_ERROR);
+ if (!signedIn()) return failure(message.id, -32000, "Authentication required");
+ sessions += 1;
+ result(message.id, { sessionId: `fixture-session-${process.pid}-${sessions}`, configOptions: configOptions() });
+ break;
+ case "session/set_config_option":
+ if (message.params?.configId === "mode") mode = String(message.params.value);
+ if (message.params?.configId === "model") model = String(message.params.value);
+ result(message.id, { configOptions: configOptions() });
+ break;
+ case "session/prompt":
+ out({ method: "session/update", params: { sessionId: message.params?.sessionId, update: { sessionUpdate: "agent_message_chunk", content: { type: "text", text: "fixture reply" } } } });
+ result(message.id, { stopReason: "end_turn" });
+ break;
+ default:
+ result(message.id, {});
+ }
+}).on("close", () => process.exit(0));
diff --git a/src/components/EngineSetup.antigravity.test.ts b/src/components/EngineSetup.antigravity.test.ts
index 66b8695017..b5355d6197 100644
--- a/src/components/EngineSetup.antigravity.test.ts
+++ b/src/components/EngineSetup.antigravity.test.ts
@@ -2,7 +2,7 @@
import { createElement } from "react";
import { flushSync } from "react-dom";
import { createRoot, type Root } from "react-dom/client";
-import { afterEach, beforeEach, expect, it, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { setLocale } from "@/lib/i18n";
import { BotEditorStore, type InstanceInfo, type useStore } from "@/state/store";
@@ -39,18 +39,18 @@ function auth(body: object) {
return new Response(JSON.stringify({ auth: body }), { status: 200, headers: { "content-type": "application/json" } });
}
-async function startSignIn(status: object, ogb: object = { remoteClient: { active: false } }, config: object = {}) {
+async function startSignIn(status: object, ogb: object = { remoteClient: { active: false } }, config: object = {}, started: object = {}) {
const openExternal = vi.fn(async () => {});
vi.stubGlobal("ogb", { platform: "linux", openExternal, ...ogb });
const fetched = vi.fn(async (input: RequestInfo | URL) => String(input).includes("/auth/status")
? auth(status)
- : auth({ phase: "waiting", flowId: "flow-1", authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth?state=s" }));
+ : auth({ phase: "waiting", flowId: "flow-1", authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth?state=s", ...started }));
vi.stubGlobal("fetch", fetched);
const store = { state: { config }, dispatch: vi.fn(), refreshInstances: vi.fn(async () => {}), refreshModels: vi.fn(async () => {}) } as unknown as ReturnType<typeof useStore>;
flushSync(() => root.render(createElement(BotEditorStore, { value: store, children: createElement(EngineSetup, { instance: antigravity }) })));
const button = () => [...host.querySelectorAll("button")].find((b) => /Sign in with Google|Open Google sign-in again/.test(b.textContent ?? ""))!;
button().click();
- await vi.waitFor(() => expect(host.querySelector("[data-redirect-paste]")).not.toBeNull());
+ await vi.waitFor(() => expect(host.querySelector("[data-redirect-paste], [data-code-paste]")).not.toBeNull());
return { store, fetched, openExternal, button };
}
@@ -118,29 +118,57 @@ it("names Google on the sign-in card, never another provider", () => {
expect(host.textContent).not.toContain("Mistral");
});
-// Antigravity's native CLI signs in with `--login`: Google's Antigravity page shows a code to paste back, and there is no
-// redirect to paste and nothing to finish by itself.
-it("asks for the code the Antigravity page shows when the sign-in is the native CLI's, and sends it", async () => {
- vi.stubGlobal("ogb", { platform: "linux", openExternal: vi.fn(async () => {}), remoteClient: { active: false } });
- const fetched = vi.fn(async (input: RequestInfo | URL, _init?: RequestInit) => String(input).includes("/auth/status")
- ? auth({ phase: "waiting", flowId: "flow-1", authorizationUrl: null })
- : auth({ phase: "waiting", flowId: "flow-1", authorizationUrl: "https://accounts.google.com/o/oauth2/auth?state=s", pasteCode: true }));
- vi.stubGlobal("fetch", fetched);
- const store = { state: { config: { cloudHome: true } }, dispatch: vi.fn(), refreshInstances: vi.fn(async () => {}), refreshModels: vi.fn(async () => {}) } as unknown as ReturnType<typeof useStore>;
- flushSync(() => root.render(createElement(BotEditorStore, { value: store, children: createElement(EngineSetup, { instance: antigravity }) })));
- [...host.querySelectorAll("button")].find((b) => /Sign in with Google/.test(b.textContent ?? ""))!.click();
- await vi.waitFor(() => expect(host.querySelector("[data-code-paste]")).not.toBeNull());
- expect(host.querySelector("[data-redirect-paste]")).toBeNull();
- expect(host.textContent).not.toContain("I finished signing in");
- expect(host.textContent).not.toContain("Google opens a page that won’t load");
- expect(host.querySelector("[data-code-paste] p")?.textContent).toBe("After you sign in, Google shows a code on the Antigravity page. Copy it and paste it here.");
- const field = host.querySelector<HTMLInputElement>("[data-code-paste] input")!;
- const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!;
- flushSync(() => { setValue.call(field, "4/0Ab-code"); field.dispatchEvent(new Event("input", { bubbles: true })); });
- const send = [...host.querySelectorAll("button")].find((b) => b.textContent === "Send code")!;
- await vi.waitFor(() => expect(send.disabled).toBe(false));
- send.click();
- await vi.waitFor(() => expect(fetched.mock.calls.some(([url]) => String(url).includes("/auth/complete"))).toBe(true));
- const [, init] = fetched.mock.calls.find(([url]) => String(url).includes("/auth/complete"))!;
- expect(JSON.parse(String(init?.body))).toEqual({ flowId: "flow-1", callbackUrl: "4/0Ab-code" });
+// The app starts the native CLI so each account keeps its own sign-in, as on the pinned runtime.
+it("says each account has its own Google account on the sign-in card, on either runtime", () => {
+ vi.stubGlobal("ogb", { platform: "linux", remoteClient: { active: false } });
+ const store = { state: { config: {} }, dispatch: vi.fn(), refreshInstances: vi.fn(async () => {}), refreshModels: vi.fn(async () => {}) } as unknown as ReturnType<typeof useStore>;
+ const render = (instance: InstanceInfo) => flushSync(() => root.render(createElement(BotEditorStore, { value: store, children: createElement(EngineSetup, { instance }) })));
+ for (const instance of [{ ...antigravity, cli: "antigravity", snapshot: { ...antigravity.snapshot, nativeCli: true as const } }, { ...antigravity, cli: "agy" }]) {
+ render(instance);
+ expect(host.textContent).toContain("has its own Google account");
+ expect(host.textContent).not.toContain("keeps one sign-in");
+ }
+});
+
+it("describes and labels the install as Google's Antigravity CLI, unless the path asks for the pinned runtime alone", () => {
+ vi.stubGlobal("ogb", { platform: "linux", remoteClient: { active: false } });
+ const store = { state: { config: {} }, dispatch: vi.fn(), refreshInstances: vi.fn(async () => {}), refreshModels: vi.fn(async () => {}) } as unknown as ReturnType<typeof useStore>;
+ const missing = { state: "unavailable" as const, reason: "The Antigravity CLI is not installed yet." };
+ const render = (cli: string | undefined) => flushSync(() => root.render(createElement(BotEditorStore, { value: store, children: createElement(EngineSetup, { instance: { ...antigravity, cli, snapshot: missing } }) })));
+ for (const cli of [undefined, "agy", "antigravity"]) {
+ render(cli);
+ expect(host.textContent).toContain("installs Google's Antigravity CLI");
+ expect(host.textContent).toContain("Install Google Antigravity CLI");
+ expect(host.textContent).not.toContain("separate from the Antigravity app and agy CLI");
+ }
+ render("agy_acp_server");
+ expect(host.textContent).toContain("separate from the Antigravity app and agy CLI");
+ expect(host.textContent).toContain("Install Classic runtime");
+});
+
+// The native CLI's sign-in ends on a page that shows a code, not on a redirect to this computer.
+describe("a sign-in whose page ends on a code", () => {
+ const native = { kind: "pasted-code", authorizationUrl: "https://accounts.google.com/o/oauth2/auth?state=s" };
+
+ it("asks for the code or the page's address, and never for a redirect that cannot load or a finished button", async () => {
+ await startSignIn({ phase: "waiting", flowId: "flow-1" }, { remoteClient: { active: false } }, { cloudHome: true }, native);
+ expect(host.querySelector("[data-redirect-paste]")).toBeNull();
+ expect(host.textContent).not.toContain("I finished signing in");
+ expect(host.textContent).not.toContain("won’t load");
+ expect(host.querySelector("[data-code-paste] p")?.textContent).toContain("paste the code it shows, or the full address of the page you end on");
+ expect(host.querySelector("[data-code-paste] input")?.getAttribute("aria-label")).toBe("Sign-in code or page address");
+ });
+
+ it("sends what was pasted with the sign-in's id, then reads the engines again", async () => {
+ const { store, fetched } = await startSignIn({ phase: "waiting", flowId: "flow-1" }, { remoteClient: { active: false } }, {}, native);
+ const field = host.querySelector<HTMLInputElement>("[data-code-paste] input")!;
+ const send = [...host.querySelectorAll("button")].find((b) => b.textContent === "Send code")!;
+ expect(send.disabled).toBe(true);
+ const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!;
+ flushSync(() => { setValue.call(field, "4/0AbcCode"); field.dispatchEvent(new Event("input", { bubbles: true })); });
+ flushSync(() => send.click());
+ await vi.waitFor(() => expect(store.refreshModels).toHaveBeenCalledWith("antigravity"));
+ const sent = (fetched.mock.calls as unknown as Array<[RequestInfo | URL, RequestInit]>).find(([input]) => String(input).includes("/auth/complete"))!;
+ expect(JSON.parse(String(sent[1].body))).toEqual({ flowId: "flow-1", callbackUrl: "4/0AbcCode" });
+ });
});
diff --git a/src/components/EngineSetup.test.ts b/src/components/EngineSetup.test.ts
index 7600f14ec9..60d31c09d1 100644
--- a/src/components/EngineSetup.test.ts
+++ b/src/components/EngineSetup.test.ts
@@ -66,7 +66,7 @@ describe("managed engine setup errors", () => {
const markup = render(engine);
expect(markup).toContain(reason);
expect(markup).toContain('role="alert"');
- expect(markup).toContain("Install official Antigravity");
+ expect(markup).toContain("Install Google Antigravity CLI");
expect(engineStatus(engine)).toBe("Setup required");
expect(markup).not.toMatch(/CLI not found|Not installed/);
});
@@ -82,7 +82,7 @@ describe("managed engine setup errors", () => {
const markup = render(engine);
expect(engineStatus(engine)).toBe("Sign-in required");
expect(markup).toContain("Sign in with Google");
- expect(markup).not.toContain("Install official Antigravity");
+ expect(markup).not.toContain("Install Google Antigravity CLI");
});
});
diff --git a/src/components/EngineSetup.tsx b/src/components/EngineSetup.tsx
index 800ebc274e..e30d102f9c 100644
--- a/src/components/EngineSetup.tsx
+++ b/src/components/EngineSetup.tsx
@@ -272,13 +272,24 @@ export function EngineWarningNotice({
);
}
+/** An Antigravity account on Google's native CLI: the one it runs, or, while it runs none, the one its path names. */
+export function runsAntigravityCli(instance: InstanceInfo): boolean {
+ if (instance.driverKind !== "antigravityAgent") return false;
+ if (instance.snapshot.state === "available") return instance.snapshot.nativeCli === true;
+ return /(?:^|[\\/])antigravity(?:\.exe)?$/iu.test(instance.cli?.trim() ?? "");
+}
+
+/** A path that does not ask for the pinned runtime alone takes the Antigravity CLI when the app installs one. */
+function installsAntigravityCli(instance: InstanceInfo): boolean {
+ return instance.driverKind === "antigravityAgent" && !/^agy_acp_server$/iu.test(instance.cli?.trim() ?? "");
+}
+
function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo; signInOnly: boolean }) {
const { state, refreshInstances, refreshModels } = useStore();
const signInStarted = useSignInStarted(instance.instanceId);
const [busy, setBusy] = useState<"install" | "signin" | "complete" | "check" | null>(null);
const [error, setError] = useState<string | null>(null);
- // `pasteCode`: Antigravity's native CLI, whose Google page shows a code to paste back instead of a redirect.
- const [flow, setFlow] = useState<{ flowId: string; authorizationUrl: string; pasteCode?: boolean } | null>(null);
+ const [flow, setFlow] = useState<{ flowId: string; authorizationUrl: string; pastedCode: boolean } | null>(null);
const [callbackUrl, setCallbackUrl] = useState("");
const managed = instance.install!.managed!;
@@ -342,7 +353,7 @@ function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo;
return;
}
if (!auth.flowId || !auth.authorizationUrl) throw new Error(t("engineSetup.googleNoLink"));
- setFlow({ flowId: auth.flowId, authorizationUrl: auth.authorizationUrl, pasteCode: auth.pasteCode === true });
+ setFlow({ flowId: auth.flowId, authorizationUrl: auth.authorizationUrl, pastedCode: auth.kind === "pasted-code" });
await openLink(auth.authorizationUrl);
});
@@ -372,7 +383,9 @@ function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo;
className="flex w-full items-center justify-center gap-2 rounded-lg bg-accent px-3 py-2 text-[13px] font-semibold text-white hover:brightness-110 disabled:cursor-wait disabled:opacity-70"
>
{busy === "install" ? <Loader2 size={14} className="animate-spin" /> : <Download size={14} />}
- {busy === "install" ? t("engineSetup.installing") : managed.label}
+ {busy === "install" ? t("engineSetup.installing") : instance.driverKind === "antigravityAgent"
+ ? t(installsAntigravityCli(instance) ? "engineSetup.installAntigravityCli" : "engineSetup.installClassicRuntime")
+ : managed.label}
</button>
{!managed.sizeUnknown && <p className="mt-1.5 text-center text-[11px] text-ink-tertiary">
{t("engineSetup.downloadNote", { mb: Math.ceil(managed.downloadBytes / 1024 / 1024) })}
@@ -385,7 +398,7 @@ function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo;
const cloudHome = state.config?.cloudHome === true;
return (
<div className="mt-3 space-y-2">
- {cloudHome && !flow?.pasteCode && <p className="text-[12px] leading-relaxed text-ink-secondary">{t("engineSetup.cloudPasteHint")}</p>}
+ {cloudHome && !flow?.pastedCode && <p className="text-[12px] leading-relaxed text-ink-secondary">{t("engineSetup.cloudPasteHint")}</p>}
<button
type="button"
disabled={busy !== null}
@@ -400,14 +413,16 @@ function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo;
: t("engineSetup.signInGoogle")}
</button>
{busy === "signin" && <p role="status" className="text-[12px] text-ink-secondary">{t("engineSetup.antigravitySlow")}</p>}
- {flow?.pasteCode && (
+ {flow?.pastedCode && (
<div data-code-paste className="rounded-lg border border-hairline/50 bg-app px-2.5 py-2 text-[12px] text-ink-secondary">
<p className="leading-relaxed">{t("engineSetup.pasteCodeHint")}</p>
<input
value={callbackUrl}
onChange={(event) => setCallbackUrl(event.target.value)}
aria-label={t("engineSetup.pasteCodeLabel")}
+ placeholder={t("engineSetup.pasteCodePlaceholder")}
autoComplete="off"
+ spellCheck={false}
className="mt-2 w-full rounded-md border border-hairline bg-inset px-2 py-1.5 text-[11px] text-ink outline-none focus:border-accent"
/>
<button
@@ -420,7 +435,7 @@ function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo;
</button>
</div>
)}
- {flow && !flow.pasteCode && (
+ {flow && !flow.pastedCode && (
<>
<button type="button" onClick={() => void check()} className="w-full rounded-lg bg-control px-3 py-2 text-[12px] font-semibold text-ink hover:bg-raised-hover">
{busy === "check" ? t("common.checking") : t("engineSetup.finishedSignIn")}
@@ -626,7 +641,7 @@ export function EngineSetup({
: install?.server
? t("engineSetup.serverInstallDesc")
: install?.managed
- ? t("engineSetup.managedDesc")
+ ? t(installsAntigravityCli(instance) ? "engineSetup.managedDescCli" : "engineSetup.managedDesc")
: signInCommand
? t("engineSetup.installDescSignIn")
: t("engineSetup.installDesc"));
diff --git a/src/components/EnginesSettings.antigravity-runtime.dom.test.ts b/src/components/EnginesSettings.antigravity-runtime.dom.test.ts
new file mode 100644
index 0000000000..dfe5cc751c
--- /dev/null
+++ b/src/components/EnginesSettings.antigravity-runtime.dom.test.ts
@@ -0,0 +1,71 @@
+// @vitest-environment happy-dom
+import { act, createElement } from "react";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, expect, it, vi } from "vitest";
+import type { Bot, InstanceInfo } from "@/state/store";
+import { setLocale } from "@/lib/i18n";
+
+const fixture = vi.hoisted(() => ({ state: { instances: [] as InstanceInfo[], bots: [] as Bot[], config: {} as Record<string, unknown> }, patches: [] as Array<{ path: string; body: unknown }> }));
+vi.mock("@/state/store", async (original) => ({
+ ...await original<typeof import("@/state/store")>(),
+ useStore: () => ({
+ state: fixture.state,
+ dispatch: (action: { type: string; instances?: InstanceInfo[] }) => { if (action.type === "instances" && action.instances) fixture.state = { ...fixture.state, instances: action.instances }; },
+ refreshInstances: async () => {}, refreshModels: async () => {},
+ }),
+ api: async (path: string, init?: { method?: string; body?: string }) => {
+ if (init?.method === "PATCH") fixture.patches.push({ path, body: init.body ? JSON.parse(init.body) : undefined });
+ return {};
+ },
+}));
+import { EnginesSettings } from "./EnginesSettings";
+
+function google(fields: Partial<InstanceInfo>): InstanceInfo {
+ return {
+ instanceId: "antigravity", driverKind: "antigravityAgent", displayName: "Google Gemini", cliDefault: "agy",
+ snapshot: { state: "available", authenticated: true }, models: { default: "gemini", options: [] },
+ install: { managed: { label: "Install Antigravity", downloadBytes: 1 } }, ...fields,
+ } as InstanceInfo;
+}
+
+let container: HTMLDivElement, root: Root;
+beforeEach(() => {
+ vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
+ setLocale("en");
+ fixture.patches = [];
+ container = document.createElement("div"); document.body.append(container); root = createRoot(container);
+});
+afterEach(async () => { await act(async () => root.unmount()); container.remove(); vi.unstubAllGlobals(); });
+
+async function show(instance: InstanceInfo) {
+ fixture.state = { instances: [instance], bots: [], config: {} };
+ await act(async () => { root.render(createElement(EnginesSettings)); });
+ return container.querySelector<HTMLSelectElement>("[data-antigravity-runtime] select");
+}
+
+it.each([
+ ["the CLI it runs", google({ cli: "agy", snapshot: { state: "available", authenticated: true, nativeCli: true } }), "cli"],
+ ["the path antigravity", google({ cli: "antigravity", snapshot: { state: "unavailable" } }), "cli"],
+ ["the path Antigravity.exe", google({ cli: "Antigravity.exe", snapshot: { state: "unavailable" } }), "cli"],
+ ["a new install with nothing yet", google({ snapshot: { state: "unavailable" } }), "cli"],
+ ["the pinned runtime it runs", google({ snapshot: { state: "available", authenticated: true, version: "1.4.3" } }), "pinned"],
+ ["the path that asks for the pinned runtime", google({ cli: "agy_acp_server", snapshot: { state: "unavailable" } }), "pinned"],
+ ["a path of the person's own", google({ cli: "/opt/agy/agy_acp_server.par", snapshot: { state: "available", version: "1.4.3" } }), "custom"],
+ ["a native CLI at a path of the person's own", google({ cli: "/opt/tools/antigravity", snapshot: { state: "available", authenticated: true, nativeCli: true } }), "custom"],
+])("shows what an Antigravity account runs, from %s", async (_from, instance, shown) => {
+ const select = await show(instance);
+ expect(select?.value).toBe(shown);
+});
+
+it.each([
+ ["pinned", "agy_acp_server", google({ cli: "antigravity", snapshot: { state: "available", authenticated: true, nativeCli: true } })],
+ ["cli", "antigravity", google({ snapshot: { state: "available", authenticated: true, version: "1.4.3" } })],
+ ["cli", "antigravity", google({ cli: "/opt/tools/antigravity", snapshot: { state: "available", authenticated: true, nativeCli: true } })],
+])("saves the path for %s when it is chosen", async (choice, path, instance) => {
+ const select = await show(instance);
+ await act(async () => {
+ select!.value = choice;
+ select!.dispatchEvent(new Event("change", { bubbles: true }));
+ });
+ expect(fixture.patches).toEqual([{ path: "/api/instances/antigravity", body: { cli: path } }]);
+});
diff --git a/src/components/EnginesSettings.hidden-providers.dom.test.ts b/src/components/EnginesSettings.hidden-providers.dom.test.ts
index d5e9678c42..fbbcff8deb 100644
--- a/src/components/EnginesSettings.hidden-providers.dom.test.ts
+++ b/src/components/EnginesSettings.hidden-providers.dom.test.ts
@@ -205,6 +205,21 @@ describe("Settings → AI: Sign out on other CLI sign-ins", () => {
expect(server.calls.some((call) => call.method === "PATCH")).toBe(false);
});
+ // The native CLI keeps each account's sign-in in its own profile (antigravity-acp.ts), so signing out ends that one alone.
+ it.each([["antigravity", true], ["agy", false]] as const)("asks the usual question before signing out an account on %s (native CLI: %s)", async (cli, native) => {
+ server.all = [codex, {
+ instanceId: "antigravity", driverKind: "antigravityAgent", displayName: "Antigravity", cli,
+ snapshot: { state: "available", authenticated: true, ...(native ? { nativeCli: true as const } : {}) }, models: { default: "gemini", options: [] },
+ authentication: { method: "callback-url", signOut: true },
+ }];
+ fixture.state = { ...fixture.state, instances: [...server.all] };
+ await render();
+ await click(rowButton("antigravity"));
+ await click([...container.querySelectorAll('[data-engine-card="antigravity"] button')].find((button) => button.textContent === "Sign out"));
+ expect(document.body.textContent).toContain("Bots that use this account need it signed in again before their next task.");
+ expect(document.body.textContent).not.toContain("keeps one sign-in");
+ });
+
it("offers no Sign out to an engine an API key signs in", async () => {
server.all = [codex, vibe({ method: "api-key" })];
fixture.state = { ...fixture.state, instances: [...server.all] };
diff --git a/src/components/EnginesSettings.test.ts b/src/components/EnginesSettings.test.ts
index e01af9051d..b856b73e98 100644
--- a/src/components/EnginesSettings.test.ts
+++ b/src/components/EnginesSettings.test.ts
@@ -163,16 +163,17 @@ describe("Settings → Engines → setup cards", () => {
expect(renderToStaticMarkup(createElement(EnginesSettings))).not.toContain(note);
});
- it("shows the actual Google account email with an honest fallback", () => {
+ it("shows the actual Google account email, and only that it is signed in with Google when the email is not known", () => {
vi.stubGlobal("window", {});
fixture.bots = [];
const instance: InstanceInfo = { instanceId: "google-work", driverKind: "antigravityAgent", displayName: "Work", cliDefault: "agy_acp_server", snapshot: { state: "available", authenticated: true, account: { email: "[email protected]" } }, models: { default: "gemini", options: [] } };
fixture.instances = [instance];
expect(renderToStaticMarkup(createElement(EnginesSettings))).toContain("[email protected]");
delete instance.snapshot.account;
- expect(renderToStaticMarkup(createElement(EnginesSettings))).toContain("account email unavailable");
+ expect(renderToStaticMarkup(createElement(EnginesSettings))).toContain("Signed in with Google");
+ expect(renderToStaticMarkup(createElement(EnginesSettings))).not.toContain("unavailable");
instance.snapshot.authenticated = false;
- expect(renderToStaticMarkup(createElement(EnginesSettings))).not.toContain("account email unavailable");
+ expect(renderToStaticMarkup(createElement(EnginesSettings))).not.toContain("Signed in with Google");
});
it("offers removal for an added Antigravity account only", () => {
diff --git a/src/components/EnginesSettings.tsx b/src/components/EnginesSettings.tsx
index 97a7c0ec06..c895c9f71d 100644
--- a/src/components/EnginesSettings.tsx
+++ b/src/components/EnginesSettings.tsx
@@ -8,7 +8,7 @@ import { cn } from "@/lib/cn";
import { useMenuMotion } from "./MenuMotion";
import { t } from "@/lib/i18n";
import type { LocaleKey } from "@/locales";
-import { ApiKeyEngineManage, EngineSetup, EngineUpdateNotice, EngineWarningNotice, isApiKeyEngine } from "./EngineSetup";
+import { ApiKeyEngineManage, EngineSetup, EngineUpdateNotice, EngineWarningNotice, isApiKeyEngine, runsAntigravityCli } from "./EngineSetup";
import { AppCopyNotice } from "./EngineAppCopy";
import { forgetAppCopySwitches } from "@/state/engine-install";
import { AccountsCard, AddAccount, accountGroupOf, accountsReady, type AccountGroup } from "./EngineAccounts";
@@ -374,6 +374,46 @@ function EngineAccountAction({ instance, action, cli = false, removeBody = "acco
</>;
}
+const ANTIGRAVITY_RUNTIME_PATHS = { cli: "antigravity", pinned: "agy_acp_server" } as const;
+type AntigravityRuntime = keyof typeof ANTIGRAVITY_RUNTIME_PATHS | "custom";
+
+/** What an Antigravity account runs, or for one with no runtime yet, what its install takes: a new install the CLI. */
+function antigravityRuntimeOf(instance: InstanceInfo): AntigravityRuntime {
+ const cli = instance.cli?.trim() ?? "";
+ if (/^antigravity(?:\.exe)?$/iu.test(cli)) return "cli";
+ if (/^agy_acp_server$/iu.test(cli)) return "pinned";
+ if (cli !== "" && cli !== "agy") return "custom";
+ if (runsAntigravityCli(instance)) return "cli";
+ return instance.snapshot.state === "available" ? "pinned" : "cli";
+}
+
+function AntigravityRuntimeChoice({ instance }: { instance: InstanceInfo }) {
+ const showInstances = useShowInstances();
+ const [saving, setSaving] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const current = antigravityRuntimeOf(instance);
+ const choose = (next: AntigravityRuntime) => {
+ if (next === "custom" || next === current || saving) return;
+ setSaving(true);
+ setError(null);
+ api(`/api/instances/${encodeURIComponent(instance.instanceId)}`, { method: "PATCH", body: JSON.stringify({ cli: ANTIGRAVITY_RUNTIME_PATHS[next] }) })
+ .then((answer) => showInstances(answer).catch(() => {}))
+ .catch((cause) => setError(cause instanceof Error ? cause.message : String(cause)))
+ .finally(() => setSaving(false));
+ };
+ return <div data-antigravity-runtime={current} className="mb-3">
+ <label className="flex items-center gap-3 text-[13px] text-ink">
+ <span className="shrink-0">{t("engines.antigravity.runtime")}</span>
+ <Select className="min-w-0 flex-1" value={current} disabled={saving} aria-busy={saving} onChange={(event) => choose(event.target.value as AntigravityRuntime)}>
+ <option value="cli">{t("engines.antigravity.runtimeCli")}</option>
+ <option value="pinned">{t("engines.antigravity.runtimePinned")}</option>
+ {current === "custom" && <option value="custom" disabled>{t("engines.antigravity.runtimeCustom")}</option>}
+ </Select>
+ </label>
+ {error && <p role="alert" className="mt-1 text-[12px] text-danger">{error}</p>}
+ </div>;
+}
+
function AntigravityAddAccount({ source }: { source: InstanceInfo }) {
const state = useStoreSelector((s) => ({ instances: s.instances }), sameFields);
const [addedId, setAddedId] = useState<string | null>(null);
@@ -401,6 +441,7 @@ function EngineRow({ instance, bare = false }: { instance: InstanceInfo; bare?:
return (
<EngineCard instance={instance} bare={bare}>
{policyNote}
+ {instance.driverKind === "antigravityAgent" && <AntigravityRuntimeChoice instance={instance} />}
{!engineReady(instance) && <EngineSetup instance={instance} intent={instance.access === "custom" ? "inject" : "cloud"} description={instance.codexEndpoint ? t("agentEndpoints.codexHint") : undefined} unframed />}
{engineReady(instance) && <ApiKeyEngineManage instance={instance} className="mt-3" />}
{engineReady(instance) && instance.serverKind === "ollama" && <OllamaModels instance={instance} className="mt-3" />}
@@ -424,7 +465,7 @@ function EngineRow({ instance, bare = false }: { instance: InstanceInfo; bare?:
{instance.freeUpSpace && <AntigravityFreeSpace instance={instance} />}
{instance.driverKind === "antigravityAgent" && (
<div className="mt-3 space-y-3">
- {instance.snapshot.authenticated && <p className="break-words text-[12px] text-ink-secondary">{instance.snapshot.account?.email ?? t("engineSetup.antigravity.emailUnavailable")}</p>}
+ {instance.snapshot.authenticated && <p className="break-words text-[12px] text-ink-secondary">{instance.snapshot.account?.email ?? t("engineSetup.antigravity.signedInGoogle")}</p>}
<AntigravityAddAccount source={instance} />
{instance.snapshot.authenticated === true && instance.authentication?.signOut === true && <EngineAccountAction instance={instance} action="signOut" />}
{instance.instanceId.startsWith("antigravity-") && <EngineAccountAction instance={instance} action="remove" />}
diff --git a/src/hooks/use-updated-once.dom.test.ts b/src/hooks/use-updated-once.dom.test.ts
index d664428aa6..8fd1bad798 100644
--- a/src/hooks/use-updated-once.dom.test.ts
+++ b/src/hooks/use-updated-once.dom.test.ts
@@ -1,5 +1,5 @@
// @vitest-environment happy-dom
-import { act, createElement } from "react";
+import { act, createElement, useState } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import { useUpdatedOnce } from "./use-updated-once";
@@ -37,3 +37,39 @@ it("names the version the app updated an engine to the first time its card shows
expect(await shownFor({ version: "2.2.5", at: 1 })).toBe("plain");
expect(await shownFor({ version: "2.3.0", at: 2 })).toBe("2.3.0");
});
+
+it("drops the version from a mounted card once the engine is on one without an update, as after a switch of runtime", async () => {
+ let setUpdated!: (value: { version: string; at: number } | undefined) => void;
+ function Card() {
+ const [autoUpdated, set] = useState<{ version: string; at: number } | undefined>({ version: "1.5.8", at: 1 });
+ setUpdated = set;
+ return createElement("span", null, useUpdatedOnce({ driverKind: "antigravityAgent", autoUpdated }) ?? "plain");
+ }
+ container = document.createElement("div");
+ document.body.append(container);
+ root = createRoot(container);
+ await act(async () => root!.render(createElement(Card)));
+ expect(container.textContent).toBe("1.5.8");
+ await act(async () => setUpdated(undefined));
+ expect(container.textContent).toBe("plain");
+});
+
+it("names each version once when one engine has two cards on two versions", async () => {
+ async function cardsFor(): Promise<string> {
+ function Cards() {
+ return createElement("span", null,
+ useUpdatedOnce({ driverKind: "antigravityAgent", autoUpdated: { version: "1.5.8", at: 1 } }) ?? "plain",
+ " ",
+ useUpdatedOnce({ driverKind: "antigravityAgent", autoUpdated: { version: "1.4.3", at: 1 } }) ?? "plain");
+ }
+ await act(async () => root?.unmount());
+ container?.remove();
+ container = document.createElement("div");
+ document.body.append(container);
+ root = createRoot(container);
+ await act(async () => root!.render(createElement(Cards)));
+ return container.textContent ?? "";
+ }
+ expect(await cardsFor()).toBe("1.5.8 1.4.3");
+ expect(await cardsFor()).toBe("plain plain");
+});
diff --git a/src/hooks/use-updated-once.ts b/src/hooks/use-updated-once.ts
index 05f18e2d41..e829981a58 100644
--- a/src/hooks/use-updated-once.ts
+++ b/src/hooks/use-updated-once.ts
@@ -18,10 +18,14 @@ export function useUpdatedOnce(instance: Pick<InstanceInfo, "driverKind" | "auto
const version = instance.autoUpdated?.version ?? null;
const [shown, setShown] = useState<string | null>(null);
useEffect(() => {
- if (version === null || seen()[instance.driverKind] === version) return;
+ const key = `${instance.driverKind}@${version}`;
+ if (version === null || seen()[key]) {
+ setShown((current) => (current === version ? current : null));
+ return;
+ }
setShown(version);
try {
- localStorage.setItem(SEEN_KEY, JSON.stringify({ ...seen(), [instance.driverKind]: version }));
+ localStorage.setItem(SEEN_KEY, JSON.stringify({ ...seen(), [key]: version }));
} catch {}
}, [instance.driverKind, version]);
return shown;
diff --git a/src/locales/de.json b/src/locales/de.json
index 0e815eb6e6..ce3ae04f26 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -1385,6 +1385,17 @@
"engineSetup.terminalSignIn": "Schließ die Kontoanmeldung im Terminal ab. Öffne dieses Menü danach erneut, dann prüfen wir noch einmal.",
"engineSetup.injectDesc": "Installiere den Agenten einmal, dann kannst du ihn mit lokalen Modellen betreiben — ohne Cloud-Anmeldung.",
"engineSetup.managedDesc": "{app} installiert seine eigene geprüfte Antigravity-Laufzeit. Sie ist unabhängig von der Antigravity-App und der agy-CLI; installiere sie hier, melde dich mit Google an, und diese Modellliste aktualisiert sich aus deinem Konto.",
+ "engineSetup.pasteCodeHint": "Melde dich auf der Seite an, die Google öffnet. Füge dann hier den angezeigten Code oder die vollständige Adresse der Seite ein, auf der du landest.",
+ "engineSetup.pasteCodeLabel": "Anmeldecode oder Seitenadresse",
+ "engineSetup.pasteCodePlaceholder": "Code oder https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Code senden",
+ "engines.antigravity.runtime": "Läuft mit",
+ "engines.antigravity.runtimeCustom": "Eigener Pfad",
+ "engineSetup.managedDescCli": "{app} installiert Googles Antigravity CLI. Installiere sie hier und melde dich mit Google an; danach wird diese Modellliste aus deinem Konto aktualisiert.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Google Antigravity CLI installieren",
+ "engineSetup.installClassicRuntime": "Classic runtime installieren",
"engineSetup.installDesc": "Installiere die Kommandozeilen-App einmal. Die Modelle erscheinen hier, sobald sie bereit ist.",
"engineSetup.installDescSignIn": "Installiere die Kommandozeilen-App einmal. Die Modelle erscheinen hier, sobald sie bereit ist; eine Anmeldung kann folgen.",
"engineSetup.notReady": "{name} ist nicht bereit",
diff --git a/src/locales/en.json b/src/locales/en.json
index 79e7df989a..e9211b2d7d 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -3723,8 +3723,9 @@
"engineSetup.otherComputerUrl": "Page address from the other computer",
"engineSetup.sending": "Sending…",
"engineSetup.sendRedirect": "Send redirect",
- "engineSetup.pasteCodeHint": "After you sign in, Google shows a code on the Antigravity page. Copy it and paste it here.",
- "engineSetup.pasteCodeLabel": "Code from the Antigravity page",
+ "engineSetup.pasteCodeHint": "Sign in on the page Google opens. Then paste the code it shows, or the full address of the page you end on, here.",
+ "engineSetup.pasteCodeLabel": "Sign-in code or page address",
+ "engineSetup.pasteCodePlaceholder": "Code, or https://antigravity.google/oauth-callback?…",
"engineSetup.sendCode": "Send code",
"engineSetup.googleNoLink": "Google sign-in did not return a link.",
"engineSetup.googleExpired": "Google sign-in expired. Start again.",
@@ -3732,8 +3733,15 @@
"engineSetup.signInTitle": "Sign in to {name}",
"engineSetup.installTitle": "Install {name}",
"engineSetup.managedSignIn": "Each Antigravity setup has its own Google account. Your browser completes the secure sign-in.",
+ "engines.antigravity.runtime": "Runs on",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engines.antigravity.runtimeCustom": "Custom path",
"engineSetup.terminalSignIn": "Finish the account sign-in in Terminal. Reopen this menu afterward and we’ll check again.",
"engineSetup.injectDesc": "Install the agent once, then you can run it with local models. No cloud sign-in required.",
+ "engineSetup.installAntigravityCli": "Install Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "Install Classic runtime",
+ "engineSetup.managedDescCli": "{app} installs Google's Antigravity CLI. Install it here and sign in with Google; this model list will then refresh from your account.",
"engineSetup.managedDesc": "{app} installs its own verified Antigravity runtime. It is separate from the Antigravity app and agy CLI; install it here, sign in with Google, and this model list will refresh from your account.",
"engineSetup.installDesc": "Install the command-line app once. Models will appear here as soon as it’s ready.",
"engineSetup.installDescSignIn": "Install the command-line app once. Models will appear here as soon as it’s ready; sign-in may follow.",
@@ -6241,7 +6249,7 @@
"engineSetup.chatgpt.description": "Use your ChatGPT plan for eligible AI requests in {app}. This is separate from MausBot Cloud and from paying with an API key.",
"engineSetup.chatgpt.start": "Continue with ChatGPT",
"engineSetup.antigravity.addAccount": "Add Google account",
- "engineSetup.antigravity.emailUnavailable": "Signed in with Google · account email unavailable",
+ "engineSetup.antigravity.signedInGoogle": "Signed in with Google",
"engineSetup.chatgpt.modelsAfterSignIn": "Available models appear after you connect your ChatGPT plan.",
"engineSetup.chatgpt.starting": "Opening ChatGPT sign-in…",
"engineSetup.chatgpt.security": "Sign in on OpenAI's page and choose whether to share plan usage. Your password stays with OpenAI; credentials stay on this computer.",
diff --git a/src/locales/es.json b/src/locales/es.json
index 45189c10bd..db017a958d 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -2593,6 +2593,17 @@
"engineSetup.terminalSignIn": "Termina el acceso a la cuenta en la Terminal. Vuelve a abrir este menú después y lo comprobamos otra vez.",
"engineSetup.injectDesc": "Instala el agente una vez y podrás usarlo con modelos locales, sin acceso en la nube.",
"engineSetup.managedDesc": "{app} instala su propio entorno de ejecución de Antigravity verificado. Es independiente de la app Antigravity y de la CLI agy; instálalo aquí, inicia sesión con Google y esta lista de modelos se actualizará desde tu cuenta.",
+ "engineSetup.pasteCodeHint": "Inicia sesión en la página que abre Google. Después pega aquí el código que muestra o la dirección completa de la página en la que terminas.",
+ "engineSetup.pasteCodeLabel": "Código de inicio de sesión o dirección de la página",
+ "engineSetup.pasteCodePlaceholder": "Código, o https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Enviar código",
+ "engines.antigravity.runtime": "Se ejecuta en",
+ "engines.antigravity.runtimeCustom": "Ruta personalizada",
+ "engineSetup.managedDescCli": "{app} instala la Antigravity CLI de Google. Instálala aquí e inicia sesión con Google; después esta lista de modelos se actualizará desde tu cuenta.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Instalar Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "Instalar Classic runtime",
"engineSetup.installDesc": "Instala la app de línea de comandos una vez. Los modelos aparecerán aquí en cuanto esté lista.",
"engineSetup.installDescSignIn": "Instala la app de línea de comandos una vez. Los modelos aparecerán aquí en cuanto esté lista; después puede pedirte iniciar sesión.",
"engineSetup.notReady": "{name} no está listo",
@@ -4444,7 +4455,7 @@
"engineSetup.device.description": "Conecta tu cuenta de ChatGPT a Codex. Completa el inicio de sesión en tu propio navegador; sin terminal y sin compartir contraseñas.",
"engineSetup.chatgpt.start": "Continuar con ChatGPT",
"engineSetup.antigravity.addAccount": "Añadir cuenta de Google",
- "engineSetup.antigravity.emailUnavailable": "Sesión iniciada con Google · email de la cuenta no disponible",
+ "engineSetup.antigravity.signedInGoogle": "Sesión iniciada con Google",
"engineSetup.chatgpt.modelsAfterSignIn": "Los modelos disponibles aparecen después de conectar tu plan de ChatGPT.",
"engineSetup.chatgpt.starting": "Abriendo el inicio de sesión de ChatGPT…",
"engineSetup.chatgpt.security": "Inicia sesión en la página de OpenAI y elige si quieres compartir el uso del plan. Tu contraseña se queda en OpenAI; las credenciales se quedan en este equipo.",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index aab8d608e5..c97ae7382d 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -1265,6 +1265,17 @@
"engineSetup.terminalSignIn": "Terminez la connexion au compte dans le Terminal. Rouvrez ensuite ce menu et nous vérifierons à nouveau.",
"engineSetup.injectDesc": "Installez l'agent une fois, puis utilisez-le avec des modèles locaux — sans connexion au cloud.",
"engineSetup.managedDesc": "{app} installe son propre runtime Antigravity vérifié. Il est distinct de l'application Antigravity et de la CLI agy ; installez-le ici, connectez-vous avec Google, et cette liste de modèles se mettra à jour depuis votre compte.",
+ "engineSetup.pasteCodeHint": "Connectez-vous sur la page ouverte par Google. Collez ensuite ici le code affiché, ou l'adresse complète de la page sur laquelle vous arrivez.",
+ "engineSetup.pasteCodeLabel": "Code de connexion ou adresse de la page",
+ "engineSetup.pasteCodePlaceholder": "Code, ou https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Envoyer le code",
+ "engines.antigravity.runtime": "S'exécute sur",
+ "engines.antigravity.runtimeCustom": "Chemin personnalisé",
+ "engineSetup.managedDescCli": "{app} installe l'Antigravity CLI de Google. Installez-la ici et connectez-vous avec Google ; cette liste de modèles sera ensuite actualisée depuis votre compte.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Installer Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "Installer Classic runtime",
"engineSetup.installDesc": "Installez l'application en ligne de commande une fois. Les modèles apparaîtront ici dès qu'elle sera prête.",
"engineSetup.installDescSignIn": "Installez l'application en ligne de commande une fois. Les modèles apparaîtront ici dès qu'elle sera prête ; une connexion peut suivre.",
"engineSetup.notReady": "{name} n'est pas prêt",
diff --git a/src/locales/hi.json b/src/locales/hi.json
index b63f5c071e..d62e11c6c1 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -1263,6 +1263,17 @@
"engineSetup.terminalSignIn": "खाते का साइन-इन टर्मिनल में पूरा करें। फिर यह मेन्यू दोबारा खोलें, हम फिर से जाँच लेंगे।",
"engineSetup.injectDesc": "एजेंट एक बार इंस्टॉल करें, फिर लोकल मॉडल के साथ चलाएँ — क्लाउड साइन-इन की ज़रूरत नहीं।",
"engineSetup.managedDesc": "{app} अपना सत्यापित Antigravity रनटाइम इंस्टॉल करता है। यह Antigravity ऐप और agy CLI से अलग है; इसे यहाँ इंस्टॉल करें, Google से साइन इन करें, और यह मॉडल सूची आपके खाते से ताज़ा हो जाएगी।",
+ "engineSetup.pasteCodeHint": "Google जो पेज खोले उस पर साइन इन करें। फिर उसमें दिखा कोड, या जिस पेज पर आप पहुँचें उसका पूरा पता, यहाँ पेस्ट करें।",
+ "engineSetup.pasteCodeLabel": "साइन-इन कोड या पेज का पता",
+ "engineSetup.pasteCodePlaceholder": "कोड, या https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "कोड भेजें",
+ "engines.antigravity.runtime": "इस पर चलता है",
+ "engines.antigravity.runtimeCustom": "कस्टम पाथ",
+ "engineSetup.managedDescCli": "{app} Google का Antigravity CLI इंस्टॉल करता है। इसे यहाँ इंस्टॉल करें और Google से साइन इन करें; इसके बाद यह मॉडल सूची आपके अकाउंट से रीफ़्रेश होगी।",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Google Antigravity CLI इंस्टॉल करें",
+ "engineSetup.installClassicRuntime": "Classic runtime इंस्टॉल करें",
"engineSetup.installDesc": "कमांड-लाइन ऐप एक बार इंस्टॉल करें। तैयार होते ही मॉडल यहाँ दिखने लगेंगे।",
"engineSetup.installDescSignIn": "कमांड-लाइन ऐप एक बार इंस्टॉल करें। तैयार होते ही मॉडल यहाँ दिखेंगे; उसके बाद साइन-इन माँगा जा सकता है।",
"engineSetup.notReady": "{name} तैयार नहीं है",
diff --git a/src/locales/it.json b/src/locales/it.json
index 95bf9b2b78..8e301488ae 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -3713,6 +3713,17 @@
"engineSetup.terminalSignIn": "Completa l'accesso all'account nel Terminale. Riapri questo menu dopo e ricontrolliamo.",
"engineSetup.injectDesc": "Installa l'agente una volta, poi puoi eseguirlo con modelli locali, senza accesso al cloud.",
"engineSetup.managedDesc": "{app} installa un proprio runtime Antigravity verificato. È separato dall'app Antigravity e dalla CLI agy; installalo qui, accedi con Google e questo elenco di modelli si aggiorna dal tuo account.",
+ "engineSetup.pasteCodeHint": "Accedi nella pagina che apre Google. Poi incolla qui il codice che mostra, o l'indirizzo completo della pagina su cui arrivi.",
+ "engineSetup.pasteCodeLabel": "Codice di accesso o indirizzo della pagina",
+ "engineSetup.pasteCodePlaceholder": "Codice, oppure https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Invia codice",
+ "engines.antigravity.runtime": "Funziona con",
+ "engines.antigravity.runtimeCustom": "Percorso personalizzato",
+ "engineSetup.managedDescCli": "{app} installa la Antigravity CLI di Google. Installala qui e accedi con Google; poi questo elenco di modelli si aggiornerà dal tuo account.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Installa Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "Installa Classic runtime",
"engineSetup.installDesc": "Installa una volta l'app da riga di comando. I modelli compaiono qui appena è pronta.",
"engineSetup.installDescSignIn": "Installa una volta l'app da riga di comando. I modelli compaiono qui appena è pronta; l'accesso può seguire.",
"engineSetup.notReady": "{name} non è pronto",
@@ -6204,7 +6215,7 @@
"engineSetup.chatgpt.description": "Usa il tuo piano ChatGPT per le richieste IA idonee in {app}. È separato da MausBot Cloud e dal pagamento con una chiave API.",
"engineSetup.chatgpt.start": "Continua con ChatGPT",
"engineSetup.antigravity.addAccount": "Aggiungi account Google",
- "engineSetup.antigravity.emailUnavailable": "Accesso effettuato con Google · email dell'account non disponibile",
+ "engineSetup.antigravity.signedInGoogle": "Accesso effettuato con Google",
"engineSetup.chatgpt.modelsAfterSignIn": "I modelli disponibili compaiono dopo che colleghi il piano ChatGPT.",
"engineSetup.chatgpt.starting": "Apertura dell'accesso a ChatGPT…",
"engineSetup.chatgpt.security": "Accedi sulla pagina di OpenAI e scegli se condividere l'uso del piano. La password resta su OpenAI; le credenziali restano su questo computer.",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index c5921751b5..1fc760a83f 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -3144,6 +3144,17 @@
"engineSetup.terminalSignIn": "アカウントのサインインはターミナルで完了してください。その後このメニューを開き直せば、もう一度確認します。",
"engineSetup.injectDesc": "エージェントを一度インストールすれば、ローカルモデルで動かせます。クラウドのサインインは不要です。",
"engineSetup.managedDesc": "{app} は検証済みの独自 Antigravity ランタイムをインストールします。Antigravity アプリや agy CLI とは別物です。ここでインストールして Google でサインインすると、このモデル一覧があなたのアカウントから更新されます。",
+ "engineSetup.pasteCodeHint": "Google が開くページでサインインしてください。表示されたコード、または最後に開いたページのアドレス全体をここに貼り付けます。",
+ "engineSetup.pasteCodeLabel": "サインインコードまたはページのアドレス",
+ "engineSetup.pasteCodePlaceholder": "コード、または https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "コードを送信",
+ "engines.antigravity.runtime": "実行環境",
+ "engines.antigravity.runtimeCustom": "カスタムパス",
+ "engineSetup.managedDescCli": "{app} は Google の Antigravity CLI をインストールします。ここでインストールして Google でサインインすると、このモデル一覧があなたのアカウントから更新されます。",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Google Antigravity CLI をインストール",
+ "engineSetup.installClassicRuntime": "Classic runtime をインストール",
"engineSetup.installDesc": "コマンドラインアプリを一度インストールしてください。準備ができ次第、ここにモデルが表示されます。",
"engineSetup.installDescSignIn": "コマンドラインアプリを一度インストールしてください。準備ができ次第ここにモデルが表示されます。その後サインインが必要な場合があります。",
"engineSetup.notReady": "{name} は準備できていません",
@@ -5421,7 +5432,7 @@
"engineSetup.chatgpt.description": "{app} の対象となる AI リクエストに、ご自身の ChatGPT のプランを使います。MausBot Cloud とも、API キーでの支払いとも別です。",
"engineSetup.chatgpt.start": "ChatGPT で続ける",
"engineSetup.antigravity.addAccount": "Google アカウントを追加",
- "engineSetup.antigravity.emailUnavailable": "Google でサインイン済み · アカウントのメールアドレスを取得できません",
+ "engineSetup.antigravity.signedInGoogle": "Google でサインイン済み",
"engineSetup.chatgpt.modelsAfterSignIn": "ChatGPT プランを接続すると、利用可能なモデルが表示されます。",
"engineSetup.chatgpt.starting": "ChatGPT サインインを開いています…",
"engineSetup.chatgpt.security": "OpenAI のページでサインインし、プランの利用状況を共有するか選んでください。パスワードは OpenAI に留まり、認証情報はこのコンピューターに保存されます。",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 1a94c5fe9e..2ae4934feb 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -3008,6 +3008,17 @@
"engineSetup.terminalSignIn": "터미널에서 계정 로그인을 마치세요. 그다음 이 메뉴를 다시 열면 다시 확인할게요.",
"engineSetup.injectDesc": "에이전트를 한 번만 설치하면 로컬 모델로 실행할 수 있어요. 클라우드 로그인은 필요 없어요.",
"engineSetup.managedDesc": "{app}은 확인을 거친 자체 Antigravity 런타임을 설치해요. Antigravity 앱이나 agy CLI와는 별개예요. 여기서 설치하고 Google로 로그인하면 이 모델 목록이 내 계정 기준으로 새로고침돼요.",
+ "engineSetup.pasteCodeHint": "Google이 여는 페이지에서 로그인하세요. 그런 다음 표시된 코드나 마지막으로 도착한 페이지의 전체 주소를 여기에 붙여 넣으세요.",
+ "engineSetup.pasteCodeLabel": "로그인 코드 또는 페이지 주소",
+ "engineSetup.pasteCodePlaceholder": "코드 또는 https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "코드 보내기",
+ "engines.antigravity.runtime": "실행 방식",
+ "engines.antigravity.runtimeCustom": "사용자 지정 경로",
+ "engineSetup.managedDescCli": "{app}은 Google의 Antigravity CLI를 설치해요. 여기서 설치하고 Google로 로그인하면 이 모델 목록이 내 계정 기준으로 새로고침돼요.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Google Antigravity CLI 설치",
+ "engineSetup.installClassicRuntime": "Classic runtime 설치",
"engineSetup.installDesc": "명령줄 앱을 한 번만 설치하세요. 준비되면 바로 여기에 모델이 나타나요.",
"engineSetup.installDescSignIn": "명령줄 앱을 한 번만 설치하세요. 준비되면 바로 여기에 모델이 나타나고, 이어서 로그인이 필요할 수 있어요.",
"engineSetup.notReady": "{name}이(가) 준비되지 않았어요",
@@ -5205,7 +5216,7 @@
"engineSetup.chatgpt.description": "{app}의 해당 AI 요청에 ChatGPT 요금제를 써요. MausBot Cloud나 API 결제와는 별개예요.",
"engineSetup.chatgpt.start": "ChatGPT로 계속",
"engineSetup.antigravity.addAccount": "Google 계정 추가",
- "engineSetup.antigravity.emailUnavailable": "Google로 로그인됨 · 계정 이메일을 알 수 없음",
+ "engineSetup.antigravity.signedInGoogle": "Google로 로그인됨",
"engineSetup.chatgpt.modelsAfterSignIn": "ChatGPT 요금제를 연결하면 사용 가능한 모델이 나타나요.",
"engineSetup.chatgpt.starting": "ChatGPT 로그인 여는 중…",
"engineSetup.chatgpt.security": "OpenAI 페이지에서 로그인하고 요금제 사용량을 공유할지 고르세요. 비밀번호는 OpenAI에만 남고, 자격 증명은 이 컴퓨터에 남아요.",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index ea40e910c4..f0f2dd87bf 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -2780,6 +2780,17 @@
"engineSetup.terminalSignIn": "Dokończ logowanie do konta w terminalu. Otwórz ponownie to menu, a sprawdzimy jeszcze raz.",
"engineSetup.injectDesc": "Zainstaluj agenta raz, a potem możesz uruchamiać go z modelami lokalnymi—logowanie do chmury nie jest wymagane.",
"engineSetup.managedDesc": "{app} instaluje własne zweryfikowane środowisko uruchomieniowe Antigravity. Jest ono oddzielne od aplikacji Antigravity i CLI agy; zainstaluj je tutaj, zaloguj się przez Google, a ta lista modeli odświeży się z twojego konta.",
+ "engineSetup.pasteCodeHint": "Zaloguj się na stronie, którą otworzy Google. Potem wklej tutaj pokazany kod albo pełny adres strony, na której skończysz.",
+ "engineSetup.pasteCodeLabel": "Kod logowania lub adres strony",
+ "engineSetup.pasteCodePlaceholder": "Kod albo https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Wyślij kod",
+ "engines.antigravity.runtime": "Działa na",
+ "engines.antigravity.runtimeCustom": "Własna ścieżka",
+ "engineSetup.managedDescCli": "{app} instaluje Antigravity CLI od Google. Zainstaluj ją tutaj i zaloguj się przez Google; potem ta lista modeli odświeży się z Twojego konta.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Zainstaluj Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "Zainstaluj Classic runtime",
"engineSetup.installDesc": "Zainstaluj aplikację wiersza poleceń raz. Modele pojawią się tutaj, gdy tylko będzie gotowa.",
"engineSetup.installDescSignIn": "Zainstaluj aplikację wiersza poleceń raz. Modele pojawią się tutaj, gdy tylko będzie gotowa; może być wymagane logowanie.",
"engineSetup.notReady": "{name} nie jest gotowy",
@@ -4791,7 +4802,7 @@
"engineSetup.device.description": "Połącz swoje konto ChatGPT z Codex. Dokończ logowanie we własnej przeglądarce; nie potrzebujesz terminala ani udostępniania hasła.",
"engineSetup.chatgpt.start": "Kontynuuj przez ChatGPT",
"engineSetup.antigravity.addAccount": "Dodaj konto Google",
- "engineSetup.antigravity.emailUnavailable": "Zalogowano przez Google · e-mail konta niedostępny",
+ "engineSetup.antigravity.signedInGoogle": "Zalogowano przez Google",
"engineSetup.chatgpt.modelsAfterSignIn": "Dostępne modele pojawią się po połączeniu planu ChatGPT.",
"engineSetup.chatgpt.starting": "Otwieranie logowania ChatGPT…",
"engineSetup.chatgpt.security": "Zaloguj się na stronie OpenAI i wybierz, czy udostępniać wykorzystanie planu. Twoje hasło pozostaje w OpenAI; dane logowania pozostają na tym komputerze.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index be0d3a051d..d0bb7ce127 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -3532,9 +3532,6 @@
"engineSetup.otherComputerUrl": "Endereço da página no outro computador",
"engineSetup.sending": "Enviando…",
"engineSetup.sendRedirect": "Enviar link",
- "engineSetup.pasteCodeHint": "Depois que você entrar, o Google mostra um código na página do Antigravity. Copie e cole aqui.",
- "engineSetup.pasteCodeLabel": "Código da página do Antigravity",
- "engineSetup.sendCode": "Enviar código",
"engineSetup.googleNoLink": "O login do Google não devolveu um link.",
"engineSetup.googleExpired": "O login com o Google expirou. Comece de novo.",
"engineSetup.googleFailed": "O login com o Google não foi concluído. Comece de novo.",
@@ -3544,6 +3541,17 @@
"engineSetup.terminalSignIn": "Conclua o login da conta no Terminal. Depois reabra este menu e vamos verificar novamente.",
"engineSetup.injectDesc": "Instale o agente uma vez para usá-lo com modelos locais. Não é preciso fazer login na nuvem.",
"engineSetup.managedDesc": "O app {app} instala seu próprio ambiente de execução verificado do Antigravity, separado do app Antigravity e da CLI agy. Instale aqui, entre com o Google, e esta lista de modelos será atualizada com os da sua conta.",
+ "engineSetup.pasteCodeHint": "Entre na página que o Google abrir. Depois cole aqui o código exibido ou o endereço completo da página em que você chegar.",
+ "engineSetup.pasteCodeLabel": "Código de login ou endereço da página",
+ "engineSetup.pasteCodePlaceholder": "Código, ou https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Enviar código",
+ "engines.antigravity.runtime": "Executa em",
+ "engines.antigravity.runtimeCustom": "Caminho personalizado",
+ "engineSetup.managedDescCli": "O app {app} instala a Antigravity CLI do Google. Instale aqui e entre com o Google; depois esta lista de modelos será atualizada a partir da sua conta.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Instalar Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "Instalar Classic runtime",
"engineSetup.installDesc": "Instale o app de linha de comando uma vez. Os modelos aparecem aqui assim que estiver pronto.",
"engineSetup.installDescSignIn": "Instale o app de linha de comando uma vez. Os modelos aparecem aqui assim que estiver pronto; pode ser preciso fazer login depois.",
"engineSetup.notReady": "{name} ainda não está disponível",
@@ -5903,7 +5911,7 @@
"engineSetup.chatgpt.description": "Use seu plano do ChatGPT nos pedidos de IA que ele cobre no app {app}. Isso é separado do MausBot Cloud e do pagamento com chave de API.",
"engineSetup.chatgpt.start": "Continuar com o ChatGPT",
"engineSetup.antigravity.addAccount": "Adicionar conta Google",
- "engineSetup.antigravity.emailUnavailable": "Login feito com o Google · e-mail da conta indisponível",
+ "engineSetup.antigravity.signedInGoogle": "Login feito com o Google",
"engineSetup.chatgpt.modelsAfterSignIn": "Os modelos disponíveis aparecem depois que você conectar seu plano do ChatGPT.",
"engineSetup.chatgpt.starting": "Abrindo o login do ChatGPT…",
"engineSetup.chatgpt.security": "Faça login na página da OpenAI e escolha se quer compartilhar o uso do plano. Sua senha fica com a OpenAI; as credenciais ficam neste computador.",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 5d9964c1b5..4a11a3e38d 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -2806,6 +2806,17 @@
"engineSetup.terminalSignIn": "Завершите вход в аккаунт в Терминале. После этого снова откройте это меню, и мы проверим ещё раз.",
"engineSetup.injectDesc": "Установите агента один раз, и вы сможете запускать его с локальными моделями — вход в облако не требуется.",
"engineSetup.managedDesc": "{app} устанавливает собственную проверенную среду выполнения Antigravity. Она отдельна от приложения Antigravity и CLI agy: установите её здесь, войдите через Google, и этот список моделей обновится из вашего аккаунта.",
+ "engineSetup.pasteCodeHint": "Войдите на странице, которую откроет Google. Затем вставьте сюда показанный код или полный адрес страницы, на которой окажетесь.",
+ "engineSetup.pasteCodeLabel": "Код входа или адрес страницы",
+ "engineSetup.pasteCodePlaceholder": "Код или https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Отправить код",
+ "engines.antigravity.runtime": "Работает на",
+ "engines.antigravity.runtimeCustom": "Свой путь",
+ "engineSetup.managedDescCli": "{app} устанавливает Antigravity CLI от Google. Установите её здесь и войдите через Google; после этого список моделей обновится из вашего аккаунта.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Установить Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "Установить Classic runtime",
"engineSetup.installDesc": "Установите приложение командной строки один раз. Модели появятся здесь, как только всё будет готово.",
"engineSetup.installDescSignIn": "Установите приложение командной строки один раз. Модели появятся здесь, как только всё будет готово; позже может потребоваться вход.",
"engineSetup.notReady": "{name} пока не готов",
@@ -4840,7 +4851,7 @@
"engineSetup.device.description": "Подключите учётную запись ChatGPT к Codex. Завершите вход в своём браузере — без терминала и без передачи пароля.",
"engineSetup.chatgpt.start": "Продолжить с ChatGPT",
"engineSetup.antigravity.addAccount": "Добавить учётную запись Google",
- "engineSetup.antigravity.emailUnavailable": "Выполнен вход через Google · адрес почты учётной записи недоступен",
+ "engineSetup.antigravity.signedInGoogle": "Выполнен вход через Google",
"engineSetup.chatgpt.modelsAfterSignIn": "Доступные модели появятся, когда вы подключите план ChatGPT.",
"engineSetup.chatgpt.starting": "Открытие входа в ChatGPT…",
"engineSetup.chatgpt.security": "Войдите на странице OpenAI и выберите, передавать ли данные об использовании плана. Ваш пароль остаётся у OpenAI; учётные данные остаются на этом компьютере.",
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index 5d0e8e2410..a84a5d2629 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -4298,7 +4298,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"es": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -8076,7 +8087,7 @@
"engineSetup.device.description": "0f1ec8f0f576411af1f3551da5351f12ced556e9d887198322dff3719c7b7c7f",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -10869,7 +10880,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"fr": {
"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",
@@ -14845,7 +14867,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"hi": {
"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",
@@ -18673,7 +18706,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"ja": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -22873,7 +22917,7 @@
"engineSetup.device.description": "0f1ec8f0f576411af1f3551da5351f12ced556e9d887198322dff3719c7b7c7f",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -26778,7 +26822,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"pt-br": {
"voice.gemini.keyPlaceholder": "8c87ba2043a4a89d63c90cae8a6dafd5cbd193652e923b97988e381a74773e10",
@@ -32040,7 +32095,7 @@
"engineSetup.chatgpt.description": "c0418a6a8f7510d757e69538a2bd5e7ea186f2d219c309fddeb8aef1714977ad",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -38291,8 +38346,8 @@
"model.unreadable.signedOut": "fbb9251c3437926ddce45580e946b751ae1aa8d9e5b689a39b6a51958c06e2d1",
"model.unreadable.timedOut": "d15b91980ff8a0db2fb194f82b235e8c1cfca944320281b324e76632eb989898",
"composer.command.forkDesc": "b28ef25f51301b4a0d3be34257dae82b4333c30e3d2987bbce9e1d9ddd900560",
- "engineSetup.pasteCodeHint": "7634502e0f9ef36f2ed9c2239d19fe3fda58c5047d9fe3202cd4287373e7e158",
- "engineSetup.pasteCodeLabel": "f51d2cb7684936d8c09909409ef20cbd6ac6c7f32b026f6031c5af24ff336c40",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
"engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
"keys.vps.servers.nameOf": "c720c7251ac750989a931757925cdaeb024baae907e6539b71e63cc159502bd2",
"keys.vps.serverMemoryAria": "4114da0543e32816c38f314fc670e9b765fe1dc35da661e7ff70eb89c8238b28",
@@ -38516,7 +38571,15 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"zh": {
"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",
@@ -44358,7 +44421,7 @@
"engineSetup.chatgpt.description": "c0418a6a8f7510d757e69538a2bd5e7ea186f2d219c309fddeb8aef1714977ad",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -48810,7 +48873,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"zh-tw": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -55425,7 +55499,7 @@
"mcp.check.testingOff": "043962f647cca5a427d72b2b1f266241427ec81c67f634e2a186f947c75c55cb",
"engineSetup.chatgpt.description": "c0418a6a8f7510d757e69538a2bd5e7ea186f2d219c309fddeb8aef1714977ad",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.kimi.description": "7a77ed978cdaf385c6572d76026e917548563602c4ecdc670172fdd99cba0de7",
"engineSetup.kimi.start": "35d73c34b8181be1d1a50752954a226c55650e394c79962e1de46c8ffed75a16",
"engineSetup.kimi.enterCode": "3d6fb060321fcf6b59e7640e529a5a1f25ce7c0d374cde24cef3713919e4753c",
@@ -59191,7 +59265,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"uk": {
"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",
@@ -63439,7 +63524,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"vi": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -66752,7 +66848,7 @@
"engineSetup.device.description": "0f1ec8f0f576411af1f3551da5351f12ced556e9d887198322dff3719c7b7c7f",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -69505,7 +69601,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"tr": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -72818,7 +72925,7 @@
"engineSetup.device.description": "0f1ec8f0f576411af1f3551da5351f12ced556e9d887198322dff3719c7b7c7f",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -75571,7 +75678,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"pl": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -79722,7 +79840,7 @@
"engineSetup.device.description": "0f1ec8f0f576411af1f3551da5351f12ced556e9d887198322dff3719c7b7c7f",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -82838,7 +82956,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"ru": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -87074,7 +87203,7 @@
"engineSetup.device.description": "0f1ec8f0f576411af1f3551da5351f12ced556e9d887198322dff3719c7b7c7f",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -90159,7 +90288,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"it": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -94247,7 +94387,7 @@
"engineSetup.device.description": "0f1ec8f0f576411af1f3551da5351f12ced556e9d887198322dff3719c7b7c7f",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -101618,7 +101758,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
},
"ko": {
"connectedWorkspaces.localTitle": "7d6deafeab011d734c3fdd1bfd6f69544fbb746a004019269bdb48544b01164b",
@@ -106428,7 +106579,7 @@
"engineSetup.chatgpt.description": "c0418a6a8f7510d757e69538a2bd5e7ea186f2d219c309fddeb8aef1714977ad",
"engineSetup.chatgpt.start": "54f19947592ebdfd957c358b818ce658d44d16028f2be9df1f5c89350303317d",
"engineSetup.antigravity.addAccount": "04b3960a1e07708b38dcc75eacb7df836775ba59fb55460724f24106a765b718",
- "engineSetup.antigravity.emailUnavailable": "3dd8e5c7dc55b92b0b2cf37d0910e8ba9187068e0335bc42480316341b9a87e5",
+ "engineSetup.antigravity.signedInGoogle": "e324eb192b9398739f08df2ebcf3db000d357adb3274af21522e578d423c10f7",
"engineSetup.chatgpt.modelsAfterSignIn": "4e35cb16f8843c9d6b7b6a2c51358d66d951a2e3226d5752484819f3a75ddd5c",
"engineSetup.chatgpt.starting": "abcd017e8469010c15f5a329f77df9b6e54647153f139f0ae41b3229767ecf3a",
"engineSetup.chatgpt.security": "dea64e2b90bf49bb88dba76b4ea1289a3d657b71dae3ff98abc5be443d68bddb",
@@ -109413,7 +109564,18 @@
"skillBurger.run.pathUndone": "2a2c3d46532dea203b843ff140a412c5a0942d79f6748ea28d9fc5a911c744cd",
"skillBurger.run.addPathFailed": "969dd8cc30abc64e096bd0bf22d36198b8b082d004e31ceb4ece3261d05bf747",
"activity.tool.team.runWorkflow": "89bbf828d17d4d85dc2811f06cd02c3e2619ee3119475991e95b508c28c815a8",
- "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7"
+ "activity.tool.team.workflowEdit": "f4db6d696f437b450c9dcfb1e4b9976ae3774af77166d9df39f63835dac4c1e7",
+ "engineSetup.pasteCodeHint": "83f1e5bc77baae3abf68ea4b844d4366ea03379fecba577435d84bc52dfca3db",
+ "engineSetup.pasteCodeLabel": "0f71ef4e2a5cae79f74de3fc8cb861161071c413ce0097b80ea12007aae5d129",
+ "engineSetup.pasteCodePlaceholder": "a07fbe5c71f175bb11f44a362ffb5f54e73e91d7168c4c271a95378ef8326bd6",
+ "engineSetup.sendCode": "66a5b4090d14cb4117ddd4fbfd989aef36df60112701665b06c65629e6606cfa",
+ "engines.antigravity.runtime": "88a550e0f44eff785ac7511e720ec4841b7561c3773cc16d604c499c3f4df36b",
+ "engines.antigravity.runtimeCli": "3e468530626d318270d30483b8e1b7ecdd9624297e10a6415207db8274d5b669",
+ "engines.antigravity.runtimePinned": "340e98cda066b75e83fd70ea79960695b678d145fe1f604d95ebe5a77a2a9594",
+ "engines.antigravity.runtimeCustom": "260f308a01fb58a69bc468f0206fee15d68b41581aeb4f73013195badd4030c6",
+ "engineSetup.managedDescCli": "26db0ff7d1026bb0e1ad5b6040f337da7e45ea678ac7e52af5a883ecb5ab36ee",
+ "engineSetup.installAntigravityCli": "e6af9add2c7616ad233b60b352ad21d81ab05b79f810b12dffe283214dae7e3f",
+ "engineSetup.installClassicRuntime": "b88c07c8fbde9cc716764e5bab502cd94d2e16d727f86776e8039f6c9ff2b285"
}
}
}
diff --git a/src/locales/tr.json b/src/locales/tr.json
index 36f5a3db2d..777db051e1 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -2259,6 +2259,17 @@
"engineSetup.terminalSignIn": "Hesap girişini Terminal'de tamamlayın. Ardından bu menüyü tekrar açtığınızda kontrol edeceğiz.",
"engineSetup.injectDesc": "Ajanı bir kez kurun, ardından yerel modellerle çalıştırabilirsiniz; bulut girişi gerekmez.",
"engineSetup.managedDesc": "{app} kendi doğrulanmış Antigravity çalışma zamanını kurar. Antigravity uygulaması ve agy CLI'dan ayrıdır; buradan kurun, Google ile giriş yapın, bu model listesi hesabınızdan yenilenecektir.",
+ "engineSetup.pasteCodeHint": "Google'ın açtığı sayfada giriş yapın. Ardından gösterilen kodu veya vardığınız sayfanın tam adresini buraya yapıştırın.",
+ "engineSetup.pasteCodeLabel": "Giriş kodu veya sayfa adresi",
+ "engineSetup.pasteCodePlaceholder": "Kod veya https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Kodu gönder",
+ "engines.antigravity.runtime": "Çalıştığı yer",
+ "engines.antigravity.runtimeCustom": "Özel yol",
+ "engineSetup.managedDescCli": "{app}, Google'ın Antigravity CLI'ını kurar. Buradan kurun ve Google ile giriş yapın; ardından bu model listesi hesabınızdan yenilenir.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Google Antigravity CLI'ı kur",
+ "engineSetup.installClassicRuntime": "Classic runtime'ı kur",
"engineSetup.installDesc": "Komut satırı uygulamasını bir kez kurun. Hazır olur olmaz modeller burada görünecektir.",
"engineSetup.installDescSignIn": "Komut satırı uygulamasını bir kez kurun. Hazır olur olmaz modeller burada görünecektir; ardından giriş yapılması gerekebilir.",
"engineSetup.notReady": "{name} hazır değil",
@@ -3823,7 +3834,7 @@
"engineSetup.device.description": "ChatGPT hesabınızı Codex'e bağlayın. Oturum açmayı kendi tarayıcınızda tamamlayın; terminal veya şifre paylaşımı gerekmez.",
"engineSetup.chatgpt.start": "ChatGPT ile devam et",
"engineSetup.antigravity.addAccount": "Google hesabı ekle",
- "engineSetup.antigravity.emailUnavailable": "Google ile giriş yapıldı · hesap e-postası kullanılamıyor",
+ "engineSetup.antigravity.signedInGoogle": "Google ile giriş yapıldı",
"engineSetup.chatgpt.modelsAfterSignIn": "Kullanılabilir modeller, ChatGPT planınızı bağladıktan sonra görünür.",
"engineSetup.chatgpt.starting": "ChatGPT oturum açma sayfası açılıyor…",
"engineSetup.chatgpt.security": "OpenAI sayfasında oturum açın ve plan kullanımını paylaşıp paylaşmayacağınızı seçin. Şifreniz OpenAI'de kalır; kimlik bilgileri bu bilgisayarda kalır.",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 75fa43f94b..e237814604 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -1437,6 +1437,17 @@
"engineSetup.terminalSignIn": "Завершіть вхід в акаунт у терміналі. Потім знову відкрийте це меню, і ми перевіримо.",
"engineSetup.injectDesc": "Встановіть агента один раз — і ви зможете запускати його з локальними моделями без входу в хмару.",
"engineSetup.managedDesc": "{app} встановлює власний перевірений рантайм Antigravity. Він окремий від застосунку Antigravity і agy CLI; встановіть його тут, увійдіть через Google, і цей список моделей оновиться з вашого акаунта.",
+ "engineSetup.pasteCodeHint": "Увійдіть на сторінці, яку відкриє Google. Потім вставте сюди показаний код або повну адресу сторінки, на якій опинитеся.",
+ "engineSetup.pasteCodeLabel": "Код входу або адреса сторінки",
+ "engineSetup.pasteCodePlaceholder": "Код або https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Надіслати код",
+ "engines.antigravity.runtime": "Працює на",
+ "engines.antigravity.runtimeCustom": "Власний шлях",
+ "engineSetup.managedDescCli": "{app} встановлює Antigravity CLI від Google. Встановіть її тут і увійдіть через Google; після цього список моделей оновиться з вашого облікового запису.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Встановити Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "Встановити Classic runtime",
"engineSetup.installDesc": "Встановіть консольний застосунок один раз. Моделі з'являться тут, щойно все буде готове.",
"engineSetup.installDescSignIn": "Встановіть консольний застосунок один раз. Моделі з'являться тут, щойно все буде готове; за входом може бути наступним кроком.",
"engineSetup.notReady": "{name} не готовий",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index c4df7eb23c..16b2b78992 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -2259,6 +2259,17 @@
"engineSetup.terminalSignIn": "Hoàn tất đăng nhập tài khoản trong Terminal. Mở lại menu này sau đó và chúng tôi sẽ kiểm tra lại.",
"engineSetup.injectDesc": "Cài đặt agent một lần, sau đó bạn có thể chạy với các mô hình cục bộ—không yêu cầu đăng nhập đám mây.",
"engineSetup.managedDesc": "{app} cài đặt môi trường chạy (runtime) Antigravity riêng đã qua xác minh, hoàn toàn tách biệt với ứng dụng Antigravity và CLI agy. Hãy cài đặt tại đây, đăng nhập Google và danh sách mô hình này sẽ tự động cập nhật từ tài khoản của bạn.",
+ "engineSetup.pasteCodeHint": "Đăng nhập trên trang Google mở ra. Sau đó dán mã được hiển thị, hoặc địa chỉ đầy đủ của trang bạn đến cuối cùng, vào đây.",
+ "engineSetup.pasteCodeLabel": "Mã đăng nhập hoặc địa chỉ trang",
+ "engineSetup.pasteCodePlaceholder": "Mã, hoặc https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "Gửi mã",
+ "engines.antigravity.runtime": "Chạy trên",
+ "engines.antigravity.runtimeCustom": "Đường dẫn tùy chỉnh",
+ "engineSetup.managedDescCli": "{app} cài đặt Antigravity CLI của Google. Hãy cài đặt tại đây và đăng nhập bằng Google; sau đó danh sách mô hình này sẽ được làm mới từ tài khoản của bạn.",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "Cài đặt Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "Cài đặt Classic runtime",
"engineSetup.installDesc": "Cài đặt ứng dụng dòng lệnh một lần. Các mô hình sẽ xuất hiện ở đây ngay khi sẵn sàng.",
"engineSetup.installDescSignIn": "Cài đặt ứng dụng dòng lệnh một lần. Các mô hình sẽ xuất hiện ở đây ngay khi hoàn tất; sau đó có thể bạn sẽ cần đăng nhập.",
"engineSetup.notReady": "{name} chưa sẵn sàng",
@@ -3823,7 +3834,7 @@
"engineSetup.device.description": "Kết nối tài khoản ChatGPT của bạn với Codex. Hoàn tất đăng nhập trong trình duyệt của riêng bạn; không cần chia sẻ terminal hay mật khẩu.",
"engineSetup.chatgpt.start": "Tiếp tục với ChatGPT",
"engineSetup.antigravity.addAccount": "Thêm tài khoản Google",
- "engineSetup.antigravity.emailUnavailable": "Đã đăng nhập bằng Google · không thể lấy email tài khoản",
+ "engineSetup.antigravity.signedInGoogle": "Đã đăng nhập bằng Google",
"engineSetup.chatgpt.modelsAfterSignIn": "Các mô hình khả dụng sẽ xuất hiện sau khi bạn kết nối gói ChatGPT của mình.",
"engineSetup.chatgpt.starting": "Đang mở trang đăng nhập ChatGPT…",
"engineSetup.chatgpt.security": "Đăng nhập trên trang của OpenAI và chọn có chia sẻ mức sử dụng gói hay không. Mật khẩu của bạn luôn được lưu tại OpenAI; thông tin xác thực lưu trên máy tính này.",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index a7933dfbff..8e25e928a0 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -3330,6 +3330,17 @@
"engineSetup.terminalSignIn": "請在終端機中完成帳戶登入。之後重新開啟此選單,我們會再檢查一次。",
"engineSetup.injectDesc": "引擎只需安裝一次,之後即可搭配本機模型執行,不需要雲端登入。",
"engineSetup.managedDesc": "{app} 會安裝自己已驗證的 Antigravity 執行環境。它與 Antigravity 應用程式及 agy CLI 各自獨立;請在這裡安裝、使用 Google 登入,接著這份模型清單就會依你的帳戶重新整理。",
+ "engineSetup.pasteCodeHint": "在 Google 開啟的頁面登入,再把頁面顯示的代碼,或最後停留頁面的完整網址,貼到這裡。",
+ "engineSetup.pasteCodeLabel": "登入代碼或頁面網址",
+ "engineSetup.pasteCodePlaceholder": "代碼,或 https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "傳送代碼",
+ "engines.antigravity.runtime": "執行方式",
+ "engines.antigravity.runtimeCustom": "自訂路徑",
+ "engineSetup.managedDescCli": "{app} 會安裝 Google 的 Antigravity CLI。在這裡安裝並使用 Google 登入後,這份模型清單會依你的帳戶重新整理。",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engineSetup.installAntigravityCli": "安裝 Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "安裝 Classic runtime",
"engineSetup.installDesc": "命令列應用程式只需安裝一次。準備就緒後,模型就會顯示在這裡。",
"engineSetup.installDescSignIn": "命令列應用程式只需安裝一次。準備就緒後模型就會顯示在這裡;接著可能需要登入。",
"engineSetup.notReady": "{name} 尚未就緒",
@@ -5619,7 +5630,7 @@
"engineSetup.chatgpt.description": "在 {app} 中使用你的 ChatGPT 方案處理符合資格的 AI 請求。這與 MausBot Cloud 以及使用 API 金鑰付費是分開的。",
"engineSetup.chatgpt.start": "使用 ChatGPT 繼續",
"engineSetup.antigravity.addAccount": "新增 Google 帳號",
- "engineSetup.antigravity.emailUnavailable": "已使用 Google 登入 · 無法取得帳號電子郵件",
+ "engineSetup.antigravity.signedInGoogle": "已使用 Google 登入",
"engineSetup.chatgpt.modelsAfterSignIn": "連線你的 ChatGPT 方案後,就會顯示可用的模型。",
"engineSetup.chatgpt.starting": "正在開啟 ChatGPT 登入…",
"engineSetup.chatgpt.security": "請在 OpenAI 的頁面登入,並選擇是否分享方案用量。你的密碼只會留在 OpenAI;憑證則留在這台電腦上。",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 95586f04fa..fe4fb21749 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -3363,12 +3363,23 @@
"engineSetup.otherComputerUrl": "另一台电脑上的页面地址",
"engineSetup.sending": "正在发送…",
"engineSetup.sendRedirect": "发送跳转地址",
+ "engineSetup.pasteCodeHint": "在 Google 打开的页面完成登录,然后把页面上显示的授权码,或最终落地页的完整地址,粘贴到这里。",
+ "engineSetup.pasteCodeLabel": "登录授权码或页面地址",
+ "engineSetup.pasteCodePlaceholder": "授权码,或 https://antigravity.google/oauth-callback?…",
+ "engineSetup.sendCode": "发送授权码",
"engineSetup.googleNoLink": "Google 登录没有返回链接。",
"engineSetup.signInTitle": "登录 {name}",
"engineSetup.installTitle": "安装 {name}",
"engineSetup.managedSignIn": "每个 Antigravity 配置都有自己的 Google 账户。安全登录由你的浏览器完成。",
+ "engines.antigravity.runtime": "运行方式",
+ "engines.antigravity.runtimeCli": "Google Antigravity CLI",
+ "engines.antigravity.runtimePinned": "Classic runtime",
+ "engines.antigravity.runtimeCustom": "自定义路径",
"engineSetup.terminalSignIn": "请在终端里完成账户登录。之后重新打开此菜单,我们会再检查一次。",
"engineSetup.injectDesc": "安装一次该智能体,之后就能用本地模型运行——不需要云端登录。",
+ "engineSetup.installAntigravityCli": "安装 Google Antigravity CLI",
+ "engineSetup.installClassicRuntime": "安装 Classic runtime",
+ "engineSetup.managedDescCli": "{app} 会安装 Google 官方的 Antigravity CLI。在这里安装并用 Google 登录后,这个模型列表会从你的账户刷新。",
"engineSetup.managedDesc": "{app} 会安装自己校验过的 Antigravity 运行时。它独立于 Antigravity 应用和 agy CLI;在这里安装并用 Google 登录后,这个模型列表会从你的账户刷新。",
"engineSetup.installDesc": "安装一次命令行应用。就绪后模型就会出现在这里。",
"engineSetup.installDescSignIn": "安装一次命令行应用。就绪后模型就会出现在这里;之后可能还需要登录。",
@@ -5629,7 +5640,7 @@
"engineSetup.chatgpt.description": "让 {app} 中符合条件的 AI 请求使用你的 ChatGPT 方案。这与 MausBot Cloud 无关,也和通过 API 密钥付费无关。",
"engineSetup.chatgpt.start": "使用 ChatGPT 继续",
"engineSetup.antigravity.addAccount": "添加 Google 账户",
- "engineSetup.antigravity.emailUnavailable": "已通过 Google 登录 · 无法获取账户邮箱",
+ "engineSetup.antigravity.signedInGoogle": "已通过 Google 登录",
"engineSetup.chatgpt.modelsAfterSignIn": "连接你的 ChatGPT 方案后,就会显示可用的模型。",
"engineSetup.chatgpt.starting": "正在打开 ChatGPT 登录…",
"engineSetup.chatgpt.security": "在 OpenAI 的页面上登录,并选择是否共享方案用量。你的密码只保存在 OpenAI 那里;登录凭证只保留在这台电脑上。",
diff --git a/src/state/store.tsx b/src/state/store.tsx
index 9fd0e33a1f..1c7403bb68 100644
--- a/src/state/store.tsx
+++ b/src/state/store.tsx
@@ -423,7 +423,7 @@ export interface InstanceInfo extends InstanceEndpointInfo {
snapshot: {
state: "available" | "unavailable";
reason?: string;
- authenticated?: boolean; /** The CLI path runs another program, not this engine's CLI. */ notEngineCli?: true;
+ authenticated?: boolean; /** The CLI path runs another program, not this engine's CLI. */ notEngineCli?: true; /** Runs Google's native Antigravity CLI. */ nativeCli?: true;
chatgptPlan?: boolean;
/** Ready only through OpenCode's free no-login models: a backup, never "an AI already works". */
freeFallback?: boolean;