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

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.
@@ -776,10 +776,10 @@ function mergeDefs(...defs) {
776
776
  function cloneDef(schema) {
777
777
  return mergeDefs(schema._zod.def);
778
778
  }
779
- function getElementAtPath(obj, path11) {
780
- if (!path11)
779
+ function getElementAtPath(obj, path12) {
780
+ if (!path12)
781
781
  return obj;
782
- return path11.reduce((acc, key) => acc?.[key], obj);
782
+ return path12.reduce((acc, key) => acc?.[key], obj);
783
783
  }
784
784
  function promiseAllObject(promisesObj) {
785
785
  const keys = Object.keys(promisesObj);
@@ -1188,11 +1188,11 @@ function explicitlyAborted(x2, startIndex = 0) {
1188
1188
  }
1189
1189
  return false;
1190
1190
  }
1191
- function prefixIssues(path11, issues) {
1191
+ function prefixIssues(path12, issues) {
1192
1192
  return issues.map((iss) => {
1193
1193
  var _a4;
1194
1194
  (_a4 = iss).path ?? (_a4.path = []);
1195
- iss.path.unshift(path11);
1195
+ iss.path.unshift(path12);
1196
1196
  return iss;
1197
1197
  });
1198
1198
  }
@@ -1339,16 +1339,16 @@ function flattenError(error52, mapper = (issue2) => issue2.message) {
1339
1339
  }
1340
1340
  function formatError(error52, mapper = (issue2) => issue2.message) {
1341
1341
  const fieldErrors = { _errors: [] };
1342
- const processError = (error53, path11 = []) => {
1342
+ const processError = (error53, path12 = []) => {
1343
1343
  for (const issue2 of error53.issues) {
1344
1344
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1345
- issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1345
+ issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
1346
1346
  } else if (issue2.code === "invalid_key") {
1347
- processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1347
+ processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1348
1348
  } else if (issue2.code === "invalid_element") {
1349
- processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1349
+ processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1350
1350
  } else {
1351
- const fullpath = [...path11, ...issue2.path];
1351
+ const fullpath = [...path12, ...issue2.path];
1352
1352
  if (fullpath.length === 0) {
1353
1353
  fieldErrors._errors.push(mapper(issue2));
1354
1354
  } else {
@@ -1375,17 +1375,17 @@ function formatError(error52, mapper = (issue2) => issue2.message) {
1375
1375
  }
1376
1376
  function treeifyError(error52, mapper = (issue2) => issue2.message) {
1377
1377
  const result = { errors: [] };
1378
- const processError = (error53, path11 = []) => {
1378
+ const processError = (error53, path12 = []) => {
1379
1379
  var _a4, _b2;
1380
1380
  for (const issue2 of error53.issues) {
1381
1381
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1382
- issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1382
+ issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
1383
1383
  } else if (issue2.code === "invalid_key") {
1384
- processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1384
+ processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1385
1385
  } else if (issue2.code === "invalid_element") {
1386
- processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1386
+ processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1387
1387
  } else {
1388
- const fullpath = [...path11, ...issue2.path];
1388
+ const fullpath = [...path12, ...issue2.path];
1389
1389
  if (fullpath.length === 0) {
1390
1390
  result.errors.push(mapper(issue2));
1391
1391
  continue;
@@ -1417,8 +1417,8 @@ function treeifyError(error52, mapper = (issue2) => issue2.message) {
1417
1417
  }
1418
1418
  function toDotPath(_path) {
1419
1419
  const segs = [];
1420
- const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1421
- for (const seg of path11) {
1420
+ const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1421
+ for (const seg of path12) {
1422
1422
  if (typeof seg === "number")
1423
1423
  segs.push(`[${seg}]`);
1424
1424
  else if (typeof seg === "symbol")
@@ -14110,13 +14110,13 @@ function resolveRef(ref, ctx) {
14110
14110
  if (!ref.startsWith("#")) {
14111
14111
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14112
14112
  }
14113
- const path11 = ref.slice(1).split("/").filter(Boolean);
14114
- if (path11.length === 0) {
14113
+ const path12 = ref.slice(1).split("/").filter(Boolean);
14114
+ if (path12.length === 0) {
14115
14115
  return ctx.rootSchema;
14116
14116
  }
14117
14117
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14118
- if (path11[0] === defsKey) {
14119
- const key = path11[1];
14118
+ if (path12[0] === defsKey) {
14119
+ const key = path12[1];
14120
14120
  if (!key || !ctx.defs[key]) {
14121
14121
  throw new Error(`Reference not found: ${ref}`);
14122
14122
  }
@@ -14550,6 +14550,8 @@ var threadUsageSnapshotSchema = external_exports.object({
14550
14550
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
14551
14551
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
14552
14552
  totalCostUsd: finiteNonNegativeNumberSchema.optional(),
14553
+ totalCredits: finiteNonNegativeNumberSchema.optional(),
14554
+ contextUsagePercent: finiteNonNegativeNumberSchema.optional(),
14553
14555
  cacheHitRatePercent: cacheHitRatePercentSchema.optional(),
14554
14556
  contextWindowTokens: nonNegativeSafeIntegerSchema.optional(),
14555
14557
  contextUsedTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -14606,12 +14608,28 @@ var accountResetCreditsSchema = external_exports.object({
14606
14608
  var accountCreditsSnapshotSchema = external_exports.object({
14607
14609
  /** Native label when the primary limit is scoped to a model or product group. */
14608
14610
  label: external_exports.string().min(1).optional(),
14609
- usedPercent: usagePercentSchema,
14611
+ usedPercent: usagePercentSchema.optional(),
14612
+ remaining: external_exports.number().finite().optional(),
14613
+ unit: external_exports.string().trim().min(1).max(32).optional(),
14610
14614
  resetsAt: external_exports.string().min(1).optional(),
14611
14615
  periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
14612
14616
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
14613
14617
  resetCredits: accountResetCreditsSchema.optional()
14614
- }).strict();
14618
+ }).strict().superRefine((credits, context) => {
14619
+ if (credits.usedPercent === void 0 && credits.remaining === void 0) {
14620
+ context.addIssue({
14621
+ code: "custom",
14622
+ message: "Account credits must include usedPercent or remaining"
14623
+ });
14624
+ }
14625
+ if (credits.remaining !== void 0 && !credits.unit) {
14626
+ context.addIssue({
14627
+ code: "custom",
14628
+ message: "Account remaining credits require a unit",
14629
+ path: ["unit"]
14630
+ });
14631
+ }
14632
+ });
14615
14633
  var threadUsageInspectionParamsSchema = external_exports.object({
14616
14634
  threadId: hostThreadIdSchema,
14617
14635
  refresh: external_exports.literal("exact").optional()
@@ -15489,7 +15507,9 @@ var usageFields = /* @__PURE__ */ new Set([
15489
15507
  ...tokenFields,
15490
15508
  ...safeIntegerFields,
15491
15509
  ...percentFields,
15492
- "totalCostUsd"
15510
+ "totalCostUsd",
15511
+ "totalCredits",
15512
+ "contextUsagePercent"
15493
15513
  ]);
15494
15514
  function isRecord(value) {
15495
15515
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -15523,6 +15543,12 @@ function parseHostUsage(value) {
15523
15543
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
15524
15544
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
15525
15545
  }
15546
+ for (const field of ["totalCredits", "contextUsagePercent"]) {
15547
+ const candidate = value[field];
15548
+ if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
15549
+ throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
15550
+ }
15551
+ }
15526
15552
  for (const field of percentFields) {
15527
15553
  const candidate = value[field];
15528
15554
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
@@ -15551,10 +15577,13 @@ var HARNESS_BROKER_PROTOCOL_VERSION = 1;
15551
15577
  var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
15552
15578
  var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
15553
15579
  var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
15580
+ var HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE = 100;
15554
15581
  var harnessBrokerMethodSchema = external_exports.enum([
15555
15582
  "adapter.inspect",
15556
15583
  "adapter.inspectAccount",
15557
15584
  "adapter.open",
15585
+ "adapter.sessionImport.list",
15586
+ "adapter.sessionImport.resolve",
15558
15587
  "adapter.subagent.readSnapshot",
15559
15588
  "session.readSnapshot",
15560
15589
  "session.refreshUsage",
@@ -15703,6 +15732,27 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
15703
15732
  rollbackSchema
15704
15733
  ]);
15705
15734
  var brokerInspectInputSchema = external_exports.object({ cwd: cwdSchema.optional(), refresh: external_exports.boolean().optional() }).strict();
15735
+ var brokerSessionImportListParamsSchema = external_exports.object({
15736
+ offset: external_exports.number().int().nonnegative().safe(),
15737
+ limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
15738
+ }).strict();
15739
+ var brokerSessionImportResolveParamsSchema = external_exports.object({ nativeSessionId: harnessSessionImportIdSchema }).strict();
15740
+ var brokerSessionImportCandidatesSchema = external_exports.array(harnessSessionImportCandidateSchema);
15741
+ var brokerSessionImportPageSchema = external_exports.object({
15742
+ candidates: external_exports.array(harnessSessionImportCandidateSchema).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE),
15743
+ total: external_exports.number().int().nonnegative().safe()
15744
+ }).strict();
15745
+ var brokerSessionImportSourceSchema = external_exports.object({
15746
+ candidate: harnessSessionImportCandidateSchema,
15747
+ nativeRef: nativeSessionRefSchema
15748
+ }).strict().superRefine((source, context) => {
15749
+ if (source.nativeRef.harnessId !== "claude-code" || source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
15750
+ context.addIssue({
15751
+ code: "custom",
15752
+ message: "Claude Session import source identity does not match"
15753
+ });
15754
+ }
15755
+ });
15706
15756
  var textInputSchema = external_exports.object({ type: external_exports.literal("text"), text: external_exports.string().max(4e6) }).strict();
15707
15757
  var turnStartSchema = external_exports.object({
15708
15758
  type: external_exports.literal("turn.start"),
@@ -16230,6 +16280,7 @@ var BrokeredHarnessAdapter = class {
16230
16280
  #descriptorPath;
16231
16281
  #connection = null;
16232
16282
  #closed = false;
16283
+ #sessionImportListing = null;
16233
16284
  subagents = {
16234
16285
  readSnapshot: async (input) => {
16235
16286
  try {
@@ -16242,6 +16293,84 @@ var BrokeredHarnessAdapter = class {
16242
16293
  }
16243
16294
  }
16244
16295
  };
16296
+ sessionImport = Object.freeze({
16297
+ listCandidates: () => {
16298
+ this.#sessionImportListing ??= this.#listSessionImportCandidates().finally(() => {
16299
+ this.#sessionImportListing = null;
16300
+ });
16301
+ return this.#sessionImportListing;
16302
+ },
16303
+ resolveCandidate: async (nativeSessionId) => {
16304
+ if (this.#closed) {
16305
+ return {
16306
+ ok: false,
16307
+ error: unavailable("Claude Aqua broker adapter is closed", false)
16308
+ };
16309
+ }
16310
+ try {
16311
+ const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.resolve", {
16312
+ nativeSessionId
16313
+ }));
16314
+ if (!result.ok)
16315
+ return result;
16316
+ const parsed = brokerSessionImportSourceSchema.safeParse(result.value);
16317
+ if (!parsed.success || parsed.data.candidate.nativeSessionId !== nativeSessionId) {
16318
+ return {
16319
+ ok: false,
16320
+ error: {
16321
+ ...unavailable("Harness broker returned an invalid Session source", false),
16322
+ code: "protocolError"
16323
+ }
16324
+ };
16325
+ }
16326
+ return { ok: true, value: parsed.data };
16327
+ } catch (error52) {
16328
+ this.#connection = null;
16329
+ return {
16330
+ ok: false,
16331
+ error: unavailable(error52 instanceof Error ? error52.message : String(error52))
16332
+ };
16333
+ }
16334
+ }
16335
+ });
16336
+ async #listSessionImportCandidates() {
16337
+ if (this.#closed) {
16338
+ return {
16339
+ ok: false,
16340
+ error: unavailable("Claude Aqua broker adapter is closed", false)
16341
+ };
16342
+ }
16343
+ try {
16344
+ const candidates = [];
16345
+ for (; ; ) {
16346
+ const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.list", {
16347
+ offset: candidates.length,
16348
+ limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
16349
+ }));
16350
+ if (!result.ok)
16351
+ return result;
16352
+ const parsed = brokerSessionImportPageSchema.safeParse(result.value);
16353
+ if (!parsed.success || parsed.data.total < candidates.length + parsed.data.candidates.length || parsed.data.candidates.length === 0 && candidates.length < parsed.data.total) {
16354
+ return {
16355
+ ok: false,
16356
+ error: {
16357
+ ...unavailable("Harness broker returned invalid Session candidates", false),
16358
+ code: "protocolError"
16359
+ }
16360
+ };
16361
+ }
16362
+ candidates.push(...parsed.data.candidates);
16363
+ if (candidates.length === parsed.data.total)
16364
+ return { ok: true, value: candidates };
16365
+ }
16366
+ } catch (error52) {
16367
+ this.#connection = null;
16368
+ return {
16369
+ ok: false,
16370
+ error: unavailable(error52 instanceof Error ? error52.message : String(error52))
16371
+ };
16372
+ }
16373
+ }
16245
16374
  constructor(input = {}) {
16246
16375
  if (input.commandCatalog)
16247
16376
  this.commandCatalog = input.commandCatalog;
@@ -16303,7 +16432,7 @@ var BrokeredHarnessAdapter = class {
16303
16432
 
16304
16433
  // dist/claude-code-adapter.js
16305
16434
  import { randomUUID as randomUUID2 } from "node:crypto";
16306
- import path9 from "node:path";
16435
+ import path10 from "node:path";
16307
16436
 
16308
16437
  // ../../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
16309
16438
  import { createRequire as DW } from "node:module";
@@ -16373,6 +16502,8 @@ import { promisify as tEe } from "util";
16373
16502
  import { execFileSync as GSe } from "child_process";
16374
16503
  import { lstatSync as WSe } from "fs";
16375
16504
  import { join as VSe } from "path";
16505
+ import { readdir as FT, stat as CEe } from "fs/promises";
16506
+ import { basename as REe, join as zT } from "path";
16376
16507
  import { open as UEe, readdir as sF, rm as iF, stat as $Ee } from "fs/promises";
16377
16508
  import { join as mc } from "path";
16378
16509
  import { randomUUID as n_ } from "crypto";
@@ -25133,6 +25264,19 @@ function Xc(e, t) {
25133
25264
  }
25134
25265
  return;
25135
25266
  }
25267
+ function HO(e, t) {
25268
+ let r = e.data;
25269
+ if (r.isSidechain === true) return null;
25270
+ let n = go(r.firstPromptLocked === true ? r.firstPrompt : r.commandFallback) || void 0, o = go(r.customTitle) || go(r.aiTitle) || void 0, i = o || go(r.lastPrompt) || go(r.summaryHint) || n;
25271
+ if (!i) return null;
25272
+ return { sessionId: e.sessionId, summary: i, lastModified: e.mtime, fileSize: void 0, customTitle: o, firstPrompt: n, gitBranch: go(r.gitBranch) || void 0, cwd: go(r.cwd) || t || void 0, tag: go(r.tag) || void 0, createdAt: JW(r.createdAt) };
25273
+ }
25274
+ function go(e) {
25275
+ return typeof e === "string" ? e : void 0;
25276
+ }
25277
+ function JW(e) {
25278
+ return typeof e === "number" ? e : void 0;
25279
+ }
25136
25280
  var It = class extends Error {
25137
25281
  };
25138
25282
  function Cs() {
@@ -39466,6 +39610,14 @@ async function ao(e) {
39466
39610
  }
39467
39611
  }
39468
39612
  var dn = 65536;
39613
+ var sEe = /* @__PURE__ */ new Set(["sdk-cli", "sdk-ts", "sdk-py"]);
39614
+ function B1(e, t) {
39615
+ let r = pc(e, "entrypoint") ?? er(t, "entrypoint");
39616
+ if (r && sEe.has(r)) return true;
39617
+ let n = e.split(`
39618
+ `).find((i) => i.includes('"parentUuid":')) ?? e, o = pc(n, "sessionKind");
39619
+ return o === "daemon" || o === "daemon-worker";
39620
+ }
39469
39621
  var aEe = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
39470
39622
  function ze(e) {
39471
39623
  if (typeof e !== "string") return null;
@@ -39708,6 +39860,126 @@ function fc(e, t, r) {
39708
39860
  `).findLast((T) => T.includes('"type":"tag"') && T.includes('"tag":"')), b = y ? er(y, "tag") || void 0 : void 0;
39709
39861
  return { sessionId: e, summary: g, lastModified: i, fileSize: s, customTitle: u, firstPrompt: d, gitBranch: h, cwd: _, tag: b, createdAt: m };
39710
39862
  }
39863
+ async function Gp(e, t, r) {
39864
+ let n;
39865
+ try {
39866
+ n = await FT(e);
39867
+ } catch {
39868
+ return [];
39869
+ }
39870
+ return (await Promise.all(n.map(async (i) => {
39871
+ if (!i.endsWith(".jsonl")) return null;
39872
+ let s = ze(i.slice(0, -6));
39873
+ if (!s) return null;
39874
+ let a = zT(e, i);
39875
+ if (!t) return { sessionId: s, filePath: a, mtime: 0, projectPath: r };
39876
+ try {
39877
+ let c = await CEe(a);
39878
+ return { sessionId: s, filePath: a, mtime: c.mtime.getTime(), projectPath: r };
39879
+ } catch {
39880
+ return null;
39881
+ }
39882
+ }))).filter((i) => i !== null);
39883
+ }
39884
+ async function tF(e, t) {
39885
+ let r = await r_(e.filePath);
39886
+ if (!r) return null;
39887
+ if (!t && B1(r.head, r.tail)) return null;
39888
+ let n = fc(e.sessionId, r, e.projectPath);
39889
+ if (!n) return null;
39890
+ if (e.mtime) n.lastModified = e.mtime;
39891
+ return n;
39892
+ }
39893
+ var IEe = 32;
39894
+ function PEe(e, t) {
39895
+ if (t.mtime !== e.mtime) return t.mtime - e.mtime;
39896
+ return t.sessionId < e.sessionId ? -1 : t.sessionId > e.sessionId ? 1 : 0;
39897
+ }
39898
+ async function DEe(e, t, r, n) {
39899
+ e.sort(PEe);
39900
+ let o = [], i = t && t > 0 ? t : 1 / 0, s = 0, a = /* @__PURE__ */ new Set();
39901
+ for (let c = 0; c < e.length && o.length < i; ) {
39902
+ let u = Math.min(c + IEe, e.length), d = e.slice(c, u), f = await Promise.all(d.map((m) => tF(m, n)));
39903
+ for (let m = 0; m < f.length && o.length < i; m++) {
39904
+ c++;
39905
+ let g = f[m];
39906
+ if (!g) continue;
39907
+ if (a.has(g.sessionId)) continue;
39908
+ if (a.add(g.sessionId), s < r) {
39909
+ s++;
39910
+ continue;
39911
+ }
39912
+ o.push(g);
39913
+ }
39914
+ }
39915
+ return o;
39916
+ }
39917
+ async function LEe(e, t) {
39918
+ let r = await Promise.all(e.map((i) => tF(i, t))), n = /* @__PURE__ */ new Map();
39919
+ for (let i of r) {
39920
+ if (!i) continue;
39921
+ let s = n.get(i.sessionId);
39922
+ if (!s || i.lastModified > s.lastModified) n.set(i.sessionId, i);
39923
+ }
39924
+ let o = [...n.values()];
39925
+ return o.sort((i, s) => s.lastModified !== i.lastModified ? s.lastModified - i.lastModified : s.sessionId < i.sessionId ? -1 : s.sessionId > i.sessionId ? 1 : 0), o;
39926
+ }
39927
+ async function NEe(e, t, r) {
39928
+ let n = await Jo(e), o;
39929
+ if (t) try {
39930
+ o = await ao(n);
39931
+ } catch {
39932
+ o = [];
39933
+ }
39934
+ else o = [];
39935
+ if (o.length <= 1) {
39936
+ let f = [];
39937
+ for (let m of await fr(n)) f.push(...await Gp(m, r, n));
39938
+ return f;
39939
+ }
39940
+ let i = fn(), s = process.platform === "win32", a = o.map((f) => {
39941
+ let m = us(f);
39942
+ return { path: f, prefix: s ? m.toLowerCase() : m };
39943
+ });
39944
+ a.sort((f, m) => m.prefix.length - f.prefix.length);
39945
+ let c;
39946
+ try {
39947
+ c = await FT(i, { withFileTypes: true });
39948
+ } catch {
39949
+ let f = [];
39950
+ for (let m of await fr(n)) f.push(...await Gp(m, r, n));
39951
+ return f;
39952
+ }
39953
+ let u = [], d = /* @__PURE__ */ new Set();
39954
+ for (let f of await fr(n)) {
39955
+ let m = REe(f);
39956
+ d.add(s ? m.toLowerCase() : m), u.push(...await Gp(f, r, n));
39957
+ }
39958
+ for (let f of c) {
39959
+ if (!f.isDirectory()) continue;
39960
+ let m = s ? f.name.toLowerCase() : f.name;
39961
+ if (d.has(m)) continue;
39962
+ for (let { path: g, prefix: h } of a) if (m === h || h.length >= dc && m.startsWith(h + "-")) {
39963
+ d.add(m), u.push(...await Gp(zT(i, f.name), r, g));
39964
+ break;
39965
+ }
39966
+ }
39967
+ return u;
39968
+ }
39969
+ async function MEe(e) {
39970
+ let t = fn(), r;
39971
+ try {
39972
+ r = await FT(t, { withFileTypes: true });
39973
+ } catch {
39974
+ return [];
39975
+ }
39976
+ return (await Promise.all(r.filter((o) => o.isDirectory()).map((o) => Gp(zT(t, o.name), e)))).flat();
39977
+ }
39978
+ async function rF(e) {
39979
+ let { dir: t, limit: r, offset: n, includeWorktrees: o, includeProgrammatic: i } = e ?? {}, s = n ?? 0, a = i ?? true, c = r !== void 0 && r > 0 || s > 0, u = t ? await NEe(t, o ?? true, c) : await MEe(c);
39980
+ if (!c) return LEe(u, a);
39981
+ return DEe(u, r, s, a);
39982
+ }
39711
39983
  async function nF(e, t = {}) {
39712
39984
  let r = ze(e);
39713
39985
  if (!r) return;
@@ -41766,6 +42038,10 @@ function bUe(e, t) {
41766
42038
  n.spawnAbort(m), r.setError(m);
41767
42039
  }), dO(r, n, e, o), r;
41768
42040
  }
42041
+ async function Ikt(e) {
42042
+ if (e?.sessionStore) return vUe(e.sessionStore, e);
42043
+ return rF(e);
42044
+ }
41769
42045
  async function Pkt(e, t) {
41770
42046
  if (t?.sessionStore) return TUe(t.sessionStore, e, t);
41771
42047
  return nF(e, t);
@@ -41805,9 +42081,53 @@ function lW(e) {
41805
42081
  `) + `
41806
42082
  `;
41807
42083
  }
42084
+ function uW(e, t, r) {
42085
+ if (t !== void 0 && t > 0) return e.slice(r, r + t);
42086
+ if (r > 0) return e.slice(r);
42087
+ return e;
42088
+ }
41808
42089
  function cO(e) {
41809
42090
  return typeof e === "object" && e !== null && "type" in e && e.type === "agent_metadata";
41810
42091
  }
42092
+ async function vUe(e, t) {
42093
+ let r = cW(t.dir), n = us(r), o = t.offset ?? 0, i = t.limit;
42094
+ if (e.listSessionSummaries) return SUe(e, n, r, t.dir, i, o);
42095
+ if (!e.listSessions) throw Error("sessionStore.listSessions is not implemented -- cannot list sessions. Provide a store with a listSessions() method.");
42096
+ let a = (await e.listSessions(n)).slice().sort((u, d) => d.mtime - u.mtime), c = uW(a, i, o);
42097
+ return pW(e, c, t.dir, r);
42098
+ }
42099
+ async function SUe(e, t, r, n, o, i) {
42100
+ let s = await e.listSessionSummaries(t), a = e.listSessions ? new Map((await e.listSessions(t)).map((f) => [f.sessionId, f])) : void 0, c = [];
42101
+ for (let f of s) {
42102
+ let m = a?.get(f.sessionId);
42103
+ if (a && !m) continue;
42104
+ let g = m !== void 0 && f.mtime < m.mtime;
42105
+ c.push({ sessionId: f.sessionId, mtime: g ? m.mtime : f.mtime, info: g ? void 0 : HO(f, r) });
42106
+ }
42107
+ if (a) {
42108
+ let f = new Set(s.map((m) => m.sessionId));
42109
+ for (let [m, g] of a) if (!f.has(m)) c.push({ sessionId: m, mtime: g.mtime });
42110
+ } else ce("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");
42111
+ c.sort((f, m) => m.mtime - f.mtime);
42112
+ let u = uW(c, o, i), d = u.filter((f) => f.info === void 0);
42113
+ if (d.length > 0) {
42114
+ let f = await pW(e, d, n, r), m = new Map(f.map((g) => [g.sessionId, g]));
42115
+ for (let g of u) if (g.info === void 0) g.info = m.get(g.sessionId) ?? null;
42116
+ }
42117
+ return u.flatMap((f) => f.info ? [f.info] : []);
42118
+ }
42119
+ async function pW(e, t, r, n) {
42120
+ return (await Promise.allSettled(t.map(async (i) => {
42121
+ let s = await fW(e, i.sessionId, r);
42122
+ if (!s) return null;
42123
+ let a = fc(i.sessionId, dW(s, i.mtime), n);
42124
+ return a ? { ...a, lastModified: i.mtime } : null;
42125
+ }))).flatMap((i, s) => {
42126
+ let a = t[s];
42127
+ if (i.status === "fulfilled") return i.value ? [i.value] : [];
42128
+ return [{ sessionId: a.sessionId, summary: "", lastModified: a.mtime }];
42129
+ });
42130
+ }
41811
42131
  function dW(e, t) {
41812
42132
  let r = Buffer.from(e, "utf-8"), n = r.length, o = r.subarray(0, dn).toString("utf-8"), i = n > dn ? r.subarray(n - dn).toString("utf-8") : o;
41813
42133
  return { mtime: t, size: n, head: o, tail: i };
@@ -42913,26 +43233,150 @@ async function forkClaudeSession(input) {
42913
43233
  return { ok: true, value: { sessionId: derivedSessionId } };
42914
43234
  }
42915
43235
 
43236
+ // dist/claude-session-import.js
43237
+ import { realpath, stat } from "node:fs/promises";
43238
+ import path6 from "node:path";
43239
+ function titleFromMetadata(metadata) {
43240
+ for (const value of [metadata.customTitle, metadata.summary, metadata.firstPrompt]) {
43241
+ if (typeof value !== "string")
43242
+ continue;
43243
+ const title = value.replaceAll("\0", "").trim().slice(0, HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH);
43244
+ if (title)
43245
+ return title;
43246
+ }
43247
+ return null;
43248
+ }
43249
+ async function sourceFromMetadata(metadata, isRunning, signal, canonicalCwds, preferredCwds = []) {
43250
+ signal.throwIfAborted();
43251
+ if (typeof metadata.sessionId !== "string" || metadata.sessionId.trim().length === 0 || typeof metadata.lastModified !== "number" || !Number.isFinite(metadata.lastModified)) {
43252
+ return null;
43253
+ }
43254
+ const candidates = [
43255
+ ...preferredCwds,
43256
+ ...typeof metadata.cwd === "string" ? [metadata.cwd] : []
43257
+ ];
43258
+ let cwd = null;
43259
+ for (const candidate2 of new Set(candidates)) {
43260
+ if (!path6.isAbsolute(candidate2))
43261
+ continue;
43262
+ let canonical = canonicalCwds.get(candidate2);
43263
+ if (!canonical) {
43264
+ canonical = (async () => {
43265
+ try {
43266
+ const resolved = await realpath(candidate2);
43267
+ return (await stat(resolved)).isDirectory() ? resolved : null;
43268
+ } catch {
43269
+ return null;
43270
+ }
43271
+ })();
43272
+ canonicalCwds.set(candidate2, canonical);
43273
+ }
43274
+ cwd = await canonical;
43275
+ signal.throwIfAborted();
43276
+ if (cwd)
43277
+ break;
43278
+ }
43279
+ if (!cwd)
43280
+ return null;
43281
+ const nativeSessionId = metadata.sessionId.trim();
43282
+ const candidate = harnessSessionImportCandidateSchema.safeParse({
43283
+ nativeSessionId,
43284
+ cwd,
43285
+ title: titleFromMetadata(metadata),
43286
+ updatedAt: Math.floor(metadata.lastModified),
43287
+ // We know about sessions opened through this Adapter. Other Claude clients do not
43288
+ // expose a reliable cross-process ownership signal, so their activity stays unknown.
43289
+ running: isRunning(nativeSessionId) ? true : null
43290
+ });
43291
+ const nativeRef = nativeSessionRefSchema.safeParse({
43292
+ harnessId: "claude-code",
43293
+ nativeSessionId,
43294
+ formatVersion: 1
43295
+ });
43296
+ return candidate.success && nativeRef.success ? { candidate: candidate.data, nativeRef: nativeRef.data } : null;
43297
+ }
43298
+ var ClaudeSessionImportIndex = class {
43299
+ #dependencies;
43300
+ #listing;
43301
+ constructor(dependencies) {
43302
+ this.#dependencies = dependencies;
43303
+ }
43304
+ list(signal) {
43305
+ this.#listing ??= this.#scan(signal).finally(() => {
43306
+ this.#listing = void 0;
43307
+ });
43308
+ return this.#listing;
43309
+ }
43310
+ async #scan(signal) {
43311
+ signal.throwIfAborted();
43312
+ const metadata = await this.#dependencies.listSessions();
43313
+ signal.throwIfAborted();
43314
+ const sources = [];
43315
+ const identities = /* @__PURE__ */ new Set();
43316
+ const canonicalCwds = /* @__PURE__ */ new Map();
43317
+ for (const session of metadata) {
43318
+ const source = await sourceFromMetadata(session, this.#dependencies.isRunning, signal, canonicalCwds);
43319
+ if (!source)
43320
+ continue;
43321
+ const identity = source.candidate.nativeSessionId;
43322
+ if (identities.has(identity)) {
43323
+ throw new Error(`Claude Session identity is ambiguous: ${identity}`);
43324
+ }
43325
+ identities.add(identity);
43326
+ sources.push(source);
43327
+ }
43328
+ return sources;
43329
+ }
43330
+ async resolve(nativeSessionId, signal) {
43331
+ signal.throwIfAborted();
43332
+ const metadata = await this.#dependencies.getSessionInfo({ sessionId: nativeSessionId });
43333
+ signal.throwIfAborted();
43334
+ if (!metadata || metadata.sessionId !== nativeSessionId)
43335
+ return null;
43336
+ const preferredCwds = [];
43337
+ if (typeof metadata.cwd === "string" && path6.isAbsolute(metadata.cwd)) {
43338
+ try {
43339
+ const messages = await this.#dependencies.readSessionMessages({
43340
+ cwd: metadata.cwd,
43341
+ sessionId: nativeSessionId
43342
+ });
43343
+ signal.throwIfAborted();
43344
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
43345
+ const message = messages[index];
43346
+ if (typeof message !== "object" || message === null || Array.isArray(message) || typeof message.cwd !== "string") {
43347
+ continue;
43348
+ }
43349
+ const cwd = message.cwd;
43350
+ if (path6.isAbsolute(cwd) && !preferredCwds.includes(cwd))
43351
+ preferredCwds.push(cwd);
43352
+ }
43353
+ } catch {
43354
+ }
43355
+ }
43356
+ return sourceFromMetadata(metadata, this.#dependencies.isRunning, signal, /* @__PURE__ */ new Map(), preferredCwds);
43357
+ }
43358
+ };
43359
+
42916
43360
  // dist/claude-transcript.js
42917
43361
  import os3 from "node:os";
42918
- import path6 from "node:path";
42919
- import { readFile as readFile2, readdir, stat } from "node:fs/promises";
43362
+ import path7 from "node:path";
43363
+ import { readFile as readFile2, readdir, stat as stat2 } from "node:fs/promises";
42920
43364
  function projectDirectoryName(cwd) {
42921
43365
  return cwd.replace(/[^A-Za-z0-9]/gu, "-");
42922
43366
  }
42923
43367
  function configDirectory(environment) {
42924
- return environment.CLAUDE_CONFIG_DIR ? path6.resolve(environment.CLAUDE_CONFIG_DIR) : path6.join(os3.homedir(), ".claude");
43368
+ return environment.CLAUDE_CONFIG_DIR ? path7.resolve(environment.CLAUDE_CONFIG_DIR) : path7.join(os3.homedir(), ".claude");
42925
43369
  }
42926
43370
  async function existingFile(file2) {
42927
43371
  try {
42928
- return (await stat(file2)).isFile();
43372
+ return (await stat2(file2)).isFile();
42929
43373
  } catch {
42930
43374
  return false;
42931
43375
  }
42932
43376
  }
42933
43377
  async function findTranscriptFile(environment, cwd, relativeName) {
42934
- const projectsDirectory = path6.join(configDirectory(environment), "projects");
42935
- const expected = path6.join(projectsDirectory, projectDirectoryName(cwd), relativeName);
43378
+ const projectsDirectory = path7.join(configDirectory(environment), "projects");
43379
+ const expected = path7.join(projectsDirectory, projectDirectoryName(cwd), relativeName);
42936
43380
  if (await existingFile(expected))
42937
43381
  return expected;
42938
43382
  let projects;
@@ -42942,7 +43386,7 @@ async function findTranscriptFile(environment, cwd, relativeName) {
42942
43386
  return null;
42943
43387
  }
42944
43388
  for (const project of projects) {
42945
- const candidate = path6.join(projectsDirectory, project, relativeName);
43389
+ const candidate = path7.join(projectsDirectory, project, relativeName);
42946
43390
  if (await existingFile(candidate))
42947
43391
  return candidate;
42948
43392
  }
@@ -42976,7 +43420,7 @@ async function readClaudeTranscript(input) {
42976
43420
  return parseTranscriptRecords(await readFile2(transcript, "utf8"), input.sessionId);
42977
43421
  }
42978
43422
  async function readClaudeSubagentTranscript(input) {
42979
- const relativeName = path6.join(input.sessionId, "subagents", `agent-${input.nativeSubagentId}.jsonl`);
43423
+ const relativeName = path7.join(input.sessionId, "subagents", `agent-${input.nativeSubagentId}.jsonl`);
42980
43424
  const transcript = await findTranscriptFile(input.environment, input.cwd, relativeName);
42981
43425
  if (!transcript)
42982
43426
  return null;
@@ -43243,7 +43687,7 @@ function projectClaudeAccountUsage(usage, account) {
43243
43687
 
43244
43688
  // dist/gateway-models.js
43245
43689
  import { readFile as readFile3 } from "node:fs/promises";
43246
- import path7 from "node:path";
43690
+ import path8 from "node:path";
43247
43691
  var GATEWAY_MODELS_TIMEOUT_MS = 3e3;
43248
43692
  var GATEWAY_MODELS_MAX_BYTES = 2 * 1024 * 1024;
43249
43693
  var OFFICIAL_ANTHROPIC_HOST = "api.anthropic.com";
@@ -43285,14 +43729,14 @@ function claudeConfigDirectory(environment) {
43285
43729
  if (configured)
43286
43730
  return configured;
43287
43731
  const home = trimmedEnv(environment, "HOME") ?? trimmedEnv(environment, "USERPROFILE");
43288
- return home ? path7.join(home, ".claude") : void 0;
43732
+ return home ? path8.join(home, ".claude") : void 0;
43289
43733
  }
43290
43734
  async function readClaudeUserSettingsEnv(environment) {
43291
43735
  const configDir = claudeConfigDirectory(environment);
43292
43736
  if (!configDir)
43293
43737
  return {};
43294
43738
  try {
43295
- const raw = await readFile3(path7.join(configDir, "settings.json"), "utf8");
43739
+ const raw = await readFile3(path8.join(configDir, "settings.json"), "utf8");
43296
43740
  const parsed = JSON.parse(raw);
43297
43741
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
43298
43742
  return {};
@@ -43424,7 +43868,7 @@ async function applyGatewayModelCatalog(snapshot, environment, dependencies = {}
43424
43868
  }
43425
43869
 
43426
43870
  // dist/file-change.js
43427
- import path8 from "node:path";
43871
+ import path9 from "node:path";
43428
43872
  var hunkSchema = external_exports.object({
43429
43873
  oldStart: external_exports.number().int().nonnegative(),
43430
43874
  oldLines: external_exports.number().int().nonnegative(),
@@ -43472,10 +43916,10 @@ function parseClaudeNativeFileChange(toolName, value) {
43472
43916
  };
43473
43917
  }
43474
43918
  function displayPath(nativePath, cwd) {
43475
- const resolvedCwd = path8.resolve(cwd);
43476
- const resolvedPath = path8.isAbsolute(nativePath) ? path8.resolve(nativePath) : path8.resolve(cwd, nativePath);
43477
- const relative = path8.relative(resolvedCwd, resolvedPath);
43478
- const selected = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path8.sep}`) ? relative : resolvedPath;
43919
+ const resolvedCwd = path9.resolve(cwd);
43920
+ const resolvedPath = path9.isAbsolute(nativePath) ? path9.resolve(nativePath) : path9.resolve(cwd, nativePath);
43921
+ const relative = path9.relative(resolvedCwd, resolvedPath);
43922
+ const selected = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path9.sep}`) ? relative : resolvedPath;
43479
43923
  const normalized = selected.replaceAll("\\", "/");
43480
43924
  return validNativePath(normalized) && normalized !== "." ? normalized : null;
43481
43925
  }
@@ -43487,7 +43931,7 @@ function projectClaudeFileChange(value, cwd) {
43487
43931
  `@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`,
43488
43932
  ...hunk.lines
43489
43933
  ]);
43490
- const absoluteDisplayPath = path8.posix.isAbsolute(normalizedPath);
43934
+ const absoluteDisplayPath = path9.posix.isAbsolute(normalizedPath);
43491
43935
  const oldHeader = value.kind === "add" ? "/dev/null" : absoluteDisplayPath ? normalizedPath : `a/${normalizedPath}`;
43492
43936
  const newHeader = absoluteDisplayPath ? normalizedPath : `b/${normalizedPath}`;
43493
43937
  const unifiedDiff = [`--- ${oldHeader}`, `+++ ${newHeader}`, ...body, ""].join("\n");
@@ -45615,6 +46059,9 @@ var ClaudeHarnessSession = class {
45615
46059
  initialState;
45616
46060
  initialUsage = null;
45617
46061
  outputs;
46062
+ get nativeSessionId() {
46063
+ return this.#sessionId;
46064
+ }
45618
46065
  #channel = new HarnessOutputChannel();
45619
46066
  #cancelTimeoutMs;
45620
46067
  #closeTimeoutMs;
@@ -47317,9 +47764,31 @@ var ClaudeCodeAdapter = class {
47317
47764
  }
47318
47765
  }
47319
47766
  };
47767
+ sessionImport = Object.freeze({
47768
+ listCandidates: async () => {
47769
+ const result = await this.#readImport((signal) => this.#importIndex.list(signal));
47770
+ return result.ok ? { ok: true, value: result.value.map(({ candidate }) => candidate) } : result;
47771
+ },
47772
+ resolveCandidate: async (nativeSessionId) => {
47773
+ const result = await this.#readImport((signal) => this.#importIndex.resolve(nativeSessionId, signal));
47774
+ if (!result.ok)
47775
+ return result;
47776
+ return result.value ? { ok: true, value: result.value } : {
47777
+ ok: false,
47778
+ error: {
47779
+ code: "sessionNotFound",
47780
+ message: "Claude Code Session is no longer importable",
47781
+ retryable: false
47782
+ }
47783
+ };
47784
+ }
47785
+ });
47320
47786
  #cancelTimeoutMs;
47321
47787
  #closeTimeoutMs;
47322
47788
  #dependencies;
47789
+ #importAbort = new AbortController();
47790
+ #importIndex;
47791
+ #importRequests = /* @__PURE__ */ new Set();
47323
47792
  #toolOutputLimit;
47324
47793
  #continuationQuiescenceMs;
47325
47794
  #inspectionCache = /* @__PURE__ */ new Map();
@@ -47368,10 +47837,10 @@ var ClaudeCodeAdapter = class {
47368
47837
  forkSession: ({ checkpointId, cwd, sourceSessionId }) => Mkt(sourceSessionId, { dir: cwd, upToMessageId: checkpointId }),
47369
47838
  getSessionInfo: async ({ sessionId }) => {
47370
47839
  const info = await Pkt(sessionId);
47371
- if (!info)
47372
- return void 0;
47373
- return info.cwd ? { cwd: info.cwd } : {};
47840
+ return info;
47374
47841
  },
47842
+ // Include SDK-origin Sessions so an orphaned codexhost mapping can also be recovered.
47843
+ listSessions: () => Ikt(),
47375
47844
  readSessionMessages: async ({ cwd, sessionId }) => {
47376
47845
  const transcript = await readClaudeTranscript({
47377
47846
  cwd,
@@ -47392,6 +47861,30 @@ var ClaudeCodeAdapter = class {
47392
47861
  return jkt(sessionId, nativeSubagentId2, { dir: cwd });
47393
47862
  }
47394
47863
  };
47864
+ this.#importIndex = new ClaudeSessionImportIndex({
47865
+ getSessionInfo: (input) => this.#dependencies.getSessionInfo(input),
47866
+ isRunning: (nativeSessionId) => [...this.#sessions].some((session) => session.nativeSessionId === nativeSessionId),
47867
+ listSessions: () => this.#dependencies.listSessions(),
47868
+ readSessionMessages: (input) => this.#dependencies.readSessionMessages(input)
47869
+ });
47870
+ }
47871
+ #readImport(operation) {
47872
+ if (this.#importAbort.signal.aborted) {
47873
+ return Promise.resolve({
47874
+ ok: false,
47875
+ error: invalidState("Claude Code Adapter is closed")
47876
+ });
47877
+ }
47878
+ const request = operation(this.#importAbort.signal).then((value) => ({ ok: true, value })).catch(() => ({
47879
+ ok: false,
47880
+ error: {
47881
+ code: "unavailable",
47882
+ message: "Claude Code Session discovery failed; check native storage access and duplicate Session identities, then retry after closing native clients",
47883
+ retryable: true
47884
+ }
47885
+ })).finally(() => this.#importRequests.delete(request));
47886
+ this.#importRequests.add(request);
47887
+ return request;
47395
47888
  }
47396
47889
  async inspect(input = {}) {
47397
47890
  if (this.#closePromise) {
@@ -47400,7 +47893,7 @@ var ClaudeCodeAdapter = class {
47400
47893
  error: invalidState("Claude Code Adapter is closing")
47401
47894
  };
47402
47895
  }
47403
- const cwd = path9.resolve(input.cwd ?? process.cwd());
47896
+ const cwd = path10.resolve(input.cwd ?? process.cwd());
47404
47897
  if (!input.refresh) {
47405
47898
  const cached2 = this.#inspectionCache.get(cwd);
47406
47899
  if (cached2)
@@ -47546,7 +48039,7 @@ var ClaudeCodeAdapter = class {
47546
48039
  let sourceSnapshot;
47547
48040
  try {
47548
48041
  const messages = await this.#dependencies.readSessionMessages({
47549
- cwd: path9.resolve(input.cwd),
48042
+ cwd: path10.resolve(input.cwd),
47550
48043
  sessionId: sourceRef.data.nativeSessionId
47551
48044
  });
47552
48045
  sourceSnapshot = mapClaudeSnapshot(messages, sourceRef.data.nativeSessionId);
@@ -47588,7 +48081,7 @@ var ClaudeCodeAdapter = class {
47588
48081
  } else {
47589
48082
  const forked2 = await forkClaudeSession({
47590
48083
  checkpoint: retained.checkpoint,
47591
- cwd: path9.resolve(input.cwd),
48084
+ cwd: path10.resolve(input.cwd),
47592
48085
  dependencies: this.#dependencies,
47593
48086
  harnessId: this.harnessId,
47594
48087
  sourceRef: sourceRef.data
@@ -47643,7 +48136,7 @@ var ClaudeCodeAdapter = class {
47643
48136
  }
47644
48137
  };
47645
48138
  }
47646
- const cwd = path9.resolve(input.cwd);
48139
+ const cwd = path10.resolve(input.cwd);
47647
48140
  const nativeRef = input.kind === "resume" ? nativeSessionRefSchema.safeParse(input.nativeRef) : null;
47648
48141
  if (nativeRef && (!nativeRef.success || nativeRef.data.harnessId !== this.harnessId)) {
47649
48142
  return {
@@ -47699,8 +48192,10 @@ var ClaudeCodeAdapter = class {
47699
48192
  }
47700
48193
  close() {
47701
48194
  if (!this.#closePromise) {
48195
+ this.#importAbort.abort();
47702
48196
  this.#inspectionCache.clear();
47703
48197
  this.#closePromise = Promise.all([
48198
+ ...this.#importRequests,
47704
48199
  ...[...this.#inspectors].map((inspector) => inspector.close()),
47705
48200
  ...[...this.#sessions].map((session) => session.close()),
47706
48201
  ...this.#inspectionInFlight.values()
@@ -47711,7 +48206,7 @@ var ClaudeCodeAdapter = class {
47711
48206
  };
47712
48207
 
47713
48208
  // dist/user-shell-environment.js
47714
- import path10 from "node:path";
48209
+ import path11 from "node:path";
47715
48210
  import { spawnSync } from "node:child_process";
47716
48211
  var ENVIRONMENT_MARKER = Buffer.from("\0CODEXHOST_USER_SHELL_ENV_V1\0");
47717
48212
  var ENVIRONMENT_COMMAND = "printf '\\0CODEXHOST_USER_SHELL_ENV_V1\\0'; /usr/bin/env -0";
@@ -47754,7 +48249,7 @@ function withUserShellEnvironment(environment, dependencies) {
47754
48249
  if (platform === "win32" || !environment.HOME)
47755
48250
  return environment;
47756
48251
  const shell = environment.SHELL?.trim() || defaultShell(platform);
47757
- if (!shell || !SUPPORTED_SHELLS.has(path10.basename(shell)))
48252
+ if (!shell || !SUPPORTED_SHELLS.has(path11.basename(shell)))
47758
48253
  return environment;
47759
48254
  const cacheKey = `${platform}\0${shell}\0${environment.HOME}`;
47760
48255
  const cached2 = dependencies ? void 0 : shellEnvironmentCache.get(cacheKey);