@liberseek/boft-cli-win32-arm64 0.7.4 → 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.
@@ -771,10 +771,10 @@ function mergeDefs(...defs) {
771
771
  function cloneDef(schema) {
772
772
  return mergeDefs(schema._zod.def);
773
773
  }
774
- function getElementAtPath(obj, path7) {
775
- if (!path7)
774
+ function getElementAtPath(obj, path8) {
775
+ if (!path8)
776
776
  return obj;
777
- return path7.reduce((acc, key) => acc?.[key], obj);
777
+ return path8.reduce((acc, key) => acc?.[key], obj);
778
778
  }
779
779
  function promiseAllObject(promisesObj) {
780
780
  const keys = Object.keys(promisesObj);
@@ -1183,11 +1183,11 @@ function explicitlyAborted(x, startIndex = 0) {
1183
1183
  }
1184
1184
  return false;
1185
1185
  }
1186
- function prefixIssues(path7, issues) {
1186
+ function prefixIssues(path8, issues) {
1187
1187
  return issues.map((iss) => {
1188
1188
  var _a3;
1189
1189
  (_a3 = iss).path ?? (_a3.path = []);
1190
- iss.path.unshift(path7);
1190
+ iss.path.unshift(path8);
1191
1191
  return iss;
1192
1192
  });
1193
1193
  }
@@ -1334,16 +1334,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1334
1334
  }
1335
1335
  function formatError(error51, mapper = (issue2) => issue2.message) {
1336
1336
  const fieldErrors = { _errors: [] };
1337
- const processError = (error52, path7 = []) => {
1337
+ const processError = (error52, path8 = []) => {
1338
1338
  for (const issue2 of error52.issues) {
1339
1339
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1340
- issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1340
+ issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1341
1341
  } else if (issue2.code === "invalid_key") {
1342
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1342
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1343
1343
  } else if (issue2.code === "invalid_element") {
1344
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1344
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1345
1345
  } else {
1346
- const fullpath = [...path7, ...issue2.path];
1346
+ const fullpath = [...path8, ...issue2.path];
1347
1347
  if (fullpath.length === 0) {
1348
1348
  fieldErrors._errors.push(mapper(issue2));
1349
1349
  } else {
@@ -1370,17 +1370,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1370
1370
  }
1371
1371
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1372
1372
  const result = { errors: [] };
1373
- const processError = (error52, path7 = []) => {
1373
+ const processError = (error52, path8 = []) => {
1374
1374
  var _a3, _b;
1375
1375
  for (const issue2 of error52.issues) {
1376
1376
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1377
- issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1377
+ issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1378
1378
  } else if (issue2.code === "invalid_key") {
1379
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1379
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1380
1380
  } else if (issue2.code === "invalid_element") {
1381
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1381
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1382
1382
  } else {
1383
- const fullpath = [...path7, ...issue2.path];
1383
+ const fullpath = [...path8, ...issue2.path];
1384
1384
  if (fullpath.length === 0) {
1385
1385
  result.errors.push(mapper(issue2));
1386
1386
  continue;
@@ -1412,8 +1412,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1412
1412
  }
1413
1413
  function toDotPath(_path) {
1414
1414
  const segs = [];
1415
- const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1416
- for (const seg of path7) {
1415
+ const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1416
+ for (const seg of path8) {
1417
1417
  if (typeof seg === "number")
1418
1418
  segs.push(`[${seg}]`);
1419
1419
  else if (typeof seg === "symbol")
@@ -14105,13 +14105,13 @@ function resolveRef(ref, ctx) {
14105
14105
  if (!ref.startsWith("#")) {
14106
14106
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14107
14107
  }
14108
- const path7 = ref.slice(1).split("/").filter(Boolean);
14109
- if (path7.length === 0) {
14108
+ const path8 = ref.slice(1).split("/").filter(Boolean);
14109
+ if (path8.length === 0) {
14110
14110
  return ctx.rootSchema;
14111
14111
  }
14112
14112
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14113
- if (path7[0] === defsKey) {
14114
- const key = path7[1];
14113
+ if (path8[0] === defsKey) {
14114
+ const key = path8[1];
14115
14115
  if (!key || !ctx.defs[key]) {
14116
14116
  throw new Error(`Reference not found: ${ref}`);
14117
14117
  }
@@ -14574,6 +14574,55 @@ var credentialImportsParamsSchema = external_exports.object({
14574
14574
  request: credentialImportsRequestSchema
14575
14575
  }).strict();
14576
14576
 
14577
+ // ../../shared-contracts/dist/harness-display-settings.js
14578
+ var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
14579
+ agent: external_exports.string().min(1).max(128),
14580
+ section: external_exports.enum(["main", "more", "auto"])
14581
+ })).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
14582
+ var harnessDisplaySettingsSchema = external_exports.strictObject({
14583
+ entries: harnessDisplayEntriesSchema.nullable()
14584
+ });
14585
+ var harnessDisplayGetSchema = external_exports.strictObject({});
14586
+ var harnessDisplaySetSchema = external_exports.strictObject({
14587
+ entries: harnessDisplayEntriesSchema,
14588
+ /** Import legacy Desktop preferences only if no shared settings exist yet. */
14589
+ initializeOnly: external_exports.boolean().optional()
14590
+ });
14591
+
14592
+ // ../../shared-contracts/dist/console.js
14593
+ var consoleAnnouncementSchema = external_exports.strictObject({
14594
+ title: external_exports.string().trim().min(1).max(200),
14595
+ type: external_exports.enum(["info", "warning", "danger"]),
14596
+ body: external_exports.string().trim().min(1).max(16 * 1024)
14597
+ });
14598
+ var consoleOpenParamsSchema = external_exports.strictObject({});
14599
+ var consoleOpenResultSchema = external_exports.strictObject({
14600
+ /** The console address. */
14601
+ url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
14602
+ });
14603
+ var CONSOLE_HOST_METHODS = Object.freeze([
14604
+ "codexhost/harness/plugins/list",
14605
+ "codexhost/harness/display-settings/get",
14606
+ "codexhost/harness/display-settings/set",
14607
+ "codexhost/harness/inspect",
14608
+ "codexhost/harness/launch-settings/get",
14609
+ "codexhost/harness/launch-settings/set",
14610
+ "codexhost/harness/web-ui/open",
14611
+ "codexhost/harness/accounts/sources",
14612
+ "codexhost/harness/accounts/list",
14613
+ "codexhost/harness/accounts/inspect",
14614
+ "codexhost/harness/credential-imports",
14615
+ "codexhost/harness/session-import/sources",
14616
+ "codexhost/harness/session-import/list",
14617
+ "codexhost/harness/session-import/import",
14618
+ "codexhost/account/list",
14619
+ "codexhost/account/refresh",
14620
+ "codexhost/account/usage/inspect",
14621
+ "codexhost/update/check",
14622
+ "codexhost/update/start",
14623
+ "codexhost/update/status"
14624
+ ]);
14625
+
14577
14626
  // ../../shared-contracts/dist/version.js
14578
14627
  var WORKSPACE_CONTRACT_VERSION = 1;
14579
14628
 
@@ -14627,6 +14676,12 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
14627
14676
  var hostItemIdSchema = opaqueIdSchema.brand();
14628
14677
  var hostInteractionIdSchema = opaqueIdSchema.brand();
14629
14678
 
14679
+ // ../../shared-contracts/dist/manual-compaction.js
14680
+ var threadManualCompactionStartedSchema = external_exports.strictObject({
14681
+ threadId: hostThreadIdSchema,
14682
+ turnId: hostTurnIdSchema
14683
+ });
14684
+
14630
14685
  // ../../shared-contracts/dist/thread-usage.js
14631
14686
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14632
14687
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -14687,6 +14742,10 @@ var threadUsageSnapshotSchema = external_exports.object({
14687
14742
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
14688
14743
  var accountCreditsProductUsageSchema = external_exports.object({
14689
14744
  product: external_exports.string().min(1),
14745
+ used: external_exports.number().finite().nonnegative().optional(),
14746
+ // Zero is a real empty cap, not an absent field.
14747
+ limit: external_exports.number().finite().nonnegative().optional(),
14748
+ unit: external_exports.string().min(1).max(32).optional(),
14690
14749
  usagePercent: usagePercentSchema,
14691
14750
  resetsAt: external_exports.string().min(1).optional()
14692
14751
  }).strict();
@@ -14696,11 +14755,14 @@ var accountResetCreditsSchema = external_exports.object({
14696
14755
  expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
14697
14756
  }).strict();
14698
14757
  var accountCreditsSnapshotSchema = external_exports.object({
14758
+ used: external_exports.number().finite().nonnegative().optional(),
14759
+ // Zero is a real empty cap, not an absent field.
14760
+ limit: external_exports.number().finite().nonnegative().optional(),
14761
+ unit: external_exports.string().trim().min(1).max(32).optional(),
14699
14762
  /** Native label when the primary limit is scoped to a model or product group. */
14700
14763
  label: external_exports.string().min(1).optional(),
14701
14764
  usedPercent: usagePercentSchema.optional(),
14702
14765
  remaining: external_exports.number().finite().optional(),
14703
- unit: external_exports.string().trim().min(1).max(32).optional(),
14704
14766
  resetsAt: external_exports.string().min(1).optional(),
14705
14767
  periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
14706
14768
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
@@ -14731,12 +14793,27 @@ var threadUsageInspectionSchema = external_exports.object({
14731
14793
  }).strict();
14732
14794
 
14733
14795
  // ../../shared-contracts/dist/harness-accounts.js
14734
- var harnessAccountSnapshotSchema = external_exports.object({
14796
+ var accountBalanceSnapshotSchema = external_exports.object({
14797
+ amount: external_exports.number().finite().nonnegative(),
14798
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
14799
+ currency: external_exports.string().trim().min(1).max(8),
14800
+ /** Native label when the Harness exposes several Billing Sources. */
14801
+ label: external_exports.string().trim().min(1).max(128).optional()
14802
+ }).strict();
14803
+ var harnessAccountSnapshotObject = external_exports.object({
14735
14804
  email: external_exports.string().trim().min(1).max(320).optional(),
14736
14805
  label: external_exports.string().trim().min(1).max(256).optional(),
14737
14806
  plan: external_exports.string().trim().min(1).max(128).optional(),
14738
- credits: accountCreditsSnapshotSchema
14807
+ credits: accountCreditsSnapshotSchema.optional(),
14808
+ balance: accountBalanceSnapshotSchema.optional()
14739
14809
  }).strict();
14810
+ function requireReportedQuota(schema) {
14811
+ return schema.refine((value) => {
14812
+ const reported = value;
14813
+ return reported.credits !== void 0 || reported.balance !== void 0;
14814
+ }, { message: "Account must report either credits or a balance" });
14815
+ }
14816
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
14740
14817
  var harnessAccountIdentityShape = {
14741
14818
  harnessId: harnessIdSchema,
14742
14819
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -14747,11 +14824,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
14747
14824
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
14748
14825
  var harnessAccountInspectResultSchema = external_exports.object({
14749
14826
  ...harnessAccountIdentityShape,
14750
- account: harnessAccountSnapshotSchema.nullable()
14827
+ account: harnessAccountSnapshotSchema.nullable(),
14828
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
14829
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
14751
14830
  }).strict();
14752
14831
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
14753
14832
  var harnessAccountListResultSchema = external_exports.object({
14754
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
14833
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
14755
14834
  }).strict();
14756
14835
 
14757
14836
  // ../../shared-contracts/dist/json-value.js
@@ -14889,6 +14968,8 @@ var harnessModelSchema = external_exports.object({
14889
14968
  ref: harnessModelRefSchema,
14890
14969
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
14891
14970
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
14971
+ /** Optional opaque selection for this same Model with priority processing enabled. */
14972
+ fastModel: harnessModelRefSchema.optional(),
14892
14973
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14893
14974
  }).strict();
14894
14975
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -14921,6 +15002,16 @@ var harnessModelCatalogSchema = external_exports.object({
14921
15002
  });
14922
15003
  }
14923
15004
  refs.add(model.ref.id);
15005
+ if (model.fastModel) {
15006
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15007
+ context.addIssue({
15008
+ code: "custom",
15009
+ message: "Fast Model refs must be distinct and unique",
15010
+ path: ["models", index, "fastModel"]
15011
+ });
15012
+ }
15013
+ refs.add(model.fastModel.id);
15014
+ }
14924
15015
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14925
15016
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
14926
15017
  if (supportedThinkingIds.has(optionId)) {
@@ -15043,11 +15134,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15043
15134
  thinkingOptionId: harnessThinkingOptionIdSchema
15044
15135
  }).strict();
15045
15136
  var threadInspectionParamsSchema = external_exports.object({
15046
- threadId: hostThreadIdSchema
15137
+ threadId: hostThreadIdSchema,
15138
+ includeReferenceCapability: external_exports.boolean().optional()
15047
15139
  }).strict();
15048
15140
  var codexThreadInspectionSchema = external_exports.object({
15049
15141
  owner: external_exports.literal("codex"),
15050
- locked: external_exports.literal(true)
15142
+ locked: external_exports.literal(true),
15143
+ supportsThreadReferences: external_exports.literal(true).optional()
15051
15144
  }).strict();
15052
15145
  var externalThreadInspectionSchema = external_exports.object({
15053
15146
  owner: external_exports.literal("external"),
@@ -15175,10 +15268,31 @@ var harnessLaunchSettingsSchema = external_exports.object({
15175
15268
  restartRequired: external_exports.boolean()
15176
15269
  }).strict();
15177
15270
 
15271
+ // ../../shared-contracts/dist/harness-installation.js
15272
+ var harnessInstallationParamsSchema = external_exports.object({
15273
+ harnessId: harnessIdSchema,
15274
+ action: external_exports.enum(["check", "update"])
15275
+ }).strict();
15276
+ var harnessInstallationStateSchema = external_exports.object({
15277
+ currentVersion: external_exports.string().min(1).max(128),
15278
+ latestVersion: external_exports.string().min(1).max(128),
15279
+ updateAvailable: external_exports.boolean(),
15280
+ canUpdate: external_exports.boolean(),
15281
+ message: external_exports.string().max(2048).optional()
15282
+ }).strict();
15283
+
15178
15284
  // ../../shared-contracts/dist/codex-accounts.js
15179
15285
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15180
15286
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
15181
15287
  var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
15288
+ var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
15289
+ function isCodexAccountSiteUrl(value) {
15290
+ return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
15291
+ }
15292
+ var externalUrlOpenParamsSchema = external_exports.object({
15293
+ url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
15294
+ }).strict();
15295
+ var externalUrlOpenResultSchema = external_exports.object({}).strict();
15182
15296
  var codexAccountPlanTypeSchema = external_exports.enum([
15183
15297
  "free",
15184
15298
  "go",
@@ -15204,7 +15318,8 @@ var codexAccountSchema = external_exports.object({
15204
15318
  email: external_exports.string().email().max(320).optional(),
15205
15319
  planType: codexAccountPlanTypeSchema.optional(),
15206
15320
  authKind: codexAccountAuthKindSchema.optional(),
15207
- authIdentity: nonBlankTextSchema3.max(256).optional()
15321
+ authIdentity: nonBlankTextSchema3.max(256).optional(),
15322
+ siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
15208
15323
  }).strict();
15209
15324
  var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
15210
15325
  var codexAccountListResultSchema = external_exports.object({
@@ -19917,7 +20032,7 @@ var ClientSideConnection = class {
19917
20032
  };
19918
20033
 
19919
20034
  // dist/command.js
19920
- import path3 from "node:path";
20035
+ import path4 from "node:path";
19921
20036
 
19922
20037
  // ../../harness-discovery/dist/environment.js
19923
20038
  import fs from "node:fs";
@@ -19981,6 +20096,20 @@ function commandInvocation(command, arguments_, environment, platform = process.
19981
20096
  };
19982
20097
  }
19983
20098
 
20099
+ // ../../harness-discovery/dist/node-runtime.js
20100
+ import path3 from "node:path";
20101
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
20102
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
20103
+ const delimiter = platform === "win32" ? ";" : ":";
20104
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
20105
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
20106
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
20107
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
20108
+ directories.push(runtimeDirectory);
20109
+ }
20110
+ return { ...environment, [pathKey]: directories.join(delimiter) };
20111
+ }
20112
+
19984
20113
  // ../../harness-discovery/dist/resolve.js
19985
20114
  import os from "node:os";
19986
20115
 
@@ -20144,6 +20273,60 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
20144
20273
  return void 0;
20145
20274
  }
20146
20275
 
20276
+ // ../../harness-discovery/dist/installation.js
20277
+ import { execFile } from "node:child_process";
20278
+ import { homedir } from "node:os";
20279
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
20280
+ const env = withNodeRuntimeOnPath(environment);
20281
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
20282
+ return new Promise((resolve, reject) => {
20283
+ const child = execFile(invocation.command, invocation.arguments, {
20284
+ env,
20285
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
20286
+ encoding: "utf8",
20287
+ timeout,
20288
+ killSignal: "SIGKILL",
20289
+ maxBuffer: 1024 * 1024,
20290
+ windowsHide: true,
20291
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
20292
+ }, (error51, stdout, stderr) => {
20293
+ if (error51)
20294
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
20295
+ else
20296
+ resolve((stdout || stderr).trim());
20297
+ });
20298
+ child.stdin?.end();
20299
+ });
20300
+ }
20301
+ function createInstallationManager(options) {
20302
+ let checking;
20303
+ let updating;
20304
+ const check2 = () => checking ??= options.check().finally(() => {
20305
+ checking = void 0;
20306
+ });
20307
+ return (action) => {
20308
+ if (updating)
20309
+ return updating;
20310
+ if (action === "check")
20311
+ return check2();
20312
+ updating = (async () => {
20313
+ const before = await check2();
20314
+ if (!before.updateAvailable)
20315
+ return before;
20316
+ if (!before.canUpdate)
20317
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
20318
+ await options.update(before);
20319
+ const after = await check2();
20320
+ if (after.currentVersion === before.currentVersion)
20321
+ throw new Error("The Harness version did not change; check the native updater and retry");
20322
+ return after;
20323
+ })().finally(() => {
20324
+ updating = void 0;
20325
+ });
20326
+ return updating;
20327
+ };
20328
+ }
20329
+
20147
20330
  // dist/command.js
20148
20331
  var HermesExecutableError = class extends Error {
20149
20332
  code = "HERMES_NOT_FOUND";
@@ -20167,7 +20350,7 @@ function resolveHermesExecutable(input = {}) {
20167
20350
  });
20168
20351
  if (!resolution)
20169
20352
  throw new HermesExecutableError("Hermes CLI is not installed");
20170
- return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path3.resolve(resolution.executable);
20353
+ return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
20171
20354
  }
20172
20355
  function hermesInvocation(command, platform = process.platform) {
20173
20356
  return commandInvocation(command, ["acp"], process.env, platform);
@@ -20591,7 +20774,7 @@ var HermesAcpTransport = class {
20591
20774
  // dist/hermes-inventory.js
20592
20775
  import { spawn as spawn2 } from "node:child_process";
20593
20776
  import { access, readFile } from "node:fs/promises";
20594
- import path4 from "node:path";
20777
+ import path5 from "node:path";
20595
20778
 
20596
20779
  // dist/hermes-models.js
20597
20780
  var HERMES_MODE_DEFAULT = "default";
@@ -20764,7 +20947,7 @@ async function venvPythonFromShim(hermesExecutable, platform = process.platform)
20764
20947
  const shim = await readFile(hermesExecutable, "utf8");
20765
20948
  if (platform === "win32") {
20766
20949
  const target = WINDOWS_VENV_HERMES_SHIM_PATTERN.exec(shim)?.[1];
20767
- return target ? path4.win32.join(path4.win32.dirname(target), "python.exe") : null;
20950
+ return target ? path5.win32.join(path5.win32.dirname(target), "python.exe") : null;
20768
20951
  }
20769
20952
  return POSIX_VENV_PYTHON_SHIM_PATTERN.exec(shim)?.[1] ?? null;
20770
20953
  } catch {
@@ -20772,7 +20955,7 @@ async function venvPythonFromShim(hermesExecutable, platform = process.platform)
20772
20955
  }
20773
20956
  }
20774
20957
  function inventoryPythonCandidates(hermesExecutable, platform = process.platform) {
20775
- const pathApi = platform === "win32" ? path4.win32 : path4.posix;
20958
+ const pathApi = platform === "win32" ? path5.win32 : path5.posix;
20776
20959
  const executableDirectory = pathApi.dirname(hermesExecutable);
20777
20960
  const environmentDirectory = pathApi.basename(executableDirectory).toLowerCase();
20778
20961
  const candidates = [];
@@ -20789,7 +20972,7 @@ function inventoryPythonCandidates(hermesExecutable, platform = process.platform
20789
20972
  function runProbe(pythonExecutable, timeoutMs, environment) {
20790
20973
  return new Promise((resolve, reject) => {
20791
20974
  const child = spawn2(pythonExecutable, ["-I", "-c", INVENTORY_PROBE_SCRIPT], {
20792
- cwd: path4.dirname(pythonExecutable),
20975
+ cwd: path5.dirname(pythonExecutable),
20793
20976
  env: { ...process.env, ...environment },
20794
20977
  stdio: ["ignore", "pipe", "pipe"]
20795
20978
  });
@@ -21091,16 +21274,16 @@ var Diff = class {
21091
21274
  }
21092
21275
  }
21093
21276
  }
21094
- addToPath(path7, added, removed, oldPosInc, options) {
21095
- const last = path7.lastComponent;
21277
+ addToPath(path8, added, removed, oldPosInc, options) {
21278
+ const last = path8.lastComponent;
21096
21279
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
21097
21280
  return {
21098
- oldPos: path7.oldPos + oldPosInc,
21281
+ oldPos: path8.oldPos + oldPosInc,
21099
21282
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
21100
21283
  };
21101
21284
  } else {
21102
21285
  return {
21103
- oldPos: path7.oldPos + oldPosInc,
21286
+ oldPos: path8.oldPos + oldPosInc,
21104
21287
  lastComponent: { count: 1, added, removed, previousComponent: last }
21105
21288
  };
21106
21289
  }
@@ -21415,8 +21598,8 @@ function hermesFileChanges(update) {
21415
21598
  for (const block of update.content ?? []) {
21416
21599
  if (block.type !== "diff")
21417
21600
  continue;
21418
- const { path: path7, oldText, newText } = block;
21419
- if (!path7.trim() || /[\0\r\n]/u.test(path7) || typeof newText !== "string")
21601
+ const { path: path8, oldText, newText } = block;
21602
+ if (!path8.trim() || /[\0\r\n]/u.test(path8) || typeof newText !== "string")
21420
21603
  continue;
21421
21604
  if (oldText === newText)
21422
21605
  continue;
@@ -21424,10 +21607,10 @@ function hermesFileChanges(update) {
21424
21607
  if (bytes > MAX_DIFF_BYTES || changes.length === MAX_DIFFS)
21425
21608
  return [];
21426
21609
  changes.push({
21427
- path: path7,
21610
+ path: path8,
21428
21611
  kind: "update",
21429
21612
  diffScope: "fragment",
21430
- unifiedDiff: createTwoFilesPatch(path7, path7, oldText ?? "", newText, "", "", {
21613
+ unifiedDiff: createTwoFilesPatch(path8, path8, oldText ?? "", newText, "", "", {
21431
21614
  context: 3
21432
21615
  })
21433
21616
  });
@@ -22368,7 +22551,7 @@ import { createInterface } from "node:readline";
22368
22551
  // dist/gateway-delegation.js
22369
22552
  import { mkdtemp, writeFile, rm } from "node:fs/promises";
22370
22553
  import os2 from "node:os";
22371
- import path5 from "node:path";
22554
+ import path6 from "node:path";
22372
22555
  var HERMES_DELEGATION_GUIDANCE = `This Session runs inside codexhost.
22373
22556
  When the user authorizes cross-Harness delegation, discover the executable named by CODEXHOST_CLI_PATH through your native terminal tool. Read its --help and harness list, then use delegate start and thread send/read/wait/cancel as documented. Prefer --format compact. Preserve CODEXHOST_RUNTIME_ENDPOINT, CODEXHOST_RUNTIME_TOKEN and CODEXHOST_THREAD_ID in these calls: they identify the Runtime and parent Thread. Never print their values or substitute another executable. Native Hermes delegate_task remains available for Hermes subagents.`;
22374
22557
  var required2 = [
@@ -22381,8 +22564,8 @@ async function prepareGatewayDelegation(environment) {
22381
22564
  if (!required2.every((key) => environment[key]))
22382
22565
  return { environment, bootstrap: "", dispose: async () => {
22383
22566
  } };
22384
- const directory = await mkdtemp(path5.join(os2.tmpdir(), "codexhost-hermes-delegation-"));
22385
- const file2 = path5.join(directory, "SKILL.md");
22567
+ const directory = await mkdtemp(path6.join(os2.tmpdir(), "codexhost-hermes-delegation-"));
22568
+ const file2 = path6.join(directory, "SKILL.md");
22386
22569
  try {
22387
22570
  await writeFile(file2, `---
22388
22571
  name: delegation
@@ -23054,6 +23237,29 @@ var HermesGatewayHistory = class {
23054
23237
  }
23055
23238
  };
23056
23239
 
23240
+ // dist/gateway-configuration.js
23241
+ import { execFile as execFile2 } from "node:child_process";
23242
+ import { promisify } from "node:util";
23243
+ async function resolveGatewayModel(transport, modelId) {
23244
+ if (/\s/u.test(modelId) || modelId.startsWith("-"))
23245
+ throw new Error("Invalid Hermes Model identifier");
23246
+ const result = await promisify(execFile2)(transport.python, [
23247
+ "-I",
23248
+ "-c",
23249
+ "import json,sys\nfrom hermes_cli.models import parse_model_input\np,m=parse_model_input(sys.argv[1], '')\nprint(json.dumps({'provider':p,'model':m}))",
23250
+ modelId
23251
+ ], {
23252
+ cwd: transport.cwd,
23253
+ env: { ...process.env, ...transport.environment },
23254
+ timeout: 2e4,
23255
+ maxBuffer: 1024 * 1024
23256
+ });
23257
+ const value = JSON.parse(result.stdout.trim());
23258
+ if (!value || typeof value !== "object" || !("provider" in value) || !("model" in value) || typeof value.provider !== "string" || typeof value.model !== "string")
23259
+ throw new Error("Hermes returned an invalid Model choice");
23260
+ return { provider: value.provider, model: value.model };
23261
+ }
23262
+
23057
23263
  // dist/gateway-session-transport.js
23058
23264
  var hermesGatewayThinkingOptions = [
23059
23265
  "none",
@@ -23085,14 +23291,14 @@ function gatewayDiff(text2) {
23085
23291
  if (!text2 || text2.length > 1024 * 1024)
23086
23292
  return [];
23087
23293
  const result = [];
23088
- let path7 = "";
23294
+ let path8 = "";
23089
23295
  let inHunk = false;
23090
23296
  let oldLines = [], newLines = [];
23091
23297
  const flush = () => {
23092
- if (path7)
23298
+ if (path8)
23093
23299
  result.push({
23094
23300
  type: "diff",
23095
- path: path7,
23301
+ path: path8,
23096
23302
  oldText: oldLines.join("\n"),
23097
23303
  newText: newLines.join("\n")
23098
23304
  });
@@ -23105,24 +23311,24 @@ function gatewayDiff(text2) {
23105
23311
  if (header) {
23106
23312
  flush();
23107
23313
  inHunk = false;
23108
- path7 = (header[2] === "/dev/null" ? header[1] ?? "" : header[2] ?? "").replace(/^[ab]\//u, "");
23314
+ path8 = (header[2] === "/dev/null" ? header[1] ?? "" : header[2] ?? "").replace(/^[ab]\//u, "");
23109
23315
  continue;
23110
23316
  }
23111
23317
  if (line.startsWith("--- ") && !inHunk) {
23112
23318
  flush();
23113
- path7 = line.slice(4).replace(/^a\//u, "");
23319
+ path8 = line.slice(4).replace(/^a\//u, "");
23114
23320
  } else if (line.startsWith("+++ ") && !inHunk) {
23115
23321
  const next = line.slice(4);
23116
23322
  if (next !== "/dev/null")
23117
- path7 = next.replace(/^b\//u, "");
23323
+ path8 = next.replace(/^b\//u, "");
23118
23324
  } else if (line.startsWith("@@")) {
23119
23325
  inHunk = true;
23120
23326
  continue;
23121
- } else if (path7 && line.startsWith("-"))
23327
+ } else if (path8 && line.startsWith("-"))
23122
23328
  oldLines.push(line.slice(1));
23123
- else if (path7 && line.startsWith("+"))
23329
+ else if (path8 && line.startsWith("+"))
23124
23330
  newLines.push(line.slice(1));
23125
- else if (path7 && line.startsWith(" ")) {
23331
+ else if (path8 && line.startsWith(" ")) {
23126
23332
  oldLines.push(line.slice(1));
23127
23333
  newLines.push(line.slice(1));
23128
23334
  }
@@ -23208,11 +23414,10 @@ var HermesGatewaySessionTransport = class {
23208
23414
  return optionId;
23209
23415
  }
23210
23416
  async setModel(modelId) {
23211
- if (/\s/u.test(modelId) || modelId.startsWith("-"))
23212
- throw new Error("Invalid Hermes Model identifier");
23417
+ const choice = await resolveGatewayModel(this.transport, modelId);
23213
23418
  const result = await this.transport.request("config.set", {
23214
23419
  key: "model",
23215
- value: modelId,
23420
+ value: choice.provider ? `${choice.model} --provider ${choice.provider}` : modelId,
23216
23421
  scope: "session",
23217
23422
  session_id: this.sessionId
23218
23423
  });
@@ -23522,35 +23727,10 @@ var HermesGatewaySessionTransport = class {
23522
23727
  };
23523
23728
 
23524
23729
  // dist/gateway-open.js
23525
- import path6 from "node:path";
23730
+ import path7 from "node:path";
23526
23731
  import { realpath } from "node:fs/promises";
23527
-
23528
- // dist/gateway-configuration.js
23529
- import { execFile } from "node:child_process";
23530
- import { promisify } from "node:util";
23531
- async function resolveGatewayModel(transport, modelId) {
23532
- if (/\s/u.test(modelId) || modelId.startsWith("-"))
23533
- throw new Error("Invalid Hermes Model identifier");
23534
- const result = await promisify(execFile)(transport.python, [
23535
- "-I",
23536
- "-c",
23537
- "import json,sys\nfrom hermes_cli.models import parse_model_input\np,m=parse_model_input(sys.argv[1], '')\nprint(json.dumps({'provider':p,'model':m}))",
23538
- modelId
23539
- ], {
23540
- cwd: transport.cwd,
23541
- env: { ...process.env, ...transport.environment },
23542
- timeout: 2e4,
23543
- maxBuffer: 1024 * 1024
23544
- });
23545
- const value = JSON.parse(result.stdout.trim());
23546
- if (!value || typeof value !== "object" || !("provider" in value) || !("model" in value) || typeof value.provider !== "string" || typeof value.model !== "string")
23547
- throw new Error("Hermes returned an invalid Model choice");
23548
- return { provider: value.provider, model: value.model };
23549
- }
23550
-
23551
- // dist/gateway-open.js
23552
23732
  async function sameDirectory(left, right) {
23553
- return await realpath(left).catch(() => path6.resolve(left)) === await realpath(right).catch(() => path6.resolve(right));
23733
+ return await realpath(left).catch(() => path7.resolve(left)) === await realpath(right).catch(() => path7.resolve(right));
23554
23734
  }
23555
23735
  var gatewayCapabilities = {
23556
23736
  configuration: {
@@ -24138,14 +24318,68 @@ function failure(code, message, retryable = false) {
24138
24318
  return { ok: false, error: { code, message, retryable } };
24139
24319
  }
24140
24320
 
24321
+ // dist/installation.js
24322
+ function createHermesInstallation(environment, command) {
24323
+ let executable;
24324
+ return createInstallationManager({
24325
+ async check() {
24326
+ executable = resolveHermesExecutable({ environment, ...command ? { command } : {} });
24327
+ const run = (args) => runInstallationCommand(executable, args, environment);
24328
+ const versionOutput = await run(["--version"]);
24329
+ const version2 = versionOutput.match(/^Hermes Agent v?([\w.+?-]{1,96})(?:\s|$)/m)?.[1];
24330
+ if (!version2)
24331
+ throw new Error("Hermes returned an unknown version response");
24332
+ const help = await run(["update", "--help"]);
24333
+ if (!help.includes("--plan") || !help.includes("--check"))
24334
+ return {
24335
+ currentVersion: version2,
24336
+ latestVersion: "Unknown",
24337
+ updateAvailable: false,
24338
+ canUpdate: false,
24339
+ message: "This Hermes release does not expose a safe update plan. Use the original installer."
24340
+ };
24341
+ const plan = await run(["update", "--plan"]);
24342
+ const sha = plan.match(/Install:.* @ ([a-f0-9]{8,40})\)/i)?.[1];
24343
+ const currentVersion = `${version2}${sha ? ` @ ${sha}` : ""}`;
24344
+ if (!/Install:\s*git\b/i.test(plan) || /NOT updatable in place/i.test(plan))
24345
+ return {
24346
+ currentVersion,
24347
+ latestVersion: "Unknown",
24348
+ updateAvailable: false,
24349
+ canUpdate: false,
24350
+ message: "This Hermes installation is managed externally. Update it through its desktop app, container, or original package manager."
24351
+ };
24352
+ const output = await run(["update", "--check"]);
24353
+ const updateAvailable = /(?:selected release|update) available/i.test(output);
24354
+ if (!updateAvailable && !/up.to.date/i.test(output))
24355
+ throw new Error("Hermes update check returned an unknown response");
24356
+ const release = output.match(/Selected release available:\s*([\w.+-]+)/i)?.[1];
24357
+ const latestVersion = updateAvailable ? release ?? "Tracking branch (new commits)" : currentVersion;
24358
+ const root = versionOutput.match(/^Install directory:\s*(.+)$/m)?.[1]?.trim();
24359
+ const clean = root ? await runInstallationCommand("git", ["-C", root, "status", "--porcelain"], environment).then((output2) => !output2.trim(), () => false) : false;
24360
+ const canUpdate = !!sha && clean && help.includes("--yes") && help.includes("--no-gateway-restart");
24361
+ return {
24362
+ currentVersion,
24363
+ latestVersion,
24364
+ updateAvailable,
24365
+ canUpdate,
24366
+ message: canUpdate ? "Uses Hermes's configured update channel. Gateway restarts are deferred; existing processes keep their running code." : "Use the native updater manually. Safe non-interactive updates require a clean source checkout, commit identity, and Gateway restart deferral."
24367
+ };
24368
+ },
24369
+ async update() {
24370
+ await runInstallationCommand(executable, ["update", "--yes", "--no-gateway-restart"], environment, 3e5);
24371
+ }
24372
+ });
24373
+ }
24374
+
24141
24375
  // dist/plugin.js
24142
24376
  var HERMES_COMMAND_ENV = "CODEXHOST_HERMES_COMMAND";
24143
24377
  function createHarnessAdapter(context) {
24144
24378
  const environment = { ...context.environment };
24145
- return new HermesAdapter({
24379
+ return Object.assign(new HermesAdapter({
24146
24380
  ...environment[HERMES_COMMAND_ENV] ? { command: environment[HERMES_COMMAND_ENV] } : {},
24147
24381
  environment
24148
- });
24382
+ }), { installation: createHermesInstallation(environment, environment[HERMES_COMMAND_ENV]) });
24149
24383
  }
24150
24384
  export {
24151
24385
  HERMES_COMMAND_ENV,