UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

38 lines • 1.87 kB
/** * A socket host's answer to `watch_host_occupancy` (oh-my-openagent#14272): how many of its attached connections * still occupy it, sent to every watcher at once and again whenever the number changes. A connection occupies the * host while it holds a session, has an open or a command in flight, or has never held a session at all (an * ensure's attach hold, a client that has not opened yet). One whose sessions have all closed stops counting, so a * parent that keeps its shard connection after its last session does not keep a 0-session host alive. * * A watcher is the supervisor's observer link; while one is connected the host's own empty exit stays with the * supervisor (`watching`). */ export interface HostOccupancyWatchPorts { readonly connections: () => Iterable<string>; /** Attached by the occupancy rule: not an observer, not one of this host's own sessions (`host-client-occupancy.ts`). */ readonly attached: (connection: string) => boolean; readonly holdsSessions: (connection: string) => boolean; readonly send: (connection: string, record: { readonly type: string; readonly holders: number; }) => void; } export declare class HostOccupancyWatch { private readonly watchers; private readonly inFlight; /** Connections that held a session here at least once: only these stop counting once they hold nothing. */ private readonly heldOnce; private reported; private readonly ports; constructor(ports: HostOccupancyWatchPorts); get watching(): boolean; watch(connection: string): void; /** A command from `connection` started; it holds the host until `end`. */ begin(connection: string): void; end(connection: string): void; forget(connection: string): void; refresh(): void; private holders; } //# sourceMappingURL=host-occupancy-watch.d.ts.map