@liberseek/boft-cli-win32-arm64 0.8.0 → 0.8.2

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.8.0
10
+ npm install -g @liberseek/boft-cli@0.8.2
11
11
  ```
12
12
 
13
13
  Do not install this package directly. npm selects it through the optional dependencies of `@liberseek/boft-cli`.
@@ -12,7 +12,7 @@ License text: licenses/Cosmokit-LICENSE.txt
12
12
  License: Apache-2.0
13
13
  License text: licenses/Agent-Client-Protocol-SDK-LICENSE.txt
14
14
 
15
- @anthropic-ai/claude-agent-sdk 0.3.220
15
+ @anthropic-ai/claude-agent-sdk 0.3.273
16
16
  License: SEE LICENSE IN README.md
17
17
  License text: licenses/Claude-Agent-SDK-LICENSE.md
18
18
 
@@ -1 +1 @@
1
- {"schemaVersion":1,"version":"0.8.0","distribution":"npm","target":"windows-arm64"}
1
+ {"schemaVersion":1,"version":"0.8.2","distribution":"npm","target":"windows-arm64"}
@@ -136,7 +136,7 @@ async function readRuntimeMetadata(entryPath2, environment = process.env) {
136
136
  }
137
137
 
138
138
  // packages/update-manager/dist/github-release.js
139
- var CODEXHOST_LATEST_RELEASE_URL = "https://api.github.com/repos/LiberSeek/BOFT-CLI/releases/latest";
139
+ var CODEXHOST_LATEST_RELEASE_URL = "https://api.github.com/repos/LIBERSEEK/BOFT-CLI/releases/latest";
140
140
  var SHA256_DIGEST_PATTERN = /^sha256:([0-9a-f]{64})$/u;
141
141
  var RELEASE_NOTES_URL_PATTERN = /^https:\/\/github\.com\/(LiberSeek|LIBERSEEK)\/BOFT-CLI\/releases\/tag\/(v[0-9A-Za-z.+-]+)$/u;
142
142
  var DOWNLOAD_URL_PREFIXES = [
@@ -274,7 +274,7 @@ function selectInstallerReleaseArtifact(release, target) {
274
274
  // packages/update-manager/dist/github-cli-release.js
275
275
  import { execFile } from "node:child_process";
276
276
  import path3 from "node:path";
277
- var GITHUB_LATEST_RELEASE_ENDPOINT = "repos/BytePioneer-AI/codex-host/releases/latest";
277
+ var GITHUB_LATEST_RELEASE_ENDPOINT = "repos/LIBERSEEK/BOFT-CLI/releases/latest";
278
278
  var MAX_RELEASE_RESPONSE_BYTES = 1024 * 1024;
279
279
  var GITHUB_CLI_TIMEOUT_MS = 5e3;
280
280
  function defaultExecutableCandidates(environment, platform) {
@@ -363,39 +363,25 @@ async function regularFile(filePath) {
363
363
  throw error51;
364
364
  }
365
365
  }
366
- async function isUpdateOperationActive(stateDirectory) {
366
+ async function discoverActiveUpdateStatus(stateDirectory) {
367
367
  if (!path4.isAbsolute(stateDirectory))
368
368
  throw new Error("update state directory must be absolute");
369
- return regularFile(path4.join(stateDirectory, LOCK_FILE));
370
- }
371
- async function discoverLatestUpdateStatus(stateDirectory) {
372
- if (!path4.isAbsolute(stateDirectory))
373
- throw new Error("update state directory must be absolute");
374
- let entries;
369
+ const lockPath = path4.join(stateDirectory, LOCK_FILE);
370
+ if (!await regularFile(lockPath))
371
+ return null;
375
372
  try {
376
- entries = await readdir(stateDirectory, { withFileTypes: true });
377
- } catch (error51) {
378
- if (error51.code === "ENOENT")
373
+ const lock = JSON.parse(await readFile2(lockPath, "utf8"));
374
+ if (typeof lock.statusPath !== "string" || !path4.isAbsolute(lock.statusPath))
379
375
  return null;
380
- throw error51;
381
- }
382
- const candidates = [];
383
- for (const entry of entries) {
384
- if (!entry.isDirectory() || entry.isSymbolicLink() || !entry.name.startsWith("update-"))
385
- continue;
386
- const statusPath = path4.join(stateDirectory, entry.name, STATUS_FILE);
387
- if (!await regularFile(statusPath))
388
- continue;
389
- try {
390
- candidates.push({
391
- statusPath,
392
- status: parseUpdateStatus(JSON.parse(await readFile2(statusPath, "utf8")))
393
- });
394
- } catch {
395
- }
376
+ if (!await regularFile(lock.statusPath))
377
+ return null;
378
+ const status = parseUpdateStatus(JSON.parse(await readFile2(lock.statusPath, "utf8")));
379
+ if (TERMINAL_PHASES.has(status.phase))
380
+ return null;
381
+ return { statusPath: lock.statusPath, status };
382
+ } catch {
383
+ return null;
396
384
  }
397
- candidates.sort((left, right) => right.status.updatedAt - left.status.updatedAt);
398
- return candidates[0] ?? null;
399
385
  }
400
386
  async function cleanupTerminalUpdateState(stateDirectory, options = {}) {
401
387
  const now = Math.floor((options.now ?? Date.now()) / 1e3);
@@ -593,6 +579,48 @@ async function verifyDownloadedArtifact(source, filePath, result) {
593
579
  }
594
580
  }
595
581
 
582
+ // packages/update-manager/dist/updater-ready.js
583
+ import { setTimeout as delay } from "node:timers/promises";
584
+ async function waitForUpdaterReady(child, readStatus, timeoutMs = 1e4) {
585
+ let failure;
586
+ const onError = (error51) => {
587
+ failure = error51;
588
+ };
589
+ const onExit = () => {
590
+ failure = new Error("Background Updater exited before completing handoff");
591
+ };
592
+ child.on("error", onError);
593
+ child.on("exit", onExit);
594
+ const deadline = performance.now() + timeoutMs;
595
+ try {
596
+ while (true) {
597
+ const status = await readStatus();
598
+ if (status?.phase === "failed")
599
+ throw new Error(status.error ?? "Background Updater failed");
600
+ if (failure)
601
+ throw failure;
602
+ if (child.exitCode != null || child.signalCode != null) {
603
+ throw new Error("Background Updater exited before completing handoff");
604
+ }
605
+ if (status?.phase === "waiting-for-exit")
606
+ return;
607
+ if (status && status.phase !== "prepared") {
608
+ throw new Error(`Unexpected Updater phase during handoff: ${status.phase}`);
609
+ }
610
+ if (performance.now() >= deadline) {
611
+ throw new Error("Background Updater did not confirm handoff before the startup timeout");
612
+ }
613
+ await delay(20);
614
+ }
615
+ } catch (error51) {
616
+ child.kill();
617
+ throw error51;
618
+ } finally {
619
+ child.removeListener("error", onError);
620
+ child.removeListener("exit", onExit);
621
+ }
622
+ }
623
+
596
624
  // packages/update-manager/dist/update-manager.js
597
625
  var REQUEST_SCHEMA_VERSION = 1;
598
626
  var WINDOWS_RENAME_RETRY_DELAYS_MS = [10, 30, 70, 150, 300];
@@ -602,7 +630,7 @@ function errorMessage(error51) {
602
630
  function systemErrorCode(error51) {
603
631
  return typeof error51 === "object" && error51 !== null && "code" in error51 ? String(error51.code) : null;
604
632
  }
605
- function delay(milliseconds) {
633
+ function delay2(milliseconds) {
606
634
  return new Promise((resolve) => setTimeout(resolve, milliseconds));
607
635
  }
608
636
  async function replaceStatusFile(temporaryPath, statusPath) {
@@ -618,7 +646,7 @@ async function replaceStatusFile(temporaryPath, statusPath) {
618
646
  throw error51;
619
647
  }
620
648
  retryIndex += 1;
621
- await delay(retryDelay);
649
+ await delay2(retryDelay);
622
650
  }
623
651
  }
624
652
  }
@@ -838,14 +866,20 @@ function createBackgroundUpdateManager(dependencies = {}) {
838
866
  app_path: appPath
839
867
  }, artifact.artifactPath);
840
868
  },
841
- start(prepared) {
869
+ async start(prepared) {
842
870
  if (!preparedRequests.delete(prepared.requestPath)) {
843
871
  throw new Error("background update was not prepared by this manager or was already started");
844
872
  }
845
- const child = spawnUpdater(prepared.helperPath, prepared.requestPath);
846
- if (child.pid === void 0)
847
- throw new Error("background Updater did not report a process ID");
848
- return Object.freeze({ ...prepared, updaterPid: child.pid });
873
+ try {
874
+ const child = spawnUpdater(prepared.helperPath, prepared.requestPath);
875
+ await waitForUpdaterReady(child, () => this.readStatus(prepared.statusPath));
876
+ if (child.pid === void 0)
877
+ throw new Error("background Updater did not report a process ID");
878
+ return Object.freeze({ ...prepared, updaterPid: child.pid });
879
+ } catch (error51) {
880
+ await writeFailedStatus(prepared.statusPath, prepared.version, prepared.installation, error51);
881
+ throw error51;
882
+ }
849
883
  },
850
884
  async readStatus(statusPathValue) {
851
885
  const statusPath = requireAbsolutePath(statusPathValue, "update status path");
@@ -15460,6 +15494,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
15460
15494
  initializeOnly: external_exports.boolean().optional()
15461
15495
  });
15462
15496
 
15497
+ // packages/shared-contracts/dist/harness-presentation.js
15498
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
15499
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
15500
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
15501
+ label: displayText(256).optional(),
15502
+ description: displayText(1024).optional()
15503
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
15504
+ var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
15505
+
15463
15506
  // packages/shared-contracts/dist/model-price-overrides.js
15464
15507
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
15465
15508
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -15538,6 +15581,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
15538
15581
  harness,
15539
15582
  sessionId: external_exports.string().min(1).max(512),
15540
15583
  project: project.nullable(),
15584
+ /** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
15585
+ title: external_exports.string().min(1).max(200).optional(),
15541
15586
  /** Models the session used, most requests first. */
15542
15587
  models: external_exports.array(model).max(16),
15543
15588
  firstAtMs: count,
@@ -15604,7 +15649,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15604
15649
  * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
15605
15650
  * requests without a native session are not listed here but count everywhere else.
15606
15651
  */
15607
- sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
15652
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
15653
+ /**
15654
+ * The sessions last active in the range, newest first, all filters applied. Optional for older
15655
+ * Hosts; missing is treated as no list rather than no sessions.
15656
+ */
15657
+ recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
15608
15658
  });
15609
15659
 
15610
15660
  // packages/shared-contracts/dist/ids.js
@@ -15876,8 +15926,24 @@ var threadUsageSnapshotSchema = external_exports.object({
15876
15926
  }
15877
15927
  });
15878
15928
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
15929
+ var accountCreditsPeriodSchema = external_exports.enum([
15930
+ "weekly",
15931
+ "monthly",
15932
+ "five_hour",
15933
+ "seven_day",
15934
+ "unknown"
15935
+ ]);
15936
+ var accountCreditsScopeSchema = external_exports.object({
15937
+ id: external_exports.string().min(1).max(256),
15938
+ label: external_exports.string().min(1).max(256),
15939
+ localizations: harnessLocalizationsSchema.optional()
15940
+ }).strict();
15879
15941
  var accountCreditsProductUsageSchema = external_exports.object({
15880
15942
  product: external_exports.string().min(1),
15943
+ /** Native period and scope, never inferred from the display name. */
15944
+ periodType: accountCreditsPeriodSchema.optional(),
15945
+ scope: accountCreditsScopeSchema.optional(),
15946
+ localizations: harnessLocalizationsSchema.optional(),
15881
15947
  used: external_exports.number().finite().nonnegative().optional(),
15882
15948
  // Zero is a real empty cap, not an absent field.
15883
15949
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -15899,8 +15965,10 @@ var accountCreditsSnapshotSchema = external_exports.object({
15899
15965
  label: external_exports.string().min(1).optional(),
15900
15966
  usedPercent: usagePercentSchema.optional(),
15901
15967
  remaining: external_exports.number().finite().optional(),
15968
+ scope: accountCreditsScopeSchema.optional(),
15969
+ localizations: harnessLocalizationsSchema.optional(),
15902
15970
  resetsAt: external_exports.string().min(1).optional(),
15903
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
15971
+ periodType: accountCreditsPeriodSchema,
15904
15972
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
15905
15973
  resetCredits: accountResetCreditsSchema.optional()
15906
15974
  }).strict().superRefine((credits, context) => {
@@ -15925,7 +15993,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
15925
15993
  var threadUsageInspectionSchema = external_exports.object({
15926
15994
  threadId: hostThreadIdSchema,
15927
15995
  usage: threadUsageSnapshotSchema.nullable(),
15928
- accountCredits: accountCreditsSnapshotSchema.optional()
15996
+ accountCredits: accountCreditsSnapshotSchema.optional(),
15997
+ /** Whether this source can provide cached account quota independently of usage. */
15998
+ accountCreditsSupported: external_exports.boolean().optional()
15929
15999
  }).strict();
15930
16000
 
15931
16001
  // packages/shared-contracts/dist/harness-accounts.js
@@ -16052,7 +16122,8 @@ var harnessPermissionModeSchema = external_exports.object({
16052
16122
  id: harnessPermissionModeIdSchema,
16053
16123
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
16054
16124
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
16055
- dangerous: external_exports.boolean().optional()
16125
+ dangerous: external_exports.boolean().optional(),
16126
+ localizations: harnessLocalizationsSchema.optional()
16056
16127
  }).strict();
16057
16128
  var harnessPermissionModeCatalogSchema = external_exports.object({
16058
16129
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -16375,6 +16446,8 @@ var harnessInstallationStateSchema = external_exports.object({
16375
16446
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
16376
16447
  message: external_exports.string().max(2048).optional(),
16377
16448
  messageCode: external_exports.string().min(1).max(128).optional(),
16449
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
16450
+ notice: harnessLocalizedTextSchema.optional(),
16378
16451
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
16379
16452
  }).strict();
16380
16453
 
@@ -16513,6 +16586,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
16513
16586
  invocation: commandInvocationSchema,
16514
16587
  label: commandLabelSchema,
16515
16588
  description: commandDescriptionSchema.optional(),
16589
+ localizations: harnessLocalizationsSchema.optional(),
16516
16590
  argumentMode: external_exports.enum(["none", "text"]),
16517
16591
  /**
16518
16592
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -17564,14 +17638,15 @@ function createConsoleUpdates(options) {
17564
17638
  });
17565
17639
  let candidate = null;
17566
17640
  let handedOff = false;
17641
+ let currentStatusPath = null;
17567
17642
  async function latestStatus() {
17568
- const directory = stateDirectory();
17569
- const discovered = await discoverLatestUpdateStatus(directory);
17570
- if (!discovered) return null;
17571
- if (discovered.status.phase !== "succeeded" && discovered.status.phase !== "failed" && !await isUpdateOperationActive(directory)) {
17572
- return null;
17643
+ if (!currentStatusPath) {
17644
+ const active = await discoverActiveUpdateStatus(stateDirectory());
17645
+ if (!active) return null;
17646
+ currentStatusPath = active.statusPath;
17573
17647
  }
17574
- return publicStatus(discovered.status);
17648
+ const status = await manager.readStatus(currentStatusPath);
17649
+ return status ? publicStatus(status) : null;
17575
17650
  }
17576
17651
  function installable(metadata, release) {
17577
17652
  const kind = installationKind(metadata);
@@ -17698,6 +17773,7 @@ function createConsoleUpdates(options) {
17698
17773
  if (existing) return { status: existing };
17699
17774
  throw new ConsoleUpdateError("busy", "Another update operation is already active");
17700
17775
  }
17776
+ currentStatusPath = null;
17701
17777
  try {
17702
17778
  const release = await fetchLatest();
17703
17779
  if (compareSemanticVersions(metadata.version, release.version) >= 0 || candidate && candidate.version !== release.version) {
@@ -17716,9 +17792,10 @@ function createConsoleUpdates(options) {
17716
17792
  try {
17717
17793
  const prepared = await prepare(metadata, target, release, async (info) => {
17718
17794
  await lock.setStatusPath(info.statusPath);
17795
+ currentStatusPath = info.statusPath;
17719
17796
  resolvePrepared(info.statusPath);
17720
17797
  });
17721
- manager.start(prepared);
17798
+ await manager.start(prepared);
17722
17799
  handedOff = true;
17723
17800
  options.onHandedOff();
17724
17801
  } catch (error51) {
@@ -17751,7 +17828,7 @@ function createConsoleUpdates(options) {
17751
17828
 
17752
17829
  // packages/console-server/src/server.ts
17753
17830
  var CONSOLE_SERVICE = "codexhost-console";
17754
- var ISSUE_LIST_URL = "https://github.com/LiberSeek/BOFT-CLI/issues";
17831
+ var ISSUE_LIST_URL = "https://github.com/LIBERSEEK/BOFT-CLI/issues";
17755
17832
  var MAX_BODY_BYTES = 16 * 1024;
17756
17833
  var INSPECT_CACHE_MS = 2e3;
17757
17834
  var SECURITY_HEADERS = {
@@ -18225,7 +18302,7 @@ async function runUpdateCommand(target, updates, write = console.log) {
18225
18302
  const { status } = await updates.start(target);
18226
18303
  if (status.phase === "failed") throw new Error(status.error ?? "Update failed");
18227
18304
  write(
18228
- `Update ${status.version}: ${status.phase}. The background updater will finish installation and restart BOFT.`
18305
+ `Update ${status.version}: ${status.phase}. The background updater has accepted the handoff; installation is not complete yet. It will install the update and restart BOFT CLI.`
18229
18306
  );
18230
18307
  }
18231
18308
  async function updateFromCommand(appDirectory2, arguments_) {