@codexhost/cli-linux-arm64 0.10.2 → 0.12.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.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.txt +4 -0
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/console-server.mjs +18001 -0
  5. package/app/console-web.js +27674 -0
  6. package/app/desktop-controller.mjs +452 -110
  7. package/app/host-runtime.mjs +6670 -1272
  8. package/app/plugins/antigravity/plugin.mjs +686 -305
  9. package/app/plugins/claude-code/plugin.mjs +2283 -1450
  10. package/app/plugins/codebuddy/plugin.mjs +1272 -506
  11. package/app/plugins/cursor-cli/manifest.json +1 -1
  12. package/app/plugins/cursor-cli/plugin.mjs +1295 -497
  13. package/app/plugins/deepseek-harness/plugin.mjs +4718 -4925
  14. package/app/plugins/enabled.json +2 -1
  15. package/app/plugins/grok/plugin.mjs +1012 -369
  16. package/app/plugins/hermes/plugin.mjs +18587 -22714
  17. package/app/plugins/kimi-code/plugin.mjs +1283 -355
  18. package/app/plugins/kiro-cli/plugin.mjs +840 -299
  19. package/app/plugins/omp/plugin.mjs +1045 -328
  20. package/app/plugins/opencode/plugin.mjs +5341 -1686
  21. package/app/plugins/pi/plugin.mjs +1343 -534
  22. package/app/plugins/qoder/plugin.mjs +913 -258
  23. package/app/plugins/qoder-cn/plugin.mjs +712 -49
  24. package/app/plugins/workbuddy/plugin.mjs +531 -44
  25. package/app/plugins/zcode/assets/icon.svg +8 -0
  26. package/app/plugins/zcode/manifest.json +14 -0
  27. package/app/plugins/zcode/plugin.mjs +19202 -0
  28. package/app/renderer-extension.js +5011 -1899
  29. package/bin/codexhost +0 -0
  30. package/libexec/codexhost-shim +0 -0
  31. package/libexec/codexhost-updater +0 -0
  32. package/licenses/OpenCode-v2-Client-LICENSE.txt +21 -0
  33. package/package.json +1 -1
@@ -5,13 +5,416 @@ var __export = (target, all) => {
5
5
  __defProp(target, name, { get: all[name], enumerable: true });
6
6
  };
7
7
 
8
+ // ../../harness-discovery/dist/environment.js
9
+ import fs from "node:fs";
10
+ import path from "node:path";
11
+ function targetPath(platform) {
12
+ return platform === "win32" ? path.win32 : path.posix;
13
+ }
14
+ function environmentValue(environment, name) {
15
+ const lowered = name.toLowerCase();
16
+ for (const [key, value] of Object.entries(environment)) {
17
+ if (key.toLowerCase() === lowered)
18
+ return value;
19
+ }
20
+ return void 0;
21
+ }
22
+ function pathDelimiter(platform) {
23
+ return platform === "win32" ? ";" : ":";
24
+ }
25
+ function pathDirectories(environment, platform) {
26
+ return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
27
+ }
28
+ function executableExtensions(command, platform, environment) {
29
+ if (platform !== "win32")
30
+ return [""];
31
+ if (targetPath(platform).extname(command) !== "")
32
+ return [""];
33
+ return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
34
+ }
35
+ function isExecutableFile(filePath, platform) {
36
+ try {
37
+ fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
38
+ return fs.statSync(filePath).isFile();
39
+ } catch {
40
+ return false;
41
+ }
42
+ }
43
+ function subdirectoryNames(directory) {
44
+ try {
45
+ return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
46
+ } catch {
47
+ return [];
48
+ }
49
+ }
50
+ function newestFirst(names) {
51
+ return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
52
+ }
53
+
54
+ // ../../harness-discovery/dist/invocation.js
55
+ import path2 from "node:path";
56
+ function commandInvocation(command, arguments_, environment, platform = process.platform) {
57
+ const extension = path2.win32.extname(command).toLowerCase();
58
+ if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
59
+ return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
60
+ }
61
+ const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
62
+ const commandLine = [command, ...arguments_].map(quote).join(" ");
63
+ return {
64
+ command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
65
+ arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
66
+ windowsVerbatimArguments: true
67
+ };
68
+ }
69
+
70
+ // ../../harness-discovery/dist/node-runtime.js
71
+ import path3 from "node:path";
72
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
73
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
74
+ const delimiter = platform === "win32" ? ";" : ":";
75
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
76
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
77
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
78
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
79
+ directories.push(runtimeDirectory);
80
+ }
81
+ return { ...environment, [pathKey]: directories.join(delimiter) };
82
+ }
83
+
84
+ // ../../harness-discovery/dist/resolve.js
85
+ import os from "node:os";
86
+
87
+ // ../../harness-discovery/dist/version-managers.js
88
+ function versionManagerBinaryDirectories(context) {
89
+ const { platform, environment, home } = context;
90
+ const list = context.subdirectories ?? subdirectoryNames;
91
+ const pathFlavor = targetPath(platform);
92
+ const value = (name) => environmentValue(environment, name);
93
+ const directories = [];
94
+ const versioned = (root, ...tail) => {
95
+ for (const version2 of newestFirst(list(root))) {
96
+ directories.push(pathFlavor.join(root, version2, ...tail));
97
+ }
98
+ };
99
+ if (platform === "win32") {
100
+ const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
101
+ const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
102
+ versioned(pathFlavor.join(appData, "nvm"));
103
+ versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
104
+ directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
105
+ directories.push(pathFlavor.join(home, ".bun", "bin"));
106
+ const pnpmHome2 = value("PNPM_HOME");
107
+ if (pnpmHome2)
108
+ directories.push(pnpmHome2);
109
+ directories.push(pathFlavor.join(localAppData, "pnpm"));
110
+ return directories;
111
+ }
112
+ versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
113
+ const fnmRoots = [
114
+ value("FNM_DIR"),
115
+ pathFlavor.join(home, ".local", "share", "fnm"),
116
+ pathFlavor.join(home, "Library", "Application Support", "fnm")
117
+ ].filter((root) => root !== void 0);
118
+ for (const root of fnmRoots) {
119
+ versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
120
+ }
121
+ const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
122
+ versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
123
+ directories.push(pathFlavor.join(voltaHome, "bin"));
124
+ const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
125
+ versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
126
+ directories.push(pathFlavor.join(asdfHome, "shims"));
127
+ const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
128
+ versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
129
+ directories.push(pathFlavor.join(nodenvHome, "shims"));
130
+ versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
131
+ directories.push(pathFlavor.join(home, ".bun", "bin"));
132
+ const pnpmHome = value("PNPM_HOME");
133
+ if (pnpmHome)
134
+ directories.push(pnpmHome);
135
+ directories.push(pathFlavor.join(home, "Library", "pnpm"));
136
+ directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
137
+ for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
138
+ for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
139
+ directories.push(pathFlavor.join(prefix, formula, "bin"));
140
+ }
141
+ }
142
+ return directories;
143
+ }
144
+
145
+ // ../../harness-discovery/dist/resolve.js
146
+ var VERSION_MANAGER_ROOTS = "<version-managers>";
147
+ function installRootExtensions(platform) {
148
+ return platform === "win32" ? [".exe", ".cmd"] : [""];
149
+ }
150
+ function resolveHomeDirectory(input) {
151
+ return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
152
+ }
153
+ function templateVariables(environment, platform, home) {
154
+ const pathFlavor = targetPath(platform);
155
+ return {
156
+ HOME: home,
157
+ USERPROFILE: home,
158
+ APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
159
+ LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
160
+ };
161
+ }
162
+ function joinTemplate(platform, value) {
163
+ const pathFlavor = targetPath(platform);
164
+ const segments = value.split("/");
165
+ const head = segments[0] ?? "";
166
+ const tail = segments.slice(1);
167
+ if (head === "")
168
+ return pathFlavor.join(pathFlavor.sep, ...tail);
169
+ return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
170
+ }
171
+ function expandInstallRoot(template, environment, platform, home) {
172
+ const variables = templateVariables(environment, platform, home);
173
+ let unresolved = false;
174
+ const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
175
+ const value = variables[name] ?? environmentValue(environment, name);
176
+ if (value === void 0 || value === "") {
177
+ unresolved = true;
178
+ return "";
179
+ }
180
+ return value;
181
+ });
182
+ return unresolved ? void 0 : joinTemplate(platform, substituted);
183
+ }
184
+ function installRootDirectories(spec, input, dependencies, platform, home) {
185
+ const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
186
+ const directories = [];
187
+ for (const template of templates) {
188
+ if (template === VERSION_MANAGER_ROOTS) {
189
+ directories.push(...versionManagerBinaryDirectories({
190
+ platform,
191
+ environment: input.environment,
192
+ home,
193
+ ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
194
+ }));
195
+ continue;
196
+ }
197
+ const directory = expandInstallRoot(template, input.environment, platform, home);
198
+ if (directory !== void 0)
199
+ directories.push(directory);
200
+ }
201
+ return directories;
202
+ }
203
+ function harnessCandidates(spec, input, dependencies = {}) {
204
+ const platform = input.platform ?? process.platform;
205
+ const pathFlavor = targetPath(platform);
206
+ const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
207
+ const command = configured ?? spec.command;
208
+ if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
209
+ return [{ candidate: command, source: "configured" }];
210
+ }
211
+ const candidates = [];
212
+ const extensions = executableExtensions(command, platform, input.environment);
213
+ for (const directory of pathDirectories(input.environment, platform)) {
214
+ for (const extension of extensions) {
215
+ candidates.push({
216
+ candidate: pathFlavor.join(directory, command + extension),
217
+ source: "path"
218
+ });
219
+ }
220
+ }
221
+ if (configured !== void 0)
222
+ return candidates;
223
+ const home = resolveHomeDirectory(input);
224
+ for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
225
+ for (const extension of installRootExtensions(platform)) {
226
+ candidates.push({
227
+ candidate: pathFlavor.join(directory, spec.command + extension),
228
+ source: "install-root"
229
+ });
230
+ }
231
+ }
232
+ return candidates;
233
+ }
234
+ function resolveHarnessExecutable(spec, input, dependencies = {}) {
235
+ const platform = input.platform ?? process.platform;
236
+ const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
237
+ const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
238
+ const context = { platform, isExecutable };
239
+ for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
240
+ const executable = runnable(candidate, context);
241
+ if (executable !== void 0 && isExecutable(executable))
242
+ return { executable, source };
243
+ }
244
+ return void 0;
245
+ }
246
+
247
+ // ../../harness-discovery/dist/installation.js
248
+ import { execFile } from "node:child_process";
249
+ import { homedir } from "node:os";
250
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
251
+ const env = withNodeRuntimeOnPath(environment);
252
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
253
+ return new Promise((resolve, reject) => {
254
+ const child = execFile(invocation.command, invocation.arguments, {
255
+ env,
256
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
257
+ encoding: "utf8",
258
+ timeout,
259
+ killSignal: "SIGKILL",
260
+ maxBuffer: 1024 * 1024,
261
+ windowsHide: true,
262
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
263
+ }, (error51, stdout, stderr) => {
264
+ if (error51)
265
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
266
+ else
267
+ resolve((stdout || stderr).trim());
268
+ });
269
+ child.stdin?.end();
270
+ });
271
+ }
272
+ function installationVersion(value) {
273
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
274
+ throw new Error("Harness returned an invalid version");
275
+ return value.trim().replace(/^v/, "");
276
+ }
277
+ function versionFromOutput(output) {
278
+ return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
279
+ }
280
+ function newerInstallationVersion(current, latest) {
281
+ const a = installationVersion(current).replace(/\+.*/, "");
282
+ const b = installationVersion(latest).replace(/\+.*/, "");
283
+ const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
284
+ const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
285
+ for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
286
+ if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
287
+ return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
288
+ }
289
+ const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
290
+ const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
291
+ if (!preA.length || !preB.length)
292
+ return !!preA.length && !preB.length;
293
+ for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
294
+ const x = preA[i];
295
+ const y = preB[i];
296
+ if (x === y)
297
+ continue;
298
+ if (x === void 0 || y === void 0)
299
+ return x === void 0;
300
+ const numericX = /^\d+$/.test(x);
301
+ const numericY = /^\d+$/.test(y);
302
+ if (numericX && numericY) {
303
+ if (BigInt(x) === BigInt(y))
304
+ continue;
305
+ return BigInt(y) > BigInt(x);
306
+ }
307
+ if (numericX !== numericY)
308
+ return numericX;
309
+ return y > x;
310
+ }
311
+ return false;
312
+ }
313
+ function createInstallationManager(options) {
314
+ let checking;
315
+ let updating;
316
+ const check2 = () => checking ??= options.check().finally(() => {
317
+ checking = void 0;
318
+ });
319
+ return (action) => {
320
+ if (updating)
321
+ return updating;
322
+ if (action === "check")
323
+ return check2();
324
+ updating = (async () => {
325
+ const before = await check2();
326
+ if (!before.updateAvailable)
327
+ return before;
328
+ if (!before.canUpdate)
329
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
330
+ await options.update(before);
331
+ const after = await check2();
332
+ if (after.currentVersion === before.currentVersion)
333
+ throw new Error("The Harness version did not change; check the native updater and retry");
334
+ return after;
335
+ })().finally(() => {
336
+ updating = void 0;
337
+ });
338
+ return updating;
339
+ };
340
+ }
341
+ async function fetchInstallationText(url2) {
342
+ const request = async () => {
343
+ const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
344
+ if (!response.ok)
345
+ throw new Error("Could not check the latest Harness version");
346
+ return response.text();
347
+ };
348
+ try {
349
+ return await request();
350
+ } catch (error51) {
351
+ if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
352
+ throw error51;
353
+ return request();
354
+ }
355
+ }
356
+
357
+ // ../../harness-discovery/dist/installer.js
358
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
359
+ import { tmpdir } from "node:os";
360
+ import { join } from "node:path";
361
+ function createHarnessInstaller(environment, source) {
362
+ return async () => {
363
+ if (!["darwin", "linux", "win32"].includes(process.platform))
364
+ throw new Error("Unsupported installation platform");
365
+ const env = withNodeRuntimeOnPath(environment);
366
+ if ("npm" in source) {
367
+ const npm = resolveHarnessExecutable({
368
+ id: "npm",
369
+ command: "npm",
370
+ installRoots: {
371
+ posix: [
372
+ "~/.npm-global/bin",
373
+ "~/.local/bin",
374
+ VERSION_MANAGER_ROOTS,
375
+ "/opt/homebrew/bin",
376
+ "/usr/local/bin",
377
+ "/usr/bin"
378
+ ],
379
+ windows: [
380
+ "${APPDATA}/npm",
381
+ VERSION_MANAGER_ROOTS,
382
+ "${ProgramFiles}/nodejs",
383
+ "${LOCALAPPDATA}/Programs/nodejs"
384
+ ]
385
+ }
386
+ }, { environment: env });
387
+ if (!npm)
388
+ throw new Error("Install Node.js and npm first");
389
+ await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
390
+ ...env,
391
+ ...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
392
+ }, 6e5);
393
+ return;
394
+ }
395
+ const windows = process.platform === "win32";
396
+ const url2 = windows ? source.windows : source.posix;
397
+ if (new URL(url2).protocol !== "https:")
398
+ throw new Error("Installer requires HTTPS");
399
+ const script = await fetchInstallationText(url2);
400
+ const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
401
+ try {
402
+ const file2 = join(directory, windows ? "install.ps1" : "install.sh");
403
+ await writeFile(file2, script, { mode: 384 });
404
+ await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
405
+ } finally {
406
+ await rm(directory, { recursive: true, force: true });
407
+ }
408
+ };
409
+ }
410
+
8
411
  // dist/antigravity-adapter.js
9
412
  import { spawn } from "node:child_process";
10
413
  import { randomUUID as randomUUID6 } from "node:crypto";
11
414
  import { readFile as readFile2, unlink } from "node:fs/promises";
12
415
  import https3 from "node:https";
13
416
  import os5 from "node:os";
14
- import path9 from "node:path";
417
+ import path10 from "node:path";
15
418
  import readline from "node:readline";
16
419
 
17
420
  // ../../../node_modules/zod/v4/classic/external.js
@@ -780,10 +1183,10 @@ function mergeDefs(...defs) {
780
1183
  function cloneDef(schema) {
781
1184
  return mergeDefs(schema._zod.def);
782
1185
  }
783
- function getElementAtPath(obj, path10) {
784
- if (!path10)
1186
+ function getElementAtPath(obj, path11) {
1187
+ if (!path11)
785
1188
  return obj;
786
- return path10.reduce((acc, key) => acc?.[key], obj);
1189
+ return path11.reduce((acc, key) => acc?.[key], obj);
787
1190
  }
788
1191
  function promiseAllObject(promisesObj) {
789
1192
  const keys = Object.keys(promisesObj);
@@ -1192,11 +1595,11 @@ function explicitlyAborted(x, startIndex = 0) {
1192
1595
  }
1193
1596
  return false;
1194
1597
  }
1195
- function prefixIssues(path10, issues) {
1598
+ function prefixIssues(path11, issues) {
1196
1599
  return issues.map((iss) => {
1197
1600
  var _a3;
1198
1601
  (_a3 = iss).path ?? (_a3.path = []);
1199
- iss.path.unshift(path10);
1602
+ iss.path.unshift(path11);
1200
1603
  return iss;
1201
1604
  });
1202
1605
  }
@@ -1343,16 +1746,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1343
1746
  }
1344
1747
  function formatError(error51, mapper = (issue2) => issue2.message) {
1345
1748
  const fieldErrors = { _errors: [] };
1346
- const processError = (error52, path10 = []) => {
1749
+ const processError = (error52, path11 = []) => {
1347
1750
  for (const issue2 of error52.issues) {
1348
1751
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1349
- issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
1752
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1350
1753
  } else if (issue2.code === "invalid_key") {
1351
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1754
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1352
1755
  } else if (issue2.code === "invalid_element") {
1353
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1756
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1354
1757
  } else {
1355
- const fullpath = [...path10, ...issue2.path];
1758
+ const fullpath = [...path11, ...issue2.path];
1356
1759
  if (fullpath.length === 0) {
1357
1760
  fieldErrors._errors.push(mapper(issue2));
1358
1761
  } else {
@@ -1379,17 +1782,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1379
1782
  }
1380
1783
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1381
1784
  const result = { errors: [] };
1382
- const processError = (error52, path10 = []) => {
1785
+ const processError = (error52, path11 = []) => {
1383
1786
  var _a3, _b;
1384
1787
  for (const issue2 of error52.issues) {
1385
1788
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1386
- issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
1789
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1387
1790
  } else if (issue2.code === "invalid_key") {
1388
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1791
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1389
1792
  } else if (issue2.code === "invalid_element") {
1390
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1793
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1391
1794
  } else {
1392
- const fullpath = [...path10, ...issue2.path];
1795
+ const fullpath = [...path11, ...issue2.path];
1393
1796
  if (fullpath.length === 0) {
1394
1797
  result.errors.push(mapper(issue2));
1395
1798
  continue;
@@ -1421,8 +1824,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1421
1824
  }
1422
1825
  function toDotPath(_path) {
1423
1826
  const segs = [];
1424
- const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1425
- for (const seg of path10) {
1827
+ const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1828
+ for (const seg of path11) {
1426
1829
  if (typeof seg === "number")
1427
1830
  segs.push(`[${seg}]`);
1428
1831
  else if (typeof seg === "symbol")
@@ -14114,13 +14517,13 @@ function resolveRef(ref, ctx) {
14114
14517
  if (!ref.startsWith("#")) {
14115
14518
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14116
14519
  }
14117
- const path10 = ref.slice(1).split("/").filter(Boolean);
14118
- if (path10.length === 0) {
14520
+ const path11 = ref.slice(1).split("/").filter(Boolean);
14521
+ if (path11.length === 0) {
14119
14522
  return ctx.rootSchema;
14120
14523
  }
14121
14524
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14122
- if (path10[0] === defsKey) {
14123
- const key = path10[1];
14525
+ if (path11[0] === defsKey) {
14526
+ const key = path11[1];
14124
14527
  if (!key || !ctx.defs[key]) {
14125
14528
  throw new Error(`Reference not found: ${ref}`);
14126
14529
  }
@@ -14583,6 +14986,56 @@ var credentialImportsParamsSchema = external_exports.object({
14583
14986
  request: credentialImportsRequestSchema
14584
14987
  }).strict();
14585
14988
 
14989
+ // ../../shared-contracts/dist/harness-display-settings.js
14990
+ var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
14991
+ agent: external_exports.string().min(1).max(128),
14992
+ section: external_exports.enum(["main", "more", "auto"])
14993
+ })).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
14994
+ var harnessDisplaySettingsSchema = external_exports.strictObject({
14995
+ entries: harnessDisplayEntriesSchema.nullable()
14996
+ });
14997
+ var harnessDisplayGetSchema = external_exports.strictObject({});
14998
+ var harnessDisplaySetSchema = external_exports.strictObject({
14999
+ entries: harnessDisplayEntriesSchema,
15000
+ /** Import legacy Desktop preferences only if no shared settings exist yet. */
15001
+ initializeOnly: external_exports.boolean().optional()
15002
+ });
15003
+
15004
+ // ../../shared-contracts/dist/console.js
15005
+ var consoleAnnouncementSchema = external_exports.strictObject({
15006
+ title: external_exports.string().trim().min(1).max(200),
15007
+ type: external_exports.enum(["info", "warning", "danger"]),
15008
+ body: external_exports.string().trim().min(1).max(16 * 1024)
15009
+ });
15010
+ var consoleOpenParamsSchema = external_exports.strictObject({});
15011
+ var consoleOpenResultSchema = external_exports.strictObject({
15012
+ /** The console address. */
15013
+ url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
15014
+ });
15015
+ var CONSOLE_HOST_METHODS = Object.freeze([
15016
+ "codexhost/harness/plugins/list",
15017
+ "codexhost/harness/display-settings/get",
15018
+ "codexhost/harness/display-settings/set",
15019
+ "codexhost/harness/inspect",
15020
+ "codexhost/harness/installation",
15021
+ "codexhost/harness/launch-settings/get",
15022
+ "codexhost/harness/launch-settings/set",
15023
+ "codexhost/harness/web-ui/open",
15024
+ "codexhost/harness/accounts/sources",
15025
+ "codexhost/harness/accounts/list",
15026
+ "codexhost/harness/accounts/inspect",
15027
+ "codexhost/harness/credential-imports",
15028
+ "codexhost/harness/session-import/sources",
15029
+ "codexhost/harness/session-import/list",
15030
+ "codexhost/harness/session-import/import",
15031
+ "codexhost/account/list",
15032
+ "codexhost/account/refresh",
15033
+ "codexhost/account/usage/inspect",
15034
+ "codexhost/update/check",
15035
+ "codexhost/update/start",
15036
+ "codexhost/update/status"
15037
+ ]);
15038
+
14586
15039
  // ../../shared-contracts/dist/version.js
14587
15040
  var WORKSPACE_CONTRACT_VERSION = 1;
14588
15041
 
@@ -14636,6 +15089,12 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
14636
15089
  var hostItemIdSchema = opaqueIdSchema.brand();
14637
15090
  var hostInteractionIdSchema = opaqueIdSchema.brand();
14638
15091
 
15092
+ // ../../shared-contracts/dist/manual-compaction.js
15093
+ var threadManualCompactionStartedSchema = external_exports.strictObject({
15094
+ threadId: hostThreadIdSchema,
15095
+ turnId: hostTurnIdSchema
15096
+ });
15097
+
14639
15098
  // ../../shared-contracts/dist/thread-usage.js
14640
15099
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14641
15100
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -14696,6 +15155,10 @@ var threadUsageSnapshotSchema = external_exports.object({
14696
15155
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
14697
15156
  var accountCreditsProductUsageSchema = external_exports.object({
14698
15157
  product: external_exports.string().min(1),
15158
+ used: external_exports.number().finite().nonnegative().optional(),
15159
+ // Zero is a real empty cap, not an absent field.
15160
+ limit: external_exports.number().finite().nonnegative().optional(),
15161
+ unit: external_exports.string().min(1).max(32).optional(),
14699
15162
  usagePercent: usagePercentSchema,
14700
15163
  resetsAt: external_exports.string().min(1).optional()
14701
15164
  }).strict();
@@ -14705,6 +15168,10 @@ var accountResetCreditsSchema = external_exports.object({
14705
15168
  expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
14706
15169
  }).strict();
14707
15170
  var accountCreditsSnapshotSchema = external_exports.object({
15171
+ used: external_exports.number().finite().nonnegative().optional(),
15172
+ // Zero is a real empty cap, not an absent field.
15173
+ limit: external_exports.number().finite().nonnegative().optional(),
15174
+ unit: external_exports.string().min(1).max(32).optional(),
14708
15175
  /** Native label when the primary limit is scoped to a model or product group. */
14709
15176
  label: external_exports.string().min(1).optional(),
14710
15177
  usedPercent: usagePercentSchema,
@@ -14724,12 +15191,27 @@ var threadUsageInspectionSchema = external_exports.object({
14724
15191
  }).strict();
14725
15192
 
14726
15193
  // ../../shared-contracts/dist/harness-accounts.js
14727
- var harnessAccountSnapshotSchema = external_exports.object({
15194
+ var accountBalanceSnapshotSchema = external_exports.object({
15195
+ amount: external_exports.number().finite().nonnegative(),
15196
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
15197
+ currency: external_exports.string().trim().min(1).max(8),
15198
+ /** Native label when the Harness exposes several Billing Sources. */
15199
+ label: external_exports.string().trim().min(1).max(128).optional()
15200
+ }).strict();
15201
+ var harnessAccountSnapshotObject = external_exports.object({
14728
15202
  email: external_exports.string().trim().min(1).max(320).optional(),
14729
15203
  label: external_exports.string().trim().min(1).max(256).optional(),
14730
15204
  plan: external_exports.string().trim().min(1).max(128).optional(),
14731
- credits: accountCreditsSnapshotSchema
15205
+ credits: accountCreditsSnapshotSchema.optional(),
15206
+ balance: accountBalanceSnapshotSchema.optional()
14732
15207
  }).strict();
15208
+ function requireReportedQuota(schema) {
15209
+ return schema.refine((value) => {
15210
+ const reported = value;
15211
+ return reported.credits !== void 0 || reported.balance !== void 0;
15212
+ }, { message: "Account must report either credits or a balance" });
15213
+ }
15214
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
14733
15215
  var harnessAccountIdentityShape = {
14734
15216
  harnessId: harnessIdSchema,
14735
15217
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -14740,11 +15222,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
14740
15222
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
14741
15223
  var harnessAccountInspectResultSchema = external_exports.object({
14742
15224
  ...harnessAccountIdentityShape,
14743
- account: harnessAccountSnapshotSchema.nullable()
15225
+ account: harnessAccountSnapshotSchema.nullable(),
15226
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
15227
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
14744
15228
  }).strict();
14745
15229
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
14746
15230
  var harnessAccountListResultSchema = external_exports.object({
14747
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
15231
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
14748
15232
  }).strict();
14749
15233
 
14750
15234
  // ../../shared-contracts/dist/json-value.js
@@ -14882,6 +15366,8 @@ var harnessModelSchema = external_exports.object({
14882
15366
  ref: harnessModelRefSchema,
14883
15367
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
14884
15368
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15369
+ /** Optional opaque selection for this same Model with priority processing enabled. */
15370
+ fastModel: harnessModelRefSchema.optional(),
14885
15371
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14886
15372
  }).strict();
14887
15373
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -14914,6 +15400,16 @@ var harnessModelCatalogSchema = external_exports.object({
14914
15400
  });
14915
15401
  }
14916
15402
  refs.add(model.ref.id);
15403
+ if (model.fastModel) {
15404
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15405
+ context.addIssue({
15406
+ code: "custom",
15407
+ message: "Fast Model refs must be distinct and unique",
15408
+ path: ["models", index, "fastModel"]
15409
+ });
15410
+ }
15411
+ refs.add(model.fastModel.id);
15412
+ }
14917
15413
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14918
15414
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
14919
15415
  if (supportedThinkingIds.has(optionId)) {
@@ -15033,11 +15529,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15033
15529
  thinkingOptionId: harnessThinkingOptionIdSchema
15034
15530
  }).strict();
15035
15531
  var threadInspectionParamsSchema = external_exports.object({
15036
- threadId: hostThreadIdSchema
15532
+ threadId: hostThreadIdSchema,
15533
+ includeReferenceCapability: external_exports.boolean().optional()
15037
15534
  }).strict();
15038
15535
  var codexThreadInspectionSchema = external_exports.object({
15039
15536
  owner: external_exports.literal("codex"),
15040
- locked: external_exports.literal(true)
15537
+ locked: external_exports.literal(true),
15538
+ supportsThreadReferences: external_exports.literal(true).optional()
15041
15539
  }).strict();
15042
15540
  var externalThreadInspectionSchema = external_exports.object({
15043
15541
  owner: external_exports.literal("external"),
@@ -15163,6 +15661,22 @@ var harnessLaunchSettingsSchema = external_exports.object({
15163
15661
  restartRequired: external_exports.boolean()
15164
15662
  }).strict();
15165
15663
 
15664
+ // ../../shared-contracts/dist/harness-installation.js
15665
+ var harnessInstallationParamsSchema = external_exports.object({
15666
+ harnessId: harnessIdSchema,
15667
+ action: external_exports.enum(["check", "update", "install"])
15668
+ }).strict();
15669
+ var harnessInstallationStateSchema = external_exports.object({
15670
+ currentVersion: external_exports.string().min(1).max(128),
15671
+ latestVersion: external_exports.string().min(1).max(128),
15672
+ updateAvailable: external_exports.boolean(),
15673
+ canUpdate: external_exports.boolean(),
15674
+ // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15675
+ message: external_exports.string().max(2048).optional(),
15676
+ messageCode: external_exports.string().min(1).max(128).optional(),
15677
+ latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15678
+ }).strict();
15679
+
15166
15680
  // ../../shared-contracts/dist/codex-accounts.js
15167
15681
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15168
15682
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
@@ -15462,6 +15976,38 @@ var updateStatusResultSchema = external_exports.strictObject({
15462
15976
  status: updateStatusSchema.nullable()
15463
15977
  });
15464
15978
 
15979
+ // ../../shared-contracts/dist/remote-runtime.js
15980
+ var remoteUpdatePhaseSchema = external_exports.enum([
15981
+ "idle",
15982
+ "installing",
15983
+ "restarting",
15984
+ "succeeded",
15985
+ "failed"
15986
+ ]);
15987
+ var runtimeStatusSchema = external_exports.object({
15988
+ runningVersion: external_exports.string().nullable(),
15989
+ installedVersion: external_exports.string().nullable(),
15990
+ restartRequired: external_exports.boolean(),
15991
+ remote: external_exports.boolean(),
15992
+ updateSupported: external_exports.boolean(),
15993
+ update: external_exports.object({
15994
+ phase: remoteUpdatePhaseSchema,
15995
+ targetVersion: external_exports.string().nullable(),
15996
+ error: external_exports.string().nullable()
15997
+ })
15998
+ });
15999
+ var remoteUpdateParamsSchema = external_exports.object({
16000
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
16001
+ }).strict();
16002
+ var remoteSshSetupParamsSchema = external_exports.object({
16003
+ hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
16004
+ port: external_exports.number().int().min(1).max(65535).nullable(),
16005
+ identity: external_exports.string().max(4096).nullable(),
16006
+ action: external_exports.enum(["inspect", "install", "update", "repair"]),
16007
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
16008
+ }).strict();
16009
+ var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
16010
+
15465
16011
  // ../../shared-contracts/dist/index.js
15466
16012
  var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
15467
16013
 
@@ -15589,233 +16135,8 @@ var usageFields = /* @__PURE__ */ new Set([
15589
16135
  "contextUsagePercent"
15590
16136
  ]);
15591
16137
 
15592
- // ../../harness-discovery/dist/environment.js
15593
- import fs from "node:fs";
15594
- import path from "node:path";
15595
- function targetPath(platform) {
15596
- return platform === "win32" ? path.win32 : path.posix;
15597
- }
15598
- function environmentValue(environment, name) {
15599
- const lowered = name.toLowerCase();
15600
- for (const [key, value] of Object.entries(environment)) {
15601
- if (key.toLowerCase() === lowered)
15602
- return value;
15603
- }
15604
- return void 0;
15605
- }
15606
- function pathDelimiter(platform) {
15607
- return platform === "win32" ? ";" : ":";
15608
- }
15609
- function pathDirectories(environment, platform) {
15610
- return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
15611
- }
15612
- function executableExtensions(command, platform, environment) {
15613
- if (platform !== "win32")
15614
- return [""];
15615
- if (targetPath(platform).extname(command) !== "")
15616
- return [""];
15617
- return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
15618
- }
15619
- function isExecutableFile(filePath, platform) {
15620
- try {
15621
- fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
15622
- return fs.statSync(filePath).isFile();
15623
- } catch {
15624
- return false;
15625
- }
15626
- }
15627
- function subdirectoryNames(directory) {
15628
- try {
15629
- return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
15630
- } catch {
15631
- return [];
15632
- }
15633
- }
15634
- function newestFirst(names) {
15635
- return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
15636
- }
15637
-
15638
- // ../../harness-discovery/dist/invocation.js
15639
- import path2 from "node:path";
15640
- function commandInvocation(command, arguments_, environment, platform = process.platform) {
15641
- const extension = path2.win32.extname(command).toLowerCase();
15642
- if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
15643
- return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
15644
- }
15645
- const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
15646
- const commandLine = [command, ...arguments_].map(quote).join(" ");
15647
- return {
15648
- command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
15649
- arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
15650
- windowsVerbatimArguments: true
15651
- };
15652
- }
15653
-
15654
- // ../../harness-discovery/dist/resolve.js
15655
- import os from "node:os";
15656
-
15657
- // ../../harness-discovery/dist/version-managers.js
15658
- function versionManagerBinaryDirectories(context) {
15659
- const { platform, environment, home } = context;
15660
- const list = context.subdirectories ?? subdirectoryNames;
15661
- const pathFlavor = targetPath(platform);
15662
- const value = (name) => environmentValue(environment, name);
15663
- const directories = [];
15664
- const versioned = (root, ...tail) => {
15665
- for (const version2 of newestFirst(list(root))) {
15666
- directories.push(pathFlavor.join(root, version2, ...tail));
15667
- }
15668
- };
15669
- if (platform === "win32") {
15670
- const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
15671
- const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
15672
- versioned(pathFlavor.join(appData, "nvm"));
15673
- versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
15674
- directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
15675
- directories.push(pathFlavor.join(home, ".bun", "bin"));
15676
- const pnpmHome2 = value("PNPM_HOME");
15677
- if (pnpmHome2)
15678
- directories.push(pnpmHome2);
15679
- directories.push(pathFlavor.join(localAppData, "pnpm"));
15680
- return directories;
15681
- }
15682
- versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
15683
- const fnmRoots = [
15684
- value("FNM_DIR"),
15685
- pathFlavor.join(home, ".local", "share", "fnm"),
15686
- pathFlavor.join(home, "Library", "Application Support", "fnm")
15687
- ].filter((root) => root !== void 0);
15688
- for (const root of fnmRoots) {
15689
- versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
15690
- }
15691
- const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
15692
- versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
15693
- directories.push(pathFlavor.join(voltaHome, "bin"));
15694
- const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
15695
- versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
15696
- directories.push(pathFlavor.join(asdfHome, "shims"));
15697
- const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
15698
- versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
15699
- directories.push(pathFlavor.join(nodenvHome, "shims"));
15700
- versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
15701
- directories.push(pathFlavor.join(home, ".bun", "bin"));
15702
- const pnpmHome = value("PNPM_HOME");
15703
- if (pnpmHome)
15704
- directories.push(pnpmHome);
15705
- directories.push(pathFlavor.join(home, "Library", "pnpm"));
15706
- directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
15707
- for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
15708
- for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
15709
- directories.push(pathFlavor.join(prefix, formula, "bin"));
15710
- }
15711
- }
15712
- return directories;
15713
- }
15714
-
15715
- // ../../harness-discovery/dist/resolve.js
15716
- var VERSION_MANAGER_ROOTS = "<version-managers>";
15717
- function installRootExtensions(platform) {
15718
- return platform === "win32" ? [".exe", ".cmd"] : [""];
15719
- }
15720
- function resolveHomeDirectory(input) {
15721
- return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
15722
- }
15723
- function templateVariables(environment, platform, home) {
15724
- const pathFlavor = targetPath(platform);
15725
- return {
15726
- HOME: home,
15727
- USERPROFILE: home,
15728
- APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
15729
- LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
15730
- };
15731
- }
15732
- function joinTemplate(platform, value) {
15733
- const pathFlavor = targetPath(platform);
15734
- const segments = value.split("/");
15735
- const head = segments[0] ?? "";
15736
- const tail = segments.slice(1);
15737
- if (head === "")
15738
- return pathFlavor.join(pathFlavor.sep, ...tail);
15739
- return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
15740
- }
15741
- function expandInstallRoot(template, environment, platform, home) {
15742
- const variables = templateVariables(environment, platform, home);
15743
- let unresolved = false;
15744
- const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
15745
- const value = variables[name] ?? environmentValue(environment, name);
15746
- if (value === void 0 || value === "") {
15747
- unresolved = true;
15748
- return "";
15749
- }
15750
- return value;
15751
- });
15752
- return unresolved ? void 0 : joinTemplate(platform, substituted);
15753
- }
15754
- function installRootDirectories(spec, input, dependencies, platform, home) {
15755
- const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
15756
- const directories = [];
15757
- for (const template of templates) {
15758
- if (template === VERSION_MANAGER_ROOTS) {
15759
- directories.push(...versionManagerBinaryDirectories({
15760
- platform,
15761
- environment: input.environment,
15762
- home,
15763
- ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
15764
- }));
15765
- continue;
15766
- }
15767
- const directory = expandInstallRoot(template, input.environment, platform, home);
15768
- if (directory !== void 0)
15769
- directories.push(directory);
15770
- }
15771
- return directories;
15772
- }
15773
- function harnessCandidates(spec, input, dependencies = {}) {
15774
- const platform = input.platform ?? process.platform;
15775
- const pathFlavor = targetPath(platform);
15776
- const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
15777
- const command = configured ?? spec.command;
15778
- if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
15779
- return [{ candidate: command, source: "configured" }];
15780
- }
15781
- const candidates = [];
15782
- const extensions = executableExtensions(command, platform, input.environment);
15783
- for (const directory of pathDirectories(input.environment, platform)) {
15784
- for (const extension of extensions) {
15785
- candidates.push({
15786
- candidate: pathFlavor.join(directory, command + extension),
15787
- source: "path"
15788
- });
15789
- }
15790
- }
15791
- if (configured !== void 0)
15792
- return candidates;
15793
- const home = resolveHomeDirectory(input);
15794
- for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
15795
- for (const extension of installRootExtensions(platform)) {
15796
- candidates.push({
15797
- candidate: pathFlavor.join(directory, spec.command + extension),
15798
- source: "install-root"
15799
- });
15800
- }
15801
- }
15802
- return candidates;
15803
- }
15804
- function resolveHarnessExecutable(spec, input, dependencies = {}) {
15805
- const platform = input.platform ?? process.platform;
15806
- const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
15807
- const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
15808
- const context = { platform, isExecutable };
15809
- for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
15810
- const executable = runnable(candidate, context);
15811
- if (executable !== void 0 && isExecutable(executable))
15812
- return { executable, source };
15813
- }
15814
- return void 0;
15815
- }
15816
-
15817
16138
  // dist/command.js
15818
- import path3 from "node:path";
16139
+ import path4 from "node:path";
15819
16140
  var antigravityDiscoverySpec = {
15820
16141
  id: "antigravity",
15821
16142
  command: "agy",
@@ -15835,20 +16156,20 @@ function resolveAntigravityExecutable(input = {}) {
15835
16156
  });
15836
16157
  if (!resolution)
15837
16158
  return void 0;
15838
- return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path3.resolve(resolution.executable);
16159
+ return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
15839
16160
  }
15840
16161
 
15841
16162
  // dist/fork.js
15842
16163
  import { randomUUID as randomUUID2 } from "node:crypto";
15843
16164
  import { copyFile, cp, mkdir as mkdir2 } from "node:fs/promises";
15844
16165
  import os3 from "node:os";
15845
- import path5 from "node:path";
16166
+ import path6 from "node:path";
15846
16167
 
15847
16168
  // dist/history.js
15848
16169
  import { randomUUID } from "node:crypto";
15849
- import { mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
16170
+ import { mkdir, readFile, readdir, rename, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
15850
16171
  import os2 from "node:os";
15851
- import path4 from "node:path";
16172
+ import path5 from "node:path";
15852
16173
  var HISTORY_VERSION = 1;
15853
16174
  var THREAD_ID_ENV = "CODEXHOST_THREAD_ID";
15854
16175
  var harnessErrorSchema = external_exports.strictObject({
@@ -15945,7 +16266,7 @@ var historySchema = external_exports.strictObject({
15945
16266
  });
15946
16267
  function historyRoot(environment) {
15947
16268
  const dataDirectory = environment.CODEXHOST_DATA_DIR;
15948
- return path4.join(dataDirectory ? path4.resolve(dataDirectory) : path4.join(os2.homedir(), ".codexhost"), "antigravity-history");
16269
+ return path5.join(dataDirectory ? path5.resolve(dataDirectory) : path5.join(os2.homedir(), ".codexhost"), "antigravity-history");
15949
16270
  }
15950
16271
  function safeThreadId(environment) {
15951
16272
  const threadId = (environment[THREAD_ID_ENV] ?? environment.CODEXHOST_DELEGATION_THREAD_ID)?.trim();
@@ -15953,7 +16274,7 @@ function safeThreadId(environment) {
15953
16274
  }
15954
16275
  function historyPath(environment) {
15955
16276
  const threadId = safeThreadId(environment);
15956
- return threadId ? path4.join(historyRoot(environment), `${threadId}.json`) : null;
16277
+ return threadId ? path5.join(historyRoot(environment), `${threadId}.json`) : null;
15957
16278
  }
15958
16279
  function jsonTurn(turn) {
15959
16280
  return JSON.parse(JSON.stringify(turn));
@@ -16032,7 +16353,7 @@ var AntigravityHistory = class _AntigravityHistory {
16032
16353
  for (const entry of entries) {
16033
16354
  if (!entry.endsWith(".json"))
16034
16355
  continue;
16035
- const file2 = path4.join(root, entry);
16356
+ const file2 = path5.join(root, entry);
16036
16357
  try {
16037
16358
  const parsed = historySchema.safeParse(JSON.parse(await readFile(file2, "utf8")));
16038
16359
  if (parsed.success && parsed.data.nativeSessionId === nativeSessionId) {
@@ -16119,11 +16440,11 @@ var AntigravityHistory = class _AntigravityHistory {
16119
16440
  const model = this.#model;
16120
16441
  const thinkingOptionId = this.#thinkingOptionId;
16121
16442
  this.#write = this.#write.catch(() => void 0).then(async () => {
16122
- const directory = path4.dirname(file2);
16443
+ const directory = path5.dirname(file2);
16123
16444
  await mkdir(directory, { recursive: true, mode: 448 });
16124
- const temporary = path4.join(directory, `.${path4.basename(file2)}.${randomUUID()}.tmp`);
16445
+ const temporary = path5.join(directory, `.${path5.basename(file2)}.${randomUUID()}.tmp`);
16125
16446
  try {
16126
- await writeFile(temporary, `${JSON.stringify({
16447
+ await writeFile2(temporary, `${JSON.stringify({
16127
16448
  formatVersion: HISTORY_VERSION,
16128
16449
  nativeSessionId,
16129
16450
  turns,
@@ -16133,31 +16454,31 @@ var AntigravityHistory = class _AntigravityHistory {
16133
16454
  `, { mode: 384 });
16134
16455
  await rename(temporary, file2);
16135
16456
  } finally {
16136
- await rm(temporary, { force: true }).catch(() => void 0);
16457
+ await rm2(temporary, { force: true }).catch(() => void 0);
16137
16458
  }
16138
16459
  });
16139
16460
  }
16140
16461
  };
16141
16462
 
16142
16463
  // dist/fork.js
16143
- function nativeConversationDbPath(nativeSessionId, homedir = os3.homedir()) {
16144
- return path5.join(homedir, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
16464
+ function nativeConversationDbPath(nativeSessionId, homedir2 = os3.homedir()) {
16465
+ return path6.join(homedir2, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
16145
16466
  }
16146
- function nativeBrainDirPath(nativeSessionId, homedir = os3.homedir()) {
16147
- return path5.join(homedir, ".gemini", "antigravity-cli", "brain", nativeSessionId);
16467
+ function nativeBrainDirPath(nativeSessionId, homedir2 = os3.homedir()) {
16468
+ return path6.join(homedir2, ".gemini", "antigravity-cli", "brain", nativeSessionId);
16148
16469
  }
16149
16470
  async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, retainedTurnsCountOrHomedir, homedirOption = os3.homedir()) {
16150
16471
  let retainedTurnsCount;
16151
- let homedir = homedirOption;
16472
+ let homedir2 = homedirOption;
16152
16473
  if (typeof retainedTurnsCountOrHomedir === "string") {
16153
- homedir = retainedTurnsCountOrHomedir;
16474
+ homedir2 = retainedTurnsCountOrHomedir;
16154
16475
  } else if (typeof retainedTurnsCountOrHomedir === "number") {
16155
16476
  retainedTurnsCount = retainedTurnsCountOrHomedir;
16156
16477
  }
16157
- const sourceDb = nativeConversationDbPath(sourceSessionId, homedir);
16158
- const targetDb = nativeConversationDbPath(derivedSessionId, homedir);
16478
+ const sourceDb = nativeConversationDbPath(sourceSessionId, homedir2);
16479
+ const targetDb = nativeConversationDbPath(derivedSessionId, homedir2);
16159
16480
  try {
16160
- await mkdir2(path5.dirname(targetDb), { recursive: true });
16481
+ await mkdir2(path6.dirname(targetDb), { recursive: true });
16161
16482
  await copyFile(sourceDb, targetDb);
16162
16483
  } catch {
16163
16484
  return false;
@@ -16208,7 +16529,7 @@ async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, reta
16208
16529
  } catch {
16209
16530
  }
16210
16531
  try {
16211
- const summariesDbPath = path5.join(homedir, ".gemini", "antigravity-cli", "conversation_summaries.db");
16532
+ const summariesDbPath = path6.join(homedir2, ".gemini", "antigravity-cli", "conversation_summaries.db");
16212
16533
  const sumDb = new DatabaseSync(summariesDbPath);
16213
16534
  try {
16214
16535
  const cur = sumDb.prepare("SELECT * FROM conversation_summaries WHERE conversation_id = ?");
@@ -16245,13 +16566,13 @@ async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, reta
16245
16566
  return true;
16246
16567
  }
16247
16568
  var copyNativeConversationDbIfExists = cloneNativeConversationDb;
16248
- async function copyNativeBrainDirIfExists(sourceSessionId, derivedSessionId, homedir = os3.homedir()) {
16249
- const sourceBrain = nativeBrainDirPath(sourceSessionId, homedir);
16250
- const targetBrain = nativeBrainDirPath(derivedSessionId, homedir);
16569
+ async function copyNativeBrainDirIfExists(sourceSessionId, derivedSessionId, homedir2 = os3.homedir()) {
16570
+ const sourceBrain = nativeBrainDirPath(sourceSessionId, homedir2);
16571
+ const targetBrain = nativeBrainDirPath(derivedSessionId, homedir2);
16251
16572
  try {
16252
16573
  await cp(sourceBrain, targetBrain, {
16253
16574
  recursive: true,
16254
- filter: (source) => path5.basename(source) !== ".system_generated"
16575
+ filter: (source) => path6.basename(source) !== ".system_generated"
16255
16576
  });
16256
16577
  return true;
16257
16578
  } catch {
@@ -16702,7 +17023,7 @@ function parseAndFormatAntigravityCommand(command) {
16702
17023
  import https from "node:https";
16703
17024
 
16704
17025
  // dist/tool-projection.js
16705
- import path6 from "node:path";
17026
+ import path7 from "node:path";
16706
17027
  function isRecord(value) {
16707
17028
  return typeof value === "object" && value !== null && !Array.isArray(value);
16708
17029
  }
@@ -16723,10 +17044,10 @@ function displayPath(nativePath, cwd) {
16723
17044
  if (typeof nativePath !== "string" || nativePath.trim().length === 0 || nativePath.includes("\0") || nativePath.includes("\n") || nativePath.includes("\r")) {
16724
17045
  return null;
16725
17046
  }
16726
- const resolvedCwd = path6.resolve(cwd);
16727
- const resolvedPath = path6.isAbsolute(nativePath) ? path6.resolve(nativePath) : path6.resolve(cwd, nativePath);
16728
- const relative = path6.relative(resolvedCwd, resolvedPath);
16729
- const inside = !path6.isAbsolute(relative) && relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path6.sep}`);
17047
+ const resolvedCwd = path7.resolve(cwd);
17048
+ const resolvedPath = path7.isAbsolute(nativePath) ? path7.resolve(nativePath) : path7.resolve(cwd, nativePath);
17049
+ const relative = path7.relative(resolvedCwd, resolvedPath);
17050
+ const inside = !path7.isAbsolute(relative) && relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path7.sep}`);
16730
17051
  const selected = inside ? relative : resolvedPath;
16731
17052
  const normalized = selected.replaceAll("\\", "/");
16732
17053
  if (normalized.length === 0 || normalized === ".")
@@ -16857,7 +17178,7 @@ function synthesizeAntigravityCommand(toolName, params, cwd) {
16857
17178
  ]);
16858
17179
  let resolvedCwd;
16859
17180
  if (workingDir && workingDir.trim().length > 0) {
16860
- resolvedCwd = cwd && !path6.isAbsolute(workingDir) ? path6.resolve(cwd, workingDir) : workingDir;
17181
+ resolvedCwd = cwd && !path7.isAbsolute(workingDir) ? path7.resolve(cwd, workingDir) : workingDir;
16861
17182
  } else if (cwd) {
16862
17183
  resolvedCwd = cwd;
16863
17184
  }
@@ -17258,10 +17579,10 @@ async function fetchAntigravityQuota(run, now = /* @__PURE__ */ new Date()) {
17258
17579
 
17259
17580
  // dist/question-bridge.js
17260
17581
  import { randomBytes, randomUUID as randomUUID4, timingSafeEqual } from "node:crypto";
17261
- import { mkdir as mkdir3, mkdtemp, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
17582
+ import { mkdir as mkdir3, mkdtemp as mkdtemp2, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
17262
17583
  import { createServer } from "node:http";
17263
17584
  import os4 from "node:os";
17264
- import path7 from "node:path";
17585
+ import path8 from "node:path";
17265
17586
 
17266
17587
  // dist/question-hook-client.js
17267
17588
  var ANTIGRAVITY_QUESTION_HOOK_CLIENT = String.raw`
@@ -17386,7 +17707,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
17386
17707
  this.#server.on("request", (request, response) => this.#receive(request, response));
17387
17708
  }
17388
17709
  static async create(options) {
17389
- const directory = await mkdtemp(path7.join(os4.tmpdir(), "codexhost-agy-question-"));
17710
+ const directory = await mkdtemp2(path8.join(os4.tmpdir(), "codexhost-agy-question-"));
17390
17711
  const bridge = new _AntigravityQuestionBridge(directory, options);
17391
17712
  try {
17392
17713
  await new Promise((resolve, reject) => {
@@ -17401,14 +17722,14 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
17401
17722
  if (!address || typeof address === "string")
17402
17723
  throw new Error("Question bridge did not bind");
17403
17724
  bridge.environment.CODEXHOST_AGY_QUESTION_URL = `http://127.0.0.1:${address.port}/question`;
17404
- const client = path7.join(directory, "question-hook.cjs");
17405
- await mkdir3(path7.join(directory, ".agents"));
17406
- await writeFile2(client, ANTIGRAVITY_QUESTION_HOOK_CLIENT, "utf8");
17725
+ const client = path8.join(directory, "question-hook.cjs");
17726
+ await mkdir3(path8.join(directory, ".agents"));
17727
+ await writeFile3(client, ANTIGRAVITY_QUESTION_HOOK_CLIENT, "utf8");
17407
17728
  const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
17408
17729
  bridge.environment.CODEXHOST_AGY_QUESTION_NODE = `"${process.execPath.replaceAll("\\", "/")}"`;
17409
17730
  bridge.environment.CODEXHOST_AGY_QUESTION_CLIENT = `"${client.replaceAll("\\", "/")}"`;
17410
17731
  const command = process.platform === "win32" ? "%CODEXHOST_AGY_QUESTION_NODE% %CODEXHOST_AGY_QUESTION_CLIENT%" : `${quote(process.execPath)} ${quote(client)}`;
17411
- await writeFile2(path7.join(directory, ".agents", "hooks.json"), JSON.stringify({
17732
+ await writeFile3(path8.join(directory, ".agents", "hooks.json"), JSON.stringify({
17412
17733
  "codexhost-question-bridge": {
17413
17734
  PreToolUse: [
17414
17735
  {
@@ -17631,7 +17952,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
17631
17952
  this.#server.close(() => resolve());
17632
17953
  this.#server.closeAllConnections();
17633
17954
  });
17634
- await rm2(this.directory, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
17955
+ await rm3(this.directory, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
17635
17956
  })();
17636
17957
  return this.#disposal;
17637
17958
  }
@@ -17643,7 +17964,7 @@ import { randomUUID as randomUUID5 } from "node:crypto";
17643
17964
  // dist/subagent-transcript.js
17644
17965
  import { open, realpath } from "node:fs/promises";
17645
17966
  import https2 from "node:https";
17646
- import path8 from "node:path";
17967
+ import path9 from "node:path";
17647
17968
  var nativeSubagentIdSchema = external_exports.uuid();
17648
17969
  var MAX_TRANSCRIPT_BYTES = 8 * 1024 * 1024;
17649
17970
  var transcriptStepSchema = external_exports.object({
@@ -17811,10 +18132,10 @@ async function readSubagentTranscript(input) {
17811
18132
  };
17812
18133
  }
17813
18134
  try {
17814
- const file2 = path8.join(nativeBrainDirPath(input.childId, input.home), ".system_generated", "logs", "transcript.jsonl");
17815
- const brainRoot = await realpath(path8.dirname(nativeBrainDirPath(input.childId, input.home)));
18135
+ const file2 = path9.join(nativeBrainDirPath(input.childId, input.home), ".system_generated", "logs", "transcript.jsonl");
18136
+ const brainRoot = await realpath(path9.dirname(nativeBrainDirPath(input.childId, input.home)));
17816
18137
  const resolved = await realpath(file2);
17817
- const expected = path8.join(brainRoot, input.childId, ".system_generated", "logs", "transcript.jsonl");
18138
+ const expected = path9.join(brainRoot, input.childId, ".system_generated", "logs", "transcript.jsonl");
17818
18139
  const normalize = (value) => process.platform === "win32" ? value.toLowerCase() : value;
17819
18140
  if (normalize(resolved) !== normalize(expected))
17820
18141
  throw new Error("Subagent log redirects outside its native location");
@@ -18159,8 +18480,8 @@ function mergePendingStep(pending, step) {
18159
18480
  };
18160
18481
  }
18161
18482
  function sameFile(left, right) {
18162
- const a = path9.resolve(left);
18163
- const b = path9.resolve(right);
18483
+ const a = path10.resolve(left);
18484
+ const b = path10.resolve(right);
18164
18485
  return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
18165
18486
  }
18166
18487
  function resolveAntigravityContextWindow(modelId, reportedWindow) {
@@ -18327,7 +18648,9 @@ function normalizedProcessError(detail, fallback, exposeDetail = false) {
18327
18648
  return {
18328
18649
  code: "nativeFailure",
18329
18650
  message: exposeDetail && nativeDetail ? `${fallback}: ${nativeDetail}` : fallback,
18330
- retryable: true,
18651
+ // These native rejections need a changed precondition or a quota reset;
18652
+ // immediately replaying a Turn (and its tools) cannot resolve them.
18653
+ retryable: !/User location is not supported for the API use|Individual quota reached/iu.test(nativeDetail),
18331
18654
  ...diagnostic ? { stderrTail: diagnostic.slice(-4e3) } : {}
18332
18655
  };
18333
18656
  }
@@ -18519,7 +18842,7 @@ var AntigravitySession = class {
18519
18842
  return { ok: false, error: invalidState("Antigravity Session is closed") };
18520
18843
  }
18521
18844
  const environment = { ...this.#environment, ...questions.environment };
18522
- const logPath = path9.join(os5.tmpdir(), `codexhost-antigravity-${randomUUID6()}.log`);
18845
+ const logPath = path10.join(os5.tmpdir(), `codexhost-antigravity-${randomUUID6()}.log`);
18523
18846
  const arguments_ = [
18524
18847
  "--input-format",
18525
18848
  "stream-json",
@@ -18738,6 +19061,18 @@ ${line}`).slice(-8e3);
18738
19061
  async #handleResult(active, event) {
18739
19062
  if (this.#active !== active)
18740
19063
  return;
19064
+ const resultConversationId = event.result.conversation_id.trim();
19065
+ if (resultConversationId && this.#nativeRef && resultConversationId !== this.#nativeRef.nativeSessionId) {
19066
+ this.#completeTurn(active, {
19067
+ status: "failed",
19068
+ error: {
19069
+ code: "protocolError",
19070
+ message: "Antigravity returned a result for a different Conversation",
19071
+ retryable: false
19072
+ }
19073
+ });
19074
+ return;
19075
+ }
18741
19076
  const usage = hostUsage(event.result.usage, active.model?.id);
18742
19077
  if (usage)
18743
19078
  this.#publishUsage(active, usage);
@@ -18750,7 +19085,7 @@ ${line}`).slice(-8e3);
18750
19085
  await active.subagents.refresh();
18751
19086
  if (this.#active !== active)
18752
19087
  return;
18753
- const convId = event.result.conversation_id && event.result.conversation_id.trim().length > 0 ? event.result.conversation_id.trim() : this.#nativeRef?.nativeSessionId ?? "";
19088
+ const convId = resultConversationId || this.#nativeRef?.nativeSessionId || "";
18754
19089
  if (!this.#nativeRef && convId) {
18755
19090
  this.#nativeRef = nativeSessionRefSchema.parse({
18756
19091
  harnessId: this.harnessId,
@@ -19198,7 +19533,7 @@ var AntigravityAdapter = class {
19198
19533
  if (this.#closed) {
19199
19534
  return { status: "unavailable", error: invalidState("Antigravity Adapter is closed") };
19200
19535
  }
19201
- const cwd = path9.resolve(input.cwd ?? process.cwd());
19536
+ const cwd = path10.resolve(input.cwd ?? process.cwd());
19202
19537
  const inFlight = this.#inspectionInFlight.get(cwd);
19203
19538
  if (inFlight)
19204
19539
  return inFlight;
@@ -19340,7 +19675,7 @@ var AntigravityAdapter = class {
19340
19675
  }
19341
19676
  };
19342
19677
  }
19343
- const cwd = path9.resolve(input.cwd);
19678
+ const cwd = path10.resolve(input.cwd);
19344
19679
  let catalog = this.#inspectionCache.get(cwd)?.catalog;
19345
19680
  if (!catalog) {
19346
19681
  const inspection = await this.inspect({ cwd: input.cwd });
@@ -19486,13 +19821,59 @@ var AntigravityAdapter = class {
19486
19821
  }
19487
19822
  };
19488
19823
 
19824
+ // dist/installation.js
19825
+ var ANTIGRAVITY_UPDATE_MANIFEST_ROOT = "https://antigravity-cli-auto-updater-974169037036.us-central1.run.app";
19826
+ function antigravityUpdateManifestUrl(platform = process.platform, arch = process.arch) {
19827
+ const system = platform === "darwin" ? "darwin" : platform === "linux" ? "linux" : platform === "win32" ? "windows" : void 0;
19828
+ const cpu = arch === "arm64" ? "arm64" : arch === "x64" ? "amd64" : void 0;
19829
+ if (!system || !cpu)
19830
+ throw new Error("Antigravity updates are unavailable for this platform");
19831
+ return `${ANTIGRAVITY_UPDATE_MANIFEST_ROOT}/manifests/${system}_${cpu}.json`;
19832
+ }
19833
+ function createAntigravityInstallation(environment, command, dependencies = {}) {
19834
+ const run = dependencies.run ?? ((args, timeout) => runInstallationCommand(resolveAntigravityExecutable({ environment, ...command ? { command } : {} }) ?? "agy", args, environment, timeout));
19835
+ const fetchText = dependencies.fetchText ?? fetchInstallationText;
19836
+ const platform = dependencies.platform ?? process.platform;
19837
+ const arch = dependencies.arch ?? process.arch;
19838
+ return createInstallationManager({
19839
+ async check() {
19840
+ const manifestUrl = antigravityUpdateManifestUrl(platform, arch);
19841
+ const currentVersion = versionFromOutput(await run(["--version"]));
19842
+ let payload;
19843
+ try {
19844
+ payload = JSON.parse(await fetchText(manifestUrl));
19845
+ } catch (error51) {
19846
+ if (error51 instanceof SyntaxError)
19847
+ throw new Error("Could not check the latest Antigravity version");
19848
+ throw error51;
19849
+ }
19850
+ const latestVersion = installationVersion(payload.version);
19851
+ return {
19852
+ currentVersion,
19853
+ latestVersion,
19854
+ updateAvailable: newerInstallationVersion(currentVersion, latestVersion),
19855
+ canUpdate: true
19856
+ };
19857
+ },
19858
+ async update() {
19859
+ await run(["update"], 3e5);
19860
+ }
19861
+ });
19862
+ }
19863
+
19489
19864
  // dist/plugin.js
19490
19865
  var ANTIGRAVITY_COMMAND_ENV = "CODEXHOST_ANTIGRAVITY_COMMAND";
19491
19866
  function createHarnessAdapter(context) {
19492
19867
  const environment = { ...context.environment };
19493
- return new AntigravityAdapter({
19868
+ return Object.assign(new AntigravityAdapter({
19494
19869
  ...environment[ANTIGRAVITY_COMMAND_ENV] ? { command: environment[ANTIGRAVITY_COMMAND_ENV] } : {},
19495
19870
  environment
19871
+ }), {
19872
+ install: createHarnessInstaller(environment, {
19873
+ posix: "https://antigravity.google/cli/install.sh",
19874
+ windows: "https://antigravity.google/cli/install.ps1"
19875
+ }),
19876
+ installation: createAntigravityInstallation(environment, environment[ANTIGRAVITY_COMMAND_ENV])
19496
19877
  });
19497
19878
  }
19498
19879
  async function warmup(adapter) {