@liberseek/boft-cli-linux-x64 0.7.7 → 0.7.9

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.
@@ -15007,6 +15007,10 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
15007
15007
  var hostItemIdSchema = opaqueIdSchema.brand();
15008
15008
  var hostInteractionIdSchema = opaqueIdSchema.brand();
15009
15009
 
15010
+ // ../../shared-contracts/dist/thread-prewarm.js
15011
+ var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15012
+ var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15013
+
15010
15014
  // ../../shared-contracts/dist/harness-plugins.js
15011
15015
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15012
15016
  var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
@@ -15074,6 +15078,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
15074
15078
  url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
15075
15079
  });
15076
15080
  var CONSOLE_HOST_METHODS = Object.freeze([
15081
+ "codexhost/console/remote-connections",
15082
+ "codexhost/runtime/status",
15083
+ "codexhost/remote/ssh-setup",
15077
15084
  "codexhost/harness/plugins/list",
15078
15085
  "codexhost/harness/display-settings/get",
15079
15086
  "codexhost/harness/display-settings/set",
@@ -15702,7 +15709,10 @@ var harnessInstallationStateSchema = external_exports.object({
15702
15709
  latestVersion: external_exports.string().min(1).max(128),
15703
15710
  updateAvailable: external_exports.boolean(),
15704
15711
  canUpdate: external_exports.boolean(),
15705
- message: external_exports.string().max(2048).optional()
15712
+ // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15713
+ message: external_exports.string().max(2048).optional(),
15714
+ messageCode: external_exports.string().min(1).max(128).optional(),
15715
+ latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15706
15716
  }).strict();
15707
15717
 
15708
15718
  // ../../shared-contracts/dist/codex-accounts.js
@@ -15997,7 +16007,7 @@ var updateStatusSchema = external_exports.strictObject({
15997
16007
  }
15998
16008
  });
15999
16009
  var updateEmptyParamsSchema = external_exports.strictObject({});
16000
- 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");
16010
+ 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");
16001
16011
  var updateCheckResultSchema = external_exports.strictObject({
16002
16012
  currentVersion: updateSemanticVersionSchema,
16003
16013
  installation: updateInstallationSchema.nullable(),
@@ -16016,6 +16026,80 @@ var updateStatusResultSchema = external_exports.strictObject({
16016
16026
  status: updateStatusSchema.nullable()
16017
16027
  });
16018
16028
 
16029
+ // ../../shared-contracts/dist/remote-runtime.js
16030
+ var remoteUpdatePhaseSchema = external_exports.enum([
16031
+ "idle",
16032
+ "installing",
16033
+ "restarting",
16034
+ "succeeded",
16035
+ "failed"
16036
+ ]);
16037
+ var runtimeStatusSchema = external_exports.object({
16038
+ runningVersion: external_exports.string().nullable(),
16039
+ installedVersion: external_exports.string().nullable(),
16040
+ restartRequired: external_exports.boolean(),
16041
+ remote: external_exports.boolean(),
16042
+ updateSupported: external_exports.boolean(),
16043
+ update: external_exports.object({
16044
+ phase: remoteUpdatePhaseSchema,
16045
+ targetVersion: external_exports.string().nullable(),
16046
+ error: external_exports.string().nullable()
16047
+ })
16048
+ });
16049
+ var remoteUpdateParamsSchema = external_exports.object({
16050
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
16051
+ }).strict();
16052
+ var remoteSshSetupParamsSchema = external_exports.object({
16053
+ hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
16054
+ port: external_exports.number().int().min(1).max(65535).nullable(),
16055
+ identity: external_exports.string().max(4096).nullable(),
16056
+ action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
16057
+ uninstallPackage: external_exports.boolean().optional(),
16058
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
16059
+ }).strict();
16060
+ var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
16061
+
16062
+ // ../../shared-contracts/dist/remote-connections.js
16063
+ var hostId = external_exports.string().min(1).max(1024);
16064
+ var codexSshConnectionSchema = external_exports.object({
16065
+ hostId,
16066
+ displayName: external_exports.string().min(1).max(1024),
16067
+ source: external_exports.enum(["codex-managed", "discovered"]),
16068
+ sshAlias: external_exports.string().max(1024).nullable(),
16069
+ sshHost: external_exports.string().min(1).max(1024),
16070
+ sshPort: external_exports.number().int().min(1).max(65535).nullable(),
16071
+ identity: external_exports.string().max(4096).nullable(),
16072
+ autoConnect: external_exports.boolean(),
16073
+ connectionAnalyticsId: external_exports.string().max(1024).optional()
16074
+ });
16075
+ var codexSshDraftSchema = external_exports.strictObject({
16076
+ displayName: external_exports.string().min(1).max(1024),
16077
+ hostname: external_exports.string().min(1).max(1024),
16078
+ sshPort: external_exports.number().int().min(1).max(65535).nullable(),
16079
+ identity: external_exports.string().max(4096).nullable()
16080
+ });
16081
+ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
16082
+ external_exports.strictObject({ action: external_exports.literal("list") }),
16083
+ external_exports.strictObject({
16084
+ action: external_exports.literal("save"),
16085
+ draft: codexSshDraftSchema,
16086
+ previous: codexSshConnectionSchema.nullable()
16087
+ }),
16088
+ external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
16089
+ external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
16090
+ external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
16091
+ external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
16092
+ external_exports.strictObject({
16093
+ action: external_exports.literal("update"),
16094
+ hostId: hostId.refine((id) => id !== "local"),
16095
+ version: remoteUpdateParamsSchema.shape.version
16096
+ })
16097
+ ]);
16098
+ var remoteConnectionsReplySchema = external_exports.union([
16099
+ external_exports.strictObject({ result: jsonValueSchema }),
16100
+ external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
16101
+ ]);
16102
+
16019
16103
  // ../../shared-contracts/dist/index.js
16020
16104
  var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
16021
16105
 
@@ -18652,20 +18736,105 @@ import { opendir, realpath as realpath3, stat } from "node:fs/promises";
18652
18736
  import os3 from "node:os";
18653
18737
  import path11 from "node:path";
18654
18738
  import { createInterface as createInterface2 } from "node:readline";
18655
- var PiSessionChangedError = class extends Error {
18656
- constructor() {
18657
- super("Pi Session changed during discovery; refresh and retry");
18739
+
18740
+ // ../../harness-adapter/dist/session-import.js
18741
+ var SessionImportChangedError = class extends Error {
18742
+ constructor(message3 = "Native Session changed during discovery; refresh and retry") {
18743
+ super(message3);
18744
+ this.name = "SessionImportChangedError";
18658
18745
  }
18659
18746
  };
18660
- function sameFile(left, right) {
18661
- return left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs && left.ino === right.ino && left.dev === right.dev;
18747
+ function isMissingFileError(error51) {
18748
+ return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
18749
+ }
18750
+ function sameFileFingerprint(left, right) {
18751
+ return left === null || right === null ? left === right : left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
18662
18752
  }
18753
+ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
18754
+ if (typeof value !== "string")
18755
+ return null;
18756
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
18757
+ if (!normalized)
18758
+ return null;
18759
+ if (normalized.length <= maxLength)
18760
+ return normalized;
18761
+ const characters = [...normalized];
18762
+ if (characters.length <= maxLength)
18763
+ return normalized;
18764
+ return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
18765
+ }
18766
+ function sessionImportCandidate(input) {
18767
+ const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
18768
+ const parsed = harnessSessionImportCandidateSchema.safeParse({
18769
+ nativeSessionId: input.nativeSessionId,
18770
+ cwd: input.cwd,
18771
+ title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
18772
+ updatedAt: Math.floor(time3),
18773
+ // Unknown must stay unknown; only an explicit boolean is a native statement.
18774
+ running: typeof input.running === "boolean" ? input.running : null
18775
+ });
18776
+ return parsed.success ? parsed.data : null;
18777
+ }
18778
+ var SessionImportScope = class {
18779
+ #abort = new AbortController();
18780
+ #options;
18781
+ #pending = /* @__PURE__ */ new Set();
18782
+ constructor(options) {
18783
+ this.#options = options;
18784
+ }
18785
+ #closed() {
18786
+ return {
18787
+ ok: false,
18788
+ error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
18789
+ };
18790
+ }
18791
+ read(operation) {
18792
+ const signal = this.#abort.signal;
18793
+ if (signal.aborted)
18794
+ return Promise.resolve(this.#closed());
18795
+ let started;
18796
+ try {
18797
+ started = operation(signal);
18798
+ } catch (error51) {
18799
+ started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
18800
+ }
18801
+ const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
18802
+ ok: false,
18803
+ error: {
18804
+ code: "unavailable",
18805
+ message: this.#options.unavailableMessage,
18806
+ retryable: true
18807
+ }
18808
+ }).finally(() => this.#pending.delete(request));
18809
+ this.#pending.add(request);
18810
+ return request;
18811
+ }
18812
+ /** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
18813
+ async resolve(operation) {
18814
+ const result = await this.read(operation);
18815
+ if (!result.ok)
18816
+ return result;
18817
+ return result.value ? { ok: true, value: result.value } : {
18818
+ ok: false,
18819
+ error: {
18820
+ code: "sessionNotFound",
18821
+ message: this.#options.notFoundMessage,
18822
+ retryable: false
18823
+ }
18824
+ };
18825
+ }
18826
+ /** Idempotent. Resolves after every started read has settled. */
18827
+ async close() {
18828
+ this.#abort.abort();
18829
+ await Promise.allSettled(this.#pending);
18830
+ }
18831
+ };
18832
+
18833
+ // dist/pi-session-import.js
18834
+ var PI_SESSION_CHANGED = "Pi Session changed during discovery; refresh and retry";
18663
18835
  function isRecord4(value) {
18664
18836
  return typeof value === "object" && value !== null && !Array.isArray(value);
18665
18837
  }
18666
- function missing(error51) {
18667
- return isRecord4(error51) && error51.code === "ENOENT";
18668
- }
18669
18838
  function expandDirectory(value, home) {
18670
18839
  return path11.resolve(value === "~" ? home : value.startsWith(`~${path11.sep}`) || value.startsWith("~/") ? path11.join(home, value.slice(2)) : value);
18671
18840
  }
@@ -18685,7 +18854,7 @@ async function sessionFiles(directory, flat, signal) {
18685
18854
  const visit = async (dir, projectLevel) => {
18686
18855
  signal.throwIfAborted();
18687
18856
  const entries = await opendir(dir).catch((error51) => {
18688
- if (missing(error51))
18857
+ if (isMissingFileError(error51))
18689
18858
  return null;
18690
18859
  throw error51;
18691
18860
  });
@@ -18740,12 +18909,12 @@ async function readCandidate(file2, signal) {
18740
18909
  if (!firstMessage && entry.type === "message" && message3?.role === "user") {
18741
18910
  const content = message3.content;
18742
18911
  const text2 = typeof content === "string" ? content : Array.isArray(content) ? content.filter((block) => isRecord4(block) && block.type === "text" && typeof block.text === "string").map((block) => block.text).join(" ") : "";
18743
- firstMessage = text2.replaceAll("\0", "").trim().slice(0, HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) || null;
18912
+ firstMessage = sessionImportTitle(text2);
18744
18913
  }
18745
18914
  hasUser = entry.type === "message" && message3?.role === "user" || typeof entry.parentId === "string" && entries.get(entry.parentId) === true;
18746
18915
  entries.set(entry.id, hasUser);
18747
18916
  if (entry.type === "session_info")
18748
- name = typeof entry.name === "string" ? entry.name.trim() || null : null;
18917
+ name = sessionImportTitle(entry.name);
18749
18918
  if (entry.type === "message" && (message3?.role === "user" || message3?.role === "assistant")) {
18750
18919
  const time3 = typeof message3.timestamp === "number" ? message3.timestamp : typeof entry.timestamp === "string" ? Date.parse(entry.timestamp) : NaN;
18751
18920
  if (Number.isFinite(time3))
@@ -18761,8 +18930,8 @@ async function readCandidate(file2, signal) {
18761
18930
  if (!hasUser)
18762
18931
  return null;
18763
18932
  const after = await stat(file2);
18764
- if (!sameFile(before, after))
18765
- throw new PiSessionChangedError();
18933
+ if (!sameFileFingerprint(before, after))
18934
+ throw new SessionImportChangedError(PI_SESSION_CHANGED);
18766
18935
  const cwd = await realpath3(String(header.cwd));
18767
18936
  if (!(await stat(cwd)).isDirectory())
18768
18937
  return null;
@@ -18772,14 +18941,13 @@ async function readCandidate(file2, signal) {
18772
18941
  locator: { sessionFile: await realpath3(file2) },
18773
18942
  formatVersion: 1
18774
18943
  });
18775
- const candidate = harnessSessionImportCandidateSchema.safeParse({
18944
+ const candidate = sessionImportCandidate({
18776
18945
  nativeSessionId: header.id,
18777
18946
  cwd,
18778
18947
  title: name ?? firstMessage,
18779
- updatedAt: Math.floor(updatedAt),
18780
- running: null
18948
+ updatedAt
18781
18949
  });
18782
- return candidate.success && nativeRef.success ? { candidate: candidate.data, nativeRef: nativeRef.data } : null;
18950
+ return candidate && nativeRef.success ? { candidate, nativeRef: nativeRef.data } : null;
18783
18951
  }
18784
18952
  async function readIdentity(file2, signal) {
18785
18953
  const stream = createReadStream2(file2, { encoding: "utf8", signal });
@@ -18827,7 +18995,7 @@ var PiSessionImportIndex = class {
18827
18995
  try {
18828
18996
  const fingerprint = await stat(file2);
18829
18997
  const cached2 = this.#cache.get(file2);
18830
- const source = cached2 && sameFile(cached2.fingerprint, fingerprint) ? cached2.source : await readCandidate(file2, signal);
18998
+ const source = cached2 && sameFileFingerprint(cached2.fingerprint, fingerprint) ? cached2.source : await readCandidate(file2, signal);
18831
18999
  if (!source)
18832
19000
  continue;
18833
19001
  if (!(await stat(source.candidate.cwd)).isDirectory())
@@ -18838,7 +19006,7 @@ var PiSessionImportIndex = class {
18838
19006
  next.set(file2, { fingerprint, source });
18839
19007
  sources.push(source);
18840
19008
  } catch (error51) {
18841
- if (!missing(error51) && !(error51 instanceof PiSessionChangedError))
19009
+ if (!isMissingFileError(error51) && !(error51 instanceof SessionImportChangedError))
18842
19010
  throw error51;
18843
19011
  }
18844
19012
  }
@@ -18853,14 +19021,14 @@ var PiSessionImportIndex = class {
18853
19021
  try {
18854
19022
  const fingerprint = await stat(file2);
18855
19023
  const cached2 = this.#cache.get(file2);
18856
- const id = cached2 && sameFile(cached2.fingerprint, fingerprint) ? cached2.source.nativeRef.nativeSessionId : await readIdentity(file2, signal);
19024
+ const id = cached2 && sameFileFingerprint(cached2.fingerprint, fingerprint) ? cached2.source.nativeRef.nativeSessionId : await readIdentity(file2, signal);
18857
19025
  if (id !== nativeSessionId)
18858
19026
  continue;
18859
19027
  if (selected)
18860
19028
  throw new Error("Pi Session identity is ambiguous across files");
18861
19029
  selected = file2;
18862
19030
  } catch (error51) {
18863
- if (!missing(error51))
19031
+ if (!isMissingFileError(error51))
18864
19032
  throw error51;
18865
19033
  }
18866
19034
  }
@@ -18870,7 +19038,7 @@ var PiSessionImportIndex = class {
18870
19038
  const source = await readCandidate(selected, signal);
18871
19039
  return source?.nativeRef.nativeSessionId === nativeSessionId ? source : null;
18872
19040
  } catch (error51) {
18873
- if (missing(error51))
19041
+ if (isMissingFileError(error51))
18874
19042
  return null;
18875
19043
  throw error51;
18876
19044
  }
@@ -21893,27 +22061,17 @@ var PiAdapter = class {
21893
22061
  };
21894
22062
  sessionImport = Object.freeze({
21895
22063
  listCandidates: async () => {
21896
- const result = await this.#readImport((signal) => this.#importIndex.list(signal));
22064
+ const result = await this.#importScope.read((signal) => this.#importIndex.list(signal));
21897
22065
  return result.ok ? { ok: true, value: result.value.map(({ candidate }) => candidate) } : result;
21898
22066
  },
21899
- resolveCandidate: async (nativeSessionId) => {
21900
- const result = await this.#readImport((signal) => this.#importIndex.resolve(nativeSessionId, signal));
21901
- if (!result.ok)
21902
- return result;
21903
- const source = result.value;
21904
- return source ? { ok: true, value: source } : {
21905
- ok: false,
21906
- error: {
21907
- code: "sessionNotFound",
21908
- message: "Pi Session is no longer importable",
21909
- retryable: false
21910
- }
21911
- };
21912
- }
22067
+ resolveCandidate: (nativeSessionId) => this.#importScope.resolve((signal) => this.#importIndex.resolve(nativeSessionId, signal))
21913
22068
  });
21914
22069
  #importIndex;
21915
- #importAbort = new AbortController();
21916
- #importRequests = /* @__PURE__ */ new Set();
22070
+ #importScope = new SessionImportScope({
22071
+ closedMessage: "Pi Adapter is closed",
22072
+ unavailableMessage: "Pi Session discovery failed; check storage access and duplicate Session identities, then retry after closing native clients",
22073
+ notFoundMessage: "Pi Session is no longer importable"
22074
+ });
21917
22075
  #closeTimeoutMs;
21918
22076
  #createTransport;
21919
22077
  #inspectionCache = /* @__PURE__ */ new Map();
@@ -21956,20 +22114,6 @@ var PiAdapter = class {
21956
22114
  const accounts = await this.inspectAccounts();
21957
22115
  return accounts[0] ?? null;
21958
22116
  }
21959
- #readImport(operation) {
21960
- if (this.#importAbort.signal.aborted)
21961
- return Promise.resolve({ ok: false, error: invalidState("Pi Adapter is closed") });
21962
- const request = operation(this.#importAbort.signal).then((value) => ({ ok: true, value })).catch(() => ({
21963
- ok: false,
21964
- error: {
21965
- code: "unavailable",
21966
- message: "Pi Session discovery failed; check storage access and duplicate Session identities, then retry after closing native clients",
21967
- retryable: true
21968
- }
21969
- })).finally(() => this.#importRequests.delete(request));
21970
- this.#importRequests.add(request);
21971
- return request;
21972
- }
21973
22117
  async inspect(input = {}) {
21974
22118
  if (this.#closePromise) {
21975
22119
  return {
@@ -22297,9 +22441,8 @@ var PiAdapter = class {
22297
22441
  }
22298
22442
  close() {
22299
22443
  if (!this.#closePromise) {
22300
- this.#importAbort.abort();
22301
22444
  this.#closePromise = Promise.all([
22302
- ...this.#importRequests,
22445
+ this.#importScope.close(),
22303
22446
  ...[...this.#inspections].map((transport) => transport.close()),
22304
22447
  ...[...this.#sessions].map((session) => session.close())
22305
22448
  ]).then(() => void 0);