@codexhost/cli-darwin-x64 0.10.2 → 0.11.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.
@@ -11,7 +11,7 @@ import { randomUUID as randomUUID6 } from "node:crypto";
11
11
  import { readFile as readFile2, unlink } from "node:fs/promises";
12
12
  import https3 from "node:https";
13
13
  import os5 from "node:os";
14
- import path9 from "node:path";
14
+ import path10 from "node:path";
15
15
  import readline from "node:readline";
16
16
 
17
17
  // ../../../node_modules/zod/v4/classic/external.js
@@ -780,10 +780,10 @@ function mergeDefs(...defs) {
780
780
  function cloneDef(schema) {
781
781
  return mergeDefs(schema._zod.def);
782
782
  }
783
- function getElementAtPath(obj, path10) {
784
- if (!path10)
783
+ function getElementAtPath(obj, path11) {
784
+ if (!path11)
785
785
  return obj;
786
- return path10.reduce((acc, key) => acc?.[key], obj);
786
+ return path11.reduce((acc, key) => acc?.[key], obj);
787
787
  }
788
788
  function promiseAllObject(promisesObj) {
789
789
  const keys = Object.keys(promisesObj);
@@ -1192,11 +1192,11 @@ function explicitlyAborted(x, startIndex = 0) {
1192
1192
  }
1193
1193
  return false;
1194
1194
  }
1195
- function prefixIssues(path10, issues) {
1195
+ function prefixIssues(path11, issues) {
1196
1196
  return issues.map((iss) => {
1197
1197
  var _a3;
1198
1198
  (_a3 = iss).path ?? (_a3.path = []);
1199
- iss.path.unshift(path10);
1199
+ iss.path.unshift(path11);
1200
1200
  return iss;
1201
1201
  });
1202
1202
  }
@@ -1343,16 +1343,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1343
1343
  }
1344
1344
  function formatError(error51, mapper = (issue2) => issue2.message) {
1345
1345
  const fieldErrors = { _errors: [] };
1346
- const processError = (error52, path10 = []) => {
1346
+ const processError = (error52, path11 = []) => {
1347
1347
  for (const issue2 of error52.issues) {
1348
1348
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1349
- issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
1349
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1350
1350
  } else if (issue2.code === "invalid_key") {
1351
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1351
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1352
1352
  } else if (issue2.code === "invalid_element") {
1353
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1353
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1354
1354
  } else {
1355
- const fullpath = [...path10, ...issue2.path];
1355
+ const fullpath = [...path11, ...issue2.path];
1356
1356
  if (fullpath.length === 0) {
1357
1357
  fieldErrors._errors.push(mapper(issue2));
1358
1358
  } else {
@@ -1379,17 +1379,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1379
1379
  }
1380
1380
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1381
1381
  const result = { errors: [] };
1382
- const processError = (error52, path10 = []) => {
1382
+ const processError = (error52, path11 = []) => {
1383
1383
  var _a3, _b;
1384
1384
  for (const issue2 of error52.issues) {
1385
1385
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1386
- issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
1386
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1387
1387
  } else if (issue2.code === "invalid_key") {
1388
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1388
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1389
1389
  } else if (issue2.code === "invalid_element") {
1390
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1390
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1391
1391
  } else {
1392
- const fullpath = [...path10, ...issue2.path];
1392
+ const fullpath = [...path11, ...issue2.path];
1393
1393
  if (fullpath.length === 0) {
1394
1394
  result.errors.push(mapper(issue2));
1395
1395
  continue;
@@ -1421,8 +1421,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1421
1421
  }
1422
1422
  function toDotPath(_path) {
1423
1423
  const segs = [];
1424
- const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1425
- for (const seg of path10) {
1424
+ const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1425
+ for (const seg of path11) {
1426
1426
  if (typeof seg === "number")
1427
1427
  segs.push(`[${seg}]`);
1428
1428
  else if (typeof seg === "symbol")
@@ -14114,13 +14114,13 @@ function resolveRef(ref, ctx) {
14114
14114
  if (!ref.startsWith("#")) {
14115
14115
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14116
14116
  }
14117
- const path10 = ref.slice(1).split("/").filter(Boolean);
14118
- if (path10.length === 0) {
14117
+ const path11 = ref.slice(1).split("/").filter(Boolean);
14118
+ if (path11.length === 0) {
14119
14119
  return ctx.rootSchema;
14120
14120
  }
14121
14121
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14122
- if (path10[0] === defsKey) {
14123
- const key = path10[1];
14122
+ if (path11[0] === defsKey) {
14123
+ const key = path11[1];
14124
14124
  if (!key || !ctx.defs[key]) {
14125
14125
  throw new Error(`Reference not found: ${ref}`);
14126
14126
  }
@@ -14583,6 +14583,55 @@ var credentialImportsParamsSchema = external_exports.object({
14583
14583
  request: credentialImportsRequestSchema
14584
14584
  }).strict();
14585
14585
 
14586
+ // ../../shared-contracts/dist/harness-display-settings.js
14587
+ var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
14588
+ agent: external_exports.string().min(1).max(128),
14589
+ section: external_exports.enum(["main", "more", "auto"])
14590
+ })).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
14591
+ var harnessDisplaySettingsSchema = external_exports.strictObject({
14592
+ entries: harnessDisplayEntriesSchema.nullable()
14593
+ });
14594
+ var harnessDisplayGetSchema = external_exports.strictObject({});
14595
+ var harnessDisplaySetSchema = external_exports.strictObject({
14596
+ entries: harnessDisplayEntriesSchema,
14597
+ /** Import legacy Desktop preferences only if no shared settings exist yet. */
14598
+ initializeOnly: external_exports.boolean().optional()
14599
+ });
14600
+
14601
+ // ../../shared-contracts/dist/console.js
14602
+ var consoleAnnouncementSchema = external_exports.strictObject({
14603
+ title: external_exports.string().trim().min(1).max(200),
14604
+ type: external_exports.enum(["info", "warning", "danger"]),
14605
+ body: external_exports.string().trim().min(1).max(16 * 1024)
14606
+ });
14607
+ var consoleOpenParamsSchema = external_exports.strictObject({});
14608
+ var consoleOpenResultSchema = external_exports.strictObject({
14609
+ /** The console address. */
14610
+ url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
14611
+ });
14612
+ var CONSOLE_HOST_METHODS = Object.freeze([
14613
+ "codexhost/harness/plugins/list",
14614
+ "codexhost/harness/display-settings/get",
14615
+ "codexhost/harness/display-settings/set",
14616
+ "codexhost/harness/inspect",
14617
+ "codexhost/harness/launch-settings/get",
14618
+ "codexhost/harness/launch-settings/set",
14619
+ "codexhost/harness/web-ui/open",
14620
+ "codexhost/harness/accounts/sources",
14621
+ "codexhost/harness/accounts/list",
14622
+ "codexhost/harness/accounts/inspect",
14623
+ "codexhost/harness/credential-imports",
14624
+ "codexhost/harness/session-import/sources",
14625
+ "codexhost/harness/session-import/list",
14626
+ "codexhost/harness/session-import/import",
14627
+ "codexhost/account/list",
14628
+ "codexhost/account/refresh",
14629
+ "codexhost/account/usage/inspect",
14630
+ "codexhost/update/check",
14631
+ "codexhost/update/start",
14632
+ "codexhost/update/status"
14633
+ ]);
14634
+
14586
14635
  // ../../shared-contracts/dist/version.js
14587
14636
  var WORKSPACE_CONTRACT_VERSION = 1;
14588
14637
 
@@ -14636,6 +14685,12 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
14636
14685
  var hostItemIdSchema = opaqueIdSchema.brand();
14637
14686
  var hostInteractionIdSchema = opaqueIdSchema.brand();
14638
14687
 
14688
+ // ../../shared-contracts/dist/manual-compaction.js
14689
+ var threadManualCompactionStartedSchema = external_exports.strictObject({
14690
+ threadId: hostThreadIdSchema,
14691
+ turnId: hostTurnIdSchema
14692
+ });
14693
+
14639
14694
  // ../../shared-contracts/dist/thread-usage.js
14640
14695
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14641
14696
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -14696,6 +14751,10 @@ var threadUsageSnapshotSchema = external_exports.object({
14696
14751
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
14697
14752
  var accountCreditsProductUsageSchema = external_exports.object({
14698
14753
  product: external_exports.string().min(1),
14754
+ used: external_exports.number().finite().nonnegative().optional(),
14755
+ // Zero is a real empty cap, not an absent field.
14756
+ limit: external_exports.number().finite().nonnegative().optional(),
14757
+ unit: external_exports.string().min(1).max(32).optional(),
14699
14758
  usagePercent: usagePercentSchema,
14700
14759
  resetsAt: external_exports.string().min(1).optional()
14701
14760
  }).strict();
@@ -14705,6 +14764,10 @@ var accountResetCreditsSchema = external_exports.object({
14705
14764
  expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
14706
14765
  }).strict();
14707
14766
  var accountCreditsSnapshotSchema = external_exports.object({
14767
+ used: external_exports.number().finite().nonnegative().optional(),
14768
+ // Zero is a real empty cap, not an absent field.
14769
+ limit: external_exports.number().finite().nonnegative().optional(),
14770
+ unit: external_exports.string().min(1).max(32).optional(),
14708
14771
  /** Native label when the primary limit is scoped to a model or product group. */
14709
14772
  label: external_exports.string().min(1).optional(),
14710
14773
  usedPercent: usagePercentSchema,
@@ -14724,12 +14787,27 @@ var threadUsageInspectionSchema = external_exports.object({
14724
14787
  }).strict();
14725
14788
 
14726
14789
  // ../../shared-contracts/dist/harness-accounts.js
14727
- var harnessAccountSnapshotSchema = external_exports.object({
14790
+ var accountBalanceSnapshotSchema = external_exports.object({
14791
+ amount: external_exports.number().finite().nonnegative(),
14792
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
14793
+ currency: external_exports.string().trim().min(1).max(8),
14794
+ /** Native label when the Harness exposes several Billing Sources. */
14795
+ label: external_exports.string().trim().min(1).max(128).optional()
14796
+ }).strict();
14797
+ var harnessAccountSnapshotObject = external_exports.object({
14728
14798
  email: external_exports.string().trim().min(1).max(320).optional(),
14729
14799
  label: external_exports.string().trim().min(1).max(256).optional(),
14730
14800
  plan: external_exports.string().trim().min(1).max(128).optional(),
14731
- credits: accountCreditsSnapshotSchema
14801
+ credits: accountCreditsSnapshotSchema.optional(),
14802
+ balance: accountBalanceSnapshotSchema.optional()
14732
14803
  }).strict();
14804
+ function requireReportedQuota(schema) {
14805
+ return schema.refine((value) => {
14806
+ const reported = value;
14807
+ return reported.credits !== void 0 || reported.balance !== void 0;
14808
+ }, { message: "Account must report either credits or a balance" });
14809
+ }
14810
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
14733
14811
  var harnessAccountIdentityShape = {
14734
14812
  harnessId: harnessIdSchema,
14735
14813
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -14740,11 +14818,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
14740
14818
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
14741
14819
  var harnessAccountInspectResultSchema = external_exports.object({
14742
14820
  ...harnessAccountIdentityShape,
14743
- account: harnessAccountSnapshotSchema.nullable()
14821
+ account: harnessAccountSnapshotSchema.nullable(),
14822
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
14823
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
14744
14824
  }).strict();
14745
14825
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
14746
14826
  var harnessAccountListResultSchema = external_exports.object({
14747
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
14827
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
14748
14828
  }).strict();
14749
14829
 
14750
14830
  // ../../shared-contracts/dist/json-value.js
@@ -14882,6 +14962,8 @@ var harnessModelSchema = external_exports.object({
14882
14962
  ref: harnessModelRefSchema,
14883
14963
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
14884
14964
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
14965
+ /** Optional opaque selection for this same Model with priority processing enabled. */
14966
+ fastModel: harnessModelRefSchema.optional(),
14885
14967
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14886
14968
  }).strict();
14887
14969
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -14914,6 +14996,16 @@ var harnessModelCatalogSchema = external_exports.object({
14914
14996
  });
14915
14997
  }
14916
14998
  refs.add(model.ref.id);
14999
+ if (model.fastModel) {
15000
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15001
+ context.addIssue({
15002
+ code: "custom",
15003
+ message: "Fast Model refs must be distinct and unique",
15004
+ path: ["models", index, "fastModel"]
15005
+ });
15006
+ }
15007
+ refs.add(model.fastModel.id);
15008
+ }
14917
15009
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14918
15010
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
14919
15011
  if (supportedThinkingIds.has(optionId)) {
@@ -15033,11 +15125,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15033
15125
  thinkingOptionId: harnessThinkingOptionIdSchema
15034
15126
  }).strict();
15035
15127
  var threadInspectionParamsSchema = external_exports.object({
15036
- threadId: hostThreadIdSchema
15128
+ threadId: hostThreadIdSchema,
15129
+ includeReferenceCapability: external_exports.boolean().optional()
15037
15130
  }).strict();
15038
15131
  var codexThreadInspectionSchema = external_exports.object({
15039
15132
  owner: external_exports.literal("codex"),
15040
- locked: external_exports.literal(true)
15133
+ locked: external_exports.literal(true),
15134
+ supportsThreadReferences: external_exports.literal(true).optional()
15041
15135
  }).strict();
15042
15136
  var externalThreadInspectionSchema = external_exports.object({
15043
15137
  owner: external_exports.literal("external"),
@@ -15163,6 +15257,19 @@ var harnessLaunchSettingsSchema = external_exports.object({
15163
15257
  restartRequired: external_exports.boolean()
15164
15258
  }).strict();
15165
15259
 
15260
+ // ../../shared-contracts/dist/harness-installation.js
15261
+ var harnessInstallationParamsSchema = external_exports.object({
15262
+ harnessId: harnessIdSchema,
15263
+ action: external_exports.enum(["check", "update"])
15264
+ }).strict();
15265
+ var harnessInstallationStateSchema = external_exports.object({
15266
+ currentVersion: external_exports.string().min(1).max(128),
15267
+ latestVersion: external_exports.string().min(1).max(128),
15268
+ updateAvailable: external_exports.boolean(),
15269
+ canUpdate: external_exports.boolean(),
15270
+ message: external_exports.string().max(2048).optional()
15271
+ }).strict();
15272
+
15166
15273
  // ../../shared-contracts/dist/codex-accounts.js
15167
15274
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15168
15275
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
@@ -15651,6 +15758,20 @@ function commandInvocation(command, arguments_, environment, platform = process.
15651
15758
  };
15652
15759
  }
15653
15760
 
15761
+ // ../../harness-discovery/dist/node-runtime.js
15762
+ import path3 from "node:path";
15763
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
15764
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
15765
+ const delimiter = platform === "win32" ? ";" : ":";
15766
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
15767
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
15768
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
15769
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
15770
+ directories.push(runtimeDirectory);
15771
+ }
15772
+ return { ...environment, [pathKey]: directories.join(delimiter) };
15773
+ }
15774
+
15654
15775
  // ../../harness-discovery/dist/resolve.js
15655
15776
  import os from "node:os";
15656
15777
 
@@ -15814,8 +15935,118 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
15814
15935
  return void 0;
15815
15936
  }
15816
15937
 
15938
+ // ../../harness-discovery/dist/installation.js
15939
+ import { execFile } from "node:child_process";
15940
+ import { homedir } from "node:os";
15941
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
15942
+ const env = withNodeRuntimeOnPath(environment);
15943
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
15944
+ return new Promise((resolve, reject) => {
15945
+ const child = execFile(invocation.command, invocation.arguments, {
15946
+ env,
15947
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
15948
+ encoding: "utf8",
15949
+ timeout,
15950
+ killSignal: "SIGKILL",
15951
+ maxBuffer: 1024 * 1024,
15952
+ windowsHide: true,
15953
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
15954
+ }, (error51, stdout, stderr) => {
15955
+ if (error51)
15956
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
15957
+ else
15958
+ resolve((stdout || stderr).trim());
15959
+ });
15960
+ child.stdin?.end();
15961
+ });
15962
+ }
15963
+ function installationVersion(value) {
15964
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
15965
+ throw new Error("Harness returned an invalid version");
15966
+ return value.trim().replace(/^v/, "");
15967
+ }
15968
+ function versionFromOutput(output) {
15969
+ return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
15970
+ }
15971
+ function newerInstallationVersion(current, latest) {
15972
+ const a = installationVersion(current).replace(/\+.*/, "");
15973
+ const b = installationVersion(latest).replace(/\+.*/, "");
15974
+ const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
15975
+ const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
15976
+ for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
15977
+ if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
15978
+ return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
15979
+ }
15980
+ const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
15981
+ const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
15982
+ if (!preA.length || !preB.length)
15983
+ return !!preA.length && !preB.length;
15984
+ for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
15985
+ const x = preA[i];
15986
+ const y = preB[i];
15987
+ if (x === y)
15988
+ continue;
15989
+ if (x === void 0 || y === void 0)
15990
+ return x === void 0;
15991
+ const numericX = /^\d+$/.test(x);
15992
+ const numericY = /^\d+$/.test(y);
15993
+ if (numericX && numericY) {
15994
+ if (BigInt(x) === BigInt(y))
15995
+ continue;
15996
+ return BigInt(y) > BigInt(x);
15997
+ }
15998
+ if (numericX !== numericY)
15999
+ return numericX;
16000
+ return y > x;
16001
+ }
16002
+ return false;
16003
+ }
16004
+ function createInstallationManager(options) {
16005
+ let checking;
16006
+ let updating;
16007
+ const check2 = () => checking ??= options.check().finally(() => {
16008
+ checking = void 0;
16009
+ });
16010
+ return (action) => {
16011
+ if (updating)
16012
+ return updating;
16013
+ if (action === "check")
16014
+ return check2();
16015
+ updating = (async () => {
16016
+ const before = await check2();
16017
+ if (!before.updateAvailable)
16018
+ return before;
16019
+ if (!before.canUpdate)
16020
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
16021
+ await options.update(before);
16022
+ const after = await check2();
16023
+ if (after.currentVersion === before.currentVersion)
16024
+ throw new Error("The Harness version did not change; check the native updater and retry");
16025
+ return after;
16026
+ })().finally(() => {
16027
+ updating = void 0;
16028
+ });
16029
+ return updating;
16030
+ };
16031
+ }
16032
+ async function fetchInstallationText(url2) {
16033
+ const request = async () => {
16034
+ const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
16035
+ if (!response.ok)
16036
+ throw new Error("Could not check the latest Harness version");
16037
+ return response.text();
16038
+ };
16039
+ try {
16040
+ return await request();
16041
+ } catch (error51) {
16042
+ if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
16043
+ throw error51;
16044
+ return request();
16045
+ }
16046
+ }
16047
+
15817
16048
  // dist/command.js
15818
- import path3 from "node:path";
16049
+ import path4 from "node:path";
15819
16050
  var antigravityDiscoverySpec = {
15820
16051
  id: "antigravity",
15821
16052
  command: "agy",
@@ -15835,20 +16066,20 @@ function resolveAntigravityExecutable(input = {}) {
15835
16066
  });
15836
16067
  if (!resolution)
15837
16068
  return void 0;
15838
- return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path3.resolve(resolution.executable);
16069
+ return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
15839
16070
  }
15840
16071
 
15841
16072
  // dist/fork.js
15842
16073
  import { randomUUID as randomUUID2 } from "node:crypto";
15843
16074
  import { copyFile, cp, mkdir as mkdir2 } from "node:fs/promises";
15844
16075
  import os3 from "node:os";
15845
- import path5 from "node:path";
16076
+ import path6 from "node:path";
15846
16077
 
15847
16078
  // dist/history.js
15848
16079
  import { randomUUID } from "node:crypto";
15849
16080
  import { mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
15850
16081
  import os2 from "node:os";
15851
- import path4 from "node:path";
16082
+ import path5 from "node:path";
15852
16083
  var HISTORY_VERSION = 1;
15853
16084
  var THREAD_ID_ENV = "CODEXHOST_THREAD_ID";
15854
16085
  var harnessErrorSchema = external_exports.strictObject({
@@ -15945,7 +16176,7 @@ var historySchema = external_exports.strictObject({
15945
16176
  });
15946
16177
  function historyRoot(environment) {
15947
16178
  const dataDirectory = environment.CODEXHOST_DATA_DIR;
15948
- return path4.join(dataDirectory ? path4.resolve(dataDirectory) : path4.join(os2.homedir(), ".codexhost"), "antigravity-history");
16179
+ return path5.join(dataDirectory ? path5.resolve(dataDirectory) : path5.join(os2.homedir(), ".codexhost"), "antigravity-history");
15949
16180
  }
15950
16181
  function safeThreadId(environment) {
15951
16182
  const threadId = (environment[THREAD_ID_ENV] ?? environment.CODEXHOST_DELEGATION_THREAD_ID)?.trim();
@@ -15953,7 +16184,7 @@ function safeThreadId(environment) {
15953
16184
  }
15954
16185
  function historyPath(environment) {
15955
16186
  const threadId = safeThreadId(environment);
15956
- return threadId ? path4.join(historyRoot(environment), `${threadId}.json`) : null;
16187
+ return threadId ? path5.join(historyRoot(environment), `${threadId}.json`) : null;
15957
16188
  }
15958
16189
  function jsonTurn(turn) {
15959
16190
  return JSON.parse(JSON.stringify(turn));
@@ -16032,7 +16263,7 @@ var AntigravityHistory = class _AntigravityHistory {
16032
16263
  for (const entry of entries) {
16033
16264
  if (!entry.endsWith(".json"))
16034
16265
  continue;
16035
- const file2 = path4.join(root, entry);
16266
+ const file2 = path5.join(root, entry);
16036
16267
  try {
16037
16268
  const parsed = historySchema.safeParse(JSON.parse(await readFile(file2, "utf8")));
16038
16269
  if (parsed.success && parsed.data.nativeSessionId === nativeSessionId) {
@@ -16119,9 +16350,9 @@ var AntigravityHistory = class _AntigravityHistory {
16119
16350
  const model = this.#model;
16120
16351
  const thinkingOptionId = this.#thinkingOptionId;
16121
16352
  this.#write = this.#write.catch(() => void 0).then(async () => {
16122
- const directory = path4.dirname(file2);
16353
+ const directory = path5.dirname(file2);
16123
16354
  await mkdir(directory, { recursive: true, mode: 448 });
16124
- const temporary = path4.join(directory, `.${path4.basename(file2)}.${randomUUID()}.tmp`);
16355
+ const temporary = path5.join(directory, `.${path5.basename(file2)}.${randomUUID()}.tmp`);
16125
16356
  try {
16126
16357
  await writeFile(temporary, `${JSON.stringify({
16127
16358
  formatVersion: HISTORY_VERSION,
@@ -16140,24 +16371,24 @@ var AntigravityHistory = class _AntigravityHistory {
16140
16371
  };
16141
16372
 
16142
16373
  // dist/fork.js
16143
- function nativeConversationDbPath(nativeSessionId, homedir = os3.homedir()) {
16144
- return path5.join(homedir, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
16374
+ function nativeConversationDbPath(nativeSessionId, homedir2 = os3.homedir()) {
16375
+ return path6.join(homedir2, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
16145
16376
  }
16146
- function nativeBrainDirPath(nativeSessionId, homedir = os3.homedir()) {
16147
- return path5.join(homedir, ".gemini", "antigravity-cli", "brain", nativeSessionId);
16377
+ function nativeBrainDirPath(nativeSessionId, homedir2 = os3.homedir()) {
16378
+ return path6.join(homedir2, ".gemini", "antigravity-cli", "brain", nativeSessionId);
16148
16379
  }
16149
16380
  async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, retainedTurnsCountOrHomedir, homedirOption = os3.homedir()) {
16150
16381
  let retainedTurnsCount;
16151
- let homedir = homedirOption;
16382
+ let homedir2 = homedirOption;
16152
16383
  if (typeof retainedTurnsCountOrHomedir === "string") {
16153
- homedir = retainedTurnsCountOrHomedir;
16384
+ homedir2 = retainedTurnsCountOrHomedir;
16154
16385
  } else if (typeof retainedTurnsCountOrHomedir === "number") {
16155
16386
  retainedTurnsCount = retainedTurnsCountOrHomedir;
16156
16387
  }
16157
- const sourceDb = nativeConversationDbPath(sourceSessionId, homedir);
16158
- const targetDb = nativeConversationDbPath(derivedSessionId, homedir);
16388
+ const sourceDb = nativeConversationDbPath(sourceSessionId, homedir2);
16389
+ const targetDb = nativeConversationDbPath(derivedSessionId, homedir2);
16159
16390
  try {
16160
- await mkdir2(path5.dirname(targetDb), { recursive: true });
16391
+ await mkdir2(path6.dirname(targetDb), { recursive: true });
16161
16392
  await copyFile(sourceDb, targetDb);
16162
16393
  } catch {
16163
16394
  return false;
@@ -16208,7 +16439,7 @@ async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, reta
16208
16439
  } catch {
16209
16440
  }
16210
16441
  try {
16211
- const summariesDbPath = path5.join(homedir, ".gemini", "antigravity-cli", "conversation_summaries.db");
16442
+ const summariesDbPath = path6.join(homedir2, ".gemini", "antigravity-cli", "conversation_summaries.db");
16212
16443
  const sumDb = new DatabaseSync(summariesDbPath);
16213
16444
  try {
16214
16445
  const cur = sumDb.prepare("SELECT * FROM conversation_summaries WHERE conversation_id = ?");
@@ -16245,13 +16476,13 @@ async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, reta
16245
16476
  return true;
16246
16477
  }
16247
16478
  var copyNativeConversationDbIfExists = cloneNativeConversationDb;
16248
- async function copyNativeBrainDirIfExists(sourceSessionId, derivedSessionId, homedir = os3.homedir()) {
16249
- const sourceBrain = nativeBrainDirPath(sourceSessionId, homedir);
16250
- const targetBrain = nativeBrainDirPath(derivedSessionId, homedir);
16479
+ async function copyNativeBrainDirIfExists(sourceSessionId, derivedSessionId, homedir2 = os3.homedir()) {
16480
+ const sourceBrain = nativeBrainDirPath(sourceSessionId, homedir2);
16481
+ const targetBrain = nativeBrainDirPath(derivedSessionId, homedir2);
16251
16482
  try {
16252
16483
  await cp(sourceBrain, targetBrain, {
16253
16484
  recursive: true,
16254
- filter: (source) => path5.basename(source) !== ".system_generated"
16485
+ filter: (source) => path6.basename(source) !== ".system_generated"
16255
16486
  });
16256
16487
  return true;
16257
16488
  } catch {
@@ -16702,7 +16933,7 @@ function parseAndFormatAntigravityCommand(command) {
16702
16933
  import https from "node:https";
16703
16934
 
16704
16935
  // dist/tool-projection.js
16705
- import path6 from "node:path";
16936
+ import path7 from "node:path";
16706
16937
  function isRecord(value) {
16707
16938
  return typeof value === "object" && value !== null && !Array.isArray(value);
16708
16939
  }
@@ -16723,10 +16954,10 @@ function displayPath(nativePath, cwd) {
16723
16954
  if (typeof nativePath !== "string" || nativePath.trim().length === 0 || nativePath.includes("\0") || nativePath.includes("\n") || nativePath.includes("\r")) {
16724
16955
  return null;
16725
16956
  }
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}`);
16957
+ const resolvedCwd = path7.resolve(cwd);
16958
+ const resolvedPath = path7.isAbsolute(nativePath) ? path7.resolve(nativePath) : path7.resolve(cwd, nativePath);
16959
+ const relative = path7.relative(resolvedCwd, resolvedPath);
16960
+ const inside = !path7.isAbsolute(relative) && relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path7.sep}`);
16730
16961
  const selected = inside ? relative : resolvedPath;
16731
16962
  const normalized = selected.replaceAll("\\", "/");
16732
16963
  if (normalized.length === 0 || normalized === ".")
@@ -16857,7 +17088,7 @@ function synthesizeAntigravityCommand(toolName, params, cwd) {
16857
17088
  ]);
16858
17089
  let resolvedCwd;
16859
17090
  if (workingDir && workingDir.trim().length > 0) {
16860
- resolvedCwd = cwd && !path6.isAbsolute(workingDir) ? path6.resolve(cwd, workingDir) : workingDir;
17091
+ resolvedCwd = cwd && !path7.isAbsolute(workingDir) ? path7.resolve(cwd, workingDir) : workingDir;
16861
17092
  } else if (cwd) {
16862
17093
  resolvedCwd = cwd;
16863
17094
  }
@@ -17261,7 +17492,7 @@ import { randomBytes, randomUUID as randomUUID4, timingSafeEqual } from "node:cr
17261
17492
  import { mkdir as mkdir3, mkdtemp, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
17262
17493
  import { createServer } from "node:http";
17263
17494
  import os4 from "node:os";
17264
- import path7 from "node:path";
17495
+ import path8 from "node:path";
17265
17496
 
17266
17497
  // dist/question-hook-client.js
17267
17498
  var ANTIGRAVITY_QUESTION_HOOK_CLIENT = String.raw`
@@ -17386,7 +17617,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
17386
17617
  this.#server.on("request", (request, response) => this.#receive(request, response));
17387
17618
  }
17388
17619
  static async create(options) {
17389
- const directory = await mkdtemp(path7.join(os4.tmpdir(), "codexhost-agy-question-"));
17620
+ const directory = await mkdtemp(path8.join(os4.tmpdir(), "codexhost-agy-question-"));
17390
17621
  const bridge = new _AntigravityQuestionBridge(directory, options);
17391
17622
  try {
17392
17623
  await new Promise((resolve, reject) => {
@@ -17401,14 +17632,14 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
17401
17632
  if (!address || typeof address === "string")
17402
17633
  throw new Error("Question bridge did not bind");
17403
17634
  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"));
17635
+ const client = path8.join(directory, "question-hook.cjs");
17636
+ await mkdir3(path8.join(directory, ".agents"));
17406
17637
  await writeFile2(client, ANTIGRAVITY_QUESTION_HOOK_CLIENT, "utf8");
17407
17638
  const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
17408
17639
  bridge.environment.CODEXHOST_AGY_QUESTION_NODE = `"${process.execPath.replaceAll("\\", "/")}"`;
17409
17640
  bridge.environment.CODEXHOST_AGY_QUESTION_CLIENT = `"${client.replaceAll("\\", "/")}"`;
17410
17641
  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({
17642
+ await writeFile2(path8.join(directory, ".agents", "hooks.json"), JSON.stringify({
17412
17643
  "codexhost-question-bridge": {
17413
17644
  PreToolUse: [
17414
17645
  {
@@ -17643,7 +17874,7 @@ import { randomUUID as randomUUID5 } from "node:crypto";
17643
17874
  // dist/subagent-transcript.js
17644
17875
  import { open, realpath } from "node:fs/promises";
17645
17876
  import https2 from "node:https";
17646
- import path8 from "node:path";
17877
+ import path9 from "node:path";
17647
17878
  var nativeSubagentIdSchema = external_exports.uuid();
17648
17879
  var MAX_TRANSCRIPT_BYTES = 8 * 1024 * 1024;
17649
17880
  var transcriptStepSchema = external_exports.object({
@@ -17811,10 +18042,10 @@ async function readSubagentTranscript(input) {
17811
18042
  };
17812
18043
  }
17813
18044
  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)));
18045
+ const file2 = path9.join(nativeBrainDirPath(input.childId, input.home), ".system_generated", "logs", "transcript.jsonl");
18046
+ const brainRoot = await realpath(path9.dirname(nativeBrainDirPath(input.childId, input.home)));
17816
18047
  const resolved = await realpath(file2);
17817
- const expected = path8.join(brainRoot, input.childId, ".system_generated", "logs", "transcript.jsonl");
18048
+ const expected = path9.join(brainRoot, input.childId, ".system_generated", "logs", "transcript.jsonl");
17818
18049
  const normalize = (value) => process.platform === "win32" ? value.toLowerCase() : value;
17819
18050
  if (normalize(resolved) !== normalize(expected))
17820
18051
  throw new Error("Subagent log redirects outside its native location");
@@ -18159,8 +18390,8 @@ function mergePendingStep(pending, step) {
18159
18390
  };
18160
18391
  }
18161
18392
  function sameFile(left, right) {
18162
- const a = path9.resolve(left);
18163
- const b = path9.resolve(right);
18393
+ const a = path10.resolve(left);
18394
+ const b = path10.resolve(right);
18164
18395
  return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
18165
18396
  }
18166
18397
  function resolveAntigravityContextWindow(modelId, reportedWindow) {
@@ -18519,7 +18750,7 @@ var AntigravitySession = class {
18519
18750
  return { ok: false, error: invalidState("Antigravity Session is closed") };
18520
18751
  }
18521
18752
  const environment = { ...this.#environment, ...questions.environment };
18522
- const logPath = path9.join(os5.tmpdir(), `codexhost-antigravity-${randomUUID6()}.log`);
18753
+ const logPath = path10.join(os5.tmpdir(), `codexhost-antigravity-${randomUUID6()}.log`);
18523
18754
  const arguments_ = [
18524
18755
  "--input-format",
18525
18756
  "stream-json",
@@ -19198,7 +19429,7 @@ var AntigravityAdapter = class {
19198
19429
  if (this.#closed) {
19199
19430
  return { status: "unavailable", error: invalidState("Antigravity Adapter is closed") };
19200
19431
  }
19201
- const cwd = path9.resolve(input.cwd ?? process.cwd());
19432
+ const cwd = path10.resolve(input.cwd ?? process.cwd());
19202
19433
  const inFlight = this.#inspectionInFlight.get(cwd);
19203
19434
  if (inFlight)
19204
19435
  return inFlight;
@@ -19340,7 +19571,7 @@ var AntigravityAdapter = class {
19340
19571
  }
19341
19572
  };
19342
19573
  }
19343
- const cwd = path9.resolve(input.cwd);
19574
+ const cwd = path10.resolve(input.cwd);
19344
19575
  let catalog = this.#inspectionCache.get(cwd)?.catalog;
19345
19576
  if (!catalog) {
19346
19577
  const inspection = await this.inspect({ cwd: input.cwd });
@@ -19486,13 +19717,55 @@ var AntigravityAdapter = class {
19486
19717
  }
19487
19718
  };
19488
19719
 
19720
+ // dist/installation.js
19721
+ var ANTIGRAVITY_UPDATE_MANIFEST_ROOT = "https://antigravity-cli-auto-updater-974169037036.us-central1.run.app";
19722
+ function antigravityUpdateManifestUrl(platform = process.platform, arch = process.arch) {
19723
+ const system = platform === "darwin" ? "darwin" : platform === "linux" ? "linux" : platform === "win32" ? "windows" : void 0;
19724
+ const cpu = arch === "arm64" ? "arm64" : arch === "x64" ? "amd64" : void 0;
19725
+ if (!system || !cpu)
19726
+ throw new Error("Antigravity updates are unavailable for this platform");
19727
+ return `${ANTIGRAVITY_UPDATE_MANIFEST_ROOT}/manifests/${system}_${cpu}.json`;
19728
+ }
19729
+ function createAntigravityInstallation(environment, command, dependencies = {}) {
19730
+ const run = dependencies.run ?? ((args, timeout) => runInstallationCommand(resolveAntigravityExecutable({ environment, ...command ? { command } : {} }) ?? "agy", args, environment, timeout));
19731
+ const fetchText = dependencies.fetchText ?? fetchInstallationText;
19732
+ const platform = dependencies.platform ?? process.platform;
19733
+ const arch = dependencies.arch ?? process.arch;
19734
+ return createInstallationManager({
19735
+ async check() {
19736
+ const manifestUrl = antigravityUpdateManifestUrl(platform, arch);
19737
+ const currentVersion = versionFromOutput(await run(["--version"]));
19738
+ let payload;
19739
+ try {
19740
+ payload = JSON.parse(await fetchText(manifestUrl));
19741
+ } catch (error51) {
19742
+ if (error51 instanceof SyntaxError)
19743
+ throw new Error("Could not check the latest Antigravity version");
19744
+ throw error51;
19745
+ }
19746
+ const latestVersion = installationVersion(payload.version);
19747
+ return {
19748
+ currentVersion,
19749
+ latestVersion,
19750
+ updateAvailable: newerInstallationVersion(currentVersion, latestVersion),
19751
+ canUpdate: true
19752
+ };
19753
+ },
19754
+ async update() {
19755
+ await run(["update"], 3e5);
19756
+ }
19757
+ });
19758
+ }
19759
+
19489
19760
  // dist/plugin.js
19490
19761
  var ANTIGRAVITY_COMMAND_ENV = "CODEXHOST_ANTIGRAVITY_COMMAND";
19491
19762
  function createHarnessAdapter(context) {
19492
19763
  const environment = { ...context.environment };
19493
- return new AntigravityAdapter({
19764
+ return Object.assign(new AntigravityAdapter({
19494
19765
  ...environment[ANTIGRAVITY_COMMAND_ENV] ? { command: environment[ANTIGRAVITY_COMMAND_ENV] } : {},
19495
19766
  environment
19767
+ }), {
19768
+ installation: createAntigravityInstallation(environment, environment[ANTIGRAVITY_COMMAND_ENV])
19496
19769
  });
19497
19770
  }
19498
19771
  async function warmup(adapter) {