Open History to see the last commit
1// @effect-diagnostics-next-line nodeBuiltinImport:off - Effect's symlink has no type argument, and Windows needs a junction to link without elevation.
2import * as NodeFSP from "node:fs/promises";
3
4import type { AntigravityAuthMethod, ProviderInstanceId } from "@t3tools/contracts";
5import * as HostProcess from "@t3tools/shared/HostProcess";
6import { resolveNodeExecutable, nodeRuntimeUnavailableMessage } from "@t3tools/shared/nodeRuntime";
7import * as Crypto from "effect/Crypto";
8import * as Effect from "effect/Effect";
9import * as Hex from "effect/encoding/Hex";
10import * as FileSystem from "effect/FileSystem";
11import * as Path from "effect/Path";
12import type * as PlatformError from "effect/PlatformError";
13import * as Schema from "effect/Schema";
14import * as Stream from "effect/Stream";
15import * as ChildProcess from "effect/process/ChildProcess";
16import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
17import * as AcpErrors from "effect-acp/errors";
18
19import { collectUint8StreamText } from "@t3tools/provider-core/server/collectStreamText";
20import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
21import {
22 antigravityUserSkillDirectories,
23 resolveAntigravityUserHome,
24} from "./Drivers/AntigravitySkills.ts";
25
26export const ANTIGRAVITY_AUTH_STDOUT_PREFIX =
27 "Open the following link to authenticate the ACP server: ";
28export const ANTIGRAVITY_AUTH_BROWSER_MARKER = "__T3_ANTIGRAVITY_AUTH_URL__";
29export const ANTIGRAVITY_SIGN_IN_REQUIRED_MESSAGE =
30 "Sign in to Antigravity in Settings before you continue.";
31
32const maxAuthorizationUrlLength = 16_384;
33const maxBrowserHelperLineLength =
34 Math.max(ANTIGRAVITY_AUTH_BROWSER_MARKER.length, ANTIGRAVITY_AUTH_STDOUT_PREFIX.length) +
35 maxAuthorizationUrlLength +
36 2;
37const maxStdoutLineBytes = 16 * 1024 * 1024;
38const authPrefixBytes = new TextEncoder().encode(ANTIGRAVITY_AUTH_STDOUT_PREFIX);
39const decodeUrl = Schema.decodeUnknownEffect(Schema.URLFromString);
40const decodeBrowserHelperUrl = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.String));
41const ProfileSettingsFile = Schema.Struct({
42 auth: Schema.Struct({ type: Schema.String }),
43 gcp: Schema.optional(
44 Schema.Struct({
45 project: Schema.optional(Schema.String),
46 location: Schema.optional(Schema.String),
47 }),
48 ),
49});
50const encodeProfileSettings = Schema.encodeSync(Schema.fromJsonString(ProfileSettingsFile));
51const isAcpRequestError = Schema.is(AcpErrors.AcpRequestError);
52const isAcpTransportError = Schema.is(AcpErrors.AcpTransportError);
53
54// Python splits BROWSER on path separators before parsing quotes. Exit 0 on EPIPE to prevent browser fallback after cancellation.
55const browserHelperSource =
56 `process.stderr.on("error",()=>process.exit(0)).write(` +
57 `"${ANTIGRAVITY_AUTH_BROWSER_MARKER}"+JSON.stringify(process.argv[1])+"\\n",` +
58 `()=>process.exit(0))`;
59const browserPreflightUrl = "https://example.invalid/t3-antigravity-browser-preflight";
60
61const removedEnvironmentKeys = new Set([
62 "GEMINI_API_KEY",
63 "GOOGLE_API_KEY",
64 "GOOGLE_APPLICATION_CREDENTIALS",
65 "GOOGLE_CLOUD_PROJECT",
66 "GOOGLE_CLOUD_LOCATION",
67 "GOOGLE_CLOUD_QUOTA_PROJECT",
68 "GOOGLE_GENAI_USE_VERTEXAI",
69 "GCLOUD_PROJECT",
70 "CLOUDSDK_CORE_PROJECT",
71 "AGY_ACP_CCPA_PROJECT",
72 "AGY_ACP_ENABLE_OAUTH",
73 "GEMINI_HOME",
74 "AGY_ACP_FORCE_FILE_STORAGE",
75 "ANTIGRAVITY_HARNESS_PATH",
76 "BROWSER",
77 "PYTHONUNBUFFERED",
78 "ELECTRON_RUN_AS_NODE",
79]);
80
81export interface AntigravityProfile {
82 readonly platform: NodeJS.Platform;
83 readonly geminiHome: string;
84 readonly acpDirectory: string;
85 readonly tokenPath: string;
86 readonly tempDirectory: string;
87 readonly browserCommand: string;
88 readonly caBundlePath?: string;
89}
90
91export interface AntigravityAuthConfig {
92 readonly authMethod: AntigravityAuthMethod;
93 readonly apiKey: string;
94 readonly gcpProject: string;
95 readonly gcpLocation: string;
96}
97
98const ANTIGRAVITY_PERSONAL_AUTH: AntigravityAuthConfig = {
99 authMethod: "oauth-personal",
100 apiKey: "",
101 gcpProject: "",
102 gcpLocation: "",
103};
104
105export function antigravityAuthUsesBrowser(authMethod: AntigravityAuthMethod): boolean {
106 return authMethod === "oauth-personal" || authMethod === "oauth-business";
107}
108
109export function antigravityAuthLabel(authMethod: AntigravityAuthMethod): string {
110 switch (authMethod) {
111 case "oauth-personal":
112 return "Google account";
113 case "oauth-business":
114 return "Gemini Enterprise";
115 case "gemini-api-key":
116 return "Gemini API key";
117 case "agent-platform":
118 return "Agent Platform";
119 }
120}
121
122export function antigravityAuthConfigIssue(auth: AntigravityAuthConfig): string | null {
123 switch (auth.authMethod) {
124 case "oauth-personal":
125 return null;
126 case "oauth-business":
127 return auth.gcpProject && auth.gcpLocation
128 ? null
129 : "Gemini Enterprise needs a GCP project and location in the Antigravity provider settings.";
130 case "gemini-api-key":
131 return auth.apiKey ? null : "Enter a Gemini API key in the Antigravity provider settings.";
132 case "agent-platform":
133 return auth.apiKey || (auth.gcpProject && auth.gcpLocation)
134 ? null
135 : "Agent Platform needs an API key, or a GCP project and location, in the Antigravity provider settings.";
136 }
137}
138
139/**
140 * `auth.type` names the selected method so a native logout clears only that method's credentials
141 * instead of every stored token. Never holds a credential.
142 */
143function antigravityProfileSettings(auth: AntigravityAuthConfig): string {
144 const gcp = {
145 ...(auth.gcpProject ? { project: auth.gcpProject } : {}),
146 ...(auth.gcpLocation ? { location: auth.gcpLocation } : {}),
147 };
148 return `${encodeProfileSettings({
149 auth: { type: auth.authMethod },
150 ...(Object.keys(gcp).length > 0 ? { gcp } : {}),
151 })}\n`;
152}
153
154export interface AntigravityAuthorizationUrl {
155 readonly authorizationUrl: string;
156 readonly redirectUri: string;
157 readonly state: string;
158}
159
160function authSupportError(detail: string) {
161 return new AcpErrors.AcpTransportError({ detail, cause: undefined });
162}
163
164export function isAntigravitySignInRequiredError(error: unknown): boolean {
165 return (
166 (isAcpRequestError(error) && error.code === -32000) ||
167 (isAcpTransportError(error) && error.detail === ANTIGRAVITY_SIGN_IN_REQUIRED_MESSAGE)
168 );
169}
170
171export interface AntigravityInstanceDirectories {
172 readonly profile: string;
173 /** Keep beside the profile: 120-character archive members under its longer name would exceed Windows' 260-character limit. */
174 readonly runtimeTemp: string;
175}
176
177/** Hashes the instance ID so case-only differences stay separate on case-insensitive filesystems. */
178export const resolveAntigravityInstanceDirectories = Effect.fn(
179 "resolveAntigravityInstanceDirectories",
180)(function* (stateDir: string, instanceId: ProviderInstanceId) {
181 const crypto = yield* Crypto.Crypto;
182 const path = yield* Path.Path;
183 const key = Hex.encode(yield* crypto.digest("SHA-256", new TextEncoder().encode(instanceId)));
184 return {
185 profile: path.join(stateDir, "providers", "antigravity", key),
186 runtimeTemp: path.join(stateDir, "antigravity-tmp", key.slice(0, 12)),
187 } satisfies AntigravityInstanceDirectories;
188});
189
190function quoteBrowserArgument(value: string): string {
191 return `'${value.replaceAll("'", `'"'"'`)}'`;
192}
193
194function antigravityEnvironment(
195 profile: AntigravityProfile,
196 baseEnv: NodeJS.ProcessEnv,
197 auth: AntigravityAuthConfig,
198 runtimeTempDirectory?: string,
199) {
200 const environment: NodeJS.ProcessEnv = {};
201 for (const [key, value] of Object.entries(baseEnv)) {
202 // Windows treats environment keys as case-insensitive. Remove aliases too.
203 if (!removedEnvironmentKeys.has(key.toUpperCase())) environment[key] = value;
204 }
205 // Put the GCP pair in settings.json because GOOGLE_API_KEY takes precedence in the environment.
206 const credential =
207 auth.authMethod === "gemini-api-key" && auth.apiKey
208 ? { GEMINI_API_KEY: auth.apiKey }
209 : auth.authMethod === "agent-platform" && auth.apiKey
210 ? { GOOGLE_API_KEY: auth.apiKey }
211 : {};
212 // Each launch unpacks about 1 GB; use T3-owned temp so the driver can reclaim files after force-kill.
213 const tempDirectory = runtimeTempDirectory ?? profile.tempDirectory;
214 return {
215 ...environment,
216 ...credential,
217 ...(profile.caBundlePath !== undefined &&
218 baseEnv.SSL_CERT_FILE === undefined &&
219 baseEnv.SSL_CERT_DIR === undefined
220 ? { SSL_CERT_FILE: profile.caBundlePath }
221 : {}),
222 GEMINI_HOME: profile.geminiHome,
223 AGY_ACP_FORCE_FILE_STORAGE: "1",
224 BROWSER: profile.browserCommand,
225 PYTHONUNBUFFERED: "1",
226 ELECTRON_RUN_AS_NODE: "1",
227 ...(profile.platform === "win32"
228 ? { TEMP: tempDirectory, TMP: tempDirectory }
229 : { TMPDIR: tempDirectory }),
230 };
231}
232
233/** Private GEMINI_HOME isolates credentials/hooks/MCP; link global skills from the real ~/.gemini. */
234const linkAntigravityUserSkills = Effect.fn("linkAntigravityUserSkills")(function* (input: {
235 readonly profileDirectory: string;
236 readonly userHome: string;
237 readonly platform: NodeJS.Platform;
238}): Effect.fn.Return<void, never, FileSystem.FileSystem | Path.Path> {
239 const fs = yield* FileSystem.FileSystem;
240 const path = yield* Path.Path;
241 const links = antigravityUserSkillDirectories(path, input.profileDirectory);
242 const targets = antigravityUserSkillDirectories(path, path.join(input.userHome, ".gemini"));
243 for (const [link, target] of [
244 [links[0], targets[0]],
245 [links[1], targets[1]],
246 ] as const) {
247 yield* Effect.gen(function* () {
248 const existing = yield* fs.readLink(link).pipe(
249 Effect.map((value): string | undefined => path.resolve(path.dirname(link), value)),
250 Effect.catchReason("PlatformError", "NotFound", () => Effect.undefined),
251 );
252 if (existing === target) return;
253 if (existing !== undefined) {
254 yield* fs.remove(link);
255 }
256 yield* fs.makeDirectory(path.dirname(link), { recursive: true });
257 yield* Effect.tryPromise(() =>
258 NodeFSP.symlink(target, link, input.platform === "win32" ? "junction" : "dir"),
259 );
260 }).pipe(
261 Effect.catch((error) =>
262 Effect.logWarning("Antigravity user skills are not linked into the profile.", {
263 link,
264 target,
265 error,
266 }),
267 ),
268 );
269 }
270});
271
272export const prepareAntigravityProfile = Effect.fn("prepareAntigravityProfile")(function* (input: {
273 readonly profileDirectory: string;
274 readonly baseEnv?: NodeJS.ProcessEnv;
275 readonly runtimeExecutablePath?: string;
276 readonly platform?: NodeJS.Platform;
277 readonly auth?: AntigravityAuthConfig;
278 readonly userHome?: string;
279 readonly tempDirectory?: string;
280}) {
281 const auth = input.auth ?? ANTIGRAVITY_PERSONAL_AUTH;
282 const fs = yield* FileSystem.FileSystem;
283 const path = yield* Path.Path;
284 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
285 const platform = input.platform ?? (yield* HostProcess.Platform);
286 const userHome =
287 input.userHome ??
288 resolveAntigravityUserHome(
289 platform,
290 input.baseEnv ?? process.env,
291 yield* HostProcess.HomeDirectory,
292 );
293 const runtimeExecutablePath =
294 input.runtimeExecutablePath ??
295 (yield* resolveNodeExecutable("Antigravity sign-in", input.baseEnv).pipe(
296 Effect.mapError(
297 (cause) =>
298 new AcpErrors.AcpTransportError({
299 detail: nodeRuntimeUnavailableMessage("Antigravity sign-in"),
300 cause,
301 }),
302 ),
303 ));
304 const helperExecutable =
305 platform === "win32" ? runtimeExecutablePath.replaceAll("\\", "/") : runtimeExecutablePath;
306 const browserArguments = [helperExecutable, "-e", browserHelperSource, "--", "%s"];
307 const browserCommand = browserArguments.map(quoteBrowserArgument).join(" ");
308 if (
309 browserCommand.includes(platform === "win32" ? ";" : ":") ||
310 helperExecutable.includes("\r") ||
311 helperExecutable.includes("\n") ||
312 helperExecutable.includes("\0") ||
313 helperExecutable.includes("%s")
314 ) {
315 return yield* authSupportError(
316 "The T3 runtime path cannot be used to suppress Antigravity browser launches.",
317 );
318 }
319
320 const geminiHome = path.resolve(input.profileDirectory);
321 const acpDirectory = path.join(geminiHome, "antigravity-acp");
322 const tempDirectory = input.tempDirectory ?? path.join(acpDirectory, "tmp");
323 let caBundlePath: string | undefined;
324 if (platform === "linux") {
325 // Bundled Python may look for certificates at paths absent on this distribution.
326 // Relative paths would resolve differently when the agent runs in the project directory.
327 for (const candidate of [
328 (input.baseEnv ?? process.env).NIX_SSL_CERT_FILE,
329 "/etc/ssl/certs/ca-bundle.crt",
330 "/etc/ssl/certs/ca-certificates.crt",
331 "/etc/pki/tls/certs/ca-bundle.crt",
332 "/etc/ssl/cert.pem",
333 ]) {
334 if (
335 candidate &&
336 path.isAbsolute(candidate) &&
337 (yield* fs.exists(candidate).pipe(Effect.orElseSucceed(() => false)))
338 ) {
339 caBundlePath = candidate;
340 break;
341 }
342 }
343 }
344 const profile: AntigravityProfile = {
345 platform,
346 geminiHome,
347 acpDirectory,
348 tokenPath: path.join(acpDirectory, "acp_token.json"),
349 tempDirectory,
350 browserCommand,
351 ...(caBundlePath === undefined ? {} : { caBundlePath }),
352 };
353 const environment = antigravityEnvironment(profile, input.baseEnv ?? process.env, auth);
354 yield* Effect.gen(function* () {
355 const child = yield* spawner.spawn(
356 ChildProcess.make(helperExecutable, ["-e", browserHelperSource, "--", browserPreflightUrl], {
357 env: environment,
358 extendEnv: false,
359 shell: false,
360 }),
361 );
362 const [stdout, stderr, exitCode] = yield* Effect.all(
363 [
364 collectUint8StreamText({ stream: child.stdout, maxBytes: 4_096 }),
365 collectUint8StreamText({ stream: child.stderr, maxBytes: 4_096 }),
366 child.exitCode,
367 ],
368 { concurrency: "unbounded" },
369 );
370 if (
371 Number(exitCode) !== 0 ||
372 stdout.bytes !== 0 ||
373 stdout.truncated ||
374 stderr.truncated ||
375 stderr.text !== `${ANTIGRAVITY_AUTH_BROWSER_MARKER}"${browserPreflightUrl}"\n`
376 ) {
377 return yield* authSupportError("Antigravity browser suppression could not be verified.");
378 }
379 }).pipe(
380 Effect.scoped,
381 Effect.timeoutOrElse({
382 duration: "5 seconds",
383 orElse: () =>
384 Effect.fail(authSupportError("Antigravity browser suppression verification timed out.")),
385 }),
386 Effect.mapError((error) =>
387 error._tag === "AcpTransportError"
388 ? error
389 : authSupportError("Antigravity browser suppression could not be verified."),
390 ),
391 );
392
393 for (const directory of [geminiHome, acpDirectory, tempDirectory]) {
394 yield* fs
395 .makeDirectory(directory, { recursive: true, mode: 0o700 })
396 .pipe(
397 Effect.mapError(() =>
398 authSupportError("The Antigravity profile directory could not be created."),
399 ),
400 );
401 if (platform !== "win32") {
402 yield* fs
403 .chmod(directory, 0o700)
404 .pipe(
405 Effect.mapError(() =>
406 authSupportError("The Antigravity profile directory permissions could not be set."),
407 ),
408 );
409 }
410 }
411 yield* fs
412 .writeFileString(path.join(acpDirectory, "settings.json"), antigravityProfileSettings(auth))
413 .pipe(
414 Effect.mapError(() =>
415 authSupportError("The Antigravity profile settings could not be written."),
416 ),
417 );
418 yield* linkAntigravityUserSkills({ profileDirectory: geminiHome, userHome, platform });
419 return profile;
420});
421
422export function buildAntigravityAcpSpawnInput(input: {
423 readonly installation: {
424 readonly executablePath: string;
425 readonly harnessPath: string;
426 };
427 readonly profile: AntigravityProfile;
428 readonly cwd: string;
429 readonly baseEnv?: NodeJS.ProcessEnv;
430 readonly auth?: AntigravityAuthConfig;
431 readonly runtimeTempDirectory?: string;
432}): AcpSessionRuntime.AcpSpawnInput {
433 return {
434 command: input.installation.executablePath,
435 args: input.profile.platform === "linux" ? ["--uid="] : [],
436 cwd: input.cwd,
437 env: {
438 ...antigravityEnvironment(
439 input.profile,
440 input.baseEnv ?? process.env,
441 input.auth ?? ANTIGRAVITY_PERSONAL_AUTH,
442 input.runtimeTempDirectory,
443 ),
444 ANTIGRAVITY_HARNESS_PATH: input.installation.harnessPath,
445 },
446 extendEnv: false,
447 };
448}
449
450export const parseAntigravityAuthorizationUrl = Effect.fn("parseAntigravityAuthorizationUrl")(
451 function* (
452 authorizationUrl: string,
453 ): Effect.fn.Return<AntigravityAuthorizationUrl, AcpErrors.AcpError> {
454 const invalidUrl = () =>
455 authSupportError("Antigravity returned an invalid Google sign-in URL.");
456 if (authorizationUrl.length > maxAuthorizationUrlLength || /\s/.test(authorizationUrl)) {
457 return yield* invalidUrl();
458 }
459 const url = yield* decodeUrl(authorizationUrl).pipe(Effect.mapError(invalidUrl));
460 const state = url.searchParams.get("state");
461 const redirectUri = url.searchParams.get("redirect_uri");
462 if (
463 url.origin !== "https://accounts.google.com" ||
464 url.pathname !== "/o/oauth2/v2/auth" ||
465 url.username !== "" ||
466 url.password !== "" ||
467 url.hash !== "" ||
468 url.searchParams.getAll("state").length !== 1 ||
469 url.searchParams.getAll("redirect_uri").length !== 1 ||
470 url.searchParams.getAll("response_type").length !== 1 ||
471 url.searchParams.get("response_type") !== "code" ||
472 state === null ||
473 state.length === 0 ||
474 state.length > 512 ||
475 /\s/.test(state) ||
476 redirectUri === null ||
477 !/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}\/$/.test(redirectUri)
478 ) {
479 return yield* invalidUrl();
480 }
481 const redirect = yield* decodeUrl(redirectUri).pipe(Effect.mapError(invalidUrl));
482 if (Number(redirect.port) < 1_024) return yield* invalidUrl();
483 return { authorizationUrl, redirectUri, state };
484 },
485);
486
487export function makeAntigravityStdoutTransform(
488 input: {
489 readonly onAuthorizationUrl?: (
490 authorizationUrl: string,
491 ) => Effect.Effect<void, AcpErrors.AcpError>;
492 } = {},
493) {
494 const handleLine = Effect.fn("antigravityAuthSupport.handleStdoutLine")(function* (
495 line: Uint8Array,
496 ) {
497 if (!authPrefixBytes.every((byte, index) => line[index] === byte)) return [line];
498 const message = new TextDecoder().decode(line).replace(/\r?\n$/, "");
499 const request = yield* parseAntigravityAuthorizationUrl(
500 message.slice(ANTIGRAVITY_AUTH_STDOUT_PREFIX.length),
501 );
502 if (!input.onAuthorizationUrl) {
503 return yield* authSupportError(ANTIGRAVITY_SIGN_IN_REQUIRED_MESSAGE);
504 }
505 yield* input.onAuthorizationUrl(request.authorizationUrl);
506 return [];
507 });
508
509 return (
510 stdout: ChildProcessSpawner.ChildProcessHandle["stdout"],
511 ): Stream.Stream<Uint8Array, PlatformError.PlatformError | AcpErrors.AcpError> =>
512 Stream.suspend(() => {
513 let pending: Uint8Array[] = [];
514 let pendingBytes = 0;
515 const finishLine = () => {
516 const line = Buffer.concat(pending, pendingBytes);
517 pending = [];
518 pendingBytes = 0;
519 return line;
520 };
521 return stdout.pipe(
522 Stream.mapEffect(
523 Effect.fn("antigravityAuthSupport.splitStdoutLines")(function* (chunk: Uint8Array) {
524 const lines: Uint8Array[] = [];
525 let offset = 0;
526 while (offset < chunk.byteLength) {
527 const newline = chunk.indexOf(10, offset);
528 const end = newline === -1 ? chunk.byteLength : newline + 1;
529 const part = chunk.subarray(offset, end);
530 if (pendingBytes + part.byteLength > maxStdoutLineBytes) {
531 return yield* authSupportError(
532 "Antigravity sent a protocol line that is too large.",
533 );
534 }
535 pending.push(part);
536 pendingBytes += part.byteLength;
537 if (newline !== -1) lines.push(finishLine());
538 offset = end;
539 }
540 return lines;
541 }),
542 ),
543 Stream.flatMap(Stream.fromIterable),
544 Stream.concat(
545 Stream.suspend(() => (pendingBytes > 0 ? Stream.succeed(finishLine()) : Stream.empty)),
546 ),
547 Stream.mapEffect(handleLine),
548 Stream.flatMap(Stream.fromIterable),
549 );
550 });
551}
552
553export function makeAntigravityStderrHandler(
554 input: {
555 readonly onAuthorizationUrl?: (
556 authorizationUrl: string,
557 ) => Effect.Effect<void, AcpErrors.AcpError>;
558 } = {},
559) {
560 let pending = "";
561 const handleLine = (line: string) => {
562 const message = line.endsWith("\r") ? line.slice(0, -1) : line;
563 if (message.length > maxBrowserHelperLineLength) {
564 return Effect.void;
565 }
566 const url = message.startsWith(ANTIGRAVITY_AUTH_STDOUT_PREFIX)
567 ? Effect.succeed(message.slice(ANTIGRAVITY_AUTH_STDOUT_PREFIX.length))
568 : message.startsWith(ANTIGRAVITY_AUTH_BROWSER_MARKER)
569 ? decodeBrowserHelperUrl(message.slice(ANTIGRAVITY_AUTH_BROWSER_MARKER.length))
570 : undefined;
571 if (url === undefined) return Effect.void;
572 return url.pipe(
573 Effect.flatMap(parseAntigravityAuthorizationUrl),
574 Effect.matchEffect({
575 onFailure: () => Effect.void,
576 onSuccess: (request) =>
577 input.onAuthorizationUrl
578 ? input.onAuthorizationUrl(request.authorizationUrl)
579 : Effect.fail(authSupportError(ANTIGRAVITY_SIGN_IN_REQUIRED_MESSAGE)),
580 }),
581 );
582 };
583
584 return Effect.fn("antigravityAuthSupport.handleStderr")(function* (text: string) {
585 const lines = `${pending}${text}`.split("\n");
586 pending = lines.pop() ?? "";
587 if (pending.length > maxBrowserHelperLineLength) pending = "";
588 yield* Effect.forEach(lines, handleLine, { discard: true });
589 });
590}