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

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.
@@ -776,10 +776,10 @@ function mergeDefs(...defs) {
776
776
  function cloneDef(schema) {
777
777
  return mergeDefs(schema._zod.def);
778
778
  }
779
- function getElementAtPath(obj, path18) {
780
- if (!path18)
779
+ function getElementAtPath(obj, path19) {
780
+ if (!path19)
781
781
  return obj;
782
- return path18.reduce((acc, key) => acc?.[key], obj);
782
+ return path19.reduce((acc, key) => acc?.[key], obj);
783
783
  }
784
784
  function promiseAllObject(promisesObj) {
785
785
  const keys = Object.keys(promisesObj);
@@ -1188,11 +1188,11 @@ function explicitlyAborted(x2, startIndex = 0) {
1188
1188
  }
1189
1189
  return false;
1190
1190
  }
1191
- function prefixIssues(path18, issues) {
1191
+ function prefixIssues(path19, issues) {
1192
1192
  return issues.map((iss) => {
1193
1193
  var _a4;
1194
1194
  (_a4 = iss).path ?? (_a4.path = []);
1195
- iss.path.unshift(path18);
1195
+ iss.path.unshift(path19);
1196
1196
  return iss;
1197
1197
  });
1198
1198
  }
@@ -1339,16 +1339,16 @@ function flattenError(error52, mapper = (issue2) => issue2.message) {
1339
1339
  }
1340
1340
  function formatError(error52, mapper = (issue2) => issue2.message) {
1341
1341
  const fieldErrors = { _errors: [] };
1342
- const processError = (error53, path18 = []) => {
1342
+ const processError = (error53, path19 = []) => {
1343
1343
  for (const issue2 of error53.issues) {
1344
1344
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1345
- issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
1345
+ issue2.errors.map((issues) => processError({ issues }, [...path19, ...issue2.path]));
1346
1346
  } else if (issue2.code === "invalid_key") {
1347
- processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1347
+ processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
1348
1348
  } else if (issue2.code === "invalid_element") {
1349
- processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1349
+ processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
1350
1350
  } else {
1351
- const fullpath = [...path18, ...issue2.path];
1351
+ const fullpath = [...path19, ...issue2.path];
1352
1352
  if (fullpath.length === 0) {
1353
1353
  fieldErrors._errors.push(mapper(issue2));
1354
1354
  } else {
@@ -1375,17 +1375,17 @@ function formatError(error52, mapper = (issue2) => issue2.message) {
1375
1375
  }
1376
1376
  function treeifyError(error52, mapper = (issue2) => issue2.message) {
1377
1377
  const result = { errors: [] };
1378
- const processError = (error53, path18 = []) => {
1378
+ const processError = (error53, path19 = []) => {
1379
1379
  var _a4, _b2;
1380
1380
  for (const issue2 of error53.issues) {
1381
1381
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1382
- issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
1382
+ issue2.errors.map((issues) => processError({ issues }, [...path19, ...issue2.path]));
1383
1383
  } else if (issue2.code === "invalid_key") {
1384
- processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1384
+ processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
1385
1385
  } else if (issue2.code === "invalid_element") {
1386
- processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1386
+ processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
1387
1387
  } else {
1388
- const fullpath = [...path18, ...issue2.path];
1388
+ const fullpath = [...path19, ...issue2.path];
1389
1389
  if (fullpath.length === 0) {
1390
1390
  result.errors.push(mapper(issue2));
1391
1391
  continue;
@@ -1417,8 +1417,8 @@ function treeifyError(error52, mapper = (issue2) => issue2.message) {
1417
1417
  }
1418
1418
  function toDotPath(_path) {
1419
1419
  const segs = [];
1420
- const path18 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1421
- for (const seg of path18) {
1420
+ const path19 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1421
+ for (const seg of path19) {
1422
1422
  if (typeof seg === "number")
1423
1423
  segs.push(`[${seg}]`);
1424
1424
  else if (typeof seg === "symbol")
@@ -14110,13 +14110,13 @@ function resolveRef(ref, ctx) {
14110
14110
  if (!ref.startsWith("#")) {
14111
14111
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14112
14112
  }
14113
- const path18 = ref.slice(1).split("/").filter(Boolean);
14114
- if (path18.length === 0) {
14113
+ const path19 = ref.slice(1).split("/").filter(Boolean);
14114
+ if (path19.length === 0) {
14115
14115
  return ctx.rootSchema;
14116
14116
  }
14117
14117
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14118
- if (path18[0] === defsKey) {
14119
- const key = path18[1];
14118
+ if (path19[0] === defsKey) {
14119
+ const key = path19[1];
14120
14120
  if (!key || !ctx.defs[key]) {
14121
14121
  throw new Error(`Reference not found: ${ref}`);
14122
14122
  }
@@ -14594,6 +14594,71 @@ var harnessDisplaySetSchema = external_exports.strictObject({
14594
14594
  initializeOnly: external_exports.boolean().optional()
14595
14595
  });
14596
14596
 
14597
+ // ../../shared-contracts/dist/ids.js
14598
+ var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14599
+ message: "Identifier must not be empty or whitespace"
14600
+ });
14601
+ var harnessIdSchema = opaqueIdSchema.brand();
14602
+ var hostThreadIdSchema = opaqueIdSchema.brand();
14603
+ var hostTurnIdSchema = opaqueIdSchema.brand();
14604
+ var hostItemIdSchema = opaqueIdSchema.brand();
14605
+ var hostInteractionIdSchema = opaqueIdSchema.brand();
14606
+
14607
+ // ../../shared-contracts/dist/harness-plugins.js
14608
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
14609
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
14610
+ var HARNESS_PLUGIN_LIMIT = 128;
14611
+ var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
14612
+ var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
14613
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
14614
+ var pluginPresentationShape = {
14615
+ id: harnessPluginIdSchema,
14616
+ name: external_exports.string().trim().min(1).max(128),
14617
+ version: external_exports.string().min(1).max(128),
14618
+ /** The factory accepts a persisted local entrypoint through its construction context. */
14619
+ launchCommand: external_exports.literal(true).optional(),
14620
+ links: external_exports.object({
14621
+ documentation: documentationUrlSchema.optional(),
14622
+ installation: documentationUrlSchema.optional()
14623
+ }).strict().optional()
14624
+ };
14625
+ var harnessPluginManifestSchema = external_exports.object({
14626
+ manifestVersion: external_exports.literal(1),
14627
+ ...pluginPresentationShape,
14628
+ adapterApiVersion: external_exports.number().int().positive(),
14629
+ entry: relativeResourceSchema,
14630
+ icon: relativeResourceSchema.optional()
14631
+ }).strict();
14632
+ var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
14633
+ var harnessPluginDescriptorSchema = external_exports.object({
14634
+ ...pluginPresentationShape,
14635
+ icon: harnessPluginIconSchema.optional()
14636
+ }).strict();
14637
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
14638
+ var harnessPluginListResultSchema = external_exports.object({
14639
+ plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
14640
+ }).strict();
14641
+ var harnessPluginConfigurationSchema = external_exports.object({
14642
+ version: external_exports.literal(1),
14643
+ enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
14644
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
14645
+ message: "Enabled plugin IDs must be unique",
14646
+ path: ["enabled"]
14647
+ });
14648
+
14649
+ // ../../shared-contracts/dist/harness-long-context.js
14650
+ var HARNESS_LONG_CONTEXT_GET_METHOD = "codexhost/harness/long-context/get";
14651
+ var HARNESS_LONG_CONTEXT_SET_METHOD = "codexhost/harness/long-context/set";
14652
+ var harnessLongContextGetSchema = external_exports.object({
14653
+ harnessId: harnessPluginIdSchema
14654
+ }).strict();
14655
+ var harnessLongContextSetSchema = harnessLongContextGetSchema.extend({
14656
+ enabled: external_exports.boolean()
14657
+ });
14658
+ var harnessLongContextSchema = external_exports.object({
14659
+ enabled: external_exports.boolean()
14660
+ }).strict();
14661
+
14597
14662
  // ../../shared-contracts/dist/console.js
14598
14663
  var consoleAnnouncementSchema = external_exports.strictObject({
14599
14664
  title: external_exports.string().trim().min(1).max(200),
@@ -14610,8 +14675,11 @@ var CONSOLE_HOST_METHODS = Object.freeze([
14610
14675
  "codexhost/harness/display-settings/get",
14611
14676
  "codexhost/harness/display-settings/set",
14612
14677
  "codexhost/harness/inspect",
14678
+ "codexhost/harness/installation",
14613
14679
  "codexhost/harness/launch-settings/get",
14614
14680
  "codexhost/harness/launch-settings/set",
14681
+ HARNESS_LONG_CONTEXT_GET_METHOD,
14682
+ HARNESS_LONG_CONTEXT_SET_METHOD,
14615
14683
  "codexhost/harness/web-ui/open",
14616
14684
  "codexhost/harness/accounts/sources",
14617
14685
  "codexhost/harness/accounts/list",
@@ -14671,16 +14739,6 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
14671
14739
  inactiveMs: external_exports.number().nonnegative()
14672
14740
  }));
14673
14741
 
14674
- // ../../shared-contracts/dist/ids.js
14675
- var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14676
- message: "Identifier must not be empty or whitespace"
14677
- });
14678
- var harnessIdSchema = opaqueIdSchema.brand();
14679
- var hostThreadIdSchema = opaqueIdSchema.brand();
14680
- var hostTurnIdSchema = opaqueIdSchema.brand();
14681
- var hostItemIdSchema = opaqueIdSchema.brand();
14682
- var hostInteractionIdSchema = opaqueIdSchema.brand();
14683
-
14684
14742
  // ../../shared-contracts/dist/manual-compaction.js
14685
14743
  var threadManualCompactionStartedSchema = external_exports.strictObject({
14686
14744
  threadId: hostThreadIdSchema,
@@ -15210,48 +15268,6 @@ var threadOwnershipListResultSchema = external_exports.object({
15210
15268
  }
15211
15269
  });
15212
15270
 
15213
- // ../../shared-contracts/dist/harness-plugins.js
15214
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15215
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
15216
- var HARNESS_PLUGIN_LIMIT = 128;
15217
- var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
15218
- var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
15219
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15220
- var pluginPresentationShape = {
15221
- id: harnessPluginIdSchema,
15222
- name: external_exports.string().trim().min(1).max(128),
15223
- version: external_exports.string().min(1).max(128),
15224
- /** The factory accepts a persisted local entrypoint through its construction context. */
15225
- launchCommand: external_exports.literal(true).optional(),
15226
- links: external_exports.object({
15227
- documentation: documentationUrlSchema.optional(),
15228
- installation: documentationUrlSchema.optional()
15229
- }).strict().optional()
15230
- };
15231
- var harnessPluginManifestSchema = external_exports.object({
15232
- manifestVersion: external_exports.literal(1),
15233
- ...pluginPresentationShape,
15234
- adapterApiVersion: external_exports.number().int().positive(),
15235
- entry: relativeResourceSchema,
15236
- icon: relativeResourceSchema.optional()
15237
- }).strict();
15238
- var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
15239
- var harnessPluginDescriptorSchema = external_exports.object({
15240
- ...pluginPresentationShape,
15241
- icon: harnessPluginIconSchema.optional()
15242
- }).strict();
15243
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
15244
- var harnessPluginListResultSchema = external_exports.object({
15245
- plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
15246
- }).strict();
15247
- var harnessPluginConfigurationSchema = external_exports.object({
15248
- version: external_exports.literal(1),
15249
- enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15250
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15251
- message: "Enabled plugin IDs must be unique",
15252
- path: ["enabled"]
15253
- });
15254
-
15255
15271
  // ../../shared-contracts/dist/harness-route.js
15256
15272
  var harnessPluginRouteSchema = external_exports.object({
15257
15273
  harnessId: harnessPluginIdSchema,
@@ -15276,14 +15292,17 @@ var harnessLaunchSettingsSchema = external_exports.object({
15276
15292
  // ../../shared-contracts/dist/harness-installation.js
15277
15293
  var harnessInstallationParamsSchema = external_exports.object({
15278
15294
  harnessId: harnessIdSchema,
15279
- action: external_exports.enum(["check", "update"])
15295
+ action: external_exports.enum(["check", "update", "install"])
15280
15296
  }).strict();
15281
15297
  var harnessInstallationStateSchema = external_exports.object({
15282
15298
  currentVersion: external_exports.string().min(1).max(128),
15283
15299
  latestVersion: external_exports.string().min(1).max(128),
15284
15300
  updateAvailable: external_exports.boolean(),
15285
15301
  canUpdate: external_exports.boolean(),
15286
- message: external_exports.string().max(2048).optional()
15302
+ // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15303
+ message: external_exports.string().max(2048).optional(),
15304
+ messageCode: external_exports.string().min(1).max(128).optional(),
15305
+ latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15287
15306
  }).strict();
15288
15307
 
15289
15308
  // ../../shared-contracts/dist/codex-accounts.js
@@ -15578,7 +15597,7 @@ var updateStatusSchema = external_exports.strictObject({
15578
15597
  }
15579
15598
  });
15580
15599
  var updateEmptyParamsSchema = external_exports.strictObject({});
15581
- var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/LiberSeek\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
15600
+ var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/(LiberSeek|LIBERSEEK)\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
15582
15601
  var updateCheckResultSchema = external_exports.strictObject({
15583
15602
  currentVersion: updateSemanticVersionSchema,
15584
15603
  installation: updateInstallationSchema.nullable(),
@@ -16930,8 +16949,8 @@ var BrokeredHarnessAdapter = class {
16930
16949
  };
16931
16950
 
16932
16951
  // dist/claude-code-adapter.js
16933
- import { randomUUID as randomUUID3 } from "node:crypto";
16934
- import path15 from "node:path";
16952
+ import { randomUUID as randomUUID4 } from "node:crypto";
16953
+ import path16 from "node:path";
16935
16954
 
16936
16955
  // ../../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
16937
16956
  import { createRequire as DW } from "node:module";
@@ -20838,8 +20857,8 @@ var qU = v(function(BU) {
20838
20857
  BU._globalThis = void 0;
20839
20858
  BU._globalThis = typeof globalThis === "object" ? globalThis : global;
20840
20859
  });
20841
- var GU = v(function(os6) {
20842
- var Axe = os6 && os6.__createBinding || (Object.create ? function(e, t, r, n) {
20860
+ var GU = v(function(os7) {
20861
+ var Axe = os7 && os7.__createBinding || (Object.create ? function(e, t, r, n) {
20843
20862
  if (n === void 0) n = r;
20844
20863
  Object.defineProperty(e, n, { enumerable: true, get: function() {
20845
20864
  return t[r];
@@ -20847,11 +20866,11 @@ var GU = v(function(os6) {
20847
20866
  } : function(e, t, r, n) {
20848
20867
  if (n === void 0) n = r;
20849
20868
  e[n] = t[r];
20850
- }), kxe = os6 && os6.__exportStar || function(e, t) {
20869
+ }), kxe = os7 && os7.__exportStar || function(e, t) {
20851
20870
  for (var r in e) if (r !== "default" && !Object.prototype.hasOwnProperty.call(t, r)) Axe(t, e, r);
20852
20871
  };
20853
- Object.defineProperty(os6, "__esModule", { value: true });
20854
- kxe(qU(), os6);
20872
+ Object.defineProperty(os7, "__esModule", { value: true });
20873
+ kxe(qU(), os7);
20855
20874
  });
20856
20875
  var WU = v(function(is) {
20857
20876
  var Oxe = is && is.__createBinding || (Object.create ? function(e, t, r, n) {
@@ -43244,6 +43263,60 @@ async function npmInstallation(command, packages, environment) {
43244
43263
  return null;
43245
43264
  }
43246
43265
 
43266
+ // ../../harness-discovery/dist/installer.js
43267
+ import { mkdtemp, rm as rm2, writeFile } from "node:fs/promises";
43268
+ import { tmpdir } from "node:os";
43269
+ import { join as join2 } from "node:path";
43270
+ function createHarnessInstaller(environment, source) {
43271
+ return async () => {
43272
+ if (!["darwin", "linux", "win32"].includes(process.platform))
43273
+ throw new Error("Unsupported installation platform");
43274
+ const env = withNodeRuntimeOnPath(environment);
43275
+ if ("npm" in source) {
43276
+ const npm = resolveHarnessExecutable({
43277
+ id: "npm",
43278
+ command: "npm",
43279
+ installRoots: {
43280
+ posix: [
43281
+ "~/.npm-global/bin",
43282
+ "~/.local/bin",
43283
+ VERSION_MANAGER_ROOTS,
43284
+ "/opt/homebrew/bin",
43285
+ "/usr/local/bin",
43286
+ "/usr/bin"
43287
+ ],
43288
+ windows: [
43289
+ "${APPDATA}/npm",
43290
+ VERSION_MANAGER_ROOTS,
43291
+ "${ProgramFiles}/nodejs",
43292
+ "${LOCALAPPDATA}/Programs/nodejs"
43293
+ ]
43294
+ }
43295
+ }, { environment: env });
43296
+ if (!npm)
43297
+ throw new Error("Install Node.js and npm first");
43298
+ await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
43299
+ ...env,
43300
+ ...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
43301
+ }, 6e5);
43302
+ return;
43303
+ }
43304
+ const windows = process.platform === "win32";
43305
+ const url2 = windows ? source.windows : source.posix;
43306
+ if (new URL(url2).protocol !== "https:")
43307
+ throw new Error("Installer requires HTTPS");
43308
+ const script = await fetchInstallationText(url2);
43309
+ const directory = await mkdtemp(join2(tmpdir(), "codexhost-installer-"));
43310
+ try {
43311
+ const file2 = join2(directory, windows ? "install.ps1" : "install.sh");
43312
+ await writeFile(file2, script, { mode: 384 });
43313
+ await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
43314
+ } finally {
43315
+ await rm2(directory, { recursive: true, force: true });
43316
+ }
43317
+ };
43318
+ }
43319
+
43247
43320
  // dist/command.js
43248
43321
  var ClaudeCodeExecutableError = class extends Error {
43249
43322
  code = "CLAUDE_NOT_FOUND";
@@ -43295,7 +43368,7 @@ function resolveClaudeCodeExecutable(input = {}, dependencies = {}) {
43295
43368
 
43296
43369
  // dist/pending-session.js
43297
43370
  import { randomUUID as randomUUID2 } from "node:crypto";
43298
- import { mkdir, open, readFile as readFile3, rename, rm as rm2, stat, unlink } from "node:fs/promises";
43371
+ import { mkdir, open, readFile as readFile3, rename, rm as rm3, stat, unlink } from "node:fs/promises";
43299
43372
  import os3 from "node:os";
43300
43373
  import path7 from "node:path";
43301
43374
  var reservationSchema = external_exports.strictObject({
@@ -43343,7 +43416,7 @@ var ClaudePendingSessions = class {
43343
43416
  await file2.close();
43344
43417
  }
43345
43418
  } catch (error52) {
43346
- await rm2(directory, { recursive: true, force: true });
43419
+ await rm3(directory, { recursive: true, force: true });
43347
43420
  throw error52;
43348
43421
  }
43349
43422
  await this.#sync(directory);
@@ -43388,7 +43461,7 @@ var ClaudePendingSessions = class {
43388
43461
  await rename(temporary, path7.join(directory, "session.json"));
43389
43462
  await this.#sync(directory);
43390
43463
  } finally {
43391
- await rm2(temporary, { force: true });
43464
+ await rm3(temporary, { force: true });
43392
43465
  }
43393
43466
  }
43394
43467
  async #sync(directory) {
@@ -43417,7 +43490,7 @@ var ClaudePendingSessions = class {
43417
43490
  await this.#sync(this.#path(ref, cwd));
43418
43491
  }
43419
43492
  async discard(ref, cwd) {
43420
- await rm2(this.#path(ref, cwd), { recursive: true, force: true });
43493
+ await rm3(this.#path(ref, cwd), { recursive: true, force: true });
43421
43494
  }
43422
43495
  };
43423
43496
 
@@ -45077,11 +45150,55 @@ async function readClaudeSubagentTranscript(input) {
45077
45150
  return parseTranscriptRecords(await readFile4(transcript, "utf8"), input.sessionId);
45078
45151
  }
45079
45152
 
45080
- // dist/model-catalog.js
45081
- import { Buffer as Buffer2 } from "node:buffer";
45082
- import { readFile as readFile5 } from "node:fs/promises";
45153
+ // dist/long-context.js
45154
+ import { randomUUID as randomUUID3 } from "node:crypto";
45155
+ import { mkdir as mkdir2, readFile as readFile5, rename as rename2, rm as rm4, writeFile as writeFile2 } from "node:fs/promises";
45083
45156
  import os5 from "node:os";
45084
45157
  import path12 from "node:path";
45158
+ var MILLION_CONTEXT_MODELS = [{ id: "claude-opus-5-5", aliases: ["claude-opus-5.5"] }];
45159
+ var MILLION_CONTEXT_MODEL_IDS = new Set(MILLION_CONTEXT_MODELS.flatMap((model) => [model.id, ...model.aliases]));
45160
+ var MILLION_CONTEXT_SUFFIX = /\[1m\]$/iu;
45161
+ function claudeLongContextFile(environment) {
45162
+ const root = environment.CODEXHOST_DATA_DIR ? path12.resolve(environment.CODEXHOST_DATA_DIR) : path12.join(os5.homedir(), ".codexhost");
45163
+ return path12.join(root, "claude-code-long-context.json");
45164
+ }
45165
+ async function readClaudeLongContext(environment) {
45166
+ try {
45167
+ const parsed = JSON.parse(await readFile5(claudeLongContextFile(environment), "utf8"));
45168
+ if (typeof parsed === "object" && parsed !== null && "enabled" in parsed && typeof parsed.enabled === "boolean") {
45169
+ return parsed.enabled;
45170
+ }
45171
+ } catch {
45172
+ }
45173
+ return true;
45174
+ }
45175
+ async function writeClaudeLongContext(environment, enabled) {
45176
+ const file2 = claudeLongContextFile(environment);
45177
+ await mkdir2(path12.dirname(file2), { recursive: true, mode: 448 });
45178
+ const temporary = `${file2}.${randomUUID3()}.tmp`;
45179
+ try {
45180
+ await writeFile2(temporary, `${JSON.stringify({ enabled })}
45181
+ `, { mode: 384, flag: "wx" });
45182
+ await rename2(temporary, file2);
45183
+ } finally {
45184
+ await rm4(temporary, { force: true });
45185
+ }
45186
+ return enabled;
45187
+ }
45188
+ function claudeSessionModel(model, enabled) {
45189
+ if (!model)
45190
+ return void 0;
45191
+ const bare = model.replace(MILLION_CONTEXT_SUFFIX, "");
45192
+ if (!enabled || !MILLION_CONTEXT_MODEL_IDS.has(bare))
45193
+ return bare;
45194
+ return `${bare}[1m]`;
45195
+ }
45196
+
45197
+ // dist/model-catalog.js
45198
+ import { Buffer as Buffer2 } from "node:buffer";
45199
+ import { readFile as readFile6 } from "node:fs/promises";
45200
+ import os6 from "node:os";
45201
+ import path13 from "node:path";
45085
45202
 
45086
45203
  // dist/thinking-options.js
45087
45204
  var option = (id, label) => ({
@@ -45163,7 +45280,7 @@ function decodeClaudeModelRef(ref) {
45163
45280
  return value === "default" ? void 0 : value;
45164
45281
  }
45165
45282
  function resolveClaudeConfigDirectory(environment = process.env) {
45166
- return path12.resolve(environment.CLAUDE_CONFIG_DIR ?? path12.join(os5.homedir(), ".claude"));
45283
+ return path13.resolve(environment.CLAUDE_CONFIG_DIR ?? path13.join(os6.homedir(), ".claude"));
45167
45284
  }
45168
45285
  function parseModelPickerOptions(value) {
45169
45286
  if (!Array.isArray(value))
@@ -45205,10 +45322,10 @@ function parseClaudeModelPickerSettings(value) {
45205
45322
  };
45206
45323
  }
45207
45324
  async function readClaudeUserModelPicker(environment = process.env) {
45208
- const settingsPath = path12.join(resolveClaudeConfigDirectory(environment), "settings.json");
45325
+ const settingsPath = path13.join(resolveClaudeConfigDirectory(environment), "settings.json");
45209
45326
  let raw;
45210
45327
  try {
45211
- raw = await readFile5(settingsPath, "utf8");
45328
+ raw = await readFile6(settingsPath, "utf8");
45212
45329
  } catch {
45213
45330
  return void 0;
45214
45331
  }
@@ -45534,8 +45651,8 @@ function projectClaudeAccountUsage(usage, account) {
45534
45651
  }
45535
45652
 
45536
45653
  // dist/gateway-models.js
45537
- import { readFile as readFile6 } from "node:fs/promises";
45538
- import path13 from "node:path";
45654
+ import { readFile as readFile7 } from "node:fs/promises";
45655
+ import path14 from "node:path";
45539
45656
  var GATEWAY_MODELS_TIMEOUT_MS = 3e3;
45540
45657
  var GATEWAY_MODELS_MAX_BYTES = 2 * 1024 * 1024;
45541
45658
  var OFFICIAL_ANTHROPIC_HOST = "api.anthropic.com";
@@ -45577,14 +45694,14 @@ function claudeConfigDirectory(environment) {
45577
45694
  if (configured)
45578
45695
  return configured;
45579
45696
  const home = trimmedEnv(environment, "HOME") ?? trimmedEnv(environment, "USERPROFILE");
45580
- return home ? path13.join(home, ".claude") : void 0;
45697
+ return home ? path14.join(home, ".claude") : void 0;
45581
45698
  }
45582
45699
  async function readClaudeUserSettingsEnv(environment) {
45583
45700
  const configDir = claudeConfigDirectory(environment);
45584
45701
  if (!configDir)
45585
45702
  return {};
45586
45703
  try {
45587
- const raw = await readFile6(path13.join(configDir, "settings.json"), "utf8");
45704
+ const raw = await readFile7(path14.join(configDir, "settings.json"), "utf8");
45588
45705
  const parsed = JSON.parse(raw);
45589
45706
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
45590
45707
  return {};
@@ -45717,7 +45834,7 @@ async function applyGatewayModelCatalog(snapshot, environment, dependencies = {}
45717
45834
 
45718
45835
  // dist/process-fence.js
45719
45836
  import { execFile as execFile2 } from "node:child_process";
45720
- import path14 from "node:path";
45837
+ import path15 from "node:path";
45721
45838
  import { setTimeout as setTimeout2 } from "node:timers/promises";
45722
45839
  import { promisify } from "node:util";
45723
45840
  var executeFile = promisify(execFile2);
@@ -45741,9 +45858,9 @@ async function closeClaudeProcessGroup(child, timeoutMs) {
45741
45858
  if (child.exitCode !== null || child.signalCode !== null)
45742
45859
  throw new Error("Claude process tree cannot be confirmed after its Windows root exited");
45743
45860
  const root = process.env.SystemRoot ?? process.env.SYSTEMROOT;
45744
- if (!root || !path14.win32.isAbsolute(root))
45861
+ if (!root || !path15.win32.isAbsolute(root))
45745
45862
  throw new Error("Windows SystemRoot is unavailable");
45746
- await executeFile(path14.win32.join(root, "System32", "taskkill.exe"), ["/PID", String(pid), "/T", "/F"], {
45863
+ await executeFile(path15.win32.join(root, "System32", "taskkill.exe"), ["/PID", String(pid), "/T", "/F"], {
45747
45864
  timeout: timeoutMs,
45748
45865
  windowsHide: true
45749
45866
  });
@@ -47531,6 +47648,8 @@ var ClaudeHarnessSession = class {
47531
47648
  #startupTask = null;
47532
47649
  #randomUUID;
47533
47650
  #requestedModel;
47651
+ #sdkModel;
47652
+ #longContextEnabled;
47534
47653
  #requestedPermissionModeId;
47535
47654
  #requestedThinkingOptionId;
47536
47655
  #readSessionMessages;
@@ -47588,6 +47707,7 @@ var ClaudeHarnessSession = class {
47588
47707
  this.#onPlanLimitObserved = onPlanLimitObserved;
47589
47708
  this.#openMode = options.openMode;
47590
47709
  this.#requestedModel = options.requestedModel;
47710
+ this.#longContextEnabled = options.longContextEnabled;
47591
47711
  this.#requestedPermissionModeId = options.requestedPermissionModeId;
47592
47712
  this.#requestedThinkingOptionId = options.requestedThinkingOptionId;
47593
47713
  this.#sessionId = options.sessionId;
@@ -47986,6 +48106,29 @@ var ClaudeHarnessSession = class {
47986
48106
  };
47987
48107
  }
47988
48108
  }
48109
+ async applyLongContext(enabled) {
48110
+ const transport = this.#transport;
48111
+ if (!transport || this.#phase !== "open")
48112
+ return;
48113
+ if (this.#acceptingTurn || this.#configurationTask || this.#readingHistory || this.#active) {
48114
+ return;
48115
+ }
48116
+ let decoded;
48117
+ try {
48118
+ decoded = this.#requestedModel ? decodeClaudeModelRef(this.#requestedModel) : void 0;
48119
+ } catch {
48120
+ return;
48121
+ }
48122
+ const sessionModel = claudeSessionModel(decoded, enabled);
48123
+ if (sessionModel === this.#sdkModel)
48124
+ return;
48125
+ await transport.setModel(sessionModel);
48126
+ this.#sdkModel = sessionModel;
48127
+ this.#usageGeneration += 1;
48128
+ this.#contextUsageFreshUntilMs = 0;
48129
+ this.#contextUsageCooldownUntilMs = 0;
48130
+ this.#requestContextUsage(transport, void 0, CONTEXT_USAGE_RETRY_DELAYS_MS);
48131
+ }
47989
48132
  refreshUsage() {
47990
48133
  if (this.#phase !== "open" || !this.#transport)
47991
48134
  return Promise.resolve();
@@ -48042,7 +48185,9 @@ var ClaudeHarnessSession = class {
48042
48185
  const transport = this.#transport;
48043
48186
  if (transport) {
48044
48187
  try {
48045
- await transport.setModel(model);
48188
+ const sessionModel = claudeSessionModel(model, await this.#longContextEnabled());
48189
+ await transport.setModel(sessionModel);
48190
+ this.#sdkModel = sessionModel;
48046
48191
  } catch {
48047
48192
  return {
48048
48193
  ok: false,
@@ -48381,7 +48526,8 @@ var ClaudeHarnessSession = class {
48381
48526
  throw new Error("Claude Code Session closed during startup");
48382
48527
  }
48383
48528
  const selectedModel = this.#requestedModel ?? (this.#openMode === "create" ? CLAUDE_DEFAULT_MODEL_REF : void 0);
48384
- const model = selectedModel ? decodeClaudeModelRef(selectedModel) : void 0;
48529
+ const model = claudeSessionModel(selectedModel ? decodeClaudeModelRef(selectedModel) : void 0, await this.#longContextEnabled());
48530
+ this.#sdkModel = model;
48385
48531
  const permissionMode = decodeClaudePermissionModeId(this.#requestedPermissionModeId);
48386
48532
  let transport;
48387
48533
  try {
@@ -49471,11 +49617,13 @@ var ClaudeCodeAdapter = class {
49471
49617
  #inspectionInFlight = /* @__PURE__ */ new Map();
49472
49618
  #inspectors = /* @__PURE__ */ new Set();
49473
49619
  #sessions = /* @__PURE__ */ new Set();
49620
+ #environment;
49474
49621
  #closePromise = null;
49475
49622
  #latestPlanLimit = null;
49476
49623
  #accountInspection = null;
49477
49624
  constructor(options = {}, dependencies) {
49478
49625
  const environment = options.environment ?? process.env;
49626
+ this.#environment = environment;
49479
49627
  this.#pendingSessions = new ClaudePendingSessions(environment);
49480
49628
  this.#closeTimeoutMs = options.closeTimeoutMs ?? DEFAULT_CLOSE_TIMEOUT_MS;
49481
49629
  this.#cancelTimeoutMs = options.cancelTimeoutMs ?? DEFAULT_CANCEL_TIMEOUT_MS;
@@ -49491,7 +49639,7 @@ var ClaudeCodeAdapter = class {
49491
49639
  throw new RangeError("Claude Code continuation quiescence must be a positive safe integer");
49492
49640
  }
49493
49641
  this.#dependencies = dependencies ?? {
49494
- randomUUID: randomUUID3,
49642
+ randomUUID: randomUUID4,
49495
49643
  bypassPermissionsAvailable: (environment2) => claudeBypassPermissionsAvailable(environment2 ?? options.environment ?? process.env),
49496
49644
  inspectInstallation: () => {
49497
49645
  resolveClaudeCodeExecutable({
@@ -49572,7 +49720,7 @@ var ClaudeCodeAdapter = class {
49572
49720
  error: invalidState("Claude Code Adapter is closing")
49573
49721
  };
49574
49722
  }
49575
- const cwd = path15.resolve(input.cwd ?? process.cwd());
49723
+ const cwd = path16.resolve(input.cwd ?? process.cwd());
49576
49724
  if (!input.refresh) {
49577
49725
  const cached2 = this.#inspectionCache.get(cwd);
49578
49726
  if (cached2)
@@ -49768,7 +49916,7 @@ var ClaudeCodeAdapter = class {
49768
49916
  }
49769
49917
  requestedPermissionModeId = CLAUDE_DEFAULT_PERMISSION_MODE_ID;
49770
49918
  }
49771
- const cwd = path15.resolve(input.cwd);
49919
+ const cwd = path16.resolve(input.cwd);
49772
49920
  if (input.kind === "rollbackLastTurn") {
49773
49921
  for (const source of this.#sessions) {
49774
49922
  const ready = await source.prepareRollback(input.sourceRef.nativeSessionId);
@@ -49851,6 +49999,7 @@ var ClaudeCodeAdapter = class {
49851
49999
  ...durableRef ? { nativeRef: durableRef } : {},
49852
50000
  sessionId: forked?.ok ? forked.value.sessionId : nativeRef?.success ? nativeRef.data.nativeSessionId : this.#dependencies.randomUUID(),
49853
50001
  ...requestedModel ? { requestedModel } : {},
50002
+ longContextEnabled: () => readClaudeLongContext(this.#environment),
49854
50003
  requestedPermissionModeId,
49855
50004
  requestedThinkingOptionId,
49856
50005
  toolOutputLimit: this.#toolOutputLimit,
@@ -49879,6 +50028,14 @@ var ClaudeCodeAdapter = class {
49879
50028
  credits() {
49880
50029
  return projectClaudePlanLimitToCredits(this.#latestPlanLimit);
49881
50030
  }
50031
+ async getLongContext() {
50032
+ return { enabled: await readClaudeLongContext(this.#environment) };
50033
+ }
50034
+ async setLongContext(enabled) {
50035
+ const stored = await writeClaudeLongContext(this.#environment, enabled);
50036
+ await Promise.all([...this.#sessions].map((session) => session.applyLongContext(stored).catch(() => void 0)));
50037
+ return { enabled: stored };
50038
+ }
49882
50039
  close() {
49883
50040
  if (!this.#closePromise) {
49884
50041
  this.#importAbort.abort();
@@ -49895,11 +50052,11 @@ var ClaudeCodeAdapter = class {
49895
50052
  };
49896
50053
 
49897
50054
  // dist/installation.js
49898
- import { readFile as readFile7, realpath as realpath3 } from "node:fs/promises";
50055
+ import { readFile as readFile8, realpath as realpath3 } from "node:fs/promises";
49899
50056
  import { homedir as homedir2 } from "node:os";
49900
- import path16 from "node:path";
50057
+ import path17 from "node:path";
49901
50058
  async function readSettings(file2) {
49902
- const text = await readFile7(file2, "utf8").catch((error52) => {
50059
+ const text = await readFile8(file2, "utf8").catch((error52) => {
49903
50060
  if (error52.code === "ENOENT")
49904
50061
  return "{}";
49905
50062
  throw error52;
@@ -49918,9 +50075,9 @@ function createClaudeInstallation(environment, command) {
49918
50075
  ...command ? { command } : {}
49919
50076
  });
49920
50077
  const home = environment.HOME ?? environment.USERPROFILE ?? homedir2();
49921
- const config2 = environment.CLAUDE_CONFIG_DIR ? path16.resolve(home, environment.CLAUDE_CONFIG_DIR) : path16.join(home, ".claude");
49922
- const managedFile = process.platform === "darwin" ? "/Library/Application Support/ClaudeCode/managed-settings.json" : process.platform === "win32" ? path16.join(environment.ProgramFiles ?? "C:\\Program Files", "ClaudeCode", "managed-settings.json") : "/etc/claude-code/managed-settings.json";
49923
- const user = await readSettings(path16.join(config2, "settings.json"));
50078
+ const config2 = environment.CLAUDE_CONFIG_DIR ? path17.resolve(home, environment.CLAUDE_CONFIG_DIR) : path17.join(home, ".claude");
50079
+ const managedFile = process.platform === "darwin" ? "/Library/Application Support/ClaudeCode/managed-settings.json" : process.platform === "win32" ? path17.join(environment.ProgramFiles ?? "C:\\Program Files", "ClaudeCode", "managed-settings.json") : "/etc/claude-code/managed-settings.json";
50080
+ const user = await readSettings(path17.join(config2, "settings.json"));
49924
50081
  const managed = await readSettings(managedFile);
49925
50082
  const settings = { ...user, ...managed, env: { ...user.env, ...managed.env } };
49926
50083
  const env = { ...environment, ...settings.env };
@@ -49933,10 +50090,10 @@ function createClaudeInstallation(environment, command) {
49933
50090
  throw new Error("Unknown Claude release channel");
49934
50091
  const latestVersion = installationVersion(await fetchInstallationText(`https://downloads.claude.ai/claude-code-releases/${channel}`));
49935
50092
  const npm = await npmInstallation(executable, ["@anthropic-ai/claude-code"], env);
49936
- const launcher = path16.join(home, ".local", "bin", process.platform === "win32" ? "claude.exe" : "claude");
50093
+ const launcher = path17.join(home, ".local", "bin", process.platform === "win32" ? "claude.exe" : "claude");
49937
50094
  const selected = await realpath3(executable);
49938
- const versions = path16.join(home, ".local", "share", "claude", "versions") + path16.sep;
49939
- const native = path16.resolve(executable) === launcher && (selected.startsWith(versions) || process.platform === "win32" && selected === launcher);
50095
+ const versions = path17.join(home, ".local", "share", "claude", "versions") + path17.sep;
50096
+ const native = path17.resolve(executable) === launcher && (selected.startsWith(versions) || process.platform === "win32" && selected === launcher);
49940
50097
  const blocked = !!env.DISABLE_UPDATES && env.DISABLE_UPDATES !== "0" || !!settings.minimumVersion && newerInstallationVersion(latestVersion, installationVersion(settings.minimumVersion)) || !!settings.requiredMaximumVersion && newerInstallationVersion(installationVersion(settings.requiredMaximumVersion), latestVersion);
49941
50098
  const canUpdate = !blocked && (npm?.canUpdate ?? native);
49942
50099
  update = async () => {
@@ -49949,6 +50106,7 @@ function createClaudeInstallation(environment, command) {
49949
50106
  updateAvailable: newerInstallationVersion(currentVersion, latestVersion),
49950
50107
  canUpdate,
49951
50108
  ...!canUpdate ? {
50109
+ messageCode: blocked ? "claude-policy-restricted" : "original-installer",
49952
50110
  message: blocked ? "Claude updates are restricted by the installation's settings or policy." : "Use the original installer or package manager for this Claude installation."
49953
50111
  } : {}
49954
50112
  };
@@ -49960,7 +50118,7 @@ function createClaudeInstallation(environment, command) {
49960
50118
  }
49961
50119
 
49962
50120
  // dist/user-shell-environment.js
49963
- import path17 from "node:path";
50121
+ import path18 from "node:path";
49964
50122
  import { execFile as execFile3 } from "node:child_process";
49965
50123
  var ENVIRONMENT_MARKER = Buffer.from("\0CODEXHOST_USER_SHELL_ENV_V1\0");
49966
50124
  var ENVIRONMENT_COMMAND = "printf '\\0CODEXHOST_USER_SHELL_ENV_V1\\0'; /usr/bin/env -0";
@@ -50003,7 +50161,7 @@ async function withUserShellEnvironment(environment, dependencies) {
50003
50161
  if (platform === "win32" || !environment.HOME)
50004
50162
  return environment;
50005
50163
  const shell = environment.SHELL?.trim() || defaultShell(platform);
50006
- if (!shell || !SUPPORTED_SHELLS.has(path17.basename(shell)))
50164
+ if (!shell || !SUPPORTED_SHELLS.has(path18.basename(shell)))
50007
50165
  return environment;
50008
50166
  const cacheKey = `${platform}\0${shell}\0${environment.HOME}`;
50009
50167
  const cached2 = dependencies ? void 0 : shellEnvironmentCache.get(cacheKey);
@@ -50050,7 +50208,13 @@ async function createHarnessAdapter(context) {
50050
50208
  return Object.assign(new ClaudeCodeAdapter({
50051
50209
  ...environment[CLAUDE_CODE_COMMAND_ENV] ? { command: environment[CLAUDE_CODE_COMMAND_ENV] } : {},
50052
50210
  environment
50053
- }), { installation: createClaudeInstallation(environment, environment[CLAUDE_CODE_COMMAND_ENV]) });
50211
+ }), {
50212
+ installation: createClaudeInstallation(environment, environment[CLAUDE_CODE_COMMAND_ENV]),
50213
+ install: createHarnessInstaller(environment, {
50214
+ posix: "https://claude.ai/install.sh",
50215
+ windows: "https://claude.ai/install.ps1"
50216
+ })
50217
+ });
50054
50218
  }
50055
50219
  async function warmup(adapter) {
50056
50220
  try {