@karlorz/codexhost-cli-win32-x64 0.14.0-5 → 0.15.0-1

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.
@@ -777,10 +777,10 @@ function mergeDefs(...defs) {
777
777
  function cloneDef(schema) {
778
778
  return mergeDefs(schema._zod.def);
779
779
  }
780
- function getElementAtPath(obj, path19) {
781
- if (!path19)
780
+ function getElementAtPath(obj, path18) {
781
+ if (!path18)
782
782
  return obj;
783
- return path19.reduce((acc, key) => acc?.[key], obj);
783
+ return path18.reduce((acc, key) => acc?.[key], obj);
784
784
  }
785
785
  function promiseAllObject(promisesObj) {
786
786
  const keys = Object.keys(promisesObj);
@@ -1189,11 +1189,11 @@ function explicitlyAborted(x, startIndex = 0) {
1189
1189
  }
1190
1190
  return false;
1191
1191
  }
1192
- function prefixIssues(path19, issues) {
1192
+ function prefixIssues(path18, issues) {
1193
1193
  return issues.map((iss) => {
1194
1194
  var _a4;
1195
1195
  (_a4 = iss).path ?? (_a4.path = []);
1196
- iss.path.unshift(path19);
1196
+ iss.path.unshift(path18);
1197
1197
  return iss;
1198
1198
  });
1199
1199
  }
@@ -1340,16 +1340,16 @@ function flattenError(error52, mapper = (issue2) => issue2.message) {
1340
1340
  }
1341
1341
  function formatError(error52, mapper = (issue2) => issue2.message) {
1342
1342
  const fieldErrors = { _errors: [] };
1343
- const processError = (error53, path19 = []) => {
1343
+ const processError = (error53, path18 = []) => {
1344
1344
  for (const issue2 of error53.issues) {
1345
1345
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1346
- issue2.errors.map((issues) => processError({ issues }, [...path19, ...issue2.path]));
1346
+ issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
1347
1347
  } else if (issue2.code === "invalid_key") {
1348
- processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
1348
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1349
1349
  } else if (issue2.code === "invalid_element") {
1350
- processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
1350
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1351
1351
  } else {
1352
- const fullpath = [...path19, ...issue2.path];
1352
+ const fullpath = [...path18, ...issue2.path];
1353
1353
  if (fullpath.length === 0) {
1354
1354
  fieldErrors._errors.push(mapper(issue2));
1355
1355
  } else {
@@ -1376,17 +1376,17 @@ function formatError(error52, mapper = (issue2) => issue2.message) {
1376
1376
  }
1377
1377
  function treeifyError(error52, mapper = (issue2) => issue2.message) {
1378
1378
  const result = { errors: [] };
1379
- const processError = (error53, path19 = []) => {
1379
+ const processError = (error53, path18 = []) => {
1380
1380
  var _a4, _b2;
1381
1381
  for (const issue2 of error53.issues) {
1382
1382
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1383
- issue2.errors.map((issues) => processError({ issues }, [...path19, ...issue2.path]));
1383
+ issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
1384
1384
  } else if (issue2.code === "invalid_key") {
1385
- processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
1385
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1386
1386
  } else if (issue2.code === "invalid_element") {
1387
- processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
1387
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1388
1388
  } else {
1389
- const fullpath = [...path19, ...issue2.path];
1389
+ const fullpath = [...path18, ...issue2.path];
1390
1390
  if (fullpath.length === 0) {
1391
1391
  result.errors.push(mapper(issue2));
1392
1392
  continue;
@@ -1418,8 +1418,8 @@ function treeifyError(error52, mapper = (issue2) => issue2.message) {
1418
1418
  }
1419
1419
  function toDotPath(_path) {
1420
1420
  const segs = [];
1421
- const path19 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1422
- for (const seg of path19) {
1421
+ const path18 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1422
+ for (const seg of path18) {
1423
1423
  if (typeof seg === "number")
1424
1424
  segs.push(`[${seg}]`);
1425
1425
  else if (typeof seg === "symbol")
@@ -14111,13 +14111,13 @@ function resolveRef(ref, ctx) {
14111
14111
  if (!ref.startsWith("#")) {
14112
14112
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14113
14113
  }
14114
- const path19 = ref.slice(1).split("/").filter(Boolean);
14115
- if (path19.length === 0) {
14114
+ const path18 = ref.slice(1).split("/").filter(Boolean);
14115
+ if (path18.length === 0) {
14116
14116
  return ctx.rootSchema;
14117
14117
  }
14118
14118
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14119
- if (path19[0] === defsKey) {
14120
- const key = path19[1];
14119
+ if (path18[0] === defsKey) {
14120
+ const key = path18[1];
14121
14121
  if (!key || !ctx.defs[key]) {
14122
14122
  throw new Error(`Reference not found: ${ref}`);
14123
14123
  }
@@ -16531,6 +16531,7 @@ var HARNESS_BROKER_PROTOCOL_VERSION = 1;
16531
16531
  var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
16532
16532
  var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
16533
16533
  var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
16534
+ var HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE = 100;
16534
16535
  var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
16535
16536
  var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
16536
16537
  var harnessBrokerMethodSchema = external_exports.enum([
@@ -16538,6 +16539,8 @@ var harnessBrokerMethodSchema = external_exports.enum([
16538
16539
  "adapter.inspectAccount",
16539
16540
  "adapter.credits",
16540
16541
  "adapter.open",
16542
+ "adapter.sessionImport.list",
16543
+ "adapter.sessionImport.resolve",
16541
16544
  "adapter.subagent.readSnapshot",
16542
16545
  "session.readSnapshot",
16543
16546
  "session.readCapabilities",
@@ -16640,30 +16643,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
16640
16643
  });
16641
16644
  }
16642
16645
 
16643
- // ../../harness-broker/dist/paths.js
16644
- import os from "node:os";
16645
- import path from "node:path";
16646
- var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
16647
- var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
16648
- function defaultHarnessBrokerDirectory(environment = process.env) {
16649
- const home = environment.HOME || os.homedir();
16650
- return path.join(home, ".codexhost", "harness-broker");
16651
- }
16652
- function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
16653
- harnessPluginIdSchema.parse(harnessId);
16654
- if (harnessId !== "claude-code")
16655
- return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
16656
- return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
16657
- }
16658
- function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
16659
- harnessPluginIdSchema.parse(harnessId);
16660
- return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
16661
- }
16662
- function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
16663
- const home = environment.HOME || os.homedir();
16664
- return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
16665
- }
16666
-
16667
16646
  // ../../harness-broker/dist/validation.js
16668
16647
  var cwdSchema = external_exports.string().min(1).max(16384);
16669
16648
  var brokerEnvironmentSchema = external_exports.object({
@@ -16714,7 +16693,31 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
16714
16693
  forkSchema,
16715
16694
  rollbackSchema
16716
16695
  ]);
16717
- var brokerInspectInputSchema = external_exports.object({ cwd: cwdSchema.optional(), refresh: external_exports.boolean().optional() }).strict();
16696
+ var brokerInspectInputSchema = external_exports.object({
16697
+ cwd: cwdSchema.optional(),
16698
+ refresh: external_exports.boolean().optional(),
16699
+ purpose: external_exports.literal("availability").optional()
16700
+ }).strict();
16701
+ var brokerSessionImportListParamsSchema = external_exports.object({
16702
+ offset: external_exports.number().int().nonnegative().safe(),
16703
+ limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
16704
+ }).strict();
16705
+ var brokerSessionImportResolveParamsSchema = external_exports.object({ nativeSessionId: harnessSessionImportIdSchema }).strict();
16706
+ var brokerSessionImportPageSchema = external_exports.object({
16707
+ candidates: external_exports.array(harnessSessionImportCandidateSchema).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE),
16708
+ total: external_exports.number().int().nonnegative().safe()
16709
+ }).strict();
16710
+ var brokerSessionImportSourceSchema = external_exports.object({
16711
+ candidate: harnessSessionImportCandidateSchema,
16712
+ nativeRef: nativeSessionRefSchema
16713
+ }).strict().superRefine((source, context) => {
16714
+ if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
16715
+ context.addIssue({
16716
+ code: "custom",
16717
+ message: "Session import source identity does not match"
16718
+ });
16719
+ }
16720
+ });
16718
16721
  var textInputSchema = external_exports.object({ type: external_exports.literal("text"), text: external_exports.string().max(4e6) }).strict();
16719
16722
  var turnStartSchema = external_exports.object({
16720
16723
  type: external_exports.literal("turn.start"),
@@ -16885,6 +16888,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
16885
16888
  return false;
16886
16889
  });
16887
16890
 
16891
+ // ../../harness-broker/dist/session-import-client.js
16892
+ function createBrokerSessionImportCapability(input) {
16893
+ let listing = null;
16894
+ const closed = () => ({
16895
+ ok: false,
16896
+ error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
16897
+ });
16898
+ const invalid = () => ({
16899
+ ok: false,
16900
+ error: {
16901
+ code: "protocolError",
16902
+ message: "Harness broker returned invalid Session import metadata",
16903
+ retryable: false
16904
+ }
16905
+ });
16906
+ const list = async () => {
16907
+ try {
16908
+ const candidates = [];
16909
+ const identities = /* @__PURE__ */ new Set();
16910
+ let total;
16911
+ for (; ; ) {
16912
+ if (input.isClosed())
16913
+ return closed();
16914
+ const result = await input.request("adapter.sessionImport.list", {
16915
+ offset: candidates.length,
16916
+ limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
16917
+ });
16918
+ if (input.isClosed())
16919
+ return closed();
16920
+ if (!result.ok)
16921
+ return result;
16922
+ const page = brokerSessionImportPageSchema.safeParse(result.value);
16923
+ if (!page.success || total !== void 0 && total !== page.data.total || page.data.total < candidates.length + page.data.candidates.length || page.data.candidates.length === 0 && candidates.length < page.data.total)
16924
+ return invalid();
16925
+ total = page.data.total;
16926
+ for (const candidate of page.data.candidates) {
16927
+ if (identities.has(candidate.nativeSessionId))
16928
+ return invalid();
16929
+ identities.add(candidate.nativeSessionId);
16930
+ candidates.push(candidate);
16931
+ }
16932
+ if (candidates.length === total)
16933
+ return { ok: true, value: candidates };
16934
+ }
16935
+ } catch (error52) {
16936
+ return { ok: false, error: input.error(error52) };
16937
+ }
16938
+ };
16939
+ return {
16940
+ listCandidates() {
16941
+ if (input.isClosed())
16942
+ return Promise.resolve(closed());
16943
+ listing ??= list().finally(() => {
16944
+ listing = null;
16945
+ });
16946
+ return listing;
16947
+ },
16948
+ async resolveCandidate(nativeSessionId) {
16949
+ if (input.isClosed())
16950
+ return closed();
16951
+ try {
16952
+ const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
16953
+ if (input.isClosed())
16954
+ return closed();
16955
+ if (!result.ok)
16956
+ return result;
16957
+ const source = brokerSessionImportSourceSchema.safeParse(result.value);
16958
+ if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
16959
+ return invalid();
16960
+ return { ok: true, value: source.data };
16961
+ } catch (error52) {
16962
+ return { ok: false, error: input.error(error52) };
16963
+ }
16964
+ }
16965
+ };
16966
+ }
16967
+
16968
+ // ../../harness-broker/dist/paths.js
16969
+ import os from "node:os";
16970
+ import path from "node:path";
16971
+ var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
16972
+ var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
16973
+ function defaultHarnessBrokerDirectory(environment = process.env) {
16974
+ const home = environment.HOME || os.homedir();
16975
+ return path.join(home, ".codexhost", "harness-broker");
16976
+ }
16977
+ function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
16978
+ harnessPluginIdSchema.parse(harnessId);
16979
+ if (harnessId !== "claude-code")
16980
+ return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
16981
+ return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
16982
+ }
16983
+ function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
16984
+ harnessPluginIdSchema.parse(harnessId);
16985
+ return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
16986
+ }
16987
+ function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
16988
+ const home = environment.HOME || os.homedir();
16989
+ return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
16990
+ }
16991
+
16888
16992
  // ../../harness-broker/dist/client.js
16889
16993
  function unavailable(message, retryable = true) {
16890
16994
  return { code: "unavailable", message, retryable, stage: "harnessBroker" };
@@ -17421,6 +17525,7 @@ var BrokeredHarnessAdapter = class {
17421
17525
  commandCatalog;
17422
17526
  liveCommandCatalog;
17423
17527
  harnessId;
17528
+ sessionImport;
17424
17529
  credits;
17425
17530
  refreshCredits;
17426
17531
  #descriptorPath;
@@ -17443,6 +17548,14 @@ var BrokeredHarnessAdapter = class {
17443
17548
  };
17444
17549
  constructor(input = {}) {
17445
17550
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
17551
+ if (input.sessionImport) {
17552
+ this.sessionImport = createBrokerSessionImportCapability({
17553
+ harnessId: this.harnessId,
17554
+ request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
17555
+ isClosed: () => this.#closed,
17556
+ error: (error52) => this.#error(error52)
17557
+ });
17558
+ }
17446
17559
  if (input.accountCredits !== false) {
17447
17560
  this.credits = () => this.#credits;
17448
17561
  this.refreshCredits = () => this.#refreshAccountCredits();
@@ -17906,7 +18019,7 @@ function claudePromptCacheIndicators(accountCreditsSupported, lastResponseAtUnix
17906
18019
 
17907
18020
  // dist/claude-code-adapter.js
17908
18021
  import { randomUUID as randomUUID5 } from "node:crypto";
17909
- import path16 from "node:path";
18022
+ import path15 from "node:path";
17910
18023
 
17911
18024
  // ../../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
17912
18025
  import { createRequire as jre } from "node:module";
@@ -54558,7 +54671,6 @@ var ClaudePendingSessions = class {
54558
54671
  };
54559
54672
 
54560
54673
  // dist/claude-fork.js
54561
- import path12 from "node:path";
54562
54674
  import { isDeepStrictEqual } from "node:util";
54563
54675
 
54564
54676
  // dist/file-change.js
@@ -54706,6 +54818,17 @@ function targetedSubagentId(argumentsValue) {
54706
54818
  return void 0;
54707
54819
  return boundedString(argumentsValue.to ?? argumentsValue.recipient ?? argumentsValue.agentId, SUBAGENT_DESCRIPTION_LIMIT);
54708
54820
  }
54821
+ function claudeSendMessageFailed(nativeResult, outputText) {
54822
+ if (isRecord7(nativeResult) && typeof nativeResult.success === "boolean") {
54823
+ return nativeResult.success === false;
54824
+ }
54825
+ try {
54826
+ const parsed = JSON.parse(outputText ?? "");
54827
+ return isRecord7(parsed) && parsed.success === false;
54828
+ } catch {
54829
+ return false;
54830
+ }
54831
+ }
54709
54832
  function includesAuthenticationFailure(errors) {
54710
54833
  return errors.some((error52) => AUTHENTICATION_ERRORS.has(error52));
54711
54834
  }
@@ -55444,7 +55567,7 @@ var ClaudeNativeTurnAccumulator = class {
55444
55567
  events.push({
55445
55568
  type: "subagent.completed",
55446
55569
  callId,
55447
- isError,
55570
+ isError: isError || tool.name === "SendMessage" && claudeSendMessageFailed(nativeResult, outputText),
55448
55571
  ...subagentContinuesInBackground(nativeResult, outputText) ? { continuesInBackground: true } : {},
55449
55572
  ...agentId ? { nativeSubagentId: agentId } : {},
55450
55573
  ...resultSummary ? { resultSummary } : {}
@@ -55577,7 +55700,7 @@ function conversationMessages(values, sessionId) {
55577
55700
  let promptId = null;
55578
55701
  const occupancy = new ClaudeBackgroundOccupancy();
55579
55702
  let accumulator = new ClaudeNativeTurnAccumulator();
55580
- const sends = /* @__PURE__ */ new Set();
55703
+ const sends = /* @__PURE__ */ new Map();
55581
55704
  let pendingNotification = false;
55582
55705
  for (const value of values) {
55583
55706
  if (!isRecord8(value))
@@ -55610,17 +55733,19 @@ function conversationMessages(values, sessionId) {
55610
55733
  for (const event of accumulator.consume(value).events) {
55611
55734
  if (event.type === "subagent.started") {
55612
55735
  if (event.operation === "send") {
55613
- sends.add(event.callId);
55614
- if (event.nativeSubagentId)
55615
- occupancy.occupyAgent(event.nativeSubagentId);
55736
+ sends.set(event.callId, event.nativeSubagentId);
55616
55737
  } else if (event.background)
55617
55738
  occupancy.occupySpawn(event.callId, event.nativeSubagentId);
55618
55739
  } else if (event.type === "subagent.completed") {
55619
- if (!event.isError && (event.continuesInBackground || sends.has(event.callId))) {
55740
+ if (sends.has(event.callId)) {
55741
+ const agentId = event.nativeSubagentId ?? sends.get(event.callId);
55742
+ if (!event.isError && agentId)
55743
+ occupancy.occupyAgent(agentId);
55744
+ sends.delete(event.callId);
55745
+ } else if (!event.isError && event.continuesInBackground) {
55620
55746
  occupancy.occupySpawn(event.callId, event.nativeSubagentId);
55621
55747
  } else
55622
55748
  occupancy.release(event.callId, event.nativeSubagentId);
55623
- sends.delete(event.callId);
55624
55749
  } else if (event.type === "workflow.launched" && event.background && !event.isError) {
55625
55750
  occupancy.occupySpawn(event.callId, event.taskId);
55626
55751
  } else if (event.type === "subagent.settled") {
@@ -55797,7 +55922,7 @@ function mapClaudeSnapshot(values, sessionId) {
55797
55922
  if (!result)
55798
55923
  continue;
55799
55924
  const output = toolResultOutput(result);
55800
- const failed = result.is_error === true;
55925
+ const failed = result.is_error === true || block.name === "SendMessage" && claudeSendMessageFailed(void 0, output);
55801
55926
  const toolOutcome = failed ? {
55802
55927
  status: "failed",
55803
55928
  error: {
@@ -56092,12 +56217,6 @@ async function forkClaudeSession(input) {
56092
56217
  error: error51("protocolError", "Claude Code Session working directory is unavailable", false)
56093
56218
  };
56094
56219
  }
56095
- if (path12.resolve(sourceInfo.cwd) !== input.cwd) {
56096
- return {
56097
- ok: false,
56098
- error: error51("unsupported", "Claude Code cannot Fork across working directories", false)
56099
- };
56100
- }
56101
56220
  const source = await readSnapshot(input.dependencies, input.cwd, sourceRef.data.nativeSessionId);
56102
56221
  if (!source.ok)
56103
56222
  return source;
@@ -56197,13 +56316,13 @@ import { readFile as readFile6, rename as rename4, rm as rm5, stat as stat5, wri
56197
56316
 
56198
56317
  // dist/claude-transcript.js
56199
56318
  import os6 from "node:os";
56200
- import path13 from "node:path";
56319
+ import path12 from "node:path";
56201
56320
  import { readFile as readFile5, readdir as readdir3, stat as stat4 } from "node:fs/promises";
56202
56321
  function projectDirectoryName(cwd) {
56203
56322
  return cwd.replace(/[^A-Za-z0-9]/gu, "-");
56204
56323
  }
56205
56324
  function configDirectory(environment) {
56206
- return environment.CLAUDE_CONFIG_DIR ? path13.resolve(environment.CLAUDE_CONFIG_DIR) : path13.join(os6.homedir(), ".claude");
56325
+ return environment.CLAUDE_CONFIG_DIR ? path12.resolve(environment.CLAUDE_CONFIG_DIR) : path12.join(os6.homedir(), ".claude");
56207
56326
  }
56208
56327
  async function existingFile(file2) {
56209
56328
  try {
@@ -56213,9 +56332,9 @@ async function existingFile(file2) {
56213
56332
  }
56214
56333
  }
56215
56334
  async function findClaudeTranscript(input) {
56216
- const projectsDirectory = path13.join(configDirectory(input.environment), "projects");
56335
+ const projectsDirectory = path12.join(configDirectory(input.environment), "projects");
56217
56336
  const name = `${input.sessionId}.jsonl`;
56218
- const expected = path13.join(projectsDirectory, projectDirectoryName(input.cwd), name);
56337
+ const expected = path12.join(projectsDirectory, projectDirectoryName(input.cwd), name);
56219
56338
  if (await existingFile(expected))
56220
56339
  return expected;
56221
56340
  let projects;
@@ -56225,7 +56344,7 @@ async function findClaudeTranscript(input) {
56225
56344
  return null;
56226
56345
  }
56227
56346
  for (const project2 of projects) {
56228
- const candidate = path13.join(projectsDirectory, project2, name);
56347
+ const candidate = path12.join(projectsDirectory, project2, name);
56229
56348
  if (await existingFile(candidate))
56230
56349
  return candidate;
56231
56350
  }
@@ -56335,7 +56454,7 @@ async function remapForkedSessionReferences(input) {
56335
56454
  import { Buffer as Buffer2 } from "node:buffer";
56336
56455
  import { readFile as readFile7 } from "node:fs/promises";
56337
56456
  import os7 from "node:os";
56338
- import path14 from "node:path";
56457
+ import path13 from "node:path";
56339
56458
 
56340
56459
  // dist/thinking-options.js
56341
56460
  var option = (id2, label) => ({
@@ -56428,7 +56547,7 @@ function decodeClaudeModelRef(ref) {
56428
56547
  return value === "default" ? void 0 : value;
56429
56548
  }
56430
56549
  function resolveClaudeConfigDirectory(environment = process.env) {
56431
- return path14.resolve(environment.CLAUDE_CONFIG_DIR ?? path14.join(os7.homedir(), ".claude"));
56550
+ return path13.resolve(environment.CLAUDE_CONFIG_DIR ?? path13.join(os7.homedir(), ".claude"));
56432
56551
  }
56433
56552
  function parseModelPickerOptions(value) {
56434
56553
  if (!Array.isArray(value))
@@ -56470,7 +56589,7 @@ function parseClaudeModelPickerSettings(value) {
56470
56589
  };
56471
56590
  }
56472
56591
  async function readClaudeUserModelPicker(environment = process.env) {
56473
- const settingsPath = path14.join(resolveClaudeConfigDirectory(environment), "settings.json");
56592
+ const settingsPath = path13.join(resolveClaudeConfigDirectory(environment), "settings.json");
56474
56593
  let raw;
56475
56594
  try {
56476
56595
  raw = await readFile7(settingsPath, "utf8");
@@ -56816,7 +56935,7 @@ function projectClaudeAccountUsage(usage, account) {
56816
56935
 
56817
56936
  // dist/process-fence.js
56818
56937
  import { execFile as execFile3 } from "node:child_process";
56819
- import path15 from "node:path";
56938
+ import path14 from "node:path";
56820
56939
  import { setTimeout as setTimeout2 } from "node:timers/promises";
56821
56940
  import { promisify } from "node:util";
56822
56941
  var executeFile = promisify(execFile3);
@@ -56840,9 +56959,9 @@ async function closeClaudeProcessGroup(child, timeoutMs) {
56840
56959
  if (child.exitCode !== null || child.signalCode !== null)
56841
56960
  throw new Error("Claude process tree cannot be confirmed after its Windows root exited");
56842
56961
  const root = process.env.SystemRoot ?? process.env.SYSTEMROOT;
56843
- if (!root || !path15.win32.isAbsolute(root))
56962
+ if (!root || !path14.win32.isAbsolute(root))
56844
56963
  throw new Error("Windows SystemRoot is unavailable");
56845
- await executeFile(path15.win32.join(root, "System32", "taskkill.exe"), ["/PID", String(pid), "/T", "/F"], {
56964
+ await executeFile(path14.win32.join(root, "System32", "taskkill.exe"), ["/PID", String(pid), "/T", "/F"], {
56846
56965
  timeout: timeoutMs,
56847
56966
  windowsHide: true
56848
56967
  });
@@ -57142,6 +57261,8 @@ var ClaudeSdkTransport = class {
57142
57261
  /** Root tool calls of the requested Turn that have started and not yet returned a result. */
57143
57262
  #rootToolCalls = /* @__PURE__ */ new Set();
57144
57263
  #pendingSteers = /* @__PURE__ */ new Map();
57264
+ /** Written steers Claude has not yet drained into a native turn, by message ID. */
57265
+ #steerTakeovers = /* @__PURE__ */ new Map();
57145
57266
  #autonomous = null;
57146
57267
  #autonomousTurnHandler = null;
57147
57268
  #idleHandler = null;
@@ -57265,9 +57386,16 @@ var ClaudeSdkTransport = class {
57265
57386
  * `priority: "next"` joins after the current tool call, and a tool result is always followed by
57266
57387
  * another model request. So a steer written while a root tool call runs folds into this Turn;
57267
57388
  * one written while Claude streams its final text may instead run as the next Turn.
57389
+ *
57390
+ * A held Turn's continuation steers as well: while its idle stream is live, the pushed input
57391
+ * runs as that Turn's next Segment, and the background work the Turn waits on keeps running.
57268
57392
  */
57269
57393
  canSteerActiveTurn() {
57270
- return this.#nativeSteer && this.#active !== null && this.#rootToolCalls.size > 0;
57394
+ if (!this.#nativeSteer)
57395
+ return false;
57396
+ if (this.#active !== null)
57397
+ return this.#rootToolCalls.size > 0;
57398
+ return this.#idleLive && this.#idleHandler !== null;
57271
57399
  }
57272
57400
  #observeRootToolCalls(message) {
57273
57401
  if (!isRecord11(message) || message.parent_tool_use_id != null)
@@ -57443,7 +57571,7 @@ var ClaudeSdkTransport = class {
57443
57571
  * The Turn ending first therefore does not reject it, and a missing `queued` receipt resolves
57444
57572
  * after a bounded wait so callers that serialize requests are never held indefinitely.
57445
57573
  */
57446
- steer(text2, messageId) {
57574
+ steer(text2, messageId, onTakeover) {
57447
57575
  if (this.#closePromise || !this.#started || !this.#query || !this.canSteerActiveTurn()) {
57448
57576
  return Promise.reject(new ClaudeSteerMissedTurnError());
57449
57577
  }
@@ -57464,9 +57592,14 @@ var ClaudeSdkTransport = class {
57464
57592
  this.#pendingSteers.delete(messageId);
57465
57593
  return Promise.reject(new ClaudeSteerMissedTurnError());
57466
57594
  }
57595
+ if (onTakeover)
57596
+ this.#steerTakeovers.set(messageId, onTakeover);
57467
57597
  const pending = this.#pendingSteers.get(messageId);
57468
57598
  if (pending) {
57469
- pending.timer = setTimeout(() => this.#acceptSteer(messageId), this.#steerQueuedTimeoutMs);
57599
+ pending.timer = setTimeout(() => {
57600
+ this.#acceptSteer(messageId);
57601
+ this.#takeOverSteer(messageId, false);
57602
+ }, this.#steerQueuedTimeoutMs);
57470
57603
  pending.timer.unref?.();
57471
57604
  }
57472
57605
  return promise2;
@@ -57479,6 +57612,13 @@ var ClaudeSdkTransport = class {
57479
57612
  clearTimeout(pending.timer);
57480
57613
  pending.resolve();
57481
57614
  }
57615
+ #takeOverSteer(messageId, started) {
57616
+ const onTakeover = this.#steerTakeovers.get(messageId);
57617
+ if (!onTakeover)
57618
+ return;
57619
+ this.#steerTakeovers.delete(messageId);
57620
+ onTakeover(started);
57621
+ }
57482
57622
  respondToInteraction(response) {
57483
57623
  const pending = this.#interactions.get(response.requestId);
57484
57624
  if (!pending) {
@@ -57760,6 +57900,9 @@ var ClaudeSdkTransport = class {
57760
57900
  }
57761
57901
  }
57762
57902
  #rejectPendingSteers() {
57903
+ for (const messageId of [...this.#steerTakeovers.keys()]) {
57904
+ this.#takeOverSteer(messageId, false);
57905
+ }
57763
57906
  const pending = [...this.#pendingSteers.values()];
57764
57907
  this.#pendingSteers.clear();
57765
57908
  const error52 = new Error("Claude Code steer receipt was lost after input was written");
@@ -57768,16 +57911,24 @@ var ClaudeSdkTransport = class {
57768
57911
  entry.reject(error52);
57769
57912
  }
57770
57913
  }
57771
- /** `queued` is Claude's acceptance of this message into the running Session. */
57914
+ /**
57915
+ * `queued` is Claude's acceptance of this message into the running Session. `started` is its
57916
+ * drain into a native turn, folded into the running one or run as the next; a terminal state
57917
+ * without `started` means no native turn takes it over.
57918
+ */
57772
57919
  #observeSteer(message) {
57773
- if (this.#pendingSteers.size === 0 || !isRecord11(message) || message.type !== "command_lifecycle") {
57920
+ if (this.#pendingSteers.size === 0 && this.#steerTakeovers.size === 0 || !isRecord11(message) || message.type !== "command_lifecycle") {
57774
57921
  return;
57775
57922
  }
57776
- if (message.state !== "queued")
57777
- return;
57778
57923
  if (typeof message.command_uuid !== "string" || message.command_uuid.length === 0)
57779
57924
  return;
57780
- this.#acceptSteer(message.command_uuid);
57925
+ if (message.state === "queued") {
57926
+ this.#acceptSteer(message.command_uuid);
57927
+ return;
57928
+ }
57929
+ if (["started", "completed", "cancelled", "discarded", "refused"].includes(String(message.state))) {
57930
+ this.#takeOverSteer(message.command_uuid, message.state === "started");
57931
+ }
57781
57932
  }
57782
57933
  #observeBackgroundTasks(message) {
57783
57934
  if (!isRecord11(message) || message.type !== "system")
@@ -57890,13 +58041,13 @@ var ClaudeSdkTransport = class {
57890
58041
  throw new Error("Claude SDK Query ended unexpectedly");
57891
58042
  } catch (error52) {
57892
58043
  const active = this.#active;
58044
+ if (!this.#closePromise)
58045
+ this.#onFault(error52);
57893
58046
  this.#closeInteractions("all", "cancelled");
57894
58047
  this.#rejectPendingSteers();
57895
58048
  this.#rootToolCalls.clear();
57896
58049
  this.#active = null;
57897
58050
  active?.reject(error52);
57898
- if (!this.#closePromise)
57899
- this.#onFault(error52);
57900
58051
  }
57901
58052
  }
57902
58053
  #spawn(options) {
@@ -58195,7 +58346,7 @@ var ClaudeSubagentLifecycle = class {
58195
58346
  });
58196
58347
  const outcome = cancellationRequested ? { status: "cancelled", reason: "Cancelled by user" } : event.isError ? { status: "failed", error: subagentFailure() } : { status: "succeeded" };
58197
58348
  this.#emit({ type: "item.completed", turnId, snapshot: { item, outcome } });
58198
- return subagent;
58349
+ return { operation: active.item.operation, subagent };
58199
58350
  }
58200
58351
  finalize(turnId, outcome) {
58201
58352
  for (const [callId, active] of this.#delegations) {
@@ -59091,10 +59242,12 @@ var ClaudeHarnessSession = class {
59091
59242
  },
59092
59243
  history: { fork: true, forkAcrossCwd: false, rollbackLastTurn: true },
59093
59244
  subagents: { observe: true, readTranscript: true },
59094
- // Read live: native delivery joins this Turn only while a requested Turn runs a root tool call
59095
- // on a CLI that confirms steers (`msg_lifecycle_v1`). Otherwise the Host stops and restarts.
59245
+ // Read live: native delivery joins this Turn while a root tool call runs, or while a held
59246
+ // Turn's continuation waits on background work, on a CLI that confirms steers
59247
+ // (`msg_lifecycle_v1`). A Turn whose cancellation is in flight must not take more input;
59248
+ // every other case stops and restarts.
59096
59249
  get steer() {
59097
- return session.#transport?.canSteerActiveTurn?.() === true;
59250
+ return session.#transport?.canSteerActiveTurn?.() === true && session.#active?.cancellationRequested !== true;
59098
59251
  }
59099
59252
  }))(this);
59100
59253
  commands;
@@ -59421,6 +59574,7 @@ var ClaudeHarnessSession = class {
59421
59574
  nativeTurnKey,
59422
59575
  nativeTurnRef: null,
59423
59576
  cancellationRequested: false,
59577
+ steersAwaitingNative: /* @__PURE__ */ new Set(),
59424
59578
  usageRequestIds: /* @__PURE__ */ new Set(),
59425
59579
  estimatedInputTokens: 0,
59426
59580
  estimatedOutputTokens: 0,
@@ -59457,9 +59611,13 @@ var ClaudeHarnessSession = class {
59457
59611
  return { ok: true, value: { turnId: command.turnId } };
59458
59612
  }
59459
59613
  async #steer(command) {
59460
- if (!this.#active || this.#active.command.turnId !== command.turnId) {
59614
+ const active = this.#active;
59615
+ if (!active || active.command.turnId !== command.turnId) {
59461
59616
  return { ok: false, error: invalidState("Claude Code steer target is not the active Turn") };
59462
59617
  }
59618
+ if (active.cancellationRequested) {
59619
+ return { ok: false, error: invalidState("Claude Code steer target is being cancelled") };
59620
+ }
59463
59621
  const text2 = command.input.map((input) => input.text).join("\n");
59464
59622
  if (text2.length === 0) {
59465
59623
  return {
@@ -59485,10 +59643,13 @@ var ClaudeHarnessSession = class {
59485
59643
  }
59486
59644
  };
59487
59645
  }
59646
+ const messageId = this.#randomUUID();
59647
+ active.steersAwaitingNative.add(messageId);
59488
59648
  try {
59489
- await transport.steer(text2, this.#randomUUID());
59649
+ await transport.steer(text2, messageId, (started) => this.#takeOverSteer(active, messageId, started));
59490
59650
  } catch (error52) {
59491
59651
  if (error52 instanceof ClaudeSteerMissedTurnError) {
59652
+ this.#takeOverSteer(active, messageId, false);
59492
59653
  return { ok: false, error: invalidState("Claude Code steer missed the active Turn") };
59493
59654
  }
59494
59655
  throw error52;
@@ -59591,6 +59752,7 @@ var ClaudeHarnessSession = class {
59591
59752
  nativeTurnKey,
59592
59753
  nativeTurnRef: null,
59593
59754
  cancellationRequested: false,
59755
+ steersAwaitingNative: /* @__PURE__ */ new Set(),
59594
59756
  usageRequestIds: /* @__PURE__ */ new Set(),
59595
59757
  estimatedInputTokens: 0,
59596
59758
  estimatedOutputTokens: 0,
@@ -59952,7 +60114,7 @@ var ClaudeHarnessSession = class {
59952
60114
  active.cancellationRequested = true;
59953
60115
  const transport = this.#transport;
59954
60116
  const taskIds = this.#backgroundTaskIds(active);
59955
- if (transport && (taskIds.length > 0 || active.held && (active.rootSegmentActive || this.#occupancy.awaitingContinuation))) {
60117
+ if (transport && (taskIds.length > 0 || active.held && (active.rootSegmentActive || this.#occupancy.awaitingContinuation || active.steersAwaitingNative.size > 0))) {
59956
60118
  await this.#cancelBackgroundWork(active, transport, taskIds);
59957
60119
  return { ok: true, value: { cancellationRequested: true } };
59958
60120
  }
@@ -60027,6 +60189,11 @@ var ClaudeHarnessSession = class {
60027
60189
  return;
60028
60190
  if (cancellation.stopping || cancellation.interrupting || active.rootSegmentActive)
60029
60191
  return;
60192
+ if (active.steersAwaitingNative.size > 0) {
60193
+ this.#armCancelEscalation(active);
60194
+ return;
60195
+ }
60196
+ this.#clearCancelEscalation();
60030
60197
  this.#clearCancellationQuiet(cancellation);
60031
60198
  const quiet = setTimeout(() => {
60032
60199
  cancellation.quiet = null;
@@ -60306,10 +60473,7 @@ var ClaudeHarnessSession = class {
60306
60473
  }
60307
60474
  this.#completeAgentItem(active, { status: "succeeded" }, false);
60308
60475
  active.subagents.start(active.command.turnId, event);
60309
- if (event.operation === "send") {
60310
- if (event.nativeSubagentId)
60311
- this.#occupancy.occupyAgent(event.nativeSubagentId);
60312
- } else if (event.background) {
60476
+ if (event.operation === "spawn" && event.background) {
60313
60477
  this.#occupancy.occupySpawn(event.callId, event.nativeSubagentId);
60314
60478
  }
60315
60479
  return;
@@ -60328,7 +60492,13 @@ var ClaudeHarnessSession = class {
60328
60492
  }
60329
60493
  return;
60330
60494
  case "subagent.completed": {
60331
- const subagent = active.subagents.complete(active.command.turnId, event, active.cancellationRequested);
60495
+ const { operation, subagent } = active.subagents.complete(active.command.turnId, event, active.cancellationRequested);
60496
+ if (operation === "send") {
60497
+ if (subagent.status === "running" && subagent.nativeSubagentId) {
60498
+ this.#occupancy.occupyAgent(subagent.nativeSubagentId);
60499
+ }
60500
+ return;
60501
+ }
60332
60502
  if (subagent.status === "running") {
60333
60503
  this.#occupancy.occupySpawn(event.callId, subagent.nativeSubagentId);
60334
60504
  return;
@@ -60640,6 +60810,7 @@ var ClaudeHarnessSession = class {
60640
60810
  const active = {
60641
60811
  command: { type: "turn.start", turnId, input: [] },
60642
60812
  compactionItem: null,
60813
+ steersAwaitingNative: /* @__PURE__ */ new Set(),
60643
60814
  item,
60644
60815
  agentMessageOrdinal: 1,
60645
60816
  assistantMessageId: null,
@@ -61028,7 +61199,7 @@ var ClaudeHarnessSession = class {
61028
61199
  this.#clearContinuationQuiescence();
61029
61200
  const quiescence = setTimeout(() => {
61030
61201
  this.#continuationQuiescence = null;
61031
- if (this.#active !== active || !active.held || active.rootSegmentActive || this.#phase !== "open") {
61202
+ if (this.#active !== active || !active.held || active.rootSegmentActive || active.steersAwaitingNative.size > 0 || this.#phase !== "open") {
61032
61203
  return;
61033
61204
  }
61034
61205
  this.#occupancy.releaseContinuations();
@@ -61049,6 +61220,30 @@ var ClaudeHarnessSession = class {
61049
61220
  active.rootSegmentActive = true;
61050
61221
  this.#clearContinuationQuiescence();
61051
61222
  }
61223
+ /**
61224
+ * A drained steer runs in a native turn whose result still reaches this Turn, folded into the
61225
+ * running Root Segment or as the held Turn's next one. A steer that ends without one releases
61226
+ * its keep-open, so a Turn held only for it settles as if the steer had never been written.
61227
+ */
61228
+ #takeOverSteer(active, messageId, started) {
61229
+ if (!active.steersAwaitingNative.delete(messageId) || this.#active !== active)
61230
+ return;
61231
+ if (started) {
61232
+ this.#handleTurnEvent(active, { type: "segment.started" });
61233
+ return;
61234
+ }
61235
+ if (active.cancellation) {
61236
+ this.#settleCancellation(active);
61237
+ return;
61238
+ }
61239
+ if (!active.held || active.rootSegmentActive || active.steersAwaitingNative.size > 0 || this.#phase !== "open") {
61240
+ return;
61241
+ }
61242
+ if (this.#occupancy.awaitingContinuation)
61243
+ this.#armContinuationQuiescence(active);
61244
+ else if (!this.#occupancy.unsettled)
61245
+ this.#finish(active, { status: "succeeded" });
61246
+ }
61052
61247
  #finish(active, outcome) {
61053
61248
  if (this.#active !== active)
61054
61249
  return;
@@ -61059,7 +61254,7 @@ var ClaudeHarnessSession = class {
61059
61254
  active.cancellation = null;
61060
61255
  }
61061
61256
  this.#clearContinuationQuiescence();
61062
- const hold = outcome.status === "succeeded" && !active.cancellationRequested && this.#occupancy.unsettled;
61257
+ const hold = outcome.status === "succeeded" && !active.cancellationRequested && (this.#occupancy.unsettled || active.steersAwaitingNative.size > 0);
61063
61258
  this.#closeActiveInteractions(active, outcome.status === "succeeded" ? "superseded" : "cancelled", hold);
61064
61259
  const itemOutcome2 = outcome;
61065
61260
  if (active.compactionItem)
@@ -61325,7 +61520,7 @@ var ClaudeCodeAdapter = class {
61325
61520
  error: invalidState("Claude Code Adapter is closing")
61326
61521
  };
61327
61522
  }
61328
- const cwd = path16.resolve(input.cwd ?? process.cwd());
61523
+ const cwd = path15.resolve(input.cwd ?? process.cwd());
61329
61524
  if (!input.refresh) {
61330
61525
  const cached2 = this.#inspectionCache.get(cwd);
61331
61526
  if (cached2)
@@ -61529,7 +61724,7 @@ var ClaudeCodeAdapter = class {
61529
61724
  }
61530
61725
  requestedPermissionModeId = CLAUDE_DEFAULT_PERMISSION_MODE_ID;
61531
61726
  }
61532
- const cwd = path16.resolve(input.cwd);
61727
+ const cwd = path15.resolve(input.cwd);
61533
61728
  if (input.kind === "rollbackLastTurn") {
61534
61729
  for (const source of this.#sessions) {
61535
61730
  const ready = await source.prepareRollback(input.sourceRef.nativeSessionId);
@@ -61689,7 +61884,7 @@ var ClaudeCodeAdapter = class {
61689
61884
  // dist/installation.js
61690
61885
  import { readFile as readFile8, realpath as realpath5 } from "node:fs/promises";
61691
61886
  import { homedir as homedir2 } from "node:os";
61692
- import path17 from "node:path";
61887
+ import path16 from "node:path";
61693
61888
  async function readSettings(file2) {
61694
61889
  const text2 = await readFile8(file2, "utf8").catch((error52) => {
61695
61890
  if (error52.code === "ENOENT")
@@ -61728,9 +61923,9 @@ function createClaudeInstallation(environment, command) {
61728
61923
  };
61729
61924
  }
61730
61925
  const home = environment.HOME ?? environment.USERPROFILE ?? homedir2();
61731
- const config2 = environment.CLAUDE_CONFIG_DIR ? path17.resolve(home, environment.CLAUDE_CONFIG_DIR) : path17.join(home, ".claude");
61732
- const managedFile = process.platform === "darwin" ? "/Library/Application Support/ClaudeCode/managed-settings.json" : process.platform === "win32" ? path17.join(environment.ProgramFiles ?? "C:\\Program Files", "ClaudeCode", "managed-settings.json") : "/etc/claude-code/managed-settings.json";
61733
- const user = await readSettings(path17.join(config2, "settings.json"));
61926
+ const config2 = environment.CLAUDE_CONFIG_DIR ? path16.resolve(home, environment.CLAUDE_CONFIG_DIR) : path16.join(home, ".claude");
61927
+ const managedFile = process.platform === "darwin" ? "/Library/Application Support/ClaudeCode/managed-settings.json" : process.platform === "win32" ? path16.join(environment.ProgramFiles ?? "C:\\Program Files", "ClaudeCode", "managed-settings.json") : "/etc/claude-code/managed-settings.json";
61928
+ const user = await readSettings(path16.join(config2, "settings.json"));
61734
61929
  const managed = await readSettings(managedFile);
61735
61930
  const settings = { ...user, ...managed, env: { ...user.env, ...managed.env } };
61736
61931
  const env = { ...environment, ...settings.env };
@@ -61743,10 +61938,10 @@ function createClaudeInstallation(environment, command) {
61743
61938
  throw new Error("Unknown Claude release channel");
61744
61939
  const latestVersion = installationVersion(await fetchInstallationText(`https://downloads.claude.ai/claude-code-releases/${channel}`));
61745
61940
  const npm = await npmInstallation(executable, ["@anthropic-ai/claude-code"], env);
61746
- const launcher = path17.join(home, ".local", "bin", process.platform === "win32" ? "claude.exe" : "claude");
61941
+ const launcher = path16.join(home, ".local", "bin", process.platform === "win32" ? "claude.exe" : "claude");
61747
61942
  const selected = await realpath5(executable);
61748
- const versions = path17.join(home, ".local", "share", "claude", "versions") + path17.sep;
61749
- const native = path17.resolve(executable) === launcher && (selected.startsWith(versions) || process.platform === "win32" && selected === launcher);
61943
+ const versions = path16.join(home, ".local", "share", "claude", "versions") + path16.sep;
61944
+ const native = path16.resolve(executable) === launcher && (selected.startsWith(versions) || process.platform === "win32" && selected === launcher);
61750
61945
  const blocked = !!env.DISABLE_UPDATES && env.DISABLE_UPDATES !== "0" || !!settings.minimumVersion && newerInstallationVersion(latestVersion, installationVersion(settings.minimumVersion)) || !!settings.requiredMaximumVersion && newerInstallationVersion(installationVersion(settings.requiredMaximumVersion), latestVersion);
61751
61946
  const canUpdate = !blocked && (npm?.canUpdate ?? native);
61752
61947
  update = async () => {
@@ -61777,7 +61972,7 @@ function createClaudeInstallation(environment, command) {
61777
61972
  }
61778
61973
 
61779
61974
  // dist/user-shell-environment.js
61780
- import path18 from "node:path";
61975
+ import path17 from "node:path";
61781
61976
  import { execFile as execFile4 } from "node:child_process";
61782
61977
  var ENVIRONMENT_MARKER = Buffer.from("\0CODEXHOST_USER_SHELL_ENV_V1\0");
61783
61978
  var ENVIRONMENT_COMMAND = "printf '\\0CODEXHOST_USER_SHELL_ENV_V1\\0'; /usr/bin/env -0";
@@ -61820,7 +62015,7 @@ async function withUserShellEnvironment(environment, dependencies) {
61820
62015
  if (platform === "win32" || !environment.HOME)
61821
62016
  return environment;
61822
62017
  const shell = environment.SHELL?.trim() || defaultShell(platform);
61823
- if (!shell || !SUPPORTED_SHELLS.has(path18.basename(shell)))
62018
+ if (!shell || !SUPPORTED_SHELLS.has(path17.basename(shell)))
61824
62019
  return environment;
61825
62020
  const cacheKey = `${platform}\0${shell}\0${environment.HOME}`;
61826
62021
  const cached2 = dependencies ? void 0 : shellEnvironmentCache.get(cacheKey);
@@ -61858,6 +62053,7 @@ async function createHarnessAdapter(context) {
61858
62053
  const environment = await withUserShellEnvironment({ ...context.environment });
61859
62054
  if (context.platform === "darwin" && context.managedRemoteHost) {
61860
62055
  return new BrokeredHarnessAdapter({
62056
+ sessionImport: true,
61861
62057
  forwardDelegationEnvironment: true,
61862
62058
  commandCatalog: claudeCommandCatalog,
61863
62059
  liveCommandCatalog: true,