claude-use 9.12.1 → 9.13.0

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
@@ -2595,7 +2595,7 @@ function listFrontDoorSessions(fs12, sessionsDir) {
2595
2595
  try {
2596
2596
  const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs12.readFileUtf8(import_node_path8.default.join(sessionsDir, name)) ?? ""));
2597
2597
  if (parsed.success) {
2598
- sessions.push({ pid: parsed.data.pid, startedAt: parsed.data.startedAt });
2598
+ sessions.push({ pid: parsed.data.pid, startedAt: parsed.data.startedAt, ...parsed.data.supervisorPid === void 0 ? {} : { supervisorPid: parsed.data.supervisorPid } });
2599
2599
  }
2600
2600
  } catch {
2601
2601
  continue;
@@ -2623,7 +2623,7 @@ var init_state = __esm({
2623
2623
  import_node_path8 = __toESM(require("node:path"), 1);
2624
2624
  import_zod3 = require("zod");
2625
2625
  FRONT_DOOR_PROTOCOL = 3;
2626
- FrontDoorSessionSchema = import_zod3.z.strictObject({ pid: import_zod3.z.number().int().positive(), startedAt: import_zod3.z.number(), token: import_zod3.z.string().min(1) });
2626
+ FrontDoorSessionSchema = import_zod3.z.strictObject({ pid: import_zod3.z.number().int().positive(), startedAt: import_zod3.z.number(), token: import_zod3.z.string().min(1), supervisorPid: import_zod3.z.number().int().positive().optional() });
2627
2627
  FrontDoorStateSchema = import_zod3.z.strictObject({
2628
2628
  /**
2629
2629
  * The launcher-to-door wire protocol this supervisor speaks, written once it is serving; absent in state written by a release that predates the field, which `ensureFrontDoor` reads as protocol 0. A launcher replaces a door whose protocol is lower than its own (see `FRONT_DOOR_PROTOCOL`).
@@ -2663,7 +2663,7 @@ var init_package = __esm({
2663
2663
  "package.json"() {
2664
2664
  package_default = {
2665
2665
  name: "claude-use",
2666
- version: "9.12.1",
2666
+ version: "9.13.0",
2667
2667
  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.",
2668
2668
  license: "MIT",
2669
2669
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -2766,6 +2766,36 @@ var init_package = __esm({
2766
2766
  }
2767
2767
  });
2768
2768
 
2769
+ // src/frontdoor/supervisorProcesses.ts
2770
+ function parseFrontDoorSupervisorPids(psOutput) {
2771
+ const pids = [];
2772
+ for (const line of psOutput.split("\n")) {
2773
+ const [pidText, ...argumentsList] = line.trim().split(/\s+/);
2774
+ const pid = Number(pidText);
2775
+ if (Number.isInteger(pid) && pid > 0 && argumentsList.includes(FRONT_DOOR_SUPERVISOR_ARGUMENT)) {
2776
+ pids.push(pid);
2777
+ }
2778
+ }
2779
+ return pids.sort((a, b) => a - b);
2780
+ }
2781
+ function listFrontDoorSupervisors(run, uid) {
2782
+ const result = run.run("ps", ["-U", String(uid), "-o", "pid=,command="]);
2783
+ if (result.status === null) {
2784
+ return { ok: false, message: "ps could not be run" };
2785
+ }
2786
+ if (result.status !== 0) {
2787
+ return { ok: false, message: `ps exited ${String(result.status)}${result.stderr.trim() === "" ? "" : `: ${result.stderr.trim()}`}` };
2788
+ }
2789
+ return { ok: true, pids: parseFrontDoorSupervisorPids(result.stdout) };
2790
+ }
2791
+ var FRONT_DOOR_SUPERVISOR_ARGUMENT;
2792
+ var init_supervisorProcesses = __esm({
2793
+ "src/frontdoor/supervisorProcesses.ts"() {
2794
+ "use strict";
2795
+ FRONT_DOOR_SUPERVISOR_ARGUMENT = "__frontdoor-supervisor";
2796
+ }
2797
+ });
2798
+
2769
2799
  // src/headroom/state.ts
2770
2800
  function parseJson(raw, schema) {
2771
2801
  if (raw === void 0 || raw.trim() === "") {
@@ -3363,9 +3393,15 @@ async function runSupervisor(initialConfig, ports, options = {}) {
3363
3393
  await ports.sleep(HEADROOM_POLL_MS);
3364
3394
  }
3365
3395
  }
3396
+ function currentHeadroomAllowlistInputs(fs12, paths) {
3397
+ return {
3398
+ providers: readAllProviders(fs12, paths.providersDir).map((entry) => entry.provider),
3399
+ frontDoorOrigin: frontDoorOrigin(readFrontDoorState(fs12, paths.frontdoorStateFile))
3400
+ };
3401
+ }
3366
3402
  function currentHeadroomAllowlist(fs12, paths) {
3367
- const providers = readAllProviders(fs12, paths.providersDir).map((entry) => entry.provider);
3368
- return headroomAllowlist(headroomUpstreams(providers, frontDoorOrigin(readFrontDoorState(fs12, paths.frontdoorStateFile))));
3403
+ const inputs = currentHeadroomAllowlistInputs(fs12, paths);
3404
+ return headroomAllowlist(headroomUpstreams(inputs.providers, inputs.frontDoorOrigin));
3369
3405
  }
3370
3406
  function allowlistOf(ports) {
3371
3407
  return currentHeadroomAllowlist(ports.fs, ports.paths);
@@ -3428,8 +3464,8 @@ function realIsProcessRunning(pid) {
3428
3464
  return realIsProcessAlive(pid) && !realIsProcessZombie(pid);
3429
3465
  }
3430
3466
  function realIsFrontDoorSupervisor(pid) {
3431
- const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8" });
3432
- return result.status === 0 && result.stdout.split(/\s+/).includes(FRONT_DOOR_SUPERVISOR_SUBCOMMAND);
3467
+ const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
3468
+ return result.status === 0 && parseFrontDoorSupervisorPids(result.stdout).includes(pid);
3433
3469
  }
3434
3470
  function expandHome2(filePath) {
3435
3471
  return filePath.startsWith("~/") ? import_node_path13.default.join(import_node_os2.default.homedir(), filePath.slice(1)) : filePath;
@@ -3628,7 +3664,7 @@ function realResolveClaudeBinary(isOwnBinary) {
3628
3664
  function realInstalledClaudeVersions() {
3629
3665
  return installedVersions(listVersionsDir(defaultVersionsDir()));
3630
3666
  }
3631
- var import_node_child_process2, import_node_crypto8, import_node_fs2, import_node_os2, import_node_path13, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, FRONT_DOOR_SUPERVISOR_SUBCOMMAND, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
3667
+ var import_node_child_process2, import_node_crypto8, import_node_fs2, import_node_os2, import_node_path13, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
3632
3668
  var init_realPorts = __esm({
3633
3669
  "src/realPorts.ts"() {
3634
3670
  "use strict";
@@ -3640,6 +3676,7 @@ var init_realPorts = __esm({
3640
3676
  import_node_sea = require("node:sea");
3641
3677
  init_load();
3642
3678
  init_versionDiscovery();
3679
+ init_supervisorProcesses();
3643
3680
  init_ensure();
3644
3681
  init_supervisor();
3645
3682
  init_state2();
@@ -3769,7 +3806,6 @@ var init_realPorts = __esm({
3769
3806
  }
3770
3807
  };
3771
3808
  INT32_BYTE_LENGTH = 4;
3772
- FRONT_DOOR_SUPERVISOR_SUBCOMMAND = "__frontdoor-supervisor";
3773
3809
  realRunPort = {
3774
3810
  run(command, args) {
3775
3811
  const result = (0, import_node_child_process2.spawnSync)(command, [...args], { encoding: "utf8" });
@@ -4676,7 +4712,7 @@ function assessIdentity(member, nowMs) {
4676
4712
  );
4677
4713
  if (blockedUntil > nowMs) {
4678
4714
  if (unified.overageStatus === "allowed") {
4679
- return { candidate: { ...base, class: "pay-per-use", reasons: [`plan exhausted until ${new Date(blockedUntil).toISOString()}, continues as extra usage`, ...windowReasons, ...planReasons] } };
4715
+ return { candidate: { ...base, class: "pay-per-use", planReturnsAtMs: blockedUntil, reasons: [`plan exhausted until ${new Date(blockedUntil).toISOString()} (in ${formatAge(blockedUntil - nowMs)}), continues as extra usage`, ...windowReasons, ...planReasons] } };
4680
4716
  }
4681
4717
  return { candidate: { ...base, class: "ineligible", blockedUntilMs: blockedUntil, reasons: [`refused until ${new Date(blockedUntil).toISOString()} (in ${formatAge(blockedUntil - nowMs)})`, ...unified.fallbackAvailable === true ? ["a fallback is on offer, so requests for some models may still be served"] : [], ...windowReasons, ...overageReasons, ...planReasons] } };
4682
4718
  }
@@ -4791,7 +4827,8 @@ function rankPool(input) {
4791
4827
  return {
4792
4828
  candidates: ordered,
4793
4829
  ...pick === void 0 ? { ...earliestReturn === void 0 ? {} : { earliestReturn } } : { pick },
4794
- ...movedOff === void 0 || pick === void 0 ? {} : { movedOff }
4830
+ ...movedOff === void 0 || pick === void 0 ? {} : { movedOff },
4831
+ ...pick?.planReturnsAtMs === void 0 ? {} : { planReturn: { identity: pick.identity, atMs: pick.planReturnsAtMs } }
4795
4832
  };
4796
4833
  }
4797
4834
  var MS_PER_SECOND4, MS_PER_HOUR2, HOURS_PER_DAY2, FIVE_HOURS, PROMPT_CACHE_TTL_HOURS, PERCENT, SEVEN_DAYS, FIVE_HOUR_WINDOW_MS, SEVEN_DAY_WINDOW_MS, PROMPT_CACHE_TTL_MS, CLASS_ORDER;
@@ -6204,7 +6241,7 @@ function ensureFrontDoor(params) {
6204
6241
  }
6205
6242
  if (verdict.ok) {
6206
6243
  const token = (0, import_node_crypto9.randomUUID)();
6207
- writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token });
6244
+ writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid });
6208
6245
  return { port: state.port, connectPort: state.connectPort, token };
6209
6246
  }
6210
6247
  lastRejection = `the listener on 127.0.0.1:${String(state.port)} (recorded for pid ${String(supervisorPid)}) failed authentication: ${verdict.reason}`;
@@ -6739,7 +6776,12 @@ function resolvePoolLaunch(params) {
6739
6776
  if (graph.ranking.candidates.length === 0) {
6740
6777
  return { ok: false, message: `agent-shim: no member of pool "${poolName}" is an existing identity.` };
6741
6778
  }
6742
- const { pick, earliestReturn, movedOff } = graph.ranking;
6779
+ const { pick, earliestReturn, movedOff, planReturn } = graph.ranking;
6780
+ if (pick !== void 0 && params.wait && planReturn !== void 0) {
6781
+ log.info(`agent-shim: pool "${poolName}" would continue ${planReturn.identity} on extra usage; waiting until ${new Date(planReturn.atMs).toISOString()} for its plan window`);
6782
+ params.sleep(Math.max(planReturn.atMs - nowMs, 0));
6783
+ continue;
6784
+ }
6743
6785
  if (pick !== void 0) {
6744
6786
  if (params.recordPick) {
6745
6787
  recordStickyPick(params.usageFs, params.paths.usagePicksFile, params.cwd, pick.identity, nowMs);
@@ -8701,16 +8743,27 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
8701
8743
  ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: front door on 127.0.0.1:${String(http3.port)}, CONNECT surface on 127.0.0.1:${String(connect3.port)}`);
8702
8744
  let idleSince;
8703
8745
  let ticks = 0;
8746
+ const supersedingOwner = () => {
8747
+ const owner = readFrontDoorState(fs12, paths.frontdoorStateFile)?.supervisorPid;
8748
+ return owner !== void 0 && owner !== ports.ownPid && ports.isRunning(owner) ? owner : void 0;
8749
+ };
8750
+ let supersededBy;
8751
+ let served;
8704
8752
  const binaryReplaced = () => {
8705
8753
  const current = ports.statOwnExecutable();
8706
8754
  return current !== void 0 && servingBinary !== void 0 && (current.dev !== servingBinary.dev || current.ino !== servingBinary.ino || current.size !== servingBinary.size || current.mtimeMs !== servingBinary.mtimeMs);
8707
8755
  };
8708
- const shutdown = async () => {
8756
+ const closeServing = async () => {
8709
8757
  await direct.close();
8710
8758
  await connect3.close();
8711
8759
  await http3.close();
8712
8760
  ports.closeRcStreamHub();
8713
- writeFrontDoorState(fs12, paths.frontdoorStateFile, sticky());
8761
+ };
8762
+ const shutdown = async () => {
8763
+ await closeServing();
8764
+ if (supersedingOwner() === void 0) {
8765
+ writeFrontDoorState(fs12, paths.frontdoorStateFile, sticky());
8766
+ }
8714
8767
  return 0;
8715
8768
  };
8716
8769
  for (; ; ) {
@@ -8723,7 +8776,28 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
8723
8776
  ports.observeLaunchRegistry(listed, pruned);
8724
8777
  ports.checkQuotaExpiry();
8725
8778
  const prunedPids = new Set(pruned);
8726
- if (listed.filter((session) => !prunedPids.has(session.pid)).length === 0) {
8779
+ const live = listed.filter((session) => !prunedPids.has(session.pid));
8780
+ if (supersededBy === void 0) {
8781
+ supersededBy = supersedingOwner();
8782
+ if (supersededBy !== void 0) {
8783
+ ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: supervisor ${String(supersededBy)} now owns the front door; taking no new sessions and exiting once the sessions this door serves have ended`);
8784
+ ports.doorHealth.superseded(supersededBy);
8785
+ await ports.sleep(FRONTDOOR_POLL_MS);
8786
+ continue;
8787
+ }
8788
+ } else {
8789
+ const owner = supersededBy;
8790
+ served = (served ?? live.filter((session) => session.pid !== ports.ownPid && session.pid !== owner && (session.supervisorPid === void 0 || session.supervisorPid === ports.ownPid))).filter((own) => live.some((session) => session.pid === own.pid && session.startedAt === own.startedAt));
8791
+ if (served.length === 0) {
8792
+ ports.log("agent-shim frontdoor supervisor: the sessions this superseded door served have ended; closing the front door and exiting");
8793
+ ports.doorHealth.drained();
8794
+ await closeServing();
8795
+ return 0;
8796
+ }
8797
+ await ports.sleep(FRONTDOOR_POLL_MS);
8798
+ continue;
8799
+ }
8800
+ if (live.length === 0) {
8727
8801
  if (ticks > 1 && binaryReplaced()) {
8728
8802
  ports.log("agent-shim frontdoor supervisor: the installed binary changed and no sessions are live; turning the door over for the next launch");
8729
8803
  ports.doorHealth.binaryTurnover();
@@ -12877,7 +12951,55 @@ init_credential();
12877
12951
  init_credentialCache();
12878
12952
  init_realCredentialCache();
12879
12953
  init_source();
12954
+
12955
+ // src/headroom/allowlistDrift.ts
12880
12956
  init_state2();
12957
+ function diagnoseAllowlistDrift(params) {
12958
+ const { recordedHash, providers, frontDoorOrigin: frontDoorOrigin2 } = params;
12959
+ if (recordedHash === void 0 || recordedHash === hashAllowlist(headroomAllowlist(headroomUpstreams(providers, frontDoorOrigin2)))) {
12960
+ return void 0;
12961
+ }
12962
+ const originIsInput = providers.length > 0 && frontDoorOrigin2 !== void 0;
12963
+ if (!originIsInput) {
12964
+ return ["provider-files"];
12965
+ }
12966
+ return recordedHash === hashAllowlist(headroomAllowlist(headroomUpstreams(providers, void 0))) ? ["front-door-origin"] : ["provider-files", "front-door-origin"];
12967
+ }
12968
+
12969
+ // src/doctorReport.ts
12970
+ init_state2();
12971
+ init_supervisor();
12972
+ init_state();
12973
+
12974
+ // src/doctorFrontDoor.ts
12975
+ function pushFrontDoor(push, supervisors, registeredPid) {
12976
+ if (!supervisors.ok) {
12977
+ push("frontdoor", "warn", `Could not list processes to look for duplicate front door supervisors: ${supervisors.message}.`);
12978
+ return;
12979
+ }
12980
+ const { pids } = supervisors;
12981
+ if (pids.length === 0) {
12982
+ push("frontdoor", "pass", "No front door supervisor is running.");
12983
+ return;
12984
+ }
12985
+ const [only, ...rest] = pids;
12986
+ if (only !== void 0 && rest.length === 0) {
12987
+ push("frontdoor", "pass", `One front door supervisor is running (pid ${String(only)}).`);
12988
+ return;
12989
+ }
12990
+ const serving = registeredPid !== void 0 && pids.includes(registeredPid) ? `The front door state file names pid ${String(registeredPid)} as the serving supervisor.` : "The front door state file names no running supervisor.";
12991
+ for (const pid of pids.filter((candidate) => candidate !== registeredPid)) {
12992
+ push(
12993
+ "frontdoor",
12994
+ "fail",
12995
+ `Front door supervisor pid ${String(pid)} is running beside ${String(pids.length - 1)} other(s). ${serving} Stop it with \`kill ${String(pid)}\`; launches still connected to it lose their door.`,
12996
+ String(pid)
12997
+ );
12998
+ }
12999
+ }
13000
+
13001
+ // src/doctorReport.ts
13002
+ init_supervisorProcesses();
12881
13003
  init_legacy();
12882
13004
  init_providersStore();
12883
13005
  init_guard();
@@ -12900,7 +13022,8 @@ var DOCTOR_SECTIONS = [
12900
13022
  "global-config",
12901
13023
  "categories-local",
12902
13024
  "active-identity",
12903
- "headroom"
13025
+ "headroom",
13026
+ "frontdoor"
12904
13027
  ];
12905
13028
  function refinePathShadow(status, ownExecutablePath, realpath) {
12906
13029
  if (status.status !== "shadowed") {
@@ -13296,6 +13419,17 @@ function runDoctor(params) {
13296
13419
  `Headroom daemon is up on unix socket ${state.socketPath} (supervisor ${String(state.supervisorPid)}, daemon ${String(state.headroomPid)}).`
13297
13420
  );
13298
13421
  }
13422
+ const allowlist = params.headroom.allowlist;
13423
+ if (supervisorAlive && headroomAlive && state.socketPath !== void 0 && allowlist?.driftInputs?.includes("front-door-origin") === true) {
13424
+ const origin = allowlist.frontDoorOrigin ?? "";
13425
+ const certainty = allowlist.driftInputs.includes("provider-files") ? "may exclude" : "excludes";
13426
+ push(
13427
+ "headroom",
13428
+ "fail",
13429
+ `Headroom daemon ${String(state.headroomPid)} was started with an allowlist that ${certainty} the serving front door's direct origin ${origin}, so it refuses every request a provider launch sends back through the door. Its supervisor restarts it once no launch is registered against it; \`agent-shim headroom status\` lists the registered launches, and \`--no-headroom\` launches are unaffected.`,
13430
+ String(state.headroomPid)
13431
+ );
13432
+ }
13299
13433
  if (state.lastError !== void 0 && supervisorAlive) {
13300
13434
  push("headroom", "warn", `Headroom recorded a previous error: ${state.lastError}`);
13301
13435
  }
@@ -13308,6 +13442,10 @@ function runDoctor(params) {
13308
13442
  }
13309
13443
  }
13310
13444
  }
13445
+ if (params.frontDoor !== void 0) {
13446
+ const validated3 = params.frontDoor.state.raw === void 0 ? void 0 : validateJson(FrontDoorStateSchema, params.frontDoor.state);
13447
+ pushFrontDoor(push, params.frontDoor.supervisors, validated3?.ok === true ? validated3.data.supervisorPid : void 0);
13448
+ }
13311
13449
  if (params.activeIdentity.raw === void 0) {
13312
13450
  push("active-identity", "pass", "No active identity set.");
13313
13451
  } else {
@@ -13337,6 +13475,7 @@ var SECTION_TITLES = {
13337
13475
  "directory-rules": "Directory rules",
13338
13476
  "global-config": "Global config",
13339
13477
  headroom: "Headroom daemon",
13478
+ frontdoor: "Front door",
13340
13479
  "categories-local": "categories.local.json",
13341
13480
  "active-identity": "Active identity"
13342
13481
  };
@@ -13354,6 +13493,7 @@ var SECTION_ORDER = [
13354
13493
  "directory-rules",
13355
13494
  "global-config",
13356
13495
  "headroom",
13496
+ "frontdoor",
13357
13497
  "categories-local",
13358
13498
  "active-identity"
13359
13499
  ];
@@ -13431,6 +13571,9 @@ function collectDoctorReport(params) {
13431
13571
  shimState.targetPath,
13432
13572
  realpathOrSelf
13433
13573
  );
13574
+ const uid = process.getuid?.();
13575
+ const allowlistInputs = currentHeadroomAllowlistInputs(realFarmFs, paths);
13576
+ const servingHeadroom = resolveServingHeadroomState(realFarmFs, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, realIsProcessRunning);
13434
13577
  const report = runDoctor({
13435
13578
  env: params.env,
13436
13579
  credentialCache: realCredentialCacheEnv(paths),
@@ -13469,8 +13612,13 @@ function collectDoctorReport(params) {
13469
13612
  const statePath = resolved?.path ?? paths.headroomStateFile;
13470
13613
  return { path: statePath, raw: realFarmFs.readFileUtf8(statePath) };
13471
13614
  })(),
13472
- isRunning: realIsProcessRunning
13473
- }
13615
+ isRunning: realIsProcessRunning,
13616
+ allowlist: {
13617
+ driftInputs: diagnoseAllowlistDrift({ recordedHash: servingHeadroom?.state.allowlistHash, ...allowlistInputs }),
13618
+ frontDoorOrigin: allowlistInputs.frontDoorOrigin
13619
+ }
13620
+ },
13621
+ ...uid === void 0 ? {} : { frontDoor: { state: { path: paths.frontdoorStateFile, raw: realFsPort.readFileUtf8(paths.frontdoorStateFile) }, supervisors: listFrontDoorSupervisors(realRunPort, uid) } }
13474
13622
  });
13475
13623
  return report;
13476
13624
  }
@@ -14172,7 +14320,9 @@ var DoorHealthEventSchema = import_zod23.z.discriminatedUnion("kind", [
14172
14320
  import_zod23.z.strictObject({ kind: import_zod23.z.literal("generation"), pid: import_zod23.z.number().int().positive(), providerPort: import_zod23.z.number().int().positive(), connectPort: import_zod23.z.number().int().positive(), directPort: import_zod23.z.number().int().positive(), observedAt: import_zod23.z.number() }),
14173
14321
  import_zod23.z.strictObject({ kind: import_zod23.z.literal("listenerFailed"), pid: import_zod23.z.number().int().positive(), listener: import_zod23.z.enum(["provider", "connect", "direct"]), message: import_zod23.z.string(), observedAt: import_zod23.z.number() }),
14174
14322
  import_zod23.z.strictObject({ kind: import_zod23.z.literal("binaryTurnover"), pid: import_zod23.z.number().int().positive(), observedAt: import_zod23.z.number() }),
14175
- import_zod23.z.strictObject({ kind: import_zod23.z.literal("idleShutdown"), pid: import_zod23.z.number().int().positive(), observedAt: import_zod23.z.number() })
14323
+ import_zod23.z.strictObject({ kind: import_zod23.z.literal("idleShutdown"), pid: import_zod23.z.number().int().positive(), observedAt: import_zod23.z.number() }),
14324
+ import_zod23.z.strictObject({ kind: import_zod23.z.literal("superseded"), pid: import_zod23.z.number().int().positive(), ownerPid: import_zod23.z.number().int().positive(), observedAt: import_zod23.z.number() }),
14325
+ import_zod23.z.strictObject({ kind: import_zod23.z.literal("drained"), pid: import_zod23.z.number().int().positive(), observedAt: import_zod23.z.number() })
14176
14326
  ]);
14177
14327
  var QuotaExpiringEventSchema = import_zod23.z.strictObject({
14178
14328
  identity: import_zod23.z.string().min(1),
@@ -14669,6 +14819,12 @@ function createDoorHealthPublisher(hub, now, pid) {
14669
14819
  },
14670
14820
  binaryTurnover: () => {
14671
14821
  publisher.publish({ kind: "binaryTurnover", pid, observedAt: now() });
14822
+ },
14823
+ superseded: (ownerPid) => {
14824
+ publisher.publish({ kind: "superseded", pid, ownerPid, observedAt: now() });
14825
+ },
14826
+ drained: () => {
14827
+ publisher.publish({ kind: "drained", pid, observedAt: now() });
14672
14828
  }
14673
14829
  };
14674
14830
  }