@ycodium-ai/agent-antigravity 0.2.4343 → 0.2.4368
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 +119 -27
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1387,7 +1387,7 @@ var require_yauzl = __commonJS({
|
|
|
1387
1387
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
1388
1388
|
|
|
1389
1389
|
// ../../packages/plugin-api/src/version.ts
|
|
1390
|
-
var PLUGIN_API_VERSION =
|
|
1390
|
+
var PLUGIN_API_VERSION = 112;
|
|
1391
1391
|
|
|
1392
1392
|
// src/index.ts
|
|
1393
1393
|
import {
|
|
@@ -1768,9 +1768,11 @@ var AcpExecutorRequestError = class extends AcpExecutorError {
|
|
|
1768
1768
|
}
|
|
1769
1769
|
};
|
|
1770
1770
|
var AcpConnectionClosedError = class extends Error {
|
|
1771
|
+
reason;
|
|
1771
1772
|
constructor(message = "ACP connection closed", options2) {
|
|
1772
|
-
super(message, options2);
|
|
1773
|
+
super(message, options2?.cause === void 0 ? void 0 : { cause: options2.cause });
|
|
1773
1774
|
this.name = "AcpConnectionClosedError";
|
|
1775
|
+
this.reason = options2?.reason ?? "closed";
|
|
1774
1776
|
}
|
|
1775
1777
|
};
|
|
1776
1778
|
async function withStartupStderr(error62, stderrTail) {
|
|
@@ -1780,9 +1782,65 @@ async function withStartupStderr(error62, stderrTail) {
|
|
|
1780
1782
|
return new AcpConnectionClosedError(`${error62.message}
|
|
1781
1783
|
Agent stderr (last lines):
|
|
1782
1784
|
${tail}`, {
|
|
1783
|
-
cause: error62
|
|
1785
|
+
cause: error62,
|
|
1786
|
+
reason: error62.reason
|
|
1784
1787
|
});
|
|
1785
1788
|
}
|
|
1789
|
+
var AGENT_EXIT_STDERR_MAX_CHARS = 800;
|
|
1790
|
+
var AGENT_EXIT_SETTLE_MS = 500;
|
|
1791
|
+
var AcpAgentExitedError = class extends AcpConnectionClosedError {
|
|
1792
|
+
exitCode;
|
|
1793
|
+
constructor(message, exitCode, cause) {
|
|
1794
|
+
super(message, { cause, reason: "input-ended" });
|
|
1795
|
+
this.name = "AcpAgentExitedError";
|
|
1796
|
+
this.exitCode = exitCode;
|
|
1797
|
+
}
|
|
1798
|
+
};
|
|
1799
|
+
var REDACTION_MARKERS = ["[redacted]", "[pairing-url]"];
|
|
1800
|
+
var lastLines = (text, maxChars) => {
|
|
1801
|
+
if (text.length <= maxChars) return text;
|
|
1802
|
+
let start = text.length - maxChars;
|
|
1803
|
+
if (text[start - 1] !== "\n") {
|
|
1804
|
+
const lineEnd = text.indexOf("\n", start);
|
|
1805
|
+
if (lineEnd !== -1 && lineEnd < text.length - 1) return text.slice(lineEnd + 1);
|
|
1806
|
+
const code = text.charCodeAt(start);
|
|
1807
|
+
if (code >= 56320 && code <= 57343) start += 1;
|
|
1808
|
+
for (const marker of REDACTION_MARKERS) {
|
|
1809
|
+
const at = text.lastIndexOf(marker, start);
|
|
1810
|
+
if (at !== -1 && at < start && start < at + marker.length) start = at + marker.length;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
return text.slice(start);
|
|
1814
|
+
};
|
|
1815
|
+
var settledExitCode = async (exited) => {
|
|
1816
|
+
if (exited === void 0) return void 0;
|
|
1817
|
+
let timer;
|
|
1818
|
+
try {
|
|
1819
|
+
return await Promise.race([
|
|
1820
|
+
exited.catch(() => void 0),
|
|
1821
|
+
new Promise((resolve6) => {
|
|
1822
|
+
timer = setTimeout(() => resolve6(void 0), AGENT_EXIT_SETTLE_MS);
|
|
1823
|
+
})
|
|
1824
|
+
]);
|
|
1825
|
+
} finally {
|
|
1826
|
+
clearTimeout(timer);
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1829
|
+
async function describeAgentExit(input2) {
|
|
1830
|
+
const [exitCode, tail] = await Promise.all([
|
|
1831
|
+
settledExitCode(input2.exited),
|
|
1832
|
+
input2.stderrTail === void 0 ? "" : Promise.resolve().then(input2.stderrTail).catch(() => "")
|
|
1833
|
+
]);
|
|
1834
|
+
const head = exitCode === void 0 ? "The agent closed its connection." : exitCode === null ? "The agent process exited without an exit code." : `The agent process exited with code ${exitCode}.`;
|
|
1835
|
+
const excerpt = lastLines(tail.trim(), AGENT_EXIT_STDERR_MAX_CHARS);
|
|
1836
|
+
return new AcpAgentExitedError(
|
|
1837
|
+
excerpt.length === 0 ? head : `${head}
|
|
1838
|
+
Agent stderr (last lines):
|
|
1839
|
+
${excerpt}`,
|
|
1840
|
+
exitCode,
|
|
1841
|
+
input2.cause
|
|
1842
|
+
);
|
|
1843
|
+
}
|
|
1786
1844
|
|
|
1787
1845
|
// ../../packages/ycodium-acp-executor/src/event-stream.ts
|
|
1788
1846
|
var UnboundedEventStream = class {
|
|
@@ -26749,7 +26807,8 @@ function createAcpConnection(options2) {
|
|
|
26749
26807
|
options2.onInboundFailure?.(error62);
|
|
26750
26808
|
void shutdown(
|
|
26751
26809
|
new AcpConnectionClosedError(
|
|
26752
|
-
`ACP inbound handling failed: ${error62 instanceof Error ? error62.message : String(error62)}
|
|
26810
|
+
`ACP inbound handling failed: ${error62 instanceof Error ? error62.message : String(error62)}`,
|
|
26811
|
+
{ reason: "inbound-failed" }
|
|
26753
26812
|
)
|
|
26754
26813
|
);
|
|
26755
26814
|
};
|
|
@@ -26794,19 +26853,21 @@ function createAcpConnection(options2) {
|
|
|
26794
26853
|
} finally {
|
|
26795
26854
|
endInboundBatch();
|
|
26796
26855
|
}
|
|
26797
|
-
await shutdown(
|
|
26856
|
+
await shutdown(
|
|
26857
|
+
new AcpConnectionClosedError("ACP input stream ended", { reason: "input-ended" })
|
|
26858
|
+
);
|
|
26798
26859
|
});
|
|
26799
26860
|
};
|
|
26800
26861
|
const onError = (error62) => {
|
|
26801
26862
|
enqueueInbound(async () => {
|
|
26802
26863
|
await shutdown(
|
|
26803
|
-
error62 instanceof Error ? error62 : new AcpConnectionClosedError("ACP input stream error")
|
|
26864
|
+
error62 instanceof Error ? error62 : new AcpConnectionClosedError("ACP input stream error", { reason: "stream-error" })
|
|
26804
26865
|
);
|
|
26805
26866
|
});
|
|
26806
26867
|
};
|
|
26807
26868
|
const onWritableError = (error62) => {
|
|
26808
26869
|
void shutdown(
|
|
26809
|
-
error62 instanceof Error ? error62 : new AcpConnectionClosedError("ACP output stream error")
|
|
26870
|
+
error62 instanceof Error ? error62 : new AcpConnectionClosedError("ACP output stream error", { reason: "stream-error" })
|
|
26810
26871
|
);
|
|
26811
26872
|
};
|
|
26812
26873
|
options2.readable.on("data", onData);
|
|
@@ -26869,7 +26930,8 @@ function createAcpConnection(options2) {
|
|
|
26869
26930
|
awaitInboundIdle,
|
|
26870
26931
|
abandonPending,
|
|
26871
26932
|
close,
|
|
26872
|
-
closed
|
|
26933
|
+
closed,
|
|
26934
|
+
closeError: () => closedError
|
|
26873
26935
|
};
|
|
26874
26936
|
}
|
|
26875
26937
|
|
|
@@ -27278,7 +27340,8 @@ var ACP_FAILURE_CATEGORIES = [
|
|
|
27278
27340
|
"auth",
|
|
27279
27341
|
"model-unavailable",
|
|
27280
27342
|
"transport",
|
|
27281
|
-
"unknown"
|
|
27343
|
+
"unknown",
|
|
27344
|
+
"process-exit"
|
|
27282
27345
|
];
|
|
27283
27346
|
var isAcpFailureCategory = (value) => ACP_FAILURE_CATEGORIES.some((category) => category === value);
|
|
27284
27347
|
var readAcpFailureCategory = (error62) => {
|
|
@@ -27288,11 +27351,14 @@ var readAcpFailureCategory = (error62) => {
|
|
|
27288
27351
|
};
|
|
27289
27352
|
var withFailureCategory = (error62, category) => category === void 0 ? error62 : Object.assign(error62, { failureCategory: category });
|
|
27290
27353
|
var failureCategoryField = (category) => category === void 0 ? {} : { failureCategory: category };
|
|
27291
|
-
var
|
|
27354
|
+
var acpClosedConnectionCategory = (closeError, sessionEstablished, disposed) => {
|
|
27355
|
+
if (!sessionEstablished || disposed) return void 0;
|
|
27356
|
+
return closeError instanceof AcpConnectionClosedError && closeError.reason === "input-ended" ? "process-exit" : "transport";
|
|
27357
|
+
};
|
|
27292
27358
|
var acpPromptFailureCategory = (error62, input2) => {
|
|
27293
27359
|
const signaled = readAcpFailureCategory(error62);
|
|
27294
27360
|
if (signaled !== void 0) return signaled;
|
|
27295
|
-
return error62 instanceof AcpConnectionClosedError ?
|
|
27361
|
+
return error62 instanceof AcpConnectionClosedError ? acpClosedConnectionCategory(error62, input2.sessionEstablished, input2.disposed) : void 0;
|
|
27296
27362
|
};
|
|
27297
27363
|
|
|
27298
27364
|
// ../../packages/ycodium-acp-executor/src/tool-subagents.ts
|
|
@@ -27307,7 +27373,7 @@ var sealedHidden = (entry) => ({
|
|
|
27307
27373
|
});
|
|
27308
27374
|
function toolSubagentSettlementOfTurn(state, failureCategory) {
|
|
27309
27375
|
if (state === "cancelled") return "turn-interrupted";
|
|
27310
|
-
return state === "failed" && failureCategory === "
|
|
27376
|
+
return state === "failed" && failureCategory === "process-exit" ? "session-ended" : "turn-ended";
|
|
27311
27377
|
}
|
|
27312
27378
|
var sameFacts = (a, b) => a.title === b.title && a.description === b.description && a.summary === b.summary && a.role === b.role && a.model === b.model && a.effort === b.effort && a.rosterKind === b.rosterKind;
|
|
27313
27379
|
function linkage(taskId, toolCallId, facts) {
|
|
@@ -27924,14 +27990,19 @@ function createExecutorPrompt({
|
|
|
27924
27990
|
},
|
|
27925
27991
|
record2
|
|
27926
27992
|
);
|
|
27927
|
-
} catch (
|
|
27993
|
+
} catch (caught) {
|
|
27928
27994
|
if (shared.disposed) {
|
|
27929
27995
|
throw new AcpExecutorDisposedError();
|
|
27930
27996
|
}
|
|
27931
|
-
const failureCategory = acpPromptFailureCategory(
|
|
27997
|
+
const failureCategory = acpPromptFailureCategory(caught, {
|
|
27932
27998
|
sessionEstablished: shared.startResult !== void 0,
|
|
27933
27999
|
disposed: shared.disposed
|
|
27934
28000
|
});
|
|
28001
|
+
const error62 = failureCategory === "process-exit" && !interruptedTurnIds.has(turnId) ? await describeAgentExit({
|
|
28002
|
+
cause: caught,
|
|
28003
|
+
exited: options2.exited,
|
|
28004
|
+
stderrTail: options2.stderrTail
|
|
28005
|
+
}) : caught;
|
|
27935
28006
|
if (!interruptedTurnIds.has(turnId)) {
|
|
27936
28007
|
const errorMessage2 = error62 instanceof Error && error62.message.trim() || "ACP prompt failed";
|
|
27937
28008
|
if (settle2({
|
|
@@ -29320,24 +29391,40 @@ function createExecutorUpdates({
|
|
|
29320
29391
|
return;
|
|
29321
29392
|
}
|
|
29322
29393
|
};
|
|
29323
|
-
const
|
|
29324
|
-
for (const
|
|
29394
|
+
const emitHookEvents = (hookEvents) => {
|
|
29395
|
+
for (const hookEvent of hookEvents ?? []) {
|
|
29396
|
+
if (hookEvent.type === "runtime.warning") {
|
|
29397
|
+
const message = hookEvent.payload.message.trim();
|
|
29398
|
+
if (message.length === 0) continue;
|
|
29399
|
+
emit({
|
|
29400
|
+
type: "runtime.warning",
|
|
29401
|
+
...stamp(),
|
|
29402
|
+
provider: options2.provider,
|
|
29403
|
+
threadId: options2.threadId,
|
|
29404
|
+
...hookEvent.turnId !== void 0 ? { turnId: hookEvent.turnId } : {},
|
|
29405
|
+
payload: {
|
|
29406
|
+
message,
|
|
29407
|
+
...hookEvent.payload.detail !== void 0 ? { detail: hookEvent.payload.detail } : {}
|
|
29408
|
+
}
|
|
29409
|
+
});
|
|
29410
|
+
continue;
|
|
29411
|
+
}
|
|
29325
29412
|
emit({
|
|
29326
|
-
type:
|
|
29413
|
+
type: hookEvent.type,
|
|
29327
29414
|
...stamp(),
|
|
29328
29415
|
provider: options2.provider,
|
|
29329
29416
|
threadId: options2.threadId,
|
|
29330
|
-
...
|
|
29331
|
-
payload:
|
|
29417
|
+
...hookEvent.turnId !== void 0 ? { turnId: hookEvent.turnId } : {},
|
|
29418
|
+
payload: hookEvent.payload
|
|
29332
29419
|
});
|
|
29333
29420
|
}
|
|
29334
29421
|
};
|
|
29335
29422
|
const toolSubagents = hooks.toolSubagents === void 0 ? void 0 : createToolSubagentTracker(hooks.toolSubagents);
|
|
29336
|
-
const settleToolSubagents = (settlement, turnId) =>
|
|
29423
|
+
const settleToolSubagents = (settlement, turnId) => emitHookEvents(toolSubagents?.settle(settlement, turnId));
|
|
29337
29424
|
const settleSessionEnded = () => {
|
|
29338
29425
|
settleToolSubagents("session-ended");
|
|
29339
|
-
|
|
29340
|
-
|
|
29426
|
+
emitHookEvents(subagentSessions?.settleSessionEnded());
|
|
29427
|
+
emitHookEvents(hooks.onSessionEnded?.());
|
|
29341
29428
|
};
|
|
29342
29429
|
const observeContext = () => ({
|
|
29343
29430
|
turnId: shared.activeTurnId,
|
|
@@ -29399,7 +29486,7 @@ function createExecutorUpdates({
|
|
|
29399
29486
|
};
|
|
29400
29487
|
const hookResult = call === void 0 ? void 0 : toolSubagents?.onToolCallUpdated(call) ?? hooks.onToolCallUpdated?.(call);
|
|
29401
29488
|
const handledByHook = hookResult !== void 0 && "events" in hookResult && hookResult.handled === true;
|
|
29402
|
-
|
|
29489
|
+
emitHookEvents(
|
|
29403
29490
|
hookResult === void 0 ? [] : "events" in hookResult ? hookResult.events : hookResult
|
|
29404
29491
|
);
|
|
29405
29492
|
if (nextToolCall.status === "completed" && hookResult && "artifacts" in hookResult)
|
|
@@ -29496,7 +29583,7 @@ function createExecutorUpdates({
|
|
|
29496
29583
|
};
|
|
29497
29584
|
const receiveSessionUpdate = (params) => {
|
|
29498
29585
|
const foreign = !shared.ownSessionIds.has(params.sessionId) && (shared.childSessions.has(params.sessionId) || shared.sessionOpensInFlight === 0 && shared.ownSessionIds.size > 0);
|
|
29499
|
-
|
|
29586
|
+
emitHookEvents(
|
|
29500
29587
|
subagentSessions?.observe(params, {
|
|
29501
29588
|
turnId: shared.activeTurnId,
|
|
29502
29589
|
foreign,
|
|
@@ -29506,7 +29593,7 @@ function createExecutorUpdates({
|
|
|
29506
29593
|
);
|
|
29507
29594
|
if (!shared.sessionLoadInFlight) {
|
|
29508
29595
|
if (hooks.onSessionUpdate) {
|
|
29509
|
-
|
|
29596
|
+
emitHookEvents(hooks.onSessionUpdate(params, { ...observeContext(), foreign }));
|
|
29510
29597
|
}
|
|
29511
29598
|
}
|
|
29512
29599
|
if (!foreign) handleSessionUpdate(params);
|
|
@@ -29514,7 +29601,7 @@ function createExecutorUpdates({
|
|
|
29514
29601
|
const receiveExtensionNotification = (method, params) => {
|
|
29515
29602
|
if (shared.sessionLoadInFlight || !hooks.onExtensionNotification) return;
|
|
29516
29603
|
const result = hooks.onExtensionNotification(method, params, observeContext());
|
|
29517
|
-
if (Array.isArray(result))
|
|
29604
|
+
if (Array.isArray(result)) emitHookEvents(result);
|
|
29518
29605
|
};
|
|
29519
29606
|
return {
|
|
29520
29607
|
emitCompactionState,
|
|
@@ -29809,7 +29896,11 @@ function createAcpExecutor(options2) {
|
|
|
29809
29896
|
settleAllUserInputs();
|
|
29810
29897
|
abortPendingSettlement(
|
|
29811
29898
|
"connection closed",
|
|
29812
|
-
|
|
29899
|
+
acpClosedConnectionCategory(
|
|
29900
|
+
connection.closeError(),
|
|
29901
|
+
shared.startResult !== void 0,
|
|
29902
|
+
shared.disposed
|
|
29903
|
+
)
|
|
29813
29904
|
);
|
|
29814
29905
|
shared.promptWaiters.splice(0).forEach((wake) => wake());
|
|
29815
29906
|
},
|
|
@@ -31549,6 +31640,7 @@ function createAntigravitySession({
|
|
|
31549
31640
|
readable,
|
|
31550
31641
|
writable,
|
|
31551
31642
|
stderrTail,
|
|
31643
|
+
exited: handle.exited,
|
|
31552
31644
|
cwd,
|
|
31553
31645
|
threadId: input2.threadId,
|
|
31554
31646
|
provider: ANTIGRAVITY_DRIVER_KIND,
|
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.4368",
|
|
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-
|
|
35
|
-
"ycodium-executor
|
|
36
|
-
"
|
|
34
|
+
"@ycodium-ai/plugin-api": "0.2.4368",
|
|
35
|
+
"ycodium-acp-executor": "0.2.4368",
|
|
36
|
+
"ycodium-executor-testing": "0.0.0"
|
|
37
37
|
},
|
|
38
38
|
"ycodium": {
|
|
39
39
|
"plugin": "./dist/index.js",
|