@ycodium-ai/agent-antigravity 0.2.3020 → 0.2.3024

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +31 -29
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -28677,17 +28677,38 @@ async function* watchAgentStderr(source, onLoginPrompt, onBrowserHelperLine) {
28677
28677
  // src/agentProcess.ts
28678
28678
  async function waitForExit(handle, timeoutMs) {
28679
28679
  let timer;
28680
- await Promise.race([
28680
+ const exited = await Promise.race([
28681
28681
  handle.exited.then(
28682
- () => void 0,
28683
- () => void 0
28682
+ () => true,
28683
+ () => true
28684
28684
  ),
28685
28685
  new Promise((resolve6) => {
28686
- timer = setTimeout(resolve6, timeoutMs);
28686
+ timer = setTimeout(() => resolve6(false), timeoutMs);
28687
28687
  timer.unref?.();
28688
28688
  })
28689
28689
  ]);
28690
28690
  clearTimeout(timer);
28691
+ return exited;
28692
+ }
28693
+ function stopAgentProcess(handle, exitWaitMs, log) {
28694
+ let stopping = stoppingByHandle.get(handle);
28695
+ if (stopping === void 0) {
28696
+ stopping = terminate(handle, exitWaitMs, log);
28697
+ stoppingByHandle.set(handle, stopping);
28698
+ }
28699
+ return stopping;
28700
+ }
28701
+ var stoppingByHandle = /* @__PURE__ */ new WeakMap();
28702
+ async function terminate(handle, exitWaitMs, log) {
28703
+ await handle.kill("SIGTERM").catch(() => void 0);
28704
+ if (await waitForExit(handle, exitWaitMs)) return;
28705
+ log.warn("the agent process ignored SIGTERM; killing it", { pid: handle.pid, exitWaitMs });
28706
+ await handle.kill("SIGKILL").catch(() => void 0);
28707
+ if (await waitForExit(handle, exitWaitMs)) return;
28708
+ log.error("the agent process is still running after SIGKILL; leaving it behind", {
28709
+ pid: handle.pid,
28710
+ exitWaitMs
28711
+ });
28691
28712
  }
28692
28713
  async function openAgentProcess(input2) {
28693
28714
  await prepareAntigravityProfile(input2.profile);
@@ -28752,8 +28773,7 @@ async function openAgentProcess(input2) {
28752
28773
  const close = () => {
28753
28774
  closing ??= (async () => {
28754
28775
  await connection.close().catch(() => void 0);
28755
- await handle.kill("SIGTERM").catch(() => void 0);
28756
- await waitForExit(handle, input2.exitWaitMs);
28776
+ await stopAgentProcess(handle, input2.exitWaitMs, input2.host.log);
28757
28777
  await removeRuntimeTempDir(directory);
28758
28778
  })();
28759
28779
  return closing;
@@ -30851,9 +30871,8 @@ function createAntigravityTextGeneration(deps) {
30851
30871
  const closeAll = async () => {
30852
30872
  stopped = true;
30853
30873
  await executor?.dispose().catch(() => void 0);
30854
- await handle?.kill("SIGTERM").catch(() => void 0);
30874
+ if (handle !== void 0) await stopAgentProcess(handle, deps.exitWaitMs, deps.host.log);
30855
30875
  await pump?.catch(() => void 0);
30856
- if (handle !== void 0) await waitForExit(handle, deps.exitWaitMs);
30857
30876
  if (runtimeTemp !== void 0) await removeRuntimeTempDir(runtimeTemp);
30858
30877
  if (workspace !== void 0) {
30859
30878
  await removeTemporarySessionFiles({ profile: deps.profile, sessionId, workspace });
@@ -31461,9 +31480,8 @@ async function createAntigravityInstance(config2, host, deps) {
31461
31480
  const stopBooked = async (booked) => {
31462
31481
  for (const stopped of booked.background.finish()) events.push(stopped);
31463
31482
  await booked.executor.dispose().catch(() => void 0);
31464
- await booked.handle.kill("SIGTERM").catch(() => void 0);
31483
+ await stopAgentProcess(booked.handle, exitWaitMs, host.log);
31465
31484
  await booked.forwarding.catch(() => void 0);
31466
- await waitForExit(booked.handle, exitWaitMs);
31467
31485
  if (!await removeRuntimeTempDir(booked.runtimeTemp)) {
31468
31486
  host.log.warn("could not remove a runtime temp directory; it is swept on the next start", {
31469
31487
  directory: booked.runtimeTemp
@@ -31705,7 +31723,7 @@ async function createAntigravityInstance(config2, host, deps) {
31705
31723
  if (sessionReady) {
31706
31724
  void noteSession(() => login.noteSessionSignedOut());
31707
31725
  host.log.warn("antigravity asked to sign in during a session; stopping the process");
31708
- void handle.kill("SIGTERM").catch(() => void 0);
31726
+ void stopAgentProcess(handle, exitWaitMs, host.log);
31709
31727
  }
31710
31728
  };
31711
31729
  const aborted2 = new Promise((_, reject) => {
@@ -31847,9 +31865,8 @@ async function createAntigravityInstance(config2, host, deps) {
31847
31865
  return session;
31848
31866
  } catch (error62) {
31849
31867
  await executor.dispose().catch(() => void 0);
31850
- await handle.kill("SIGTERM").catch(() => void 0);
31868
+ await stopAgentProcess(handle, exitWaitMs, host.log);
31851
31869
  await forwarding.catch(() => void 0);
31852
- await waitForExit(handle, exitWaitMs);
31853
31870
  await removeRuntimeTempDir(runtimeTemp);
31854
31871
  if (live.signInRequired || isSignInRequiredError(error62)) {
31855
31872
  await noteSession(() => login.noteSessionSignedOut());
@@ -32523,20 +32540,6 @@ function matchesExpectedRuntime(initializeResult, expectedVersion) {
32523
32540
  const auth = capabilities["auth"];
32524
32541
  return agentInfo["name"] === EXPECTED_AGENT_NAME && runtimeVersionNumber(acpAgentVersion(initializeResult) ?? "") === runtimeVersionNumber(expectedVersion) && initializeResult["protocolVersion"] === 1 && capabilities["loadSession"] === true && isRecord18(sessionCapabilities) && Boolean(sessionCapabilities["resume"]) && isRecord18(auth) && Boolean(auth["logout"]) && authMethods.some((method) => isRecord18(method) && method["id"] === "oauth-personal");
32525
32542
  }
32526
- async function waitForExit2(handle) {
32527
- let timer;
32528
- await Promise.race([
32529
- handle.exited.then(
32530
- () => void 0,
32531
- () => void 0
32532
- ),
32533
- new Promise((resolve6) => {
32534
- timer = setTimeout(resolve6, EXIT_WAIT_MS);
32535
- timer.unref?.();
32536
- })
32537
- ]);
32538
- clearTimeout(timer);
32539
- }
32540
32543
  async function validateInstalledRuntime(input2) {
32541
32544
  const platform2 = input2.platform ?? HOST_PLATFORM;
32542
32545
  const profileRoot = NodePath12.join(input2.dataDir, "tmp", "validate-profile");
@@ -32591,8 +32594,7 @@ async function validateInstalledRuntime(input2) {
32591
32594
  } finally {
32592
32595
  await closeHandshake?.().catch(() => void 0);
32593
32596
  if (handle !== void 0) {
32594
- await handle.kill("SIGTERM").catch(() => void 0);
32595
- await waitForExit2(handle);
32597
+ await stopAgentProcess(handle, EXIT_WAIT_MS, input2.host.log);
32596
32598
  }
32597
32599
  await removeRuntimeTempDir(runtimeTemp);
32598
32600
  await removeRuntimeTempDir(profile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-antigravity",
3
- "version": "0.2.3020",
3
+ "version": "0.2.3024",
4
4
  "description": "Google Antigravity executor: runs the Antigravity agent over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -31,9 +31,9 @@
31
31
  "typescript": "~6.0.3",
32
32
  "vite-plus": "0.2.2",
33
33
  "yauzl": "^3.4.0",
34
- "@ycodium-ai/plugin-api": "0.2.3020",
35
- "ycodium-acp-executor": "0.2.0",
36
- "ycodium-executor-testing": "0.0.0"
34
+ "@ycodium-ai/plugin-api": "0.2.3024",
35
+ "ycodium-executor-testing": "0.0.0",
36
+ "ycodium-acp-executor": "0.2.0"
37
37
  },
38
38
  "ycodium": {
39
39
  "plugin": "./dist/index.js",