@liberseek/boft-cli-win32-arm64 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.
@@ -3229,8 +3229,8 @@ var require_utils = __commonJS({
3229
3229
  }
3230
3230
  return ind;
3231
3231
  }
3232
- function removeDotSegments(path6) {
3233
- let input = path6;
3232
+ function removeDotSegments(path7) {
3233
+ let input = path7;
3234
3234
  const output = [];
3235
3235
  let nextSlash = -1;
3236
3236
  let len = 0;
@@ -3482,8 +3482,8 @@ var require_schemes = __commonJS({
3482
3482
  wsComponent.secure = void 0;
3483
3483
  }
3484
3484
  if (wsComponent.resourceName) {
3485
- const [path6, query] = wsComponent.resourceName.split("?");
3486
- wsComponent.path = path6 && path6 !== "/" ? path6 : void 0;
3485
+ const [path7, query] = wsComponent.resourceName.split("?");
3486
+ wsComponent.path = path7 && path7 !== "/" ? path7 : void 0;
3487
3487
  wsComponent.query = query;
3488
3488
  wsComponent.resourceName = void 0;
3489
3489
  }
@@ -12592,7 +12592,7 @@ var require_dist = __commonJS({
12592
12592
 
12593
12593
  // ../qoder/dist/qoder-adapter.js
12594
12594
  import { randomUUID as randomUUID2 } from "node:crypto";
12595
- import path5 from "node:path";
12595
+ import path6 from "node:path";
12596
12596
 
12597
12597
  // ../../../node_modules/zod/v4/classic/external.js
12598
12598
  var external_exports = {};
@@ -13360,10 +13360,10 @@ function mergeDefs(...defs) {
13360
13360
  function cloneDef(schema) {
13361
13361
  return mergeDefs(schema._zod.def);
13362
13362
  }
13363
- function getElementAtPath(obj, path6) {
13364
- if (!path6)
13363
+ function getElementAtPath(obj, path7) {
13364
+ if (!path7)
13365
13365
  return obj;
13366
- return path6.reduce((acc, key) => acc?.[key], obj);
13366
+ return path7.reduce((acc, key) => acc?.[key], obj);
13367
13367
  }
13368
13368
  function promiseAllObject(promisesObj) {
13369
13369
  const keys = Object.keys(promisesObj);
@@ -13772,11 +13772,11 @@ function explicitlyAborted(x3, startIndex = 0) {
13772
13772
  }
13773
13773
  return false;
13774
13774
  }
13775
- function prefixIssues(path6, issues) {
13775
+ function prefixIssues(path7, issues) {
13776
13776
  return issues.map((iss) => {
13777
13777
  var _a5;
13778
13778
  (_a5 = iss).path ?? (_a5.path = []);
13779
- iss.path.unshift(path6);
13779
+ iss.path.unshift(path7);
13780
13780
  return iss;
13781
13781
  });
13782
13782
  }
@@ -13923,16 +13923,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
13923
13923
  }
13924
13924
  function formatError(error51, mapper = (issue2) => issue2.message) {
13925
13925
  const fieldErrors = { _errors: [] };
13926
- const processError = (error52, path6 = []) => {
13926
+ const processError = (error52, path7 = []) => {
13927
13927
  for (const issue2 of error52.issues) {
13928
13928
  if (issue2.code === "invalid_union" && issue2.errors.length) {
13929
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
13929
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
13930
13930
  } else if (issue2.code === "invalid_key") {
13931
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
13931
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
13932
13932
  } else if (issue2.code === "invalid_element") {
13933
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
13933
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
13934
13934
  } else {
13935
- const fullpath = [...path6, ...issue2.path];
13935
+ const fullpath = [...path7, ...issue2.path];
13936
13936
  if (fullpath.length === 0) {
13937
13937
  fieldErrors._errors.push(mapper(issue2));
13938
13938
  } else {
@@ -13959,17 +13959,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
13959
13959
  }
13960
13960
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
13961
13961
  const result = { errors: [] };
13962
- const processError = (error52, path6 = []) => {
13962
+ const processError = (error52, path7 = []) => {
13963
13963
  var _a5, _b;
13964
13964
  for (const issue2 of error52.issues) {
13965
13965
  if (issue2.code === "invalid_union" && issue2.errors.length) {
13966
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
13966
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
13967
13967
  } else if (issue2.code === "invalid_key") {
13968
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
13968
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
13969
13969
  } else if (issue2.code === "invalid_element") {
13970
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
13970
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
13971
13971
  } else {
13972
- const fullpath = [...path6, ...issue2.path];
13972
+ const fullpath = [...path7, ...issue2.path];
13973
13973
  if (fullpath.length === 0) {
13974
13974
  result.errors.push(mapper(issue2));
13975
13975
  continue;
@@ -14001,8 +14001,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
14001
14001
  }
14002
14002
  function toDotPath(_path) {
14003
14003
  const segs = [];
14004
- const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
14005
- for (const seg of path6) {
14004
+ const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
14005
+ for (const seg of path7) {
14006
14006
  if (typeof seg === "number")
14007
14007
  segs.push(`[${seg}]`);
14008
14008
  else if (typeof seg === "symbol")
@@ -26694,13 +26694,13 @@ function resolveRef(ref, ctx) {
26694
26694
  if (!ref.startsWith("#")) {
26695
26695
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
26696
26696
  }
26697
- const path6 = ref.slice(1).split("/").filter(Boolean);
26698
- if (path6.length === 0) {
26697
+ const path7 = ref.slice(1).split("/").filter(Boolean);
26698
+ if (path7.length === 0) {
26699
26699
  return ctx.rootSchema;
26700
26700
  }
26701
26701
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
26702
- if (path6[0] === defsKey) {
26703
- const key = path6[1];
26702
+ if (path7[0] === defsKey) {
26703
+ const key = path7[1];
26704
26704
  if (!key || !ctx.defs[key]) {
26705
26705
  throw new Error(`Reference not found: ${ref}`);
26706
26706
  }
@@ -27188,6 +27188,10 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
27188
27188
  var hostItemIdSchema = opaqueIdSchema.brand();
27189
27189
  var hostInteractionIdSchema = opaqueIdSchema.brand();
27190
27190
 
27191
+ // ../../shared-contracts/dist/thread-prewarm.js
27192
+ var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
27193
+ var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
27194
+
27191
27195
  // ../../shared-contracts/dist/harness-plugins.js
27192
27196
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
27193
27197
  var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
@@ -27255,6 +27259,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
27255
27259
  url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
27256
27260
  });
27257
27261
  var CONSOLE_HOST_METHODS = Object.freeze([
27262
+ "codexhost/console/remote-connections",
27263
+ "codexhost/runtime/status",
27264
+ "codexhost/remote/ssh-setup",
27258
27265
  "codexhost/harness/plugins/list",
27259
27266
  "codexhost/harness/display-settings/get",
27260
27267
  "codexhost/harness/display-settings/set",
@@ -27883,7 +27890,10 @@ var harnessInstallationStateSchema = external_exports.object({
27883
27890
  latestVersion: external_exports.string().min(1).max(128),
27884
27891
  updateAvailable: external_exports.boolean(),
27885
27892
  canUpdate: external_exports.boolean(),
27886
- message: external_exports.string().max(2048).optional()
27893
+ // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
27894
+ message: external_exports.string().max(2048).optional(),
27895
+ messageCode: external_exports.string().min(1).max(128).optional(),
27896
+ latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
27887
27897
  }).strict();
27888
27898
 
27889
27899
  // ../../shared-contracts/dist/codex-accounts.js
@@ -28178,7 +28188,7 @@ var updateStatusSchema = external_exports.strictObject({
28178
28188
  }
28179
28189
  });
28180
28190
  var updateEmptyParamsSchema = external_exports.strictObject({});
28181
- 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");
28191
+ 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");
28182
28192
  var updateCheckResultSchema = external_exports.strictObject({
28183
28193
  currentVersion: updateSemanticVersionSchema,
28184
28194
  installation: updateInstallationSchema.nullable(),
@@ -28197,6 +28207,80 @@ var updateStatusResultSchema = external_exports.strictObject({
28197
28207
  status: updateStatusSchema.nullable()
28198
28208
  });
28199
28209
 
28210
+ // ../../shared-contracts/dist/remote-runtime.js
28211
+ var remoteUpdatePhaseSchema = external_exports.enum([
28212
+ "idle",
28213
+ "installing",
28214
+ "restarting",
28215
+ "succeeded",
28216
+ "failed"
28217
+ ]);
28218
+ var runtimeStatusSchema = external_exports.object({
28219
+ runningVersion: external_exports.string().nullable(),
28220
+ installedVersion: external_exports.string().nullable(),
28221
+ restartRequired: external_exports.boolean(),
28222
+ remote: external_exports.boolean(),
28223
+ updateSupported: external_exports.boolean(),
28224
+ update: external_exports.object({
28225
+ phase: remoteUpdatePhaseSchema,
28226
+ targetVersion: external_exports.string().nullable(),
28227
+ error: external_exports.string().nullable()
28228
+ })
28229
+ });
28230
+ var remoteUpdateParamsSchema = external_exports.object({
28231
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
28232
+ }).strict();
28233
+ var remoteSshSetupParamsSchema = external_exports.object({
28234
+ hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
28235
+ port: external_exports.number().int().min(1).max(65535).nullable(),
28236
+ identity: external_exports.string().max(4096).nullable(),
28237
+ action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
28238
+ uninstallPackage: external_exports.boolean().optional(),
28239
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
28240
+ }).strict();
28241
+ var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
28242
+
28243
+ // ../../shared-contracts/dist/remote-connections.js
28244
+ var hostId = external_exports.string().min(1).max(1024);
28245
+ var codexSshConnectionSchema = external_exports.object({
28246
+ hostId,
28247
+ displayName: external_exports.string().min(1).max(1024),
28248
+ source: external_exports.enum(["codex-managed", "discovered"]),
28249
+ sshAlias: external_exports.string().max(1024).nullable(),
28250
+ sshHost: external_exports.string().min(1).max(1024),
28251
+ sshPort: external_exports.number().int().min(1).max(65535).nullable(),
28252
+ identity: external_exports.string().max(4096).nullable(),
28253
+ autoConnect: external_exports.boolean(),
28254
+ connectionAnalyticsId: external_exports.string().max(1024).optional()
28255
+ });
28256
+ var codexSshDraftSchema = external_exports.strictObject({
28257
+ displayName: external_exports.string().min(1).max(1024),
28258
+ hostname: external_exports.string().min(1).max(1024),
28259
+ sshPort: external_exports.number().int().min(1).max(65535).nullable(),
28260
+ identity: external_exports.string().max(4096).nullable()
28261
+ });
28262
+ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
28263
+ external_exports.strictObject({ action: external_exports.literal("list") }),
28264
+ external_exports.strictObject({
28265
+ action: external_exports.literal("save"),
28266
+ draft: codexSshDraftSchema,
28267
+ previous: codexSshConnectionSchema.nullable()
28268
+ }),
28269
+ external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
28270
+ external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
28271
+ external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
28272
+ external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
28273
+ external_exports.strictObject({
28274
+ action: external_exports.literal("update"),
28275
+ hostId: hostId.refine((id) => id !== "local"),
28276
+ version: remoteUpdateParamsSchema.shape.version
28277
+ })
28278
+ ]);
28279
+ var remoteConnectionsReplySchema = external_exports.union([
28280
+ external_exports.strictObject({ result: jsonValueSchema }),
28281
+ external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
28282
+ ]);
28283
+
28200
28284
  // ../../shared-contracts/dist/index.js
28201
28285
  var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
28202
28286
 
@@ -28862,6 +28946,26 @@ function mapQoderException(error51) {
28862
28946
  };
28863
28947
  }
28864
28948
 
28949
+ // ../qoder/dist/qoder-login-check.js
28950
+ import { execFile as execFile2 } from "node:child_process";
28951
+ function qoderLoginRequired(text) {
28952
+ return /\bnot logged in\b|\bauthentication (?:required|expired)\b/i.test(text);
28953
+ }
28954
+ function checkQoderLogin(executable, environment, cwd) {
28955
+ return new Promise((resolve) => {
28956
+ execFile2(executable, ["--list-models"], {
28957
+ env: environment,
28958
+ cwd,
28959
+ timeout: 1e4,
28960
+ maxBuffer: 64 * 1024,
28961
+ windowsHide: true
28962
+ }, (error51, stdout, stderr) => {
28963
+ resolve(Boolean(error51 && !error51.killed && qoderLoginRequired(`${stdout}
28964
+ ${stderr}`)));
28965
+ });
28966
+ });
28967
+ }
28968
+
28865
28969
  // ../../harness-adapter/dist/approval.js
28866
28970
  function invalidRequest(message) {
28867
28971
  return { code: "invalidRequest", message, retryable: false };
@@ -30219,8 +30323,8 @@ function getErrorMap2() {
30219
30323
 
30220
30324
  // ../../../node_modules/zod/v3/helpers/parseUtil.js
30221
30325
  var makeIssue = (params) => {
30222
- const { data, path: path6, errorMaps, issueData } = params;
30223
- const fullPath = [...path6, ...issueData.path || []];
30326
+ const { data, path: path7, errorMaps, issueData } = params;
30327
+ const fullPath = [...path7, ...issueData.path || []];
30224
30328
  const fullIssue = {
30225
30329
  ...issueData,
30226
30330
  path: fullPath
@@ -30335,11 +30439,11 @@ var errorUtil;
30335
30439
 
30336
30440
  // ../../../node_modules/zod/v3/types.js
30337
30441
  var ParseInputLazyPath = class {
30338
- constructor(parent, value, path6, key) {
30442
+ constructor(parent, value, path7, key) {
30339
30443
  this._cachedPath = [];
30340
30444
  this.parent = parent;
30341
30445
  this.data = value;
30342
- this._path = path6;
30446
+ this._path = path7;
30343
30447
  this._key = key;
30344
30448
  }
30345
30449
  get path() {
@@ -33866,11 +33970,11 @@ function normalizeObjectSchema(schema) {
33866
33970
  }
33867
33971
  return void 0;
33868
33972
  }
33869
- function getDotPath(path6) {
33870
- if (path6.length === 0) {
33973
+ function getDotPath(path7) {
33974
+ if (path7.length === 0) {
33871
33975
  return "object root";
33872
33976
  }
33873
- return path6.reduce((acc, seg, index) => {
33977
+ return path7.reduce((acc, seg, index) => {
33874
33978
  if (index === 0) {
33875
33979
  return String(seg);
33876
33980
  }
@@ -52441,12 +52545,171 @@ var QoderSession = class {
52441
52545
  }
52442
52546
  };
52443
52547
 
52548
+ // ../qoder/dist/qoder-session-import.js
52549
+ import { stat } from "node:fs/promises";
52550
+ import path5 from "node:path";
52551
+
52552
+ // ../../harness-adapter/dist/session-import.js
52553
+ var STORAGE_ACCESS_ERRORS = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"]);
52554
+ function isStorageAccessError(error51) {
52555
+ return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" && STORAGE_ACCESS_ERRORS.has(error51.code);
52556
+ }
52557
+ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
52558
+ if (typeof value !== "string")
52559
+ return null;
52560
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
52561
+ if (!normalized)
52562
+ return null;
52563
+ if (normalized.length <= maxLength)
52564
+ return normalized;
52565
+ const characters = [...normalized];
52566
+ if (characters.length <= maxLength)
52567
+ return normalized;
52568
+ return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
52569
+ }
52570
+ function sessionImportCandidate(input) {
52571
+ const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
52572
+ const parsed = harnessSessionImportCandidateSchema.safeParse({
52573
+ nativeSessionId: input.nativeSessionId,
52574
+ cwd: input.cwd,
52575
+ title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
52576
+ updatedAt: Math.floor(time3),
52577
+ // Unknown must stay unknown; only an explicit boolean is a native statement.
52578
+ running: typeof input.running === "boolean" ? input.running : null
52579
+ });
52580
+ return parsed.success ? parsed.data : null;
52581
+ }
52582
+ var SessionImportScope = class {
52583
+ #abort = new AbortController();
52584
+ #options;
52585
+ #pending = /* @__PURE__ */ new Set();
52586
+ constructor(options) {
52587
+ this.#options = options;
52588
+ }
52589
+ #closed() {
52590
+ return {
52591
+ ok: false,
52592
+ error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
52593
+ };
52594
+ }
52595
+ read(operation) {
52596
+ const signal = this.#abort.signal;
52597
+ if (signal.aborted)
52598
+ return Promise.resolve(this.#closed());
52599
+ let started;
52600
+ try {
52601
+ started = operation(signal);
52602
+ } catch (error51) {
52603
+ started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
52604
+ }
52605
+ const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
52606
+ ok: false,
52607
+ error: {
52608
+ code: "unavailable",
52609
+ message: this.#options.unavailableMessage,
52610
+ retryable: true
52611
+ }
52612
+ }).finally(() => this.#pending.delete(request));
52613
+ this.#pending.add(request);
52614
+ return request;
52615
+ }
52616
+ /** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
52617
+ async resolve(operation) {
52618
+ const result = await this.read(operation);
52619
+ if (!result.ok)
52620
+ return result;
52621
+ return result.value ? { ok: true, value: result.value } : {
52622
+ ok: false,
52623
+ error: {
52624
+ code: "sessionNotFound",
52625
+ message: this.#options.notFoundMessage,
52626
+ retryable: false
52627
+ }
52628
+ };
52629
+ }
52630
+ /** Idempotent. Resolves after every started read has settled. */
52631
+ async close() {
52632
+ this.#abort.abort();
52633
+ await Promise.allSettled(this.#pending);
52634
+ }
52635
+ };
52636
+
52637
+ // ../qoder/dist/qoder-session-import.js
52638
+ var QoderSessionImport = class {
52639
+ #dependencies;
52640
+ #scope;
52641
+ constructor(dependencies) {
52642
+ this.#dependencies = dependencies;
52643
+ const name = dependencies.displayName;
52644
+ this.#scope = new SessionImportScope({
52645
+ closedMessage: `${name} Session import is closed`,
52646
+ unavailableMessage: `${name} sessions could not be read; check storage access and retry`,
52647
+ notFoundMessage: `${name} Session is no longer importable`
52648
+ });
52649
+ }
52650
+ listCandidates() {
52651
+ return this.#scope.read(async (signal) => {
52652
+ const candidates = /* @__PURE__ */ new Map();
52653
+ for (const info of await this.#dependencies.listSessions()) {
52654
+ signal.throwIfAborted();
52655
+ const candidate = await this.#candidate(info);
52656
+ if (candidate && !candidates.has(candidate.nativeSessionId))
52657
+ candidates.set(candidate.nativeSessionId, candidate);
52658
+ }
52659
+ return [...candidates.values()];
52660
+ });
52661
+ }
52662
+ resolveCandidate(nativeSessionId) {
52663
+ return this.#scope.resolve(async (signal) => {
52664
+ const info = await this.#dependencies.getSessionInfo(nativeSessionId);
52665
+ signal.throwIfAborted();
52666
+ if (info?.sessionId !== nativeSessionId)
52667
+ return null;
52668
+ const candidate = await this.#candidate(info);
52669
+ if (!candidate)
52670
+ return null;
52671
+ return {
52672
+ candidate,
52673
+ nativeRef: nativeSessionRefSchema.parse({
52674
+ harnessId: this.#dependencies.harnessId,
52675
+ nativeSessionId,
52676
+ formatVersion: 1
52677
+ })
52678
+ };
52679
+ });
52680
+ }
52681
+ close() {
52682
+ return this.#scope.close();
52683
+ }
52684
+ async #candidate(info) {
52685
+ if (typeof info.cwd !== "string" || !path5.isAbsolute(info.cwd))
52686
+ return null;
52687
+ const cwd = path5.resolve(info.cwd);
52688
+ try {
52689
+ if (!(await stat(cwd)).isDirectory())
52690
+ return null;
52691
+ } catch (error51) {
52692
+ if (isStorageAccessError(error51))
52693
+ throw error51;
52694
+ return null;
52695
+ }
52696
+ return sessionImportCandidate({
52697
+ nativeSessionId: info.sessionId,
52698
+ cwd,
52699
+ title: sessionImportTitle(info.customTitle) ?? sessionImportTitle(info.summary) ?? sessionImportTitle(info.firstPrompt),
52700
+ updatedAt: info.lastModified
52701
+ // The SDK exposes no cross-process activity marker: idleness cannot be established.
52702
+ });
52703
+ }
52704
+ };
52705
+
52444
52706
  // ../qoder/dist/qoder-adapter.js
52445
52707
  var QoderAdapter = class {
52446
52708
  harnessId;
52447
52709
  #variant;
52448
52710
  commandCatalog = QODER_FALLBACK_COMMAND_CATALOG;
52449
52711
  liveCommandCatalog = true;
52712
+ sessionImport;
52450
52713
  #commandOverride;
52451
52714
  #environment;
52452
52715
  #platform;
@@ -52470,6 +52733,12 @@ var QoderAdapter = class {
52470
52733
  this.#forkSession = options.forkSession ?? runtime.sdk.forkSession;
52471
52734
  this.#getSessionMessages = options.getSessionMessages ?? runtime.sdk.getSessionMessages;
52472
52735
  this.#getSessionInfo = options.getSessionInfo ?? runtime.sdk.getSessionInfo;
52736
+ this.sessionImport = new QoderSessionImport({
52737
+ harnessId: this.harnessId,
52738
+ displayName: this.#variant === "cn" ? "Qoder CN" : "Qoder",
52739
+ listSessions: options.listSessions ?? (() => runtime.sdk.listSessions()),
52740
+ getSessionInfo: this.#getSessionInfo
52741
+ });
52473
52742
  this.#getAvailableModels = options.getAvailableModels;
52474
52743
  this.#resolveExecutable = options.resolveExecutable ?? ((input, dependencies) => resolveQoderExecutable({ ...input, variant: this.#variant }, dependencies));
52475
52744
  }
@@ -52534,11 +52803,15 @@ var QoderAdapter = class {
52534
52803
  } catch {
52535
52804
  }
52536
52805
  } else {
52806
+ let stderr = "";
52537
52807
  try {
52538
52808
  const probeQuery = this.#queryFactory({
52539
52809
  prompt: "",
52540
52810
  options: {
52541
52811
  cwd: input?.cwd ?? process.cwd(),
52812
+ stderr: (chunk) => {
52813
+ stderr = (stderr + chunk).slice(-8192);
52814
+ },
52542
52815
  pathToQoderCLIExecutable: executable,
52543
52816
  ...this.#environment ? { env: this.#environment } : {},
52544
52817
  auth: qoderAuthForEnvironment(this.#variant, this.#environment)
@@ -52555,9 +52828,14 @@ var QoderAdapter = class {
52555
52828
  }
52556
52829
  }
52557
52830
  } catch (error51) {
52831
+ const needsLogin = qoderLoginRequired(stderr) || error51 instanceof Error && error51.message === "Transport closed" && qoderAuthForEnvironment(this.#variant, this.#environment).type === "qodercli" && await checkQoderLogin(executable, this.#environment, input?.cwd);
52558
52832
  const result2 = {
52559
52833
  status: "unavailable",
52560
- error: mapQoderException(error51)
52834
+ error: needsLogin ? {
52835
+ code: "authenticationRequired",
52836
+ message: `Please run ${this.#variant === "cn" ? "qoderclicn" : "qodercli"} login to authenticate.`,
52837
+ retryable: false
52838
+ } : mapQoderException(error51)
52561
52839
  };
52562
52840
  return result2;
52563
52841
  }
@@ -52679,7 +52957,7 @@ var QoderAdapter = class {
52679
52957
  sourceInfo = await this.#getSessionInfo(sourceRef.data.nativeSessionId, { dir: input.cwd });
52680
52958
  } catch {
52681
52959
  }
52682
- if (sourceInfo?.cwd && path5.resolve(sourceInfo.cwd) !== path5.resolve(input.cwd)) {
52960
+ if (sourceInfo?.cwd && path6.resolve(sourceInfo.cwd) !== path6.resolve(input.cwd)) {
52683
52961
  return {
52684
52962
  ok: false,
52685
52963
  error: {
@@ -52829,7 +53107,7 @@ var QoderAdapter = class {
52829
53107
  this.#sessions.clear();
52830
53108
  this.#inspections.clear();
52831
53109
  this.#inFlightInspections.clear();
52832
- await Promise.all(sessions.map((s) => s.close()));
53110
+ await Promise.all([this.sessionImport.close(), ...sessions.map((s) => s.close())]);
52833
53111
  }
52834
53112
  };
52835
53113
 
@@ -52845,6 +53123,7 @@ function createQoderInstallation(environment, command, variant = "global") {
52845
53123
  latestVersion: "Unknown",
52846
53124
  updateAvailable: false,
52847
53125
  canUpdate: false,
53126
+ messageCode: "qoder-check-unavailable",
52848
53127
  message: "This Qoder China release does not expose a non-installing update check. Use its original installer."
52849
53128
  };
52850
53129
  const output = await run(["update", "--check"]);