@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.
@@ -105,16 +105,16 @@ var Diff = class {
105
105
  }
106
106
  }
107
107
  }
108
- addToPath(path5, added, removed, oldPosInc, options) {
109
- const last = path5.lastComponent;
108
+ addToPath(path7, added, removed, oldPosInc, options) {
109
+ const last = path7.lastComponent;
110
110
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
111
111
  return {
112
- oldPos: path5.oldPos + oldPosInc,
112
+ oldPos: path7.oldPos + oldPosInc,
113
113
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
114
114
  };
115
115
  } else {
116
116
  return {
117
- oldPos: path5.oldPos + oldPosInc,
117
+ oldPos: path7.oldPos + oldPosInc,
118
118
  lastComponent: { count: 1, added, removed, previousComponent: last }
119
119
  };
120
120
  }
@@ -528,7 +528,7 @@ function splitLines(text) {
528
528
  // dist/omp-adapter.js
529
529
  import { randomUUID as randomUUID2 } from "node:crypto";
530
530
  import { realpath as realpath2, stat } from "node:fs/promises";
531
- import path4 from "node:path";
531
+ import path5 from "node:path";
532
532
 
533
533
  // ../../../node_modules/zod/v4/classic/external.js
534
534
  var external_exports = {};
@@ -1296,10 +1296,10 @@ function mergeDefs(...defs) {
1296
1296
  function cloneDef(schema) {
1297
1297
  return mergeDefs(schema._zod.def);
1298
1298
  }
1299
- function getElementAtPath(obj, path5) {
1300
- if (!path5)
1299
+ function getElementAtPath(obj, path7) {
1300
+ if (!path7)
1301
1301
  return obj;
1302
- return path5.reduce((acc, key) => acc?.[key], obj);
1302
+ return path7.reduce((acc, key) => acc?.[key], obj);
1303
1303
  }
1304
1304
  function promiseAllObject(promisesObj) {
1305
1305
  const keys = Object.keys(promisesObj);
@@ -1708,11 +1708,11 @@ function explicitlyAborted(x, startIndex = 0) {
1708
1708
  }
1709
1709
  return false;
1710
1710
  }
1711
- function prefixIssues(path5, issues) {
1711
+ function prefixIssues(path7, issues) {
1712
1712
  return issues.map((iss) => {
1713
1713
  var _a3;
1714
1714
  (_a3 = iss).path ?? (_a3.path = []);
1715
- iss.path.unshift(path5);
1715
+ iss.path.unshift(path7);
1716
1716
  return iss;
1717
1717
  });
1718
1718
  }
@@ -1859,16 +1859,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1859
1859
  }
1860
1860
  function formatError(error51, mapper = (issue2) => issue2.message) {
1861
1861
  const fieldErrors = { _errors: [] };
1862
- const processError = (error52, path5 = []) => {
1862
+ const processError = (error52, path7 = []) => {
1863
1863
  for (const issue2 of error52.issues) {
1864
1864
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1865
- issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
1865
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1866
1866
  } else if (issue2.code === "invalid_key") {
1867
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1867
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1868
1868
  } else if (issue2.code === "invalid_element") {
1869
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1869
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1870
1870
  } else {
1871
- const fullpath = [...path5, ...issue2.path];
1871
+ const fullpath = [...path7, ...issue2.path];
1872
1872
  if (fullpath.length === 0) {
1873
1873
  fieldErrors._errors.push(mapper(issue2));
1874
1874
  } else {
@@ -1895,17 +1895,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1895
1895
  }
1896
1896
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1897
1897
  const result = { errors: [] };
1898
- const processError = (error52, path5 = []) => {
1898
+ const processError = (error52, path7 = []) => {
1899
1899
  var _a3, _b;
1900
1900
  for (const issue2 of error52.issues) {
1901
1901
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1902
- issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
1902
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1903
1903
  } else if (issue2.code === "invalid_key") {
1904
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1904
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1905
1905
  } else if (issue2.code === "invalid_element") {
1906
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1906
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1907
1907
  } else {
1908
- const fullpath = [...path5, ...issue2.path];
1908
+ const fullpath = [...path7, ...issue2.path];
1909
1909
  if (fullpath.length === 0) {
1910
1910
  result.errors.push(mapper(issue2));
1911
1911
  continue;
@@ -1937,8 +1937,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1937
1937
  }
1938
1938
  function toDotPath(_path) {
1939
1939
  const segs = [];
1940
- const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1941
- for (const seg of path5) {
1940
+ const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1941
+ for (const seg of path7) {
1942
1942
  if (typeof seg === "number")
1943
1943
  segs.push(`[${seg}]`);
1944
1944
  else if (typeof seg === "symbol")
@@ -14630,13 +14630,13 @@ function resolveRef(ref, ctx) {
14630
14630
  if (!ref.startsWith("#")) {
14631
14631
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14632
14632
  }
14633
- const path5 = ref.slice(1).split("/").filter(Boolean);
14634
- if (path5.length === 0) {
14633
+ const path7 = ref.slice(1).split("/").filter(Boolean);
14634
+ if (path7.length === 0) {
14635
14635
  return ctx.rootSchema;
14636
14636
  }
14637
14637
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14638
- if (path5[0] === defsKey) {
14639
- const key = path5[1];
14638
+ if (path7[0] === defsKey) {
14639
+ const key = path7[1];
14640
14640
  if (!key || !ctx.defs[key]) {
14641
14641
  throw new Error(`Reference not found: ${ref}`);
14642
14642
  }
@@ -15099,6 +15099,55 @@ var credentialImportsParamsSchema = external_exports.object({
15099
15099
  request: credentialImportsRequestSchema
15100
15100
  }).strict();
15101
15101
 
15102
+ // ../../shared-contracts/dist/harness-display-settings.js
15103
+ var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
15104
+ agent: external_exports.string().min(1).max(128),
15105
+ section: external_exports.enum(["main", "more", "auto"])
15106
+ })).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
15107
+ var harnessDisplaySettingsSchema = external_exports.strictObject({
15108
+ entries: harnessDisplayEntriesSchema.nullable()
15109
+ });
15110
+ var harnessDisplayGetSchema = external_exports.strictObject({});
15111
+ var harnessDisplaySetSchema = external_exports.strictObject({
15112
+ entries: harnessDisplayEntriesSchema,
15113
+ /** Import legacy Desktop preferences only if no shared settings exist yet. */
15114
+ initializeOnly: external_exports.boolean().optional()
15115
+ });
15116
+
15117
+ // ../../shared-contracts/dist/console.js
15118
+ var consoleAnnouncementSchema = external_exports.strictObject({
15119
+ title: external_exports.string().trim().min(1).max(200),
15120
+ type: external_exports.enum(["info", "warning", "danger"]),
15121
+ body: external_exports.string().trim().min(1).max(16 * 1024)
15122
+ });
15123
+ var consoleOpenParamsSchema = external_exports.strictObject({});
15124
+ var consoleOpenResultSchema = external_exports.strictObject({
15125
+ /** The console address. */
15126
+ url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
15127
+ });
15128
+ var CONSOLE_HOST_METHODS = Object.freeze([
15129
+ "codexhost/harness/plugins/list",
15130
+ "codexhost/harness/display-settings/get",
15131
+ "codexhost/harness/display-settings/set",
15132
+ "codexhost/harness/inspect",
15133
+ "codexhost/harness/launch-settings/get",
15134
+ "codexhost/harness/launch-settings/set",
15135
+ "codexhost/harness/web-ui/open",
15136
+ "codexhost/harness/accounts/sources",
15137
+ "codexhost/harness/accounts/list",
15138
+ "codexhost/harness/accounts/inspect",
15139
+ "codexhost/harness/credential-imports",
15140
+ "codexhost/harness/session-import/sources",
15141
+ "codexhost/harness/session-import/list",
15142
+ "codexhost/harness/session-import/import",
15143
+ "codexhost/account/list",
15144
+ "codexhost/account/refresh",
15145
+ "codexhost/account/usage/inspect",
15146
+ "codexhost/update/check",
15147
+ "codexhost/update/start",
15148
+ "codexhost/update/status"
15149
+ ]);
15150
+
15102
15151
  // ../../shared-contracts/dist/version.js
15103
15152
  var WORKSPACE_CONTRACT_VERSION = 1;
15104
15153
 
@@ -15152,6 +15201,12 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
15152
15201
  var hostItemIdSchema = opaqueIdSchema.brand();
15153
15202
  var hostInteractionIdSchema = opaqueIdSchema.brand();
15154
15203
 
15204
+ // ../../shared-contracts/dist/manual-compaction.js
15205
+ var threadManualCompactionStartedSchema = external_exports.strictObject({
15206
+ threadId: hostThreadIdSchema,
15207
+ turnId: hostTurnIdSchema
15208
+ });
15209
+
15155
15210
  // ../../shared-contracts/dist/thread-usage.js
15156
15211
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15157
15212
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -15212,6 +15267,10 @@ var threadUsageSnapshotSchema = external_exports.object({
15212
15267
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
15213
15268
  var accountCreditsProductUsageSchema = external_exports.object({
15214
15269
  product: external_exports.string().min(1),
15270
+ used: external_exports.number().finite().nonnegative().optional(),
15271
+ // Zero is a real empty cap, not an absent field.
15272
+ limit: external_exports.number().finite().nonnegative().optional(),
15273
+ unit: external_exports.string().min(1).max(32).optional(),
15215
15274
  usagePercent: usagePercentSchema,
15216
15275
  resetsAt: external_exports.string().min(1).optional()
15217
15276
  }).strict();
@@ -15221,6 +15280,10 @@ var accountResetCreditsSchema = external_exports.object({
15221
15280
  expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
15222
15281
  }).strict();
15223
15282
  var accountCreditsSnapshotSchema = external_exports.object({
15283
+ used: external_exports.number().finite().nonnegative().optional(),
15284
+ // Zero is a real empty cap, not an absent field.
15285
+ limit: external_exports.number().finite().nonnegative().optional(),
15286
+ unit: external_exports.string().min(1).max(32).optional(),
15224
15287
  /** Native label when the primary limit is scoped to a model or product group. */
15225
15288
  label: external_exports.string().min(1).optional(),
15226
15289
  usedPercent: usagePercentSchema,
@@ -15240,12 +15303,27 @@ var threadUsageInspectionSchema = external_exports.object({
15240
15303
  }).strict();
15241
15304
 
15242
15305
  // ../../shared-contracts/dist/harness-accounts.js
15243
- var harnessAccountSnapshotSchema = external_exports.object({
15306
+ var accountBalanceSnapshotSchema = external_exports.object({
15307
+ amount: external_exports.number().finite().nonnegative(),
15308
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
15309
+ currency: external_exports.string().trim().min(1).max(8),
15310
+ /** Native label when the Harness exposes several Billing Sources. */
15311
+ label: external_exports.string().trim().min(1).max(128).optional()
15312
+ }).strict();
15313
+ var harnessAccountSnapshotObject = external_exports.object({
15244
15314
  email: external_exports.string().trim().min(1).max(320).optional(),
15245
15315
  label: external_exports.string().trim().min(1).max(256).optional(),
15246
15316
  plan: external_exports.string().trim().min(1).max(128).optional(),
15247
- credits: accountCreditsSnapshotSchema
15317
+ credits: accountCreditsSnapshotSchema.optional(),
15318
+ balance: accountBalanceSnapshotSchema.optional()
15248
15319
  }).strict();
15320
+ function requireReportedQuota(schema) {
15321
+ return schema.refine((value) => {
15322
+ const reported = value;
15323
+ return reported.credits !== void 0 || reported.balance !== void 0;
15324
+ }, { message: "Account must report either credits or a balance" });
15325
+ }
15326
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
15249
15327
  var harnessAccountIdentityShape = {
15250
15328
  harnessId: harnessIdSchema,
15251
15329
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -15256,11 +15334,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
15256
15334
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
15257
15335
  var harnessAccountInspectResultSchema = external_exports.object({
15258
15336
  ...harnessAccountIdentityShape,
15259
- account: harnessAccountSnapshotSchema.nullable()
15337
+ account: harnessAccountSnapshotSchema.nullable(),
15338
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
15339
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
15260
15340
  }).strict();
15261
15341
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
15262
15342
  var harnessAccountListResultSchema = external_exports.object({
15263
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
15343
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
15264
15344
  }).strict();
15265
15345
 
15266
15346
  // ../../shared-contracts/dist/json-value.js
@@ -15398,6 +15478,8 @@ var harnessModelSchema = external_exports.object({
15398
15478
  ref: harnessModelRefSchema,
15399
15479
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
15400
15480
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15481
+ /** Optional opaque selection for this same Model with priority processing enabled. */
15482
+ fastModel: harnessModelRefSchema.optional(),
15401
15483
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
15402
15484
  }).strict();
15403
15485
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -15430,6 +15512,16 @@ var harnessModelCatalogSchema = external_exports.object({
15430
15512
  });
15431
15513
  }
15432
15514
  refs.add(model.ref.id);
15515
+ if (model.fastModel) {
15516
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15517
+ context.addIssue({
15518
+ code: "custom",
15519
+ message: "Fast Model refs must be distinct and unique",
15520
+ path: ["models", index, "fastModel"]
15521
+ });
15522
+ }
15523
+ refs.add(model.fastModel.id);
15524
+ }
15433
15525
  const supportedThinkingIds = /* @__PURE__ */ new Set();
15434
15526
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
15435
15527
  if (supportedThinkingIds.has(optionId)) {
@@ -15549,11 +15641,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15549
15641
  thinkingOptionId: harnessThinkingOptionIdSchema
15550
15642
  }).strict();
15551
15643
  var threadInspectionParamsSchema = external_exports.object({
15552
- threadId: hostThreadIdSchema
15644
+ threadId: hostThreadIdSchema,
15645
+ includeReferenceCapability: external_exports.boolean().optional()
15553
15646
  }).strict();
15554
15647
  var codexThreadInspectionSchema = external_exports.object({
15555
15648
  owner: external_exports.literal("codex"),
15556
- locked: external_exports.literal(true)
15649
+ locked: external_exports.literal(true),
15650
+ supportsThreadReferences: external_exports.literal(true).optional()
15557
15651
  }).strict();
15558
15652
  var externalThreadInspectionSchema = external_exports.object({
15559
15653
  owner: external_exports.literal("external"),
@@ -15679,6 +15773,19 @@ var harnessLaunchSettingsSchema = external_exports.object({
15679
15773
  restartRequired: external_exports.boolean()
15680
15774
  }).strict();
15681
15775
 
15776
+ // ../../shared-contracts/dist/harness-installation.js
15777
+ var harnessInstallationParamsSchema = external_exports.object({
15778
+ harnessId: harnessIdSchema,
15779
+ action: external_exports.enum(["check", "update"])
15780
+ }).strict();
15781
+ var harnessInstallationStateSchema = external_exports.object({
15782
+ currentVersion: external_exports.string().min(1).max(128),
15783
+ latestVersion: external_exports.string().min(1).max(128),
15784
+ updateAvailable: external_exports.boolean(),
15785
+ canUpdate: external_exports.boolean(),
15786
+ message: external_exports.string().max(2048).optional()
15787
+ }).strict();
15788
+
15682
15789
  // ../../shared-contracts/dist/codex-accounts.js
15683
15790
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15684
15791
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
@@ -16856,7 +16963,7 @@ async function rollbackOmpLastTurn(transport, sourceSessionId, cwd) {
16856
16963
  // dist/omp-rpc-session.js
16857
16964
  import { spawn, spawnSync } from "node:child_process";
16858
16965
  import { randomUUID } from "node:crypto";
16859
- import path3 from "node:path";
16966
+ import path4 from "node:path";
16860
16967
 
16861
16968
  // ../../harness-discovery/dist/environment.js
16862
16969
  import fs from "node:fs";
@@ -16904,12 +17011,28 @@ function newestFirst(names) {
16904
17011
  return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
16905
17012
  }
16906
17013
 
16907
- // ../../harness-discovery/dist/node-runtime.js
17014
+ // ../../harness-discovery/dist/invocation.js
16908
17015
  import path2 from "node:path";
17016
+ function commandInvocation(command, arguments_, environment, platform = process.platform) {
17017
+ const extension = path2.win32.extname(command).toLowerCase();
17018
+ if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
17019
+ return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
17020
+ }
17021
+ const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
17022
+ const commandLine = [command, ...arguments_].map(quote).join(" ");
17023
+ return {
17024
+ command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
17025
+ arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
17026
+ windowsVerbatimArguments: true
17027
+ };
17028
+ }
17029
+
17030
+ // ../../harness-discovery/dist/node-runtime.js
17031
+ import path3 from "node:path";
16909
17032
  function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
16910
17033
  const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
16911
17034
  const delimiter = platform === "win32" ? ";" : ":";
16912
- const runtimeDirectory = path2.dirname(runtimeExecutable);
17035
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
16913
17036
  const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
16914
17037
  const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
16915
17038
  if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
@@ -17081,6 +17204,101 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
17081
17204
  return void 0;
17082
17205
  }
17083
17206
 
17207
+ // ../../harness-discovery/dist/installation.js
17208
+ import { execFile } from "node:child_process";
17209
+ import { homedir } from "node:os";
17210
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
17211
+ const env = withNodeRuntimeOnPath(environment);
17212
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
17213
+ return new Promise((resolve, reject) => {
17214
+ const child = execFile(invocation.command, invocation.arguments, {
17215
+ env,
17216
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
17217
+ encoding: "utf8",
17218
+ timeout,
17219
+ killSignal: "SIGKILL",
17220
+ maxBuffer: 1024 * 1024,
17221
+ windowsHide: true,
17222
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
17223
+ }, (error51, stdout, stderr) => {
17224
+ if (error51)
17225
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
17226
+ else
17227
+ resolve((stdout || stderr).trim());
17228
+ });
17229
+ child.stdin?.end();
17230
+ });
17231
+ }
17232
+ function installationVersion(value) {
17233
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
17234
+ throw new Error("Harness returned an invalid version");
17235
+ return value.trim().replace(/^v/, "");
17236
+ }
17237
+ function versionFromOutput(output) {
17238
+ return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
17239
+ }
17240
+ function newerInstallationVersion(current, latest) {
17241
+ const a = installationVersion(current).replace(/\+.*/, "");
17242
+ const b = installationVersion(latest).replace(/\+.*/, "");
17243
+ const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
17244
+ const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
17245
+ for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
17246
+ if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
17247
+ return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
17248
+ }
17249
+ const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
17250
+ const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
17251
+ if (!preA.length || !preB.length)
17252
+ return !!preA.length && !preB.length;
17253
+ for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
17254
+ const x = preA[i];
17255
+ const y = preB[i];
17256
+ if (x === y)
17257
+ continue;
17258
+ if (x === void 0 || y === void 0)
17259
+ return x === void 0;
17260
+ const numericX = /^\d+$/.test(x);
17261
+ const numericY = /^\d+$/.test(y);
17262
+ if (numericX && numericY) {
17263
+ if (BigInt(x) === BigInt(y))
17264
+ continue;
17265
+ return BigInt(y) > BigInt(x);
17266
+ }
17267
+ if (numericX !== numericY)
17268
+ return numericX;
17269
+ return y > x;
17270
+ }
17271
+ return false;
17272
+ }
17273
+ function createInstallationManager(options) {
17274
+ let checking;
17275
+ let updating;
17276
+ const check2 = () => checking ??= options.check().finally(() => {
17277
+ checking = void 0;
17278
+ });
17279
+ return (action) => {
17280
+ if (updating)
17281
+ return updating;
17282
+ if (action === "check")
17283
+ return check2();
17284
+ updating = (async () => {
17285
+ const before = await check2();
17286
+ if (!before.updateAvailable)
17287
+ return before;
17288
+ if (!before.canUpdate)
17289
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
17290
+ await options.update(before);
17291
+ const after = await check2();
17292
+ if (after.currentVersion === before.currentVersion)
17293
+ throw new Error("The Harness version did not change; check the native updater and retry");
17294
+ return after;
17295
+ })().finally(() => {
17296
+ updating = void 0;
17297
+ });
17298
+ return updating;
17299
+ };
17300
+ }
17301
+
17084
17302
  // dist/command.js
17085
17303
  var ompDiscoverySpec = {
17086
17304
  id: "omp",
@@ -17453,7 +17671,7 @@ function ompRpcProcessCommand(options, dependencies = {}) {
17453
17671
  ...modelArguments,
17454
17672
  ...sessionArguments
17455
17673
  ];
17456
- const extension = path3.win32.extname(command).toLowerCase();
17674
+ const extension = path4.win32.extname(command).toLowerCase();
17457
17675
  if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
17458
17676
  return { command, arguments: arguments_, windowsVerbatimArguments: false };
17459
17677
  }
@@ -18725,7 +18943,7 @@ function subagentTranscriptPath(parentSessionFile, nativeSubagentId) {
18725
18943
  if (nativeSubagentId.includes("/") || nativeSubagentId.includes("\\") || nativeSubagentId.includes("\0") || nativeSubagentId === "." || nativeSubagentId === "..") {
18726
18944
  throw new Error("Omp Subagent ID is not a plain transcript file name");
18727
18945
  }
18728
- if (!parentSessionFile.endsWith(".jsonl") || !path4.isAbsolute(parentSessionFile)) {
18946
+ if (!parentSessionFile.endsWith(".jsonl") || !path5.isAbsolute(parentSessionFile)) {
18729
18947
  return null;
18730
18948
  }
18731
18949
  return `${parentSessionFile.slice(0, -".jsonl".length)}/${nativeSubagentId}.jsonl`;
@@ -18734,7 +18952,7 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
18734
18952
  const transcriptFile = subagentTranscriptPath(parentSessionFile, nativeSubagentId);
18735
18953
  if (transcriptFile === null)
18736
18954
  return { status: "missing" };
18737
- const parentDirectory = path4.dirname(transcriptFile);
18955
+ const parentDirectory = path5.dirname(transcriptFile);
18738
18956
  let metadata;
18739
18957
  try {
18740
18958
  metadata = await stat(transcriptFile);
@@ -18752,7 +18970,7 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
18752
18970
  realpath2(transcriptFile),
18753
18971
  realpath2(parentDirectory)
18754
18972
  ]);
18755
- if (path4.dirname(resolvedTranscript) !== resolvedParentDirectory) {
18973
+ if (path5.dirname(resolvedTranscript) !== resolvedParentDirectory) {
18756
18974
  throw new Error("Omp Subagent transcript resolves outside its parent Session directory");
18757
18975
  }
18758
18976
  return {
@@ -18817,10 +19035,10 @@ function stripDiffPrefix(pathString) {
18817
19035
  return pathString.startsWith("a/") || pathString.startsWith("b/") ? pathString.slice(2) : pathString;
18818
19036
  }
18819
19037
  function displayPath(nativePath, cwd) {
18820
- const resolvedCwd = path4.resolve(cwd);
18821
- const resolvedPath = path4.isAbsolute(nativePath) ? path4.resolve(nativePath) : path4.resolve(cwd, nativePath);
18822
- const relative = path4.relative(resolvedCwd, resolvedPath);
18823
- const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path4.sep}`);
19038
+ const resolvedCwd = path5.resolve(cwd);
19039
+ const resolvedPath = path5.isAbsolute(nativePath) ? path5.resolve(nativePath) : path5.resolve(cwd, nativePath);
19040
+ const relative = path5.relative(resolvedCwd, resolvedPath);
19041
+ const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path5.sep}`);
18824
19042
  const selected = inside ? relative : resolvedPath;
18825
19043
  const normalized = selected.replaceAll("\\", "/");
18826
19044
  if (normalized.length === 0 || normalized === ".")
@@ -20677,14 +20895,51 @@ var OmpAdapter = class {
20677
20895
  }
20678
20896
  };
20679
20897
 
20898
+ // dist/installation.js
20899
+ import { realpath as realpath3 } from "node:fs/promises";
20900
+ import path6 from "node:path";
20901
+ function createOmpInstallation(environment, command) {
20902
+ let executable;
20903
+ let env;
20904
+ return createInstallationManager({
20905
+ async check() {
20906
+ executable = resolveOmpExecutable({ environment, ...command ? { command } : {} });
20907
+ const selected = await realpath3(executable);
20908
+ const pathKey = Object.keys(environment).find((key) => key.toLowerCase() === "path") ?? "PATH";
20909
+ env = {
20910
+ ...environment,
20911
+ [pathKey]: `${path6.dirname(executable)}${path6.delimiter}${environment[pathKey] ?? ""}`
20912
+ };
20913
+ const target = resolveHarnessExecutable({ id: "omp", command: "omp", installRoots: { posix: [], windows: [] } }, { environment: env });
20914
+ const canUpdate = !selected.includes("/nix/store/") && !!target && await realpath3(target.executable) === selected;
20915
+ const output = await runInstallationCommand(executable, ["update", "--check"], env);
20916
+ const currentVersion = versionFromOutput(output);
20917
+ const available = output.match(/New version available:\s*(\S+)/i);
20918
+ if (!available && !/already up to date/i.test(output))
20919
+ throw new Error("OMP update check returned an unknown response");
20920
+ const latestVersion = available ? installationVersion(available[1]) : currentVersion;
20921
+ return {
20922
+ currentVersion,
20923
+ latestVersion,
20924
+ updateAvailable: newerInstallationVersion(currentVersion, latestVersion),
20925
+ canUpdate,
20926
+ ...!canUpdate ? { message: "Update this installation with its original package manager or launcher." } : {}
20927
+ };
20928
+ },
20929
+ async update() {
20930
+ await runInstallationCommand(executable, ["update"], env, 3e5);
20931
+ }
20932
+ });
20933
+ }
20934
+
20680
20935
  // dist/plugin.js
20681
20936
  var OMP_COMMAND_ENV = "CODEXHOST_OMP_COMMAND";
20682
20937
  function createHarnessAdapter(context) {
20683
20938
  const environment = { ...context.environment };
20684
- return new OmpAdapter({
20939
+ return Object.assign(new OmpAdapter({
20685
20940
  ...environment[OMP_COMMAND_ENV] ? { command: environment[OMP_COMMAND_ENV] } : {},
20686
20941
  environment
20687
- });
20942
+ }), { installation: createOmpInstallation(environment, environment[OMP_COMMAND_ENV]) });
20688
20943
  }
20689
20944
  export {
20690
20945
  OMP_COMMAND_ENV,