UNPKG

@code-yeongyu/senpi

Version:

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

26 lines • 1.66 kB
import type { Duplex } from "node:stream"; import type { RpcConnectionSink } from "./connection-handler.ts"; import type { SocketClosingCode } from "./socket-closing.ts"; export interface HostConnection { readonly id: string; readonly sink: RpcConnectionSink; readonly socket: Duplex; readonly detach: () => void; /** RULING-124: every host close names its reason; a compact peer is told before its socket closes. */ readonly close: (code: SocketClosingCode) => Promise<void>; } /** * The deadline of a socket host's shutdown, counted from its start (the SIGTERM handler) to the forced close of its last * connection. It includes `router.dispose()`, which is not bounded on POSIX (#5398): a session that does not settle can * spend this budget, and the stop window, before the connection phase begins. */ export declare const HOST_SHUTDOWN_BUDGET_MS: number; /** * The connection phase of a socket host's shutdown, after its sessions closed: each connection drains its own queue, * then is announced and closed (`host_shutdown`), independently of the others, so a peer that never reads holds only * itself; then every connection detaches. All waits share one deadline, `startedAt` plus the budget, and a socket still * open then (its half-close grace not yet spent) is destroyed at it: the grace is min(SOCKET_CUT_GRACE_MS, remaining * budget). Returns the force's cancel. */ export declare function closeHostConnections(connections: readonly HostConnection[], drain: (id: string) => Promise<void>, startedAt: number, log: (message: string) => void): Promise<() => void>; //# sourceMappingURL=host-shutdown-connections.d.ts.map