@ycodium-ai/agent-antigravity 0.2.3210 → 0.2.3214
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 +192 -85
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -28540,6 +28540,92 @@ function readOpenToolCalls(toolCalls, turnId) {
|
|
|
28540
28540
|
return running;
|
|
28541
28541
|
}
|
|
28542
28542
|
|
|
28543
|
+
// ../../packages/ycodium-acp-executor/src/protocol-log.ts
|
|
28544
|
+
import * as NodeFS from "node:fs";
|
|
28545
|
+
import * as NodeOS from "node:os";
|
|
28546
|
+
import * as NodePath2 from "node:path";
|
|
28547
|
+
var DEFAULT_MAX_BYTES = 8 * 1024 * 1024;
|
|
28548
|
+
var UNSAFE_FILE_CHARS = /[^A-Za-z0-9._-]+/gu;
|
|
28549
|
+
function safeFileName(value) {
|
|
28550
|
+
return value.replaceAll(UNSAFE_FILE_CHARS, "_");
|
|
28551
|
+
}
|
|
28552
|
+
function createAcpProtocolLogFile(input2) {
|
|
28553
|
+
const maxBytes = input2.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
28554
|
+
NodeFS.mkdirSync(input2.directory, { recursive: true });
|
|
28555
|
+
const filePath = NodePath2.join(
|
|
28556
|
+
input2.directory,
|
|
28557
|
+
`${safeFileName(input2.provider)}-${safeFileName(input2.threadId)}-${Date.now().toString(36)}.ndjson`
|
|
28558
|
+
);
|
|
28559
|
+
const stream = (input2.openStream ?? ((path) => NodeFS.createWriteStream(path, { flags: "a" })))(
|
|
28560
|
+
filePath
|
|
28561
|
+
);
|
|
28562
|
+
let bytes = 0;
|
|
28563
|
+
let stopped = false;
|
|
28564
|
+
const closed = Promise.withResolvers();
|
|
28565
|
+
let closing = false;
|
|
28566
|
+
stream.once("close", () => closed.resolve());
|
|
28567
|
+
stream.on("error", () => {
|
|
28568
|
+
stopped = true;
|
|
28569
|
+
stream.destroy();
|
|
28570
|
+
});
|
|
28571
|
+
const writeTruncated = () => {
|
|
28572
|
+
stopped = true;
|
|
28573
|
+
const marker = `${JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), stage: "truncated" })}
|
|
28574
|
+
`;
|
|
28575
|
+
if (bytes + Buffer.byteLength(marker) <= maxBytes) stream.write(marker);
|
|
28576
|
+
stream.end();
|
|
28577
|
+
};
|
|
28578
|
+
const writeLine = (value) => {
|
|
28579
|
+
if (stopped) return;
|
|
28580
|
+
const line = `${JSON.stringify(value)}
|
|
28581
|
+
`;
|
|
28582
|
+
const lineBytes = Buffer.byteLength(line);
|
|
28583
|
+
if (bytes + lineBytes > maxBytes) {
|
|
28584
|
+
writeTruncated();
|
|
28585
|
+
return;
|
|
28586
|
+
}
|
|
28587
|
+
bytes += lineBytes;
|
|
28588
|
+
stream.write(line);
|
|
28589
|
+
};
|
|
28590
|
+
return {
|
|
28591
|
+
path: filePath,
|
|
28592
|
+
write: (event) => writeLine({
|
|
28593
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
28594
|
+
direction: event.direction,
|
|
28595
|
+
stage: event.stage,
|
|
28596
|
+
payload: event.payload
|
|
28597
|
+
}),
|
|
28598
|
+
close: async () => {
|
|
28599
|
+
if (closing) return closed.promise;
|
|
28600
|
+
closing = true;
|
|
28601
|
+
stopped = true;
|
|
28602
|
+
stream.end();
|
|
28603
|
+
await closed.promise;
|
|
28604
|
+
}
|
|
28605
|
+
};
|
|
28606
|
+
}
|
|
28607
|
+
function createAcpProtocolLogFromEnv(input2) {
|
|
28608
|
+
const flag = process.env.YCODIUM_ACP_PROTOCOL_LOG;
|
|
28609
|
+
if (flag !== "1" && flag?.toLowerCase() !== "true") return void 0;
|
|
28610
|
+
const configured = process.env.YCODIUM_ACP_PROTOCOL_LOG_DIR?.trim();
|
|
28611
|
+
const directory = configured && configured.length > 0 ? configured : NodePath2.join(NodeOS.tmpdir(), "ycodium-acp-protocol");
|
|
28612
|
+
try {
|
|
28613
|
+
const sink = createAcpProtocolLogFile({
|
|
28614
|
+
directory,
|
|
28615
|
+
provider: input2.provider,
|
|
28616
|
+
threadId: input2.threadId
|
|
28617
|
+
});
|
|
28618
|
+
input2.log?.info("acp protocol frames are being recorded", { path: sink.path });
|
|
28619
|
+
return sink;
|
|
28620
|
+
} catch (error62) {
|
|
28621
|
+
input2.log?.warn?.("acp protocol frame log could not be opened", {
|
|
28622
|
+
directory,
|
|
28623
|
+
error: error62 instanceof Error ? error62.message : String(error62)
|
|
28624
|
+
});
|
|
28625
|
+
return void 0;
|
|
28626
|
+
}
|
|
28627
|
+
}
|
|
28628
|
+
|
|
28543
28629
|
// ../../packages/ycodium-acp-executor/src/executor.ts
|
|
28544
28630
|
var DEFAULT_CANCEL_GRACE_MS = 5e3;
|
|
28545
28631
|
function defaultNowIso() {
|
|
@@ -28648,9 +28734,16 @@ function createAcpExecutor(options2) {
|
|
|
28648
28734
|
});
|
|
28649
28735
|
const { rememberSettledPromptKey, abortPendingSettlement, settleFromNotification } = createExecutorSettlement({ hooks, shared });
|
|
28650
28736
|
const promptResults = createPromptResults({ options: options2, shared });
|
|
28737
|
+
const protocolLogSink = options2.protocolLog === void 0 ? createAcpProtocolLogFromEnv({
|
|
28738
|
+
provider: options2.provider,
|
|
28739
|
+
threadId: options2.threadId,
|
|
28740
|
+
...options2.log === void 0 ? {} : { log: options2.log }
|
|
28741
|
+
}) : void 0;
|
|
28742
|
+
const protocolLog = options2.protocolLog ?? protocolLogSink?.write;
|
|
28651
28743
|
const connection = createAcpConnection({
|
|
28652
28744
|
readable: options2.readable,
|
|
28653
28745
|
writable: options2.writable,
|
|
28746
|
+
...protocolLog === void 0 ? {} : { logger: protocolLog },
|
|
28654
28747
|
onInboundFailure: (error62) => {
|
|
28655
28748
|
options2.log?.warn?.("acp connection closed: an inbound request could not be answered", {
|
|
28656
28749
|
threadId: options2.threadId,
|
|
@@ -28747,7 +28840,11 @@ function createAcpExecutor(options2) {
|
|
|
28747
28840
|
notifyPromptSettled,
|
|
28748
28841
|
shared
|
|
28749
28842
|
});
|
|
28750
|
-
const {
|
|
28843
|
+
const {
|
|
28844
|
+
cancel,
|
|
28845
|
+
compact,
|
|
28846
|
+
dispose: disposeLifecycle
|
|
28847
|
+
} = createExecutorLifecycle({
|
|
28751
28848
|
promptResults,
|
|
28752
28849
|
failIfDisposed,
|
|
28753
28850
|
requireStarted,
|
|
@@ -28774,6 +28871,7 @@ function createAcpExecutor(options2) {
|
|
|
28774
28871
|
onInputDead,
|
|
28775
28872
|
shared
|
|
28776
28873
|
});
|
|
28874
|
+
let disposeOnce;
|
|
28777
28875
|
return {
|
|
28778
28876
|
get generation() {
|
|
28779
28877
|
return shared.generation;
|
|
@@ -28796,7 +28894,16 @@ function createAcpExecutor(options2) {
|
|
|
28796
28894
|
setNativeMode,
|
|
28797
28895
|
compact,
|
|
28798
28896
|
openToolCalls: () => readOpenToolCalls(toolCalls, shared.activeTurnId),
|
|
28799
|
-
dispose
|
|
28897
|
+
dispose: () => {
|
|
28898
|
+
disposeOnce ??= (async () => {
|
|
28899
|
+
try {
|
|
28900
|
+
await disposeLifecycle();
|
|
28901
|
+
} finally {
|
|
28902
|
+
await protocolLogSink?.close();
|
|
28903
|
+
}
|
|
28904
|
+
})();
|
|
28905
|
+
return disposeOnce;
|
|
28906
|
+
}
|
|
28800
28907
|
};
|
|
28801
28908
|
}
|
|
28802
28909
|
|
|
@@ -28987,8 +29094,8 @@ var realAgentClock = {
|
|
|
28987
29094
|
// src/profile.ts
|
|
28988
29095
|
import * as NodeCrypto2 from "node:crypto";
|
|
28989
29096
|
import * as NodeFSP from "node:fs/promises";
|
|
28990
|
-
import * as
|
|
28991
|
-
import * as
|
|
29097
|
+
import * as NodeOS2 from "node:os";
|
|
29098
|
+
import * as NodePath3 from "node:path";
|
|
28992
29099
|
import { mergeLaunchEnv } from "@ycodium-ai/plugin-api/executor";
|
|
28993
29100
|
|
|
28994
29101
|
// src/hostPlatform.ts
|
|
@@ -29002,9 +29109,9 @@ function sha256Hex(value) {
|
|
|
29002
29109
|
return NodeCrypto2.createHash("sha256").update(value).digest("hex");
|
|
29003
29110
|
}
|
|
29004
29111
|
function expandHomePath(value) {
|
|
29005
|
-
if (value === "~") return
|
|
29112
|
+
if (value === "~") return NodeOS2.homedir();
|
|
29006
29113
|
if (value.startsWith("~/") || value.startsWith("~\\")) {
|
|
29007
|
-
return
|
|
29114
|
+
return NodePath3.join(NodeOS2.homedir(), value.slice(2));
|
|
29008
29115
|
}
|
|
29009
29116
|
return value;
|
|
29010
29117
|
}
|
|
@@ -29012,12 +29119,12 @@ function resolveAntigravityDirectories(input2) {
|
|
|
29012
29119
|
const key = sha256Hex(input2.instanceId);
|
|
29013
29120
|
const homePath = input2.homePath.trim();
|
|
29014
29121
|
const custom2 = homePath.length > 0;
|
|
29015
|
-
const profile = custom2 ?
|
|
29122
|
+
const profile = custom2 ? NodePath3.resolve(expandHomePath(homePath)) : NodePath3.join(input2.dataDir, "profiles", key);
|
|
29016
29123
|
const continuationSource = custom2 ? `home\0${(input2.platform ?? HOST_PLATFORM) === "win32" ? profile.toLowerCase() : profile}` : `instance\0${input2.instanceId}`;
|
|
29017
29124
|
return {
|
|
29018
29125
|
profile,
|
|
29019
|
-
runtimeTempRoot:
|
|
29020
|
-
modelCacheFile:
|
|
29126
|
+
runtimeTempRoot: NodePath3.join(input2.dataDir, "tmp", key.slice(0, 12)),
|
|
29127
|
+
modelCacheFile: NodePath3.join(input2.dataDir, "model-cache", `${key}.json`),
|
|
29021
29128
|
continuationKey: `antigravity:profile:${sha256Hex(continuationSource).slice(0, 16)}`
|
|
29022
29129
|
};
|
|
29023
29130
|
}
|
|
@@ -29065,10 +29172,10 @@ function antigravityLaunchArgs(platform2 = HOST_PLATFORM) {
|
|
|
29065
29172
|
return platform2 === "linux" ? ["--uid="] : [];
|
|
29066
29173
|
}
|
|
29067
29174
|
async function prepareAntigravityProfile(profile) {
|
|
29068
|
-
const acpDirectory =
|
|
29175
|
+
const acpDirectory = NodePath3.join(profile, "antigravity-acp");
|
|
29069
29176
|
await NodeFSP.mkdir(acpDirectory, { recursive: true, mode: 448 });
|
|
29070
29177
|
await NodeFSP.writeFile(
|
|
29071
|
-
|
|
29178
|
+
NodePath3.join(acpDirectory, "settings.json"),
|
|
29072
29179
|
`${JSON.stringify({ auth: { type: "oauth-personal" } })}
|
|
29073
29180
|
`,
|
|
29074
29181
|
"utf8"
|
|
@@ -29077,13 +29184,13 @@ async function prepareAntigravityProfile(profile) {
|
|
|
29077
29184
|
var liveRuntimeTempDirs = /* @__PURE__ */ new Set();
|
|
29078
29185
|
async function createRuntimeTempDir(root) {
|
|
29079
29186
|
await NodeFSP.mkdir(root, { recursive: true, mode: 448 });
|
|
29080
|
-
const directory = await NodeFSP.mkdtemp(
|
|
29187
|
+
const directory = await NodeFSP.mkdtemp(NodePath3.join(root, RUN_DIR_PREFIX));
|
|
29081
29188
|
liveRuntimeTempDirs.add(directory);
|
|
29082
29189
|
return directory;
|
|
29083
29190
|
}
|
|
29084
29191
|
async function removeRuntimeTempDir(directory) {
|
|
29085
29192
|
liveRuntimeTempDirs.delete(directory);
|
|
29086
|
-
if (!
|
|
29193
|
+
if (!NodePath3.isAbsolute(directory) || !NodePath3.basename(directory).startsWith(RUN_DIR_PREFIX)) {
|
|
29087
29194
|
return false;
|
|
29088
29195
|
}
|
|
29089
29196
|
try {
|
|
@@ -29103,7 +29210,7 @@ async function sweepRuntimeTempDirs(root) {
|
|
|
29103
29210
|
let removed = 0;
|
|
29104
29211
|
for (const name of names) {
|
|
29105
29212
|
if (!name.startsWith(RUN_DIR_PREFIX)) continue;
|
|
29106
|
-
const directory =
|
|
29213
|
+
const directory = NodePath3.join(root, name);
|
|
29107
29214
|
if (liveRuntimeTempDirs.has(directory)) continue;
|
|
29108
29215
|
if (await removeRuntimeTempDir(directory)) removed += 1;
|
|
29109
29216
|
}
|
|
@@ -29590,16 +29697,16 @@ function createBackgroundCommandTracker(input2) {
|
|
|
29590
29697
|
|
|
29591
29698
|
// src/clientFiles.ts
|
|
29592
29699
|
import * as NodeFSP2 from "node:fs/promises";
|
|
29593
|
-
import * as
|
|
29700
|
+
import * as NodePath4 from "node:path";
|
|
29594
29701
|
var CLIENT_FILE_MAX_BYTES = 8 * 1024 * 1024;
|
|
29595
29702
|
function isRecord9(value) {
|
|
29596
29703
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29597
29704
|
}
|
|
29598
29705
|
function isInside(root, candidate) {
|
|
29599
|
-
const relative2 =
|
|
29706
|
+
const relative2 = NodePath4.relative(root, candidate);
|
|
29600
29707
|
if (relative2 === "") return true;
|
|
29601
|
-
const escapes = relative2 === ".." || relative2.startsWith(`..${
|
|
29602
|
-
return !escapes && !
|
|
29708
|
+
const escapes = relative2 === ".." || relative2.startsWith(`..${NodePath4.sep}`);
|
|
29709
|
+
return !escapes && !NodePath4.isAbsolute(relative2);
|
|
29603
29710
|
}
|
|
29604
29711
|
async function realpathOrSelf(target) {
|
|
29605
29712
|
try {
|
|
@@ -29612,13 +29719,13 @@ async function realTarget(resolved) {
|
|
|
29612
29719
|
try {
|
|
29613
29720
|
return await NodeFSP2.realpath(resolved);
|
|
29614
29721
|
} catch {
|
|
29615
|
-
const parent =
|
|
29722
|
+
const parent = NodePath4.dirname(resolved);
|
|
29616
29723
|
if (parent === resolved) return resolved;
|
|
29617
|
-
return
|
|
29724
|
+
return NodePath4.join(await realTarget(parent), NodePath4.basename(resolved));
|
|
29618
29725
|
}
|
|
29619
29726
|
}
|
|
29620
29727
|
async function resolveInside(requestPath, cwd, roots) {
|
|
29621
|
-
const target = await realTarget(
|
|
29728
|
+
const target = await realTarget(NodePath4.resolve(cwd, requestPath));
|
|
29622
29729
|
const realRoots = await Promise.all(roots.map(realpathOrSelf));
|
|
29623
29730
|
if (!realRoots.some((root) => isInside(root, target))) {
|
|
29624
29731
|
throw RequestError.invalidParams(
|
|
@@ -29680,7 +29787,7 @@ async function writeTextFile(params, roots) {
|
|
|
29680
29787
|
const content = requireString(params, "content");
|
|
29681
29788
|
const filePath = await resolveInside(requestPath, roots.cwd, [roots.cwd]);
|
|
29682
29789
|
try {
|
|
29683
|
-
await NodeFSP2.mkdir(
|
|
29790
|
+
await NodeFSP2.mkdir(NodePath4.dirname(filePath), { recursive: true });
|
|
29684
29791
|
await NodeFSP2.writeFile(filePath, content, "utf8");
|
|
29685
29792
|
} catch {
|
|
29686
29793
|
throw RequestError.internalError(void 0, `Could not write '${requestPath}'.`);
|
|
@@ -29701,7 +29808,7 @@ function createClientFileHandler(roots) {
|
|
|
29701
29808
|
|
|
29702
29809
|
// src/modelCache.ts
|
|
29703
29810
|
import * as NodeFSP3 from "node:fs/promises";
|
|
29704
|
-
import * as
|
|
29811
|
+
import * as NodePath5 from "node:path";
|
|
29705
29812
|
var SCHEMA_VERSION = 1;
|
|
29706
29813
|
function isRecord10(value) {
|
|
29707
29814
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -29781,7 +29888,7 @@ function updateAntigravityModelCache(file2, patch) {
|
|
|
29781
29888
|
...currentModel === void 0 ? {} : { currentModel },
|
|
29782
29889
|
models: catalog?.models ?? existing?.models ?? []
|
|
29783
29890
|
};
|
|
29784
|
-
await NodeFSP3.mkdir(
|
|
29891
|
+
await NodeFSP3.mkdir(NodePath5.dirname(file2), { recursive: true });
|
|
29785
29892
|
const temporary = `${file2}.${String(process.pid)}.tmp`;
|
|
29786
29893
|
await NodeFSP3.writeFile(temporary, `${JSON.stringify(merged)}
|
|
29787
29894
|
`, "utf8");
|
|
@@ -30070,8 +30177,8 @@ function antigravityPermissionUserInput(request2) {
|
|
|
30070
30177
|
|
|
30071
30178
|
// src/userSkills.ts
|
|
30072
30179
|
import * as NodeFSP4 from "node:fs/promises";
|
|
30073
|
-
import * as
|
|
30074
|
-
import * as
|
|
30180
|
+
import * as NodeOS3 from "node:os";
|
|
30181
|
+
import * as NodePath6 from "node:path";
|
|
30075
30182
|
var ANTIGRAVITY_SKILL_SCAN_LIMITS = {
|
|
30076
30183
|
maxSkillBytes: 1e6,
|
|
30077
30184
|
maxScanBytes: 8e6,
|
|
@@ -30083,30 +30190,30 @@ function resolveAntigravityUserHome(platform2, environment) {
|
|
|
30083
30190
|
if (environment["HOMEDRIVE"] && environment["HOMEPATH"]) {
|
|
30084
30191
|
return `${environment["HOMEDRIVE"]}${environment["HOMEPATH"]}`;
|
|
30085
30192
|
}
|
|
30086
|
-
return
|
|
30193
|
+
return NodeOS3.homedir();
|
|
30087
30194
|
}
|
|
30088
|
-
return environment["HOME"] ||
|
|
30195
|
+
return environment["HOME"] || NodeOS3.homedir();
|
|
30089
30196
|
}
|
|
30090
30197
|
function antigravityUserSkillDirectories(geminiHome) {
|
|
30091
30198
|
return [
|
|
30092
|
-
|
|
30093
|
-
|
|
30199
|
+
NodePath6.join(geminiHome, "config", "skills"),
|
|
30200
|
+
NodePath6.join(geminiHome, "antigravity-cli", "skills")
|
|
30094
30201
|
];
|
|
30095
30202
|
}
|
|
30096
30203
|
var sameFilePath = (platform2, left, right) => platform2 === "win32" ? left.toLowerCase() === right.toLowerCase() : left === right;
|
|
30097
30204
|
async function linkOne(link, target, platform2) {
|
|
30098
|
-
if (sameFilePath(platform2,
|
|
30205
|
+
if (sameFilePath(platform2, NodePath6.resolve(link), target)) return "kept";
|
|
30099
30206
|
const existing = await NodeFSP4.lstat(link).catch((error62) => {
|
|
30100
30207
|
if (error62.code === "ENOENT") return void 0;
|
|
30101
30208
|
throw error62;
|
|
30102
30209
|
});
|
|
30103
30210
|
if (existing !== void 0) {
|
|
30104
30211
|
if (!existing.isSymbolicLink()) return "kept";
|
|
30105
|
-
const current =
|
|
30212
|
+
const current = NodePath6.resolve(NodePath6.dirname(link), await NodeFSP4.readlink(link));
|
|
30106
30213
|
if (sameFilePath(platform2, current, target)) return "already";
|
|
30107
30214
|
await NodeFSP4.unlink(link);
|
|
30108
30215
|
}
|
|
30109
|
-
await NodeFSP4.mkdir(
|
|
30216
|
+
await NodeFSP4.mkdir(NodePath6.dirname(link), { recursive: true });
|
|
30110
30217
|
try {
|
|
30111
30218
|
await NodeFSP4.symlink(target, link, platform2 === "win32" ? "junction" : "dir");
|
|
30112
30219
|
} catch (error62) {
|
|
@@ -30117,7 +30224,7 @@ async function linkOne(link, target, platform2) {
|
|
|
30117
30224
|
async function linkAntigravityUserSkills(input2) {
|
|
30118
30225
|
const links = antigravityUserSkillDirectories(input2.profile);
|
|
30119
30226
|
const targets = antigravityUserSkillDirectories(
|
|
30120
|
-
|
|
30227
|
+
NodePath6.resolve(NodePath6.join(input2.userHome, ".gemini"))
|
|
30121
30228
|
);
|
|
30122
30229
|
const results = [];
|
|
30123
30230
|
for (const [index, link] of links.entries()) {
|
|
@@ -30250,7 +30357,7 @@ async function readSkillFile(skillPath, budget, maxSkillBytes) {
|
|
|
30250
30357
|
}
|
|
30251
30358
|
}
|
|
30252
30359
|
async function discoverAntigravityUserSkills(userHome, limits = ANTIGRAVITY_SKILL_SCAN_LIMITS) {
|
|
30253
|
-
const roots = antigravityUserSkillDirectories(
|
|
30360
|
+
const roots = antigravityUserSkillDirectories(NodePath6.join(userHome, ".gemini"));
|
|
30254
30361
|
const budget = {
|
|
30255
30362
|
remainingBytes: limits.maxScanBytes,
|
|
30256
30363
|
remainingEntries: limits.maxScanEntries
|
|
@@ -30274,7 +30381,7 @@ async function discoverAntigravityUserSkills(userHome, limits = ANTIGRAVITY_SKIL
|
|
|
30274
30381
|
const skillFileName = sorted.find((entry) => entry.toLowerCase() === "skill.md");
|
|
30275
30382
|
if (skillFileName !== void 0) {
|
|
30276
30383
|
if (!skillFileName.endsWith(".md")) return;
|
|
30277
|
-
const skillPath =
|
|
30384
|
+
const skillPath = NodePath6.join(directory, skillFileName);
|
|
30278
30385
|
const contents = await readSkillFile(skillPath, budget, limits.maxSkillBytes);
|
|
30279
30386
|
if (contents === void 0) return;
|
|
30280
30387
|
const skill = parseSkillFile(contents, skillFileName);
|
|
@@ -30290,7 +30397,7 @@ async function discoverAntigravityUserSkills(userHome, limits = ANTIGRAVITY_SKIL
|
|
|
30290
30397
|
}
|
|
30291
30398
|
if (!scanChildren) return;
|
|
30292
30399
|
for (const entry of sorted.toSorted(compareSkillEntries)) {
|
|
30293
|
-
await scanDirectory(
|
|
30400
|
+
await scanDirectory(NodePath6.join(directory, entry), false);
|
|
30294
30401
|
}
|
|
30295
30402
|
};
|
|
30296
30403
|
for (const root of roots) await scanDirectory(root, true);
|
|
@@ -30825,12 +30932,12 @@ function forwardCallback(callback, timeoutMs = FORWARD_TIMEOUT_MS) {
|
|
|
30825
30932
|
|
|
30826
30933
|
// src/runtime.ts
|
|
30827
30934
|
import * as NodeFSP6 from "node:fs/promises";
|
|
30828
|
-
import * as
|
|
30935
|
+
import * as NodePath8 from "node:path";
|
|
30829
30936
|
|
|
30830
30937
|
// src/managedRuntime.ts
|
|
30831
30938
|
import * as NodeCrypto5 from "node:crypto";
|
|
30832
30939
|
import * as NodeFSP5 from "node:fs/promises";
|
|
30833
|
-
import * as
|
|
30940
|
+
import * as NodePath7 from "node:path";
|
|
30834
30941
|
var RELEASE_RECORD_FILE = ".install-complete.json";
|
|
30835
30942
|
var RELEASE_ID_PATTERN = /^[a-f0-9]{64}$/u;
|
|
30836
30943
|
var RECORD_MAX_BYTES = 8 * 1024;
|
|
@@ -30838,15 +30945,15 @@ var ManagedRuntimeInvalidError = class extends Error {
|
|
|
30838
30945
|
name = "ManagedRuntimeInvalidError";
|
|
30839
30946
|
};
|
|
30840
30947
|
function managedLayout(dataDir, platform2, arch2) {
|
|
30841
|
-
const root =
|
|
30948
|
+
const root = NodePath7.join(dataDir, "runtime", `${platform2}-${arch2}`);
|
|
30842
30949
|
return {
|
|
30843
30950
|
root,
|
|
30844
|
-
versionsDir:
|
|
30845
|
-
activeFile:
|
|
30951
|
+
versionsDir: NodePath7.join(root, "versions"),
|
|
30952
|
+
activeFile: NodePath7.join(root, "active.json")
|
|
30846
30953
|
};
|
|
30847
30954
|
}
|
|
30848
30955
|
function versionDirectoryOf(layout, releaseId) {
|
|
30849
|
-
return
|
|
30956
|
+
return NodePath7.join(layout.versionsDir, releaseId);
|
|
30850
30957
|
}
|
|
30851
30958
|
function isRecord14(value) {
|
|
30852
30959
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -30904,7 +31011,7 @@ async function readCompletedRelease(input2) {
|
|
|
30904
31011
|
const directory = versionDirectoryOf(input2.layout, input2.releaseId);
|
|
30905
31012
|
let parsed;
|
|
30906
31013
|
try {
|
|
30907
|
-
parsed = await readSmallJson(
|
|
31014
|
+
parsed = await readSmallJson(NodePath7.join(directory, RELEASE_RECORD_FILE));
|
|
30908
31015
|
} catch (error62) {
|
|
30909
31016
|
if (isMissing2(error62)) throw incomplete;
|
|
30910
31017
|
throw error62;
|
|
@@ -30916,8 +31023,8 @@ async function readCompletedRelease(input2) {
|
|
|
30916
31023
|
if (parsed["releaseId"] !== input2.releaseId || executable === void 0 || harness === void 0 || typeof version2 !== "string" || version2.trim().length === 0 || executable.name !== input2.names.executable || harness.name !== input2.names.harness) {
|
|
30917
31024
|
throw incomplete;
|
|
30918
31025
|
}
|
|
30919
|
-
const executablePath =
|
|
30920
|
-
const harnessPath =
|
|
31026
|
+
const executablePath = NodePath7.join(directory, executable.name);
|
|
31027
|
+
const harnessPath = NodePath7.join(directory, harness.name);
|
|
30921
31028
|
if (!await isExecutableFile(executablePath, executable.bytes, input2.platform) || !await isExecutableFile(harnessPath, harness.bytes, input2.platform)) {
|
|
30922
31029
|
throw incomplete;
|
|
30923
31030
|
}
|
|
@@ -30936,7 +31043,7 @@ async function readActiveRelease(input2) {
|
|
|
30936
31043
|
}
|
|
30937
31044
|
async function writeReleaseRecord(directory, record2) {
|
|
30938
31045
|
await NodeFSP5.writeFile(
|
|
30939
|
-
|
|
31046
|
+
NodePath7.join(directory, RELEASE_RECORD_FILE),
|
|
30940
31047
|
`${JSON.stringify(record2)}
|
|
30941
31048
|
`,
|
|
30942
31049
|
{ flag: "wx", mode: 384 }
|
|
@@ -30944,7 +31051,7 @@ async function writeReleaseRecord(directory, record2) {
|
|
|
30944
31051
|
}
|
|
30945
31052
|
async function writeActiveRelease(layout, releaseId) {
|
|
30946
31053
|
await NodeFSP5.mkdir(layout.root, { recursive: true });
|
|
30947
|
-
const pending =
|
|
31054
|
+
const pending = NodePath7.join(
|
|
30948
31055
|
layout.root,
|
|
30949
31056
|
`active.json.${NodeCrypto5.randomBytes(6).toString("hex")}.tmp`
|
|
30950
31057
|
);
|
|
@@ -30992,14 +31099,14 @@ function readPathValue(instanceEnvironment, processEnv, platform2) {
|
|
|
30992
31099
|
return lookup(instanceEnvironment) ?? lookup(processEnv) ?? "";
|
|
30993
31100
|
}
|
|
30994
31101
|
function pathCandidates(binary, pathValue) {
|
|
30995
|
-
return pathValue.split(
|
|
31102
|
+
return pathValue.split(NodePath8.delimiter).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter((directory) => directory.length > 0).map((directory) => NodePath8.resolve(directory, binary));
|
|
30996
31103
|
}
|
|
30997
31104
|
async function managedDirectoryOf(executablePath, managed) {
|
|
30998
31105
|
if (managed === void 0) return null;
|
|
30999
31106
|
try {
|
|
31000
31107
|
const realVersions = await NodeFSP6.realpath(managed.versionsDir);
|
|
31001
|
-
const directory =
|
|
31002
|
-
return
|
|
31108
|
+
const directory = NodePath8.dirname(executablePath);
|
|
31109
|
+
return NodePath8.dirname(directory) === realVersions && RELEASE_ID_PATTERN.test(NodePath8.basename(directory)) ? directory : null;
|
|
31003
31110
|
} catch {
|
|
31004
31111
|
return null;
|
|
31005
31112
|
}
|
|
@@ -31012,7 +31119,7 @@ async function resolveAntigravityExecutable(input2) {
|
|
|
31012
31119
|
const accept = async (candidate, source) => {
|
|
31013
31120
|
if (!await isExecutableFile2(candidate, platform2)) return void 0;
|
|
31014
31121
|
const executablePath = await NodeFSP6.realpath(candidate);
|
|
31015
|
-
const harnessPath =
|
|
31122
|
+
const harnessPath = NodePath8.join(NodePath8.dirname(executablePath), names.harness);
|
|
31016
31123
|
if (!await isExecutableFile2(harnessPath, platform2)) return void 0;
|
|
31017
31124
|
return {
|
|
31018
31125
|
executablePath,
|
|
@@ -31023,7 +31130,7 @@ async function resolveAntigravityExecutable(input2) {
|
|
|
31023
31130
|
};
|
|
31024
31131
|
};
|
|
31025
31132
|
if (configured.length > 0) {
|
|
31026
|
-
const candidates =
|
|
31133
|
+
const candidates = NodePath8.isAbsolute(configured) || configured.includes("/") || configured.includes("\\") ? [NodePath8.resolve(configured)] : pathCandidates(configured, pathValue);
|
|
31027
31134
|
for (const candidate of candidates) {
|
|
31028
31135
|
const found = await accept(candidate, "configured");
|
|
31029
31136
|
if (found !== void 0) return found;
|
|
@@ -31062,10 +31169,10 @@ async function resolveAntigravityExecutable(input2) {
|
|
|
31062
31169
|
|
|
31063
31170
|
// src/signedInMarker.ts
|
|
31064
31171
|
import * as NodeFSP7 from "node:fs/promises";
|
|
31065
|
-
import * as
|
|
31172
|
+
import * as NodePath9 from "node:path";
|
|
31066
31173
|
var SCHEMA_VERSION2 = 1;
|
|
31067
31174
|
function signedInMarkerFile(profile) {
|
|
31068
|
-
return
|
|
31175
|
+
return NodePath9.join(profile, "antigravity-acp", "ycodium-signed-in.json");
|
|
31069
31176
|
}
|
|
31070
31177
|
async function readSignedInMarker(file2) {
|
|
31071
31178
|
try {
|
|
@@ -31076,7 +31183,7 @@ async function readSignedInMarker(file2) {
|
|
|
31076
31183
|
}
|
|
31077
31184
|
}
|
|
31078
31185
|
async function writeSignedInMarker(file2) {
|
|
31079
|
-
await NodeFSP7.mkdir(
|
|
31186
|
+
await NodeFSP7.mkdir(NodePath9.dirname(file2), { recursive: true, mode: 448 });
|
|
31080
31187
|
const temporary = `${file2}.${String(process.pid)}.tmp`;
|
|
31081
31188
|
await NodeFSP7.writeFile(
|
|
31082
31189
|
temporary,
|
|
@@ -31617,14 +31724,14 @@ import { nodeStreamsFromHandle as nodeStreamsFromHandle3 } from "@ycodium-ai/plu
|
|
|
31617
31724
|
|
|
31618
31725
|
// src/sessionFiles.ts
|
|
31619
31726
|
import * as NodeFSP8 from "node:fs/promises";
|
|
31620
|
-
import * as
|
|
31727
|
+
import * as NodePath10 from "node:path";
|
|
31621
31728
|
var UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
|
|
31622
31729
|
var SESSION_FILE_SUFFIXES = [".db", ".db-wal", ".db-shm", ".db-journal", ".meta"];
|
|
31623
31730
|
async function removeTemporarySessionFiles(input2) {
|
|
31624
31731
|
const { sessionId } = input2;
|
|
31625
31732
|
if (sessionId === void 0 || !UUID_V4.test(sessionId)) return false;
|
|
31626
|
-
const acpDirectory =
|
|
31627
|
-
const base =
|
|
31733
|
+
const acpDirectory = NodePath10.join(input2.profile, "antigravity-acp");
|
|
31734
|
+
const base = NodePath10.join(acpDirectory, "conversations", sessionId);
|
|
31628
31735
|
try {
|
|
31629
31736
|
const meta3 = JSON.parse(await NodeFSP8.readFile(`${base}.meta`, "utf8"));
|
|
31630
31737
|
const cwd = typeof meta3 === "object" && meta3 !== null ? meta3.cwd : null;
|
|
@@ -31632,7 +31739,7 @@ async function removeTemporarySessionFiles(input2) {
|
|
|
31632
31739
|
for (const suffix of SESSION_FILE_SUFFIXES) {
|
|
31633
31740
|
await NodeFSP8.rm(`${base}${suffix}`, { force: true });
|
|
31634
31741
|
}
|
|
31635
|
-
await NodeFSP8.rm(
|
|
31742
|
+
await NodeFSP8.rm(NodePath10.join(acpDirectory, "brain", sessionId), {
|
|
31636
31743
|
recursive: true,
|
|
31637
31744
|
force: true
|
|
31638
31745
|
});
|
|
@@ -31644,7 +31751,7 @@ async function removeTemporarySessionFiles(input2) {
|
|
|
31644
31751
|
|
|
31645
31752
|
// src/textGenerationAvailability.ts
|
|
31646
31753
|
import * as NodeFSP9 from "node:fs/promises";
|
|
31647
|
-
import * as
|
|
31754
|
+
import * as NodePath11 from "node:path";
|
|
31648
31755
|
var MAX_CONFIG_BYTES = 64e3;
|
|
31649
31756
|
var CONFIG_FILES = [
|
|
31650
31757
|
{ name: "hooks.json", key: "hooks" },
|
|
@@ -31665,7 +31772,7 @@ async function configIsEmpty(file2, key) {
|
|
|
31665
31772
|
}
|
|
31666
31773
|
async function isTextGenerationAvailable(profile) {
|
|
31667
31774
|
for (const { name, key } of CONFIG_FILES) {
|
|
31668
|
-
const file2 =
|
|
31775
|
+
const file2 = NodePath11.join(profile, "config", name);
|
|
31669
31776
|
try {
|
|
31670
31777
|
await NodeFSP9.lstat(file2);
|
|
31671
31778
|
} catch (error62) {
|
|
@@ -32808,7 +32915,7 @@ function registerRuntimeCommands(ctx, manager) {
|
|
|
32808
32915
|
|
|
32809
32916
|
// src/runtimeManager.ts
|
|
32810
32917
|
import * as NodeFSP12 from "node:fs/promises";
|
|
32811
|
-
import * as
|
|
32918
|
+
import * as NodePath14 from "node:path";
|
|
32812
32919
|
|
|
32813
32920
|
// src/release.ts
|
|
32814
32921
|
var ANTIGRAVITY_RELEASE_VERSION = "agy_acp_server_1.1.1";
|
|
@@ -32876,9 +32983,9 @@ function resolveAntigravityReleaseAsset(platform2, arch2) {
|
|
|
32876
32983
|
// src/runtimeInstaller.ts
|
|
32877
32984
|
var Yauzl = __toESM(require_yauzl(), 1);
|
|
32878
32985
|
import * as NodeCrypto7 from "node:crypto";
|
|
32879
|
-
import * as
|
|
32986
|
+
import * as NodeFS2 from "node:fs";
|
|
32880
32987
|
import * as NodeFSP11 from "node:fs/promises";
|
|
32881
|
-
import * as
|
|
32988
|
+
import * as NodePath12 from "node:path";
|
|
32882
32989
|
import * as NodeStream2 from "node:stream";
|
|
32883
32990
|
import * as NodeStreamPromises from "node:stream/promises";
|
|
32884
32991
|
var DOWNLOAD_TIMEOUT_MS = 45 * 60 * 1e3;
|
|
@@ -32918,7 +33025,7 @@ async function sweepStaging(versionsDir) {
|
|
|
32918
33025
|
}
|
|
32919
33026
|
for (const name of names) {
|
|
32920
33027
|
if (!name.startsWith(STAGING_PREFIX)) continue;
|
|
32921
|
-
await removeTree(
|
|
33028
|
+
await removeTree(NodePath12.join(versionsDir, name)).catch(() => void 0);
|
|
32922
33029
|
}
|
|
32923
33030
|
}
|
|
32924
33031
|
async function downloadArchive(input2, archivePath) {
|
|
@@ -32973,7 +33080,7 @@ async function downloadArchive(input2, archivePath) {
|
|
|
32973
33080
|
await NodeStreamPromises.pipeline(
|
|
32974
33081
|
NodeStream2.Readable.fromWeb(response.body),
|
|
32975
33082
|
meter,
|
|
32976
|
-
|
|
33083
|
+
NodeFS2.createWriteStream(archivePath, { flags: "wx", mode: 384 }),
|
|
32977
33084
|
{ signal: input2.downloadSignal }
|
|
32978
33085
|
);
|
|
32979
33086
|
} catch (error62) {
|
|
@@ -33085,7 +33192,7 @@ async function extractPair(archivePath, outDirectory, asset) {
|
|
|
33085
33192
|
await NodeStreamPromises.pipeline(
|
|
33086
33193
|
await openEntry(zip, entry),
|
|
33087
33194
|
limiter,
|
|
33088
|
-
|
|
33195
|
+
NodeFS2.createWriteStream(NodePath12.join(outDirectory, entry.fileName), {
|
|
33089
33196
|
flags: "wx",
|
|
33090
33197
|
mode: 448
|
|
33091
33198
|
})
|
|
@@ -33127,8 +33234,8 @@ async function validateOrThrow(input2, executable) {
|
|
|
33127
33234
|
}
|
|
33128
33235
|
function executableOf(directory, input2, names) {
|
|
33129
33236
|
return {
|
|
33130
|
-
executablePath:
|
|
33131
|
-
harnessPath:
|
|
33237
|
+
executablePath: NodePath12.join(directory, names.executable),
|
|
33238
|
+
harnessPath: NodePath12.join(directory, names.harness),
|
|
33132
33239
|
source: "managed",
|
|
33133
33240
|
version: input2.asset.version,
|
|
33134
33241
|
managedVersionDirectory: directory
|
|
@@ -33174,10 +33281,10 @@ async function installManagedRelease(input2) {
|
|
|
33174
33281
|
`Antigravity needs at least ${String(Math.ceil(needed / 1024 / 1024))} MiB of free space to install.`
|
|
33175
33282
|
);
|
|
33176
33283
|
}
|
|
33177
|
-
const staging = await NodeFSP11.mkdtemp(
|
|
33284
|
+
const staging = await NodeFSP11.mkdtemp(NodePath12.join(layout.versionsDir, STAGING_PREFIX));
|
|
33178
33285
|
try {
|
|
33179
|
-
const archivePath =
|
|
33180
|
-
const pairDirectory =
|
|
33286
|
+
const archivePath = NodePath12.join(staging, "download.zip");
|
|
33287
|
+
const pairDirectory = NodePath12.join(staging, "runtime");
|
|
33181
33288
|
await NodeFSP11.mkdir(pairDirectory);
|
|
33182
33289
|
const downloaded = await downloadArchive(input2, archivePath);
|
|
33183
33290
|
if (downloaded.bytes !== asset.archiveBytes || downloaded.sha256 !== asset.sha256) {
|
|
@@ -33190,8 +33297,8 @@ async function installManagedRelease(input2) {
|
|
|
33190
33297
|
await extractPair(archivePath, pairDirectory, asset);
|
|
33191
33298
|
await NodeFSP11.rm(archivePath, { force: true });
|
|
33192
33299
|
if (platform2 !== "win32") {
|
|
33193
|
-
await NodeFSP11.chmod(
|
|
33194
|
-
await NodeFSP11.chmod(
|
|
33300
|
+
await NodeFSP11.chmod(NodePath12.join(pairDirectory, asset.executable.name), 493);
|
|
33301
|
+
await NodeFSP11.chmod(NodePath12.join(pairDirectory, asset.harness.name), 493);
|
|
33195
33302
|
}
|
|
33196
33303
|
await validateOrThrow(input2, executableOf(pairDirectory, input2, names));
|
|
33197
33304
|
await writeReleaseRecord(pairDirectory, {
|
|
@@ -33224,7 +33331,7 @@ async function installManagedRelease(input2) {
|
|
|
33224
33331
|
|
|
33225
33332
|
// src/runtimeValidate.ts
|
|
33226
33333
|
import { nodeStreamsFromHandle as nodeStreamsFromHandle4 } from "@ycodium-ai/plugin-api/process-stdin";
|
|
33227
|
-
import * as
|
|
33334
|
+
import * as NodePath13 from "node:path";
|
|
33228
33335
|
var VALIDATE_REQUEST_TIMEOUT_MS = 9e4;
|
|
33229
33336
|
var EXIT_WAIT_MS = 1e4;
|
|
33230
33337
|
var VALIDATE_CLIENT_INFO = { name: "ycodium-agent-antigravity", version: "0.1.0" };
|
|
@@ -33246,8 +33353,8 @@ function matchesExpectedRuntime(initializeResult, expectedVersion) {
|
|
|
33246
33353
|
}
|
|
33247
33354
|
async function validateInstalledRuntime(input2) {
|
|
33248
33355
|
const platform2 = input2.platform ?? HOST_PLATFORM;
|
|
33249
|
-
const profileRoot =
|
|
33250
|
-
const tempRoot =
|
|
33356
|
+
const profileRoot = NodePath13.join(input2.dataDir, "tmp", "validate-profile");
|
|
33357
|
+
const tempRoot = NodePath13.join(input2.dataDir, "tmp", "validate");
|
|
33251
33358
|
await sweepRuntimeTempDirs(profileRoot);
|
|
33252
33359
|
await sweepRuntimeTempDirs(tempRoot);
|
|
33253
33360
|
const profile = await createRuntimeTempDir(profileRoot);
|
|
@@ -33463,8 +33570,8 @@ function createRuntimeManager(deps) {
|
|
|
33463
33570
|
if (!(error62 instanceof AntigravityRuntimeError)) throw error62;
|
|
33464
33571
|
}
|
|
33465
33572
|
if (realRoot !== void 0) {
|
|
33466
|
-
const real = await NodeFSP12.realpath(configured).catch(() =>
|
|
33467
|
-
if (real.startsWith(`${realRoot}${
|
|
33573
|
+
const real = await NodeFSP12.realpath(configured).catch(() => NodePath14.resolve(configured));
|
|
33574
|
+
if (real.startsWith(`${realRoot}${NodePath14.sep}`)) return true;
|
|
33468
33575
|
}
|
|
33469
33576
|
}
|
|
33470
33577
|
return false;
|
|
@@ -33508,8 +33615,8 @@ function createRuntimeManager(deps) {
|
|
|
33508
33615
|
for (const entry of instances) {
|
|
33509
33616
|
const configured = entry.binaryPath.trim();
|
|
33510
33617
|
if (configured.length === 0) continue;
|
|
33511
|
-
const target = await NodeFSP12.realpath(configured).catch(() =>
|
|
33512
|
-
if (target.startsWith(`${real}${
|
|
33618
|
+
const target = await NodeFSP12.realpath(configured).catch(() => NodePath14.resolve(configured));
|
|
33619
|
+
if (target.startsWith(`${real}${NodePath14.sep}`)) return true;
|
|
33513
33620
|
}
|
|
33514
33621
|
return false;
|
|
33515
33622
|
};
|
|
@@ -33524,11 +33631,11 @@ function createRuntimeManager(deps) {
|
|
|
33524
33631
|
try {
|
|
33525
33632
|
await removeDirectory(directory);
|
|
33526
33633
|
deps.log.info("removed an old antigravity runtime version", {
|
|
33527
|
-
releaseId:
|
|
33634
|
+
releaseId: NodePath14.basename(directory)
|
|
33528
33635
|
});
|
|
33529
33636
|
} catch (error62) {
|
|
33530
33637
|
deps.log.warn("could not remove an old antigravity runtime version", {
|
|
33531
|
-
releaseId:
|
|
33638
|
+
releaseId: NodePath14.basename(directory),
|
|
33532
33639
|
error: error62 instanceof Error ? error62.message : String(error62)
|
|
33533
33640
|
});
|
|
33534
33641
|
}
|
|
@@ -33772,7 +33879,7 @@ var executors = [
|
|
|
33772
33879
|
];
|
|
33773
33880
|
var index_default = definePlugin({
|
|
33774
33881
|
id: "agent-antigravity",
|
|
33775
|
-
apiVersion:
|
|
33882
|
+
apiVersion: 21,
|
|
33776
33883
|
executors,
|
|
33777
33884
|
activate(ctx) {
|
|
33778
33885
|
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.3214",
|
|
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-acp-executor": "0.2.3214",
|
|
34
35
|
"ycodium-executor-testing": "0.0.0",
|
|
35
|
-
"ycodium-
|
|
36
|
-
"@ycodium-ai/plugin-api": "0.2.3210"
|
|
36
|
+
"@ycodium-ai/plugin-api": "0.2.3214"
|
|
37
37
|
},
|
|
38
38
|
"ycodium": {
|
|
39
39
|
"plugin": "./dist/index.js",
|