@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
47 lines • 2.54 kB
TypeScript
import type { RecoveryRoute } from "./compact-recovery-state.ts";
import type { RecoveryCaller, RecoveryStreamState } from "./compact-recovery-types.ts";
/**
* One peer + session stream (RULING-42 Q2 A): the session incarnation it materializes, its issued generation,
* the admissions routed through it (RULING-46 item 1) and its current token. It lives while both its peer
* incarnation and its routing session do (RULING-56 (2)).
*/
export interface RecoveryStreamRecord {
readonly sessionId: string;
readonly sessionEpoch: string;
readonly generation: number;
readonly routes: ReadonlySet<string>;
readonly current: string | undefined;
}
/**
* The stream records of one host: one per peer incarnation and routing session, replaced by a new session
* incarnation, freed when the peer incarnation or the routing session ends.
*/
export declare class RecoveryStreams {
private readonly streams;
/** Per peer incarnation, each routed admission and how many of its streams route it (a mirror routes several). */
private readonly routed;
get size(): number;
get(caller: RecoveryCaller): RecoveryStreamRecord | undefined;
/** Another ordinary hold joins the installed cut without advancing its generation. */
join(route: RecoveryRoute): void;
/** Whether any stream of the peer incarnation routes the admission (#5274), without walking its sessions. */
routes(socketEpoch: string, admissionId: string): boolean;
/** The bounded description a caller may hold: undefined once its peer incarnation or its session ended. */
describe(caller: RecoveryCaller): RecoveryStreamState | undefined;
/**
* Admits the route's token as the stream's next generation at `sessionEpoch`; a new session incarnation replaces
* the record (carry 37). RULING-99 supplies the session-owned generation; returns the previous current token.
*/
next(route: RecoveryRoute, sessionEpoch: string, tokenId: string, generation: number): {
retired?: string;
};
forgetPeer(socketEpoch: string): void;
/** The routing session ended for good: its record goes on every peer (a sealed handle is never re-attached). */
forgetSession(sessionId: string): void;
/** An admission ended (a detach today; S14 extends this): its route leaves the stream, the counter stays. */
retireRoute(caller: RecoveryCaller, admissionId: string): void;
private addRoute;
private removeRoute;
private drop;
}
//# sourceMappingURL=compact-recovery-streams.d.ts.map