@liberseek/boft-cli-linux-x64 0.8.4 → 0.8.6
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 +2 -2
- package/THIRD_PARTY_NOTICES.txt +6 -2
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +129 -28
- package/app/console-web.js +336 -78
- package/app/desktop-controller.mjs +1741 -60
- package/app/host-runtime.mjs +4983 -2002
- package/app/plugins/antigravity/plugin.mjs +423 -63
- package/app/plugins/claude-code/plugin.mjs +417 -264
- package/app/plugins/codebuddy/plugin.mjs +256 -134
- package/app/plugins/codex-usage/plugin.mjs +97 -32
- package/app/plugins/copilot/plugin.mjs +122 -57
- package/app/plugins/cursor-cli/plugin.mjs +236 -139
- package/app/plugins/deepseek-harness/plugin.mjs +584 -86
- package/app/plugins/devin/assets/icon.svg +1 -0
- package/app/plugins/devin/manifest.json +30 -0
- package/app/plugins/devin/plugin.mjs +23425 -0
- package/app/plugins/enabled.json +2 -0
- package/app/plugins/grok/plugin.mjs +839 -500
- package/app/plugins/hermes/plugin.mjs +522 -200
- package/app/plugins/kimi-code/plugin.mjs +134 -22
- package/app/plugins/kiro-cli/plugin.mjs +84 -19
- package/app/plugins/muse/plugin.mjs +74 -9
- package/app/plugins/omp/plugin.mjs +104 -39
- package/app/plugins/opencode/plugin.mjs +126 -61
- package/app/plugins/pi/plugin.mjs +1769 -468
- package/app/plugins/qoder/plugin.mjs +9617 -8682
- package/app/plugins/qoder-cn/plugin.mjs +9617 -8682
- package/app/plugins/qwen-code/assets/icon.svg +1 -0
- package/app/plugins/qwen-code/manifest.json +29 -0
- package/app/plugins/qwen-code/plugin.mjs +29366 -0
- package/app/plugins/workbuddy/plugin.mjs +256 -134
- package/app/plugins/zcode/plugin.mjs +265 -42
- package/app/renderer-extension.js +3286 -528
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/licenses/Qwen-Code-SDK-LICENSE.txt +203 -0
- package/package.json +2 -2
|
@@ -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
|
}
|
|
@@ -15089,6 +15089,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
|
15089
15089
|
cachedInputTokens: count,
|
|
15090
15090
|
cacheWriteInputTokens: count,
|
|
15091
15091
|
cacheKnownInputTokens: count,
|
|
15092
|
+
cacheHitCachedInputTokens: count,
|
|
15093
|
+
cacheHitInputTokens: count,
|
|
15092
15094
|
outputTokens: count,
|
|
15093
15095
|
reasoningOutputTokens: count,
|
|
15094
15096
|
/** USD at the public price, summed over the priced requests only. */
|
|
@@ -15196,6 +15198,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
15196
15198
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
15197
15199
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
15198
15200
|
|
|
15201
|
+
// ../../shared-contracts/dist/thread-questions.js
|
|
15202
|
+
var field = external_exports.discriminatedUnion("type", [
|
|
15203
|
+
external_exports.object({
|
|
15204
|
+
id: external_exports.string().min(1),
|
|
15205
|
+
type: external_exports.literal("choice"),
|
|
15206
|
+
prompt: external_exports.string(),
|
|
15207
|
+
options: external_exports.array(external_exports.object({
|
|
15208
|
+
value: external_exports.string().min(1),
|
|
15209
|
+
label: external_exports.string(),
|
|
15210
|
+
description: external_exports.string().optional()
|
|
15211
|
+
})).min(1),
|
|
15212
|
+
multiple: external_exports.boolean(),
|
|
15213
|
+
allowOther: external_exports.boolean(),
|
|
15214
|
+
optional: external_exports.boolean()
|
|
15215
|
+
}),
|
|
15216
|
+
external_exports.object({
|
|
15217
|
+
id: external_exports.string().min(1),
|
|
15218
|
+
type: external_exports.literal("text"),
|
|
15219
|
+
prompt: external_exports.string(),
|
|
15220
|
+
multiline: external_exports.boolean(),
|
|
15221
|
+
secret: external_exports.literal(false),
|
|
15222
|
+
optional: external_exports.boolean(),
|
|
15223
|
+
placeholder: external_exports.string().optional(),
|
|
15224
|
+
prefill: external_exports.string().optional()
|
|
15225
|
+
})
|
|
15226
|
+
]);
|
|
15227
|
+
var threadQuestionSchema = external_exports.object({
|
|
15228
|
+
interactionId: external_exports.string().min(1),
|
|
15229
|
+
turnId: external_exports.string().min(1),
|
|
15230
|
+
title: external_exports.string().optional(),
|
|
15231
|
+
questions: external_exports.array(field).min(1)
|
|
15232
|
+
}).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
|
|
15233
|
+
message: "Shared cards require at least one multi-select question"
|
|
15234
|
+
});
|
|
15235
|
+
var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
|
|
15236
|
+
var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
|
|
15237
|
+
var threadQuestionRespondParamsSchema = external_exports.strictObject({
|
|
15238
|
+
threadId: external_exports.string().min(1),
|
|
15239
|
+
turnId: external_exports.string().min(1),
|
|
15240
|
+
interactionId: external_exports.string().min(1),
|
|
15241
|
+
answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
|
|
15242
|
+
cancelled: external_exports.boolean().default(false)
|
|
15243
|
+
});
|
|
15244
|
+
var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
|
|
15245
|
+
|
|
15199
15246
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
15200
15247
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15201
15248
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -15955,6 +16002,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15955
16002
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15956
16003
|
text: external_exports.string().optional()
|
|
15957
16004
|
}).strict();
|
|
16005
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
16006
|
+
kind: external_exports.literal("application"),
|
|
16007
|
+
value: external_exports.string().transform((text, context) => {
|
|
16008
|
+
try {
|
|
16009
|
+
return JSON.parse(text);
|
|
16010
|
+
} catch {
|
|
16011
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
16012
|
+
return external_exports.NEVER;
|
|
16013
|
+
}
|
|
16014
|
+
}).pipe(external_exports.object({
|
|
16015
|
+
expectedTurnId: hostTurnIdSchema,
|
|
16016
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
16017
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
16018
|
+
}).strict())
|
|
16019
|
+
}).strict().transform((context) => context.value);
|
|
15958
16020
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15959
16021
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15960
16022
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -15965,7 +16027,10 @@ var harnessPluginRouteSchema = external_exports.object({
|
|
|
15965
16027
|
harnessId: harnessPluginIdSchema,
|
|
15966
16028
|
model: harnessModelRefSchema.optional(),
|
|
15967
16029
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15968
|
-
permissionModeId: harnessPermissionModeIdSchema.optional()
|
|
16030
|
+
permissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
16031
|
+
/** A draft prewarm create: stays unsubmitted until the user's first Turn.
|
|
16032
|
+
* Desktop forwards only the Model of a main-process prewarm to thread/start. */
|
|
16033
|
+
prewarm: external_exports.literal(true).optional()
|
|
15969
16034
|
}).strict();
|
|
15970
16035
|
|
|
15971
16036
|
// ../../shared-contracts/dist/harness-launch-settings.js
|
|
@@ -16712,6 +16777,12 @@ function historyPath(environment) {
|
|
|
16712
16777
|
const threadId = safeThreadId(environment);
|
|
16713
16778
|
return threadId ? path5.join(historyRoot(environment), `${threadId}.json`) : null;
|
|
16714
16779
|
}
|
|
16780
|
+
function antigravityHookDirectory(environment) {
|
|
16781
|
+
const threadId = safeThreadId(environment);
|
|
16782
|
+
if (!threadId || threadId === "." || threadId === "..")
|
|
16783
|
+
return null;
|
|
16784
|
+
return path5.join(historyRoot(environment), "hooks", threadId);
|
|
16785
|
+
}
|
|
16715
16786
|
function jsonTurn(turn) {
|
|
16716
16787
|
return JSON.parse(JSON.stringify(turn));
|
|
16717
16788
|
}
|
|
@@ -16900,8 +16971,11 @@ var AntigravityHistory = class _AntigravityHistory {
|
|
|
16900
16971
|
function nativeConversationDbPath(nativeSessionId, homedir2 = os3.homedir()) {
|
|
16901
16972
|
return path6.join(homedir2, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
|
|
16902
16973
|
}
|
|
16974
|
+
function nativeBrainRoot(homedir2 = os3.homedir()) {
|
|
16975
|
+
return path6.join(homedir2, ".gemini", "antigravity-cli", "brain");
|
|
16976
|
+
}
|
|
16903
16977
|
function nativeBrainDirPath(nativeSessionId, homedir2 = os3.homedir()) {
|
|
16904
|
-
return path6.join(homedir2,
|
|
16978
|
+
return path6.join(nativeBrainRoot(homedir2), nativeSessionId);
|
|
16905
16979
|
}
|
|
16906
16980
|
async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, retainedTurnsCountOrHomedir, homedirOption = os3.homedir()) {
|
|
16907
16981
|
let retainedTurnsCount;
|
|
@@ -18154,7 +18228,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
18154
18228
|
this.#server.on("request", (request, response) => this.#receive(request, response));
|
|
18155
18229
|
}
|
|
18156
18230
|
static async create(options) {
|
|
18157
|
-
const directory = await mkdtemp2(path8.join(os4.tmpdir(), "codexhost-agy-question-"));
|
|
18231
|
+
const directory = options.directory ?? await mkdtemp2(path8.join(os4.tmpdir(), "codexhost-agy-question-"));
|
|
18158
18232
|
const bridge = new _AntigravityQuestionBridge(directory, options);
|
|
18159
18233
|
try {
|
|
18160
18234
|
await new Promise((resolve, reject) => {
|
|
@@ -18170,7 +18244,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
18170
18244
|
throw new Error("Question bridge did not bind");
|
|
18171
18245
|
bridge.environment.CODEXHOST_AGY_QUESTION_URL = `http://127.0.0.1:${address.port}/question`;
|
|
18172
18246
|
const client = path8.join(directory, "question-hook.cjs");
|
|
18173
|
-
await mkdir3(path8.join(directory, ".agents"));
|
|
18247
|
+
await mkdir3(path8.join(directory, ".agents"), { recursive: true, mode: 448 });
|
|
18174
18248
|
await writeFile3(client, ANTIGRAVITY_QUESTION_HOOK_CLIENT, "utf8");
|
|
18175
18249
|
const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
18176
18250
|
bridge.environment.CODEXHOST_AGY_QUESTION_NODE = `"${process.execPath.replaceAll("\\", "/")}"`;
|
|
@@ -18399,7 +18473,9 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
18399
18473
|
this.#server.close(() => resolve());
|
|
18400
18474
|
this.#server.closeAllConnections();
|
|
18401
18475
|
});
|
|
18402
|
-
|
|
18476
|
+
if (this.#options.directory === void 0) {
|
|
18477
|
+
await rm3(this.directory, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
|
|
18478
|
+
}
|
|
18403
18479
|
})();
|
|
18404
18480
|
return this.#disposal;
|
|
18405
18481
|
}
|
|
@@ -18893,12 +18969,221 @@ var AntigravitySubagents = class {
|
|
|
18893
18969
|
}
|
|
18894
18970
|
};
|
|
18895
18971
|
|
|
18972
|
+
// dist/usage-statistics.js
|
|
18973
|
+
import { lstat, opendir } from "node:fs/promises";
|
|
18974
|
+
import os5 from "node:os";
|
|
18975
|
+
import path10 from "node:path";
|
|
18976
|
+
|
|
18977
|
+
// ../../harness-adapter/dist/usage-statistics.js
|
|
18978
|
+
import { createReadStream } from "node:fs";
|
|
18979
|
+
import { createInterface } from "node:readline";
|
|
18980
|
+
var HarnessUsageSourceChangedError = class extends Error {
|
|
18981
|
+
code = "HARNESS_USAGE_SOURCE_CHANGED";
|
|
18982
|
+
/** Plugins may bundle their own copy of this contract, so instanceof is insufficient. */
|
|
18983
|
+
static is(error51) {
|
|
18984
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "HARNESS_USAGE_SOURCE_CHANGED";
|
|
18985
|
+
}
|
|
18986
|
+
};
|
|
18987
|
+
var MAX_SESSION_ID_LENGTH = 512;
|
|
18988
|
+
var MAX_CWD_LENGTH = 4096;
|
|
18989
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
18990
|
+
function usageSessionTitle(value) {
|
|
18991
|
+
if (typeof value !== "string")
|
|
18992
|
+
return void 0;
|
|
18993
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
18994
|
+
if (!normalized)
|
|
18995
|
+
return void 0;
|
|
18996
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
18997
|
+
return normalized;
|
|
18998
|
+
let title = "";
|
|
18999
|
+
for (const character of normalized) {
|
|
19000
|
+
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
19001
|
+
break;
|
|
19002
|
+
title += character;
|
|
19003
|
+
}
|
|
19004
|
+
return `${title.trimEnd()}…`;
|
|
19005
|
+
}
|
|
19006
|
+
function sessionIdOk(value) {
|
|
19007
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
19008
|
+
}
|
|
19009
|
+
function cwdOk(value) {
|
|
19010
|
+
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("\\\\"));
|
|
19011
|
+
}
|
|
19012
|
+
function withUsageSession(entry, session) {
|
|
19013
|
+
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
19014
|
+
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
19015
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
19016
|
+
if (sessionId === void 0 && cwd === void 0)
|
|
19017
|
+
return entry;
|
|
19018
|
+
return {
|
|
19019
|
+
...entry,
|
|
19020
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
19021
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
19022
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
19023
|
+
};
|
|
19024
|
+
}
|
|
19025
|
+
async function* jsonlRecords(file2, marker, signal) {
|
|
19026
|
+
const lines = createInterface({
|
|
19027
|
+
input: createReadStream(file2, { encoding: "utf8", signal }),
|
|
19028
|
+
crlfDelay: Infinity
|
|
19029
|
+
});
|
|
19030
|
+
for await (const line of lines) {
|
|
19031
|
+
if (!line.includes(marker))
|
|
19032
|
+
continue;
|
|
19033
|
+
let value;
|
|
19034
|
+
try {
|
|
19035
|
+
value = JSON.parse(line);
|
|
19036
|
+
} catch {
|
|
19037
|
+
continue;
|
|
19038
|
+
}
|
|
19039
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
19040
|
+
yield value;
|
|
19041
|
+
}
|
|
19042
|
+
}
|
|
19043
|
+
}
|
|
19044
|
+
function nativeTimeMs(value) {
|
|
19045
|
+
const time3 = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : Number.NaN;
|
|
19046
|
+
return Number.isFinite(time3) && time3 > 0 ? Math.floor(time3) : null;
|
|
19047
|
+
}
|
|
19048
|
+
|
|
19049
|
+
// dist/usage-statistics.js
|
|
19050
|
+
function count2(value) {
|
|
19051
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
19052
|
+
}
|
|
19053
|
+
function antigravityHome(environment) {
|
|
19054
|
+
return (process.platform === "win32" ? environment.USERPROFILE : environment.HOME) || os5.homedir();
|
|
19055
|
+
}
|
|
19056
|
+
function transcriptPath(brainRoot, conversationId) {
|
|
19057
|
+
return path10.join(brainRoot, conversationId, ".system_generated", "logs", "transcript.jsonl");
|
|
19058
|
+
}
|
|
19059
|
+
function isMissing(error51) {
|
|
19060
|
+
const code = error51?.code;
|
|
19061
|
+
return code === "ENOENT" || code === "ENOTDIR";
|
|
19062
|
+
}
|
|
19063
|
+
async function lstatIfPresent(target) {
|
|
19064
|
+
try {
|
|
19065
|
+
return await lstat(target);
|
|
19066
|
+
} catch (error51) {
|
|
19067
|
+
if (isMissing(error51))
|
|
19068
|
+
return null;
|
|
19069
|
+
throw error51;
|
|
19070
|
+
}
|
|
19071
|
+
}
|
|
19072
|
+
async function transcriptFingerprint(file2) {
|
|
19073
|
+
const logs = path10.dirname(file2);
|
|
19074
|
+
for (const directory of [path10.dirname(logs), logs]) {
|
|
19075
|
+
if (!(await lstatIfPresent(directory))?.isDirectory())
|
|
19076
|
+
return null;
|
|
19077
|
+
}
|
|
19078
|
+
const info = await lstatIfPresent(file2);
|
|
19079
|
+
return info?.isFile() && info.size > 0 ? `${info.ino}:${info.size}:${info.mtimeMs}` : null;
|
|
19080
|
+
}
|
|
19081
|
+
async function listTranscripts(brainRoot, signal) {
|
|
19082
|
+
signal.throwIfAborted();
|
|
19083
|
+
const conversations = await opendir(brainRoot).catch((error51) => {
|
|
19084
|
+
if (error51.code === "ENOENT")
|
|
19085
|
+
return null;
|
|
19086
|
+
throw error51;
|
|
19087
|
+
});
|
|
19088
|
+
if (!conversations)
|
|
19089
|
+
return [];
|
|
19090
|
+
const sources = [];
|
|
19091
|
+
for await (const entry of conversations) {
|
|
19092
|
+
signal.throwIfAborted();
|
|
19093
|
+
if (!entry.isDirectory())
|
|
19094
|
+
continue;
|
|
19095
|
+
const file2 = transcriptPath(brainRoot, entry.name);
|
|
19096
|
+
const fingerprint = await transcriptFingerprint(file2);
|
|
19097
|
+
if (fingerprint)
|
|
19098
|
+
sources.push({ id: file2, fingerprint });
|
|
19099
|
+
}
|
|
19100
|
+
return sources;
|
|
19101
|
+
}
|
|
19102
|
+
async function readAntigravityUsage(file2, signal) {
|
|
19103
|
+
const sessionId = path10.basename(path10.resolve(file2, "..", "..", ".."));
|
|
19104
|
+
const requests = /* @__PURE__ */ new Map();
|
|
19105
|
+
for await (const record2 of jsonlRecords(file2, '"input_tokens"', signal)) {
|
|
19106
|
+
if (record2.type !== "PLANNER_RESPONSE")
|
|
19107
|
+
continue;
|
|
19108
|
+
const step = count2(record2.step_index);
|
|
19109
|
+
const input = count2(record2.input_tokens);
|
|
19110
|
+
const output = count2(record2.output_tokens);
|
|
19111
|
+
const cached2 = count2(record2.cache_read_tokens);
|
|
19112
|
+
const at = nativeTimeMs(record2.created_at);
|
|
19113
|
+
if (step === null || input === null || output === null || at === null)
|
|
19114
|
+
continue;
|
|
19115
|
+
requests.set(step, withUsageSession({
|
|
19116
|
+
id: `${String(record2.created_at)}:${step}:${input}:${cached2 ?? "-"}:${output}`,
|
|
19117
|
+
occurredAtMs: at,
|
|
19118
|
+
inputTokens: input + (cached2 ?? 0),
|
|
19119
|
+
...cached2 !== null ? { cachedInputTokens: cached2 } : {},
|
|
19120
|
+
outputTokens: output
|
|
19121
|
+
}, { sessionId }));
|
|
19122
|
+
}
|
|
19123
|
+
return [...requests.values()];
|
|
19124
|
+
}
|
|
19125
|
+
function createAntigravityUsageStatistics(environment) {
|
|
19126
|
+
const brainRoot = nativeBrainRoot(antigravityHome(environment));
|
|
19127
|
+
let listed = /* @__PURE__ */ new Map();
|
|
19128
|
+
return Object.freeze({
|
|
19129
|
+
async listSources(signal) {
|
|
19130
|
+
const sources = await listTranscripts(brainRoot, signal);
|
|
19131
|
+
listed = new Map(sources.map(({ id, fingerprint }) => [id, fingerprint]));
|
|
19132
|
+
return sources;
|
|
19133
|
+
},
|
|
19134
|
+
async readSource(id, signal) {
|
|
19135
|
+
const expected = listed.get(id);
|
|
19136
|
+
let entries;
|
|
19137
|
+
try {
|
|
19138
|
+
entries = await readAntigravityUsage(id, signal);
|
|
19139
|
+
} catch (error51) {
|
|
19140
|
+
if (expected !== void 0 && isMissing(error51)) {
|
|
19141
|
+
throw new HarnessUsageSourceChangedError("Antigravity transcript disappeared before reading; refresh to retry");
|
|
19142
|
+
}
|
|
19143
|
+
throw error51;
|
|
19144
|
+
}
|
|
19145
|
+
if (expected !== void 0 && await transcriptFingerprint(id) !== expected) {
|
|
19146
|
+
throw new HarnessUsageSourceChangedError("Antigravity transcript changed while reading; refresh to retry");
|
|
19147
|
+
}
|
|
19148
|
+
return entries;
|
|
19149
|
+
}
|
|
19150
|
+
});
|
|
19151
|
+
}
|
|
19152
|
+
|
|
18896
19153
|
// dist/antigravity-adapter.js
|
|
19154
|
+
function unstreamedReplyTail(streamed, reply) {
|
|
19155
|
+
const shown = streamed.replace(/\s+/gu, "");
|
|
19156
|
+
if (shown === "")
|
|
19157
|
+
return null;
|
|
19158
|
+
const replied = reply.replace(/\s+/gu, "");
|
|
19159
|
+
if (shown.endsWith(replied))
|
|
19160
|
+
return "";
|
|
19161
|
+
let at = 0;
|
|
19162
|
+
let matched = 0;
|
|
19163
|
+
while (matched < shown.length && at < reply.length) {
|
|
19164
|
+
const char = reply[at] ?? "";
|
|
19165
|
+
if (/\s/u.test(char)) {
|
|
19166
|
+
at += 1;
|
|
19167
|
+
continue;
|
|
19168
|
+
}
|
|
19169
|
+
if (char !== shown[matched])
|
|
19170
|
+
return null;
|
|
19171
|
+
at += 1;
|
|
19172
|
+
matched += 1;
|
|
19173
|
+
}
|
|
19174
|
+
if (matched < shown.length)
|
|
19175
|
+
return null;
|
|
19176
|
+
const tail = reply.slice(at);
|
|
19177
|
+
const shownTrailing = /\s*$/u.exec(streamed)?.[0] ?? "";
|
|
19178
|
+
return tail.startsWith(shownTrailing) ? tail.slice(shownTrailing.length) : tail;
|
|
19179
|
+
}
|
|
18897
19180
|
var antigravityHarnessId = harnessIdSchema.parse("antigravity");
|
|
18898
19181
|
var DEFAULT_INSPECT_TIMEOUT_MS = 2e4;
|
|
18899
19182
|
var DEFAULT_PRINT_TIMEOUT = "30m";
|
|
18900
19183
|
var DEFAULT_TOOL_OUTPUT_LIMIT = 64e3;
|
|
18901
19184
|
var DEFAULT_SUBAGENT_OBSERVATION_TIMEOUT_MS = 3e4;
|
|
19185
|
+
var NATIVE_EXIT_GRACE_MS = 2e3;
|
|
19186
|
+
var DEFAULT_TURN_CLEANUP_WAIT_MS = 5e3;
|
|
18902
19187
|
var CONTEXT_USAGE_TIMEOUT_MS = 8e3;
|
|
18903
19188
|
var CONTEXT_USAGE_RETRY_MS = 100;
|
|
18904
19189
|
var TRAJECTORY_TIMEOUT_MS = 2e3;
|
|
@@ -18927,8 +19212,8 @@ function mergePendingStep(pending, step) {
|
|
|
18927
19212
|
};
|
|
18928
19213
|
}
|
|
18929
19214
|
function sameFile(left, right) {
|
|
18930
|
-
const a =
|
|
18931
|
-
const b =
|
|
19215
|
+
const a = path11.resolve(left);
|
|
19216
|
+
const b = path11.resolve(right);
|
|
18932
19217
|
return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
18933
19218
|
}
|
|
18934
19219
|
function resolveAntigravityContextWindow(modelId, reportedWindow) {
|
|
@@ -18956,12 +19241,28 @@ function errorMessage(error51) {
|
|
|
18956
19241
|
function invalidState(message) {
|
|
18957
19242
|
return { code: "invalidState", message, retryable: false };
|
|
18958
19243
|
}
|
|
19244
|
+
function settledWithin(promise2, timeoutMs) {
|
|
19245
|
+
return new Promise((resolve) => {
|
|
19246
|
+
const timer = setTimeout(resolve, timeoutMs);
|
|
19247
|
+
const settle = () => {
|
|
19248
|
+
clearTimeout(timer);
|
|
19249
|
+
resolve();
|
|
19250
|
+
};
|
|
19251
|
+
void promise2.then(settle, settle);
|
|
19252
|
+
});
|
|
19253
|
+
}
|
|
18959
19254
|
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";
|
|
18960
|
-
function
|
|
19255
|
+
function antigravityWorkingDirectoryInstruction(cwd) {
|
|
19256
|
+
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.]
|
|
19257
|
+
|
|
19258
|
+
`;
|
|
19259
|
+
}
|
|
19260
|
+
function formatAntigravityTurnPrompt(text, cwd) {
|
|
18961
19261
|
if (text.startsWith("/") || text.includes("ArtifactMetadata")) {
|
|
18962
19262
|
return text;
|
|
18963
19263
|
}
|
|
18964
|
-
|
|
19264
|
+
const workingDirectory = cwd ? antigravityWorkingDirectoryInstruction(cwd) : "";
|
|
19265
|
+
return `${ANTIGRAVITY_WORKSPACE_FILE_INSTRUCTION}${workingDirectory}${text}`;
|
|
18965
19266
|
}
|
|
18966
19267
|
function permissionDeniedTurnError(nativeMode, denial) {
|
|
18967
19268
|
const mode = nativeMode ? ` '${nativeMode}'` : "";
|
|
@@ -19063,14 +19364,15 @@ async function pollAntigravityContextUsage(logPath, conversationId, modelId, isD
|
|
|
19063
19364
|
}
|
|
19064
19365
|
return null;
|
|
19065
19366
|
}
|
|
19066
|
-
function hostUsage(value, modelId) {
|
|
19367
|
+
function hostUsage(value, modelId, scope) {
|
|
19067
19368
|
if (!value)
|
|
19068
19369
|
return null;
|
|
19069
19370
|
const inputTokens = safeToken(value.input_tokens);
|
|
19070
19371
|
const outputTokens = safeToken(value.output_tokens);
|
|
19071
19372
|
const reasoningOutputTokens = safeToken(value.thinking_tokens);
|
|
19072
19373
|
const totalTokens = safeToken(value.total_tokens);
|
|
19073
|
-
const
|
|
19374
|
+
const requestPromptTokens = scope === "request" && inputTokens !== void 0 ? inputTokens + (safeToken(value.cache_read_tokens) ?? 0) : void 0;
|
|
19375
|
+
const contextUsedTokens = safeToken(value.context_used_tokens ?? value.estimated_tokens_used) ?? requestPromptTokens;
|
|
19074
19376
|
const rawWindow = safeToken(value.context_window_tokens ?? value.max_context_tokens);
|
|
19075
19377
|
const contextWindowTokens = contextUsedTokens !== void 0 || rawWindow !== void 0 ? resolveAntigravityContextWindow(modelId, rawWindow) : void 0;
|
|
19076
19378
|
const usage = {
|
|
@@ -19147,6 +19449,7 @@ var AntigravitySession = class {
|
|
|
19147
19449
|
#printTimeout;
|
|
19148
19450
|
#toolOutputLimit;
|
|
19149
19451
|
#subagentObservationTimeoutMs;
|
|
19452
|
+
#turnCleanupWaitMs;
|
|
19150
19453
|
#history;
|
|
19151
19454
|
#subagentObservers = /* @__PURE__ */ new Set();
|
|
19152
19455
|
#active = null;
|
|
@@ -19173,6 +19476,7 @@ var AntigravitySession = class {
|
|
|
19173
19476
|
this.#thinkingOptionId = input.thinkingOptionId ?? input.history.thinkingOptionId;
|
|
19174
19477
|
this.#toolOutputLimit = input.toolOutputLimit;
|
|
19175
19478
|
this.#subagentObservationTimeoutMs = input.subagentObservationTimeoutMs;
|
|
19479
|
+
this.#turnCleanupWaitMs = input.turnCleanupWaitMs;
|
|
19176
19480
|
this.#onClosed = input.onClosed;
|
|
19177
19481
|
this.initialState = this.#state();
|
|
19178
19482
|
this.outputs = this.#channel.outputs;
|
|
@@ -19250,7 +19554,10 @@ var AntigravitySession = class {
|
|
|
19250
19554
|
};
|
|
19251
19555
|
}
|
|
19252
19556
|
let questions;
|
|
19253
|
-
|
|
19557
|
+
const hookDirectory = antigravityHookDirectory(this.#environment);
|
|
19558
|
+
const previousTurn = hookDirectory ? this.#questionCleanup : Promise.resolve();
|
|
19559
|
+
this.#preparingQuestions = previousTurn.then(() => AntigravityQuestionBridge.create({
|
|
19560
|
+
...hookDirectory ? { directory: hookDirectory } : {},
|
|
19254
19561
|
turnId: command.turnId,
|
|
19255
19562
|
nativeSessionId: () => this.#active?.command === command && !this.#active.cancellationRequested ? this.#nativeRef?.nativeSessionId : void 0,
|
|
19256
19563
|
schedule: (action) => {
|
|
@@ -19273,7 +19580,7 @@ var AntigravitySession = class {
|
|
|
19273
19580
|
}
|
|
19274
19581
|
this.#channel.emit(output);
|
|
19275
19582
|
}
|
|
19276
|
-
});
|
|
19583
|
+
}));
|
|
19277
19584
|
try {
|
|
19278
19585
|
questions = await this.#preparingQuestions;
|
|
19279
19586
|
} catch (error51) {
|
|
@@ -19293,7 +19600,7 @@ var AntigravitySession = class {
|
|
|
19293
19600
|
return { ok: false, error: invalidState("Antigravity Session is closed") };
|
|
19294
19601
|
}
|
|
19295
19602
|
const environment = { ...this.#environment, ...questions.environment };
|
|
19296
|
-
const logPath =
|
|
19603
|
+
const logPath = path11.join(os6.tmpdir(), `codexhost-antigravity-${randomUUID6()}.log`);
|
|
19297
19604
|
const arguments_ = [
|
|
19298
19605
|
"--input-format",
|
|
19299
19606
|
"stream-json",
|
|
@@ -19354,6 +19661,7 @@ var AntigravitySession = class {
|
|
|
19354
19661
|
logPath,
|
|
19355
19662
|
agentItem: null,
|
|
19356
19663
|
agentText: "",
|
|
19664
|
+
turnAgentText: "",
|
|
19357
19665
|
tools: /* @__PURE__ */ new Map(),
|
|
19358
19666
|
completedItems: [],
|
|
19359
19667
|
stderr: "",
|
|
@@ -19414,7 +19722,7 @@ ${line}`).slice(-8e3);
|
|
|
19414
19722
|
});
|
|
19415
19723
|
});
|
|
19416
19724
|
try {
|
|
19417
|
-
const turnPrompt = formatAntigravityTurnPrompt(text);
|
|
19725
|
+
const turnPrompt = formatAntigravityTurnPrompt(text, this.#cwd);
|
|
19418
19726
|
if (child.stdin.writable) {
|
|
19419
19727
|
child.stdin.write(`${JSON.stringify({ event: "user", message: { content: turnPrompt } })}
|
|
19420
19728
|
`, () => void 0);
|
|
@@ -19498,7 +19806,7 @@ ${line}`).slice(-8e3);
|
|
|
19498
19806
|
if (event.step_update.conversation_id !== this.#nativeRef?.nativeSessionId)
|
|
19499
19807
|
return;
|
|
19500
19808
|
await this.#handleStep(active, event.step_update);
|
|
19501
|
-
const usage = hostUsage(event.step_update.usage, active.model?.id);
|
|
19809
|
+
const usage = hostUsage(event.step_update.usage, active.model?.id, "request");
|
|
19502
19810
|
if (usage)
|
|
19503
19811
|
this.#publishUsage(active, usage);
|
|
19504
19812
|
this.#ensureContextUsage(active, event.step_update.conversation_id);
|
|
@@ -19524,7 +19832,7 @@ ${line}`).slice(-8e3);
|
|
|
19524
19832
|
});
|
|
19525
19833
|
return;
|
|
19526
19834
|
}
|
|
19527
|
-
const usage = hostUsage(event.result.usage, active.model?.id);
|
|
19835
|
+
const usage = hostUsage(event.result.usage, active.model?.id, "conversation");
|
|
19528
19836
|
if (usage)
|
|
19529
19837
|
this.#publishUsage(active, usage);
|
|
19530
19838
|
this.#ensureContextUsage(active, event.result.conversation_id);
|
|
@@ -19551,19 +19859,27 @@ ${line}`).slice(-8e3);
|
|
|
19551
19859
|
const repliedThisTurn = Boolean(active.agentItem) || turnReply.trim() !== "";
|
|
19552
19860
|
if (response)
|
|
19553
19861
|
this.#lastResultResponse = response;
|
|
19554
|
-
if (turnReply.trim() !== "")
|
|
19555
|
-
|
|
19862
|
+
if (turnReply.trim() !== "") {
|
|
19863
|
+
const unshown = unstreamedReplyTail(active.turnAgentText, turnReply);
|
|
19864
|
+
if (unshown === null)
|
|
19865
|
+
this.#appendOrSyncAgentText(active, turnReply, false);
|
|
19866
|
+
else if (unshown.trim() !== "")
|
|
19867
|
+
this.#appendAgentText(active, unshown);
|
|
19868
|
+
}
|
|
19869
|
+
if (!convId) {
|
|
19870
|
+
this.#completeIdentitylessTurn(active, event);
|
|
19871
|
+
return;
|
|
19872
|
+
}
|
|
19556
19873
|
const safeTurnId = event.result.num_turns !== void 0 && event.result.num_turns !== null ? `turn:${event.result.num_turns}` : `turn:${this.#history.snapshot().length + 1}`;
|
|
19557
|
-
const safeSessionId = convId || this.#nativeRef?.nativeSessionId || "unknown-session";
|
|
19558
19874
|
const nativeTurnRef = nativeTurnRefSchema.parse({
|
|
19559
19875
|
harnessId: this.harnessId,
|
|
19560
|
-
nativeSessionId:
|
|
19876
|
+
nativeSessionId: convId,
|
|
19561
19877
|
nativeTurnKey: safeTurnId,
|
|
19562
19878
|
formatVersion: 1
|
|
19563
19879
|
});
|
|
19564
19880
|
const checkpoint = nativeCheckpointRefSchema.parse({
|
|
19565
19881
|
harnessId: this.harnessId,
|
|
19566
|
-
nativeSessionId:
|
|
19882
|
+
nativeSessionId: convId,
|
|
19567
19883
|
checkpointId: safeTurnId,
|
|
19568
19884
|
formatVersion: 1
|
|
19569
19885
|
});
|
|
@@ -19580,16 +19896,33 @@ ${line}`).slice(-8e3);
|
|
|
19580
19896
|
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
19581
19897
|
}
|
|
19582
19898
|
} else {
|
|
19583
|
-
const
|
|
19584
|
-
|
|
19585
|
-
const error51 = normalizedProcessError(errorDetail, `Antigravity Turn ended with status ${event.result.status}`, nativeError !== void 0);
|
|
19586
|
-
if (repliedThisTurn && nativeError && this.#reportedEarlier(error51)) {
|
|
19899
|
+
const error51 = this.#resultError(active, event);
|
|
19900
|
+
if (repliedThisTurn && event.result.error?.trim() && this.#reportedEarlier(error51)) {
|
|
19587
19901
|
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
19588
19902
|
} else {
|
|
19589
19903
|
this.#completeTurn(active, { status: "failed", error: error51, checkpoint }, nativeTurnRef);
|
|
19590
19904
|
}
|
|
19591
19905
|
}
|
|
19592
19906
|
}
|
|
19907
|
+
/** A Turn agy ended without a Conversation keeps its native outcome but no native identity. */
|
|
19908
|
+
#completeIdentitylessTurn(active, event) {
|
|
19909
|
+
if (active.cancellationRequested) {
|
|
19910
|
+
this.#completeTurn(active, { status: "cancelled", reason: "Cancelled by user" });
|
|
19911
|
+
return;
|
|
19912
|
+
}
|
|
19913
|
+
this.#completeTurn(active, {
|
|
19914
|
+
status: "failed",
|
|
19915
|
+
error: event.result.status === "SUCCESS" ? {
|
|
19916
|
+
code: "protocolError",
|
|
19917
|
+
message: "Antigravity finished the Turn without a Conversation identity",
|
|
19918
|
+
retryable: true
|
|
19919
|
+
} : this.#resultError(active, event)
|
|
19920
|
+
});
|
|
19921
|
+
}
|
|
19922
|
+
#resultError(active, event) {
|
|
19923
|
+
const nativeError = event.result.error?.trim();
|
|
19924
|
+
return normalizedProcessError(nativeError || active.stderr, `Antigravity Turn ended with status ${event.result.status}`, nativeError !== void 0);
|
|
19925
|
+
}
|
|
19593
19926
|
#reportedEarlier(error51) {
|
|
19594
19927
|
return this.#history.snapshot().some(({ outcome }) => outcome.status === "failed" && outcome.error.code === error51.code && outcome.error.message === error51.message);
|
|
19595
19928
|
}
|
|
@@ -19736,6 +20069,7 @@ ${line}`).slice(-8e3);
|
|
|
19736
20069
|
this.#appendAgentText(active, text);
|
|
19737
20070
|
}
|
|
19738
20071
|
#appendAgentText(active, text) {
|
|
20072
|
+
active.turnAgentText += text;
|
|
19739
20073
|
if (!active.agentItem) {
|
|
19740
20074
|
active.agentItem = { type: "agentMessage", itemId: this.#newItemId(), text };
|
|
19741
20075
|
active.agentText = text;
|
|
@@ -19761,8 +20095,9 @@ ${line}`).slice(-8e3);
|
|
|
19761
20095
|
await active.subagents.settled;
|
|
19762
20096
|
if (active.process.stdin.writable)
|
|
19763
20097
|
active.process.stdin.end();
|
|
19764
|
-
const timer = setTimeout(() => active.process.kill(),
|
|
19765
|
-
await active.exited
|
|
20098
|
+
const timer = setTimeout(() => active.process.kill(), NATIVE_EXIT_GRACE_MS);
|
|
20099
|
+
await settledWithin(active.exited, NATIVE_EXIT_GRACE_MS + this.#turnCleanupWaitMs);
|
|
20100
|
+
clearTimeout(timer);
|
|
19766
20101
|
await active.questions.dispose();
|
|
19767
20102
|
this.#subagentObservers.delete(active.subagents);
|
|
19768
20103
|
}).catch(() => void 0);
|
|
@@ -19939,6 +20274,7 @@ function historySubagentState(history, id) {
|
|
|
19939
20274
|
var AntigravityAdapter = class {
|
|
19940
20275
|
commandCatalog = ANTIGRAVITY_COMMAND_CATALOG;
|
|
19941
20276
|
harnessId = antigravityHarnessId;
|
|
20277
|
+
usageStatistics;
|
|
19942
20278
|
subagents = {
|
|
19943
20279
|
readSnapshot: async (input) => {
|
|
19944
20280
|
if (this.#closed || input.parent.harnessId !== this.harnessId || !nativeSubagentIdSchema.safeParse(input.nativeSubagentId).success) {
|
|
@@ -19971,6 +20307,7 @@ var AntigravityAdapter = class {
|
|
|
19971
20307
|
#sessions = /* @__PURE__ */ new Set();
|
|
19972
20308
|
#toolOutputLimit;
|
|
19973
20309
|
#subagentObservationTimeoutMs;
|
|
20310
|
+
#turnCleanupWaitMs;
|
|
19974
20311
|
#closed = false;
|
|
19975
20312
|
#quota = null;
|
|
19976
20313
|
#quotaCwd = null;
|
|
@@ -19979,6 +20316,7 @@ var AntigravityAdapter = class {
|
|
|
19979
20316
|
constructor(options = {}) {
|
|
19980
20317
|
this.#command = options.command;
|
|
19981
20318
|
this.#environment = options.environment ?? process.env;
|
|
20319
|
+
this.usageStatistics = createAntigravityUsageStatistics(this.#environment);
|
|
19982
20320
|
this.#inspectTimeoutMs = options.inspectTimeoutMs ?? DEFAULT_INSPECT_TIMEOUT_MS;
|
|
19983
20321
|
this.#printTimeout = options.printTimeout ?? DEFAULT_PRINT_TIMEOUT;
|
|
19984
20322
|
this.#toolOutputLimit = options.toolOutputLimit ?? DEFAULT_TOOL_OUTPUT_LIMIT;
|
|
@@ -19987,12 +20325,17 @@ var AntigravityAdapter = class {
|
|
|
19987
20325
|
throw new RangeError("subagentObservationTimeoutMs must be a finite positive number");
|
|
19988
20326
|
}
|
|
19989
20327
|
this.#subagentObservationTimeoutMs = subagentObservationTimeoutMs;
|
|
20328
|
+
const turnCleanupWaitMs = options.turnCleanupWaitMs ?? DEFAULT_TURN_CLEANUP_WAIT_MS;
|
|
20329
|
+
if (!Number.isFinite(turnCleanupWaitMs) || turnCleanupWaitMs < 0) {
|
|
20330
|
+
throw new RangeError("turnCleanupWaitMs must be a finite non-negative number");
|
|
20331
|
+
}
|
|
20332
|
+
this.#turnCleanupWaitMs = turnCleanupWaitMs;
|
|
19990
20333
|
}
|
|
19991
20334
|
async inspect(input = {}) {
|
|
19992
20335
|
if (this.#closed) {
|
|
19993
20336
|
return { status: "unavailable", error: invalidState("Antigravity Adapter is closed") };
|
|
19994
20337
|
}
|
|
19995
|
-
const cwd =
|
|
20338
|
+
const cwd = path11.resolve(input.cwd ?? process.cwd());
|
|
19996
20339
|
const inFlight = this.#inspectionInFlight.get(cwd);
|
|
19997
20340
|
if (inFlight)
|
|
19998
20341
|
return inFlight;
|
|
@@ -20135,7 +20478,7 @@ var AntigravityAdapter = class {
|
|
|
20135
20478
|
}
|
|
20136
20479
|
};
|
|
20137
20480
|
}
|
|
20138
|
-
const cwd =
|
|
20481
|
+
const cwd = path11.resolve(input.cwd);
|
|
20139
20482
|
let catalog = this.#inspectionCache.get(cwd)?.catalog;
|
|
20140
20483
|
if (!catalog) {
|
|
20141
20484
|
const inspection = await this.inspect({ cwd: input.cwd });
|
|
@@ -20171,6 +20514,7 @@ var AntigravityAdapter = class {
|
|
|
20171
20514
|
...params.thinkingOptionId ? { thinkingOptionId: params.thinkingOptionId } : {},
|
|
20172
20515
|
toolOutputLimit: this.#toolOutputLimit,
|
|
20173
20516
|
subagentObservationTimeoutMs: this.#subagentObservationTimeoutMs,
|
|
20517
|
+
turnCleanupWaitMs: this.#turnCleanupWaitMs,
|
|
20174
20518
|
onClosed: () => this.#sessions.delete(session2)
|
|
20175
20519
|
});
|
|
20176
20520
|
this.#sessions.add(session2);
|
|
@@ -20207,6 +20551,7 @@ var AntigravityAdapter = class {
|
|
|
20207
20551
|
...params.thinkingOptionId ? { thinkingOptionId: params.thinkingOptionId } : {},
|
|
20208
20552
|
toolOutputLimit: this.#toolOutputLimit,
|
|
20209
20553
|
subagentObservationTimeoutMs: this.#subagentObservationTimeoutMs,
|
|
20554
|
+
turnCleanupWaitMs: this.#turnCleanupWaitMs,
|
|
20210
20555
|
onClosed: () => this.#sessions.delete(session2)
|
|
20211
20556
|
});
|
|
20212
20557
|
this.#sessions.add(session2);
|
|
@@ -20264,6 +20609,7 @@ var AntigravityAdapter = class {
|
|
|
20264
20609
|
...thinkingOptionId ? { thinkingOptionId } : {},
|
|
20265
20610
|
toolOutputLimit: this.#toolOutputLimit,
|
|
20266
20611
|
subagentObservationTimeoutMs: this.#subagentObservationTimeoutMs,
|
|
20612
|
+
turnCleanupWaitMs: this.#turnCleanupWaitMs,
|
|
20267
20613
|
onClosed: () => this.#sessions.delete(session)
|
|
20268
20614
|
});
|
|
20269
20615
|
this.#sessions.add(session);
|
|
@@ -20323,11 +20669,23 @@ function createAntigravityInstallation(environment, command, dependencies = {})
|
|
|
20323
20669
|
|
|
20324
20670
|
// dist/plugin.js
|
|
20325
20671
|
var ANTIGRAVITY_COMMAND_ENV = "CODEXHOST_ANTIGRAVITY_COMMAND";
|
|
20672
|
+
var ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV = "AGY_CLI_DISABLE_AUTO_UPDATE";
|
|
20673
|
+
function antigravityProcessEnvironment(environment, platform) {
|
|
20674
|
+
if (platform !== "win32" && platform !== "darwin")
|
|
20675
|
+
return environment;
|
|
20676
|
+
const isWindows = platform === "win32";
|
|
20677
|
+
const matchesSwitch = (name) => isWindows ? name.toUpperCase() === ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV : name === ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV;
|
|
20678
|
+
const entries = Object.entries(environment);
|
|
20679
|
+
const configured = entries.some(([name, value]) => matchesSwitch(name) && value !== void 0);
|
|
20680
|
+
const hasUndefinedSwitch = entries.some(([name, value]) => matchesSwitch(name) && value === void 0);
|
|
20681
|
+
const cleanEnvironment = hasUndefinedSwitch ? Object.fromEntries(entries.filter(([name, value]) => !matchesSwitch(name) || value !== void 0)) : environment;
|
|
20682
|
+
return configured ? cleanEnvironment : { ...cleanEnvironment, [ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV]: "true" };
|
|
20683
|
+
}
|
|
20326
20684
|
function createHarnessAdapter(context) {
|
|
20327
20685
|
const environment = { ...context.environment };
|
|
20328
20686
|
return Object.assign(new AntigravityAdapter({
|
|
20329
20687
|
...environment[ANTIGRAVITY_COMMAND_ENV] ? { command: environment[ANTIGRAVITY_COMMAND_ENV] } : {},
|
|
20330
|
-
environment
|
|
20688
|
+
environment: antigravityProcessEnvironment(environment, context.platform)
|
|
20331
20689
|
}), {
|
|
20332
20690
|
install: createHarnessInstaller(environment, {
|
|
20333
20691
|
posix: "https://antigravity.google/cli/install.sh",
|
|
@@ -20344,6 +20702,8 @@ async function warmup(adapter) {
|
|
|
20344
20702
|
}
|
|
20345
20703
|
export {
|
|
20346
20704
|
ANTIGRAVITY_COMMAND_ENV,
|
|
20705
|
+
ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV,
|
|
20706
|
+
antigravityProcessEnvironment,
|
|
20347
20707
|
createHarnessAdapter,
|
|
20348
20708
|
warmup
|
|
20349
20709
|
};
|