@ycodium-ai/agent-antigravity 0.2.3202 → 0.2.3208
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.
- package/dist/index.js +159 -48
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -28812,6 +28812,9 @@ function createAcpSessionRegistry(threads, stopBooked) {
|
|
|
28812
28812
|
if (!booked) return Promise.resolve();
|
|
28813
28813
|
booked.closing ??= Promise.resolve().then(() => stopBooked(booked)).then(() => {
|
|
28814
28814
|
if (threads.get(threadId) === booked) threads.delete(threadId);
|
|
28815
|
+
}).catch((cause) => {
|
|
28816
|
+
if (threads.get(threadId) === booked) delete booked.closing;
|
|
28817
|
+
throw cause;
|
|
28815
28818
|
});
|
|
28816
28819
|
return booked.closing;
|
|
28817
28820
|
};
|
|
@@ -28821,6 +28824,61 @@ function createAcpSessionRegistry(threads, stopBooked) {
|
|
|
28821
28824
|
return { requireThread, stopSession, stopAll };
|
|
28822
28825
|
}
|
|
28823
28826
|
|
|
28827
|
+
// ../../packages/ycodium-acp-executor/src/session-cleanup.ts
|
|
28828
|
+
var reportedForwardingFailures = /* @__PURE__ */ new WeakSet();
|
|
28829
|
+
async function cleanupAcpSession(input2) {
|
|
28830
|
+
const failures = [];
|
|
28831
|
+
const forwarding = input2.forwarding.catch((cause) => {
|
|
28832
|
+
if (reportedForwardingFailures.has(input2.forwarding)) return;
|
|
28833
|
+
reportedForwardingFailures.add(input2.forwarding);
|
|
28834
|
+
failures.push(new Error(`forwarding failed: ${String(cause)}`, { cause }));
|
|
28835
|
+
});
|
|
28836
|
+
for (const [step, cleanup] of [
|
|
28837
|
+
["executor.dispose", () => input2.executor.dispose()],
|
|
28838
|
+
["stopProcess", input2.stopProcess],
|
|
28839
|
+
["forwarding", () => forwarding]
|
|
28840
|
+
]) {
|
|
28841
|
+
try {
|
|
28842
|
+
await cleanup();
|
|
28843
|
+
} catch (cause) {
|
|
28844
|
+
failures.push(new Error(`${step} failed: ${String(cause)}`, { cause }));
|
|
28845
|
+
}
|
|
28846
|
+
}
|
|
28847
|
+
if (failures.length > 0) {
|
|
28848
|
+
throw new AggregateError(failures, failures.map((error62) => error62.message).join("; "));
|
|
28849
|
+
}
|
|
28850
|
+
}
|
|
28851
|
+
async function cleanupAcpStartup(input2) {
|
|
28852
|
+
try {
|
|
28853
|
+
await cleanupAcpSession(input2);
|
|
28854
|
+
return true;
|
|
28855
|
+
} catch (cleanupError) {
|
|
28856
|
+
input2.log.warn("ACP session startup cleanup failed", {
|
|
28857
|
+
threadId: input2.threadId,
|
|
28858
|
+
error: String(cleanupError)
|
|
28859
|
+
});
|
|
28860
|
+
return false;
|
|
28861
|
+
}
|
|
28862
|
+
}
|
|
28863
|
+
function createRetryableClose(run) {
|
|
28864
|
+
let task;
|
|
28865
|
+
return () => {
|
|
28866
|
+
if (task) return task;
|
|
28867
|
+
const done = Promise.withResolvers();
|
|
28868
|
+
const current = done.promise;
|
|
28869
|
+
task = current;
|
|
28870
|
+
void current.catch(() => {
|
|
28871
|
+
if (task === current) task = void 0;
|
|
28872
|
+
});
|
|
28873
|
+
try {
|
|
28874
|
+
run().then(done.resolve, done.reject);
|
|
28875
|
+
} catch (cause) {
|
|
28876
|
+
done.reject(cause);
|
|
28877
|
+
}
|
|
28878
|
+
return current;
|
|
28879
|
+
};
|
|
28880
|
+
}
|
|
28881
|
+
|
|
28824
28882
|
// ../../packages/ycodium-acp-executor/src/start-abort.ts
|
|
28825
28883
|
function throwIfStartAborted(signal) {
|
|
28826
28884
|
if (signal?.aborted) throw new Error("aborted");
|
|
@@ -29187,37 +29245,63 @@ async function* watchAgentStderr(source, onLoginPrompt, onBrowserHelperLine) {
|
|
|
29187
29245
|
async function waitForExit(handle, timeoutMs, clock) {
|
|
29188
29246
|
let cancel = () => {
|
|
29189
29247
|
};
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
() => true,
|
|
29193
|
-
() =>
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
|
|
29198
|
-
|
|
29199
|
-
|
|
29200
|
-
return exited;
|
|
29248
|
+
try {
|
|
29249
|
+
return await Promise.race([
|
|
29250
|
+
handle.exited.then(() => true),
|
|
29251
|
+
new Promise((resolve6) => {
|
|
29252
|
+
cancel = clock.delay(timeoutMs, () => resolve6(false));
|
|
29253
|
+
})
|
|
29254
|
+
]);
|
|
29255
|
+
} finally {
|
|
29256
|
+
cancel();
|
|
29257
|
+
}
|
|
29201
29258
|
}
|
|
29202
29259
|
function stopAgentProcess(handle, exitWaitMs, log, clock = realAgentClock) {
|
|
29203
|
-
let
|
|
29204
|
-
if (
|
|
29205
|
-
|
|
29206
|
-
|
|
29260
|
+
let stopper = stoppersByHandle.get(handle);
|
|
29261
|
+
if (stopper === void 0) {
|
|
29262
|
+
const created = {
|
|
29263
|
+
args: { exitWaitMs, log, clock },
|
|
29264
|
+
stop: createRetryableClose(
|
|
29265
|
+
() => terminate(handle, created.args.exitWaitMs, created.args.log, created.args.clock)
|
|
29266
|
+
)
|
|
29267
|
+
};
|
|
29268
|
+
stoppersByHandle.set(handle, created);
|
|
29269
|
+
stopper = created;
|
|
29207
29270
|
}
|
|
29208
|
-
|
|
29271
|
+
stopper.args = { exitWaitMs, log, clock };
|
|
29272
|
+
return stopper.stop();
|
|
29209
29273
|
}
|
|
29210
|
-
var
|
|
29274
|
+
var stoppersByHandle = /* @__PURE__ */ new WeakMap();
|
|
29211
29275
|
async function terminate(handle, exitWaitMs, log, clock) {
|
|
29212
|
-
|
|
29213
|
-
|
|
29214
|
-
|
|
29215
|
-
|
|
29216
|
-
|
|
29217
|
-
|
|
29218
|
-
|
|
29219
|
-
|
|
29220
|
-
|
|
29276
|
+
const failures = [];
|
|
29277
|
+
for (const signal of ["SIGTERM", "SIGKILL"]) {
|
|
29278
|
+
try {
|
|
29279
|
+
await handle.kill(signal);
|
|
29280
|
+
} catch (cause) {
|
|
29281
|
+
failures.push(new Error(`${signal} failed: ${String(cause)}`, { cause }));
|
|
29282
|
+
}
|
|
29283
|
+
try {
|
|
29284
|
+
if (await waitForExit(handle, exitWaitMs, clock)) {
|
|
29285
|
+
if (failures.length > 0) {
|
|
29286
|
+
log.warn("the agent process exited after a signal failed", {
|
|
29287
|
+
pid: handle.pid,
|
|
29288
|
+
error: failures.map((error62) => error62.message).join("; ")
|
|
29289
|
+
});
|
|
29290
|
+
}
|
|
29291
|
+
return;
|
|
29292
|
+
}
|
|
29293
|
+
} catch (cause) {
|
|
29294
|
+
failures.push(new Error(`waitForExit after ${signal} failed: ${String(cause)}`, { cause }));
|
|
29295
|
+
}
|
|
29296
|
+
if (signal === "SIGTERM") {
|
|
29297
|
+
log.warn("the agent process ignored SIGTERM; killing it", { pid: handle.pid, exitWaitMs });
|
|
29298
|
+
} else {
|
|
29299
|
+
const message = "the agent process is still running after SIGKILL; leaving it behind";
|
|
29300
|
+
log.error(message, { pid: handle.pid, exitWaitMs });
|
|
29301
|
+
failures.push(new Error(message));
|
|
29302
|
+
}
|
|
29303
|
+
}
|
|
29304
|
+
throw new AggregateError(failures, failures.map((error62) => error62.message).join("; "));
|
|
29221
29305
|
}
|
|
29222
29306
|
async function openAgentProcess(input2) {
|
|
29223
29307
|
await prepareAntigravityProfile(input2.profile);
|
|
@@ -29282,7 +29366,13 @@ async function openAgentProcess(input2) {
|
|
|
29282
29366
|
const close = () => {
|
|
29283
29367
|
closing ??= (async () => {
|
|
29284
29368
|
await connection.close().catch(() => void 0);
|
|
29285
|
-
await stopAgentProcess(handle, input2.exitWaitMs, input2.host.log, clock)
|
|
29369
|
+
await stopAgentProcess(handle, input2.exitWaitMs, input2.host.log, clock).catch(
|
|
29370
|
+
(error62) => {
|
|
29371
|
+
input2.host.log.warn("could not confirm the agent process exited", {
|
|
29372
|
+
error: String(error62)
|
|
29373
|
+
});
|
|
29374
|
+
}
|
|
29375
|
+
);
|
|
29286
29376
|
await removeRuntimeTempDir(directory);
|
|
29287
29377
|
})();
|
|
29288
29378
|
return closing;
|
|
@@ -30466,10 +30556,14 @@ function createAntigravitySession({
|
|
|
30466
30556
|
});
|
|
30467
30557
|
return session;
|
|
30468
30558
|
} catch (error62) {
|
|
30469
|
-
|
|
30470
|
-
|
|
30471
|
-
|
|
30472
|
-
|
|
30559
|
+
const cleaned = await cleanupAcpStartup({
|
|
30560
|
+
executor,
|
|
30561
|
+
stopProcess: () => stopAgentProcess(handle, exitWaitMs, host.log, clock),
|
|
30562
|
+
forwarding,
|
|
30563
|
+
log: host.log,
|
|
30564
|
+
threadId: input2.threadId
|
|
30565
|
+
});
|
|
30566
|
+
if (cleaned) await removeRuntimeTempDir(runtimeTemp);
|
|
30473
30567
|
if (live.signInRequired || isSignInRequiredError(error62)) {
|
|
30474
30568
|
await noteSession(() => login.noteSessionSignedOut());
|
|
30475
30569
|
throw new AntigravitySignInRequiredError();
|
|
@@ -32025,7 +32119,13 @@ function createAntigravityTextGeneration(deps) {
|
|
|
32025
32119
|
stopped = true;
|
|
32026
32120
|
await executor?.dispose().catch(() => void 0);
|
|
32027
32121
|
if (handle !== void 0)
|
|
32028
|
-
await stopAgentProcess(handle, deps.exitWaitMs, deps.host.log, clock)
|
|
32122
|
+
await stopAgentProcess(handle, deps.exitWaitMs, deps.host.log, clock).catch(
|
|
32123
|
+
(error62) => {
|
|
32124
|
+
deps.host.log.warn("could not confirm the text generation process exited", {
|
|
32125
|
+
error: String(error62)
|
|
32126
|
+
});
|
|
32127
|
+
}
|
|
32128
|
+
);
|
|
32029
32129
|
await pump?.catch(() => void 0);
|
|
32030
32130
|
if (runtimeTemp !== void 0) await removeRuntimeTempDir(runtimeTemp);
|
|
32031
32131
|
if (workspace !== void 0) {
|
|
@@ -32332,7 +32432,6 @@ async function createAntigravityInstance(config2, host, deps) {
|
|
|
32332
32432
|
const events = new EventBus();
|
|
32333
32433
|
const threads = /* @__PURE__ */ new Map();
|
|
32334
32434
|
const mutable = { disposed: false };
|
|
32335
|
-
let disposeTask;
|
|
32336
32435
|
const unregister = deps.runtime.registerInstance({
|
|
32337
32436
|
instanceId: host.instanceId,
|
|
32338
32437
|
host,
|
|
@@ -32347,9 +32446,11 @@ async function createAntigravityInstance(config2, host, deps) {
|
|
|
32347
32446
|
const resolveExecutable = () => deps.runtime.resolve(resolveInput);
|
|
32348
32447
|
const stopBooked = async (booked) => {
|
|
32349
32448
|
for (const stopped of booked.background.finish()) events.push(stopped);
|
|
32350
|
-
await
|
|
32351
|
-
|
|
32352
|
-
|
|
32449
|
+
await cleanupAcpSession({
|
|
32450
|
+
executor: booked.executor,
|
|
32451
|
+
stopProcess: () => stopAgentProcess(booked.handle, exitWaitMs, host.log, clock),
|
|
32452
|
+
forwarding: booked.forwarding
|
|
32453
|
+
});
|
|
32353
32454
|
if (!await removeRuntimeTempDir(booked.runtimeTemp)) {
|
|
32354
32455
|
host.log.warn("could not remove a runtime temp directory; it is swept on the next start", {
|
|
32355
32456
|
directory: booked.runtimeTemp
|
|
@@ -32404,6 +32505,21 @@ async function createAntigravityInstance(config2, host, deps) {
|
|
|
32404
32505
|
runtimeSeen = state;
|
|
32405
32506
|
void login.syncProgram();
|
|
32406
32507
|
});
|
|
32508
|
+
let unregistered = false;
|
|
32509
|
+
const disposeOnce = createRetryableClose(async () => {
|
|
32510
|
+
if (!unregistered) {
|
|
32511
|
+
unregistered = true;
|
|
32512
|
+
unregisterLogin();
|
|
32513
|
+
unsubscribeRuntime();
|
|
32514
|
+
try {
|
|
32515
|
+
await login.dispose();
|
|
32516
|
+
} finally {
|
|
32517
|
+
unregister();
|
|
32518
|
+
}
|
|
32519
|
+
}
|
|
32520
|
+
await Promise.all([stopAll(), helpers.stopRunning()]);
|
|
32521
|
+
events.close();
|
|
32522
|
+
});
|
|
32407
32523
|
const signedInFile = signedInMarkerFile(dirs.profile);
|
|
32408
32524
|
const noteSession = (note) => note().catch((error62) => {
|
|
32409
32525
|
host.log.warn("could not update the signed-in marker", {
|
|
@@ -32576,17 +32692,8 @@ async function createAntigravityInstance(config2, host, deps) {
|
|
|
32576
32692
|
textGeneration: helpers.textGeneration,
|
|
32577
32693
|
continuationKey: dirs.continuationKey,
|
|
32578
32694
|
dispose: () => {
|
|
32579
|
-
if (disposeTask) return disposeTask;
|
|
32580
32695
|
mutable.disposed = true;
|
|
32581
|
-
|
|
32582
|
-
unregisterLogin();
|
|
32583
|
-
unsubscribeRuntime();
|
|
32584
|
-
await login.dispose();
|
|
32585
|
-
unregister();
|
|
32586
|
-
await Promise.all([stopAll(), helpers.stopRunning()]);
|
|
32587
|
-
events.close();
|
|
32588
|
-
})();
|
|
32589
|
-
return disposeTask;
|
|
32696
|
+
return disposeOnce();
|
|
32590
32697
|
}
|
|
32591
32698
|
};
|
|
32592
32699
|
return instance;
|
|
@@ -33191,7 +33298,11 @@ async function validateInstalledRuntime(input2) {
|
|
|
33191
33298
|
} finally {
|
|
33192
33299
|
await closeHandshake?.().catch(() => void 0);
|
|
33193
33300
|
if (handle !== void 0) {
|
|
33194
|
-
await stopAgentProcess(handle, EXIT_WAIT_MS, input2.host.log)
|
|
33301
|
+
await stopAgentProcess(handle, EXIT_WAIT_MS, input2.host.log).catch((error62) => {
|
|
33302
|
+
input2.host.log.warn("could not confirm the validation process exited", {
|
|
33303
|
+
error: String(error62)
|
|
33304
|
+
});
|
|
33305
|
+
});
|
|
33195
33306
|
}
|
|
33196
33307
|
await removeRuntimeTempDir(runtimeTemp);
|
|
33197
33308
|
await removeRuntimeTempDir(profile);
|
|
@@ -33661,7 +33772,7 @@ var executors = [
|
|
|
33661
33772
|
];
|
|
33662
33773
|
var index_default = definePlugin({
|
|
33663
33774
|
id: "agent-antigravity",
|
|
33664
|
-
apiVersion:
|
|
33775
|
+
apiVersion: 19,
|
|
33665
33776
|
executors,
|
|
33666
33777
|
activate(ctx) {
|
|
33667
33778
|
const runtime = createRuntimeManager({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-antigravity",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3208",
|
|
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.
|
|
34
|
+
"@ycodium-ai/plugin-api": "0.2.3208",
|
|
35
35
|
"ycodium-executor-testing": "0.0.0",
|
|
36
|
-
"ycodium-acp-executor": "0.2.
|
|
36
|
+
"ycodium-acp-executor": "0.2.3208"
|
|
37
37
|
},
|
|
38
38
|
"ycodium": {
|
|
39
39
|
"plugin": "./dist/index.js",
|