@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
42 lines • 2.35 kB
TypeScript
/**
* The supervisor's view of its public-socket clients, split by what they mean for idle exit. A socket
* host applies the same view to its own connections for its empty-exit window.
*
* A client is UNCLASSIFIED until its first request line arrives, an OBSERVER while every line it has
* sent is an observing read (`host-observe-request.ts`), and ATTACHED from the first line that is
* anything else - or from a first line too long to be a read. Only attached clients are occupancy.
* A client whose first such line names this host's own generation as its origin is DEPENDENT
* instead (`host-observe-request.ts`): one of the host's own sessions, which never holds it open.
* An unclassified client neither counts nor lets the host exit: its first line may be the readiness
* probe of an ensure that is about to open a session.
* An observer that takes a hold (`hold_host: true` on an observing read, senpi#5626) is HELD: it counts as
* occupancy, and taking the hold resets the idle window, until it releases (`hold_host: false`) or leaves.
* Where the host reports how many attached connections still occupy it (`occupancy(holders)`,
* oh-my-openagent#14272), an attached client whose sessions there have all closed no longer counts.
*/
import type { Duplex } from "node:stream";
export declare class ClientOccupancy {
private readonly clients;
private readonly observers;
private readonly attached;
private readonly held;
private readonly dependents;
private readonly onAttach;
private readonly ownInstance;
private closed;
constructor(onAttach: () => void, ownInstance?: string);
/** Occupancy: attached clients plus observers holding the host. */
get attachedCount(): number;
/**
* Occupancy when the host reported `sessionHolders` (its attached connections that still occupy it): held observers
* plus at most that many attached clients. Unreported, every attached client counts.
*/
occupancy(sessionHolders: number | undefined): number;
isAttached(client: Duplex): boolean;
get unclassifiedCount(): number;
admit(client: Duplex): boolean;
/** Returns whether this peer left without ever proving it was an observing read. */
release(client: Duplex): boolean;
destroyAll(): void;
}
//# sourceMappingURL=host-client-occupancy.d.ts.map