import type { Channel } from "./channel.js"; import { type ClientKind } from "./protocol.js"; import { type SessionState } from "./sessionRules.js"; export type SessionTimers = { set(fire: () => void, ms: number): unknown; clear(handle: unknown): void; }; export type SessionChannelOptions = { now?: () => number; /** The lease timer; a test injects a fake clock. The default is * `setTimeout`, unreferenced, so a held session never keeps a * finished program alive on its own. */ timers?: SessionTimers; /** What the driver's `keepAlive` does: with no socket of its own to * hold, the session refs the server while a request is pending. */ keepAlive?: (on: boolean) => void; /** Where the lease's line goes; the program's stderr by default. */ log?: (line: string) => void; }; export type SessionChannel = Channel & { /** A connection that sent `client` with this kind. */ admit(channel: Channel, kind: ClientKind): void; state(): SessionState; /** End the session: every party's channel is closed and the driver's * side sees the channel close. */ end(): void; }; export declare function sessionChannel(options?: SessionChannelOptions): SessionChannel;