claude-use 11.48.0 → 11.49.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.
@@ -2281,6 +2281,8 @@ interface LayoutPaths {
2281
2281
  readonly frontdoorSessionsDir: string;
2282
2282
  /** Directory holding one `<supervisor-pid>.json` per live front door, recording that door's own direct port: every door still serving sessions forwards its headroom traffic back to its own direct origin, so headroom must admit each of them, not only the one `state.json` names. */
2283
2283
  readonly frontdoorDirectRecordsDir: string;
2284
+ /** Directory holding one empty marker file per front door that has released its addresses and is finishing the connections it carried, named by its supervisor pid. */
2285
+ readonly frontdoorDrainingDir: string;
2284
2286
  /**
2285
2287
  * Directory holding one `<cse-session-id>.json` Remote Control client credential per observed session, mode 0700 with 0600 files: the OAuth-kind bearer and protocol headers the door replays as the session's attached client, persisted so a door generation that starts after a session's create can still attach. The same secret the identity's own store holds, at the same owner-only protection.
2286
2288
  */
@@ -3194,6 +3196,8 @@ type ConnectRequestHandler = (request: IncomingMessage, response: ServerResponse
3194
3196
  /** A bound loopback listener and how to stop it. */
3195
3197
  interface ConnectListenerHandle {
3196
3198
  readonly port: number;
3199
+ /** Stops accepting and releases the port at once, leaving every connection already accepted open: a successor can bind the same port while they finish. */
3200
+ readonly stopAccepting: () => void;
3197
3201
  /** Stops accepting, ends every live connection, and resolves once the port is released. */
3198
3202
  readonly close: () => Promise<void>;
3199
3203
  }
@@ -3277,6 +3281,12 @@ interface ConnectServerHandle {
3277
3281
  readonly port: number;
3278
3282
  /** The transparent listener's port, when one was requested: what an operating-system redirect should point at. */
3279
3283
  readonly transparentPort?: number;
3284
+ /** How many authenticated connections (blind tunnels and terminated sessions together) are open now: what closing this surface, or exiting its process, drops. */
3285
+ readonly openTunnels: () => number;
3286
+ /**
3287
+ * Retires the surface without cutting off the tunnels it carries: the port is released at once so a successor can bind it, every connection that is not a blind tunnel (the terminated sessions, which carry this door's own routing state, and connections still waiting for their head) is ended, and the blind tunnels, which are byte pumps to hosts the door never looks into, keep running until they end by themselves or their launch ends. Resolves when the last has, with the surface fully closed.
3288
+ */
3289
+ readonly drain: () => Promise<void>;
3280
3290
  /** Stops the listener, drops every live tunnel and terminated session, and resolves once the port is released. */
3281
3291
  readonly close: () => Promise<void>;
3282
3292
  }
@@ -4192,7 +4202,7 @@ interface RcStreamHubDeps {
4192
4202
  interface RcStreamHub {
4193
4203
  /** Reconciles the attachments against the tracker: attaches a stream to every tracked session whose OAuth credential is known, and drops an attachment whose session has expired or lost its credential. Idempotent, synchronous and total (never throws): the door calls it after every observed Remote Control exchange, so an attachment follows the session it belongs to without any polling of its own. */
4194
4204
  readonly reconcile: () => void;
4195
- /** Stops every attachment and frees their dials. */
4205
+ /** Stops every attachment and frees their dials. The hub then refuses to attach again: a later `reconcile` is a no-op, so an exchange that settles after the close cannot start a stream. */
4196
4206
  readonly close: () => void;
4197
4207
  }
4198
4208
  /** Creates the attachment hub. One per door process; everything it holds dies with it. */
@@ -5831,6 +5841,8 @@ interface RunDoctorParams {
5831
5841
  readonly supervisors: FrontDoorSupervisorListing;
5832
5842
  /** The launches registered with the front door whose launcher is still running, each naming the door it was sent to: what tells a superseded door still serving its launches from one serving nothing. */
5833
5843
  readonly liveSessions: readonly FrontDoorSessionSummary[];
5844
+ /** The supervisors that released their addresses and are finishing the connections they carried: running by design, not duplicates. Omit when the platform cannot say. */
5845
+ readonly draining?: readonly number[];
5834
5846
  /** What probing the serving door's listeners found: empty when no door serves or the platform cannot say. Omit to skip the listener checks. */
5835
5847
  readonly listeners?: readonly FrontDoorListenerReading[];
5836
5848
  };
@@ -8436,6 +8448,8 @@ interface FrontDoorSessionStatus extends FrontDoorSessionSummary {
8436
8448
  interface FrontDoorStatus {
8437
8449
  readonly state: FrontDoorState;
8438
8450
  readonly supervisorAlive: boolean;
8451
+ /** The pids of earlier doors that released their addresses and are finishing the connections they carried, found from the marker each writes when it begins to drain: running, but not the serving door. */
8452
+ readonly draining: readonly number[];
8439
8453
  readonly sessions: readonly FrontDoorSessionStatus[];
8440
8454
  /** The headroom daemon's socket as the door's hop reads and authenticates it live: undefined when no socket is recorded, a refusal when the recorded one fails the owner-only check. */
8441
8455
  readonly headroomSocket: HeadroomSocketTarget | undefined;
@@ -8691,6 +8705,7 @@ declare function createControlApiRouter(deps: ControlApiDeps): {
8691
8705
  lastError: zod.ZodOptional<zod.ZodString>;
8692
8706
  }, zod_v4_core.$strict>;
8693
8707
  supervisorAlive: zod.ZodBoolean;
8708
+ draining: zod.ZodReadonly<zod.ZodArray<zod.ZodNumber>>;
8694
8709
  sessions: zod.ZodReadonly<zod.ZodArray<zod.ZodObject<{
8695
8710
  pid: zod.ZodInt;
8696
8711
  startedAt: zod.ZodNumber;
@@ -9126,6 +9141,7 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
9126
9141
  lastError: zod.ZodOptional<zod.ZodString>;
9127
9142
  }, zod_v4_core.$strict>;
9128
9143
  supervisorAlive: zod.ZodBoolean;
9144
+ draining: zod.ZodReadonly<zod.ZodArray<zod.ZodNumber>>;
9129
9145
  sessions: zod.ZodReadonly<zod.ZodArray<zod.ZodObject<{
9130
9146
  pid: zod.ZodInt;
9131
9147
  startedAt: zod.ZodNumber;
@@ -13392,6 +13408,7 @@ declare const FrontDoorStatusOutputSchema: z.ZodObject<{
13392
13408
  lastError: z.ZodOptional<z.ZodString>;
13393
13409
  }, z.core.$strict>;
13394
13410
  supervisorAlive: z.ZodBoolean;
13411
+ draining: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
13395
13412
  sessions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
13396
13413
  pid: z.ZodInt;
13397
13414
  startedAt: z.ZodNumber;
@@ -13901,6 +13918,16 @@ declare function readRcSelfHostRecord(fs: Pick<FarmFs, "readFileUtf8">, frontdoo
13901
13918
  */
13902
13919
  declare function mintRcSelfHostCredential(deps: RcSelfHostMintDeps): RcSelfHostMintResult;
13903
13920
 
13921
+ /**
13922
+ * Why a launcher asked a running front door to exit. A closed set, so a log line can be grouped by it and a new cause has to be named here before it can be sent:
13923
+ *
13924
+ * `restart-command` is `agent-shim frontdoor restart`; `update-restart` is the restart `agent-shim update --restart-door` makes after installing a new binary; `protocol-older` is a launch finding a door that speaks an older protocol than its own; `probe-failed-restart` is a restart that found the door not answering; `probe-failed-idle` is a launch that found the door not answering while no other session was registered against it.
13925
+ */
13926
+ declare const REPLACEMENT_REASONS: readonly ["restart-command", "update-restart", "protocol-older", "probe-failed-restart", "probe-failed-idle"];
13927
+ type ReplacementReason = (typeof REPLACEMENT_REASONS)[number];
13928
+ /** The reasons a caller may ask for a deliberate replacement with, as opposed to the ones a launch finds for itself. */
13929
+ type RequestedReplacementReason = Extract<ReplacementReason, "restart-command" | "update-restart">;
13930
+
13904
13931
  /** Raised when the front door cannot be brought up in time or has recorded a fatal error: a routed launch has no other way to reach its provider, so it must fail rather than start a session that can never answer. */
13905
13932
  declare class FrontDoorStartError extends CliError {
13906
13933
  constructor(message: string);
@@ -13918,6 +13945,8 @@ interface EnsureFrontDoorPorts {
13918
13945
  readonly verifyListener: (port: number) => ListenerVerdict;
13919
13946
  /** Asks a running front-door supervisor to exit, without waiting for it to: the caller polls `isRunning`. Only ever called for a pid whose recorded listener has just authenticated as agent-shim's own, or whose process is agent-shim's front-door supervisor (`isFrontDoorSupervisor`). */
13920
13947
  readonly stopSupervisor: (pid: number) => void;
13948
+ /** Appends one line to the front door's own log. Called before every signal sent to a door, so the door's log names the cause of its own exit. */
13949
+ readonly recordReplacement: (line: string) => void;
13921
13950
  /** Ends a supervisor that did not exit when asked to, without giving it the chance to refuse: a door whose event loop is blocked never runs its signal handler. Called only for a pid `isFrontDoorSupervisor` has just confirmed, after `stopSupervisor` and a grace period. */
13922
13951
  readonly killSupervisor: (pid: number) => void;
13923
13952
  /** Whether `pid` is a live agent-shim front-door supervisor process, read from the process's own command line. This is what separates a wedged door of this tool, which a replacement must retire so the two never coexist, from an unrelated process that reuses the recorded pid, which must never be signalled. */
@@ -13932,8 +13961,8 @@ declare function ensureFrontDoor(params: {
13932
13961
  readonly paths: LayoutPaths;
13933
13962
  readonly launcherPid: number;
13934
13963
  readonly ports: EnsureFrontDoorPorts;
13935
- /** Replaces a serving door whatever its protocol, once: the restart a binary update asks for, so the new generation serves the sessions already running without waiting for the registry to empty. */
13936
- readonly replace?: boolean;
13964
+ /** Replaces a serving door whatever its protocol, once, and names why: `update-restart` is the restart a binary update asks for, so the new generation serves the sessions already running without waiting for the registry to empty, and `restart-command` is the deliberate `frontdoor restart`. */
13965
+ readonly replace?: RequestedReplacementReason;
13937
13966
  /** What this launch tells the door about itself beyond its token: the id its requests carry in their session header, and the models block it resolved when it added definitions of its own to the global one. Recorded in the launch's registry entry, so it lives and is pruned with the launch. */
13938
13967
  readonly session?: FrontDoorSessionDetails;
13939
13968
  }): {
@@ -13955,6 +13984,8 @@ interface FrontDoorListenerHandle {
13955
13984
  readonly port: number;
13956
13985
  /** Stops accepting, ends every live connection, and resolves once the port is released. */
13957
13986
  readonly close: () => Promise<void>;
13987
+ /** Releases the port at once (before the first await) and leaves the work already in progress to finish; resolves when the listener has nothing left to carry. */
13988
+ readonly drain: () => Promise<void>;
13958
13989
  }
13959
13990
  /**
13960
13991
  * The file identity of the executable this supervisor was spawned from, everything that distinguishes one installed binary from its replacement at the same path: `agent-shim update` installs by rename, so a newer release on disk is a different inode there, and the turnover check is a plain identity comparison rather than a version query (which would mean spawning a subprocess once per tick).
@@ -13992,13 +14023,19 @@ interface FrontDoorSupervisorPorts {
13992
14023
  */
13993
14024
  readonly startDirectListener: (preferredPort: number | undefined) => Promise<FrontDoorListenerHandle>;
13994
14025
  /**
13995
- * Stops the Remote Control stream hub: persists every live attachment's sequence cursor synchronously, then frees the dials. Called exactly once on every exit the supervisor owns, after every listener it started is down (a live listener could still settle an observed Remote Control exchange, and the reconcile that follows would re-attach a stream the close had just ended) and before the final state write and the process's exit.
14026
+ * Stops the Remote Control stream hub: persists every live attachment's sequence cursor synchronously, then frees the dials. Called exactly once on every exit the supervisor owns, after every listener has stopped accepting. A closing exit has every listener down by then; a drain still has responses settling, which is safe because the hub refuses to attach once it is closed (otherwise the reconcile after an observed exchange would re-attach a stream the close had just ended).
13996
14027
  */
13997
14028
  readonly closeRcStreamHub: () => void;
13998
14029
  /**
13999
14030
  * Starts the watchdog that ends this process when its main event loop stops running: it lives on its own thread, so a loop that is blocked cannot stall it. The supervisor beats it every tick and stops it before it begins to retire, so it only ever judges a door that is meant to be serving. Optional because ending the process is only right when the process is the door: the CLI's `__frontdoor-supervisor` supplies it, and a library host that runs the door inside its own process does not get its application killed by default.
14000
14031
  */
14001
14032
  readonly startWatchdog?: () => DoorWatchdog;
14033
+ /**
14034
+ * Aborted when the process is asked to exit (the CLI's `__frontdoor-supervisor` aborts it on its first SIGTERM or SIGINT). The door then retires by draining: it releases its listening addresses at once, so a successor can bind the same sticky ports, ends what holds its own routing state, and stays up only as long as the connections it still carries (blind tunnels, a response being streamed) take to end. Optional for a host that decides when the door stops by other means.
14035
+ */
14036
+ readonly retire?: AbortSignal;
14037
+ /** Stops the work the door runs on its own account rather than for a request (the usage, window, job and catalogue keepers), called once when a drain begins so the successor's are the only ones acting. Optional because a host without such work has nothing to stop. */
14038
+ readonly stopBackgroundWork?: () => void;
14002
14039
  /**
14003
14040
  * Reports one tick's session-registry facts to the door's event backbone: the sessions the tick's listing saw (taken before the prune, so a pruned launch's record is still there to name its start time) and the pids the tick's prune removed. The launch lifecycle publisher turns the diff between ticks into source-tagged events; the listing is also this loop's own idle input, so the two read one fact instead of two.
14004
14041
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "11.48.0",
3
+ "version": "11.49.0",
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>",