@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.
@@ -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,6 +14755,10 @@ 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().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,
@@ -14715,12 +14778,27 @@ var threadUsageInspectionSchema = external_exports.object({
14715
14778
  }).strict();
14716
14779
 
14717
14780
  // ../../shared-contracts/dist/harness-accounts.js
14718
- var harnessAccountSnapshotSchema = external_exports.object({
14781
+ var accountBalanceSnapshotSchema = external_exports.object({
14782
+ amount: external_exports.number().finite().nonnegative(),
14783
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
14784
+ currency: external_exports.string().trim().min(1).max(8),
14785
+ /** Native label when the Harness exposes several Billing Sources. */
14786
+ label: external_exports.string().trim().min(1).max(128).optional()
14787
+ }).strict();
14788
+ var harnessAccountSnapshotObject = external_exports.object({
14719
14789
  email: external_exports.string().trim().min(1).max(320).optional(),
14720
14790
  label: external_exports.string().trim().min(1).max(256).optional(),
14721
14791
  plan: external_exports.string().trim().min(1).max(128).optional(),
14722
- credits: accountCreditsSnapshotSchema
14792
+ credits: accountCreditsSnapshotSchema.optional(),
14793
+ balance: accountBalanceSnapshotSchema.optional()
14723
14794
  }).strict();
14795
+ function requireReportedQuota(schema) {
14796
+ return schema.refine((value) => {
14797
+ const reported = value;
14798
+ return reported.credits !== void 0 || reported.balance !== void 0;
14799
+ }, { message: "Account must report either credits or a balance" });
14800
+ }
14801
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
14724
14802
  var harnessAccountIdentityShape = {
14725
14803
  harnessId: harnessIdSchema,
14726
14804
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -14731,11 +14809,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
14731
14809
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
14732
14810
  var harnessAccountInspectResultSchema = external_exports.object({
14733
14811
  ...harnessAccountIdentityShape,
14734
- account: harnessAccountSnapshotSchema.nullable()
14812
+ account: harnessAccountSnapshotSchema.nullable(),
14813
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
14814
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
14735
14815
  }).strict();
14736
14816
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
14737
14817
  var harnessAccountListResultSchema = external_exports.object({
14738
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
14818
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
14739
14819
  }).strict();
14740
14820
 
14741
14821
  // ../../shared-contracts/dist/json-value.js
@@ -14873,6 +14953,8 @@ var harnessModelSchema = external_exports.object({
14873
14953
  ref: harnessModelRefSchema,
14874
14954
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
14875
14955
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
14956
+ /** Optional opaque selection for this same Model with priority processing enabled. */
14957
+ fastModel: harnessModelRefSchema.optional(),
14876
14958
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14877
14959
  }).strict();
14878
14960
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -14905,6 +14987,16 @@ var harnessModelCatalogSchema = external_exports.object({
14905
14987
  });
14906
14988
  }
14907
14989
  refs.add(model.ref.id);
14990
+ if (model.fastModel) {
14991
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
14992
+ context.addIssue({
14993
+ code: "custom",
14994
+ message: "Fast Model refs must be distinct and unique",
14995
+ path: ["models", index, "fastModel"]
14996
+ });
14997
+ }
14998
+ refs.add(model.fastModel.id);
14999
+ }
14908
15000
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14909
15001
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
14910
15002
  if (supportedThinkingIds.has(optionId)) {
@@ -15024,11 +15116,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15024
15116
  thinkingOptionId: harnessThinkingOptionIdSchema
15025
15117
  }).strict();
15026
15118
  var threadInspectionParamsSchema = external_exports.object({
15027
- threadId: hostThreadIdSchema
15119
+ threadId: hostThreadIdSchema,
15120
+ includeReferenceCapability: external_exports.boolean().optional()
15028
15121
  }).strict();
15029
15122
  var codexThreadInspectionSchema = external_exports.object({
15030
15123
  owner: external_exports.literal("codex"),
15031
- locked: external_exports.literal(true)
15124
+ locked: external_exports.literal(true),
15125
+ supportsThreadReferences: external_exports.literal(true).optional()
15032
15126
  }).strict();
15033
15127
  var externalThreadInspectionSchema = external_exports.object({
15034
15128
  owner: external_exports.literal("external"),
@@ -15154,6 +15248,19 @@ var harnessLaunchSettingsSchema = external_exports.object({
15154
15248
  restartRequired: external_exports.boolean()
15155
15249
  }).strict();
15156
15250
 
15251
+ // ../../shared-contracts/dist/harness-installation.js
15252
+ var harnessInstallationParamsSchema = external_exports.object({
15253
+ harnessId: harnessIdSchema,
15254
+ action: external_exports.enum(["check", "update"])
15255
+ }).strict();
15256
+ var harnessInstallationStateSchema = external_exports.object({
15257
+ currentVersion: external_exports.string().min(1).max(128),
15258
+ latestVersion: external_exports.string().min(1).max(128),
15259
+ updateAvailable: external_exports.boolean(),
15260
+ canUpdate: external_exports.boolean(),
15261
+ message: external_exports.string().max(2048).optional()
15262
+ }).strict();
15263
+
15157
15264
  // ../../shared-contracts/dist/codex-accounts.js
15158
15265
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15159
15266
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
@@ -19893,7 +20000,7 @@ var ClientSideConnection = class {
19893
20000
  };
19894
20001
 
19895
20002
  // dist/command.js
19896
- import path3 from "node:path";
20003
+ import path4 from "node:path";
19897
20004
 
19898
20005
  // ../../harness-discovery/dist/environment.js
19899
20006
  import fs from "node:fs";
@@ -19957,6 +20064,20 @@ function commandInvocation(command, arguments_, environment, platform = process.
19957
20064
  };
19958
20065
  }
19959
20066
 
20067
+ // ../../harness-discovery/dist/node-runtime.js
20068
+ import path3 from "node:path";
20069
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
20070
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
20071
+ const delimiter = platform === "win32" ? ";" : ":";
20072
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
20073
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
20074
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
20075
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
20076
+ directories.push(runtimeDirectory);
20077
+ }
20078
+ return { ...environment, [pathKey]: directories.join(delimiter) };
20079
+ }
20080
+
19960
20081
  // ../../harness-discovery/dist/resolve.js
19961
20082
  import os from "node:os";
19962
20083
 
@@ -20120,6 +20241,60 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
20120
20241
  return void 0;
20121
20242
  }
20122
20243
 
20244
+ // ../../harness-discovery/dist/installation.js
20245
+ import { execFile } from "node:child_process";
20246
+ import { homedir } from "node:os";
20247
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
20248
+ const env = withNodeRuntimeOnPath(environment);
20249
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
20250
+ return new Promise((resolve, reject) => {
20251
+ const child = execFile(invocation.command, invocation.arguments, {
20252
+ env,
20253
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
20254
+ encoding: "utf8",
20255
+ timeout,
20256
+ killSignal: "SIGKILL",
20257
+ maxBuffer: 1024 * 1024,
20258
+ windowsHide: true,
20259
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
20260
+ }, (error51, stdout, stderr) => {
20261
+ if (error51)
20262
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
20263
+ else
20264
+ resolve((stdout || stderr).trim());
20265
+ });
20266
+ child.stdin?.end();
20267
+ });
20268
+ }
20269
+ function createInstallationManager(options) {
20270
+ let checking;
20271
+ let updating;
20272
+ const check2 = () => checking ??= options.check().finally(() => {
20273
+ checking = void 0;
20274
+ });
20275
+ return (action) => {
20276
+ if (updating)
20277
+ return updating;
20278
+ if (action === "check")
20279
+ return check2();
20280
+ updating = (async () => {
20281
+ const before = await check2();
20282
+ if (!before.updateAvailable)
20283
+ return before;
20284
+ if (!before.canUpdate)
20285
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
20286
+ await options.update(before);
20287
+ const after = await check2();
20288
+ if (after.currentVersion === before.currentVersion)
20289
+ throw new Error("The Harness version did not change; check the native updater and retry");
20290
+ return after;
20291
+ })().finally(() => {
20292
+ updating = void 0;
20293
+ });
20294
+ return updating;
20295
+ };
20296
+ }
20297
+
20123
20298
  // dist/command.js
20124
20299
  var HermesExecutableError = class extends Error {
20125
20300
  code = "HERMES_NOT_FOUND";
@@ -20143,7 +20318,7 @@ function resolveHermesExecutable(input = {}) {
20143
20318
  });
20144
20319
  if (!resolution)
20145
20320
  throw new HermesExecutableError("Hermes CLI is not installed");
20146
- return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path3.resolve(resolution.executable);
20321
+ return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
20147
20322
  }
20148
20323
  function hermesInvocation(command, platform = process.platform) {
20149
20324
  return commandInvocation(command, ["acp"], process.env, platform);
@@ -20567,7 +20742,7 @@ var HermesAcpTransport = class {
20567
20742
  // dist/hermes-inventory.js
20568
20743
  import { spawn as spawn2 } from "node:child_process";
20569
20744
  import { access, readFile } from "node:fs/promises";
20570
- import path4 from "node:path";
20745
+ import path5 from "node:path";
20571
20746
 
20572
20747
  // dist/hermes-models.js
20573
20748
  var HERMES_MODE_DEFAULT = "default";
@@ -20740,7 +20915,7 @@ async function venvPythonFromShim(hermesExecutable, platform = process.platform)
20740
20915
  const shim = await readFile(hermesExecutable, "utf8");
20741
20916
  if (platform === "win32") {
20742
20917
  const target = WINDOWS_VENV_HERMES_SHIM_PATTERN.exec(shim)?.[1];
20743
- return target ? path4.win32.join(path4.win32.dirname(target), "python.exe") : null;
20918
+ return target ? path5.win32.join(path5.win32.dirname(target), "python.exe") : null;
20744
20919
  }
20745
20920
  return POSIX_VENV_PYTHON_SHIM_PATTERN.exec(shim)?.[1] ?? null;
20746
20921
  } catch {
@@ -20748,7 +20923,7 @@ async function venvPythonFromShim(hermesExecutable, platform = process.platform)
20748
20923
  }
20749
20924
  }
20750
20925
  function inventoryPythonCandidates(hermesExecutable, platform = process.platform) {
20751
- const pathApi = platform === "win32" ? path4.win32 : path4.posix;
20926
+ const pathApi = platform === "win32" ? path5.win32 : path5.posix;
20752
20927
  const executableDirectory = pathApi.dirname(hermesExecutable);
20753
20928
  const environmentDirectory = pathApi.basename(executableDirectory).toLowerCase();
20754
20929
  const candidates = [];
@@ -20765,7 +20940,7 @@ function inventoryPythonCandidates(hermesExecutable, platform = process.platform
20765
20940
  function runProbe(pythonExecutable, timeoutMs, environment) {
20766
20941
  return new Promise((resolve, reject) => {
20767
20942
  const child = spawn2(pythonExecutable, ["-I", "-c", INVENTORY_PROBE_SCRIPT], {
20768
- cwd: path4.dirname(pythonExecutable),
20943
+ cwd: path5.dirname(pythonExecutable),
20769
20944
  env: { ...process.env, ...environment },
20770
20945
  stdio: ["ignore", "pipe", "pipe"]
20771
20946
  });
@@ -21067,16 +21242,16 @@ var Diff = class {
21067
21242
  }
21068
21243
  }
21069
21244
  }
21070
- addToPath(path7, added, removed, oldPosInc, options) {
21071
- const last = path7.lastComponent;
21245
+ addToPath(path8, added, removed, oldPosInc, options) {
21246
+ const last = path8.lastComponent;
21072
21247
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
21073
21248
  return {
21074
- oldPos: path7.oldPos + oldPosInc,
21249
+ oldPos: path8.oldPos + oldPosInc,
21075
21250
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
21076
21251
  };
21077
21252
  } else {
21078
21253
  return {
21079
- oldPos: path7.oldPos + oldPosInc,
21254
+ oldPos: path8.oldPos + oldPosInc,
21080
21255
  lastComponent: { count: 1, added, removed, previousComponent: last }
21081
21256
  };
21082
21257
  }
@@ -21391,8 +21566,8 @@ function hermesFileChanges(update) {
21391
21566
  for (const block of update.content ?? []) {
21392
21567
  if (block.type !== "diff")
21393
21568
  continue;
21394
- const { path: path7, oldText, newText } = block;
21395
- if (!path7.trim() || /[\0\r\n]/u.test(path7) || typeof newText !== "string")
21569
+ const { path: path8, oldText, newText } = block;
21570
+ if (!path8.trim() || /[\0\r\n]/u.test(path8) || typeof newText !== "string")
21396
21571
  continue;
21397
21572
  if (oldText === newText)
21398
21573
  continue;
@@ -21400,10 +21575,10 @@ function hermesFileChanges(update) {
21400
21575
  if (bytes > MAX_DIFF_BYTES || changes.length === MAX_DIFFS)
21401
21576
  return [];
21402
21577
  changes.push({
21403
- path: path7,
21578
+ path: path8,
21404
21579
  kind: "update",
21405
21580
  diffScope: "fragment",
21406
- unifiedDiff: createTwoFilesPatch(path7, path7, oldText ?? "", newText, "", "", {
21581
+ unifiedDiff: createTwoFilesPatch(path8, path8, oldText ?? "", newText, "", "", {
21407
21582
  context: 3
21408
21583
  })
21409
21584
  });
@@ -22344,7 +22519,7 @@ import { createInterface } from "node:readline";
22344
22519
  // dist/gateway-delegation.js
22345
22520
  import { mkdtemp, writeFile, rm } from "node:fs/promises";
22346
22521
  import os2 from "node:os";
22347
- import path5 from "node:path";
22522
+ import path6 from "node:path";
22348
22523
  var HERMES_DELEGATION_GUIDANCE = `This Session runs inside codexhost.
22349
22524
  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.`;
22350
22525
  var required2 = [
@@ -22357,8 +22532,8 @@ async function prepareGatewayDelegation(environment) {
22357
22532
  if (!required2.every((key) => environment[key]))
22358
22533
  return { environment, bootstrap: "", dispose: async () => {
22359
22534
  } };
22360
- const directory = await mkdtemp(path5.join(os2.tmpdir(), "codexhost-hermes-delegation-"));
22361
- const file2 = path5.join(directory, "SKILL.md");
22535
+ const directory = await mkdtemp(path6.join(os2.tmpdir(), "codexhost-hermes-delegation-"));
22536
+ const file2 = path6.join(directory, "SKILL.md");
22362
22537
  try {
22363
22538
  await writeFile(file2, `---
22364
22539
  name: delegation
@@ -23030,6 +23205,29 @@ var HermesGatewayHistory = class {
23030
23205
  }
23031
23206
  };
23032
23207
 
23208
+ // dist/gateway-configuration.js
23209
+ import { execFile as execFile2 } from "node:child_process";
23210
+ import { promisify } from "node:util";
23211
+ async function resolveGatewayModel(transport, modelId) {
23212
+ if (/\s/u.test(modelId) || modelId.startsWith("-"))
23213
+ throw new Error("Invalid Hermes Model identifier");
23214
+ const result = await promisify(execFile2)(transport.python, [
23215
+ "-I",
23216
+ "-c",
23217
+ "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}))",
23218
+ modelId
23219
+ ], {
23220
+ cwd: transport.cwd,
23221
+ env: { ...process.env, ...transport.environment },
23222
+ timeout: 2e4,
23223
+ maxBuffer: 1024 * 1024
23224
+ });
23225
+ const value = JSON.parse(result.stdout.trim());
23226
+ if (!value || typeof value !== "object" || !("provider" in value) || !("model" in value) || typeof value.provider !== "string" || typeof value.model !== "string")
23227
+ throw new Error("Hermes returned an invalid Model choice");
23228
+ return { provider: value.provider, model: value.model };
23229
+ }
23230
+
23033
23231
  // dist/gateway-session-transport.js
23034
23232
  var hermesGatewayThinkingOptions = [
23035
23233
  "none",
@@ -23061,14 +23259,14 @@ function gatewayDiff(text2) {
23061
23259
  if (!text2 || text2.length > 1024 * 1024)
23062
23260
  return [];
23063
23261
  const result = [];
23064
- let path7 = "";
23262
+ let path8 = "";
23065
23263
  let inHunk = false;
23066
23264
  let oldLines = [], newLines = [];
23067
23265
  const flush = () => {
23068
- if (path7)
23266
+ if (path8)
23069
23267
  result.push({
23070
23268
  type: "diff",
23071
- path: path7,
23269
+ path: path8,
23072
23270
  oldText: oldLines.join("\n"),
23073
23271
  newText: newLines.join("\n")
23074
23272
  });
@@ -23081,24 +23279,24 @@ function gatewayDiff(text2) {
23081
23279
  if (header) {
23082
23280
  flush();
23083
23281
  inHunk = false;
23084
- path7 = (header[2] === "/dev/null" ? header[1] ?? "" : header[2] ?? "").replace(/^[ab]\//u, "");
23282
+ path8 = (header[2] === "/dev/null" ? header[1] ?? "" : header[2] ?? "").replace(/^[ab]\//u, "");
23085
23283
  continue;
23086
23284
  }
23087
23285
  if (line.startsWith("--- ") && !inHunk) {
23088
23286
  flush();
23089
- path7 = line.slice(4).replace(/^a\//u, "");
23287
+ path8 = line.slice(4).replace(/^a\//u, "");
23090
23288
  } else if (line.startsWith("+++ ") && !inHunk) {
23091
23289
  const next = line.slice(4);
23092
23290
  if (next !== "/dev/null")
23093
- path7 = next.replace(/^b\//u, "");
23291
+ path8 = next.replace(/^b\//u, "");
23094
23292
  } else if (line.startsWith("@@")) {
23095
23293
  inHunk = true;
23096
23294
  continue;
23097
- } else if (path7 && line.startsWith("-"))
23295
+ } else if (path8 && line.startsWith("-"))
23098
23296
  oldLines.push(line.slice(1));
23099
- else if (path7 && line.startsWith("+"))
23297
+ else if (path8 && line.startsWith("+"))
23100
23298
  newLines.push(line.slice(1));
23101
- else if (path7 && line.startsWith(" ")) {
23299
+ else if (path8 && line.startsWith(" ")) {
23102
23300
  oldLines.push(line.slice(1));
23103
23301
  newLines.push(line.slice(1));
23104
23302
  }
@@ -23184,11 +23382,10 @@ var HermesGatewaySessionTransport = class {
23184
23382
  return optionId;
23185
23383
  }
23186
23384
  async setModel(modelId) {
23187
- if (/\s/u.test(modelId) || modelId.startsWith("-"))
23188
- throw new Error("Invalid Hermes Model identifier");
23385
+ const choice = await resolveGatewayModel(this.transport, modelId);
23189
23386
  const result = await this.transport.request("config.set", {
23190
23387
  key: "model",
23191
- value: modelId,
23388
+ value: choice.provider ? `${choice.model} --provider ${choice.provider}` : modelId,
23192
23389
  scope: "session",
23193
23390
  session_id: this.sessionId
23194
23391
  });
@@ -23498,35 +23695,10 @@ var HermesGatewaySessionTransport = class {
23498
23695
  };
23499
23696
 
23500
23697
  // dist/gateway-open.js
23501
- import path6 from "node:path";
23698
+ import path7 from "node:path";
23502
23699
  import { realpath } from "node:fs/promises";
23503
-
23504
- // dist/gateway-configuration.js
23505
- import { execFile } from "node:child_process";
23506
- import { promisify } from "node:util";
23507
- async function resolveGatewayModel(transport, modelId) {
23508
- if (/\s/u.test(modelId) || modelId.startsWith("-"))
23509
- throw new Error("Invalid Hermes Model identifier");
23510
- const result = await promisify(execFile)(transport.python, [
23511
- "-I",
23512
- "-c",
23513
- "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}))",
23514
- modelId
23515
- ], {
23516
- cwd: transport.cwd,
23517
- env: { ...process.env, ...transport.environment },
23518
- timeout: 2e4,
23519
- maxBuffer: 1024 * 1024
23520
- });
23521
- const value = JSON.parse(result.stdout.trim());
23522
- if (!value || typeof value !== "object" || !("provider" in value) || !("model" in value) || typeof value.provider !== "string" || typeof value.model !== "string")
23523
- throw new Error("Hermes returned an invalid Model choice");
23524
- return { provider: value.provider, model: value.model };
23525
- }
23526
-
23527
- // dist/gateway-open.js
23528
23700
  async function sameDirectory(left, right) {
23529
- return await realpath(left).catch(() => path6.resolve(left)) === await realpath(right).catch(() => path6.resolve(right));
23701
+ return await realpath(left).catch(() => path7.resolve(left)) === await realpath(right).catch(() => path7.resolve(right));
23530
23702
  }
23531
23703
  var gatewayCapabilities = {
23532
23704
  configuration: {
@@ -24114,14 +24286,68 @@ function failure(code, message, retryable = false) {
24114
24286
  return { ok: false, error: { code, message, retryable } };
24115
24287
  }
24116
24288
 
24289
+ // dist/installation.js
24290
+ function createHermesInstallation(environment, command) {
24291
+ let executable;
24292
+ return createInstallationManager({
24293
+ async check() {
24294
+ executable = resolveHermesExecutable({ environment, ...command ? { command } : {} });
24295
+ const run = (args) => runInstallationCommand(executable, args, environment);
24296
+ const versionOutput = await run(["--version"]);
24297
+ const version2 = versionOutput.match(/^Hermes Agent v?([\w.+?-]{1,96})(?:\s|$)/m)?.[1];
24298
+ if (!version2)
24299
+ throw new Error("Hermes returned an unknown version response");
24300
+ const help = await run(["update", "--help"]);
24301
+ if (!help.includes("--plan") || !help.includes("--check"))
24302
+ return {
24303
+ currentVersion: version2,
24304
+ latestVersion: "Unknown",
24305
+ updateAvailable: false,
24306
+ canUpdate: false,
24307
+ message: "This Hermes release does not expose a safe update plan. Use the original installer."
24308
+ };
24309
+ const plan = await run(["update", "--plan"]);
24310
+ const sha = plan.match(/Install:.* @ ([a-f0-9]{8,40})\)/i)?.[1];
24311
+ const currentVersion = `${version2}${sha ? ` @ ${sha}` : ""}`;
24312
+ if (!/Install:\s*git\b/i.test(plan) || /NOT updatable in place/i.test(plan))
24313
+ return {
24314
+ currentVersion,
24315
+ latestVersion: "Unknown",
24316
+ updateAvailable: false,
24317
+ canUpdate: false,
24318
+ message: "This Hermes installation is managed externally. Update it through its desktop app, container, or original package manager."
24319
+ };
24320
+ const output = await run(["update", "--check"]);
24321
+ const updateAvailable = /(?:selected release|update) available/i.test(output);
24322
+ if (!updateAvailable && !/up.to.date/i.test(output))
24323
+ throw new Error("Hermes update check returned an unknown response");
24324
+ const release = output.match(/Selected release available:\s*([\w.+-]+)/i)?.[1];
24325
+ const latestVersion = updateAvailable ? release ?? "Tracking branch (new commits)" : currentVersion;
24326
+ const root = versionOutput.match(/^Install directory:\s*(.+)$/m)?.[1]?.trim();
24327
+ const clean = root ? await runInstallationCommand("git", ["-C", root, "status", "--porcelain"], environment).then((output2) => !output2.trim(), () => false) : false;
24328
+ const canUpdate = !!sha && clean && help.includes("--yes") && help.includes("--no-gateway-restart");
24329
+ return {
24330
+ currentVersion,
24331
+ latestVersion,
24332
+ updateAvailable,
24333
+ canUpdate,
24334
+ 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."
24335
+ };
24336
+ },
24337
+ async update() {
24338
+ await runInstallationCommand(executable, ["update", "--yes", "--no-gateway-restart"], environment, 3e5);
24339
+ }
24340
+ });
24341
+ }
24342
+
24117
24343
  // dist/plugin.js
24118
24344
  var HERMES_COMMAND_ENV = "CODEXHOST_HERMES_COMMAND";
24119
24345
  function createHarnessAdapter(context) {
24120
24346
  const environment = { ...context.environment };
24121
- return new HermesAdapter({
24347
+ return Object.assign(new HermesAdapter({
24122
24348
  ...environment[HERMES_COMMAND_ENV] ? { command: environment[HERMES_COMMAND_ENV] } : {},
24123
24349
  environment
24124
- });
24350
+ }), { installation: createHermesInstallation(environment, environment[HERMES_COMMAND_ENV]) });
24125
24351
  }
24126
24352
  export {
24127
24353
  HERMES_COMMAND_ENV,