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

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,7 +15292,7 @@ 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),
@@ -16930,8 +16946,8 @@ var BrokeredHarnessAdapter = class {
16930
16946
  };
16931
16947
 
16932
16948
  // dist/claude-code-adapter.js
16933
- import { randomUUID as randomUUID3 } from "node:crypto";
16934
- import path15 from "node:path";
16949
+ import { randomUUID as randomUUID4 } from "node:crypto";
16950
+ import path16 from "node:path";
16935
16951
 
16936
16952
  // ../../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
16937
16953
  import { createRequire as DW } from "node:module";
@@ -20838,8 +20854,8 @@ var qU = v(function(BU) {
20838
20854
  BU._globalThis = void 0;
20839
20855
  BU._globalThis = typeof globalThis === "object" ? globalThis : global;
20840
20856
  });
20841
- var GU = v(function(os6) {
20842
- var Axe = os6 && os6.__createBinding || (Object.create ? function(e, t, r, n) {
20857
+ var GU = v(function(os7) {
20858
+ var Axe = os7 && os7.__createBinding || (Object.create ? function(e, t, r, n) {
20843
20859
  if (n === void 0) n = r;
20844
20860
  Object.defineProperty(e, n, { enumerable: true, get: function() {
20845
20861
  return t[r];
@@ -20847,11 +20863,11 @@ var GU = v(function(os6) {
20847
20863
  } : function(e, t, r, n) {
20848
20864
  if (n === void 0) n = r;
20849
20865
  e[n] = t[r];
20850
- }), kxe = os6 && os6.__exportStar || function(e, t) {
20866
+ }), kxe = os7 && os7.__exportStar || function(e, t) {
20851
20867
  for (var r in e) if (r !== "default" && !Object.prototype.hasOwnProperty.call(t, r)) Axe(t, e, r);
20852
20868
  };
20853
- Object.defineProperty(os6, "__esModule", { value: true });
20854
- kxe(qU(), os6);
20869
+ Object.defineProperty(os7, "__esModule", { value: true });
20870
+ kxe(qU(), os7);
20855
20871
  });
20856
20872
  var WU = v(function(is) {
20857
20873
  var Oxe = is && is.__createBinding || (Object.create ? function(e, t, r, n) {
@@ -43244,6 +43260,60 @@ async function npmInstallation(command, packages, environment) {
43244
43260
  return null;
43245
43261
  }
43246
43262
 
43263
+ // ../../harness-discovery/dist/installer.js
43264
+ import { mkdtemp, rm as rm2, writeFile } from "node:fs/promises";
43265
+ import { tmpdir } from "node:os";
43266
+ import { join as join2 } from "node:path";
43267
+ function createHarnessInstaller(environment, source) {
43268
+ return async () => {
43269
+ if (!["darwin", "linux", "win32"].includes(process.platform))
43270
+ throw new Error("Unsupported installation platform");
43271
+ const env = withNodeRuntimeOnPath(environment);
43272
+ if ("npm" in source) {
43273
+ const npm = resolveHarnessExecutable({
43274
+ id: "npm",
43275
+ command: "npm",
43276
+ installRoots: {
43277
+ posix: [
43278
+ "~/.npm-global/bin",
43279
+ "~/.local/bin",
43280
+ VERSION_MANAGER_ROOTS,
43281
+ "/opt/homebrew/bin",
43282
+ "/usr/local/bin",
43283
+ "/usr/bin"
43284
+ ],
43285
+ windows: [
43286
+ "${APPDATA}/npm",
43287
+ VERSION_MANAGER_ROOTS,
43288
+ "${ProgramFiles}/nodejs",
43289
+ "${LOCALAPPDATA}/Programs/nodejs"
43290
+ ]
43291
+ }
43292
+ }, { environment: env });
43293
+ if (!npm)
43294
+ throw new Error("Install Node.js and npm first");
43295
+ await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
43296
+ ...env,
43297
+ ...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
43298
+ }, 6e5);
43299
+ return;
43300
+ }
43301
+ const windows = process.platform === "win32";
43302
+ const url2 = windows ? source.windows : source.posix;
43303
+ if (new URL(url2).protocol !== "https:")
43304
+ throw new Error("Installer requires HTTPS");
43305
+ const script = await fetchInstallationText(url2);
43306
+ const directory = await mkdtemp(join2(tmpdir(), "codexhost-installer-"));
43307
+ try {
43308
+ const file2 = join2(directory, windows ? "install.ps1" : "install.sh");
43309
+ await writeFile(file2, script, { mode: 384 });
43310
+ await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
43311
+ } finally {
43312
+ await rm2(directory, { recursive: true, force: true });
43313
+ }
43314
+ };
43315
+ }
43316
+
43247
43317
  // dist/command.js
43248
43318
  var ClaudeCodeExecutableError = class extends Error {
43249
43319
  code = "CLAUDE_NOT_FOUND";
@@ -43295,7 +43365,7 @@ function resolveClaudeCodeExecutable(input = {}, dependencies = {}) {
43295
43365
 
43296
43366
  // dist/pending-session.js
43297
43367
  import { randomUUID as randomUUID2 } from "node:crypto";
43298
- import { mkdir, open, readFile as readFile3, rename, rm as rm2, stat, unlink } from "node:fs/promises";
43368
+ import { mkdir, open, readFile as readFile3, rename, rm as rm3, stat, unlink } from "node:fs/promises";
43299
43369
  import os3 from "node:os";
43300
43370
  import path7 from "node:path";
43301
43371
  var reservationSchema = external_exports.strictObject({
@@ -43343,7 +43413,7 @@ var ClaudePendingSessions = class {
43343
43413
  await file2.close();
43344
43414
  }
43345
43415
  } catch (error52) {
43346
- await rm2(directory, { recursive: true, force: true });
43416
+ await rm3(directory, { recursive: true, force: true });
43347
43417
  throw error52;
43348
43418
  }
43349
43419
  await this.#sync(directory);
@@ -43388,7 +43458,7 @@ var ClaudePendingSessions = class {
43388
43458
  await rename(temporary, path7.join(directory, "session.json"));
43389
43459
  await this.#sync(directory);
43390
43460
  } finally {
43391
- await rm2(temporary, { force: true });
43461
+ await rm3(temporary, { force: true });
43392
43462
  }
43393
43463
  }
43394
43464
  async #sync(directory) {
@@ -43417,7 +43487,7 @@ var ClaudePendingSessions = class {
43417
43487
  await this.#sync(this.#path(ref, cwd));
43418
43488
  }
43419
43489
  async discard(ref, cwd) {
43420
- await rm2(this.#path(ref, cwd), { recursive: true, force: true });
43490
+ await rm3(this.#path(ref, cwd), { recursive: true, force: true });
43421
43491
  }
43422
43492
  };
43423
43493
 
@@ -45077,11 +45147,55 @@ async function readClaudeSubagentTranscript(input) {
45077
45147
  return parseTranscriptRecords(await readFile4(transcript, "utf8"), input.sessionId);
45078
45148
  }
45079
45149
 
45080
- // dist/model-catalog.js
45081
- import { Buffer as Buffer2 } from "node:buffer";
45082
- import { readFile as readFile5 } from "node:fs/promises";
45150
+ // dist/long-context.js
45151
+ import { randomUUID as randomUUID3 } from "node:crypto";
45152
+ import { mkdir as mkdir2, readFile as readFile5, rename as rename2, rm as rm4, writeFile as writeFile2 } from "node:fs/promises";
45083
45153
  import os5 from "node:os";
45084
45154
  import path12 from "node:path";
45155
+ var MILLION_CONTEXT_MODELS = [{ id: "claude-opus-5-5", aliases: ["claude-opus-5.5"] }];
45156
+ var MILLION_CONTEXT_MODEL_IDS = new Set(MILLION_CONTEXT_MODELS.flatMap((model) => [model.id, ...model.aliases]));
45157
+ var MILLION_CONTEXT_SUFFIX = /\[1m\]$/iu;
45158
+ function claudeLongContextFile(environment) {
45159
+ const root = environment.CODEXHOST_DATA_DIR ? path12.resolve(environment.CODEXHOST_DATA_DIR) : path12.join(os5.homedir(), ".codexhost");
45160
+ return path12.join(root, "claude-code-long-context.json");
45161
+ }
45162
+ async function readClaudeLongContext(environment) {
45163
+ try {
45164
+ const parsed = JSON.parse(await readFile5(claudeLongContextFile(environment), "utf8"));
45165
+ if (typeof parsed === "object" && parsed !== null && "enabled" in parsed && typeof parsed.enabled === "boolean") {
45166
+ return parsed.enabled;
45167
+ }
45168
+ } catch {
45169
+ }
45170
+ return true;
45171
+ }
45172
+ async function writeClaudeLongContext(environment, enabled) {
45173
+ const file2 = claudeLongContextFile(environment);
45174
+ await mkdir2(path12.dirname(file2), { recursive: true, mode: 448 });
45175
+ const temporary = `${file2}.${randomUUID3()}.tmp`;
45176
+ try {
45177
+ await writeFile2(temporary, `${JSON.stringify({ enabled })}
45178
+ `, { mode: 384, flag: "wx" });
45179
+ await rename2(temporary, file2);
45180
+ } finally {
45181
+ await rm4(temporary, { force: true });
45182
+ }
45183
+ return enabled;
45184
+ }
45185
+ function claudeSessionModel(model, enabled) {
45186
+ if (!model)
45187
+ return void 0;
45188
+ const bare = model.replace(MILLION_CONTEXT_SUFFIX, "");
45189
+ if (!enabled || !MILLION_CONTEXT_MODEL_IDS.has(bare))
45190
+ return bare;
45191
+ return `${bare}[1m]`;
45192
+ }
45193
+
45194
+ // dist/model-catalog.js
45195
+ import { Buffer as Buffer2 } from "node:buffer";
45196
+ import { readFile as readFile6 } from "node:fs/promises";
45197
+ import os6 from "node:os";
45198
+ import path13 from "node:path";
45085
45199
 
45086
45200
  // dist/thinking-options.js
45087
45201
  var option = (id, label) => ({
@@ -45163,7 +45277,7 @@ function decodeClaudeModelRef(ref) {
45163
45277
  return value === "default" ? void 0 : value;
45164
45278
  }
45165
45279
  function resolveClaudeConfigDirectory(environment = process.env) {
45166
- return path12.resolve(environment.CLAUDE_CONFIG_DIR ?? path12.join(os5.homedir(), ".claude"));
45280
+ return path13.resolve(environment.CLAUDE_CONFIG_DIR ?? path13.join(os6.homedir(), ".claude"));
45167
45281
  }
45168
45282
  function parseModelPickerOptions(value) {
45169
45283
  if (!Array.isArray(value))
@@ -45205,10 +45319,10 @@ function parseClaudeModelPickerSettings(value) {
45205
45319
  };
45206
45320
  }
45207
45321
  async function readClaudeUserModelPicker(environment = process.env) {
45208
- const settingsPath = path12.join(resolveClaudeConfigDirectory(environment), "settings.json");
45322
+ const settingsPath = path13.join(resolveClaudeConfigDirectory(environment), "settings.json");
45209
45323
  let raw;
45210
45324
  try {
45211
- raw = await readFile5(settingsPath, "utf8");
45325
+ raw = await readFile6(settingsPath, "utf8");
45212
45326
  } catch {
45213
45327
  return void 0;
45214
45328
  }
@@ -45534,8 +45648,8 @@ function projectClaudeAccountUsage(usage, account) {
45534
45648
  }
45535
45649
 
45536
45650
  // dist/gateway-models.js
45537
- import { readFile as readFile6 } from "node:fs/promises";
45538
- import path13 from "node:path";
45651
+ import { readFile as readFile7 } from "node:fs/promises";
45652
+ import path14 from "node:path";
45539
45653
  var GATEWAY_MODELS_TIMEOUT_MS = 3e3;
45540
45654
  var GATEWAY_MODELS_MAX_BYTES = 2 * 1024 * 1024;
45541
45655
  var OFFICIAL_ANTHROPIC_HOST = "api.anthropic.com";
@@ -45577,14 +45691,14 @@ function claudeConfigDirectory(environment) {
45577
45691
  if (configured)
45578
45692
  return configured;
45579
45693
  const home = trimmedEnv(environment, "HOME") ?? trimmedEnv(environment, "USERPROFILE");
45580
- return home ? path13.join(home, ".claude") : void 0;
45694
+ return home ? path14.join(home, ".claude") : void 0;
45581
45695
  }
45582
45696
  async function readClaudeUserSettingsEnv(environment) {
45583
45697
  const configDir = claudeConfigDirectory(environment);
45584
45698
  if (!configDir)
45585
45699
  return {};
45586
45700
  try {
45587
- const raw = await readFile6(path13.join(configDir, "settings.json"), "utf8");
45701
+ const raw = await readFile7(path14.join(configDir, "settings.json"), "utf8");
45588
45702
  const parsed = JSON.parse(raw);
45589
45703
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
45590
45704
  return {};
@@ -45717,7 +45831,7 @@ async function applyGatewayModelCatalog(snapshot, environment, dependencies = {}
45717
45831
 
45718
45832
  // dist/process-fence.js
45719
45833
  import { execFile as execFile2 } from "node:child_process";
45720
- import path14 from "node:path";
45834
+ import path15 from "node:path";
45721
45835
  import { setTimeout as setTimeout2 } from "node:timers/promises";
45722
45836
  import { promisify } from "node:util";
45723
45837
  var executeFile = promisify(execFile2);
@@ -45741,9 +45855,9 @@ async function closeClaudeProcessGroup(child, timeoutMs) {
45741
45855
  if (child.exitCode !== null || child.signalCode !== null)
45742
45856
  throw new Error("Claude process tree cannot be confirmed after its Windows root exited");
45743
45857
  const root = process.env.SystemRoot ?? process.env.SYSTEMROOT;
45744
- if (!root || !path14.win32.isAbsolute(root))
45858
+ if (!root || !path15.win32.isAbsolute(root))
45745
45859
  throw new Error("Windows SystemRoot is unavailable");
45746
- await executeFile(path14.win32.join(root, "System32", "taskkill.exe"), ["/PID", String(pid), "/T", "/F"], {
45860
+ await executeFile(path15.win32.join(root, "System32", "taskkill.exe"), ["/PID", String(pid), "/T", "/F"], {
45747
45861
  timeout: timeoutMs,
45748
45862
  windowsHide: true
45749
45863
  });
@@ -47531,6 +47645,8 @@ var ClaudeHarnessSession = class {
47531
47645
  #startupTask = null;
47532
47646
  #randomUUID;
47533
47647
  #requestedModel;
47648
+ #sdkModel;
47649
+ #longContextEnabled;
47534
47650
  #requestedPermissionModeId;
47535
47651
  #requestedThinkingOptionId;
47536
47652
  #readSessionMessages;
@@ -47588,6 +47704,7 @@ var ClaudeHarnessSession = class {
47588
47704
  this.#onPlanLimitObserved = onPlanLimitObserved;
47589
47705
  this.#openMode = options.openMode;
47590
47706
  this.#requestedModel = options.requestedModel;
47707
+ this.#longContextEnabled = options.longContextEnabled;
47591
47708
  this.#requestedPermissionModeId = options.requestedPermissionModeId;
47592
47709
  this.#requestedThinkingOptionId = options.requestedThinkingOptionId;
47593
47710
  this.#sessionId = options.sessionId;
@@ -47986,6 +48103,29 @@ var ClaudeHarnessSession = class {
47986
48103
  };
47987
48104
  }
47988
48105
  }
48106
+ async applyLongContext(enabled) {
48107
+ const transport = this.#transport;
48108
+ if (!transport || this.#phase !== "open")
48109
+ return;
48110
+ if (this.#acceptingTurn || this.#configurationTask || this.#readingHistory || this.#active) {
48111
+ return;
48112
+ }
48113
+ let decoded;
48114
+ try {
48115
+ decoded = this.#requestedModel ? decodeClaudeModelRef(this.#requestedModel) : void 0;
48116
+ } catch {
48117
+ return;
48118
+ }
48119
+ const sessionModel = claudeSessionModel(decoded, enabled);
48120
+ if (sessionModel === this.#sdkModel)
48121
+ return;
48122
+ await transport.setModel(sessionModel);
48123
+ this.#sdkModel = sessionModel;
48124
+ this.#usageGeneration += 1;
48125
+ this.#contextUsageFreshUntilMs = 0;
48126
+ this.#contextUsageCooldownUntilMs = 0;
48127
+ this.#requestContextUsage(transport, void 0, CONTEXT_USAGE_RETRY_DELAYS_MS);
48128
+ }
47989
48129
  refreshUsage() {
47990
48130
  if (this.#phase !== "open" || !this.#transport)
47991
48131
  return Promise.resolve();
@@ -48042,7 +48182,9 @@ var ClaudeHarnessSession = class {
48042
48182
  const transport = this.#transport;
48043
48183
  if (transport) {
48044
48184
  try {
48045
- await transport.setModel(model);
48185
+ const sessionModel = claudeSessionModel(model, await this.#longContextEnabled());
48186
+ await transport.setModel(sessionModel);
48187
+ this.#sdkModel = sessionModel;
48046
48188
  } catch {
48047
48189
  return {
48048
48190
  ok: false,
@@ -48381,7 +48523,8 @@ var ClaudeHarnessSession = class {
48381
48523
  throw new Error("Claude Code Session closed during startup");
48382
48524
  }
48383
48525
  const selectedModel = this.#requestedModel ?? (this.#openMode === "create" ? CLAUDE_DEFAULT_MODEL_REF : void 0);
48384
- const model = selectedModel ? decodeClaudeModelRef(selectedModel) : void 0;
48526
+ const model = claudeSessionModel(selectedModel ? decodeClaudeModelRef(selectedModel) : void 0, await this.#longContextEnabled());
48527
+ this.#sdkModel = model;
48385
48528
  const permissionMode = decodeClaudePermissionModeId(this.#requestedPermissionModeId);
48386
48529
  let transport;
48387
48530
  try {
@@ -49471,11 +49614,13 @@ var ClaudeCodeAdapter = class {
49471
49614
  #inspectionInFlight = /* @__PURE__ */ new Map();
49472
49615
  #inspectors = /* @__PURE__ */ new Set();
49473
49616
  #sessions = /* @__PURE__ */ new Set();
49617
+ #environment;
49474
49618
  #closePromise = null;
49475
49619
  #latestPlanLimit = null;
49476
49620
  #accountInspection = null;
49477
49621
  constructor(options = {}, dependencies) {
49478
49622
  const environment = options.environment ?? process.env;
49623
+ this.#environment = environment;
49479
49624
  this.#pendingSessions = new ClaudePendingSessions(environment);
49480
49625
  this.#closeTimeoutMs = options.closeTimeoutMs ?? DEFAULT_CLOSE_TIMEOUT_MS;
49481
49626
  this.#cancelTimeoutMs = options.cancelTimeoutMs ?? DEFAULT_CANCEL_TIMEOUT_MS;
@@ -49491,7 +49636,7 @@ var ClaudeCodeAdapter = class {
49491
49636
  throw new RangeError("Claude Code continuation quiescence must be a positive safe integer");
49492
49637
  }
49493
49638
  this.#dependencies = dependencies ?? {
49494
- randomUUID: randomUUID3,
49639
+ randomUUID: randomUUID4,
49495
49640
  bypassPermissionsAvailable: (environment2) => claudeBypassPermissionsAvailable(environment2 ?? options.environment ?? process.env),
49496
49641
  inspectInstallation: () => {
49497
49642
  resolveClaudeCodeExecutable({
@@ -49572,7 +49717,7 @@ var ClaudeCodeAdapter = class {
49572
49717
  error: invalidState("Claude Code Adapter is closing")
49573
49718
  };
49574
49719
  }
49575
- const cwd = path15.resolve(input.cwd ?? process.cwd());
49720
+ const cwd = path16.resolve(input.cwd ?? process.cwd());
49576
49721
  if (!input.refresh) {
49577
49722
  const cached2 = this.#inspectionCache.get(cwd);
49578
49723
  if (cached2)
@@ -49768,7 +49913,7 @@ var ClaudeCodeAdapter = class {
49768
49913
  }
49769
49914
  requestedPermissionModeId = CLAUDE_DEFAULT_PERMISSION_MODE_ID;
49770
49915
  }
49771
- const cwd = path15.resolve(input.cwd);
49916
+ const cwd = path16.resolve(input.cwd);
49772
49917
  if (input.kind === "rollbackLastTurn") {
49773
49918
  for (const source of this.#sessions) {
49774
49919
  const ready = await source.prepareRollback(input.sourceRef.nativeSessionId);
@@ -49851,6 +49996,7 @@ var ClaudeCodeAdapter = class {
49851
49996
  ...durableRef ? { nativeRef: durableRef } : {},
49852
49997
  sessionId: forked?.ok ? forked.value.sessionId : nativeRef?.success ? nativeRef.data.nativeSessionId : this.#dependencies.randomUUID(),
49853
49998
  ...requestedModel ? { requestedModel } : {},
49999
+ longContextEnabled: () => readClaudeLongContext(this.#environment),
49854
50000
  requestedPermissionModeId,
49855
50001
  requestedThinkingOptionId,
49856
50002
  toolOutputLimit: this.#toolOutputLimit,
@@ -49879,6 +50025,14 @@ var ClaudeCodeAdapter = class {
49879
50025
  credits() {
49880
50026
  return projectClaudePlanLimitToCredits(this.#latestPlanLimit);
49881
50027
  }
50028
+ async getLongContext() {
50029
+ return { enabled: await readClaudeLongContext(this.#environment) };
50030
+ }
50031
+ async setLongContext(enabled) {
50032
+ const stored = await writeClaudeLongContext(this.#environment, enabled);
50033
+ await Promise.all([...this.#sessions].map((session) => session.applyLongContext(stored).catch(() => void 0)));
50034
+ return { enabled: stored };
50035
+ }
49882
50036
  close() {
49883
50037
  if (!this.#closePromise) {
49884
50038
  this.#importAbort.abort();
@@ -49895,11 +50049,11 @@ var ClaudeCodeAdapter = class {
49895
50049
  };
49896
50050
 
49897
50051
  // dist/installation.js
49898
- import { readFile as readFile7, realpath as realpath3 } from "node:fs/promises";
50052
+ import { readFile as readFile8, realpath as realpath3 } from "node:fs/promises";
49899
50053
  import { homedir as homedir2 } from "node:os";
49900
- import path16 from "node:path";
50054
+ import path17 from "node:path";
49901
50055
  async function readSettings(file2) {
49902
- const text = await readFile7(file2, "utf8").catch((error52) => {
50056
+ const text = await readFile8(file2, "utf8").catch((error52) => {
49903
50057
  if (error52.code === "ENOENT")
49904
50058
  return "{}";
49905
50059
  throw error52;
@@ -49918,9 +50072,9 @@ function createClaudeInstallation(environment, command) {
49918
50072
  ...command ? { command } : {}
49919
50073
  });
49920
50074
  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"));
50075
+ const config2 = environment.CLAUDE_CONFIG_DIR ? path17.resolve(home, environment.CLAUDE_CONFIG_DIR) : path17.join(home, ".claude");
50076
+ 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";
50077
+ const user = await readSettings(path17.join(config2, "settings.json"));
49924
50078
  const managed = await readSettings(managedFile);
49925
50079
  const settings = { ...user, ...managed, env: { ...user.env, ...managed.env } };
49926
50080
  const env = { ...environment, ...settings.env };
@@ -49933,10 +50087,10 @@ function createClaudeInstallation(environment, command) {
49933
50087
  throw new Error("Unknown Claude release channel");
49934
50088
  const latestVersion = installationVersion(await fetchInstallationText(`https://downloads.claude.ai/claude-code-releases/${channel}`));
49935
50089
  const npm = await npmInstallation(executable, ["@anthropic-ai/claude-code"], env);
49936
- const launcher = path16.join(home, ".local", "bin", process.platform === "win32" ? "claude.exe" : "claude");
50090
+ const launcher = path17.join(home, ".local", "bin", process.platform === "win32" ? "claude.exe" : "claude");
49937
50091
  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);
50092
+ const versions = path17.join(home, ".local", "share", "claude", "versions") + path17.sep;
50093
+ const native = path17.resolve(executable) === launcher && (selected.startsWith(versions) || process.platform === "win32" && selected === launcher);
49940
50094
  const blocked = !!env.DISABLE_UPDATES && env.DISABLE_UPDATES !== "0" || !!settings.minimumVersion && newerInstallationVersion(latestVersion, installationVersion(settings.minimumVersion)) || !!settings.requiredMaximumVersion && newerInstallationVersion(installationVersion(settings.requiredMaximumVersion), latestVersion);
49941
50095
  const canUpdate = !blocked && (npm?.canUpdate ?? native);
49942
50096
  update = async () => {
@@ -49960,7 +50114,7 @@ function createClaudeInstallation(environment, command) {
49960
50114
  }
49961
50115
 
49962
50116
  // dist/user-shell-environment.js
49963
- import path17 from "node:path";
50117
+ import path18 from "node:path";
49964
50118
  import { execFile as execFile3 } from "node:child_process";
49965
50119
  var ENVIRONMENT_MARKER = Buffer.from("\0CODEXHOST_USER_SHELL_ENV_V1\0");
49966
50120
  var ENVIRONMENT_COMMAND = "printf '\\0CODEXHOST_USER_SHELL_ENV_V1\\0'; /usr/bin/env -0";
@@ -50003,7 +50157,7 @@ async function withUserShellEnvironment(environment, dependencies) {
50003
50157
  if (platform === "win32" || !environment.HOME)
50004
50158
  return environment;
50005
50159
  const shell = environment.SHELL?.trim() || defaultShell(platform);
50006
- if (!shell || !SUPPORTED_SHELLS.has(path17.basename(shell)))
50160
+ if (!shell || !SUPPORTED_SHELLS.has(path18.basename(shell)))
50007
50161
  return environment;
50008
50162
  const cacheKey = `${platform}\0${shell}\0${environment.HOME}`;
50009
50163
  const cached2 = dependencies ? void 0 : shellEnvironmentCache.get(cacheKey);
@@ -50050,7 +50204,13 @@ async function createHarnessAdapter(context) {
50050
50204
  return Object.assign(new ClaudeCodeAdapter({
50051
50205
  ...environment[CLAUDE_CODE_COMMAND_ENV] ? { command: environment[CLAUDE_CODE_COMMAND_ENV] } : {},
50052
50206
  environment
50053
- }), { installation: createClaudeInstallation(environment, environment[CLAUDE_CODE_COMMAND_ENV]) });
50207
+ }), {
50208
+ installation: createClaudeInstallation(environment, environment[CLAUDE_CODE_COMMAND_ENV]),
50209
+ install: createHarnessInstaller(environment, {
50210
+ posix: "https://claude.ai/install.sh",
50211
+ windows: "https://claude.ai/install.ps1"
50212
+ })
50213
+ });
50054
50214
  }
50055
50215
  async function warmup(adapter) {
50056
50216
  try {