agent-shim 11.66.1 → 11.66.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4751,7 +4751,7 @@ var init_package = __esm({
4751
4751
  "package.json"() {
4752
4752
  package_default = {
4753
4753
  name: "agent-shim",
4754
- version: "11.66.1",
4754
+ version: "11.66.3",
4755
4755
  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.",
4756
4756
  license: "MIT",
4757
4757
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -4810,7 +4810,7 @@ var init_package = __esm({
4810
4810
  cosmiconfig: "^10.0.1",
4811
4811
  picomatch: "^4.0.7",
4812
4812
  "string-width": "8.3.0",
4813
- trilean: "1.7.1",
4813
+ trilean: "1.9.0",
4814
4814
  undici: "7.30.1",
4815
4815
  zod: "^4.6.7"
4816
4816
  },
@@ -5241,6 +5241,22 @@ function daemonAdmits(fs14, allowlistFile, recordedHash, required) {
5241
5241
  const served = parseAllowlistFile(content);
5242
5242
  return recordedHash === hashAllowlistFile(content) && required.every((upstream) => served.includes(upstream));
5243
5243
  }
5244
+ function startSupervisorUnderLock(params) {
5245
+ const { paths, ports } = params;
5246
+ ports.fs.mkdirp(paths.headroomDir);
5247
+ const created = ports.fs.writeFileExclusive(paths.headroomLockFile, `${JSON.stringify({ pid: params.holderPid, at: ports.now() })}
5248
+ `);
5249
+ if (created) {
5250
+ ports.spawnSupervisor(paths);
5251
+ return "spawned";
5252
+ }
5253
+ const lock = readStartLock(ports.fs, paths.headroomLockFile);
5254
+ if (lock === void 0 || !ports.isRunning(lock.pid)) {
5255
+ ports.fs.removeRecursive(paths.headroomLockFile);
5256
+ return "cleared-stale-lock";
5257
+ }
5258
+ return "held";
5259
+ }
5244
5260
  function ensureHeadroom(params) {
5245
5261
  const { paths, ports } = params;
5246
5262
  let deadline = ports.now() + HEADROOM_START_TIMEOUT_MS;
@@ -5286,21 +5302,11 @@ function ensureHeadroom(params) {
5286
5302
  );
5287
5303
  }
5288
5304
  } else if (!spawnedSupervisor) {
5289
- ports.fs.mkdirp(paths.headroomDir);
5290
- const created = ports.fs.writeFileExclusive(
5291
- paths.headroomLockFile,
5292
- `${JSON.stringify({ pid: params.launcherPid, at: ports.now() })}
5293
- `
5294
- );
5295
- if (created) {
5296
- ports.spawnSupervisor(paths);
5305
+ const started = startSupervisorUnderLock({ paths, holderPid: params.launcherPid, ports });
5306
+ if (started === "spawned") {
5297
5307
  spawnedSupervisor = true;
5298
- } else {
5299
- const lock = readStartLock(ports.fs, paths.headroomLockFile);
5300
- if (lock === void 0 || !ports.isRunning(lock.pid)) {
5301
- ports.fs.removeRecursive(paths.headroomLockFile);
5302
- continue;
5303
- }
5308
+ } else if (started === "cleared-stale-lock") {
5309
+ continue;
5304
5310
  }
5305
5311
  }
5306
5312
  if (ports.now() >= deadline) {
package/dist/index.mjs CHANGED
@@ -4727,7 +4727,7 @@ var init_package = __esm({
4727
4727
  "package.json"() {
4728
4728
  package_default = {
4729
4729
  name: "agent-shim",
4730
- version: "11.66.1",
4730
+ version: "11.66.3",
4731
4731
  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.",
4732
4732
  license: "MIT",
4733
4733
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -4786,7 +4786,7 @@ var init_package = __esm({
4786
4786
  cosmiconfig: "^10.0.1",
4787
4787
  picomatch: "^4.0.7",
4788
4788
  "string-width": "8.3.0",
4789
- trilean: "1.7.1",
4789
+ trilean: "1.9.0",
4790
4790
  undici: "7.30.1",
4791
4791
  zod: "^4.6.7"
4792
4792
  },
@@ -5218,6 +5218,22 @@ function daemonAdmits(fs14, allowlistFile, recordedHash, required) {
5218
5218
  const served = parseAllowlistFile(content);
5219
5219
  return recordedHash === hashAllowlistFile(content) && required.every((upstream) => served.includes(upstream));
5220
5220
  }
5221
+ function startSupervisorUnderLock(params) {
5222
+ const { paths, ports } = params;
5223
+ ports.fs.mkdirp(paths.headroomDir);
5224
+ const created = ports.fs.writeFileExclusive(paths.headroomLockFile, `${JSON.stringify({ pid: params.holderPid, at: ports.now() })}
5225
+ `);
5226
+ if (created) {
5227
+ ports.spawnSupervisor(paths);
5228
+ return "spawned";
5229
+ }
5230
+ const lock = readStartLock(ports.fs, paths.headroomLockFile);
5231
+ if (lock === void 0 || !ports.isRunning(lock.pid)) {
5232
+ ports.fs.removeRecursive(paths.headroomLockFile);
5233
+ return "cleared-stale-lock";
5234
+ }
5235
+ return "held";
5236
+ }
5221
5237
  function ensureHeadroom(params) {
5222
5238
  const { paths, ports } = params;
5223
5239
  let deadline = ports.now() + HEADROOM_START_TIMEOUT_MS;
@@ -5263,21 +5279,11 @@ function ensureHeadroom(params) {
5263
5279
  );
5264
5280
  }
5265
5281
  } else if (!spawnedSupervisor) {
5266
- ports.fs.mkdirp(paths.headroomDir);
5267
- const created = ports.fs.writeFileExclusive(
5268
- paths.headroomLockFile,
5269
- `${JSON.stringify({ pid: params.launcherPid, at: ports.now() })}
5270
- `
5271
- );
5272
- if (created) {
5273
- ports.spawnSupervisor(paths);
5282
+ const started = startSupervisorUnderLock({ paths, holderPid: params.launcherPid, ports });
5283
+ if (started === "spawned") {
5274
5284
  spawnedSupervisor = true;
5275
- } else {
5276
- const lock = readStartLock(ports.fs, paths.headroomLockFile);
5277
- if (lock === void 0 || !ports.isRunning(lock.pid)) {
5278
- ports.fs.removeRecursive(paths.headroomLockFile);
5279
- continue;
5280
- }
5285
+ } else if (started === "cleared-stale-lock") {
5286
+ continue;
5281
5287
  }
5282
5288
  }
5283
5289
  if (ports.now() >= deadline) {