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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,11 +15280,14 @@ 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().trim().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.optional(),
15227
15290
  remaining: external_exports.number().finite().optional(),
15228
- unit: external_exports.string().trim().min(1).max(32).optional(),
15229
15291
  resetsAt: external_exports.string().min(1).optional(),
15230
15292
  periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
15231
15293
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
@@ -15256,12 +15318,27 @@ var threadUsageInspectionSchema = external_exports.object({
15256
15318
  }).strict();
15257
15319
 
15258
15320
  // ../../shared-contracts/dist/harness-accounts.js
15259
- var harnessAccountSnapshotSchema = external_exports.object({
15321
+ var accountBalanceSnapshotSchema = external_exports.object({
15322
+ amount: external_exports.number().finite().nonnegative(),
15323
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
15324
+ currency: external_exports.string().trim().min(1).max(8),
15325
+ /** Native label when the Harness exposes several Billing Sources. */
15326
+ label: external_exports.string().trim().min(1).max(128).optional()
15327
+ }).strict();
15328
+ var harnessAccountSnapshotObject = external_exports.object({
15260
15329
  email: external_exports.string().trim().min(1).max(320).optional(),
15261
15330
  label: external_exports.string().trim().min(1).max(256).optional(),
15262
15331
  plan: external_exports.string().trim().min(1).max(128).optional(),
15263
- credits: accountCreditsSnapshotSchema
15332
+ credits: accountCreditsSnapshotSchema.optional(),
15333
+ balance: accountBalanceSnapshotSchema.optional()
15264
15334
  }).strict();
15335
+ function requireReportedQuota(schema) {
15336
+ return schema.refine((value) => {
15337
+ const reported = value;
15338
+ return reported.credits !== void 0 || reported.balance !== void 0;
15339
+ }, { message: "Account must report either credits or a balance" });
15340
+ }
15341
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
15265
15342
  var harnessAccountIdentityShape = {
15266
15343
  harnessId: harnessIdSchema,
15267
15344
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -15272,11 +15349,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
15272
15349
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
15273
15350
  var harnessAccountInspectResultSchema = external_exports.object({
15274
15351
  ...harnessAccountIdentityShape,
15275
- account: harnessAccountSnapshotSchema.nullable()
15352
+ account: harnessAccountSnapshotSchema.nullable(),
15353
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
15354
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
15276
15355
  }).strict();
15277
15356
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
15278
15357
  var harnessAccountListResultSchema = external_exports.object({
15279
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
15358
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
15280
15359
  }).strict();
15281
15360
 
15282
15361
  // ../../shared-contracts/dist/json-value.js
@@ -15414,6 +15493,8 @@ var harnessModelSchema = external_exports.object({
15414
15493
  ref: harnessModelRefSchema,
15415
15494
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
15416
15495
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15496
+ /** Optional opaque selection for this same Model with priority processing enabled. */
15497
+ fastModel: harnessModelRefSchema.optional(),
15417
15498
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
15418
15499
  }).strict();
15419
15500
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -15446,6 +15527,16 @@ var harnessModelCatalogSchema = external_exports.object({
15446
15527
  });
15447
15528
  }
15448
15529
  refs.add(model.ref.id);
15530
+ if (model.fastModel) {
15531
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15532
+ context.addIssue({
15533
+ code: "custom",
15534
+ message: "Fast Model refs must be distinct and unique",
15535
+ path: ["models", index, "fastModel"]
15536
+ });
15537
+ }
15538
+ refs.add(model.fastModel.id);
15539
+ }
15449
15540
  const supportedThinkingIds = /* @__PURE__ */ new Set();
15450
15541
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
15451
15542
  if (supportedThinkingIds.has(optionId)) {
@@ -15568,11 +15659,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15568
15659
  thinkingOptionId: harnessThinkingOptionIdSchema
15569
15660
  }).strict();
15570
15661
  var threadInspectionParamsSchema = external_exports.object({
15571
- threadId: hostThreadIdSchema
15662
+ threadId: hostThreadIdSchema,
15663
+ includeReferenceCapability: external_exports.boolean().optional()
15572
15664
  }).strict();
15573
15665
  var codexThreadInspectionSchema = external_exports.object({
15574
15666
  owner: external_exports.literal("codex"),
15575
- locked: external_exports.literal(true)
15667
+ locked: external_exports.literal(true),
15668
+ supportsThreadReferences: external_exports.literal(true).optional()
15576
15669
  }).strict();
15577
15670
  var externalThreadInspectionSchema = external_exports.object({
15578
15671
  owner: external_exports.literal("external"),
@@ -15700,10 +15793,31 @@ var harnessLaunchSettingsSchema = external_exports.object({
15700
15793
  restartRequired: external_exports.boolean()
15701
15794
  }).strict();
15702
15795
 
15796
+ // ../../shared-contracts/dist/harness-installation.js
15797
+ var harnessInstallationParamsSchema = external_exports.object({
15798
+ harnessId: harnessIdSchema,
15799
+ action: external_exports.enum(["check", "update"])
15800
+ }).strict();
15801
+ var harnessInstallationStateSchema = external_exports.object({
15802
+ currentVersion: external_exports.string().min(1).max(128),
15803
+ latestVersion: external_exports.string().min(1).max(128),
15804
+ updateAvailable: external_exports.boolean(),
15805
+ canUpdate: external_exports.boolean(),
15806
+ message: external_exports.string().max(2048).optional()
15807
+ }).strict();
15808
+
15703
15809
  // ../../shared-contracts/dist/codex-accounts.js
15704
15810
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15705
15811
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
15706
15812
  var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
15813
+ var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
15814
+ function isCodexAccountSiteUrl(value) {
15815
+ return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
15816
+ }
15817
+ var externalUrlOpenParamsSchema = external_exports.object({
15818
+ url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
15819
+ }).strict();
15820
+ var externalUrlOpenResultSchema = external_exports.object({}).strict();
15707
15821
  var codexAccountPlanTypeSchema = external_exports.enum([
15708
15822
  "free",
15709
15823
  "go",
@@ -15729,7 +15843,8 @@ var codexAccountSchema = external_exports.object({
15729
15843
  email: external_exports.string().email().max(320).optional(),
15730
15844
  planType: codexAccountPlanTypeSchema.optional(),
15731
15845
  authKind: codexAccountAuthKindSchema.optional(),
15732
- authIdentity: nonBlankTextSchema3.max(256).optional()
15846
+ authIdentity: nonBlankTextSchema3.max(256).optional(),
15847
+ siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
15733
15848
  }).strict();
15734
15849
  var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
15735
15850
  var codexAccountListResultSchema = external_exports.object({
@@ -16886,7 +17001,7 @@ async function rollbackOmpLastTurn(transport, sourceSessionId, cwd) {
16886
17001
  // dist/omp-rpc-session.js
16887
17002
  import { spawn, spawnSync } from "node:child_process";
16888
17003
  import { randomUUID } from "node:crypto";
16889
- import path3 from "node:path";
17004
+ import path4 from "node:path";
16890
17005
 
16891
17006
  // ../../harness-discovery/dist/environment.js
16892
17007
  import fs from "node:fs";
@@ -16934,12 +17049,28 @@ function newestFirst(names) {
16934
17049
  return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
16935
17050
  }
16936
17051
 
16937
- // ../../harness-discovery/dist/node-runtime.js
17052
+ // ../../harness-discovery/dist/invocation.js
16938
17053
  import path2 from "node:path";
17054
+ function commandInvocation(command, arguments_, environment, platform = process.platform) {
17055
+ const extension = path2.win32.extname(command).toLowerCase();
17056
+ if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
17057
+ return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
17058
+ }
17059
+ const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
17060
+ const commandLine = [command, ...arguments_].map(quote).join(" ");
17061
+ return {
17062
+ command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
17063
+ arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
17064
+ windowsVerbatimArguments: true
17065
+ };
17066
+ }
17067
+
17068
+ // ../../harness-discovery/dist/node-runtime.js
17069
+ import path3 from "node:path";
16939
17070
  function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
16940
17071
  const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
16941
17072
  const delimiter = platform === "win32" ? ";" : ":";
16942
- const runtimeDirectory = path2.dirname(runtimeExecutable);
17073
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
16943
17074
  const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
16944
17075
  const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
16945
17076
  if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
@@ -17111,6 +17242,101 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
17111
17242
  return void 0;
17112
17243
  }
17113
17244
 
17245
+ // ../../harness-discovery/dist/installation.js
17246
+ import { execFile } from "node:child_process";
17247
+ import { homedir } from "node:os";
17248
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
17249
+ const env = withNodeRuntimeOnPath(environment);
17250
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
17251
+ return new Promise((resolve, reject) => {
17252
+ const child = execFile(invocation.command, invocation.arguments, {
17253
+ env,
17254
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
17255
+ encoding: "utf8",
17256
+ timeout,
17257
+ killSignal: "SIGKILL",
17258
+ maxBuffer: 1024 * 1024,
17259
+ windowsHide: true,
17260
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
17261
+ }, (error51, stdout, stderr) => {
17262
+ if (error51)
17263
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
17264
+ else
17265
+ resolve((stdout || stderr).trim());
17266
+ });
17267
+ child.stdin?.end();
17268
+ });
17269
+ }
17270
+ function installationVersion(value) {
17271
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
17272
+ throw new Error("Harness returned an invalid version");
17273
+ return value.trim().replace(/^v/, "");
17274
+ }
17275
+ function versionFromOutput(output) {
17276
+ return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
17277
+ }
17278
+ function newerInstallationVersion(current, latest) {
17279
+ const a = installationVersion(current).replace(/\+.*/, "");
17280
+ const b = installationVersion(latest).replace(/\+.*/, "");
17281
+ const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
17282
+ const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
17283
+ for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
17284
+ if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
17285
+ return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
17286
+ }
17287
+ const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
17288
+ const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
17289
+ if (!preA.length || !preB.length)
17290
+ return !!preA.length && !preB.length;
17291
+ for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
17292
+ const x = preA[i];
17293
+ const y = preB[i];
17294
+ if (x === y)
17295
+ continue;
17296
+ if (x === void 0 || y === void 0)
17297
+ return x === void 0;
17298
+ const numericX = /^\d+$/.test(x);
17299
+ const numericY = /^\d+$/.test(y);
17300
+ if (numericX && numericY) {
17301
+ if (BigInt(x) === BigInt(y))
17302
+ continue;
17303
+ return BigInt(y) > BigInt(x);
17304
+ }
17305
+ if (numericX !== numericY)
17306
+ return numericX;
17307
+ return y > x;
17308
+ }
17309
+ return false;
17310
+ }
17311
+ function createInstallationManager(options) {
17312
+ let checking;
17313
+ let updating;
17314
+ const check2 = () => checking ??= options.check().finally(() => {
17315
+ checking = void 0;
17316
+ });
17317
+ return (action) => {
17318
+ if (updating)
17319
+ return updating;
17320
+ if (action === "check")
17321
+ return check2();
17322
+ updating = (async () => {
17323
+ const before = await check2();
17324
+ if (!before.updateAvailable)
17325
+ return before;
17326
+ if (!before.canUpdate)
17327
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
17328
+ await options.update(before);
17329
+ const after = await check2();
17330
+ if (after.currentVersion === before.currentVersion)
17331
+ throw new Error("The Harness version did not change; check the native updater and retry");
17332
+ return after;
17333
+ })().finally(() => {
17334
+ updating = void 0;
17335
+ });
17336
+ return updating;
17337
+ };
17338
+ }
17339
+
17114
17340
  // dist/command.js
17115
17341
  var ompDiscoverySpec = {
17116
17342
  id: "omp",
@@ -17483,7 +17709,7 @@ function ompRpcProcessCommand(options, dependencies = {}) {
17483
17709
  ...modelArguments,
17484
17710
  ...sessionArguments
17485
17711
  ];
17486
- const extension = path3.win32.extname(command).toLowerCase();
17712
+ const extension = path4.win32.extname(command).toLowerCase();
17487
17713
  if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
17488
17714
  return { command, arguments: arguments_, windowsVerbatimArguments: false };
17489
17715
  }
@@ -18755,7 +18981,7 @@ function subagentTranscriptPath(parentSessionFile, nativeSubagentId) {
18755
18981
  if (nativeSubagentId.includes("/") || nativeSubagentId.includes("\\") || nativeSubagentId.includes("\0") || nativeSubagentId === "." || nativeSubagentId === "..") {
18756
18982
  throw new Error("Omp Subagent ID is not a plain transcript file name");
18757
18983
  }
18758
- if (!parentSessionFile.endsWith(".jsonl") || !path4.isAbsolute(parentSessionFile)) {
18984
+ if (!parentSessionFile.endsWith(".jsonl") || !path5.isAbsolute(parentSessionFile)) {
18759
18985
  return null;
18760
18986
  }
18761
18987
  return `${parentSessionFile.slice(0, -".jsonl".length)}/${nativeSubagentId}.jsonl`;
@@ -18764,7 +18990,7 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
18764
18990
  const transcriptFile = subagentTranscriptPath(parentSessionFile, nativeSubagentId);
18765
18991
  if (transcriptFile === null)
18766
18992
  return { status: "missing" };
18767
- const parentDirectory = path4.dirname(transcriptFile);
18993
+ const parentDirectory = path5.dirname(transcriptFile);
18768
18994
  let metadata;
18769
18995
  try {
18770
18996
  metadata = await stat(transcriptFile);
@@ -18782,7 +19008,7 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
18782
19008
  realpath2(transcriptFile),
18783
19009
  realpath2(parentDirectory)
18784
19010
  ]);
18785
- if (path4.dirname(resolvedTranscript) !== resolvedParentDirectory) {
19011
+ if (path5.dirname(resolvedTranscript) !== resolvedParentDirectory) {
18786
19012
  throw new Error("Omp Subagent transcript resolves outside its parent Session directory");
18787
19013
  }
18788
19014
  return {
@@ -18847,10 +19073,10 @@ function stripDiffPrefix(pathString) {
18847
19073
  return pathString.startsWith("a/") || pathString.startsWith("b/") ? pathString.slice(2) : pathString;
18848
19074
  }
18849
19075
  function displayPath(nativePath, cwd) {
18850
- const resolvedCwd = path4.resolve(cwd);
18851
- const resolvedPath = path4.isAbsolute(nativePath) ? path4.resolve(nativePath) : path4.resolve(cwd, nativePath);
18852
- const relative = path4.relative(resolvedCwd, resolvedPath);
18853
- const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path4.sep}`);
19076
+ const resolvedCwd = path5.resolve(cwd);
19077
+ const resolvedPath = path5.isAbsolute(nativePath) ? path5.resolve(nativePath) : path5.resolve(cwd, nativePath);
19078
+ const relative = path5.relative(resolvedCwd, resolvedPath);
19079
+ const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path5.sep}`);
18854
19080
  const selected = inside ? relative : resolvedPath;
18855
19081
  const normalized = selected.replaceAll("\\", "/");
18856
19082
  if (normalized.length === 0 || normalized === ".")
@@ -20710,14 +20936,51 @@ var OmpAdapter = class {
20710
20936
  }
20711
20937
  };
20712
20938
 
20939
+ // dist/installation.js
20940
+ import { realpath as realpath3 } from "node:fs/promises";
20941
+ import path6 from "node:path";
20942
+ function createOmpInstallation(environment, command) {
20943
+ let executable;
20944
+ let env;
20945
+ return createInstallationManager({
20946
+ async check() {
20947
+ executable = resolveOmpExecutable({ environment, ...command ? { command } : {} });
20948
+ const selected = await realpath3(executable);
20949
+ const pathKey = Object.keys(environment).find((key) => key.toLowerCase() === "path") ?? "PATH";
20950
+ env = {
20951
+ ...environment,
20952
+ [pathKey]: `${path6.dirname(executable)}${path6.delimiter}${environment[pathKey] ?? ""}`
20953
+ };
20954
+ const target = resolveHarnessExecutable({ id: "omp", command: "omp", installRoots: { posix: [], windows: [] } }, { environment: env });
20955
+ const canUpdate = !selected.includes("/nix/store/") && !!target && await realpath3(target.executable) === selected;
20956
+ const output = await runInstallationCommand(executable, ["update", "--check"], env);
20957
+ const currentVersion = versionFromOutput(output);
20958
+ const available = output.match(/New version available:\s*(\S+)/i);
20959
+ if (!available && !/already up to date/i.test(output))
20960
+ throw new Error("OMP update check returned an unknown response");
20961
+ const latestVersion = available ? installationVersion(available[1]) : currentVersion;
20962
+ return {
20963
+ currentVersion,
20964
+ latestVersion,
20965
+ updateAvailable: newerInstallationVersion(currentVersion, latestVersion),
20966
+ canUpdate,
20967
+ ...!canUpdate ? { message: "Update this installation with its original package manager or launcher." } : {}
20968
+ };
20969
+ },
20970
+ async update() {
20971
+ await runInstallationCommand(executable, ["update"], env, 3e5);
20972
+ }
20973
+ });
20974
+ }
20975
+
20713
20976
  // dist/plugin.js
20714
20977
  var OMP_COMMAND_ENV = "CODEXHOST_OMP_COMMAND";
20715
20978
  function createHarnessAdapter(context) {
20716
20979
  const environment = { ...context.environment };
20717
- return new OmpAdapter({
20980
+ return Object.assign(new OmpAdapter({
20718
20981
  ...environment[OMP_COMMAND_ENV] ? { command: environment[OMP_COMMAND_ENV] } : {},
20719
20982
  environment
20720
- });
20983
+ }), { installation: createOmpInstallation(environment, environment[OMP_COMMAND_ENV]) });
20721
20984
  }
20722
20985
  export {
20723
20986
  OMP_COMMAND_ENV,