@liberseek/boft-cli-win32-arm64 0.7.5 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,11 +14764,14 @@ 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().trim().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.optional(),
14711
14774
  remaining: external_exports.number().finite().optional(),
14712
- unit: external_exports.string().trim().min(1).max(32).optional(),
14713
14775
  resetsAt: external_exports.string().min(1).optional(),
14714
14776
  periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
14715
14777
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
@@ -14740,12 +14802,27 @@ var threadUsageInspectionSchema = external_exports.object({
14740
14802
  }).strict();
14741
14803
 
14742
14804
  // ../../shared-contracts/dist/harness-accounts.js
14743
- var harnessAccountSnapshotSchema = external_exports.object({
14805
+ var accountBalanceSnapshotSchema = external_exports.object({
14806
+ amount: external_exports.number().finite().nonnegative(),
14807
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
14808
+ currency: external_exports.string().trim().min(1).max(8),
14809
+ /** Native label when the Harness exposes several Billing Sources. */
14810
+ label: external_exports.string().trim().min(1).max(128).optional()
14811
+ }).strict();
14812
+ var harnessAccountSnapshotObject = external_exports.object({
14744
14813
  email: external_exports.string().trim().min(1).max(320).optional(),
14745
14814
  label: external_exports.string().trim().min(1).max(256).optional(),
14746
14815
  plan: external_exports.string().trim().min(1).max(128).optional(),
14747
- credits: accountCreditsSnapshotSchema
14816
+ credits: accountCreditsSnapshotSchema.optional(),
14817
+ balance: accountBalanceSnapshotSchema.optional()
14748
14818
  }).strict();
14819
+ function requireReportedQuota(schema) {
14820
+ return schema.refine((value) => {
14821
+ const reported = value;
14822
+ return reported.credits !== void 0 || reported.balance !== void 0;
14823
+ }, { message: "Account must report either credits or a balance" });
14824
+ }
14825
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
14749
14826
  var harnessAccountIdentityShape = {
14750
14827
  harnessId: harnessIdSchema,
14751
14828
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -14756,11 +14833,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
14756
14833
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
14757
14834
  var harnessAccountInspectResultSchema = external_exports.object({
14758
14835
  ...harnessAccountIdentityShape,
14759
- account: harnessAccountSnapshotSchema.nullable()
14836
+ account: harnessAccountSnapshotSchema.nullable(),
14837
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
14838
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
14760
14839
  }).strict();
14761
14840
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
14762
14841
  var harnessAccountListResultSchema = external_exports.object({
14763
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
14842
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
14764
14843
  }).strict();
14765
14844
 
14766
14845
  // ../../shared-contracts/dist/json-value.js
@@ -14898,6 +14977,8 @@ var harnessModelSchema = external_exports.object({
14898
14977
  ref: harnessModelRefSchema,
14899
14978
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
14900
14979
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
14980
+ /** Optional opaque selection for this same Model with priority processing enabled. */
14981
+ fastModel: harnessModelRefSchema.optional(),
14901
14982
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14902
14983
  }).strict();
14903
14984
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -14930,6 +15011,16 @@ var harnessModelCatalogSchema = external_exports.object({
14930
15011
  });
14931
15012
  }
14932
15013
  refs.add(model.ref.id);
15014
+ if (model.fastModel) {
15015
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15016
+ context.addIssue({
15017
+ code: "custom",
15018
+ message: "Fast Model refs must be distinct and unique",
15019
+ path: ["models", index, "fastModel"]
15020
+ });
15021
+ }
15022
+ refs.add(model.fastModel.id);
15023
+ }
14933
15024
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14934
15025
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
14935
15026
  if (supportedThinkingIds.has(optionId)) {
@@ -15052,11 +15143,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15052
15143
  thinkingOptionId: harnessThinkingOptionIdSchema
15053
15144
  }).strict();
15054
15145
  var threadInspectionParamsSchema = external_exports.object({
15055
- threadId: hostThreadIdSchema
15146
+ threadId: hostThreadIdSchema,
15147
+ includeReferenceCapability: external_exports.boolean().optional()
15056
15148
  }).strict();
15057
15149
  var codexThreadInspectionSchema = external_exports.object({
15058
15150
  owner: external_exports.literal("codex"),
15059
- locked: external_exports.literal(true)
15151
+ locked: external_exports.literal(true),
15152
+ supportsThreadReferences: external_exports.literal(true).optional()
15060
15153
  }).strict();
15061
15154
  var externalThreadInspectionSchema = external_exports.object({
15062
15155
  owner: external_exports.literal("external"),
@@ -15184,10 +15277,31 @@ var harnessLaunchSettingsSchema = external_exports.object({
15184
15277
  restartRequired: external_exports.boolean()
15185
15278
  }).strict();
15186
15279
 
15280
+ // ../../shared-contracts/dist/harness-installation.js
15281
+ var harnessInstallationParamsSchema = external_exports.object({
15282
+ harnessId: harnessIdSchema,
15283
+ action: external_exports.enum(["check", "update"])
15284
+ }).strict();
15285
+ var harnessInstallationStateSchema = external_exports.object({
15286
+ currentVersion: external_exports.string().min(1).max(128),
15287
+ latestVersion: external_exports.string().min(1).max(128),
15288
+ updateAvailable: external_exports.boolean(),
15289
+ canUpdate: external_exports.boolean(),
15290
+ message: external_exports.string().max(2048).optional()
15291
+ }).strict();
15292
+
15187
15293
  // ../../shared-contracts/dist/codex-accounts.js
15188
15294
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15189
15295
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
15190
15296
  var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
15297
+ var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
15298
+ function isCodexAccountSiteUrl(value) {
15299
+ return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
15300
+ }
15301
+ var externalUrlOpenParamsSchema = external_exports.object({
15302
+ url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
15303
+ }).strict();
15304
+ var externalUrlOpenResultSchema = external_exports.object({}).strict();
15191
15305
  var codexAccountPlanTypeSchema = external_exports.enum([
15192
15306
  "free",
15193
15307
  "go",
@@ -15213,7 +15327,8 @@ var codexAccountSchema = external_exports.object({
15213
15327
  email: external_exports.string().email().max(320).optional(),
15214
15328
  planType: codexAccountPlanTypeSchema.optional(),
15215
15329
  authKind: codexAccountAuthKindSchema.optional(),
15216
- authIdentity: nonBlankTextSchema3.max(256).optional()
15330
+ authIdentity: nonBlankTextSchema3.max(256).optional(),
15331
+ siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
15217
15332
  }).strict();
15218
15333
  var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
15219
15334
  var codexAccountListResultSchema = external_exports.object({
@@ -15675,6 +15790,20 @@ function commandInvocation(command, arguments_, environment, platform = process.
15675
15790
  };
15676
15791
  }
15677
15792
 
15793
+ // ../../harness-discovery/dist/node-runtime.js
15794
+ import path3 from "node:path";
15795
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
15796
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
15797
+ const delimiter = platform === "win32" ? ";" : ":";
15798
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
15799
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
15800
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
15801
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
15802
+ directories.push(runtimeDirectory);
15803
+ }
15804
+ return { ...environment, [pathKey]: directories.join(delimiter) };
15805
+ }
15806
+
15678
15807
  // ../../harness-discovery/dist/resolve.js
15679
15808
  import os from "node:os";
15680
15809
 
@@ -15838,8 +15967,118 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
15838
15967
  return void 0;
15839
15968
  }
15840
15969
 
15970
+ // ../../harness-discovery/dist/installation.js
15971
+ import { execFile } from "node:child_process";
15972
+ import { homedir } from "node:os";
15973
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
15974
+ const env = withNodeRuntimeOnPath(environment);
15975
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
15976
+ return new Promise((resolve, reject) => {
15977
+ const child = execFile(invocation.command, invocation.arguments, {
15978
+ env,
15979
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
15980
+ encoding: "utf8",
15981
+ timeout,
15982
+ killSignal: "SIGKILL",
15983
+ maxBuffer: 1024 * 1024,
15984
+ windowsHide: true,
15985
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
15986
+ }, (error51, stdout, stderr) => {
15987
+ if (error51)
15988
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
15989
+ else
15990
+ resolve((stdout || stderr).trim());
15991
+ });
15992
+ child.stdin?.end();
15993
+ });
15994
+ }
15995
+ function installationVersion(value) {
15996
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
15997
+ throw new Error("Harness returned an invalid version");
15998
+ return value.trim().replace(/^v/, "");
15999
+ }
16000
+ function versionFromOutput(output) {
16001
+ return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
16002
+ }
16003
+ function newerInstallationVersion(current, latest) {
16004
+ const a = installationVersion(current).replace(/\+.*/, "");
16005
+ const b = installationVersion(latest).replace(/\+.*/, "");
16006
+ const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
16007
+ const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
16008
+ for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
16009
+ if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
16010
+ return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
16011
+ }
16012
+ const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
16013
+ const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
16014
+ if (!preA.length || !preB.length)
16015
+ return !!preA.length && !preB.length;
16016
+ for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
16017
+ const x = preA[i];
16018
+ const y = preB[i];
16019
+ if (x === y)
16020
+ continue;
16021
+ if (x === void 0 || y === void 0)
16022
+ return x === void 0;
16023
+ const numericX = /^\d+$/.test(x);
16024
+ const numericY = /^\d+$/.test(y);
16025
+ if (numericX && numericY) {
16026
+ if (BigInt(x) === BigInt(y))
16027
+ continue;
16028
+ return BigInt(y) > BigInt(x);
16029
+ }
16030
+ if (numericX !== numericY)
16031
+ return numericX;
16032
+ return y > x;
16033
+ }
16034
+ return false;
16035
+ }
16036
+ function createInstallationManager(options) {
16037
+ let checking;
16038
+ let updating;
16039
+ const check2 = () => checking ??= options.check().finally(() => {
16040
+ checking = void 0;
16041
+ });
16042
+ return (action) => {
16043
+ if (updating)
16044
+ return updating;
16045
+ if (action === "check")
16046
+ return check2();
16047
+ updating = (async () => {
16048
+ const before = await check2();
16049
+ if (!before.updateAvailable)
16050
+ return before;
16051
+ if (!before.canUpdate)
16052
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
16053
+ await options.update(before);
16054
+ const after = await check2();
16055
+ if (after.currentVersion === before.currentVersion)
16056
+ throw new Error("The Harness version did not change; check the native updater and retry");
16057
+ return after;
16058
+ })().finally(() => {
16059
+ updating = void 0;
16060
+ });
16061
+ return updating;
16062
+ };
16063
+ }
16064
+ async function fetchInstallationText(url2) {
16065
+ const request = async () => {
16066
+ const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
16067
+ if (!response.ok)
16068
+ throw new Error("Could not check the latest Harness version");
16069
+ return response.text();
16070
+ };
16071
+ try {
16072
+ return await request();
16073
+ } catch (error51) {
16074
+ if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
16075
+ throw error51;
16076
+ return request();
16077
+ }
16078
+ }
16079
+
15841
16080
  // dist/command.js
15842
- import path3 from "node:path";
16081
+ import path4 from "node:path";
15843
16082
  var antigravityDiscoverySpec = {
15844
16083
  id: "antigravity",
15845
16084
  command: "agy",
@@ -15859,20 +16098,20 @@ function resolveAntigravityExecutable(input = {}) {
15859
16098
  });
15860
16099
  if (!resolution)
15861
16100
  return void 0;
15862
- return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path3.resolve(resolution.executable);
16101
+ return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
15863
16102
  }
15864
16103
 
15865
16104
  // dist/fork.js
15866
16105
  import { randomUUID as randomUUID2 } from "node:crypto";
15867
16106
  import { copyFile, cp, mkdir as mkdir2 } from "node:fs/promises";
15868
16107
  import os3 from "node:os";
15869
- import path5 from "node:path";
16108
+ import path6 from "node:path";
15870
16109
 
15871
16110
  // dist/history.js
15872
16111
  import { randomUUID } from "node:crypto";
15873
16112
  import { mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
15874
16113
  import os2 from "node:os";
15875
- import path4 from "node:path";
16114
+ import path5 from "node:path";
15876
16115
  var HISTORY_VERSION = 1;
15877
16116
  var THREAD_ID_ENV = "CODEXHOST_THREAD_ID";
15878
16117
  var harnessErrorSchema = external_exports.strictObject({
@@ -15969,7 +16208,7 @@ var historySchema = external_exports.strictObject({
15969
16208
  });
15970
16209
  function historyRoot(environment) {
15971
16210
  const dataDirectory = environment.CODEXHOST_DATA_DIR;
15972
- return path4.join(dataDirectory ? path4.resolve(dataDirectory) : path4.join(os2.homedir(), ".codexhost"), "antigravity-history");
16211
+ return path5.join(dataDirectory ? path5.resolve(dataDirectory) : path5.join(os2.homedir(), ".codexhost"), "antigravity-history");
15973
16212
  }
15974
16213
  function safeThreadId(environment) {
15975
16214
  const threadId = (environment[THREAD_ID_ENV] ?? environment.CODEXHOST_DELEGATION_THREAD_ID)?.trim();
@@ -15977,7 +16216,7 @@ function safeThreadId(environment) {
15977
16216
  }
15978
16217
  function historyPath(environment) {
15979
16218
  const threadId = safeThreadId(environment);
15980
- return threadId ? path4.join(historyRoot(environment), `${threadId}.json`) : null;
16219
+ return threadId ? path5.join(historyRoot(environment), `${threadId}.json`) : null;
15981
16220
  }
15982
16221
  function jsonTurn(turn) {
15983
16222
  return JSON.parse(JSON.stringify(turn));
@@ -16056,7 +16295,7 @@ var AntigravityHistory = class _AntigravityHistory {
16056
16295
  for (const entry of entries) {
16057
16296
  if (!entry.endsWith(".json"))
16058
16297
  continue;
16059
- const file2 = path4.join(root, entry);
16298
+ const file2 = path5.join(root, entry);
16060
16299
  try {
16061
16300
  const parsed = historySchema.safeParse(JSON.parse(await readFile(file2, "utf8")));
16062
16301
  if (parsed.success && parsed.data.nativeSessionId === nativeSessionId) {
@@ -16143,9 +16382,9 @@ var AntigravityHistory = class _AntigravityHistory {
16143
16382
  const model = this.#model;
16144
16383
  const thinkingOptionId = this.#thinkingOptionId;
16145
16384
  this.#write = this.#write.catch(() => void 0).then(async () => {
16146
- const directory = path4.dirname(file2);
16385
+ const directory = path5.dirname(file2);
16147
16386
  await mkdir(directory, { recursive: true, mode: 448 });
16148
- const temporary = path4.join(directory, `.${path4.basename(file2)}.${randomUUID()}.tmp`);
16387
+ const temporary = path5.join(directory, `.${path5.basename(file2)}.${randomUUID()}.tmp`);
16149
16388
  try {
16150
16389
  await writeFile(temporary, `${JSON.stringify({
16151
16390
  formatVersion: HISTORY_VERSION,
@@ -16164,24 +16403,24 @@ var AntigravityHistory = class _AntigravityHistory {
16164
16403
  };
16165
16404
 
16166
16405
  // dist/fork.js
16167
- function nativeConversationDbPath(nativeSessionId, homedir = os3.homedir()) {
16168
- return path5.join(homedir, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
16406
+ function nativeConversationDbPath(nativeSessionId, homedir2 = os3.homedir()) {
16407
+ return path6.join(homedir2, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
16169
16408
  }
16170
- function nativeBrainDirPath(nativeSessionId, homedir = os3.homedir()) {
16171
- return path5.join(homedir, ".gemini", "antigravity-cli", "brain", nativeSessionId);
16409
+ function nativeBrainDirPath(nativeSessionId, homedir2 = os3.homedir()) {
16410
+ return path6.join(homedir2, ".gemini", "antigravity-cli", "brain", nativeSessionId);
16172
16411
  }
16173
16412
  async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, retainedTurnsCountOrHomedir, homedirOption = os3.homedir()) {
16174
16413
  let retainedTurnsCount;
16175
- let homedir = homedirOption;
16414
+ let homedir2 = homedirOption;
16176
16415
  if (typeof retainedTurnsCountOrHomedir === "string") {
16177
- homedir = retainedTurnsCountOrHomedir;
16416
+ homedir2 = retainedTurnsCountOrHomedir;
16178
16417
  } else if (typeof retainedTurnsCountOrHomedir === "number") {
16179
16418
  retainedTurnsCount = retainedTurnsCountOrHomedir;
16180
16419
  }
16181
- const sourceDb = nativeConversationDbPath(sourceSessionId, homedir);
16182
- const targetDb = nativeConversationDbPath(derivedSessionId, homedir);
16420
+ const sourceDb = nativeConversationDbPath(sourceSessionId, homedir2);
16421
+ const targetDb = nativeConversationDbPath(derivedSessionId, homedir2);
16183
16422
  try {
16184
- await mkdir2(path5.dirname(targetDb), { recursive: true });
16423
+ await mkdir2(path6.dirname(targetDb), { recursive: true });
16185
16424
  await copyFile(sourceDb, targetDb);
16186
16425
  } catch {
16187
16426
  return false;
@@ -16232,7 +16471,7 @@ async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, reta
16232
16471
  } catch {
16233
16472
  }
16234
16473
  try {
16235
- const summariesDbPath = path5.join(homedir, ".gemini", "antigravity-cli", "conversation_summaries.db");
16474
+ const summariesDbPath = path6.join(homedir2, ".gemini", "antigravity-cli", "conversation_summaries.db");
16236
16475
  const sumDb = new DatabaseSync(summariesDbPath);
16237
16476
  try {
16238
16477
  const cur = sumDb.prepare("SELECT * FROM conversation_summaries WHERE conversation_id = ?");
@@ -16269,13 +16508,13 @@ async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, reta
16269
16508
  return true;
16270
16509
  }
16271
16510
  var copyNativeConversationDbIfExists = cloneNativeConversationDb;
16272
- async function copyNativeBrainDirIfExists(sourceSessionId, derivedSessionId, homedir = os3.homedir()) {
16273
- const sourceBrain = nativeBrainDirPath(sourceSessionId, homedir);
16274
- const targetBrain = nativeBrainDirPath(derivedSessionId, homedir);
16511
+ async function copyNativeBrainDirIfExists(sourceSessionId, derivedSessionId, homedir2 = os3.homedir()) {
16512
+ const sourceBrain = nativeBrainDirPath(sourceSessionId, homedir2);
16513
+ const targetBrain = nativeBrainDirPath(derivedSessionId, homedir2);
16275
16514
  try {
16276
16515
  await cp(sourceBrain, targetBrain, {
16277
16516
  recursive: true,
16278
- filter: (source) => path5.basename(source) !== ".system_generated"
16517
+ filter: (source) => path6.basename(source) !== ".system_generated"
16279
16518
  });
16280
16519
  return true;
16281
16520
  } catch {
@@ -16726,7 +16965,7 @@ function parseAndFormatAntigravityCommand(command) {
16726
16965
  import https from "node:https";
16727
16966
 
16728
16967
  // dist/tool-projection.js
16729
- import path6 from "node:path";
16968
+ import path7 from "node:path";
16730
16969
  function isRecord(value) {
16731
16970
  return typeof value === "object" && value !== null && !Array.isArray(value);
16732
16971
  }
@@ -16747,10 +16986,10 @@ function displayPath(nativePath, cwd) {
16747
16986
  if (typeof nativePath !== "string" || nativePath.trim().length === 0 || nativePath.includes("\0") || nativePath.includes("\n") || nativePath.includes("\r")) {
16748
16987
  return null;
16749
16988
  }
16750
- const resolvedCwd = path6.resolve(cwd);
16751
- const resolvedPath = path6.isAbsolute(nativePath) ? path6.resolve(nativePath) : path6.resolve(cwd, nativePath);
16752
- const relative = path6.relative(resolvedCwd, resolvedPath);
16753
- const inside = !path6.isAbsolute(relative) && relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path6.sep}`);
16989
+ const resolvedCwd = path7.resolve(cwd);
16990
+ const resolvedPath = path7.isAbsolute(nativePath) ? path7.resolve(nativePath) : path7.resolve(cwd, nativePath);
16991
+ const relative = path7.relative(resolvedCwd, resolvedPath);
16992
+ const inside = !path7.isAbsolute(relative) && relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path7.sep}`);
16754
16993
  const selected = inside ? relative : resolvedPath;
16755
16994
  const normalized = selected.replaceAll("\\", "/");
16756
16995
  if (normalized.length === 0 || normalized === ".")
@@ -16881,7 +17120,7 @@ function synthesizeAntigravityCommand(toolName, params, cwd) {
16881
17120
  ]);
16882
17121
  let resolvedCwd;
16883
17122
  if (workingDir && workingDir.trim().length > 0) {
16884
- resolvedCwd = cwd && !path6.isAbsolute(workingDir) ? path6.resolve(cwd, workingDir) : workingDir;
17123
+ resolvedCwd = cwd && !path7.isAbsolute(workingDir) ? path7.resolve(cwd, workingDir) : workingDir;
16885
17124
  } else if (cwd) {
16886
17125
  resolvedCwd = cwd;
16887
17126
  }
@@ -17285,7 +17524,7 @@ import { randomBytes, randomUUID as randomUUID4, timingSafeEqual } from "node:cr
17285
17524
  import { mkdir as mkdir3, mkdtemp, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
17286
17525
  import { createServer } from "node:http";
17287
17526
  import os4 from "node:os";
17288
- import path7 from "node:path";
17527
+ import path8 from "node:path";
17289
17528
 
17290
17529
  // dist/question-hook-client.js
17291
17530
  var ANTIGRAVITY_QUESTION_HOOK_CLIENT = String.raw`
@@ -17410,7 +17649,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
17410
17649
  this.#server.on("request", (request, response) => this.#receive(request, response));
17411
17650
  }
17412
17651
  static async create(options) {
17413
- const directory = await mkdtemp(path7.join(os4.tmpdir(), "codexhost-agy-question-"));
17652
+ const directory = await mkdtemp(path8.join(os4.tmpdir(), "codexhost-agy-question-"));
17414
17653
  const bridge = new _AntigravityQuestionBridge(directory, options);
17415
17654
  try {
17416
17655
  await new Promise((resolve, reject) => {
@@ -17425,14 +17664,14 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
17425
17664
  if (!address || typeof address === "string")
17426
17665
  throw new Error("Question bridge did not bind");
17427
17666
  bridge.environment.CODEXHOST_AGY_QUESTION_URL = `http://127.0.0.1:${address.port}/question`;
17428
- const client = path7.join(directory, "question-hook.cjs");
17429
- await mkdir3(path7.join(directory, ".agents"));
17667
+ const client = path8.join(directory, "question-hook.cjs");
17668
+ await mkdir3(path8.join(directory, ".agents"));
17430
17669
  await writeFile2(client, ANTIGRAVITY_QUESTION_HOOK_CLIENT, "utf8");
17431
17670
  const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
17432
17671
  bridge.environment.CODEXHOST_AGY_QUESTION_NODE = `"${process.execPath.replaceAll("\\", "/")}"`;
17433
17672
  bridge.environment.CODEXHOST_AGY_QUESTION_CLIENT = `"${client.replaceAll("\\", "/")}"`;
17434
17673
  const command = process.platform === "win32" ? "%CODEXHOST_AGY_QUESTION_NODE% %CODEXHOST_AGY_QUESTION_CLIENT%" : `${quote(process.execPath)} ${quote(client)}`;
17435
- await writeFile2(path7.join(directory, ".agents", "hooks.json"), JSON.stringify({
17674
+ await writeFile2(path8.join(directory, ".agents", "hooks.json"), JSON.stringify({
17436
17675
  "codexhost-question-bridge": {
17437
17676
  PreToolUse: [
17438
17677
  {
@@ -17667,7 +17906,7 @@ import { randomUUID as randomUUID5 } from "node:crypto";
17667
17906
  // dist/subagent-transcript.js
17668
17907
  import { open, realpath } from "node:fs/promises";
17669
17908
  import https2 from "node:https";
17670
- import path8 from "node:path";
17909
+ import path9 from "node:path";
17671
17910
  var nativeSubagentIdSchema = external_exports.uuid();
17672
17911
  var MAX_TRANSCRIPT_BYTES = 8 * 1024 * 1024;
17673
17912
  var transcriptStepSchema = external_exports.object({
@@ -17835,10 +18074,10 @@ async function readSubagentTranscript(input) {
17835
18074
  };
17836
18075
  }
17837
18076
  try {
17838
- const file2 = path8.join(nativeBrainDirPath(input.childId, input.home), ".system_generated", "logs", "transcript.jsonl");
17839
- const brainRoot = await realpath(path8.dirname(nativeBrainDirPath(input.childId, input.home)));
18077
+ const file2 = path9.join(nativeBrainDirPath(input.childId, input.home), ".system_generated", "logs", "transcript.jsonl");
18078
+ const brainRoot = await realpath(path9.dirname(nativeBrainDirPath(input.childId, input.home)));
17840
18079
  const resolved = await realpath(file2);
17841
- const expected = path8.join(brainRoot, input.childId, ".system_generated", "logs", "transcript.jsonl");
18080
+ const expected = path9.join(brainRoot, input.childId, ".system_generated", "logs", "transcript.jsonl");
17842
18081
  const normalize = (value) => process.platform === "win32" ? value.toLowerCase() : value;
17843
18082
  if (normalize(resolved) !== normalize(expected))
17844
18083
  throw new Error("Subagent log redirects outside its native location");
@@ -18183,8 +18422,8 @@ function mergePendingStep(pending, step) {
18183
18422
  };
18184
18423
  }
18185
18424
  function sameFile(left, right) {
18186
- const a = path9.resolve(left);
18187
- const b = path9.resolve(right);
18425
+ const a = path10.resolve(left);
18426
+ const b = path10.resolve(right);
18188
18427
  return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
18189
18428
  }
18190
18429
  function resolveAntigravityContextWindow(modelId, reportedWindow) {
@@ -18543,7 +18782,7 @@ var AntigravitySession = class {
18543
18782
  return { ok: false, error: invalidState("Antigravity Session is closed") };
18544
18783
  }
18545
18784
  const environment = { ...this.#environment, ...questions.environment };
18546
- const logPath = path9.join(os5.tmpdir(), `codexhost-antigravity-${randomUUID6()}.log`);
18785
+ const logPath = path10.join(os5.tmpdir(), `codexhost-antigravity-${randomUUID6()}.log`);
18547
18786
  const arguments_ = [
18548
18787
  "--input-format",
18549
18788
  "stream-json",
@@ -19222,7 +19461,7 @@ var AntigravityAdapter = class {
19222
19461
  if (this.#closed) {
19223
19462
  return { status: "unavailable", error: invalidState("Antigravity Adapter is closed") };
19224
19463
  }
19225
- const cwd = path9.resolve(input.cwd ?? process.cwd());
19464
+ const cwd = path10.resolve(input.cwd ?? process.cwd());
19226
19465
  const inFlight = this.#inspectionInFlight.get(cwd);
19227
19466
  if (inFlight)
19228
19467
  return inFlight;
@@ -19364,7 +19603,7 @@ var AntigravityAdapter = class {
19364
19603
  }
19365
19604
  };
19366
19605
  }
19367
- const cwd = path9.resolve(input.cwd);
19606
+ const cwd = path10.resolve(input.cwd);
19368
19607
  let catalog = this.#inspectionCache.get(cwd)?.catalog;
19369
19608
  if (!catalog) {
19370
19609
  const inspection = await this.inspect({ cwd: input.cwd });
@@ -19510,13 +19749,55 @@ var AntigravityAdapter = class {
19510
19749
  }
19511
19750
  };
19512
19751
 
19752
+ // dist/installation.js
19753
+ var ANTIGRAVITY_UPDATE_MANIFEST_ROOT = "https://antigravity-cli-auto-updater-974169037036.us-central1.run.app";
19754
+ function antigravityUpdateManifestUrl(platform = process.platform, arch = process.arch) {
19755
+ const system = platform === "darwin" ? "darwin" : platform === "linux" ? "linux" : platform === "win32" ? "windows" : void 0;
19756
+ const cpu = arch === "arm64" ? "arm64" : arch === "x64" ? "amd64" : void 0;
19757
+ if (!system || !cpu)
19758
+ throw new Error("Antigravity updates are unavailable for this platform");
19759
+ return `${ANTIGRAVITY_UPDATE_MANIFEST_ROOT}/manifests/${system}_${cpu}.json`;
19760
+ }
19761
+ function createAntigravityInstallation(environment, command, dependencies = {}) {
19762
+ const run = dependencies.run ?? ((args, timeout) => runInstallationCommand(resolveAntigravityExecutable({ environment, ...command ? { command } : {} }) ?? "agy", args, environment, timeout));
19763
+ const fetchText = dependencies.fetchText ?? fetchInstallationText;
19764
+ const platform = dependencies.platform ?? process.platform;
19765
+ const arch = dependencies.arch ?? process.arch;
19766
+ return createInstallationManager({
19767
+ async check() {
19768
+ const manifestUrl = antigravityUpdateManifestUrl(platform, arch);
19769
+ const currentVersion = versionFromOutput(await run(["--version"]));
19770
+ let payload;
19771
+ try {
19772
+ payload = JSON.parse(await fetchText(manifestUrl));
19773
+ } catch (error51) {
19774
+ if (error51 instanceof SyntaxError)
19775
+ throw new Error("Could not check the latest Antigravity version");
19776
+ throw error51;
19777
+ }
19778
+ const latestVersion = installationVersion(payload.version);
19779
+ return {
19780
+ currentVersion,
19781
+ latestVersion,
19782
+ updateAvailable: newerInstallationVersion(currentVersion, latestVersion),
19783
+ canUpdate: true
19784
+ };
19785
+ },
19786
+ async update() {
19787
+ await run(["update"], 3e5);
19788
+ }
19789
+ });
19790
+ }
19791
+
19513
19792
  // dist/plugin.js
19514
19793
  var ANTIGRAVITY_COMMAND_ENV = "CODEXHOST_ANTIGRAVITY_COMMAND";
19515
19794
  function createHarnessAdapter(context) {
19516
19795
  const environment = { ...context.environment };
19517
- return new AntigravityAdapter({
19796
+ return Object.assign(new AntigravityAdapter({
19518
19797
  ...environment[ANTIGRAVITY_COMMAND_ENV] ? { command: environment[ANTIGRAVITY_COMMAND_ENV] } : {},
19519
19798
  environment
19799
+ }), {
19800
+ installation: createAntigravityInstallation(environment, environment[ANTIGRAVITY_COMMAND_ENV])
19520
19801
  });
19521
19802
  }
19522
19803
  async function warmup(adapter) {