@codexhost/cli-darwin-x64 0.13.3 → 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 +109 -11
- package/app/console-web.js +649 -132
- package/app/desktop-controller.mjs +120 -12
- package/app/host-runtime.mjs +1124 -293
- package/app/plugins/antigravity/plugin.mjs +431 -66
- package/app/plugins/claude-code/plugin.mjs +761 -139
- package/app/plugins/codebuddy/plugin.mjs +322 -68
- package/app/plugins/codex-usage/plugin.mjs +249 -102
- package/app/plugins/copilot/assets/icon.png +0 -0
- package/app/plugins/copilot/manifest.json +26 -0
- package/app/plugins/copilot/plugin.mjs +34591 -0
- package/app/plugins/cursor-cli/plugin.mjs +21011 -44970
- package/app/plugins/deepseek-harness/plugin.mjs +160 -43
- package/app/plugins/enabled.json +1 -0
- package/app/plugins/grok/plugin.mjs +565 -107
- package/app/plugins/hermes/plugin.mjs +128 -12
- package/app/plugins/kimi-code/plugin.mjs +136 -22
- package/app/plugins/kiro-cli/plugin.mjs +136 -22
- package/app/plugins/omp/plugin.mjs +2236 -2036
- package/app/plugins/opencode/plugin.mjs +187 -68
- package/app/plugins/pi/plugin.mjs +2621 -2304
- package/app/plugins/qoder/plugin.mjs +153 -36
- package/app/plugins/qoder-cn/plugin.mjs +153 -36
- package/app/plugins/workbuddy/plugin.mjs +583 -92
- package/app/plugins/zcode/plugin.mjs +183 -40
- package/app/renderer-extension.js +1758 -392
- 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
|
}
|
|
@@ -15068,10 +15068,19 @@ var model = external_exports.string().min(1).max(512);
|
|
|
15068
15068
|
var project = external_exports.string().min(1).max(4096);
|
|
15069
15069
|
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
15070
15070
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
15071
|
+
/** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
|
|
15072
|
+
timeZone: external_exports.string().min(1).max(128).refine((value) => {
|
|
15073
|
+
try {
|
|
15074
|
+
new Intl.DateTimeFormat("en", { timeZone: value });
|
|
15075
|
+
return true;
|
|
15076
|
+
} catch {
|
|
15077
|
+
return false;
|
|
15078
|
+
}
|
|
15079
|
+
}, "Unsupported usage statistics timezone").optional(),
|
|
15071
15080
|
harness: harness.optional(),
|
|
15072
15081
|
model: model.nullable().optional(),
|
|
15073
15082
|
project: project.nullable().optional(),
|
|
15074
|
-
/** One
|
|
15083
|
+
/** One date in the query timezone inside the range. */
|
|
15075
15084
|
date: localDate.optional()
|
|
15076
15085
|
});
|
|
15077
15086
|
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
@@ -15107,7 +15116,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15107
15116
|
});
|
|
15108
15117
|
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
15109
15118
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
15110
|
-
/** First
|
|
15119
|
+
/** First date in the query timezone (Host local when omitted); null for all time. */
|
|
15111
15120
|
from: localDate.nullable(),
|
|
15112
15121
|
to: localDate,
|
|
15113
15122
|
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
@@ -15147,7 +15156,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15147
15156
|
totals: usageStatisticsTotalsSchema,
|
|
15148
15157
|
/** Each date and Harness of the range: every filter except the day. */
|
|
15149
15158
|
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
15150
|
-
/**
|
|
15159
|
+
/** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
|
|
15151
15160
|
hourly: external_exports.array(external_exports.strictObject({
|
|
15152
15161
|
weekday: external_exports.number().int().min(0).max(6),
|
|
15153
15162
|
hour: external_exports.number().int().min(0).max(23),
|
|
@@ -15187,6 +15196,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
15187
15196
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
15188
15197
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
15189
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
|
+
|
|
15190
15244
|
// ../../shared-contracts/dist/console.js
|
|
15191
15245
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
15192
15246
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -15207,6 +15261,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
15207
15261
|
"codexhost/harness/display-settings/set",
|
|
15208
15262
|
"codexhost/harness/inspect",
|
|
15209
15263
|
"codexhost/harness/installation",
|
|
15264
|
+
"codexhost/harness/installation/start",
|
|
15265
|
+
"codexhost/harness/installation/status",
|
|
15210
15266
|
"codexhost/harness/launch-settings/get",
|
|
15211
15267
|
"codexhost/harness/launch-settings/set",
|
|
15212
15268
|
"codexhost/harness/web-ui/open",
|
|
@@ -15282,7 +15338,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
15282
15338
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15283
15339
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
15284
15340
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15341
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
|
|
15342
|
+
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15343
|
+
kind: external_exports.literal("countdown"),
|
|
15344
|
+
id: external_exports.string().min(1).max(64),
|
|
15345
|
+
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15346
|
+
label: indicatorTextSchema(256).optional(),
|
|
15347
|
+
tooltip: indicatorTextSchema(1024).optional()
|
|
15348
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
|
|
15349
|
+
message: "Composer indicator IDs must be unique"
|
|
15350
|
+
});
|
|
15285
15351
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
15352
|
+
composerIndicators: composerIndicatorsSchema.optional(),
|
|
15286
15353
|
inputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15287
15354
|
cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15288
15355
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15690,7 +15757,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15690
15757
|
}).strict().optional(),
|
|
15691
15758
|
autonomousTurns: external_exports.object({
|
|
15692
15759
|
observe: external_exports.boolean()
|
|
15693
|
-
}).strict().optional()
|
|
15760
|
+
}).strict().optional(),
|
|
15761
|
+
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15762
|
+
steer: external_exports.boolean().optional()
|
|
15694
15763
|
}).strict();
|
|
15695
15764
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15696
15765
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15737,7 +15806,9 @@ var harnessInspectionSchema = external_exports.union([
|
|
|
15737
15806
|
var harnessInspectParamsSchema = external_exports.object({
|
|
15738
15807
|
harnessId: harnessIdSchema,
|
|
15739
15808
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15740
|
-
refresh: external_exports.boolean().optional()
|
|
15809
|
+
refresh: external_exports.boolean().optional(),
|
|
15810
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15811
|
+
purpose: external_exports.literal("availability").optional()
|
|
15741
15812
|
}).strict();
|
|
15742
15813
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15743
15814
|
harnessId: harnessIdSchema
|
|
@@ -15820,6 +15891,15 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
15820
15891
|
seen.add(thread.threadId);
|
|
15821
15892
|
}
|
|
15822
15893
|
});
|
|
15894
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
15895
|
+
threadId: hostThreadIdSchema,
|
|
15896
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15897
|
+
text: external_exports.string().optional()
|
|
15898
|
+
}).strict();
|
|
15899
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15900
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15901
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15902
|
+
}).strict();
|
|
15823
15903
|
|
|
15824
15904
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
15825
15905
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
@@ -15921,6 +16001,10 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
15921
16001
|
latestVersion: external_exports.string().min(1).max(128),
|
|
15922
16002
|
updateAvailable: external_exports.boolean(),
|
|
15923
16003
|
canUpdate: external_exports.boolean(),
|
|
16004
|
+
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
16005
|
+
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
16006
|
+
/** Official download opened by the user; does not imply an automatic installation. */
|
|
16007
|
+
manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
|
|
15924
16008
|
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15925
16009
|
message: external_exports.string().max(2048).optional(),
|
|
15926
16010
|
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
@@ -15928,6 +16012,20 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
15928
16012
|
notice: harnessLocalizedTextSchema.optional(),
|
|
15929
16013
|
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15930
16014
|
}).strict();
|
|
16015
|
+
var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
|
|
16016
|
+
var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
|
|
16017
|
+
external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
|
|
16018
|
+
external_exports.object({
|
|
16019
|
+
taskId: external_exports.string().uuid(),
|
|
16020
|
+
status: external_exports.literal("succeeded"),
|
|
16021
|
+
result: harnessInstallationStateSchema
|
|
16022
|
+
}).strict(),
|
|
16023
|
+
external_exports.object({
|
|
16024
|
+
taskId: external_exports.string().uuid(),
|
|
16025
|
+
status: external_exports.literal("failed"),
|
|
16026
|
+
error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
|
|
16027
|
+
}).strict()
|
|
16028
|
+
]);
|
|
15931
16029
|
|
|
15932
16030
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
15933
16031
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
@@ -16405,6 +16503,18 @@ function sanitizeDiagnosticTail(value) {
|
|
|
16405
16503
|
return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
|
|
16406
16504
|
}
|
|
16407
16505
|
|
|
16506
|
+
// ../../harness-adapter/dist/steer.js
|
|
16507
|
+
function unsupportedSteer(harnessLabel) {
|
|
16508
|
+
return {
|
|
16509
|
+
ok: false,
|
|
16510
|
+
error: {
|
|
16511
|
+
code: "unsupported",
|
|
16512
|
+
message: `${harnessLabel} cannot steer an active Turn natively`,
|
|
16513
|
+
retryable: false
|
|
16514
|
+
}
|
|
16515
|
+
};
|
|
16516
|
+
}
|
|
16517
|
+
|
|
16408
16518
|
// ../../harness-adapter/dist/usage.js
|
|
16409
16519
|
var tokenFields = [
|
|
16410
16520
|
"inputTokens",
|
|
@@ -16432,6 +16542,7 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
16432
16542
|
...safeIntegerFields,
|
|
16433
16543
|
...percentFields,
|
|
16434
16544
|
"sessionCacheUsage",
|
|
16545
|
+
"composerIndicators",
|
|
16435
16546
|
"totalCostUsd",
|
|
16436
16547
|
"totalCredits",
|
|
16437
16548
|
"contextUsagePercent",
|
|
@@ -16599,6 +16710,12 @@ function historyPath(environment) {
|
|
|
16599
16710
|
const threadId = safeThreadId(environment);
|
|
16600
16711
|
return threadId ? path5.join(historyRoot(environment), `${threadId}.json`) : null;
|
|
16601
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
|
+
}
|
|
16602
16719
|
function jsonTurn(turn) {
|
|
16603
16720
|
return JSON.parse(JSON.stringify(turn));
|
|
16604
16721
|
}
|
|
@@ -16787,8 +16904,11 @@ var AntigravityHistory = class _AntigravityHistory {
|
|
|
16787
16904
|
function nativeConversationDbPath(nativeSessionId, homedir2 = os3.homedir()) {
|
|
16788
16905
|
return path6.join(homedir2, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
|
|
16789
16906
|
}
|
|
16907
|
+
function nativeBrainRoot(homedir2 = os3.homedir()) {
|
|
16908
|
+
return path6.join(homedir2, ".gemini", "antigravity-cli", "brain");
|
|
16909
|
+
}
|
|
16790
16910
|
function nativeBrainDirPath(nativeSessionId, homedir2 = os3.homedir()) {
|
|
16791
|
-
return path6.join(homedir2,
|
|
16911
|
+
return path6.join(nativeBrainRoot(homedir2), nativeSessionId);
|
|
16792
16912
|
}
|
|
16793
16913
|
async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, retainedTurnsCountOrHomedir, homedirOption = os3.homedir()) {
|
|
16794
16914
|
let retainedTurnsCount;
|
|
@@ -18041,7 +18161,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
18041
18161
|
this.#server.on("request", (request, response) => this.#receive(request, response));
|
|
18042
18162
|
}
|
|
18043
18163
|
static async create(options) {
|
|
18044
|
-
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-"));
|
|
18045
18165
|
const bridge = new _AntigravityQuestionBridge(directory, options);
|
|
18046
18166
|
try {
|
|
18047
18167
|
await new Promise((resolve, reject) => {
|
|
@@ -18057,7 +18177,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
18057
18177
|
throw new Error("Question bridge did not bind");
|
|
18058
18178
|
bridge.environment.CODEXHOST_AGY_QUESTION_URL = `http://127.0.0.1:${address.port}/question`;
|
|
18059
18179
|
const client = path8.join(directory, "question-hook.cjs");
|
|
18060
|
-
await mkdir3(path8.join(directory, ".agents"));
|
|
18180
|
+
await mkdir3(path8.join(directory, ".agents"), { recursive: true, mode: 448 });
|
|
18061
18181
|
await writeFile3(client, ANTIGRAVITY_QUESTION_HOOK_CLIENT, "utf8");
|
|
18062
18182
|
const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
18063
18183
|
bridge.environment.CODEXHOST_AGY_QUESTION_NODE = `"${process.execPath.replaceAll("\\", "/")}"`;
|
|
@@ -18286,7 +18406,9 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
18286
18406
|
this.#server.close(() => resolve());
|
|
18287
18407
|
this.#server.closeAllConnections();
|
|
18288
18408
|
});
|
|
18289
|
-
|
|
18409
|
+
if (this.#options.directory === void 0) {
|
|
18410
|
+
await rm3(this.directory, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
|
|
18411
|
+
}
|
|
18290
18412
|
})();
|
|
18291
18413
|
return this.#disposal;
|
|
18292
18414
|
}
|
|
@@ -18780,12 +18902,195 @@ var AntigravitySubagents = class {
|
|
|
18780
18902
|
}
|
|
18781
18903
|
};
|
|
18782
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
|
+
|
|
18783
19086
|
// dist/antigravity-adapter.js
|
|
18784
19087
|
var antigravityHarnessId = harnessIdSchema.parse("antigravity");
|
|
18785
19088
|
var DEFAULT_INSPECT_TIMEOUT_MS = 2e4;
|
|
18786
19089
|
var DEFAULT_PRINT_TIMEOUT = "30m";
|
|
18787
19090
|
var DEFAULT_TOOL_OUTPUT_LIMIT = 64e3;
|
|
18788
19091
|
var DEFAULT_SUBAGENT_OBSERVATION_TIMEOUT_MS = 3e4;
|
|
19092
|
+
var NATIVE_EXIT_GRACE_MS = 2e3;
|
|
19093
|
+
var DEFAULT_TURN_CLEANUP_WAIT_MS = 5e3;
|
|
18789
19094
|
var CONTEXT_USAGE_TIMEOUT_MS = 8e3;
|
|
18790
19095
|
var CONTEXT_USAGE_RETRY_MS = 100;
|
|
18791
19096
|
var TRAJECTORY_TIMEOUT_MS = 2e3;
|
|
@@ -18814,8 +19119,8 @@ function mergePendingStep(pending, step) {
|
|
|
18814
19119
|
};
|
|
18815
19120
|
}
|
|
18816
19121
|
function sameFile(left, right) {
|
|
18817
|
-
const a =
|
|
18818
|
-
const b =
|
|
19122
|
+
const a = path11.resolve(left);
|
|
19123
|
+
const b = path11.resolve(right);
|
|
18819
19124
|
return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
18820
19125
|
}
|
|
18821
19126
|
function resolveAntigravityContextWindow(modelId, reportedWindow) {
|
|
@@ -18843,12 +19148,28 @@ function errorMessage(error51) {
|
|
|
18843
19148
|
function invalidState(message) {
|
|
18844
19149
|
return { code: "invalidState", message, retryable: false };
|
|
18845
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
|
+
}
|
|
18846
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";
|
|
18847
|
-
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) {
|
|
18848
19168
|
if (text.startsWith("/") || text.includes("ArtifactMetadata")) {
|
|
18849
19169
|
return text;
|
|
18850
19170
|
}
|
|
18851
|
-
|
|
19171
|
+
const workingDirectory = cwd ? antigravityWorkingDirectoryInstruction(cwd) : "";
|
|
19172
|
+
return `${ANTIGRAVITY_WORKSPACE_FILE_INSTRUCTION}${workingDirectory}${text}`;
|
|
18852
19173
|
}
|
|
18853
19174
|
function permissionDeniedTurnError(nativeMode, denial) {
|
|
18854
19175
|
const mode = nativeMode ? ` '${nativeMode}'` : "";
|
|
@@ -18950,14 +19271,15 @@ async function pollAntigravityContextUsage(logPath, conversationId, modelId, isD
|
|
|
18950
19271
|
}
|
|
18951
19272
|
return null;
|
|
18952
19273
|
}
|
|
18953
|
-
function hostUsage(value, modelId) {
|
|
19274
|
+
function hostUsage(value, modelId, scope) {
|
|
18954
19275
|
if (!value)
|
|
18955
19276
|
return null;
|
|
18956
19277
|
const inputTokens = safeToken(value.input_tokens);
|
|
18957
19278
|
const outputTokens = safeToken(value.output_tokens);
|
|
18958
19279
|
const reasoningOutputTokens = safeToken(value.thinking_tokens);
|
|
18959
19280
|
const totalTokens = safeToken(value.total_tokens);
|
|
18960
|
-
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;
|
|
18961
19283
|
const rawWindow = safeToken(value.context_window_tokens ?? value.max_context_tokens);
|
|
18962
19284
|
const contextWindowTokens = contextUsedTokens !== void 0 || rawWindow !== void 0 ? resolveAntigravityContextWindow(modelId, rawWindow) : void 0;
|
|
18963
19285
|
const usage = {
|
|
@@ -19034,6 +19356,7 @@ var AntigravitySession = class {
|
|
|
19034
19356
|
#printTimeout;
|
|
19035
19357
|
#toolOutputLimit;
|
|
19036
19358
|
#subagentObservationTimeoutMs;
|
|
19359
|
+
#turnCleanupWaitMs;
|
|
19037
19360
|
#history;
|
|
19038
19361
|
#subagentObservers = /* @__PURE__ */ new Set();
|
|
19039
19362
|
#active = null;
|
|
@@ -19042,6 +19365,8 @@ var AntigravitySession = class {
|
|
|
19042
19365
|
#closed = false;
|
|
19043
19366
|
#model;
|
|
19044
19367
|
#nativeRef;
|
|
19368
|
+
/** The last result's `response`: agy carries earlier Turns' replies in it. */
|
|
19369
|
+
#lastResultResponse = "";
|
|
19045
19370
|
#permissionMode;
|
|
19046
19371
|
#thinkingOptionId;
|
|
19047
19372
|
#catalog;
|
|
@@ -19058,6 +19383,7 @@ var AntigravitySession = class {
|
|
|
19058
19383
|
this.#thinkingOptionId = input.thinkingOptionId ?? input.history.thinkingOptionId;
|
|
19059
19384
|
this.#toolOutputLimit = input.toolOutputLimit;
|
|
19060
19385
|
this.#subagentObservationTimeoutMs = input.subagentObservationTimeoutMs;
|
|
19386
|
+
this.#turnCleanupWaitMs = input.turnCleanupWaitMs;
|
|
19061
19387
|
this.#onClosed = input.onClosed;
|
|
19062
19388
|
this.initialState = this.#state();
|
|
19063
19389
|
this.outputs = this.#channel.outputs;
|
|
@@ -19103,6 +19429,8 @@ var AntigravitySession = class {
|
|
|
19103
19429
|
return { ok: false, error: invalidState("Antigravity Session is closed") };
|
|
19104
19430
|
if (command.type === "turn.cancel")
|
|
19105
19431
|
return this.#cancel(command);
|
|
19432
|
+
if (command.type === "turn.steer")
|
|
19433
|
+
return unsupportedSteer("Antigravity");
|
|
19106
19434
|
if (command.type === "model.select")
|
|
19107
19435
|
return this.#selectModel(command);
|
|
19108
19436
|
if (command.type === "permissionMode.select")
|
|
@@ -19133,7 +19461,10 @@ var AntigravitySession = class {
|
|
|
19133
19461
|
};
|
|
19134
19462
|
}
|
|
19135
19463
|
let questions;
|
|
19136
|
-
|
|
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 } : {},
|
|
19137
19468
|
turnId: command.turnId,
|
|
19138
19469
|
nativeSessionId: () => this.#active?.command === command && !this.#active.cancellationRequested ? this.#nativeRef?.nativeSessionId : void 0,
|
|
19139
19470
|
schedule: (action) => {
|
|
@@ -19156,7 +19487,7 @@ var AntigravitySession = class {
|
|
|
19156
19487
|
}
|
|
19157
19488
|
this.#channel.emit(output);
|
|
19158
19489
|
}
|
|
19159
|
-
});
|
|
19490
|
+
}));
|
|
19160
19491
|
try {
|
|
19161
19492
|
questions = await this.#preparingQuestions;
|
|
19162
19493
|
} catch (error51) {
|
|
@@ -19176,7 +19507,7 @@ var AntigravitySession = class {
|
|
|
19176
19507
|
return { ok: false, error: invalidState("Antigravity Session is closed") };
|
|
19177
19508
|
}
|
|
19178
19509
|
const environment = { ...this.#environment, ...questions.environment };
|
|
19179
|
-
const logPath =
|
|
19510
|
+
const logPath = path11.join(os6.tmpdir(), `codexhost-antigravity-${randomUUID6()}.log`);
|
|
19180
19511
|
const arguments_ = [
|
|
19181
19512
|
"--input-format",
|
|
19182
19513
|
"stream-json",
|
|
@@ -19297,7 +19628,7 @@ ${line}`).slice(-8e3);
|
|
|
19297
19628
|
});
|
|
19298
19629
|
});
|
|
19299
19630
|
try {
|
|
19300
|
-
const turnPrompt = formatAntigravityTurnPrompt(text);
|
|
19631
|
+
const turnPrompt = formatAntigravityTurnPrompt(text, this.#cwd);
|
|
19301
19632
|
if (child.stdin.writable) {
|
|
19302
19633
|
child.stdin.write(`${JSON.stringify({ event: "user", message: { content: turnPrompt } })}
|
|
19303
19634
|
`, () => void 0);
|
|
@@ -19381,7 +19712,7 @@ ${line}`).slice(-8e3);
|
|
|
19381
19712
|
if (event.step_update.conversation_id !== this.#nativeRef?.nativeSessionId)
|
|
19382
19713
|
return;
|
|
19383
19714
|
await this.#handleStep(active, event.step_update);
|
|
19384
|
-
const usage = hostUsage(event.step_update.usage, active.model?.id);
|
|
19715
|
+
const usage = hostUsage(event.step_update.usage, active.model?.id, "request");
|
|
19385
19716
|
if (usage)
|
|
19386
19717
|
this.#publishUsage(active, usage);
|
|
19387
19718
|
this.#ensureContextUsage(active, event.step_update.conversation_id);
|
|
@@ -19407,7 +19738,7 @@ ${line}`).slice(-8e3);
|
|
|
19407
19738
|
});
|
|
19408
19739
|
return;
|
|
19409
19740
|
}
|
|
19410
|
-
const usage = hostUsage(event.result.usage, active.model?.id);
|
|
19741
|
+
const usage = hostUsage(event.result.usage, active.model?.id, "conversation");
|
|
19411
19742
|
if (usage)
|
|
19412
19743
|
this.#publishUsage(active, usage);
|
|
19413
19744
|
this.#ensureContextUsage(active, event.result.conversation_id);
|
|
@@ -19429,9 +19760,13 @@ ${line}`).slice(-8e3);
|
|
|
19429
19760
|
this.#history.bindNativeSession(convId);
|
|
19430
19761
|
this.#event({ type: "session.state.changed", state: this.#state() });
|
|
19431
19762
|
}
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
|
|
19763
|
+
const response = event.result.response ?? "";
|
|
19764
|
+
const turnReply = response.startsWith(this.#lastResultResponse) ? response.slice(this.#lastResultResponse.length) : response;
|
|
19765
|
+
const repliedThisTurn = Boolean(active.agentItem) || turnReply.trim() !== "";
|
|
19766
|
+
if (response)
|
|
19767
|
+
this.#lastResultResponse = response;
|
|
19768
|
+
if (turnReply.trim() !== "")
|
|
19769
|
+
this.#appendOrSyncAgentText(active, turnReply, false);
|
|
19435
19770
|
const safeTurnId = event.result.num_turns !== void 0 && event.result.num_turns !== null ? `turn:${event.result.num_turns}` : `turn:${this.#history.snapshot().length + 1}`;
|
|
19436
19771
|
const safeSessionId = convId || this.#nativeRef?.nativeSessionId || "unknown-session";
|
|
19437
19772
|
const nativeTurnRef = nativeTurnRefSchema.parse({
|
|
@@ -19461,13 +19796,17 @@ ${line}`).slice(-8e3);
|
|
|
19461
19796
|
} else {
|
|
19462
19797
|
const nativeError = event.result.error?.trim();
|
|
19463
19798
|
const errorDetail = nativeError || active.stderr;
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19799
|
+
const error51 = normalizedProcessError(errorDetail, `Antigravity Turn ended with status ${event.result.status}`, nativeError !== void 0);
|
|
19800
|
+
if (repliedThisTurn && nativeError && this.#reportedEarlier(error51)) {
|
|
19801
|
+
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
19802
|
+
} else {
|
|
19803
|
+
this.#completeTurn(active, { status: "failed", error: error51, checkpoint }, nativeTurnRef);
|
|
19804
|
+
}
|
|
19469
19805
|
}
|
|
19470
19806
|
}
|
|
19807
|
+
#reportedEarlier(error51) {
|
|
19808
|
+
return this.#history.snapshot().some(({ outcome }) => outcome.status === "failed" && outcome.error.code === error51.code && outcome.error.message === error51.message);
|
|
19809
|
+
}
|
|
19471
19810
|
#publishUsage(active, usage) {
|
|
19472
19811
|
active.latestUsage = { ...active.latestUsage ?? {}, ...usage };
|
|
19473
19812
|
this.#event({
|
|
@@ -19636,8 +19975,9 @@ ${line}`).slice(-8e3);
|
|
|
19636
19975
|
await active.subagents.settled;
|
|
19637
19976
|
if (active.process.stdin.writable)
|
|
19638
19977
|
active.process.stdin.end();
|
|
19639
|
-
const timer = setTimeout(() => active.process.kill(),
|
|
19640
|
-
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);
|
|
19641
19981
|
await active.questions.dispose();
|
|
19642
19982
|
this.#subagentObservers.delete(active.subagents);
|
|
19643
19983
|
}).catch(() => void 0);
|
|
@@ -19814,6 +20154,7 @@ function historySubagentState(history, id) {
|
|
|
19814
20154
|
var AntigravityAdapter = class {
|
|
19815
20155
|
commandCatalog = ANTIGRAVITY_COMMAND_CATALOG;
|
|
19816
20156
|
harnessId = antigravityHarnessId;
|
|
20157
|
+
usageStatistics;
|
|
19817
20158
|
subagents = {
|
|
19818
20159
|
readSnapshot: async (input) => {
|
|
19819
20160
|
if (this.#closed || input.parent.harnessId !== this.harnessId || !nativeSubagentIdSchema.safeParse(input.nativeSubagentId).success) {
|
|
@@ -19846,6 +20187,7 @@ var AntigravityAdapter = class {
|
|
|
19846
20187
|
#sessions = /* @__PURE__ */ new Set();
|
|
19847
20188
|
#toolOutputLimit;
|
|
19848
20189
|
#subagentObservationTimeoutMs;
|
|
20190
|
+
#turnCleanupWaitMs;
|
|
19849
20191
|
#closed = false;
|
|
19850
20192
|
#quota = null;
|
|
19851
20193
|
#quotaCwd = null;
|
|
@@ -19854,6 +20196,7 @@ var AntigravityAdapter = class {
|
|
|
19854
20196
|
constructor(options = {}) {
|
|
19855
20197
|
this.#command = options.command;
|
|
19856
20198
|
this.#environment = options.environment ?? process.env;
|
|
20199
|
+
this.usageStatistics = createAntigravityUsageStatistics(this.#environment);
|
|
19857
20200
|
this.#inspectTimeoutMs = options.inspectTimeoutMs ?? DEFAULT_INSPECT_TIMEOUT_MS;
|
|
19858
20201
|
this.#printTimeout = options.printTimeout ?? DEFAULT_PRINT_TIMEOUT;
|
|
19859
20202
|
this.#toolOutputLimit = options.toolOutputLimit ?? DEFAULT_TOOL_OUTPUT_LIMIT;
|
|
@@ -19862,12 +20205,17 @@ var AntigravityAdapter = class {
|
|
|
19862
20205
|
throw new RangeError("subagentObservationTimeoutMs must be a finite positive number");
|
|
19863
20206
|
}
|
|
19864
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;
|
|
19865
20213
|
}
|
|
19866
20214
|
async inspect(input = {}) {
|
|
19867
20215
|
if (this.#closed) {
|
|
19868
20216
|
return { status: "unavailable", error: invalidState("Antigravity Adapter is closed") };
|
|
19869
20217
|
}
|
|
19870
|
-
const cwd =
|
|
20218
|
+
const cwd = path11.resolve(input.cwd ?? process.cwd());
|
|
19871
20219
|
const inFlight = this.#inspectionInFlight.get(cwd);
|
|
19872
20220
|
if (inFlight)
|
|
19873
20221
|
return inFlight;
|
|
@@ -20010,7 +20358,7 @@ var AntigravityAdapter = class {
|
|
|
20010
20358
|
}
|
|
20011
20359
|
};
|
|
20012
20360
|
}
|
|
20013
|
-
const cwd =
|
|
20361
|
+
const cwd = path11.resolve(input.cwd);
|
|
20014
20362
|
let catalog = this.#inspectionCache.get(cwd)?.catalog;
|
|
20015
20363
|
if (!catalog) {
|
|
20016
20364
|
const inspection = await this.inspect({ cwd: input.cwd });
|
|
@@ -20046,6 +20394,7 @@ var AntigravityAdapter = class {
|
|
|
20046
20394
|
...params.thinkingOptionId ? { thinkingOptionId: params.thinkingOptionId } : {},
|
|
20047
20395
|
toolOutputLimit: this.#toolOutputLimit,
|
|
20048
20396
|
subagentObservationTimeoutMs: this.#subagentObservationTimeoutMs,
|
|
20397
|
+
turnCleanupWaitMs: this.#turnCleanupWaitMs,
|
|
20049
20398
|
onClosed: () => this.#sessions.delete(session2)
|
|
20050
20399
|
});
|
|
20051
20400
|
this.#sessions.add(session2);
|
|
@@ -20082,6 +20431,7 @@ var AntigravityAdapter = class {
|
|
|
20082
20431
|
...params.thinkingOptionId ? { thinkingOptionId: params.thinkingOptionId } : {},
|
|
20083
20432
|
toolOutputLimit: this.#toolOutputLimit,
|
|
20084
20433
|
subagentObservationTimeoutMs: this.#subagentObservationTimeoutMs,
|
|
20434
|
+
turnCleanupWaitMs: this.#turnCleanupWaitMs,
|
|
20085
20435
|
onClosed: () => this.#sessions.delete(session2)
|
|
20086
20436
|
});
|
|
20087
20437
|
this.#sessions.add(session2);
|
|
@@ -20139,6 +20489,7 @@ var AntigravityAdapter = class {
|
|
|
20139
20489
|
...thinkingOptionId ? { thinkingOptionId } : {},
|
|
20140
20490
|
toolOutputLimit: this.#toolOutputLimit,
|
|
20141
20491
|
subagentObservationTimeoutMs: this.#subagentObservationTimeoutMs,
|
|
20492
|
+
turnCleanupWaitMs: this.#turnCleanupWaitMs,
|
|
20142
20493
|
onClosed: () => this.#sessions.delete(session)
|
|
20143
20494
|
});
|
|
20144
20495
|
this.#sessions.add(session);
|
|
@@ -20198,11 +20549,23 @@ function createAntigravityInstallation(environment, command, dependencies = {})
|
|
|
20198
20549
|
|
|
20199
20550
|
// dist/plugin.js
|
|
20200
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
|
+
}
|
|
20201
20564
|
function createHarnessAdapter(context) {
|
|
20202
20565
|
const environment = { ...context.environment };
|
|
20203
20566
|
return Object.assign(new AntigravityAdapter({
|
|
20204
20567
|
...environment[ANTIGRAVITY_COMMAND_ENV] ? { command: environment[ANTIGRAVITY_COMMAND_ENV] } : {},
|
|
20205
|
-
environment
|
|
20568
|
+
environment: antigravityProcessEnvironment(environment, context.platform)
|
|
20206
20569
|
}), {
|
|
20207
20570
|
install: createHarnessInstaller(environment, {
|
|
20208
20571
|
posix: "https://antigravity.google/cli/install.sh",
|
|
@@ -20219,6 +20582,8 @@ async function warmup(adapter) {
|
|
|
20219
20582
|
}
|
|
20220
20583
|
export {
|
|
20221
20584
|
ANTIGRAVITY_COMMAND_ENV,
|
|
20585
|
+
ANTIGRAVITY_DISABLE_AUTO_UPDATE_ENV,
|
|
20586
|
+
antigravityProcessEnvironment,
|
|
20222
20587
|
createHarnessAdapter,
|
|
20223
20588
|
warmup
|
|
20224
20589
|
};
|