claude-use 11.57.0 → 11.57.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.
package/dist/cli.cjs CHANGED
@@ -24807,6 +24807,24 @@ var init_processRole = __esm({
24807
24807
  }
24808
24808
  });
24809
24809
 
24810
+ // src/blockingSpawn.ts
24811
+ function spawnSyncBlocking(operation, command, args, options) {
24812
+ refuseToBlockInRole(operation);
24813
+ return (0, import_node_child_process2.spawnSync)(command, args, options ?? {});
24814
+ }
24815
+ function execFileSyncBlocking(operation, file2, args, options) {
24816
+ refuseToBlockInRole(operation);
24817
+ return (0, import_node_child_process2.execFileSync)(file2, args, options ?? {});
24818
+ }
24819
+ var import_node_child_process2;
24820
+ var init_blockingSpawn = __esm({
24821
+ "src/blockingSpawn.ts"() {
24822
+ "use strict";
24823
+ import_node_child_process2 = require("node:child_process");
24824
+ init_processRole();
24825
+ }
24826
+ });
24827
+
24810
24828
  // src/versionDiscovery.ts
24811
24829
  function defaultVersionsDir() {
24812
24830
  return import_node_path3.default.join(import_node_os.default.homedir(), ".local", "share", "claude", "versions");
@@ -29459,16 +29477,14 @@ function realIsProcessAlive(pid) {
29459
29477
  }
29460
29478
  }
29461
29479
  function realIsProcessZombie(pid) {
29462
- refuseToBlockInRole("a synchronous process-table read");
29463
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
29480
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
29464
29481
  return result.status === 0 && result.stdout.trim().startsWith("Z");
29465
29482
  }
29466
29483
  function realIsProcessRunning(pid) {
29467
29484
  return realIsProcessAlive(pid) && !realIsProcessZombie(pid);
29468
29485
  }
29469
29486
  function realIsFrontDoorSupervisor(pid) {
29470
- refuseToBlockInRole("a synchronous process-table read");
29471
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
29487
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
29472
29488
  return result.status === 0 && parseFrontDoorSupervisorPids(result.stdout).includes(pid);
29473
29489
  }
29474
29490
  function leadingContinuationBytes(bytes) {
@@ -29516,20 +29532,18 @@ function realReadFileTail(filePath, fromByte, maxBytes) {
29516
29532
  }
29517
29533
  }
29518
29534
  function realProcessCommandLine(pid) {
29519
- refuseToBlockInRole("a synchronous process-table read");
29520
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
29535
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
29521
29536
  return result.status === 0 ? result.stdout.trim() : void 0;
29522
29537
  }
29523
29538
  function realFrontDoorLiveness(pids) {
29524
- refuseToBlockInRole("a synchronous process-table read");
29525
29539
  return frontDoorLivenessOf(pids, (asked) => {
29526
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
29540
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
29527
29541
  return { status: result.status, stdout: result.stdout, stderr: result.stderr, ...result.error === void 0 ? {} : { error: result.error } };
29528
29542
  });
29529
29543
  }
29530
29544
  async function readProcessStates(pids) {
29531
29545
  return await new Promise((resolve2) => {
29532
- (0, import_node_child_process2.execFile)("ps", ["-o", "pid=,stat=", "-p", pids.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS }, (_error, stdout2) => {
29546
+ (0, import_node_child_process3.execFile)("ps", ["-o", "pid=,stat=", "-p", pids.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS }, (_error, stdout2) => {
29533
29547
  const states = /* @__PURE__ */ new Map();
29534
29548
  for (const line of stdout2.split("\n")) {
29535
29549
  const [pidText, stat] = line.trim().split(/\s+/);
@@ -29549,12 +29563,19 @@ async function realRunningAmong(pids) {
29549
29563
  const states = await readProcessStates(existing);
29550
29564
  return new Set(existing.filter((pid) => states.get(pid)?.startsWith("Z") !== true));
29551
29565
  }
29566
+ async function realRunAsync(command, args) {
29567
+ return await new Promise((resolve2) => {
29568
+ (0, import_node_child_process3.execFile)(command, [...args], { encoding: "utf8", timeout: PS_TIMEOUT_MS }, (error63, stdout2, stderr) => {
29569
+ resolve2({ status: error63 === null ? 0 : typeof error63.code === "number" ? error63.code : null, stdout: stdout2, stderr });
29570
+ });
29571
+ });
29572
+ }
29552
29573
  function expandHome(filePath) {
29553
29574
  return filePath.startsWith("~/") ? import_node_path9.default.join(import_node_os2.default.homedir(), filePath.slice(1)) : filePath;
29554
29575
  }
29555
29576
  function hasDesktopSession() {
29556
29577
  if (process.platform === "darwin") {
29557
- const result = (0, import_node_child_process2.spawnSync)("launchctl", ["managername"], { encoding: "utf8" });
29578
+ const result = spawnSyncBlocking("a desktop-session check", "launchctl", ["managername"], { encoding: "utf8" });
29558
29579
  return result.status === 0 && result.stdout.trim() === MACOS_GUI_SESSION_MANAGER;
29559
29580
  }
29560
29581
  return hasDisplayServer();
@@ -29570,7 +29591,7 @@ async function hasDesktopSessionAsync() {
29570
29591
  return hasDisplayServer();
29571
29592
  }
29572
29593
  return await new Promise((resolve2) => {
29573
- (0, import_node_child_process2.execFile)("launchctl", ["managername"], { encoding: "utf8" }, (error63, stdout2) => {
29594
+ (0, import_node_child_process3.execFile)("launchctl", ["managername"], { encoding: "utf8" }, (error63, stdout2) => {
29574
29595
  resolve2(error63 === null && stdout2.trim() === MACOS_GUI_SESSION_MANAGER);
29575
29596
  });
29576
29597
  });
@@ -29578,7 +29599,7 @@ async function hasDesktopSessionAsync() {
29578
29599
  async function runCredentialCommand(argv, options) {
29579
29600
  const [command, ...args] = argv;
29580
29601
  return await new Promise((resolve2) => {
29581
- const child = (0, import_node_child_process2.spawn)(command, args, { stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"] });
29602
+ const child = (0, import_node_child_process3.spawn)(command, args, { stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"] });
29582
29603
  let stdout2 = "";
29583
29604
  let stderr = "";
29584
29605
  let timedOut = false;
@@ -29637,7 +29658,7 @@ function selfInvocation(args) {
29637
29658
  }
29638
29659
  function spawnSelfDetached(paths, args) {
29639
29660
  const invocation = selfInvocation(args);
29640
- const child = (0, import_node_child_process2.spawn)(invocation.command, [...invocation.args], { detached: true, stdio: "ignore", env: { ...process.env, AGENT_SHIM_HOME: paths.root } });
29661
+ const child = (0, import_node_child_process3.spawn)(invocation.command, [...invocation.args], { detached: true, stdio: "ignore", env: { ...process.env, AGENT_SHIM_HOME: paths.root } });
29641
29662
  child.unref();
29642
29663
  }
29643
29664
  function detachedDaemonSpawnOptions(logFd, env) {
@@ -29656,7 +29677,7 @@ function spawnDetachedDaemon(invocation, paths, subcommand, logPath) {
29656
29677
  import_node_fs3.default.mkdirSync(import_node_path9.default.dirname(logPath), { recursive: true });
29657
29678
  const logFd = import_node_fs3.default.openSync(logPath, "a");
29658
29679
  try {
29659
- const child = (0, import_node_child_process2.spawn)(invocation.command, invocation.args, detachedDaemonSpawnOptions(logFd, { ...process.env, AGENT_SHIM_HOME: paths.root }));
29680
+ const child = (0, import_node_child_process3.spawn)(invocation.command, invocation.args, detachedDaemonSpawnOptions(logFd, { ...process.env, AGENT_SHIM_HOME: paths.root }));
29660
29681
  child.unref();
29661
29682
  if (child.pid === void 0) {
29662
29683
  throw new Error(`spawning ${subcommand} returned no pid`);
@@ -29806,12 +29827,13 @@ function realResolveClaudeBinary(isOwnBinary) {
29806
29827
  function realInstalledClaudeVersions() {
29807
29828
  return installedVersions(listVersionsDir(defaultVersionsDir()));
29808
29829
  }
29809
- var import_node_child_process2, import_node_crypto4, import_node_fs3, import_node_os2, import_node_path9, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, KEY_POLL_MS, CTRL_C_BYTE, realHoldPort, LINE_FEED, UTF8_CONTINUATION_MASK, UTF8_CONTINUATION_BITS, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, realAsyncCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
29830
+ var import_node_child_process3, import_node_crypto4, import_node_fs3, import_node_os2, import_node_path9, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, KEY_POLL_MS, CTRL_C_BYTE, realHoldPort, LINE_FEED, UTF8_CONTINUATION_MASK, UTF8_CONTINUATION_BITS, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, realAsyncCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
29810
29831
  var init_realPorts = __esm({
29811
29832
  "src/realPorts.ts"() {
29812
29833
  "use strict";
29834
+ init_blockingSpawn();
29813
29835
  init_processRole();
29814
- import_node_child_process2 = require("node:child_process");
29836
+ import_node_child_process3 = require("node:child_process");
29815
29837
  import_node_crypto4 = require("node:crypto");
29816
29838
  import_node_fs3 = __toESM(require("node:fs"), 1);
29817
29839
  import_node_os2 = __toESM(require("node:os"), 1);
@@ -29986,7 +30008,7 @@ var init_realPorts = __esm({
29986
30008
  PS_TIMEOUT_MS = 2e3;
29987
30009
  realRunPort = {
29988
30010
  run(command, args) {
29989
- const result = (0, import_node_child_process2.spawnSync)(command, [...args], { encoding: "utf8" });
30011
+ const result = spawnSyncBlocking("an external command", command, args, { encoding: "utf8" });
29990
30012
  return { status: result.status, stdout: result.stdout, stderr: result.stderr };
29991
30013
  }
29992
30014
  };
@@ -30009,7 +30031,7 @@ var init_realPorts = __esm({
30009
30031
  },
30010
30032
  runCommand(argv, options) {
30011
30033
  const [command, ...args] = argv;
30012
- const result = (0, import_node_child_process2.spawnSync)(command, args, {
30034
+ const result = spawnSyncBlocking("a credential command", command, args, {
30013
30035
  encoding: "utf8",
30014
30036
  timeout: options.timeoutMs,
30015
30037
  stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"]
@@ -30053,7 +30075,7 @@ var init_realPorts = __esm({
30053
30075
  };
30054
30076
  realSpawnPort = {
30055
30077
  spawnSync(command, args, options) {
30056
- const result = (0, import_node_child_process2.spawnSync)(command, args, options);
30078
+ const result = spawnSyncBlocking("a spawned program", command, args, options);
30057
30079
  return { status: result.status, signal: result.signal, ...result.error === void 0 ? {} : { error: result.error } };
30058
30080
  }
30059
30081
  };
@@ -36782,7 +36804,7 @@ var init_package = __esm({
36782
36804
  "package.json"() {
36783
36805
  package_default = {
36784
36806
  name: "claude-use",
36785
- version: "11.57.0",
36807
+ version: "11.57.1",
36786
36808
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
36787
36809
  license: "MIT",
36788
36810
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -38217,12 +38239,12 @@ function requireKeychain() {
38217
38239
  }
38218
38240
  }
38219
38241
  function security(args, stdin2) {
38220
- const result = (0, import_node_child_process3.spawnSync)("security", args, { encoding: "utf8", ...stdin2 === void 0 ? {} : { input: stdin2 }, stdio: ["pipe", "pipe", "ignore"] });
38242
+ const result = spawnSyncBlocking("a keychain call", "security", args, { encoding: "utf8", ...stdin2 === void 0 ? {} : { input: stdin2 }, stdio: ["pipe", "pipe", "ignore"] });
38221
38243
  return { status: result.status, stdout: result.stdout };
38222
38244
  }
38223
38245
  async function securityAsync(args, stdin2) {
38224
38246
  return await new Promise((resolve2) => {
38225
- const child = (0, import_node_child_process3.spawn)("security", args, { stdio: ["pipe", "pipe", "ignore"] });
38247
+ const child = (0, import_node_child_process4.spawn)("security", args, { stdio: ["pipe", "pipe", "ignore"] });
38226
38248
  let stdout2 = "";
38227
38249
  let settled = false;
38228
38250
  const settle2 = (status) => {
@@ -38332,13 +38354,14 @@ function createAsyncRealCredentialCache(root) {
38332
38354
  function realAsyncCredentialCacheEnv(paths) {
38333
38355
  return { port: createAsyncRealCredentialCache(paths.root), platform: process.platform, now: () => Date.now() };
38334
38356
  }
38335
- var import_node_child_process3, import_node_fs9, import_node_path29, KEYCHAIN_CACHE_SERVICE, CACHE_DIR_MODE, CACHE_FILE_MODE;
38357
+ var import_node_child_process4, import_node_fs9, import_node_path29, KEYCHAIN_CACHE_SERVICE, CACHE_DIR_MODE, CACHE_FILE_MODE;
38336
38358
  var init_realCredentialCache = __esm({
38337
38359
  "src/realCredentialCache.ts"() {
38338
38360
  "use strict";
38339
- import_node_child_process3 = require("node:child_process");
38361
+ import_node_child_process4 = require("node:child_process");
38340
38362
  import_node_fs9 = __toESM(require("node:fs"), 1);
38341
38363
  import_node_path29 = __toESM(require("node:path"), 1);
38364
+ init_blockingSpawn();
38342
38365
  init_credentialCache();
38343
38366
  KEYCHAIN_CACHE_SERVICE = "agent-shim-credential-cache";
38344
38367
  CACHE_DIR_MODE = 448;
@@ -68956,14 +68979,57 @@ var init_launcher = __esm({
68956
68979
  }
68957
68980
  });
68958
68981
 
68982
+ // src/replayRun.ts
68983
+ function keyOf2(command, args) {
68984
+ return JSON.stringify([command, args]);
68985
+ }
68986
+ async function resolveWithAsyncRuns(decide, runAsync2) {
68987
+ const answers = /* @__PURE__ */ new Map();
68988
+ const replay = {
68989
+ run: (command, args) => {
68990
+ const answer = answers.get(keyOf2(command, args));
68991
+ if (answer === void 0) {
68992
+ throw new RunNeededError(command, args);
68993
+ }
68994
+ return answer;
68995
+ }
68996
+ };
68997
+ for (; ; ) {
68998
+ try {
68999
+ return decide(replay);
69000
+ } catch (error63) {
69001
+ if (!(error63 instanceof RunNeededError)) {
69002
+ throw error63;
69003
+ }
69004
+ answers.set(keyOf2(error63.command, error63.args), await runAsync2(error63.command, error63.args));
69005
+ }
69006
+ }
69007
+ }
69008
+ var RunNeededError;
69009
+ var init_replayRun = __esm({
69010
+ "src/replayRun.ts"() {
69011
+ "use strict";
69012
+ RunNeededError = class extends Error {
69013
+ constructor(command, args) {
69014
+ super(`no recorded answer for ${command} ${args.join(" ")}`);
69015
+ this.command = command;
69016
+ this.args = args;
69017
+ this.name = "RunNeededError";
69018
+ }
69019
+ command;
69020
+ args;
69021
+ };
69022
+ }
69023
+ });
69024
+
68959
69025
  // src/launchWiring.ts
68960
- function buildFarmRuntime(paths, cwd) {
69026
+ function buildFarmRuntime(paths, cwd, run = realRunPort) {
68961
69027
  const home = import_node_os9.default.homedir();
68962
69028
  const read = cosmiconfigReader();
68963
69029
  const classification = loadClassification(paths);
68964
69030
  const loaded = loadCascadeInput({ paths, home, cwd, read });
68965
69031
  const selections = readDirectorySelections(loaded);
68966
- const git = resolveGitBranch(realRunPort, cwd);
69032
+ const git = resolveGitBranch(run, cwd);
68967
69033
  const updateMode = resolveUpdateMode(loaded.globalConfig);
68968
69034
  return {
68969
69035
  runtime: {
@@ -69010,7 +69076,7 @@ function realPrepareLaunchParams(paths, options) {
69010
69076
  frontdoor: realFrontDoorPort(paths, options.spawnDaemon),
69011
69077
  credentials: { ...realCredentialPort, cache: realCredentialCacheEnv(paths) },
69012
69078
  hold: realHoldPort,
69013
- hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: import_node_path46.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
69079
+ hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: options.run ?? realRunPort }, { farmRoot: import_node_path46.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
69014
69080
  ...farm.directoryIdentity === void 0 ? {} : { directoryPinnedIdentity: farm.directoryIdentity },
69015
69081
  ...farm.directoryConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: farm.directoryConfigProfile },
69016
69082
  ...farm.globalDefaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: farm.globalDefaultConfigProfile },
@@ -69022,7 +69088,7 @@ function realPrepareLaunchParams(paths, options) {
69022
69088
  function daemonSpawnerFor(agentShim) {
69023
69089
  return agentShim === void 0 ? (spawnPaths, subcommand, logPath) => spawnDaemonThroughScript(agentShimCliPath())(spawnPaths, subcommand, logPath) : spawnDaemonThrough(agentShim);
69024
69090
  }
69025
- function resolveClaudeLaunch(options) {
69091
+ function resolveClaudeLaunch(options, run = realRunPort) {
69026
69092
  const paths = options.paths ?? resolveLayoutPaths();
69027
69093
  const refusals = [];
69028
69094
  const warnings = [];
@@ -69046,7 +69112,10 @@ function resolveClaudeLaunch(options) {
69046
69112
  const spawnDaemon = () => {
69047
69113
  throw new Error("resolving a launch starts no daemon");
69048
69114
  };
69049
- return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) })), warnings };
69115
+ return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, run, farm: buildFarmRuntime(paths, options.cwd, run) })), warnings };
69116
+ }
69117
+ async function resolveClaudeLaunchAsync(options, runAsync2 = realRunAsync) {
69118
+ return await resolveWithAsyncRuns((run) => resolveClaudeLaunch(options, run), runAsync2);
69050
69119
  }
69051
69120
  var import_node_os9, import_node_path46, import_node_crypto21, LaunchRefusedError;
69052
69121
  var init_launchWiring = __esm({
@@ -69065,6 +69134,7 @@ var init_launchWiring = __esm({
69065
69134
  init_launcher();
69066
69135
  init_launchHook();
69067
69136
  init_cascade();
69137
+ init_replayRun();
69068
69138
  init_paths();
69069
69139
  init_signIn();
69070
69140
  init_realPorts();
@@ -117340,7 +117410,7 @@ async function runSiwcLogout(ports) {
117340
117410
  }
117341
117411
 
117342
117412
  // src/codex/siwcPorts.ts
117343
- var import_node_child_process4 = require("node:child_process");
117413
+ var import_node_child_process5 = require("node:child_process");
117344
117414
  var import_node_crypto11 = require("node:crypto");
117345
117415
  var import_node_http = __toESM(require("node:http"), 1);
117346
117416
 
@@ -117406,7 +117476,7 @@ async function listenForCallback(port, state) {
117406
117476
  }
117407
117477
  function openInBrowser(url2) {
117408
117478
  const command = process.platform === "darwin" ? { file: "open", args: [url2] } : process.platform === "win32" ? { file: "cmd", args: ["/c", "start", "", url2] } : { file: "xdg-open", args: [url2] };
117409
- (0, import_node_child_process4.spawn)(command.file, command.args, { detached: true, stdio: "ignore" }).unref();
117479
+ (0, import_node_child_process5.spawn)(command.file, command.args, { detached: true, stdio: "ignore" }).unref();
117410
117480
  }
117411
117481
 
117412
117482
  // src/codex/siwcStore.ts
@@ -118754,14 +118824,14 @@ init_poolPick();
118754
118824
  init_realAnthropicUsageProbe();
118755
118825
 
118756
118826
  // src/usage/childRun.ts
118757
- var import_node_child_process5 = require("node:child_process");
118827
+ var import_node_child_process6 = require("node:child_process");
118758
118828
  init_realPorts();
118759
118829
  var CHILD_GRACE_MS = 3e4;
118760
118830
  var STDERR_TAIL_CHARS = 2e3;
118761
118831
  async function runChild(options) {
118762
118832
  const invocation = (options.invocation ?? selfInvocation)(options.args);
118763
118833
  await new Promise((resolve2, reject) => {
118764
- const child = (0, import_node_child_process5.spawn)(invocation.command, [...invocation.args], { stdio: ["ignore", "ignore", "pipe"], env: { ...process.env, AGENT_SHIM_HOME: options.paths.root } });
118834
+ const child = (0, import_node_child_process6.spawn)(invocation.command, [...invocation.args], { stdio: ["ignore", "ignore", "pipe"], env: { ...process.env, AGENT_SHIM_HOME: options.paths.root } });
118765
118835
  let stderr = "";
118766
118836
  child.stderr.on("data", (chunk2) => {
118767
118837
  stderr = `${stderr}${chunk2.toString()}`.slice(-STDERR_TAIL_CHARS);
@@ -130973,9 +131043,9 @@ function createLaunchApiRouter(deps) {
130973
131043
  // A POST because the launch's environment and arguments are a body, but the answer changes nothing.
130974
131044
  spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
130975
131045
  })
130976
- ).input(LaunchResolveInputSchema).output(LaunchResolveOutputSchema).handler(({ input: input2 }) => {
131046
+ ).input(LaunchResolveInputSchema).output(LaunchResolveOutputSchema).handler(async ({ input: input2 }) => {
130977
131047
  try {
130978
- const { resolution, warnings } = deps.resolveLaunch({ path: input2.path, argv: input2.argv ?? [], env: input2.env ?? {} });
131048
+ const { resolution, warnings } = await deps.resolveLaunch({ path: input2.path, argv: input2.argv ?? [], env: input2.env ?? {} });
130979
131049
  return { ...resolution, warnings };
130980
131050
  } catch (error63) {
130981
131051
  if (error63 instanceof CliError) {
@@ -132767,7 +132837,7 @@ init_translate();
132767
132837
  init_cloudUpstream();
132768
132838
 
132769
132839
  // src/antigravity/localUpstream.ts
132770
- var import_node_child_process6 = require("node:child_process");
132840
+ var import_node_child_process7 = require("node:child_process");
132771
132841
  var import_node_net2 = __toESM(require("node:net"), 1);
132772
132842
  var import_node_readline2 = __toESM(require("node:readline"), 1);
132773
132843
  init_zod();
@@ -132792,7 +132862,7 @@ function spawnProcess(command, signal) {
132792
132862
  throw new Error("ACP command cannot be empty");
132793
132863
  }
132794
132864
  const args = command.slice(1);
132795
- const proc = (0, import_node_child_process6.spawn)(bin, args, {
132865
+ const proc = (0, import_node_child_process7.spawn)(bin, args, {
132796
132866
  stdio: ["pipe", "pipe", "inherit"],
132797
132867
  signal
132798
132868
  });
@@ -137133,7 +137203,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, retire, trackTun
137133
137203
  },
137134
137204
  poolNames: () => Object.keys(readPools(paths)).sort(),
137135
137205
  // A read-only resolution of what a launch from one directory would do: the launcher's own decision with its effects left out, so a read never recovers or resyncs a farm, starts a daemon, records a pool pick or runs a credential command.
137136
- resolveLaunch: (request7) => resolveClaudeLaunch({ argv: request7.argv, cwd: request7.path, env: request7.env, paths }),
137206
+ resolveLaunch: async (request7) => resolveClaudeLaunchAsync({ argv: request7.argv, cwd: request7.path, env: request7.env, paths }),
137137
137207
  // The identities are read per call, like the pool table, so an identity added after the door started is listed the moment the CLI would see it.
137138
137208
  sessionList: (filters) => collectSessionList(realSessionFs, paths.identitiesDir, listIdentities(paths).map((entry) => entry.name), { ...filters.identity === void 0 ? {} : { identity: filters.identity }, ...filters.all === void 0 ? {} : { all: filters.all } }),
137139
137209
  liveTasks: () => rcTracker.liveTasksOf(),
@@ -137827,7 +137897,7 @@ function viewOf(payload) {
137827
137897
  }
137828
137898
 
137829
137899
  // src/statusline/ports.ts
137830
- var import_node_child_process7 = require("node:child_process");
137900
+ init_blockingSpawn();
137831
137901
  var import_node_fs22 = __toESM(require("node:fs"), 1);
137832
137902
  var import_node_os12 = __toESM(require("node:os"), 1);
137833
137903
  var import_node_path56 = __toESM(require("node:path"), 1);
@@ -137872,7 +137942,7 @@ var RUN_TIMEOUT_MS = 2e3;
137872
137942
  var RUN_MAX_BUFFER_BYTES = 1048576;
137873
137943
  function runProgram(file2, args, cwd) {
137874
137944
  try {
137875
- return (0, import_node_child_process7.execFileSync)(file2, [...args], { cwd, encoding: "utf8", timeout: RUN_TIMEOUT_MS, maxBuffer: RUN_MAX_BUFFER_BYTES, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
137945
+ return execFileSyncBlocking("a statusline command", file2, args, { cwd, encoding: "utf8", timeout: RUN_TIMEOUT_MS, maxBuffer: RUN_MAX_BUFFER_BYTES, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
137876
137946
  } catch {
137877
137947
  return void 0;
137878
137948
  }
@@ -149714,7 +149784,6 @@ function registerCompletionCommand(program2) {
149714
149784
  }
149715
149785
 
149716
149786
  // src/credentialCommand.ts
149717
- var import_node_child_process9 = require("node:child_process");
149718
149787
  init_commandDeps();
149719
149788
  init_cliError();
149720
149789
  init_schema();
@@ -149754,6 +149823,7 @@ function storeIdentityToken(paths, identityName, raw) {
149754
149823
  init_providersStore();
149755
149824
  init_realPorts();
149756
149825
  init_realCredentialCache();
149826
+ init_blockingSpawn();
149757
149827
  async function readStandardInput() {
149758
149828
  const chunks = [];
149759
149829
  for await (const chunk2 of process.stdin) {
@@ -149775,7 +149845,7 @@ function realCommandPorts(deps) {
149775
149845
  cache: createRealCredentialCache(deps.paths.root),
149776
149846
  platform: process.platform,
149777
149847
  now: () => Date.now(),
149778
- ssh: (host, remoteCommand, input2) => (0, import_node_child_process9.spawnSync)("ssh", ["--", host, remoteCommand], { input: input2, stdio: ["pipe", "inherit", "inherit"] }).status
149848
+ ssh: (host, remoteCommand, input2) => spawnSyncBlocking("an ssh run", "ssh", ["--", host, remoteCommand], { input: input2, stdio: ["pipe", "inherit", "inherit"] }).status
149779
149849
  };
149780
149850
  }
149781
149851
  var REMOTE_ROOT_SCRIPT = 'root="${AGENT_SHIM_HOME:-${CLAUDE_USE_HOME:-}}"; if [ -z "$root" ]; then if [ ! -d "$HOME/.agent-shim" ] && [ -d "$HOME/.claude-use" ]; then root="$HOME/.claude-use"; else root="$HOME/.agent-shim"; fi; fi';
@@ -149915,7 +149985,7 @@ function registerDoctorCommand(program2, deps) {
149915
149985
  var import_node_fs25 = __toESM(require("node:fs"), 1);
149916
149986
  var import_node_http5 = __toESM(require("node:http"), 1);
149917
149987
  var import_node_path64 = __toESM(require("node:path"), 1);
149918
- var import_node_child_process10 = require("node:child_process");
149988
+ var import_node_child_process9 = require("node:child_process");
149919
149989
  init_commandDeps();
149920
149990
  init_configProfilesStore();
149921
149991
  init_realFrontDoorPort();
@@ -149971,6 +150041,7 @@ function registerHeadroomRoutingCommands(headroom, deps) {
149971
150041
  init_settings();
149972
150042
  init_source();
149973
150043
  init_realPorts();
150044
+ init_blockingSpawn();
149974
150045
  init_earlierRelease();
149975
150046
  init_state2();
149976
150047
  init_socket();
@@ -150100,7 +150171,7 @@ async function readyOverSocket(socketPath) {
150100
150171
  }
150101
150172
  var HEADROOM_TOOL_NAME = "headroom-ai";
150102
150173
  function readInstalledHeadroomCommit() {
150103
- const toolDir = (0, import_node_child_process10.spawnSync)("uv", ["tool", "dir"], { encoding: "utf8" });
150174
+ const toolDir = spawnSyncBlocking("a headroom tool lookup", "uv", ["tool", "dir"], { encoding: "utf8" });
150104
150175
  if (toolDir.status !== 0) {
150105
150176
  return void 0;
150106
150177
  }
@@ -150144,7 +150215,7 @@ function realSupervisorPorts(paths) {
150144
150215
  }
150145
150216
  const logFd = import_node_fs25.default.openSync(paths.headroomLogPath, "a");
150146
150217
  try {
150147
- const child = (0, import_node_child_process10.spawn)("headroom", headroomProxyArgs(socketPath, allowlistFile, settings2), {
150218
+ const child = (0, import_node_child_process9.spawn)("headroom", headroomProxyArgs(socketPath, allowlistFile, settings2), {
150148
150219
  detached: true,
150149
150220
  stdio: ["ignore", logFd, logFd],
150150
150221
  env: headroomSpawnEnv(process.env, settings2, trust?.path)
@@ -150184,7 +150255,7 @@ function realSupervisorPorts(paths) {
150184
150255
  },
150185
150256
  ready: readyOverSocket,
150186
150257
  install: (spec) => {
150187
- const result = (0, import_node_child_process10.spawnSync)("uv", ["tool", "install", spec], { encoding: "utf8", timeout: HEADROOM_INSTALL_TIMEOUT_MS });
150258
+ const result = spawnSyncBlocking("a headroom install", "uv", ["tool", "install", spec], { encoding: "utf8", timeout: HEADROOM_INSTALL_TIMEOUT_MS });
150188
150259
  if (result.error !== void 0) {
150189
150260
  const timedOut = "code" in result.error && result.error.code === "ETIMEDOUT";
150190
150261
  return {
@@ -150201,7 +150272,7 @@ function realSupervisorPorts(paths) {
150201
150272
  return result.status === 0 ? { ok: true } : { ok: false, error: `uv tool install exited ${String(result.status)}` };
150202
150273
  },
150203
150274
  headroomVersion: () => {
150204
- const result = (0, import_node_child_process10.spawnSync)("headroom", ["--version"], { encoding: "utf8" });
150275
+ const result = spawnSyncBlocking("a headroom version check", "headroom", ["--version"], { encoding: "utf8" });
150205
150276
  return result.status === 0 ? result.stdout.trim() : void 0;
150206
150277
  },
150207
150278
  installedCommit: readInstalledHeadroomCommit,
@@ -152318,12 +152389,13 @@ function createIdentityMover(deps) {
152318
152389
  }
152319
152390
 
152320
152391
  // src/supervise/realPorts.ts
152321
- var import_node_child_process11 = require("node:child_process");
152392
+ var import_node_child_process10 = require("node:child_process");
152322
152393
  var import_node_fs28 = __toESM(require("node:fs"), 1);
152323
152394
  init_realPorts();
152395
+ init_blockingSpawn();
152324
152396
  var realSupervisedSpawnPort = {
152325
152397
  spawn(command, args, options) {
152326
- const child = (0, import_node_child_process11.spawn)(command, [...args], { stdio: options.stdio, env: { ...options.env } });
152398
+ const child = (0, import_node_child_process10.spawn)(command, [...args], { stdio: options.stdio, env: { ...options.env } });
152327
152399
  const exit = new Promise((resolve2) => {
152328
152400
  child.once("error", (error63) => {
152329
152401
  resolve2({ status: null, signal: null, error: error63 });
@@ -152385,7 +152457,7 @@ function resetTerminal() {
152385
152457
  return;
152386
152458
  }
152387
152459
  process.stdout.write(TERMINAL_RESET);
152388
- (0, import_node_child_process11.spawnSync)("stty", ["sane"], { stdio: ["inherit", "ignore", "ignore"] });
152460
+ spawnSyncBlocking("a terminal reset", "stty", ["sane"], { stdio: ["inherit", "ignore", "ignore"] });
152389
152461
  }
152390
152462
 
152391
152463
  // src/supervise/supervise.ts
package/dist/index.cjs CHANGED
@@ -4462,7 +4462,7 @@ var init_package = __esm({
4462
4462
  "package.json"() {
4463
4463
  package_default = {
4464
4464
  name: "claude-use",
4465
- version: "11.57.0",
4465
+ version: "11.57.1",
4466
4466
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
4467
4467
  license: "MIT",
4468
4468
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -4566,6 +4566,20 @@ var init_package = __esm({
4566
4566
  }
4567
4567
  });
4568
4568
 
4569
+ // src/blockingSpawn.ts
4570
+ function spawnSyncBlocking(operation, command, args, options) {
4571
+ refuseToBlockInRole(operation);
4572
+ return (0, import_node_child_process2.spawnSync)(command, args, options ?? {});
4573
+ }
4574
+ var import_node_child_process2;
4575
+ var init_blockingSpawn = __esm({
4576
+ "src/blockingSpawn.ts"() {
4577
+ "use strict";
4578
+ import_node_child_process2 = require("node:child_process");
4579
+ init_processRole();
4580
+ }
4581
+ });
4582
+
4569
4583
  // src/frontdoor/supervisorProcesses.ts
4570
4584
  function parseFrontDoorSupervisorPids(psOutput) {
4571
4585
  const pids = [];
@@ -5717,27 +5731,23 @@ function realIsProcessAlive(pid) {
5717
5731
  }
5718
5732
  }
5719
5733
  function realIsProcessZombie(pid) {
5720
- refuseToBlockInRole("a synchronous process-table read");
5721
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
5734
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
5722
5735
  return result.status === 0 && result.stdout.trim().startsWith("Z");
5723
5736
  }
5724
5737
  function realIsProcessRunning(pid) {
5725
5738
  return realIsProcessAlive(pid) && !realIsProcessZombie(pid);
5726
5739
  }
5727
5740
  function realIsFrontDoorSupervisor(pid) {
5728
- refuseToBlockInRole("a synchronous process-table read");
5729
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
5741
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
5730
5742
  return result.status === 0 && parseFrontDoorSupervisorPids(result.stdout).includes(pid);
5731
5743
  }
5732
5744
  function realProcessCommandLine(pid) {
5733
- refuseToBlockInRole("a synchronous process-table read");
5734
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
5745
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
5735
5746
  return result.status === 0 ? result.stdout.trim() : void 0;
5736
5747
  }
5737
5748
  function realFrontDoorLiveness(pids) {
5738
- refuseToBlockInRole("a synchronous process-table read");
5739
5749
  return frontDoorLivenessOf(pids, (asked) => {
5740
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
5750
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
5741
5751
  return { status: result.status, stdout: result.stdout, stderr: result.stderr, ...result.error === void 0 ? {} : { error: result.error } };
5742
5752
  });
5743
5753
  }
@@ -5746,7 +5756,7 @@ function expandHome2(filePath) {
5746
5756
  }
5747
5757
  function hasDesktopSession() {
5748
5758
  if (process.platform === "darwin") {
5749
- const result = (0, import_node_child_process2.spawnSync)("launchctl", ["managername"], { encoding: "utf8" });
5759
+ const result = spawnSyncBlocking("a desktop-session check", "launchctl", ["managername"], { encoding: "utf8" });
5750
5760
  return result.status === 0 && result.stdout.trim() === MACOS_GUI_SESSION_MANAGER;
5751
5761
  }
5752
5762
  return hasDisplayServer();
@@ -5792,7 +5802,7 @@ function spawnDetachedDaemon(invocation, paths, subcommand, logPath) {
5792
5802
  import_node_fs2.default.mkdirSync(import_node_path14.default.dirname(logPath), { recursive: true });
5793
5803
  const logFd = import_node_fs2.default.openSync(logPath, "a");
5794
5804
  try {
5795
- const child = (0, import_node_child_process2.spawn)(invocation.command, invocation.args, detachedDaemonSpawnOptions(logFd, { ...process.env, AGENT_SHIM_HOME: paths.root }));
5805
+ const child = (0, import_node_child_process3.spawn)(invocation.command, invocation.args, detachedDaemonSpawnOptions(logFd, { ...process.env, AGENT_SHIM_HOME: paths.root }));
5796
5806
  child.unref();
5797
5807
  if (child.pid === void 0) {
5798
5808
  throw new Error(`spawning ${subcommand} returned no pid`);
@@ -5942,12 +5952,13 @@ function realResolveClaudeBinary(isOwnBinary) {
5942
5952
  function realInstalledClaudeVersions() {
5943
5953
  return installedVersions(listVersionsDir(defaultVersionsDir()));
5944
5954
  }
5945
- var import_node_child_process2, import_node_crypto8, import_node_fs2, import_node_os2, import_node_path14, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, KEY_POLL_MS, CTRL_C_BYTE, realHoldPort, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
5955
+ var import_node_child_process3, import_node_crypto8, import_node_fs2, import_node_os2, import_node_path14, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, KEY_POLL_MS, CTRL_C_BYTE, realHoldPort, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
5946
5956
  var init_realPorts = __esm({
5947
5957
  "src/realPorts.ts"() {
5948
5958
  "use strict";
5959
+ init_blockingSpawn();
5949
5960
  init_processRole();
5950
- import_node_child_process2 = require("node:child_process");
5961
+ import_node_child_process3 = require("node:child_process");
5951
5962
  import_node_crypto8 = require("node:crypto");
5952
5963
  import_node_fs2 = __toESM(require("node:fs"), 1);
5953
5964
  import_node_os2 = __toESM(require("node:os"), 1);
@@ -6119,7 +6130,7 @@ var init_realPorts = __esm({
6119
6130
  PS_TIMEOUT_MS = 2e3;
6120
6131
  realRunPort = {
6121
6132
  run(command, args) {
6122
- const result = (0, import_node_child_process2.spawnSync)(command, [...args], { encoding: "utf8" });
6133
+ const result = spawnSyncBlocking("an external command", command, args, { encoding: "utf8" });
6123
6134
  return { status: result.status, stdout: result.stdout, stderr: result.stderr };
6124
6135
  }
6125
6136
  };
@@ -6142,7 +6153,7 @@ var init_realPorts = __esm({
6142
6153
  },
6143
6154
  runCommand(argv, options) {
6144
6155
  const [command, ...args] = argv;
6145
- const result = (0, import_node_child_process2.spawnSync)(command, args, {
6156
+ const result = spawnSyncBlocking("a credential command", command, args, {
6146
6157
  encoding: "utf8",
6147
6158
  timeout: options.timeoutMs,
6148
6159
  stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"]
@@ -6181,7 +6192,7 @@ var init_realPorts = __esm({
6181
6192
  };
6182
6193
  realSpawnPort = {
6183
6194
  spawnSync(command, args, options) {
6184
- const result = (0, import_node_child_process2.spawnSync)(command, args, options);
6195
+ const result = spawnSyncBlocking("a spawned program", command, args, options);
6185
6196
  return { status: result.status, signal: result.signal, ...result.error === void 0 ? {} : { error: result.error } };
6186
6197
  }
6187
6198
  };
@@ -8119,7 +8130,7 @@ function requireKeychain() {
8119
8130
  }
8120
8131
  }
8121
8132
  function security(args, stdin) {
8122
- const result = (0, import_node_child_process3.spawnSync)("security", args, { encoding: "utf8", ...stdin === void 0 ? {} : { input: stdin }, stdio: ["pipe", "pipe", "ignore"] });
8133
+ const result = spawnSyncBlocking("a keychain call", "security", args, { encoding: "utf8", ...stdin === void 0 ? {} : { input: stdin }, stdio: ["pipe", "pipe", "ignore"] });
8123
8134
  return { status: result.status, stdout: result.stdout };
8124
8135
  }
8125
8136
  function createRealCredentialCache(root) {
@@ -8170,13 +8181,13 @@ function createRealCredentialCache(root) {
8170
8181
  function realCredentialCacheEnv(paths) {
8171
8182
  return { port: createRealCredentialCache(paths.root), platform: process.platform, now: () => Date.now() };
8172
8183
  }
8173
- var import_node_child_process3, import_node_fs5, import_node_path24, KEYCHAIN_CACHE_SERVICE, CACHE_DIR_MODE, CACHE_FILE_MODE;
8184
+ var import_node_fs5, import_node_path24, KEYCHAIN_CACHE_SERVICE, CACHE_DIR_MODE, CACHE_FILE_MODE;
8174
8185
  var init_realCredentialCache = __esm({
8175
8186
  "src/realCredentialCache.ts"() {
8176
8187
  "use strict";
8177
- import_node_child_process3 = require("node:child_process");
8178
8188
  import_node_fs5 = __toESM(require("node:fs"), 1);
8179
8189
  import_node_path24 = __toESM(require("node:path"), 1);
8190
+ init_blockingSpawn();
8180
8191
  init_credentialCache();
8181
8192
  KEYCHAIN_CACHE_SERVICE = "agent-shim-credential-cache";
8182
8193
  CACHE_DIR_MODE = 448;
@@ -11543,13 +11554,13 @@ function resolveLaunch(params) {
11543
11554
  environment
11544
11555
  };
11545
11556
  }
11546
- function runLaunchPlan(plan, spawn4) {
11557
+ function runLaunchPlan(plan, spawn3) {
11547
11558
  try {
11548
11559
  if (plan.hold() === "cancelled") {
11549
11560
  return LAUNCH_CANCELLED_EXIT;
11550
11561
  }
11551
11562
  plan.markChildStarted();
11552
- const result = spawn4.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
11563
+ const result = spawn3.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
11553
11564
  if (result.error !== void 0) {
11554
11565
  throw result.error;
11555
11566
  }
@@ -11759,14 +11770,21 @@ var init_realFrontDoorPort = __esm({
11759
11770
  }
11760
11771
  });
11761
11772
 
11773
+ // src/replayRun.ts
11774
+ var init_replayRun = __esm({
11775
+ "src/replayRun.ts"() {
11776
+ "use strict";
11777
+ }
11778
+ });
11779
+
11762
11780
  // src/launchWiring.ts
11763
- function buildFarmRuntime(paths, cwd) {
11781
+ function buildFarmRuntime(paths, cwd, run = realRunPort) {
11764
11782
  const home = import_node_os7.default.homedir();
11765
11783
  const read = cosmiconfigReader();
11766
11784
  const classification = loadClassification(paths);
11767
11785
  const loaded = loadCascadeInput({ paths, home, cwd, read });
11768
11786
  const selections = readDirectorySelections(loaded);
11769
- const git = resolveGitBranch(realRunPort, cwd);
11787
+ const git = resolveGitBranch(run, cwd);
11770
11788
  const updateMode = resolveUpdateMode(loaded.globalConfig);
11771
11789
  return {
11772
11790
  runtime: {
@@ -11813,7 +11831,7 @@ function realPrepareLaunchParams(paths, options) {
11813
11831
  frontdoor: realFrontDoorPort(paths, options.spawnDaemon),
11814
11832
  credentials: { ...realCredentialPort, cache: realCredentialCacheEnv(paths) },
11815
11833
  hold: realHoldPort,
11816
- hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: import_node_path42.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
11834
+ hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: options.run ?? realRunPort }, { farmRoot: import_node_path42.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
11817
11835
  ...farm.directoryIdentity === void 0 ? {} : { directoryPinnedIdentity: farm.directoryIdentity },
11818
11836
  ...farm.directoryConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: farm.directoryConfigProfile },
11819
11837
  ...farm.globalDefaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: farm.globalDefaultConfigProfile },
@@ -11846,7 +11864,7 @@ function prepareClaudeLaunch(options) {
11846
11864
  const spawnDaemon = daemonSpawnerFor(options.agentShim);
11847
11865
  return prepareLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) }));
11848
11866
  }
11849
- function resolveClaudeLaunch(options) {
11867
+ function resolveClaudeLaunch(options, run = realRunPort) {
11850
11868
  const paths = options.paths ?? resolveLayoutPaths();
11851
11869
  const refusals = [];
11852
11870
  const warnings = [];
@@ -11870,7 +11888,7 @@ function resolveClaudeLaunch(options) {
11870
11888
  const spawnDaemon = () => {
11871
11889
  throw new Error("resolving a launch starts no daemon");
11872
11890
  };
11873
- return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) })), warnings };
11891
+ return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, run, farm: buildFarmRuntime(paths, options.cwd, run) })), warnings };
11874
11892
  }
11875
11893
  var import_node_os7, import_node_path42, import_node_crypto13, LaunchRefusedError;
11876
11894
  var init_launchWiring = __esm({
@@ -11889,6 +11907,7 @@ var init_launchWiring = __esm({
11889
11907
  init_launcher();
11890
11908
  init_launchHook();
11891
11909
  init_cascade();
11910
+ init_replayRun();
11892
11911
  init_paths();
11893
11912
  init_signIn();
11894
11913
  init_realPorts();
@@ -18313,9 +18332,9 @@ function createLaunchApiRouter(deps) {
18313
18332
  // A POST because the launch's environment and arguments are a body, but the answer changes nothing.
18314
18333
  spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
18315
18334
  })
18316
- ).input(LaunchResolveInputSchema).output(LaunchResolveOutputSchema).handler(({ input }) => {
18335
+ ).input(LaunchResolveInputSchema).output(LaunchResolveOutputSchema).handler(async ({ input }) => {
18317
18336
  try {
18318
- const { resolution, warnings } = deps.resolveLaunch({ path: input.path, argv: input.argv ?? [], env: input.env ?? {} });
18337
+ const { resolution, warnings } = await deps.resolveLaunch({ path: input.path, argv: input.argv ?? [], env: input.env ?? {} });
18319
18338
  return { ...resolution, warnings };
18320
18339
  } catch (error) {
18321
18340
  if (error instanceof CliError) {
package/dist/index.mjs CHANGED
@@ -4438,7 +4438,7 @@ var init_package = __esm({
4438
4438
  "package.json"() {
4439
4439
  package_default = {
4440
4440
  name: "claude-use",
4441
- version: "11.57.0",
4441
+ version: "11.57.1",
4442
4442
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
4443
4443
  license: "MIT",
4444
4444
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -4542,6 +4542,22 @@ var init_package = __esm({
4542
4542
  }
4543
4543
  });
4544
4544
 
4545
+ // src/blockingSpawn.ts
4546
+ import {
4547
+ execFileSync,
4548
+ spawnSync
4549
+ } from "node:child_process";
4550
+ function spawnSyncBlocking(operation, command, args, options) {
4551
+ refuseToBlockInRole(operation);
4552
+ return spawnSync(command, args, options ?? {});
4553
+ }
4554
+ var init_blockingSpawn = __esm({
4555
+ "src/blockingSpawn.ts"() {
4556
+ "use strict";
4557
+ init_processRole();
4558
+ }
4559
+ });
4560
+
4545
4561
  // src/frontdoor/supervisorProcesses.ts
4546
4562
  function parseFrontDoorSupervisorPids(psOutput) {
4547
4563
  const pids = [];
@@ -5673,7 +5689,7 @@ var init_logStyle = __esm({
5673
5689
  });
5674
5690
 
5675
5691
  // src/realPorts.ts
5676
- import { execFile, spawn as spawn2, spawnSync } from "node:child_process";
5692
+ import { execFile, spawn as spawn2 } from "node:child_process";
5677
5693
  import { createHash as createHash5 } from "node:crypto";
5678
5694
  import fs3 from "node:fs";
5679
5695
  import os3 from "node:os";
@@ -5698,27 +5714,23 @@ function realIsProcessAlive(pid) {
5698
5714
  }
5699
5715
  }
5700
5716
  function realIsProcessZombie(pid) {
5701
- refuseToBlockInRole("a synchronous process-table read");
5702
- const result = spawnSync("ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
5717
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
5703
5718
  return result.status === 0 && result.stdout.trim().startsWith("Z");
5704
5719
  }
5705
5720
  function realIsProcessRunning(pid) {
5706
5721
  return realIsProcessAlive(pid) && !realIsProcessZombie(pid);
5707
5722
  }
5708
5723
  function realIsFrontDoorSupervisor(pid) {
5709
- refuseToBlockInRole("a synchronous process-table read");
5710
- const result = spawnSync("ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
5724
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
5711
5725
  return result.status === 0 && parseFrontDoorSupervisorPids(result.stdout).includes(pid);
5712
5726
  }
5713
5727
  function realProcessCommandLine(pid) {
5714
- refuseToBlockInRole("a synchronous process-table read");
5715
- const result = spawnSync("ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
5728
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
5716
5729
  return result.status === 0 ? result.stdout.trim() : void 0;
5717
5730
  }
5718
5731
  function realFrontDoorLiveness(pids) {
5719
- refuseToBlockInRole("a synchronous process-table read");
5720
5732
  return frontDoorLivenessOf(pids, (asked) => {
5721
- const result = spawnSync("ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
5733
+ const result = spawnSyncBlocking("a process-table read", "ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
5722
5734
  return { status: result.status, stdout: result.stdout, stderr: result.stderr, ...result.error === void 0 ? {} : { error: result.error } };
5723
5735
  });
5724
5736
  }
@@ -5727,7 +5739,7 @@ function expandHome2(filePath) {
5727
5739
  }
5728
5740
  function hasDesktopSession() {
5729
5741
  if (process.platform === "darwin") {
5730
- const result = spawnSync("launchctl", ["managername"], { encoding: "utf8" });
5742
+ const result = spawnSyncBlocking("a desktop-session check", "launchctl", ["managername"], { encoding: "utf8" });
5731
5743
  return result.status === 0 && result.stdout.trim() === MACOS_GUI_SESSION_MANAGER;
5732
5744
  }
5733
5745
  return hasDisplayServer();
@@ -5927,6 +5939,7 @@ var realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, real
5927
5939
  var init_realPorts = __esm({
5928
5940
  "src/realPorts.ts"() {
5929
5941
  "use strict";
5942
+ init_blockingSpawn();
5930
5943
  init_processRole();
5931
5944
  init_load();
5932
5945
  init_versionDiscovery();
@@ -6094,7 +6107,7 @@ var init_realPorts = __esm({
6094
6107
  PS_TIMEOUT_MS = 2e3;
6095
6108
  realRunPort = {
6096
6109
  run(command, args) {
6097
- const result = spawnSync(command, [...args], { encoding: "utf8" });
6110
+ const result = spawnSyncBlocking("an external command", command, args, { encoding: "utf8" });
6098
6111
  return { status: result.status, stdout: result.stdout, stderr: result.stderr };
6099
6112
  }
6100
6113
  };
@@ -6117,7 +6130,7 @@ var init_realPorts = __esm({
6117
6130
  },
6118
6131
  runCommand(argv, options) {
6119
6132
  const [command, ...args] = argv;
6120
- const result = spawnSync(command, args, {
6133
+ const result = spawnSyncBlocking("a credential command", command, args, {
6121
6134
  encoding: "utf8",
6122
6135
  timeout: options.timeoutMs,
6123
6136
  stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"]
@@ -6156,7 +6169,7 @@ var init_realPorts = __esm({
6156
6169
  };
6157
6170
  realSpawnPort = {
6158
6171
  spawnSync(command, args, options) {
6159
- const result = spawnSync(command, args, options);
6172
+ const result = spawnSyncBlocking("a spawned program", command, args, options);
6160
6173
  return { status: result.status, signal: result.signal, ...result.error === void 0 ? {} : { error: result.error } };
6161
6174
  }
6162
6175
  };
@@ -8072,7 +8085,6 @@ var init_credentialCache = __esm({
8072
8085
  });
8073
8086
 
8074
8087
  // src/realCredentialCache.ts
8075
- import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
8076
8088
  import fs6 from "node:fs";
8077
8089
  import path24 from "node:path";
8078
8090
  function cacheFileNameFor(owner) {
@@ -8094,7 +8106,7 @@ function requireKeychain() {
8094
8106
  }
8095
8107
  }
8096
8108
  function security(args, stdin) {
8097
- const result = spawnSync2("security", args, { encoding: "utf8", ...stdin === void 0 ? {} : { input: stdin }, stdio: ["pipe", "pipe", "ignore"] });
8109
+ const result = spawnSyncBlocking("a keychain call", "security", args, { encoding: "utf8", ...stdin === void 0 ? {} : { input: stdin }, stdio: ["pipe", "pipe", "ignore"] });
8098
8110
  return { status: result.status, stdout: result.stdout };
8099
8111
  }
8100
8112
  function createRealCredentialCache(root) {
@@ -8149,6 +8161,7 @@ var KEYCHAIN_CACHE_SERVICE, CACHE_DIR_MODE, CACHE_FILE_MODE;
8149
8161
  var init_realCredentialCache = __esm({
8150
8162
  "src/realCredentialCache.ts"() {
8151
8163
  "use strict";
8164
+ init_blockingSpawn();
8152
8165
  init_credentialCache();
8153
8166
  KEYCHAIN_CACHE_SERVICE = "agent-shim-credential-cache";
8154
8167
  CACHE_DIR_MODE = 448;
@@ -11517,13 +11530,13 @@ function resolveLaunch(params) {
11517
11530
  environment
11518
11531
  };
11519
11532
  }
11520
- function runLaunchPlan(plan, spawn4) {
11533
+ function runLaunchPlan(plan, spawn3) {
11521
11534
  try {
11522
11535
  if (plan.hold() === "cancelled") {
11523
11536
  return LAUNCH_CANCELLED_EXIT;
11524
11537
  }
11525
11538
  plan.markChildStarted();
11526
- const result = spawn4.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
11539
+ const result = spawn3.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
11527
11540
  if (result.error !== void 0) {
11528
11541
  throw result.error;
11529
11542
  }
@@ -11728,17 +11741,24 @@ var init_realFrontDoorPort = __esm({
11728
11741
  }
11729
11742
  });
11730
11743
 
11744
+ // src/replayRun.ts
11745
+ var init_replayRun = __esm({
11746
+ "src/replayRun.ts"() {
11747
+ "use strict";
11748
+ }
11749
+ });
11750
+
11731
11751
  // src/launchWiring.ts
11732
11752
  import os8 from "node:os";
11733
11753
  import path42 from "node:path";
11734
11754
  import { randomUUID as randomUUID5 } from "node:crypto";
11735
- function buildFarmRuntime(paths, cwd) {
11755
+ function buildFarmRuntime(paths, cwd, run = realRunPort) {
11736
11756
  const home = os8.homedir();
11737
11757
  const read = cosmiconfigReader();
11738
11758
  const classification = loadClassification(paths);
11739
11759
  const loaded = loadCascadeInput({ paths, home, cwd, read });
11740
11760
  const selections = readDirectorySelections(loaded);
11741
- const git = resolveGitBranch(realRunPort, cwd);
11761
+ const git = resolveGitBranch(run, cwd);
11742
11762
  const updateMode = resolveUpdateMode(loaded.globalConfig);
11743
11763
  return {
11744
11764
  runtime: {
@@ -11785,7 +11805,7 @@ function realPrepareLaunchParams(paths, options) {
11785
11805
  frontdoor: realFrontDoorPort(paths, options.spawnDaemon),
11786
11806
  credentials: { ...realCredentialPort, cache: realCredentialCacheEnv(paths) },
11787
11807
  hold: realHoldPort,
11788
- hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: path42.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
11808
+ hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: options.run ?? realRunPort }, { farmRoot: path42.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
11789
11809
  ...farm.directoryIdentity === void 0 ? {} : { directoryPinnedIdentity: farm.directoryIdentity },
11790
11810
  ...farm.directoryConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: farm.directoryConfigProfile },
11791
11811
  ...farm.globalDefaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: farm.globalDefaultConfigProfile },
@@ -11818,7 +11838,7 @@ function prepareClaudeLaunch(options) {
11818
11838
  const spawnDaemon = daemonSpawnerFor(options.agentShim);
11819
11839
  return prepareLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) }));
11820
11840
  }
11821
- function resolveClaudeLaunch(options) {
11841
+ function resolveClaudeLaunch(options, run = realRunPort) {
11822
11842
  const paths = options.paths ?? resolveLayoutPaths();
11823
11843
  const refusals = [];
11824
11844
  const warnings = [];
@@ -11842,7 +11862,7 @@ function resolveClaudeLaunch(options) {
11842
11862
  const spawnDaemon = () => {
11843
11863
  throw new Error("resolving a launch starts no daemon");
11844
11864
  };
11845
- return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) })), warnings };
11865
+ return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, run, farm: buildFarmRuntime(paths, options.cwd, run) })), warnings };
11846
11866
  }
11847
11867
  var LaunchRefusedError;
11848
11868
  var init_launchWiring = __esm({
@@ -11858,6 +11878,7 @@ var init_launchWiring = __esm({
11858
11878
  init_launcher();
11859
11879
  init_launchHook();
11860
11880
  init_cascade();
11881
+ init_replayRun();
11861
11882
  init_paths();
11862
11883
  init_signIn();
11863
11884
  init_realPorts();
@@ -17898,9 +17919,9 @@ function createLaunchApiRouter(deps) {
17898
17919
  // A POST because the launch's environment and arguments are a body, but the answer changes nothing.
17899
17920
  spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
17900
17921
  })
17901
- ).input(LaunchResolveInputSchema).output(LaunchResolveOutputSchema).handler(({ input }) => {
17922
+ ).input(LaunchResolveInputSchema).output(LaunchResolveOutputSchema).handler(async ({ input }) => {
17902
17923
  try {
17903
- const { resolution, warnings } = deps.resolveLaunch({ path: input.path, argv: input.argv ?? [], env: input.env ?? {} });
17924
+ const { resolution, warnings } = await deps.resolveLaunch({ path: input.path, argv: input.argv ?? [], env: input.env ?? {} });
17904
17925
  return { ...resolution, warnings };
17905
17926
  } catch (error) {
17906
17927
  if (error instanceof CliError) {
@@ -12091,10 +12091,10 @@ interface LaunchApiDeps {
12091
12091
  readonly path: string;
12092
12092
  readonly argv: readonly string[];
12093
12093
  readonly env: Readonly<Record<string, string>>;
12094
- }) => {
12094
+ }) => Promise<{
12095
12095
  readonly resolution: LaunchResolution;
12096
12096
  readonly warnings: readonly string[];
12097
- };
12097
+ }>;
12098
12098
  }
12099
12099
  /** Builds the launch router: one read, behind the control-token middleware. */
12100
12100
  declare function createLaunchApiRouter(deps: LaunchApiDeps): {
@@ -22812,7 +22812,7 @@ interface ClaudeLaunchResolution {
22812
22812
  *
22813
22813
  * A launch that would be refused throws `LaunchRefusedError` carrying the launcher's own message, exactly as `prepareClaudeLaunch` does.
22814
22814
  */
22815
- declare function resolveClaudeLaunch(options: ResolveClaudeLaunchOptions): ClaudeLaunchResolution;
22815
+ declare function resolveClaudeLaunch(options: ResolveClaudeLaunchOptions, run?: RunPort): ClaudeLaunchResolution;
22816
22816
 
22817
22817
  /** How one refresh ended. */
22818
22818
  type AnthropicRefreshOutcome = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "11.57.0",
3
+ "version": "11.57.1",
4
4
  "description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
5
5
  "license": "MIT",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",