@liberseek/boft-cli-win32-arm64 0.6.0 → 0.6.1

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.
package/README.md CHANGED
@@ -7,7 +7,7 @@ BOFT CLI runs Pi and other external harnesses inside Codex Desktop.
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install -g @liberseek/boft-cli@0.6.0
10
+ npm install -g @liberseek/boft-cli@0.6.1
11
11
  ```
12
12
 
13
13
  Do not install this package directly. npm selects it through the optional dependencies of `@liberseek/boft-cli`.
@@ -1 +1 @@
1
- {"schemaVersion":1,"version":"0.6.0","distribution":"npm","target":"windows-arm64"}
1
+ {"schemaVersion":1,"version":"0.6.1","distribution":"npm","target":"windows-arm64"}
@@ -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, path10) {
780
- if (!path10)
779
+ function getElementAtPath(obj, path11) {
780
+ if (!path11)
781
781
  return obj;
782
- return path10.reduce((acc, key) => acc?.[key], obj);
782
+ return path11.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(path10, issues) {
1191
+ function prefixIssues(path11, issues) {
1192
1192
  return issues.map((iss) => {
1193
1193
  var _a4;
1194
1194
  (_a4 = iss).path ?? (_a4.path = []);
1195
- iss.path.unshift(path10);
1195
+ iss.path.unshift(path11);
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, path10 = []) => {
1342
+ const processError = (error53, path11 = []) => {
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 }, [...path10, ...issue2.path]));
1345
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1346
1346
  } else if (issue2.code === "invalid_key") {
1347
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1347
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1348
1348
  } else if (issue2.code === "invalid_element") {
1349
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1349
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1350
1350
  } else {
1351
- const fullpath = [...path10, ...issue2.path];
1351
+ const fullpath = [...path11, ...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, path10 = []) => {
1378
+ const processError = (error53, path11 = []) => {
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 }, [...path10, ...issue2.path]));
1382
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1383
1383
  } else if (issue2.code === "invalid_key") {
1384
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1384
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1385
1385
  } else if (issue2.code === "invalid_element") {
1386
- processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
1386
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1387
1387
  } else {
1388
- const fullpath = [...path10, ...issue2.path];
1388
+ const fullpath = [...path11, ...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 path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1421
- for (const seg of path10) {
1420
+ const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1421
+ for (const seg of path11) {
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 path10 = ref.slice(1).split("/").filter(Boolean);
14114
- if (path10.length === 0) {
14113
+ const path11 = ref.slice(1).split("/").filter(Boolean);
14114
+ if (path11.length === 0) {
14115
14115
  return ctx.rootSchema;
14116
14116
  }
14117
14117
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14118
- if (path10[0] === defsKey) {
14119
- const key = path10[1];
14118
+ if (path11[0] === defsKey) {
14119
+ const key = path11[1];
14120
14120
  if (!key || !ctx.defs[key]) {
14121
14121
  throw new Error(`Reference not found: ${ref}`);
14122
14122
  }
@@ -16303,7 +16303,7 @@ var BrokeredHarnessAdapter = class {
16303
16303
 
16304
16304
  // dist/claude-code-adapter.js
16305
16305
  import { randomUUID as randomUUID2 } from "node:crypto";
16306
- import path8 from "node:path";
16306
+ import path9 from "node:path";
16307
16307
 
16308
16308
  // ../../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
16309
16309
  import { createRequire as DW } from "node:module";
@@ -43241,8 +43241,190 @@ function projectClaudeAccountUsage(usage, account) {
43241
43241
  };
43242
43242
  }
43243
43243
 
43244
- // dist/file-change.js
43244
+ // dist/gateway-models.js
43245
+ import { readFile as readFile3 } from "node:fs/promises";
43245
43246
  import path7 from "node:path";
43247
+ var GATEWAY_MODELS_TIMEOUT_MS = 3e3;
43248
+ var GATEWAY_MODELS_MAX_BYTES = 2 * 1024 * 1024;
43249
+ var OFFICIAL_ANTHROPIC_HOST = "api.anthropic.com";
43250
+ var SETTINGS_ENV_KEYS = [
43251
+ "ANTHROPIC_BASE_URL",
43252
+ "ANTHROPIC_AUTH_TOKEN",
43253
+ "ANTHROPIC_API_KEY"
43254
+ ];
43255
+ function trimmedEnv(environment, name) {
43256
+ const value = environment[name]?.trim();
43257
+ return value && value.length > 0 ? value : void 0;
43258
+ }
43259
+ function officialAnthropicHost(hostname3) {
43260
+ return hostname3.replace(/\.$/u, "").toLowerCase() === OFFICIAL_ANTHROPIC_HOST;
43261
+ }
43262
+ function customAnthropicBaseUrl(environment) {
43263
+ const raw = trimmedEnv(environment, "ANTHROPIC_BASE_URL");
43264
+ if (!raw)
43265
+ return void 0;
43266
+ let url2;
43267
+ try {
43268
+ url2 = new URL(raw);
43269
+ } catch {
43270
+ return void 0;
43271
+ }
43272
+ if (url2.protocol !== "http:" && url2.protocol !== "https:")
43273
+ return void 0;
43274
+ if (officialAnthropicHost(url2.hostname))
43275
+ return void 0;
43276
+ return raw.replace(/\/+$/u, "");
43277
+ }
43278
+ function gatewayModelsUrl(baseUrl) {
43279
+ const trimmed = baseUrl.replace(/\/+$/u, "");
43280
+ const prefix = /\/v1$/iu.test(trimmed) ? trimmed : `${trimmed}/v1`;
43281
+ return `${prefix}/models?limit=1000`;
43282
+ }
43283
+ function claudeConfigDirectory(environment) {
43284
+ const configured = trimmedEnv(environment, "CLAUDE_CONFIG_DIR");
43285
+ if (configured)
43286
+ return configured;
43287
+ const home = trimmedEnv(environment, "HOME") ?? trimmedEnv(environment, "USERPROFILE");
43288
+ return home ? path7.join(home, ".claude") : void 0;
43289
+ }
43290
+ async function readClaudeUserSettingsEnv(environment) {
43291
+ const configDir = claudeConfigDirectory(environment);
43292
+ if (!configDir)
43293
+ return {};
43294
+ try {
43295
+ const raw = await readFile3(path7.join(configDir, "settings.json"), "utf8");
43296
+ const parsed = JSON.parse(raw);
43297
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
43298
+ return {};
43299
+ const env = parsed.env;
43300
+ if (env === null || typeof env !== "object" || Array.isArray(env))
43301
+ return {};
43302
+ const overlay = {};
43303
+ for (const key of SETTINGS_ENV_KEYS) {
43304
+ const value = env[key];
43305
+ if (typeof value === "string" && value.trim().length > 0)
43306
+ overlay[key] = value;
43307
+ }
43308
+ return overlay;
43309
+ } catch {
43310
+ return {};
43311
+ }
43312
+ }
43313
+ async function withClaudeGatewayEnvironment(environment, readUserSettingsEnv = readClaudeUserSettingsEnv) {
43314
+ const overlay = await readUserSettingsEnv(environment);
43315
+ const merged = { ...environment };
43316
+ for (const [name, value] of Object.entries(overlay)) {
43317
+ if (merged[name] === void 0)
43318
+ merged[name] = value;
43319
+ }
43320
+ return merged;
43321
+ }
43322
+ function boundedLabel(value) {
43323
+ const trimmed = value.trim();
43324
+ if (trimmed.length === 0)
43325
+ return trimmed;
43326
+ return trimmed.length <= HARNESS_MODEL_LABEL_MAX_LENGTH ? trimmed : trimmed.slice(0, HARNESS_MODEL_LABEL_MAX_LENGTH);
43327
+ }
43328
+ function gatewayRow(value) {
43329
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
43330
+ if (typeof value !== "string")
43331
+ return void 0;
43332
+ const id2 = value.trim();
43333
+ if (id2.length === 0 || id2.length > CLAUDE_MODEL_VALUE_MAX_LENGTH)
43334
+ return void 0;
43335
+ const label2 = boundedLabel(id2);
43336
+ return label2.length === 0 ? void 0 : { value: id2, displayName: label2 };
43337
+ }
43338
+ const record2 = value;
43339
+ const idCandidate = record2.id ?? record2.value;
43340
+ if (typeof idCandidate !== "string")
43341
+ return void 0;
43342
+ const id = idCandidate.trim();
43343
+ if (id.length === 0 || id.length > CLAUDE_MODEL_VALUE_MAX_LENGTH)
43344
+ return void 0;
43345
+ const labelCandidate = typeof record2.display_name === "string" && record2.display_name || typeof record2.displayName === "string" && record2.displayName || typeof record2.name === "string" && record2.name || id;
43346
+ const label = boundedLabel(labelCandidate);
43347
+ return label.length === 0 ? void 0 : { value: id, displayName: label };
43348
+ }
43349
+ function nativeDefaultRow(models) {
43350
+ if (Array.isArray(models)) {
43351
+ for (const row of models) {
43352
+ if (row === null || typeof row !== "object" || Array.isArray(row))
43353
+ continue;
43354
+ const record2 = row;
43355
+ if (typeof record2.value === "string" && record2.value.trim() === "default") {
43356
+ return { ...record2 };
43357
+ }
43358
+ }
43359
+ }
43360
+ return { value: "default", displayName: "Default" };
43361
+ }
43362
+ function nativeSupportsAutoMode(models) {
43363
+ if (!Array.isArray(models))
43364
+ return false;
43365
+ return models.some((row) => row !== null && typeof row === "object" && !Array.isArray(row) && row.supportsAutoMode === true);
43366
+ }
43367
+ function parseGatewayModels(payload) {
43368
+ const list = Array.isArray(payload) ? payload : payload !== null && typeof payload === "object" && !Array.isArray(payload) ? payload.data ?? payload.models : void 0;
43369
+ if (!Array.isArray(list))
43370
+ return [];
43371
+ const rows = [];
43372
+ const seen = /* @__PURE__ */ new Set();
43373
+ for (const candidate of list) {
43374
+ const row = gatewayRow(candidate);
43375
+ if (!row || row.value === "default" || seen.has(row.value))
43376
+ continue;
43377
+ seen.add(row.value);
43378
+ rows.push(row);
43379
+ }
43380
+ return rows;
43381
+ }
43382
+ async function applyGatewayModelCatalog(snapshot, environment, dependencies = {}) {
43383
+ const resolved = await withClaudeGatewayEnvironment(environment, dependencies.readUserSettingsEnv);
43384
+ const baseUrl = customAnthropicBaseUrl(resolved);
43385
+ if (!baseUrl)
43386
+ return snapshot;
43387
+ const timeoutMs = dependencies.timeoutMs ?? GATEWAY_MODELS_TIMEOUT_MS;
43388
+ const fetchImpl = dependencies.fetch ?? globalThis.fetch;
43389
+ const headers = { Accept: "application/json" };
43390
+ const token = trimmedEnv(resolved, "ANTHROPIC_AUTH_TOKEN");
43391
+ const apiKey = trimmedEnv(resolved, "ANTHROPIC_API_KEY");
43392
+ if (token)
43393
+ headers.Authorization = `Bearer ${token}`;
43394
+ if (apiKey)
43395
+ headers["x-api-key"] = apiKey;
43396
+ let payload;
43397
+ try {
43398
+ const response = await fetchImpl(gatewayModelsUrl(baseUrl), {
43399
+ method: "GET",
43400
+ headers,
43401
+ credentials: "omit",
43402
+ redirect: "error",
43403
+ signal: AbortSignal.timeout(timeoutMs)
43404
+ });
43405
+ if (!response.ok)
43406
+ return snapshot;
43407
+ const body = await response.text();
43408
+ if (body.length > GATEWAY_MODELS_MAX_BYTES)
43409
+ return snapshot;
43410
+ payload = JSON.parse(body);
43411
+ } catch {
43412
+ return snapshot;
43413
+ }
43414
+ const gatewayRows = parseGatewayModels(payload);
43415
+ if (gatewayRows.length === 0)
43416
+ return snapshot;
43417
+ const defaultRow = nativeDefaultRow(snapshot.models);
43418
+ if (nativeSupportsAutoMode(snapshot.models))
43419
+ defaultRow.supportsAutoMode = true;
43420
+ return {
43421
+ ...snapshot,
43422
+ models: [defaultRow, ...gatewayRows]
43423
+ };
43424
+ }
43425
+
43426
+ // dist/file-change.js
43427
+ import path8 from "node:path";
43246
43428
  var hunkSchema = external_exports.object({
43247
43429
  oldStart: external_exports.number().int().nonnegative(),
43248
43430
  oldLines: external_exports.number().int().nonnegative(),
@@ -43290,10 +43472,10 @@ function parseClaudeNativeFileChange(toolName, value) {
43290
43472
  };
43291
43473
  }
43292
43474
  function displayPath(nativePath, cwd) {
43293
- const resolvedCwd = path7.resolve(cwd);
43294
- const resolvedPath = path7.isAbsolute(nativePath) ? path7.resolve(nativePath) : path7.resolve(cwd, nativePath);
43295
- const relative = path7.relative(resolvedCwd, resolvedPath);
43296
- const selected = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path7.sep}`) ? relative : resolvedPath;
43475
+ const resolvedCwd = path8.resolve(cwd);
43476
+ const resolvedPath = path8.isAbsolute(nativePath) ? path8.resolve(nativePath) : path8.resolve(cwd, nativePath);
43477
+ const relative = path8.relative(resolvedCwd, resolvedPath);
43478
+ const selected = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path8.sep}`) ? relative : resolvedPath;
43297
43479
  const normalized = selected.replaceAll("\\", "/");
43298
43480
  return validNativePath(normalized) && normalized !== "." ? normalized : null;
43299
43481
  }
@@ -43305,7 +43487,7 @@ function projectClaudeFileChange(value, cwd) {
43305
43487
  `@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`,
43306
43488
  ...hunk.lines
43307
43489
  ]);
43308
- const absoluteDisplayPath = path7.posix.isAbsolute(normalizedPath);
43490
+ const absoluteDisplayPath = path8.posix.isAbsolute(normalizedPath);
43309
43491
  const oldHeader = value.kind === "add" ? "/dev/null" : absoluteDisplayPath ? normalizedPath : `a/${normalizedPath}`;
43310
43492
  const newHeader = absoluteDisplayPath ? normalizedPath : `b/${normalizedPath}`;
43311
43493
  const unifiedDiff = [`--- ${oldHeader}`, `+++ ${newHeader}`, ...body, ""].join("\n");
@@ -44720,12 +44902,13 @@ var ClaudeSdkModelInspector = class {
44720
44902
  }
44721
44903
  async inspect() {
44722
44904
  const activeQuery = this.#createQuery();
44905
+ let snapshot;
44723
44906
  try {
44724
44907
  const initialized = await activeQuery.initializationResult();
44725
44908
  const candidate = activeQuery;
44726
44909
  const canSelectModel = Array.isArray(initialized.models) && typeof candidate.setModel === "function";
44727
44910
  const canSelectPermissionMode = typeof candidate.setPermissionMode === "function";
44728
- return {
44911
+ snapshot = {
44729
44912
  models: initialized.models,
44730
44913
  canSelectModel,
44731
44914
  canSelectPermissionMode
@@ -44733,6 +44916,9 @@ var ClaudeSdkModelInspector = class {
44733
44916
  } finally {
44734
44917
  await this.close();
44735
44918
  }
44919
+ if (!snapshot)
44920
+ throw new Error("Claude Code Model inspection did not complete");
44921
+ return applyGatewayModelCatalog(snapshot, this.#environment);
44736
44922
  }
44737
44923
  close() {
44738
44924
  if (!this.#closePromise)
@@ -47214,7 +47400,7 @@ var ClaudeCodeAdapter = class {
47214
47400
  error: invalidState("Claude Code Adapter is closing")
47215
47401
  };
47216
47402
  }
47217
- const cwd = path8.resolve(input.cwd ?? process.cwd());
47403
+ const cwd = path9.resolve(input.cwd ?? process.cwd());
47218
47404
  if (!input.refresh) {
47219
47405
  const cached2 = this.#inspectionCache.get(cwd);
47220
47406
  if (cached2)
@@ -47360,7 +47546,7 @@ var ClaudeCodeAdapter = class {
47360
47546
  let sourceSnapshot;
47361
47547
  try {
47362
47548
  const messages = await this.#dependencies.readSessionMessages({
47363
- cwd: path8.resolve(input.cwd),
47549
+ cwd: path9.resolve(input.cwd),
47364
47550
  sessionId: sourceRef.data.nativeSessionId
47365
47551
  });
47366
47552
  sourceSnapshot = mapClaudeSnapshot(messages, sourceRef.data.nativeSessionId);
@@ -47402,7 +47588,7 @@ var ClaudeCodeAdapter = class {
47402
47588
  } else {
47403
47589
  const forked2 = await forkClaudeSession({
47404
47590
  checkpoint: retained.checkpoint,
47405
- cwd: path8.resolve(input.cwd),
47591
+ cwd: path9.resolve(input.cwd),
47406
47592
  dependencies: this.#dependencies,
47407
47593
  harnessId: this.harnessId,
47408
47594
  sourceRef: sourceRef.data
@@ -47457,7 +47643,7 @@ var ClaudeCodeAdapter = class {
47457
47643
  }
47458
47644
  };
47459
47645
  }
47460
- const cwd = path8.resolve(input.cwd);
47646
+ const cwd = path9.resolve(input.cwd);
47461
47647
  const nativeRef = input.kind === "resume" ? nativeSessionRefSchema.safeParse(input.nativeRef) : null;
47462
47648
  if (nativeRef && (!nativeRef.success || nativeRef.data.harnessId !== this.harnessId)) {
47463
47649
  return {
@@ -47525,7 +47711,7 @@ var ClaudeCodeAdapter = class {
47525
47711
  };
47526
47712
 
47527
47713
  // dist/user-shell-environment.js
47528
- import path9 from "node:path";
47714
+ import path10 from "node:path";
47529
47715
  import { spawnSync } from "node:child_process";
47530
47716
  var ENVIRONMENT_MARKER = Buffer.from("\0CODEXHOST_USER_SHELL_ENV_V1\0");
47531
47717
  var ENVIRONMENT_COMMAND = "printf '\\0CODEXHOST_USER_SHELL_ENV_V1\\0'; /usr/bin/env -0";
@@ -47568,7 +47754,7 @@ function withUserShellEnvironment(environment, dependencies) {
47568
47754
  if (platform === "win32" || !environment.HOME)
47569
47755
  return environment;
47570
47756
  const shell = environment.SHELL?.trim() || defaultShell(platform);
47571
- if (!shell || !SUPPORTED_SHELLS.has(path9.basename(shell)))
47757
+ if (!shell || !SUPPORTED_SHELLS.has(path10.basename(shell)))
47572
47758
  return environment;
47573
47759
  const cacheKey = `${platform}\0${shell}\0${environment.HOME}`;
47574
47760
  const cached2 = dependencies ? void 0 : shellEnvironmentCache.get(cacheKey);
package/bin/codexhost.exe CHANGED
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liberseek/boft-cli-win32-arm64",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "BOFT CLI runs Pi and other external harnesses inside Codex Desktop.",
5
5
  "type": "module",
6
6
  "files": [