claude-use 11.5.2 → 11.6.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
@@ -24697,6 +24697,35 @@ var init_store = __esm({
24697
24697
  }
24698
24698
  });
24699
24699
 
24700
+ // src/processRole.ts
24701
+ function enterProcessRole(role) {
24702
+ const previous = currentRole;
24703
+ currentRole = role;
24704
+ return () => {
24705
+ currentRole = previous;
24706
+ };
24707
+ }
24708
+ function refuseToBlockInRole(operation) {
24709
+ if (currentRole !== void 0) {
24710
+ throw new BlockingInEventLoopError(operation, currentRole);
24711
+ }
24712
+ }
24713
+ var currentRole, BlockingInEventLoopError;
24714
+ var init_processRole = __esm({
24715
+ "src/processRole.ts"() {
24716
+ "use strict";
24717
+ init_cliError();
24718
+ BlockingInEventLoopError = class extends CliError {
24719
+ constructor(operation, role) {
24720
+ super(
24721
+ `${operation} blocks the calling thread, which in the ${role} is the event loop that answers every session; it must not run there (a launch planned inside the door reaches it through its own addresses, never through the launcher's synchronous coordination)`
24722
+ );
24723
+ this.name = "BlockingInEventLoopError";
24724
+ }
24725
+ };
24726
+ }
24727
+ });
24728
+
24700
24729
  // src/versionDiscovery.ts
24701
24730
  function defaultVersionsDir() {
24702
24731
  return import_node_path3.default.join(import_node_os.default.homedir(), ".local", "share", "claude", "versions");
@@ -28498,6 +28527,7 @@ function isErrorWithCode(error63, code) {
28498
28527
  return typeof error63 === "object" && error63 !== null && "code" in error63 && error63.code === code;
28499
28528
  }
28500
28529
  function realSleepSync(ms2) {
28530
+ refuseToBlockInRole("a synchronous sleep");
28501
28531
  Atomics.wait(new Int32Array(new SharedArrayBuffer(INT32_BYTE_LENGTH)), 0, 0, ms2);
28502
28532
  }
28503
28533
  function realIsProcessAlive(pid) {
@@ -28786,6 +28816,7 @@ var import_node_child_process2, import_node_crypto4, import_node_fs3, import_nod
28786
28816
  var init_realPorts = __esm({
28787
28817
  "src/realPorts.ts"() {
28788
28818
  "use strict";
28819
+ init_processRole();
28789
28820
  import_node_child_process2 = require("node:child_process");
28790
28821
  import_node_crypto4 = require("node:crypto");
28791
28822
  import_node_fs3 = __toESM(require("node:fs"), 1);
@@ -33976,7 +34007,7 @@ var init_package = __esm({
33976
34007
  "package.json"() {
33977
34008
  package_default = {
33978
34009
  name: "claude-use",
33979
- version: "11.5.2",
34010
+ version: "11.6.1",
33980
34011
  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.",
33981
34012
  license: "MIT",
33982
34013
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -61947,6 +61978,7 @@ var init_ensure2 = __esm({
61947
61978
 
61948
61979
  // src/frontdoor/probe.ts
61949
61980
  function probeFrontDoorSync(port, caPem) {
61981
+ refuseToBlockInRole("a synchronous probe of the front door");
61950
61982
  const shared = new SharedArrayBuffer(HEADER_SLOTS * INT32_BYTES + REASON_BYTES);
61951
61983
  const header = new Int32Array(shared, 0, HEADER_SLOTS);
61952
61984
  const worker = new import_node_worker_threads.Worker(PROBE_SOURCE, {
@@ -61973,6 +62005,7 @@ var import_node_worker_threads, PROBE_TIMEOUT_MS, PROBE_WAIT_MARGIN_MS, REASON_B
61973
62005
  var init_probe = __esm({
61974
62006
  "src/frontdoor/probe.ts"() {
61975
62007
  "use strict";
62008
+ init_processRole();
61976
62009
  import_node_worker_threads = require("node:worker_threads");
61977
62010
  PROBE_TIMEOUT_MS = 2e3;
61978
62011
  PROBE_WAIT_MARGIN_MS = 1e3;
@@ -62015,6 +62048,20 @@ request.on("error", (error) => finish(failed, (error.code ? error.code + ": " :
62015
62048
  }
62016
62049
  });
62017
62050
 
62051
+ // src/frontdoor/selfIdentity.ts
62052
+ function declareThisProcessTheFrontDoor() {
62053
+ declaredPid = process.pid;
62054
+ }
62055
+ function isFrontDoorSupervisorPid(pid, identify) {
62056
+ return declaredPid !== void 0 && pid === declaredPid && pid === process.pid || identify(pid);
62057
+ }
62058
+ var declaredPid;
62059
+ var init_selfIdentity = __esm({
62060
+ "src/frontdoor/selfIdentity.ts"() {
62061
+ "use strict";
62062
+ }
62063
+ });
62064
+
62018
62065
  // src/frontdoor/trust.ts
62019
62066
  function resolveTrustBundle(params) {
62020
62067
  const { caCertFile, bundlesDir, variable, inherited, fs: fs23 } = params;
@@ -62061,7 +62108,7 @@ function realEnsurePorts(paths, spawnDaemon) {
62061
62108
  now: () => Date.now(),
62062
62109
  sleep: realSleepSync,
62063
62110
  spawnSupervisor: (layout) => spawnDaemon(layout, "__frontdoor-supervisor", layout.frontdoorLogPath),
62064
- isFrontDoorSupervisor: realIsFrontDoorSupervisor,
62111
+ isFrontDoorSupervisor: (pid) => isFrontDoorSupervisorPid(pid, realIsFrontDoorSupervisor),
62065
62112
  stopSupervisor: (pid) => {
62066
62113
  process.kill(pid, "SIGTERM");
62067
62114
  },
@@ -62102,6 +62149,7 @@ var init_realFrontDoorPort = __esm({
62102
62149
  init_ensure2();
62103
62150
  init_state();
62104
62151
  init_probe();
62152
+ init_selfIdentity();
62105
62153
  init_trust();
62106
62154
  realTrustBundleFs = {
62107
62155
  readFileUtf8: (file2) => import_node_fs13.default.readFileSync(file2, "utf8"),
@@ -114096,6 +114144,7 @@ init_route();
114096
114144
  init_state();
114097
114145
 
114098
114146
  // src/frontdoor/supervisor.ts
114147
+ init_processRole();
114099
114148
  var import_node_path44 = __toESM(require("node:path"), 1);
114100
114149
  init_state();
114101
114150
  function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
@@ -114110,6 +114159,14 @@ var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
114110
114159
  var FRONTDOOR_POLL_MS = 1e3;
114111
114160
  var MS_PER_MINUTE3 = 6e4;
114112
114161
  async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {}) {
114162
+ const leaveRole = enterProcessRole("frontdoor-supervisor");
114163
+ try {
114164
+ return await serveFrontDoor(idleShutdownMinutes, ports, options);
114165
+ } finally {
114166
+ leaveRole();
114167
+ }
114168
+ }
114169
+ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
114113
114170
  const { fs: fs23, paths } = ports;
114114
114171
  const servingBinary = ports.statOwnExecutable();
114115
114172
  const previous = readFrontDoorState(fs23, paths.frontdoorStateFile);
@@ -130992,6 +131049,7 @@ function formatFrontDoorStatus(status, caCertPath) {
130992
131049
 
130993
131050
  // src/frontdoor/commands.ts
130994
131051
  init_state();
131052
+ init_selfIdentity();
130995
131053
  init_account();
130996
131054
  init_middleware();
130997
131055
  init_quotaRefresh();
@@ -131473,6 +131531,7 @@ function registerFrontDoorCommand(program2, deps) {
131473
131531
  process.on("SIGINT", () => {
131474
131532
  deps.exit(0);
131475
131533
  });
131534
+ declareThisProcessTheFrontDoor();
131476
131535
  deps.exit(await runFrontDoorSupervisor(idleShutdownMinutes, realFrontDoorSupervisorPorts(paths)));
131477
131536
  });
131478
131537
  }
package/dist/index.cjs CHANGED
@@ -2752,13 +2752,42 @@ var init_state = __esm({
2752
2752
  }
2753
2753
  });
2754
2754
 
2755
+ // src/processRole.ts
2756
+ function enterProcessRole(role) {
2757
+ const previous = currentRole;
2758
+ currentRole = role;
2759
+ return () => {
2760
+ currentRole = previous;
2761
+ };
2762
+ }
2763
+ function refuseToBlockInRole(operation) {
2764
+ if (currentRole !== void 0) {
2765
+ throw new BlockingInEventLoopError(operation, currentRole);
2766
+ }
2767
+ }
2768
+ var currentRole, BlockingInEventLoopError;
2769
+ var init_processRole = __esm({
2770
+ "src/processRole.ts"() {
2771
+ "use strict";
2772
+ init_cliError();
2773
+ BlockingInEventLoopError = class extends CliError {
2774
+ constructor(operation, role) {
2775
+ super(
2776
+ `${operation} blocks the calling thread, which in the ${role} is the event loop that answers every session; it must not run there (a launch planned inside the door reaches it through its own addresses, never through the launcher's synchronous coordination)`
2777
+ );
2778
+ this.name = "BlockingInEventLoopError";
2779
+ }
2780
+ };
2781
+ }
2782
+ });
2783
+
2755
2784
  // package.json
2756
2785
  var package_default;
2757
2786
  var init_package = __esm({
2758
2787
  "package.json"() {
2759
2788
  package_default = {
2760
2789
  name: "claude-use",
2761
- version: "11.5.2",
2790
+ version: "11.6.1",
2762
2791
  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.",
2763
2792
  license: "MIT",
2764
2793
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -3932,6 +3961,7 @@ function isErrorWithCode(error, code) {
3932
3961
  return typeof error === "object" && error !== null && "code" in error && error.code === code;
3933
3962
  }
3934
3963
  function realSleepSync(ms) {
3964
+ refuseToBlockInRole("a synchronous sleep");
3935
3965
  Atomics.wait(new Int32Array(new SharedArrayBuffer(INT32_BYTE_LENGTH)), 0, 0, ms);
3936
3966
  }
3937
3967
  function realIsProcessAlive(pid) {
@@ -4165,6 +4195,7 @@ var import_node_child_process2, import_node_crypto8, import_node_fs2, import_nod
4165
4195
  var init_realPorts = __esm({
4166
4196
  "src/realPorts.ts"() {
4167
4197
  "use strict";
4198
+ init_processRole();
4168
4199
  import_node_child_process2 = require("node:child_process");
4169
4200
  import_node_crypto8 = require("node:crypto");
4170
4201
  import_node_fs2 = __toESM(require("node:fs"), 1);
@@ -8039,6 +8070,7 @@ var init_ownCli = __esm({
8039
8070
 
8040
8071
  // src/frontdoor/probe.ts
8041
8072
  function probeFrontDoorSync(port, caPem) {
8073
+ refuseToBlockInRole("a synchronous probe of the front door");
8042
8074
  const shared = new SharedArrayBuffer(HEADER_SLOTS * INT32_BYTES + REASON_BYTES);
8043
8075
  const header = new Int32Array(shared, 0, HEADER_SLOTS);
8044
8076
  const worker = new import_node_worker_threads.Worker(PROBE_SOURCE, {
@@ -8065,6 +8097,7 @@ var import_node_worker_threads, PROBE_TIMEOUT_MS, PROBE_WAIT_MARGIN_MS, REASON_B
8065
8097
  var init_probe = __esm({
8066
8098
  "src/frontdoor/probe.ts"() {
8067
8099
  "use strict";
8100
+ init_processRole();
8068
8101
  import_node_worker_threads = require("node:worker_threads");
8069
8102
  PROBE_TIMEOUT_MS = 2e3;
8070
8103
  PROBE_WAIT_MARGIN_MS = 1e3;
@@ -8107,6 +8140,17 @@ request.on("error", (error) => finish(failed, (error.code ? error.code + ": " :
8107
8140
  }
8108
8141
  });
8109
8142
 
8143
+ // src/frontdoor/selfIdentity.ts
8144
+ function isFrontDoorSupervisorPid(pid, identify) {
8145
+ return declaredPid !== void 0 && pid === declaredPid && pid === process.pid || identify(pid);
8146
+ }
8147
+ var declaredPid;
8148
+ var init_selfIdentity = __esm({
8149
+ "src/frontdoor/selfIdentity.ts"() {
8150
+ "use strict";
8151
+ }
8152
+ });
8153
+
8110
8154
  // src/frontdoor/trust.ts
8111
8155
  function resolveTrustBundle(params) {
8112
8156
  const { caCertFile, bundlesDir, variable, inherited, fs: fs12 } = params;
@@ -8153,7 +8197,7 @@ function realEnsurePorts(paths, spawnDaemon) {
8153
8197
  now: () => Date.now(),
8154
8198
  sleep: realSleepSync,
8155
8199
  spawnSupervisor: (layout) => spawnDaemon(layout, "__frontdoor-supervisor", layout.frontdoorLogPath),
8156
- isFrontDoorSupervisor: realIsFrontDoorSupervisor,
8200
+ isFrontDoorSupervisor: (pid) => isFrontDoorSupervisorPid(pid, realIsFrontDoorSupervisor),
8157
8201
  stopSupervisor: (pid) => {
8158
8202
  process.kill(pid, "SIGTERM");
8159
8203
  },
@@ -8191,6 +8235,7 @@ var init_realFrontDoorPort = __esm({
8191
8235
  init_ensure2();
8192
8236
  init_state();
8193
8237
  init_probe();
8238
+ init_selfIdentity();
8194
8239
  init_trust();
8195
8240
  realTrustBundleFs = {
8196
8241
  readFileUtf8: (file) => import_node_fs11.default.readFileSync(file, "utf8"),
@@ -9381,6 +9426,7 @@ init_route();
9381
9426
  init_state();
9382
9427
 
9383
9428
  // src/frontdoor/supervisor.ts
9429
+ init_processRole();
9384
9430
  var import_node_path9 = __toESM(require("node:path"), 1);
9385
9431
  init_state();
9386
9432
  function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
@@ -9395,6 +9441,14 @@ var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
9395
9441
  var FRONTDOOR_POLL_MS = 1e3;
9396
9442
  var MS_PER_MINUTE = 6e4;
9397
9443
  async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {}) {
9444
+ const leaveRole = enterProcessRole("frontdoor-supervisor");
9445
+ try {
9446
+ return await serveFrontDoor(idleShutdownMinutes, ports, options);
9447
+ } finally {
9448
+ leaveRole();
9449
+ }
9450
+ }
9451
+ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
9398
9452
  const { fs: fs12, paths } = ports;
9399
9453
  const servingBinary = ports.statOwnExecutable();
9400
9454
  const previous = readFrontDoorState(fs12, paths.frontdoorStateFile);
package/dist/index.mjs CHANGED
@@ -2728,13 +2728,42 @@ var init_state = __esm({
2728
2728
  }
2729
2729
  });
2730
2730
 
2731
+ // src/processRole.ts
2732
+ function enterProcessRole(role) {
2733
+ const previous = currentRole;
2734
+ currentRole = role;
2735
+ return () => {
2736
+ currentRole = previous;
2737
+ };
2738
+ }
2739
+ function refuseToBlockInRole(operation) {
2740
+ if (currentRole !== void 0) {
2741
+ throw new BlockingInEventLoopError(operation, currentRole);
2742
+ }
2743
+ }
2744
+ var currentRole, BlockingInEventLoopError;
2745
+ var init_processRole = __esm({
2746
+ "src/processRole.ts"() {
2747
+ "use strict";
2748
+ init_cliError();
2749
+ BlockingInEventLoopError = class extends CliError {
2750
+ constructor(operation, role) {
2751
+ super(
2752
+ `${operation} blocks the calling thread, which in the ${role} is the event loop that answers every session; it must not run there (a launch planned inside the door reaches it through its own addresses, never through the launcher's synchronous coordination)`
2753
+ );
2754
+ this.name = "BlockingInEventLoopError";
2755
+ }
2756
+ };
2757
+ }
2758
+ });
2759
+
2731
2760
  // package.json
2732
2761
  var package_default;
2733
2762
  var init_package = __esm({
2734
2763
  "package.json"() {
2735
2764
  package_default = {
2736
2765
  name: "claude-use",
2737
- version: "11.5.2",
2766
+ version: "11.6.1",
2738
2767
  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.",
2739
2768
  license: "MIT",
2740
2769
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -3913,6 +3942,7 @@ function isErrorWithCode(error, code) {
3913
3942
  return typeof error === "object" && error !== null && "code" in error && error.code === code;
3914
3943
  }
3915
3944
  function realSleepSync(ms) {
3945
+ refuseToBlockInRole("a synchronous sleep");
3916
3946
  Atomics.wait(new Int32Array(new SharedArrayBuffer(INT32_BYTE_LENGTH)), 0, 0, ms);
3917
3947
  }
3918
3948
  function realIsProcessAlive(pid) {
@@ -4146,6 +4176,7 @@ var realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, real
4146
4176
  var init_realPorts = __esm({
4147
4177
  "src/realPorts.ts"() {
4148
4178
  "use strict";
4179
+ init_processRole();
4149
4180
  init_load();
4150
4181
  init_versionDiscovery();
4151
4182
  init_supervisorProcesses();
@@ -8011,6 +8042,7 @@ var init_ownCli = __esm({
8011
8042
  // src/frontdoor/probe.ts
8012
8043
  import { Worker } from "node:worker_threads";
8013
8044
  function probeFrontDoorSync(port, caPem) {
8045
+ refuseToBlockInRole("a synchronous probe of the front door");
8014
8046
  const shared = new SharedArrayBuffer(HEADER_SLOTS * INT32_BYTES + REASON_BYTES);
8015
8047
  const header = new Int32Array(shared, 0, HEADER_SLOTS);
8016
8048
  const worker = new Worker(PROBE_SOURCE, {
@@ -8037,6 +8069,7 @@ var PROBE_TIMEOUT_MS, PROBE_WAIT_MARGIN_MS, REASON_BYTES, HEADER_SLOTS, INT32_BY
8037
8069
  var init_probe = __esm({
8038
8070
  "src/frontdoor/probe.ts"() {
8039
8071
  "use strict";
8072
+ init_processRole();
8040
8073
  PROBE_TIMEOUT_MS = 2e3;
8041
8074
  PROBE_WAIT_MARGIN_MS = 1e3;
8042
8075
  REASON_BYTES = 1024;
@@ -8078,6 +8111,17 @@ request.on("error", (error) => finish(failed, (error.code ? error.code + ": " :
8078
8111
  }
8079
8112
  });
8080
8113
 
8114
+ // src/frontdoor/selfIdentity.ts
8115
+ function isFrontDoorSupervisorPid(pid, identify) {
8116
+ return declaredPid !== void 0 && pid === declaredPid && pid === process.pid || identify(pid);
8117
+ }
8118
+ var declaredPid;
8119
+ var init_selfIdentity = __esm({
8120
+ "src/frontdoor/selfIdentity.ts"() {
8121
+ "use strict";
8122
+ }
8123
+ });
8124
+
8081
8125
  // src/frontdoor/trust.ts
8082
8126
  import { createHash as createHash6 } from "node:crypto";
8083
8127
  import path40 from "node:path";
@@ -8125,7 +8169,7 @@ function realEnsurePorts(paths, spawnDaemon) {
8125
8169
  now: () => Date.now(),
8126
8170
  sleep: realSleepSync,
8127
8171
  spawnSupervisor: (layout) => spawnDaemon(layout, "__frontdoor-supervisor", layout.frontdoorLogPath),
8128
- isFrontDoorSupervisor: realIsFrontDoorSupervisor,
8172
+ isFrontDoorSupervisor: (pid) => isFrontDoorSupervisorPid(pid, realIsFrontDoorSupervisor),
8129
8173
  stopSupervisor: (pid) => {
8130
8174
  process.kill(pid, "SIGTERM");
8131
8175
  },
@@ -8162,6 +8206,7 @@ var init_realFrontDoorPort = __esm({
8162
8206
  init_ensure2();
8163
8207
  init_state();
8164
8208
  init_probe();
8209
+ init_selfIdentity();
8165
8210
  init_trust();
8166
8211
  realTrustBundleFs = {
8167
8212
  readFileUtf8: (file) => fs11.readFileSync(file, "utf8"),
@@ -8968,6 +9013,7 @@ init_route();
8968
9013
  init_state();
8969
9014
 
8970
9015
  // src/frontdoor/supervisor.ts
9016
+ init_processRole();
8971
9017
  init_state();
8972
9018
  import path9 from "node:path";
8973
9019
  function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
@@ -8982,6 +9028,14 @@ var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
8982
9028
  var FRONTDOOR_POLL_MS = 1e3;
8983
9029
  var MS_PER_MINUTE = 6e4;
8984
9030
  async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {}) {
9031
+ const leaveRole = enterProcessRole("frontdoor-supervisor");
9032
+ try {
9033
+ return await serveFrontDoor(idleShutdownMinutes, ports, options);
9034
+ } finally {
9035
+ leaveRole();
9036
+ }
9037
+ }
9038
+ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
8985
9039
  const { fs: fs12, paths } = ports;
8986
9040
  const servingBinary = ports.statOwnExecutable();
8987
9041
  const previous = readFrontDoorState(fs12, paths.frontdoorStateFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "11.5.2",
3
+ "version": "11.6.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>",