@codexhost/cli-darwin-x64 0.14.0 → 0.15.0
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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +51 -6
- package/app/console-web.js +212 -64
- package/app/desktop-controller.mjs +48 -3
- package/app/host-runtime.mjs +358 -79
- package/app/plugins/antigravity/plugin.mjs +340 -53
- package/app/plugins/claude-code/plugin.mjs +373 -132
- package/app/plugins/codebuddy/plugin.mjs +205 -46
- package/app/plugins/codex-usage/plugin.mjs +73 -28
- package/app/plugins/copilot/plugin.mjs +98 -53
- package/app/plugins/cursor-cli/plugin.mjs +205 -46
- package/app/plugins/deepseek-harness/plugin.mjs +77 -32
- package/app/plugins/grok/plugin.mjs +352 -84
- package/app/plugins/hermes/plugin.mjs +48 -3
- package/app/plugins/kimi-code/plugin.mjs +60 -15
- package/app/plugins/kiro-cli/plugin.mjs +60 -15
- package/app/plugins/omp/plugin.mjs +80 -35
- package/app/plugins/opencode/plugin.mjs +102 -57
- package/app/plugins/pi/plugin.mjs +113 -43
- package/app/plugins/qoder/plugin.mjs +70 -25
- package/app/plugins/qoder-cn/plugin.mjs +70 -25
- package/app/plugins/workbuddy/plugin.mjs +205 -46
- package/app/plugins/zcode/plugin.mjs +99 -29
- package/app/renderer-extension.js +944 -249
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -413,8 +413,8 @@ import { spawn } from "node:child_process";
|
|
|
413
413
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
414
414
|
import { readFile as readFile2, unlink } from "node:fs/promises";
|
|
415
415
|
import https3 from "node:https";
|
|
416
|
-
import
|
|
417
|
-
import
|
|
416
|
+
import os6 from "node:os";
|
|
417
|
+
import path11 from "node:path";
|
|
418
418
|
import readline from "node:readline";
|
|
419
419
|
|
|
420
420
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
@@ -1183,10 +1183,10 @@ function mergeDefs(...defs) {
|
|
|
1183
1183
|
function cloneDef(schema) {
|
|
1184
1184
|
return mergeDefs(schema._zod.def);
|
|
1185
1185
|
}
|
|
1186
|
-
function getElementAtPath(obj,
|
|
1187
|
-
if (!
|
|
1186
|
+
function getElementAtPath(obj, path12) {
|
|
1187
|
+
if (!path12)
|
|
1188
1188
|
return obj;
|
|
1189
|
-
return
|
|
1189
|
+
return path12.reduce((acc, key) => acc?.[key], obj);
|
|
1190
1190
|
}
|
|
1191
1191
|
function promiseAllObject(promisesObj) {
|
|
1192
1192
|
const keys = Object.keys(promisesObj);
|
|
@@ -1595,11 +1595,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
return false;
|
|
1597
1597
|
}
|
|
1598
|
-
function prefixIssues(
|
|
1598
|
+
function prefixIssues(path12, issues) {
|
|
1599
1599
|
return issues.map((iss) => {
|
|
1600
1600
|
var _a3;
|
|
1601
1601
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1602
|
-
iss.path.unshift(
|
|
1602
|
+
iss.path.unshift(path12);
|
|
1603
1603
|
return iss;
|
|
1604
1604
|
});
|
|
1605
1605
|
}
|
|
@@ -1746,16 +1746,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1746
1746
|
}
|
|
1747
1747
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
1748
1748
|
const fieldErrors = { _errors: [] };
|
|
1749
|
-
const processError = (error52,
|
|
1749
|
+
const processError = (error52, path12 = []) => {
|
|
1750
1750
|
for (const issue2 of error52.issues) {
|
|
1751
1751
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1752
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1752
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
1753
1753
|
} else if (issue2.code === "invalid_key") {
|
|
1754
|
-
processError({ issues: issue2.issues }, [...
|
|
1754
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
1755
1755
|
} else if (issue2.code === "invalid_element") {
|
|
1756
|
-
processError({ issues: issue2.issues }, [...
|
|
1756
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
1757
1757
|
} else {
|
|
1758
|
-
const fullpath = [...
|
|
1758
|
+
const fullpath = [...path12, ...issue2.path];
|
|
1759
1759
|
if (fullpath.length === 0) {
|
|
1760
1760
|
fieldErrors._errors.push(mapper(issue2));
|
|
1761
1761
|
} else {
|
|
@@ -1782,17 +1782,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1782
1782
|
}
|
|
1783
1783
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
1784
1784
|
const result = { errors: [] };
|
|
1785
|
-
const processError = (error52,
|
|
1785
|
+
const processError = (error52, path12 = []) => {
|
|
1786
1786
|
var _a3, _b;
|
|
1787
1787
|
for (const issue2 of error52.issues) {
|
|
1788
1788
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1789
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1789
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
1790
1790
|
} else if (issue2.code === "invalid_key") {
|
|
1791
|
-
processError({ issues: issue2.issues }, [...
|
|
1791
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
1792
1792
|
} else if (issue2.code === "invalid_element") {
|
|
1793
|
-
processError({ issues: issue2.issues }, [...
|
|
1793
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
1794
1794
|
} else {
|
|
1795
|
-
const fullpath = [...
|
|
1795
|
+
const fullpath = [...path12, ...issue2.path];
|
|
1796
1796
|
if (fullpath.length === 0) {
|
|
1797
1797
|
result.errors.push(mapper(issue2));
|
|
1798
1798
|
continue;
|
|
@@ -1824,8 +1824,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1824
1824
|
}
|
|
1825
1825
|
function toDotPath(_path) {
|
|
1826
1826
|
const segs = [];
|
|
1827
|
-
const
|
|
1828
|
-
for (const seg of
|
|
1827
|
+
const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1828
|
+
for (const seg of path12) {
|
|
1829
1829
|
if (typeof seg === "number")
|
|
1830
1830
|
segs.push(`[${seg}]`);
|
|
1831
1831
|
else if (typeof seg === "symbol")
|
|
@@ -3446,10 +3446,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3446
3446
|
const shape = def.shape;
|
|
3447
3447
|
const propValues = {};
|
|
3448
3448
|
for (const key in shape) {
|
|
3449
|
-
const
|
|
3450
|
-
if (
|
|
3449
|
+
const field2 = shape[key]._zod;
|
|
3450
|
+
if (field2.values) {
|
|
3451
3451
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3452
|
-
for (const v of
|
|
3452
|
+
for (const v of field2.values)
|
|
3453
3453
|
propValues[key].add(v);
|
|
3454
3454
|
}
|
|
3455
3455
|
}
|
|
@@ -5053,8 +5053,8 @@ function az_default() {
|
|
|
5053
5053
|
}
|
|
5054
5054
|
|
|
5055
5055
|
// ../../../node_modules/zod/v4/locales/be.js
|
|
5056
|
-
function getBelarusianPlural(
|
|
5057
|
-
const absCount = Math.abs(
|
|
5056
|
+
function getBelarusianPlural(count3, one, few, many) {
|
|
5057
|
+
const absCount = Math.abs(count3);
|
|
5058
5058
|
const lastDigit = absCount % 10;
|
|
5059
5059
|
const lastTwoDigits = absCount % 100;
|
|
5060
5060
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -7132,8 +7132,8 @@ function hu_default() {
|
|
|
7132
7132
|
}
|
|
7133
7133
|
|
|
7134
7134
|
// ../../../node_modules/zod/v4/locales/hy.js
|
|
7135
|
-
function getArmenianPlural(
|
|
7136
|
-
return Math.abs(
|
|
7135
|
+
function getArmenianPlural(count3, one, many) {
|
|
7136
|
+
return Math.abs(count3) === 1 ? one : many;
|
|
7137
7137
|
}
|
|
7138
7138
|
function withDefiniteArticle(word) {
|
|
7139
7139
|
if (!word)
|
|
@@ -9261,8 +9261,8 @@ function ro_default() {
|
|
|
9261
9261
|
}
|
|
9262
9262
|
|
|
9263
9263
|
// ../../../node_modules/zod/v4/locales/ru.js
|
|
9264
|
-
function getRussianPlural(
|
|
9265
|
-
const absCount = Math.abs(
|
|
9264
|
+
function getRussianPlural(count3, one, few, many) {
|
|
9265
|
+
const absCount = Math.abs(count3);
|
|
9266
9266
|
const lastDigit = absCount % 10;
|
|
9267
9267
|
const lastTwoDigits = absCount % 100;
|
|
9268
9268
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -14517,13 +14517,13 @@ function resolveRef(ref, ctx) {
|
|
|
14517
14517
|
if (!ref.startsWith("#")) {
|
|
14518
14518
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14519
14519
|
}
|
|
14520
|
-
const
|
|
14521
|
-
if (
|
|
14520
|
+
const path12 = ref.slice(1).split("/").filter(Boolean);
|
|
14521
|
+
if (path12.length === 0) {
|
|
14522
14522
|
return ctx.rootSchema;
|
|
14523
14523
|
}
|
|
14524
14524
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14525
|
-
if (
|
|
14526
|
-
const key =
|
|
14525
|
+
if (path12[0] === defsKey) {
|
|
14526
|
+
const key = path12[1];
|
|
14527
14527
|
if (!key || !ctx.defs[key]) {
|
|
14528
14528
|
throw new Error(`Reference not found: ${ref}`);
|
|
14529
14529
|
}
|
|
@@ -15196,6 +15196,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
15196
15196
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
15197
15197
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
15198
15198
|
|
|
15199
|
+
// ../../shared-contracts/dist/thread-questions.js
|
|
15200
|
+
var field = external_exports.discriminatedUnion("type", [
|
|
15201
|
+
external_exports.object({
|
|
15202
|
+
id: external_exports.string().min(1),
|
|
15203
|
+
type: external_exports.literal("choice"),
|
|
15204
|
+
prompt: external_exports.string(),
|
|
15205
|
+
options: external_exports.array(external_exports.object({
|
|
15206
|
+
value: external_exports.string().min(1),
|
|
15207
|
+
label: external_exports.string(),
|
|
15208
|
+
description: external_exports.string().optional()
|
|
15209
|
+
})).min(1),
|
|
15210
|
+
multiple: external_exports.boolean(),
|
|
15211
|
+
allowOther: external_exports.boolean(),
|
|
15212
|
+
optional: external_exports.boolean()
|
|
15213
|
+
}),
|
|
15214
|
+
external_exports.object({
|
|
15215
|
+
id: external_exports.string().min(1),
|
|
15216
|
+
type: external_exports.literal("text"),
|
|
15217
|
+
prompt: external_exports.string(),
|
|
15218
|
+
multiline: external_exports.boolean(),
|
|
15219
|
+
secret: external_exports.literal(false),
|
|
15220
|
+
optional: external_exports.boolean(),
|
|
15221
|
+
placeholder: external_exports.string().optional(),
|
|
15222
|
+
prefill: external_exports.string().optional()
|
|
15223
|
+
})
|
|
15224
|
+
]);
|
|
15225
|
+
var threadQuestionSchema = external_exports.object({
|
|
15226
|
+
interactionId: external_exports.string().min(1),
|
|
15227
|
+
turnId: external_exports.string().min(1),
|
|
15228
|
+
title: external_exports.string().optional(),
|
|
15229
|
+
questions: external_exports.array(field).min(1)
|
|
15230
|
+
}).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
|
|
15231
|
+
message: "Shared cards require at least one multi-select question"
|
|
15232
|
+
});
|
|
15233
|
+
var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
|
|
15234
|
+
var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
|
|
15235
|
+
var threadQuestionRespondParamsSchema = external_exports.strictObject({
|
|
15236
|
+
threadId: external_exports.string().min(1),
|
|
15237
|
+
turnId: external_exports.string().min(1),
|
|
15238
|
+
interactionId: external_exports.string().min(1),
|
|
15239
|
+
answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
|
|
15240
|
+
cancelled: external_exports.boolean().default(false)
|
|
15241
|
+
});
|
|
15242
|
+
var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
|
|
15243
|
+
|
|
15199
15244
|
// ../../shared-contracts/dist/console.js
|
|
15200
15245
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
15201
15246
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -16665,6 +16710,12 @@ function historyPath(environment) {
|
|
|
16665
16710
|
const threadId = safeThreadId(environment);
|
|
16666
16711
|
return threadId ? path5.join(historyRoot(environment), `${threadId}.json`) : null;
|
|
16667
16712
|
}
|
|
16713
|
+
function antigravityHookDirectory(environment) {
|
|
16714
|
+
const threadId = safeThreadId(environment);
|
|
16715
|
+
if (!threadId || threadId === "." || threadId === "..")
|
|
16716
|
+
return null;
|
|
16717
|
+
return path5.join(historyRoot(environment), "hooks", threadId);
|
|
16718
|
+
}
|
|
16668
16719
|
function jsonTurn(turn) {
|
|
16669
16720
|
return JSON.parse(JSON.stringify(turn));
|
|
16670
16721
|
}
|
|
@@ -16853,8 +16904,11 @@ var AntigravityHistory = class _AntigravityHistory {
|
|
|
16853
16904
|
function nativeConversationDbPath(nativeSessionId, homedir2 = os3.homedir()) {
|
|
16854
16905
|
return path6.join(homedir2, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
|
|
16855
16906
|
}
|
|
16907
|
+
function nativeBrainRoot(homedir2 = os3.homedir()) {
|
|
16908
|
+
return path6.join(homedir2, ".gemini", "antigravity-cli", "brain");
|
|
16909
|
+
}
|
|
16856
16910
|
function nativeBrainDirPath(nativeSessionId, homedir2 = os3.homedir()) {
|
|
16857
|
-
return path6.join(homedir2,
|
|
16911
|
+
return path6.join(nativeBrainRoot(homedir2), nativeSessionId);
|
|
16858
16912
|
}
|
|
16859
16913
|
async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, retainedTurnsCountOrHomedir, homedirOption = os3.homedir()) {
|
|
16860
16914
|
let retainedTurnsCount;
|
|
@@ -18107,7 +18161,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
18107
18161
|
this.#server.on("request", (request, response) => this.#receive(request, response));
|
|
18108
18162
|
}
|
|
18109
18163
|
static async create(options) {
|
|
18110
|
-
const directory = await mkdtemp2(path8.join(os4.tmpdir(), "codexhost-agy-question-"));
|
|
18164
|
+
const directory = options.directory ?? await mkdtemp2(path8.join(os4.tmpdir(), "codexhost-agy-question-"));
|
|
18111
18165
|
const bridge = new _AntigravityQuestionBridge(directory, options);
|
|
18112
18166
|
try {
|
|
18113
18167
|
await new Promise((resolve, reject) => {
|
|
@@ -18123,7 +18177,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
18123
18177
|
throw new Error("Question bridge did not bind");
|
|
18124
18178
|
bridge.environment.CODEXHOST_AGY_QUESTION_URL = `http://127.0.0.1:${address.port}/question`;
|
|
18125
18179
|
const client = path8.join(directory, "question-hook.cjs");
|
|
18126
|
-
await mkdir3(path8.join(directory, ".agents"));
|
|
18180
|
+
await mkdir3(path8.join(directory, ".agents"), { recursive: true, mode: 448 });
|
|
18127
18181
|
await writeFile3(client, ANTIGRAVITY_QUESTION_HOOK_CLIENT, "utf8");
|
|
18128
18182
|
const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
18129
18183
|
bridge.environment.CODEXHOST_AGY_QUESTION_NODE = `"${process.execPath.replaceAll("\\", "/")}"`;
|
|
@@ -18352,7 +18406,9 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
18352
18406
|
this.#server.close(() => resolve());
|
|
18353
18407
|
this.#server.closeAllConnections();
|
|
18354
18408
|
});
|
|
18355
|
-
|
|
18409
|
+
if (this.#options.directory === void 0) {
|
|
18410
|
+
await rm3(this.directory, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
|
|
18411
|
+
}
|
|
18356
18412
|
})();
|
|
18357
18413
|
return this.#disposal;
|
|
18358
18414
|
}
|
|
@@ -18846,12 +18902,195 @@ var AntigravitySubagents = class {
|
|
|
18846
18902
|
}
|
|
18847
18903
|
};
|
|
18848
18904
|
|
|
18905
|
+
// dist/usage-statistics.js
|
|
18906
|
+
import { lstat, opendir } from "node:fs/promises";
|
|
18907
|
+
import os5 from "node:os";
|
|
18908
|
+
import path10 from "node:path";
|
|
18909
|
+
|
|
18910
|
+
// ../../harness-adapter/dist/usage-statistics.js
|
|
18911
|
+
import { createReadStream } from "node:fs";
|
|
18912
|
+
import { createInterface } from "node:readline";
|
|
18913
|
+
var HarnessUsageSourceChangedError = class extends Error {
|
|
18914
|
+
code = "HARNESS_USAGE_SOURCE_CHANGED";
|
|
18915
|
+
/** Plugins may bundle their own copy of this contract, so instanceof is insufficient. */
|
|
18916
|
+
static is(error51) {
|
|
18917
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "HARNESS_USAGE_SOURCE_CHANGED";
|
|
18918
|
+
}
|
|
18919
|
+
};
|
|
18920
|
+
var MAX_SESSION_ID_LENGTH = 512;
|
|
18921
|
+
var MAX_CWD_LENGTH = 4096;
|
|
18922
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
18923
|
+
function usageSessionTitle(value) {
|
|
18924
|
+
if (typeof value !== "string")
|
|
18925
|
+
return void 0;
|
|
18926
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
18927
|
+
if (!normalized)
|
|
18928
|
+
return void 0;
|
|
18929
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
18930
|
+
return normalized;
|
|
18931
|
+
let title = "";
|
|
18932
|
+
for (const character of normalized) {
|
|
18933
|
+
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
18934
|
+
break;
|
|
18935
|
+
title += character;
|
|
18936
|
+
}
|
|
18937
|
+
return `${title.trimEnd()}…`;
|
|
18938
|
+
}
|
|
18939
|
+
function sessionIdOk(value) {
|
|
18940
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
18941
|
+
}
|
|
18942
|
+
function cwdOk(value) {
|
|
18943
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_CWD_LENGTH && !value.includes("\0") && (value.startsWith("/") || /^[A-Za-z]:[\\/]/u.test(value) || value.startsWith("\\\\"));
|
|
18944
|
+
}
|
|
18945
|
+
function withUsageSession(entry, session) {
|
|
18946
|
+
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
18947
|
+
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
18948
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
18949
|
+
if (sessionId === void 0 && cwd === void 0)
|
|
18950
|
+
return entry;
|
|
18951
|
+
return {
|
|
18952
|
+
...entry,
|
|
18953
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
18954
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
18955
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
18956
|
+
};
|
|
18957
|
+
}
|
|
18958
|
+
async function* jsonlRecords(file2, marker, signal) {
|
|
18959
|
+
const lines = createInterface({
|
|
18960
|
+
input: createReadStream(file2, { encoding: "utf8", signal }),
|
|
18961
|
+
crlfDelay: Infinity
|
|
18962
|
+
});
|
|
18963
|
+
for await (const line of lines) {
|
|
18964
|
+
if (!line.includes(marker))
|
|
18965
|
+
continue;
|
|
18966
|
+
let value;
|
|
18967
|
+
try {
|
|
18968
|
+
value = JSON.parse(line);
|
|
18969
|
+
} catch {
|
|
18970
|
+
continue;
|
|
18971
|
+
}
|
|
18972
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
18973
|
+
yield value;
|
|
18974
|
+
}
|
|
18975
|
+
}
|
|
18976
|
+
}
|
|
18977
|
+
function nativeTimeMs(value) {
|
|
18978
|
+
const time3 = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : Number.NaN;
|
|
18979
|
+
return Number.isFinite(time3) && time3 > 0 ? Math.floor(time3) : null;
|
|
18980
|
+
}
|
|
18981
|
+
|
|
18982
|
+
// dist/usage-statistics.js
|
|
18983
|
+
function count2(value) {
|
|
18984
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
18985
|
+
}
|
|
18986
|
+
function antigravityHome(environment) {
|
|
18987
|
+
return (process.platform === "win32" ? environment.USERPROFILE : environment.HOME) || os5.homedir();
|
|
18988
|
+
}
|
|
18989
|
+
function transcriptPath(brainRoot, conversationId) {
|
|
18990
|
+
return path10.join(brainRoot, conversationId, ".system_generated", "logs", "transcript.jsonl");
|
|
18991
|
+
}
|
|
18992
|
+
function isMissing(error51) {
|
|
18993
|
+
const code = error51?.code;
|
|
18994
|
+
return code === "ENOENT" || code === "ENOTDIR";
|
|
18995
|
+
}
|
|
18996
|
+
async function lstatIfPresent(target) {
|
|
18997
|
+
try {
|
|
18998
|
+
return await lstat(target);
|
|
18999
|
+
} catch (error51) {
|
|
19000
|
+
if (isMissing(error51))
|
|
19001
|
+
return null;
|
|
19002
|
+
throw error51;
|
|
19003
|
+
}
|
|
19004
|
+
}
|
|
19005
|
+
async function transcriptFingerprint(file2) {
|
|
19006
|
+
const logs = path10.dirname(file2);
|
|
19007
|
+
for (const directory of [path10.dirname(logs), logs]) {
|
|
19008
|
+
if (!(await lstatIfPresent(directory))?.isDirectory())
|
|
19009
|
+
return null;
|
|
19010
|
+
}
|
|
19011
|
+
const info = await lstatIfPresent(file2);
|
|
19012
|
+
return info?.isFile() && info.size > 0 ? `${info.ino}:${info.size}:${info.mtimeMs}` : null;
|
|
19013
|
+
}
|
|
19014
|
+
async function listTranscripts(brainRoot, signal) {
|
|
19015
|
+
signal.throwIfAborted();
|
|
19016
|
+
const conversations = await opendir(brainRoot).catch((error51) => {
|
|
19017
|
+
if (error51.code === "ENOENT")
|
|
19018
|
+
return null;
|
|
19019
|
+
throw error51;
|
|
19020
|
+
});
|
|
19021
|
+
if (!conversations)
|
|
19022
|
+
return [];
|
|
19023
|
+
const sources = [];
|
|
19024
|
+
for await (const entry of conversations) {
|
|
19025
|
+
signal.throwIfAborted();
|
|
19026
|
+
if (!entry.isDirectory())
|
|
19027
|
+
continue;
|
|
19028
|
+
const file2 = transcriptPath(brainRoot, entry.name);
|
|
19029
|
+
const fingerprint = await transcriptFingerprint(file2);
|
|
19030
|
+
if (fingerprint)
|
|
19031
|
+
sources.push({ id: file2, fingerprint });
|
|
19032
|
+
}
|
|
19033
|
+
return sources;
|
|
19034
|
+
}
|
|
19035
|
+
async function readAntigravityUsage(file2, signal) {
|
|
19036
|
+
const sessionId = path10.basename(path10.resolve(file2, "..", "..", ".."));
|
|
19037
|
+
const requests = /* @__PURE__ */ new Map();
|
|
19038
|
+
for await (const record2 of jsonlRecords(file2, '"input_tokens"', signal)) {
|
|
19039
|
+
if (record2.type !== "PLANNER_RESPONSE")
|
|
19040
|
+
continue;
|
|
19041
|
+
const step = count2(record2.step_index);
|
|
19042
|
+
const input = count2(record2.input_tokens);
|
|
19043
|
+
const output = count2(record2.output_tokens);
|
|
19044
|
+
const cached2 = count2(record2.cache_read_tokens);
|
|
19045
|
+
const at = nativeTimeMs(record2.created_at);
|
|
19046
|
+
if (step === null || input === null || output === null || at === null)
|
|
19047
|
+
continue;
|
|
19048
|
+
requests.set(step, withUsageSession({
|
|
19049
|
+
id: `${String(record2.created_at)}:${step}:${input}:${cached2 ?? "-"}:${output}`,
|
|
19050
|
+
occurredAtMs: at,
|
|
19051
|
+
inputTokens: input + (cached2 ?? 0),
|
|
19052
|
+
...cached2 !== null ? { cachedInputTokens: cached2 } : {},
|
|
19053
|
+
outputTokens: output
|
|
19054
|
+
}, { sessionId }));
|
|
19055
|
+
}
|
|
19056
|
+
return [...requests.values()];
|
|
19057
|
+
}
|
|
19058
|
+
function createAntigravityUsageStatistics(environment) {
|
|
19059
|
+
const brainRoot = nativeBrainRoot(antigravityHome(environment));
|
|
19060
|
+
let listed = /* @__PURE__ */ new Map();
|
|
19061
|
+
return Object.freeze({
|
|
19062
|
+
async listSources(signal) {
|
|
19063
|
+
const sources = await listTranscripts(brainRoot, signal);
|
|
19064
|
+
listed = new Map(sources.map(({ id, fingerprint }) => [id, fingerprint]));
|
|
19065
|
+
return sources;
|
|
19066
|
+
},
|
|
19067
|
+
async readSource(id, signal) {
|
|
19068
|
+
const expected = listed.get(id);
|
|
19069
|
+
let entries;
|
|
19070
|
+
try {
|
|
19071
|
+
entries = await readAntigravityUsage(id, signal);
|
|
19072
|
+
} catch (error51) {
|
|
19073
|
+
if (expected !== void 0 && isMissing(error51)) {
|
|
19074
|
+
throw new HarnessUsageSourceChangedError("Antigravity transcript disappeared before reading; refresh to retry");
|
|
19075
|
+
}
|
|
19076
|
+
throw error51;
|
|
19077
|
+
}
|
|
19078
|
+
if (expected !== void 0 && await transcriptFingerprint(id) !== expected) {
|
|
19079
|
+
throw new HarnessUsageSourceChangedError("Antigravity transcript changed while reading; refresh to retry");
|
|
19080
|
+
}
|
|
19081
|
+
return entries;
|
|
19082
|
+
}
|
|
19083
|
+
});
|
|
19084
|
+
}
|
|
19085
|
+
|
|
18849
19086
|
// dist/antigravity-adapter.js
|
|
18850
19087
|
var antigravityHarnessId = harnessIdSchema.parse("antigravity");
|
|
18851
19088
|
var DEFAULT_INSPECT_TIMEOUT_MS = 2e4;
|
|
18852
19089
|
var DEFAULT_PRINT_TIMEOUT = "30m";
|
|
18853
19090
|
var DEFAULT_TOOL_OUTPUT_LIMIT = 64e3;
|
|
18854
19091
|
var DEFAULT_SUBAGENT_OBSERVATION_TIMEOUT_MS = 3e4;
|
|
19092
|
+
var NATIVE_EXIT_GRACE_MS = 2e3;
|
|
19093
|
+
var DEFAULT_TURN_CLEANUP_WAIT_MS = 5e3;
|
|
18855
19094
|
var CONTEXT_USAGE_TIMEOUT_MS = 8e3;
|
|
18856
19095
|
var CONTEXT_USAGE_RETRY_MS = 100;
|
|
18857
19096
|
var TRAJECTORY_TIMEOUT_MS = 2e3;
|
|
@@ -18880,8 +19119,8 @@ function mergePendingStep(pending, step) {
|
|
|
18880
19119
|
};
|
|
18881
19120
|
}
|
|
18882
19121
|
function sameFile(left, right) {
|
|
18883
|
-
const a =
|
|
18884
|
-
const b =
|
|
19122
|
+
const a = path11.resolve(left);
|
|
19123
|
+
const b = path11.resolve(right);
|
|
18885
19124
|
return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
18886
19125
|
}
|
|
18887
19126
|
function resolveAntigravityContextWindow(modelId, reportedWindow) {
|
|
@@ -18909,12 +19148,28 @@ function errorMessage(error51) {
|
|
|
18909
19148
|
function invalidState(message) {
|
|
18910
19149
|
return { code: "invalidState", message, retryable: false };
|
|
18911
19150
|
}
|
|
19151
|
+
function settledWithin(promise2, timeoutMs) {
|
|
19152
|
+
return new Promise((resolve) => {
|
|
19153
|
+
const timer = setTimeout(resolve, timeoutMs);
|
|
19154
|
+
const settle = () => {
|
|
19155
|
+
clearTimeout(timer);
|
|
19156
|
+
resolve();
|
|
19157
|
+
};
|
|
19158
|
+
void promise2.then(settle, settle);
|
|
19159
|
+
});
|
|
19160
|
+
}
|
|
18912
19161
|
var ANTIGRAVITY_WORKSPACE_FILE_INSTRUCTION = "[System Instruction: When creating new files in the workspace, you MUST use the write_to_file tool. When modifying existing files, use the replace_file_content tool. CRITICAL: NEVER include ArtifactMetadata when calling write_to_file for workspace files (ArtifactMetadata is strictly reserved for artifacts in the brain directory, and providing it for workspace files causes a path validation rejection). Do NOT use terminal commands (such as Set-Content, Out-File, echo, or cat) to create or write code files. For clarification, ask_question is connected to the codexhost Desktop through a Hook. Use single-choice or text questions. The Hook returns the actual user response in its reason while blocking the native auto-skip behavior; do not retry merely because the native tool reports it was blocked.]\n\n";
|
|
18913
|
-
function
|
|
19162
|
+
function antigravityWorkingDirectoryInstruction(cwd) {
|
|
19163
|
+
return `[System Instruction: The project working directory is ${JSON.stringify(cwd)}. Run terminal commands and resolve relative file paths in this directory unless the task requires another one.]
|
|
19164
|
+
|
|
19165
|
+
`;
|
|
19166
|
+
}
|
|
19167
|
+
function formatAntigravityTurnPrompt(text, cwd) {
|
|
18914
19168
|
if (text.startsWith("/") || text.includes("ArtifactMetadata")) {
|
|
18915
19169
|
return text;
|
|
18916
19170
|
}
|
|
18917
|
-
|
|
19171
|
+
const workingDirectory = cwd ? antigravityWorkingDirectoryInstruction(cwd) : "";
|
|
19172
|
+
return `${ANTIGRAVITY_WORKSPACE_FILE_INSTRUCTION}${workingDirectory}${text}`;
|
|
18918
19173
|
}
|
|
18919
19174
|
function permissionDeniedTurnError(nativeMode, denial) {
|
|
18920
19175
|
const mode = nativeMode ? ` '${nativeMode}'` : "";
|
|
@@ -19016,14 +19271,15 @@ async function pollAntigravityContextUsage(logPath, conversationId, modelId, isD
|
|
|
19016
19271
|
}
|
|
19017
19272
|
return null;
|
|
19018
19273
|
}
|
|
19019
|
-
function hostUsage(value, modelId) {
|
|
19274
|
+
function hostUsage(value, modelId, scope) {
|
|
19020
19275
|
if (!value)
|
|
19021
19276
|
return null;
|
|
19022
19277
|
const inputTokens = safeToken(value.input_tokens);
|
|
19023
19278
|
const outputTokens = safeToken(value.output_tokens);
|
|
19024
19279
|
const reasoningOutputTokens = safeToken(value.thinking_tokens);
|
|
19025
19280
|
const totalTokens = safeToken(value.total_tokens);
|
|
19026
|
-
const
|
|
19281
|
+
const requestPromptTokens = scope === "request" && inputTokens !== void 0 ? inputTokens + (safeToken(value.cache_read_tokens) ?? 0) : void 0;
|
|
19282
|
+
const contextUsedTokens = safeToken(value.context_used_tokens ?? value.estimated_tokens_used) ?? requestPromptTokens;
|
|
19027
19283
|
const rawWindow = safeToken(value.context_window_tokens ?? value.max_context_tokens);
|
|
19028
19284
|
const contextWindowTokens = contextUsedTokens !== void 0 || rawWindow !== void 0 ? resolveAntigravityContextWindow(modelId, rawWindow) : void 0;
|
|
19029
19285
|
const usage = {
|
|
@@ -19100,6 +19356,7 @@ var AntigravitySession = class {
|
|
|
19100
19356
|
#printTimeout;
|
|
19101
19357
|
#toolOutputLimit;
|
|
19102
19358
|
#subagentObservationTimeoutMs;
|
|
19359
|
+
#turnCleanupWaitMs;
|
|
19103
19360
|
#history;
|
|
19104
19361
|
#subagentObservers = /* @__PURE__ */ new Set();
|
|
19105
19362
|
#active = null;
|
|
@@ -19126,6 +19383,7 @@ var AntigravitySession = class {
|
|
|
19126
19383
|
this.#thinkingOptionId = input.thinkingOptionId ?? input.history.thinkingOptionId;
|
|
19127
19384
|
this.#toolOutputLimit = input.toolOutputLimit;
|
|
19128
19385
|
this.#subagentObservationTimeoutMs = input.subagentObservationTimeoutMs;
|
|
19386
|
+
this.#turnCleanupWaitMs = input.turnCleanupWaitMs;
|
|
19129
19387
|
this.#onClosed = input.onClosed;
|
|
19130
19388
|
this.initialState = this.#state();
|
|
19131
19389
|
this.outputs = this.#channel.outputs;
|
|
@@ -19203,7 +19461,10 @@ var AntigravitySession = class {
|
|
|
19203
19461
|
};
|
|
19204
19462
|
}
|
|
19205
19463
|
let questions;
|
|
19206
|
-
|
|
19464
|
+
const hookDirectory = antigravityHookDirectory(this.#environment);
|
|
19465
|
+
const previousTurn = hookDirectory ? this.#questionCleanup : Promise.resolve();
|
|
19466
|
+
this.#preparingQuestions = previousTurn.then(() => AntigravityQuestionBridge.create({
|
|
19467
|
+
...hookDirectory ? { directory: hookDirectory } : {},
|
|
19207
19468
|
turnId: command.turnId,
|
|
19208
19469
|
nativeSessionId: () => this.#active?.command === command && !this.#active.cancellationRequested ? this.#nativeRef?.nativeSessionId : void 0,
|
|
19209
19470
|
schedule: (action) => {
|
|
@@ -19226,7 +19487,7 @@ var AntigravitySession = class {
|
|
|
19226
19487
|
}
|
|
19227
19488
|
this.#channel.emit(output);
|
|
19228
19489
|
}
|
|
19229
|
-
});
|
|
19490
|
+
}));
|
|
19230
19491
|
try {
|
|
19231
19492
|
questions = await this.#preparingQuestions;
|
|
19232
19493
|
} catch (error51) {
|
|
@@ -19246,7 +19507,7 @@ var AntigravitySession = class {
|
|
|
19246
19507
|
return { ok: false, error: invalidState("Antigravity Session is closed") };
|
|
19247
19508
|
}
|
|
19248
19509
|
const environment = { ...this.#environment, ...questions.environment };
|
|
19249
|
-
const logPath =
|
|
19510
|
+
const logPath = path11.join(os6.tmpdir(), `codexhost-antigravity-${randomUUID6()}.log`);
|
|
19250
19511
|
const arguments_ = [
|
|
19251
19512
|
"--input-format",
|
|
19252
19513
|
"stream-json",
|
|
@@ -19367,7 +19628,7 @@ ${line}`).slice(-8e3);
|
|
|
19367
19628
|
});
|
|
19368
19629
|
});
|
|
19369
19630
|
try {
|
|
19370
|
-
const turnPrompt = formatAntigravityTurnPrompt(text);
|
|
19631
|
+
const turnPrompt = formatAntigravityTurnPrompt(text, this.#cwd);
|
|
19371
19632
|
if (child.stdin.writable) {
|
|
19372
19633
|
child.stdin.write(`${JSON.stringify({ event: "user", message: { content: turnPrompt } })}
|
|
19373
19634
|
`, () => void 0);
|
|
@@ -19451,7 +19712,7 @@ ${line}`).slice(-8e3);
|
|
|
19451
19712
|
if (event.step_update.conversation_id !== this.#nativeRef?.nativeSessionId)
|
|
19452
19713
|
return;
|
|
19453
19714
|
await this.#handleStep(active, event.step_update);
|
|
19454
|
-
const usage = hostUsage(event.step_update.usage, active.model?.id);
|
|
19715
|
+
const usage = hostUsage(event.step_update.usage, active.model?.id, "request");
|
|
19455
19716
|
if (usage)
|
|
19456
19717
|
this.#publishUsage(active, usage);
|
|
19457
19718
|
this.#ensureContextUsage(active, event.step_update.conversation_id);
|
|
@@ -19477,7 +19738,7 @@ ${line}`).slice(-8e3);
|
|
|
19477
19738
|
});
|
|
19478
19739
|
return;
|
|
19479
19740
|
}
|
|
19480
|
-
const usage = hostUsage(event.result.usage, active.model?.id);
|
|
19741
|
+
const usage = hostUsage(event.result.usage, active.model?.id, "conversation");
|
|
19481
19742
|
if (usage)
|
|
19482
19743
|
this.#publishUsage(active, usage);
|
|
19483
19744
|
this.#ensureContextUsage(active, event.result.conversation_id);
|
|
@@ -19714,8 +19975,9 @@ ${line}`).slice(-8e3);
|
|
|
19714
19975
|
await active.subagents.settled;
|
|
19715
19976
|
if (active.process.stdin.writable)
|
|
19716
19977
|
active.process.stdin.end();
|
|
19717
|
-
const timer = setTimeout(() => active.process.kill(),
|
|
19718
|
-
await active.exited
|
|
19978
|
+
const timer = setTimeout(() => active.process.kill(), NATIVE_EXIT_GRACE_MS);
|
|
19979
|
+
await settledWithin(active.exited, NATIVE_EXIT_GRACE_MS + this.#turnCleanupWaitMs);
|
|
19980
|
+
clearTimeout(timer);
|
|
19719
19981
|
await active.questions.dispose();
|
|
19720
19982
|
this.#subagentObservers.delete(active.subagents);
|
|
19721
19983
|
}).catch(() => void 0);
|
|
@@ -19892,6 +20154,7 @@ function historySubagentState(history, id) {
|
|
|
19892
20154
|
var AntigravityAdapter = class {
|
|
19893
20155
|
commandCatalog = ANTIGRAVITY_COMMAND_CATALOG;
|
|
19894
20156
|
harnessId = antigravityHarnessId;
|
|
20157
|
+
usageStatistics;
|
|
19895
20158
|
subagents = {
|
|
19896
20159
|
readSnapshot: async (input) => {
|
|
19897
20160
|
if (this.#closed || input.parent.harnessId !== this.harnessId || !nativeSubagentIdSchema.safeParse(input.nativeSubagentId).success) {
|
|
@@ -19924,6 +20187,7 @@ var AntigravityAdapter = class {
|
|
|
19924
20187
|
#sessions = /* @__PURE__ */ new Set();
|
|
19925
20188
|
#toolOutputLimit;
|
|
19926
20189
|
#subagentObservationTimeoutMs;
|
|
20190
|
+
#turnCleanupWaitMs;
|
|
19927
20191
|
#closed = false;
|
|
19928
20192
|
#quota = null;
|
|
19929
20193
|
#quotaCwd = null;
|
|
@@ -19932,6 +20196,7 @@ var AntigravityAdapter = class {
|
|
|
19932
20196
|
constructor(options = {}) {
|
|
19933
20197
|
this.#command = options.command;
|
|
19934
20198
|
this.#environment = options.environment ?? process.env;
|
|
20199
|
+
this.usageStatistics = createAntigravityUsageStatistics(this.#environment);
|
|
19935
20200
|
this.#inspectTimeoutMs = options.inspectTimeoutMs ?? DEFAULT_INSPECT_TIMEOUT_MS;
|
|
19936
20201
|
this.#printTimeout = options.printTimeout ?? DEFAULT_PRINT_TIMEOUT;
|
|
19937
20202
|
this.#toolOutputLimit = options.toolOutputLimit ?? DEFAULT_TOOL_OUTPUT_LIMIT;
|
|
@@ -19940,12 +20205,17 @@ var AntigravityAdapter = class {
|
|
|
19940
20205
|
throw new RangeError("subagentObservationTimeoutMs must be a finite positive number");
|
|
19941
20206
|
}
|
|
19942
20207
|
this.#subagentObservationTimeoutMs = subagentObservationTimeoutMs;
|
|
20208
|
+
const turnCleanupWaitMs = options.turnCleanupWaitMs ?? DEFAULT_TURN_CLEANUP_WAIT_MS;
|
|
20209
|
+
if (!Number.isFinite(turnCleanupWaitMs) || turnCleanupWaitMs < 0) {
|
|
20210
|
+
throw new RangeError("turnCleanupWaitMs must be a finite non-negative number");
|
|
20211
|
+
}
|
|
20212
|
+
this.#turnCleanupWaitMs = turnCleanupWaitMs;
|
|
19943
20213
|
}
|
|
19944
20214
|
async inspect(input = {}) {
|
|
19945
20215
|
if (this.#closed) {
|
|
19946
20216
|
return { status: "unavailable", error: invalidState("Antigravity Adapter is closed") };
|
|
19947
20217
|
}
|
|
19948
|
-
const cwd =
|
|
20218
|
+
const cwd = path11.resolve(input.cwd ?? process.cwd());
|
|
19949
20219
|
const inFlight = this.#inspectionInFlight.get(cwd);
|
|
19950
20220
|
if (inFlight)
|
|
19951
20221
|
return inFlight;
|
|
@@ -20088,7 +20358,7 @@ var AntigravityAdapter = class {
|
|
|
20088
20358
|
}
|
|
20089
20359
|
};
|
|
20090
20360
|
}
|
|
20091
|
-
const cwd =
|
|
20361
|
+
const cwd = path11.resolve(input.cwd);
|
|
20092
20362
|
let catalog = this.#inspectionCache.get(cwd)?.catalog;
|
|
20093
20363
|
if (!catalog) {
|
|
20094
20364
|
const inspection = await this.inspect({ cwd: input.cwd });
|
|
@@ -20124,6 +20394,7 @@ var AntigravityAdapter = class {
|
|
|
20124
20394
|
...params.thinkingOptionId ? { thinkingOptionId: params.thinkingOptionId } : {},
|
|
20125
20395
|
toolOutputLimit: this.#toolOutputLimit,
|
|
20126
20396
|
subagentObservationTimeoutMs: this.#subagentObservationTimeoutMs,
|
|
20397
|
+
turnCleanupWaitMs: this.#turnCleanupWaitMs,
|
|
20127
20398
|
onClosed: () => this.#sessions.delete(session2)
|
|
20128
20399
|
});
|
|
20129
20400
|
this.#sessions.add(session2);
|
|
@@ -20160,6 +20431,7 @@ var AntigravityAdapter = class {
|
|
|
20160
20431
|
...params.thinkingOptionId ? { thinkingOptionId: params.thinkingOptionId } : {},
|
|
20161
20432
|
toolOutputLimit: this.#toolOutputLimit,
|
|
20162
20433
|
subagentObservationTimeoutMs: this.#subagentObservationTimeoutMs,
|
|
20434
|
+
turnCleanupWaitMs: this.#turnCleanupWaitMs,
|
|
20163
20435
|
onClosed: () => this.#sessions.delete(session2)
|
|
20164
20436
|
});
|
|
20165
20437
|
this.#sessions.add(session2);
|
|
@@ -20217,6 +20489,7 @@ var AntigravityAdapter = class {
|
|
|
20217
20489
|
...thinkingOptionId ? { thinkingOptionId } : {},
|
|
20218
20490
|
toolOutputLimit: this.#toolOutputLimit,
|
|
20219
20491
|
subagentObservationTimeoutMs: this.#subagentObservationTimeoutMs,
|
|
20492
|
+
turnCleanupWaitMs: this.#turnCleanupWaitMs,
|
|
20220
20493
|
onClosed: () => this.#sessions.delete(session)
|
|
20221
20494
|
});
|
|
20222
20495
|
this.#sessions.add(session);
|
|
@@ -20276,11 +20549,23 @@ function createAntigravityInstallation(environment, command, dependencies = {})
|
|
|
20276
20549
|
|
|
20277
20550
|
// dist/plugin.js
|
|
20278
20551
|
var ANTIGRAVITY_COMMAND_ENV = "CODEXHOST_ANTIGRAVITY_COMMAND";
|
|
20552
|
+
var ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV = "AGY_CLI_DISABLE_AUTO_UPDATE";
|
|
20553
|
+
function antigravityProcessEnvironment(environment, platform) {
|
|
20554
|
+
if (platform !== "win32" && platform !== "darwin")
|
|
20555
|
+
return environment;
|
|
20556
|
+
const isWindows = platform === "win32";
|
|
20557
|
+
const matchesSwitch = (name) => isWindows ? name.toUpperCase() === ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV : name === ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV;
|
|
20558
|
+
const entries = Object.entries(environment);
|
|
20559
|
+
const configured = entries.some(([name, value]) => matchesSwitch(name) && value !== void 0);
|
|
20560
|
+
const hasUndefinedSwitch = entries.some(([name, value]) => matchesSwitch(name) && value === void 0);
|
|
20561
|
+
const cleanEnvironment = hasUndefinedSwitch ? Object.fromEntries(entries.filter(([name, value]) => !matchesSwitch(name) || value !== void 0)) : environment;
|
|
20562
|
+
return configured ? cleanEnvironment : { ...cleanEnvironment, [ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV]: "true" };
|
|
20563
|
+
}
|
|
20279
20564
|
function createHarnessAdapter(context) {
|
|
20280
20565
|
const environment = { ...context.environment };
|
|
20281
20566
|
return Object.assign(new AntigravityAdapter({
|
|
20282
20567
|
...environment[ANTIGRAVITY_COMMAND_ENV] ? { command: environment[ANTIGRAVITY_COMMAND_ENV] } : {},
|
|
20283
|
-
environment
|
|
20568
|
+
environment: antigravityProcessEnvironment(environment, context.platform)
|
|
20284
20569
|
}), {
|
|
20285
20570
|
install: createHarnessInstaller(environment, {
|
|
20286
20571
|
posix: "https://antigravity.google/cli/install.sh",
|
|
@@ -20297,6 +20582,8 @@ async function warmup(adapter) {
|
|
|
20297
20582
|
}
|
|
20298
20583
|
export {
|
|
20299
20584
|
ANTIGRAVITY_COMMAND_ENV,
|
|
20585
|
+
ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV,
|
|
20586
|
+
antigravityProcessEnvironment,
|
|
20300
20587
|
createHarnessAdapter,
|
|
20301
20588
|
warmup
|
|
20302
20589
|
};
|