@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
  }
@@ -12995,7 +12995,7 @@ function createHarnessInstaller(environment, source) {
12995
12995
 
12996
12996
  // dist/qoder-adapter.js
12997
12997
  import { randomUUID as randomUUID2 } from "node:crypto";
12998
- import path5 from "node:path";
12998
+ import path6 from "node:path";
12999
12999
 
13000
13000
  // ../../../node_modules/zod/v4/classic/external.js
13001
13001
  var external_exports = {};
@@ -13763,10 +13763,10 @@ function mergeDefs(...defs) {
13763
13763
  function cloneDef(schema) {
13764
13764
  return mergeDefs(schema._zod.def);
13765
13765
  }
13766
- function getElementAtPath(obj, path6) {
13767
- if (!path6)
13766
+ function getElementAtPath(obj, path7) {
13767
+ if (!path7)
13768
13768
  return obj;
13769
- return path6.reduce((acc, key) => acc?.[key], obj);
13769
+ return path7.reduce((acc, key) => acc?.[key], obj);
13770
13770
  }
13771
13771
  function promiseAllObject(promisesObj) {
13772
13772
  const keys = Object.keys(promisesObj);
@@ -14175,11 +14175,11 @@ function explicitlyAborted(x3, startIndex = 0) {
14175
14175
  }
14176
14176
  return false;
14177
14177
  }
14178
- function prefixIssues(path6, issues) {
14178
+ function prefixIssues(path7, issues) {
14179
14179
  return issues.map((iss) => {
14180
14180
  var _a5;
14181
14181
  (_a5 = iss).path ?? (_a5.path = []);
14182
- iss.path.unshift(path6);
14182
+ iss.path.unshift(path7);
14183
14183
  return iss;
14184
14184
  });
14185
14185
  }
@@ -14326,16 +14326,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
14326
14326
  }
14327
14327
  function formatError(error51, mapper = (issue2) => issue2.message) {
14328
14328
  const fieldErrors = { _errors: [] };
14329
- const processError = (error52, path6 = []) => {
14329
+ const processError = (error52, path7 = []) => {
14330
14330
  for (const issue2 of error52.issues) {
14331
14331
  if (issue2.code === "invalid_union" && issue2.errors.length) {
14332
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
14332
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
14333
14333
  } else if (issue2.code === "invalid_key") {
14334
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
14334
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14335
14335
  } else if (issue2.code === "invalid_element") {
14336
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
14336
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14337
14337
  } else {
14338
- const fullpath = [...path6, ...issue2.path];
14338
+ const fullpath = [...path7, ...issue2.path];
14339
14339
  if (fullpath.length === 0) {
14340
14340
  fieldErrors._errors.push(mapper(issue2));
14341
14341
  } else {
@@ -14362,17 +14362,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
14362
14362
  }
14363
14363
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
14364
14364
  const result = { errors: [] };
14365
- const processError = (error52, path6 = []) => {
14365
+ const processError = (error52, path7 = []) => {
14366
14366
  var _a5, _b;
14367
14367
  for (const issue2 of error52.issues) {
14368
14368
  if (issue2.code === "invalid_union" && issue2.errors.length) {
14369
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
14369
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
14370
14370
  } else if (issue2.code === "invalid_key") {
14371
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
14371
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14372
14372
  } else if (issue2.code === "invalid_element") {
14373
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
14373
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14374
14374
  } else {
14375
- const fullpath = [...path6, ...issue2.path];
14375
+ const fullpath = [...path7, ...issue2.path];
14376
14376
  if (fullpath.length === 0) {
14377
14377
  result.errors.push(mapper(issue2));
14378
14378
  continue;
@@ -14404,8 +14404,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
14404
14404
  }
14405
14405
  function toDotPath(_path) {
14406
14406
  const segs = [];
14407
- const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
14408
- for (const seg of path6) {
14407
+ const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
14408
+ for (const seg of path7) {
14409
14409
  if (typeof seg === "number")
14410
14410
  segs.push(`[${seg}]`);
14411
14411
  else if (typeof seg === "symbol")
@@ -27097,13 +27097,13 @@ function resolveRef(ref, ctx) {
27097
27097
  if (!ref.startsWith("#")) {
27098
27098
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
27099
27099
  }
27100
- const path6 = ref.slice(1).split("/").filter(Boolean);
27101
- if (path6.length === 0) {
27100
+ const path7 = ref.slice(1).split("/").filter(Boolean);
27101
+ if (path7.length === 0) {
27102
27102
  return ctx.rootSchema;
27103
27103
  }
27104
27104
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
27105
- if (path6[0] === defsKey) {
27106
- const key = path6[1];
27105
+ if (path7[0] === defsKey) {
27106
+ const key = path7[1];
27107
27107
  if (!key || !ctx.defs[key]) {
27108
27108
  throw new Error(`Reference not found: ${ref}`);
27109
27109
  }
@@ -27591,6 +27591,10 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
27591
27591
  var hostItemIdSchema = opaqueIdSchema.brand();
27592
27592
  var hostInteractionIdSchema = opaqueIdSchema.brand();
27593
27593
 
27594
+ // ../../shared-contracts/dist/thread-prewarm.js
27595
+ var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
27596
+ var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
27597
+
27594
27598
  // ../../shared-contracts/dist/harness-plugins.js
27595
27599
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
27596
27600
  var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
@@ -27658,6 +27662,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
27658
27662
  url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
27659
27663
  });
27660
27664
  var CONSOLE_HOST_METHODS = Object.freeze([
27665
+ "codexhost/console/remote-connections",
27666
+ "codexhost/runtime/status",
27667
+ "codexhost/remote/ssh-setup",
27661
27668
  "codexhost/harness/plugins/list",
27662
27669
  "codexhost/harness/display-settings/get",
27663
27670
  "codexhost/harness/display-settings/set",
@@ -28286,7 +28293,10 @@ var harnessInstallationStateSchema = external_exports.object({
28286
28293
  latestVersion: external_exports.string().min(1).max(128),
28287
28294
  updateAvailable: external_exports.boolean(),
28288
28295
  canUpdate: external_exports.boolean(),
28289
- message: external_exports.string().max(2048).optional()
28296
+ // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
28297
+ message: external_exports.string().max(2048).optional(),
28298
+ messageCode: external_exports.string().min(1).max(128).optional(),
28299
+ latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
28290
28300
  }).strict();
28291
28301
 
28292
28302
  // ../../shared-contracts/dist/codex-accounts.js
@@ -28581,7 +28591,7 @@ var updateStatusSchema = external_exports.strictObject({
28581
28591
  }
28582
28592
  });
28583
28593
  var updateEmptyParamsSchema = external_exports.strictObject({});
28584
- 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");
28594
+ 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");
28585
28595
  var updateCheckResultSchema = external_exports.strictObject({
28586
28596
  currentVersion: updateSemanticVersionSchema,
28587
28597
  installation: updateInstallationSchema.nullable(),
@@ -28600,6 +28610,80 @@ var updateStatusResultSchema = external_exports.strictObject({
28600
28610
  status: updateStatusSchema.nullable()
28601
28611
  });
28602
28612
 
28613
+ // ../../shared-contracts/dist/remote-runtime.js
28614
+ var remoteUpdatePhaseSchema = external_exports.enum([
28615
+ "idle",
28616
+ "installing",
28617
+ "restarting",
28618
+ "succeeded",
28619
+ "failed"
28620
+ ]);
28621
+ var runtimeStatusSchema = external_exports.object({
28622
+ runningVersion: external_exports.string().nullable(),
28623
+ installedVersion: external_exports.string().nullable(),
28624
+ restartRequired: external_exports.boolean(),
28625
+ remote: external_exports.boolean(),
28626
+ updateSupported: external_exports.boolean(),
28627
+ update: external_exports.object({
28628
+ phase: remoteUpdatePhaseSchema,
28629
+ targetVersion: external_exports.string().nullable(),
28630
+ error: external_exports.string().nullable()
28631
+ })
28632
+ });
28633
+ var remoteUpdateParamsSchema = external_exports.object({
28634
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
28635
+ }).strict();
28636
+ var remoteSshSetupParamsSchema = external_exports.object({
28637
+ hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
28638
+ port: external_exports.number().int().min(1).max(65535).nullable(),
28639
+ identity: external_exports.string().max(4096).nullable(),
28640
+ action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
28641
+ uninstallPackage: external_exports.boolean().optional(),
28642
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
28643
+ }).strict();
28644
+ var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
28645
+
28646
+ // ../../shared-contracts/dist/remote-connections.js
28647
+ var hostId = external_exports.string().min(1).max(1024);
28648
+ var codexSshConnectionSchema = external_exports.object({
28649
+ hostId,
28650
+ displayName: external_exports.string().min(1).max(1024),
28651
+ source: external_exports.enum(["codex-managed", "discovered"]),
28652
+ sshAlias: external_exports.string().max(1024).nullable(),
28653
+ sshHost: external_exports.string().min(1).max(1024),
28654
+ sshPort: external_exports.number().int().min(1).max(65535).nullable(),
28655
+ identity: external_exports.string().max(4096).nullable(),
28656
+ autoConnect: external_exports.boolean(),
28657
+ connectionAnalyticsId: external_exports.string().max(1024).optional()
28658
+ });
28659
+ var codexSshDraftSchema = external_exports.strictObject({
28660
+ displayName: external_exports.string().min(1).max(1024),
28661
+ hostname: external_exports.string().min(1).max(1024),
28662
+ sshPort: external_exports.number().int().min(1).max(65535).nullable(),
28663
+ identity: external_exports.string().max(4096).nullable()
28664
+ });
28665
+ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
28666
+ external_exports.strictObject({ action: external_exports.literal("list") }),
28667
+ external_exports.strictObject({
28668
+ action: external_exports.literal("save"),
28669
+ draft: codexSshDraftSchema,
28670
+ previous: codexSshConnectionSchema.nullable()
28671
+ }),
28672
+ external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
28673
+ external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
28674
+ external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
28675
+ external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
28676
+ external_exports.strictObject({
28677
+ action: external_exports.literal("update"),
28678
+ hostId: hostId.refine((id) => id !== "local"),
28679
+ version: remoteUpdateParamsSchema.shape.version
28680
+ })
28681
+ ]);
28682
+ var remoteConnectionsReplySchema = external_exports.union([
28683
+ external_exports.strictObject({ result: jsonValueSchema }),
28684
+ external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
28685
+ ]);
28686
+
28603
28687
  // ../../shared-contracts/dist/index.js
28604
28688
  var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
28605
28689
 
@@ -28860,6 +28944,26 @@ function mapQoderException(error51) {
28860
28944
  };
28861
28945
  }
28862
28946
 
28947
+ // dist/qoder-login-check.js
28948
+ import { execFile as execFile2 } from "node:child_process";
28949
+ function qoderLoginRequired(text) {
28950
+ return /\bnot logged in\b|\bauthentication (?:required|expired)\b/i.test(text);
28951
+ }
28952
+ function checkQoderLogin(executable, environment, cwd) {
28953
+ return new Promise((resolve) => {
28954
+ execFile2(executable, ["--list-models"], {
28955
+ env: environment,
28956
+ cwd,
28957
+ timeout: 1e4,
28958
+ maxBuffer: 64 * 1024,
28959
+ windowsHide: true
28960
+ }, (error51, stdout, stderr) => {
28961
+ resolve(Boolean(error51 && !error51.killed && qoderLoginRequired(`${stdout}
28962
+ ${stderr}`)));
28963
+ });
28964
+ });
28965
+ }
28966
+
28863
28967
  // ../../harness-adapter/dist/approval.js
28864
28968
  function invalidRequest(message) {
28865
28969
  return { code: "invalidRequest", message, retryable: false };
@@ -30217,8 +30321,8 @@ function getErrorMap2() {
30217
30321
 
30218
30322
  // ../../../node_modules/zod/v3/helpers/parseUtil.js
30219
30323
  var makeIssue = (params) => {
30220
- const { data, path: path6, errorMaps, issueData } = params;
30221
- const fullPath = [...path6, ...issueData.path || []];
30324
+ const { data, path: path7, errorMaps, issueData } = params;
30325
+ const fullPath = [...path7, ...issueData.path || []];
30222
30326
  const fullIssue = {
30223
30327
  ...issueData,
30224
30328
  path: fullPath
@@ -30333,11 +30437,11 @@ var errorUtil;
30333
30437
 
30334
30438
  // ../../../node_modules/zod/v3/types.js
30335
30439
  var ParseInputLazyPath = class {
30336
- constructor(parent, value, path6, key) {
30440
+ constructor(parent, value, path7, key) {
30337
30441
  this._cachedPath = [];
30338
30442
  this.parent = parent;
30339
30443
  this.data = value;
30340
- this._path = path6;
30444
+ this._path = path7;
30341
30445
  this._key = key;
30342
30446
  }
30343
30447
  get path() {
@@ -33864,11 +33968,11 @@ function normalizeObjectSchema(schema) {
33864
33968
  }
33865
33969
  return void 0;
33866
33970
  }
33867
- function getDotPath(path6) {
33868
- if (path6.length === 0) {
33971
+ function getDotPath(path7) {
33972
+ if (path7.length === 0) {
33869
33973
  return "object root";
33870
33974
  }
33871
- return path6.reduce((acc, seg, index) => {
33975
+ return path7.reduce((acc, seg, index) => {
33872
33976
  if (index === 0) {
33873
33977
  return String(seg);
33874
33978
  }
@@ -52439,12 +52543,171 @@ var QoderSession = class {
52439
52543
  }
52440
52544
  };
52441
52545
 
52546
+ // dist/qoder-session-import.js
52547
+ import { stat } from "node:fs/promises";
52548
+ import path5 from "node:path";
52549
+
52550
+ // ../../harness-adapter/dist/session-import.js
52551
+ var STORAGE_ACCESS_ERRORS = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"]);
52552
+ function isStorageAccessError(error51) {
52553
+ return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" && STORAGE_ACCESS_ERRORS.has(error51.code);
52554
+ }
52555
+ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
52556
+ if (typeof value !== "string")
52557
+ return null;
52558
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
52559
+ if (!normalized)
52560
+ return null;
52561
+ if (normalized.length <= maxLength)
52562
+ return normalized;
52563
+ const characters = [...normalized];
52564
+ if (characters.length <= maxLength)
52565
+ return normalized;
52566
+ return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
52567
+ }
52568
+ function sessionImportCandidate(input) {
52569
+ const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
52570
+ const parsed = harnessSessionImportCandidateSchema.safeParse({
52571
+ nativeSessionId: input.nativeSessionId,
52572
+ cwd: input.cwd,
52573
+ title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
52574
+ updatedAt: Math.floor(time3),
52575
+ // Unknown must stay unknown; only an explicit boolean is a native statement.
52576
+ running: typeof input.running === "boolean" ? input.running : null
52577
+ });
52578
+ return parsed.success ? parsed.data : null;
52579
+ }
52580
+ var SessionImportScope = class {
52581
+ #abort = new AbortController();
52582
+ #options;
52583
+ #pending = /* @__PURE__ */ new Set();
52584
+ constructor(options) {
52585
+ this.#options = options;
52586
+ }
52587
+ #closed() {
52588
+ return {
52589
+ ok: false,
52590
+ error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
52591
+ };
52592
+ }
52593
+ read(operation) {
52594
+ const signal = this.#abort.signal;
52595
+ if (signal.aborted)
52596
+ return Promise.resolve(this.#closed());
52597
+ let started;
52598
+ try {
52599
+ started = operation(signal);
52600
+ } catch (error51) {
52601
+ started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
52602
+ }
52603
+ const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
52604
+ ok: false,
52605
+ error: {
52606
+ code: "unavailable",
52607
+ message: this.#options.unavailableMessage,
52608
+ retryable: true
52609
+ }
52610
+ }).finally(() => this.#pending.delete(request));
52611
+ this.#pending.add(request);
52612
+ return request;
52613
+ }
52614
+ /** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
52615
+ async resolve(operation) {
52616
+ const result = await this.read(operation);
52617
+ if (!result.ok)
52618
+ return result;
52619
+ return result.value ? { ok: true, value: result.value } : {
52620
+ ok: false,
52621
+ error: {
52622
+ code: "sessionNotFound",
52623
+ message: this.#options.notFoundMessage,
52624
+ retryable: false
52625
+ }
52626
+ };
52627
+ }
52628
+ /** Idempotent. Resolves after every started read has settled. */
52629
+ async close() {
52630
+ this.#abort.abort();
52631
+ await Promise.allSettled(this.#pending);
52632
+ }
52633
+ };
52634
+
52635
+ // dist/qoder-session-import.js
52636
+ var QoderSessionImport = class {
52637
+ #dependencies;
52638
+ #scope;
52639
+ constructor(dependencies) {
52640
+ this.#dependencies = dependencies;
52641
+ const name = dependencies.displayName;
52642
+ this.#scope = new SessionImportScope({
52643
+ closedMessage: `${name} Session import is closed`,
52644
+ unavailableMessage: `${name} sessions could not be read; check storage access and retry`,
52645
+ notFoundMessage: `${name} Session is no longer importable`
52646
+ });
52647
+ }
52648
+ listCandidates() {
52649
+ return this.#scope.read(async (signal) => {
52650
+ const candidates = /* @__PURE__ */ new Map();
52651
+ for (const info of await this.#dependencies.listSessions()) {
52652
+ signal.throwIfAborted();
52653
+ const candidate = await this.#candidate(info);
52654
+ if (candidate && !candidates.has(candidate.nativeSessionId))
52655
+ candidates.set(candidate.nativeSessionId, candidate);
52656
+ }
52657
+ return [...candidates.values()];
52658
+ });
52659
+ }
52660
+ resolveCandidate(nativeSessionId) {
52661
+ return this.#scope.resolve(async (signal) => {
52662
+ const info = await this.#dependencies.getSessionInfo(nativeSessionId);
52663
+ signal.throwIfAborted();
52664
+ if (info?.sessionId !== nativeSessionId)
52665
+ return null;
52666
+ const candidate = await this.#candidate(info);
52667
+ if (!candidate)
52668
+ return null;
52669
+ return {
52670
+ candidate,
52671
+ nativeRef: nativeSessionRefSchema.parse({
52672
+ harnessId: this.#dependencies.harnessId,
52673
+ nativeSessionId,
52674
+ formatVersion: 1
52675
+ })
52676
+ };
52677
+ });
52678
+ }
52679
+ close() {
52680
+ return this.#scope.close();
52681
+ }
52682
+ async #candidate(info) {
52683
+ if (typeof info.cwd !== "string" || !path5.isAbsolute(info.cwd))
52684
+ return null;
52685
+ const cwd = path5.resolve(info.cwd);
52686
+ try {
52687
+ if (!(await stat(cwd)).isDirectory())
52688
+ return null;
52689
+ } catch (error51) {
52690
+ if (isStorageAccessError(error51))
52691
+ throw error51;
52692
+ return null;
52693
+ }
52694
+ return sessionImportCandidate({
52695
+ nativeSessionId: info.sessionId,
52696
+ cwd,
52697
+ title: sessionImportTitle(info.customTitle) ?? sessionImportTitle(info.summary) ?? sessionImportTitle(info.firstPrompt),
52698
+ updatedAt: info.lastModified
52699
+ // The SDK exposes no cross-process activity marker: idleness cannot be established.
52700
+ });
52701
+ }
52702
+ };
52703
+
52442
52704
  // dist/qoder-adapter.js
52443
52705
  var QoderAdapter = class {
52444
52706
  harnessId;
52445
52707
  #variant;
52446
52708
  commandCatalog = QODER_FALLBACK_COMMAND_CATALOG;
52447
52709
  liveCommandCatalog = true;
52710
+ sessionImport;
52448
52711
  #commandOverride;
52449
52712
  #environment;
52450
52713
  #platform;
@@ -52468,6 +52731,12 @@ var QoderAdapter = class {
52468
52731
  this.#forkSession = options.forkSession ?? runtime.sdk.forkSession;
52469
52732
  this.#getSessionMessages = options.getSessionMessages ?? runtime.sdk.getSessionMessages;
52470
52733
  this.#getSessionInfo = options.getSessionInfo ?? runtime.sdk.getSessionInfo;
52734
+ this.sessionImport = new QoderSessionImport({
52735
+ harnessId: this.harnessId,
52736
+ displayName: this.#variant === "cn" ? "Qoder CN" : "Qoder",
52737
+ listSessions: options.listSessions ?? (() => runtime.sdk.listSessions()),
52738
+ getSessionInfo: this.#getSessionInfo
52739
+ });
52471
52740
  this.#getAvailableModels = options.getAvailableModels;
52472
52741
  this.#resolveExecutable = options.resolveExecutable ?? ((input, dependencies) => resolveQoderExecutable({ ...input, variant: this.#variant }, dependencies));
52473
52742
  }
@@ -52532,11 +52801,15 @@ var QoderAdapter = class {
52532
52801
  } catch {
52533
52802
  }
52534
52803
  } else {
52804
+ let stderr = "";
52535
52805
  try {
52536
52806
  const probeQuery = this.#queryFactory({
52537
52807
  prompt: "",
52538
52808
  options: {
52539
52809
  cwd: input?.cwd ?? process.cwd(),
52810
+ stderr: (chunk) => {
52811
+ stderr = (stderr + chunk).slice(-8192);
52812
+ },
52540
52813
  pathToQoderCLIExecutable: executable,
52541
52814
  ...this.#environment ? { env: this.#environment } : {},
52542
52815
  auth: qoderAuthForEnvironment(this.#variant, this.#environment)
@@ -52553,9 +52826,14 @@ var QoderAdapter = class {
52553
52826
  }
52554
52827
  }
52555
52828
  } catch (error51) {
52829
+ 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);
52556
52830
  const result2 = {
52557
52831
  status: "unavailable",
52558
- error: mapQoderException(error51)
52832
+ error: needsLogin ? {
52833
+ code: "authenticationRequired",
52834
+ message: `Please run ${this.#variant === "cn" ? "qoderclicn" : "qodercli"} login to authenticate.`,
52835
+ retryable: false
52836
+ } : mapQoderException(error51)
52559
52837
  };
52560
52838
  return result2;
52561
52839
  }
@@ -52677,7 +52955,7 @@ var QoderAdapter = class {
52677
52955
  sourceInfo = await this.#getSessionInfo(sourceRef.data.nativeSessionId, { dir: input.cwd });
52678
52956
  } catch {
52679
52957
  }
52680
- if (sourceInfo?.cwd && path5.resolve(sourceInfo.cwd) !== path5.resolve(input.cwd)) {
52958
+ if (sourceInfo?.cwd && path6.resolve(sourceInfo.cwd) !== path6.resolve(input.cwd)) {
52681
52959
  return {
52682
52960
  ok: false,
52683
52961
  error: {
@@ -52827,7 +53105,7 @@ var QoderAdapter = class {
52827
53105
  this.#sessions.clear();
52828
53106
  this.#inspections.clear();
52829
53107
  this.#inFlightInspections.clear();
52830
- await Promise.all(sessions.map((s) => s.close()));
53108
+ await Promise.all([this.sessionImport.close(), ...sessions.map((s) => s.close())]);
52831
53109
  }
52832
53110
  };
52833
53111
 
@@ -52843,6 +53121,7 @@ function createQoderInstallation(environment, command, variant = "global") {
52843
53121
  latestVersion: "Unknown",
52844
53122
  updateAvailable: false,
52845
53123
  canUpdate: false,
53124
+ messageCode: "qoder-check-unavailable",
52846
53125
  message: "This Qoder China release does not expose a non-installing update check. Use its original installer."
52847
53126
  };
52848
53127
  const output = await run(["update", "--check"]);