claude-use 11.62.2 → 11.63.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.mjs CHANGED
@@ -3901,12 +3901,13 @@ function pruneDeadFrontDoorSessions(fs14, sessionsDir, listed, isRunning) {
3901
3901
  }
3902
3902
  return removed;
3903
3903
  }
3904
- var FRONT_DOOR_PROTOCOL, FrontDoorSessionSchema, FrontDoorStateSchema, MAX_TCP_PORT, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE;
3904
+ var FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, FrontDoorStateSchema, MAX_TCP_PORT, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE;
3905
3905
  var init_state = __esm({
3906
3906
  "src/frontdoor/state.ts"() {
3907
3907
  "use strict";
3908
3908
  init_schema();
3909
- FRONT_DOOR_PROTOCOL = 5;
3909
+ FRONT_DOOR_PROTOCOL = 6;
3910
+ FRONT_DOOR_HANDOVER_PROTOCOL = 6;
3910
3911
  FrontDoorSessionSchema = z5.strictObject({ pid: z5.number().int().positive(), startedAt: z5.number(), token: z5.string().min(1), supervisorPid: z5.number().int().positive().optional(), sessionId: z5.string().min(1).optional(), models: ModelsConfigSchema.optional() });
3911
3912
  FrontDoorStateSchema = z5.strictObject({
3912
3913
  /**
@@ -4003,18 +4004,24 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
4003
4004
  ...lastConnectPort === void 0 ? {} : { lastConnectPort },
4004
4005
  ...lastDirectPort === void 0 ? {} : { lastDirectPort }
4005
4006
  });
4007
+ const { predecessor } = ports;
4008
+ const sourceOf = (listener, preferredPort) => predecessor === void 0 ? { preferredPort } : { inherit: async () => await predecessor.take(listener) };
4006
4009
  const fail = (message) => {
4007
4010
  ports.closeRcStreamHub();
4008
- writeFrontDoorState(fs14, paths.frontdoorStateFile, { lastError: message, ...sticky() });
4009
- fs14.removeRecursive(paths.frontdoorLockFile);
4011
+ if (predecessor === void 0) {
4012
+ writeFrontDoorState(fs14, paths.frontdoorStateFile, { lastError: message, ...sticky() });
4013
+ fs14.removeRecursive(paths.frontdoorLockFile);
4014
+ }
4010
4015
  ports.log(`agent-shim frontdoor supervisor: ${message}`);
4011
4016
  return 1;
4012
4017
  };
4013
- writeFrontDoorState(fs14, paths.frontdoorStateFile, { supervisorPid: ports.ownPid, ...sticky() });
4018
+ if (predecessor === void 0) {
4019
+ writeFrontDoorState(fs14, paths.frontdoorStateFile, { supervisorPid: ports.ownPid, ...sticky() });
4020
+ }
4014
4021
  const previousSticky = lastPort;
4015
4022
  let http3;
4016
4023
  try {
4017
- http3 = await ports.startProviderListener(lastPort);
4024
+ http3 = await ports.startProviderListener(sourceOf("provider", lastPort));
4018
4025
  } catch (error) {
4019
4026
  ports.doorHealth.listenerFailed("provider", error instanceof Error ? error.message : String(error));
4020
4027
  return fail(`could not start the provider listener: ${error instanceof Error ? error.message : String(error)}`);
@@ -4026,7 +4033,7 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
4026
4033
  const previousStickyConnect = lastConnectPort;
4027
4034
  let connect3;
4028
4035
  try {
4029
- connect3 = await ports.startConnectListener(lastConnectPort);
4036
+ connect3 = await ports.startConnectListener(sourceOf("connect", lastConnectPort));
4030
4037
  } catch (error) {
4031
4038
  await http3.close();
4032
4039
  ports.doorHealth.listenerFailed("connect", error instanceof Error ? error.message : String(error));
@@ -4039,7 +4046,7 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
4039
4046
  const previousStickyDirect = lastDirectPort;
4040
4047
  let direct;
4041
4048
  try {
4042
- direct = await ports.startDirectListener(lastDirectPort);
4049
+ direct = await ports.startDirectListener(sourceOf("direct", lastDirectPort));
4043
4050
  } catch (error) {
4044
4051
  await connect3.close();
4045
4052
  await http3.close();
@@ -4053,8 +4060,12 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
4053
4060
  writeFrontDoorDirectRecord(fs14, paths.frontdoorDirectRecordsDir, { pid: ports.ownPid, directPort: direct.port });
4054
4061
  writeFrontDoorState(fs14, paths.frontdoorStateFile, { protocol: FRONT_DOOR_PROTOCOL, supervisorPid: ports.ownPid, port: http3.port, connectPort: connect3.port, directPort: direct.port, ...sticky() });
4055
4062
  ports.doorHealth.generation({ providerPort: http3.port, connectPort: connect3.port, directPort: direct.port });
4056
- fs14.removeRecursive(paths.frontdoorLockFile);
4057
- 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)}`);
4063
+ if (predecessor === void 0) {
4064
+ fs14.removeRecursive(paths.frontdoorLockFile);
4065
+ } else {
4066
+ predecessor.serving();
4067
+ }
4068
+ 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)}${predecessor === void 0 ? "" : ", taken over from the door it replaced"}`);
4058
4069
  const watchdog = ports.startWatchdog?.();
4059
4070
  let idleSince;
4060
4071
  let ticks = 0;
@@ -4074,14 +4085,16 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
4074
4085
  resolve();
4075
4086
  };
4076
4087
  ports.retire?.addEventListener("abort", wake, { once: true });
4088
+ ports.handover?.requested.addEventListener("abort", wake, { once: true });
4077
4089
  void ports.sleep(FRONTDOOR_POLL_MS).then(() => {
4078
4090
  ports.retire?.removeEventListener("abort", wake);
4091
+ ports.handover?.requested.removeEventListener("abort", wake);
4079
4092
  resolve();
4080
4093
  });
4081
4094
  });
4082
4095
  };
4083
4096
  const retireByDrain = async () => {
4084
- ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: asked to exit; releasing the front door's addresses and finishing the connections it carries`);
4097
+ ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: releasing the front door's addresses and finishing the connections it carries`);
4085
4098
  watchdog?.stop();
4086
4099
  ports.stopBackgroundWork?.();
4087
4100
  const drained = [direct.drain(), connect3.drain(), http3.drain()];
@@ -4096,6 +4109,17 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
4096
4109
  ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: the connections this door carried have ended; exiting`);
4097
4110
  return 0;
4098
4111
  };
4112
+ const handOverThenDrain = async (run) => {
4113
+ ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: asked to hand the front door's listeners to a successor; accepting on them until it serves`);
4114
+ const outcome = await run({ provider: http3.listening, connect: connect3.listening, direct: direct.listening });
4115
+ if (outcome.ok) {
4116
+ ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: successor ${String(outcome.successorPid)} serves the front door's listeners`);
4117
+ ports.doorHealth.superseded(outcome.successorPid);
4118
+ } else {
4119
+ ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: the handover failed (${outcome.reason}); retiring by drain so a successor is started on the released addresses`);
4120
+ }
4121
+ return await retireByDrain();
4122
+ };
4099
4123
  const closeServing = async () => {
4100
4124
  watchdog?.stop();
4101
4125
  await direct.close();
@@ -4112,10 +4136,13 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
4112
4136
  return 0;
4113
4137
  };
4114
4138
  for (; ; ) {
4115
- watchdog?.beat();
4116
4139
  if (ports.retire?.aborted === true) {
4140
+ ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: asked to exit`);
4117
4141
  return await retireByDrain();
4118
4142
  }
4143
+ if (ports.handover?.requested.aborted === true && supersededBy === void 0) {
4144
+ return await handOverThenDrain(ports.handover.run);
4145
+ }
4119
4146
  if (options.tickLimit !== void 0 && ticks >= options.tickLimit) {
4120
4147
  watchdog?.stop();
4121
4148
  return FRONTDOOR_SUPERVISOR_STILL_RUNNING;
@@ -4253,8 +4280,10 @@ function caParses(ca) {
4253
4280
  return false;
4254
4281
  }
4255
4282
  }
4256
- async function startConnectServer(config, effects, preferredPort) {
4283
+ async function startConnectServer(config, effects, source) {
4257
4284
  const tunnelTokens = /* @__PURE__ */ new WeakMap();
4285
+ const ledger = createConnectionLedger(config.limits, config.isLiveCapability);
4286
+ const lateSessionDeadlines = /* @__PURE__ */ new WeakMap();
4258
4287
  const onUpgrade = (host) => (request4, socket, head) => {
4259
4288
  config.capture?.upgrade(request4);
4260
4289
  if (head.length > 0) {
@@ -4276,6 +4305,12 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
4276
4305
  return { host, serveSecure: serveSecure2, tlsAcceptor: tlsAcceptor2 };
4277
4306
  }
4278
4307
  const handleHostRequest = async (request4, response) => {
4308
+ if (ledger.retiring()) {
4309
+ clearTimeout(lateSessionDeadlines.get(request4.socket));
4310
+ response.once("close", () => {
4311
+ request4.socket.end();
4312
+ });
4313
+ }
4279
4314
  if (config.localSurface !== void 0 && await config.localSurface.serve(host, request4, response)) {
4280
4315
  return;
4281
4316
  }
@@ -4295,13 +4330,19 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
4295
4330
  const httpSession = effects.createHttpSession(handler, onUpgrade(host));
4296
4331
  const serveSecure = (secure, capability) => {
4297
4332
  tunnelTokens.set(secure, capability);
4333
+ if (ledger.retiring()) {
4334
+ const deadline = setTimeout(() => {
4335
+ secure.destroy();
4336
+ }, config.limits.headDeadlineMs);
4337
+ deadline.unref();
4338
+ lateSessionDeadlines.set(secure, deadline);
4339
+ }
4298
4340
  httpSession.serve(secure);
4299
4341
  };
4300
4342
  const tlsAcceptor = effects.createTlsAcceptor(config.leafFor(host), serveSecure);
4301
4343
  return { host, serveSecure, httpSession, tlsAcceptor };
4302
4344
  });
4303
- const ledger = createConnectionLedger(config.limits, config.isLiveCapability);
4304
- const listener = await effects.listenLoopback(preferredPort, (socket) => {
4345
+ const listener = await effects.listenLoopback(source, (socket) => {
4305
4346
  handleConnect(socket, { config, effects, sessions, ledger });
4306
4347
  });
4307
4348
  const apiSession = sessions.find((session) => session.host === config.routedHost);
@@ -4314,7 +4355,7 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
4314
4355
  }
4315
4356
  session.serveSecure(secure, config.transparentCapability ?? "");
4316
4357
  });
4317
- const transparent = config.transparentPort === void 0 || apiSession === void 0 ? void 0 : await effects.listenLoopback(config.transparentPort, (socket) => {
4358
+ const transparent = config.transparentPort === void 0 || apiSession === void 0 ? void 0 : await effects.listenLoopback({ preferredPort: config.transparentPort }, (socket) => {
4318
4359
  sniAcceptor.accept(socket);
4319
4360
  });
4320
4361
  const closeSurface = async () => {
@@ -4329,6 +4370,7 @@ ${request4.rawHeaders.reduce((accumulated, value, index) => index % 2 === 0 ? `$
4329
4370
  };
4330
4371
  return {
4331
4372
  port: listener.port,
4373
+ listening: listener.listening,
4332
4374
  ...transparent === void 0 ? {} : { transparentPort: transparent.port },
4333
4375
  openTunnels: ledger.openTunnels,
4334
4376
  drain: async () => {
@@ -4345,7 +4387,9 @@ function createConnectionLedger(limits, isLiveCapability2) {
4345
4387
  const authenticated = /* @__PURE__ */ new Map();
4346
4388
  let tunnels = 0;
4347
4389
  const blind = /* @__PURE__ */ new Set();
4348
- let onNoBlindTunnels;
4390
+ const live = /* @__PURE__ */ new Set();
4391
+ let retiring = false;
4392
+ let onNoConnections;
4349
4393
  const leavePending = (socket) => {
4350
4394
  const deadline = pending.get(socket);
4351
4395
  if (deadline !== void 0) {
@@ -4377,20 +4421,19 @@ function createConnectionLedger(limits, isLiveCapability2) {
4377
4421
  refuse(socket, REFUSAL.requestTimeout);
4378
4422
  }, limits.headDeadlineMs)
4379
4423
  );
4424
+ live.add(socket);
4380
4425
  socket.once("close", () => {
4381
4426
  leavePending(socket);
4427
+ live.delete(socket);
4428
+ if (live.size === 0) {
4429
+ onNoConnections?.();
4430
+ }
4382
4431
  });
4383
4432
  },
4384
4433
  headReceived: leavePending,
4385
4434
  openTunnels: () => tunnels,
4386
4435
  retire: async () => {
4387
- for (const socket of pending.keys()) {
4388
- socket.destroy();
4389
- }
4390
- for (const deadline of pending.values()) {
4391
- clearTimeout(deadline);
4392
- }
4393
- pending.clear();
4436
+ retiring = true;
4394
4437
  for (const sockets of authenticated.values()) {
4395
4438
  for (const socket of sockets) {
4396
4439
  if (!blind.has(socket)) {
@@ -4398,12 +4441,13 @@ function createConnectionLedger(limits, isLiveCapability2) {
4398
4441
  }
4399
4442
  }
4400
4443
  }
4401
- if (blind.size > 0) {
4444
+ if (live.size > 0) {
4402
4445
  await new Promise((resolve) => {
4403
- onNoBlindTunnels = resolve;
4446
+ onNoConnections = resolve;
4404
4447
  });
4405
4448
  }
4406
4449
  },
4450
+ retiring: () => retiring,
4407
4451
  establish: (socket, capability, kind) => {
4408
4452
  if (tunnels >= limits.maxTunnels) {
4409
4453
  return false;
@@ -4418,9 +4462,6 @@ function createConnectionLedger(limits, isLiveCapability2) {
4418
4462
  socket.once("close", () => {
4419
4463
  tunnels -= 1;
4420
4464
  blind.delete(socket);
4421
- if (blind.size === 0) {
4422
- onNoBlindTunnels?.();
4423
- }
4424
4465
  sockets.delete(socket);
4425
4466
  if (sockets.size === 0 && authenticated.get(capability) === sockets) {
4426
4467
  authenticated.delete(capability);
@@ -4628,7 +4669,7 @@ var init_package = __esm({
4628
4669
  "package.json"() {
4629
4670
  package_default = {
4630
4671
  name: "claude-use",
4631
- version: "11.62.2",
4672
+ version: "11.63.0",
4632
4673
  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.",
4633
4674
  license: "MIT",
4634
4675
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -10155,7 +10196,8 @@ var init_replacement = __esm({
10155
10196
  import { randomUUID as randomUUID3 } from "node:crypto";
10156
10197
  function ensureFrontDoor(params) {
10157
10198
  const { paths, ports } = params;
10158
- const deadline = ports.now() + FRONTDOOR_START_TIMEOUT_MS;
10199
+ const startedAt = ports.now();
10200
+ let deadline = startedAt + FRONTDOOR_START_TIMEOUT_MS;
10159
10201
  let spawned = false;
10160
10202
  let replaced = false;
10161
10203
  const distrusted = /* @__PURE__ */ new Set();
@@ -10195,6 +10237,19 @@ function ensureFrontDoor(params) {
10195
10237
  ports.sleep(FRONTDOOR_LAUNCHER_POLL_MS);
10196
10238
  }
10197
10239
  };
10240
+ const handOverAndAwait = (supervisorPid, doorProtocol, reason, request4) => {
10241
+ recordReplacement(supervisorPid, doorProtocol, reason, "SIGUSR2");
10242
+ request4(supervisorPid);
10243
+ const waitEnds = ports.now() + FRONTDOOR_START_TIMEOUT_MS + FRONTDOOR_EXIT_GRACE_MS;
10244
+ deadline += FRONTDOOR_START_TIMEOUT_MS + FRONTDOOR_EXIT_GRACE_MS;
10245
+ while (ports.isRunning(supervisorPid) && readFrontDoorState(ports.fs, paths.frontdoorStateFile)?.supervisorPid === supervisorPid) {
10246
+ if (ports.now() >= waitEnds) {
10247
+ stopAndAwaitExit(supervisorPid, doorProtocol, reason, `the front door (pid ${String(supervisorPid)}) did not act on a request to hand its listeners over, and did not exit when asked to`);
10248
+ return;
10249
+ }
10250
+ ports.sleep(FRONTDOOR_LAUNCHER_POLL_MS);
10251
+ }
10252
+ };
10198
10253
  for (; ; ) {
10199
10254
  const state = readFrontDoorState(ports.fs, paths.frontdoorStateFile);
10200
10255
  const supervisorPid = state?.supervisorPid;
@@ -10208,12 +10263,16 @@ function ensureFrontDoor(params) {
10208
10263
  const verdict = verifyWithRetry(state.port);
10209
10264
  const doorProtocol = state.protocol ?? 0;
10210
10265
  if (verdict.ok && !replaced && !spawned && (params.replace !== void 0 || doorProtocol < FRONT_DOOR_PROTOCOL)) {
10211
- stopAndAwaitExit(
10212
- supervisorPid,
10213
- doorProtocol,
10214
- params.replace ?? "protocol-older",
10215
- `the front door (pid ${String(supervisorPid)}, protocol ${String(doorProtocol)}; this launcher speaks protocol ${String(FRONT_DOOR_PROTOCOL)}) was asked to be replaced and did not exit`
10216
- );
10266
+ if (params.replace !== void 0 && doorProtocol >= FRONT_DOOR_HANDOVER_PROTOCOL && ports.requestHandover !== void 0 && ports.isFrontDoorSupervisor(supervisorPid)) {
10267
+ handOverAndAwait(supervisorPid, doorProtocol, params.replace, ports.requestHandover);
10268
+ } else {
10269
+ stopAndAwaitExit(
10270
+ supervisorPid,
10271
+ doorProtocol,
10272
+ params.replace ?? "protocol-older",
10273
+ `the front door (pid ${String(supervisorPid)}, protocol ${String(doorProtocol)}; this launcher speaks protocol ${String(FRONT_DOOR_PROTOCOL)}) was asked to be replaced and did not exit`
10274
+ );
10275
+ }
10217
10276
  replaced = true;
10218
10277
  continue;
10219
10278
  }
@@ -10265,7 +10324,7 @@ function ensureFrontDoor(params) {
10265
10324
  if (ports.now() >= deadline) {
10266
10325
  const lastError = state?.lastError;
10267
10326
  throw new FrontDoorStartError(
10268
- `the front door did not become ready within ${String(FRONTDOOR_START_TIMEOUT_MS)}ms` + (lastError === void 0 ? "" : ` (last error: ${lastError})`) + (lastRejection === void 0 ? "" : ` (${lastRejection})`) + (busyDoor === void 0 ? "" : `. It was not replaced because ${String(busyDoor.sessions)} live session(s) are using it and would lose their connections; run \`agent-shim frontdoor restart\` to replace it deliberately`) + `. Daemon log: ${paths.frontdoorLogPath}`
10327
+ `the front door did not become ready within ${String(deadline - startedAt)}ms` + (lastError === void 0 ? "" : ` (last error: ${lastError})`) + (lastRejection === void 0 ? "" : ` (${lastRejection})`) + (busyDoor === void 0 ? "" : `. It was not replaced because ${String(busyDoor.sessions)} live session(s) are using it and would lose their connections; run \`agent-shim frontdoor restart\` to replace it deliberately`) + `. Daemon log: ${paths.frontdoorLogPath}`
10269
10328
  );
10270
10329
  }
10271
10330
  ports.sleep(FRONTDOOR_LAUNCHER_POLL_MS);
@@ -11908,6 +11967,12 @@ function realEnsurePorts(paths, spawnDaemon) {
11908
11967
  killSupervisor: (pid) => {
11909
11968
  process.kill(pid, "SIGKILL");
11910
11969
  },
11970
+ // Windows has no user signals (Node refuses to send one), so a replacement there keeps the stop-and-start path.
11971
+ ...process.platform === "win32" ? {} : {
11972
+ requestHandover: (pid) => {
11973
+ process.kill(pid, "SIGUSR2");
11974
+ }
11975
+ },
11911
11976
  // Read fresh for each probe: a replacement supervisor may have regenerated an unparseable CA, and the probe must trust exactly what the serving door's leaf chains to.
11912
11977
  verifyListener: (port) => probeFrontDoorSync(port, fs13.readFileSync(paths.frontdoorCaCertFile, "utf8"))
11913
11978
  };
@@ -14337,7 +14402,7 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
14337
14402
  function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
14338
14403
  const plainAgent = new ExemptHttpAgent(ports);
14339
14404
  const tlsAgent = new ExemptTlsAgent(ports);
14340
- const listenOnce = async (port, onSocket) => await new Promise((resolve, reject) => {
14405
+ const listenOnce = async (target, onSocket) => await new Promise((resolve, reject) => {
14341
14406
  const accepted = /* @__PURE__ */ new Set();
14342
14407
  const server = net2.createServer((socket) => {
14343
14408
  accepted.add(socket);
@@ -14347,7 +14412,7 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
14347
14412
  onSocket(socket);
14348
14413
  });
14349
14414
  server.once("error", reject);
14350
- server.listen(port, "127.0.0.1", () => {
14415
+ const onListening = () => {
14351
14416
  const address = server.address();
14352
14417
  const bound = typeof address === "object" && address !== null ? address.port : 0;
14353
14418
  if (bound === 0) {
@@ -14356,6 +14421,7 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
14356
14421
  }
14357
14422
  resolve({
14358
14423
  port: bound,
14424
+ listening: server,
14359
14425
  // The listening socket is released by `close` at once; the connections already accepted are untouched and keep the server's `close` callback pending until they end.
14360
14426
  stopAccepting: () => {
14361
14427
  server.close();
@@ -14371,10 +14437,19 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
14371
14437
  });
14372
14438
  }
14373
14439
  });
14374
- });
14440
+ };
14441
+ if (typeof target === "number") {
14442
+ server.listen(target, "127.0.0.1", onListening);
14443
+ } else {
14444
+ server.listen(target, onListening);
14445
+ }
14375
14446
  });
14376
14447
  return {
14377
- listenLoopback: async (preferredPort, onSocket) => {
14448
+ listenLoopback: async (source, onSocket) => {
14449
+ if ("inherit" in source) {
14450
+ return await listenOnce(await source.inherit(), onSocket);
14451
+ }
14452
+ const { preferredPort } = source;
14378
14453
  if (preferredPort !== void 0) {
14379
14454
  try {
14380
14455
  return await listenOnce(preferredPort, onSocket);