UNPKG

@code-yeongyu/senpi

Version:

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

31 lines • 1.92 kB
/** * Which sessions have an agent run in progress, from the host child's events. A run emits * `agent_start` on every loop iteration (a provider retry, a post-compaction continue, a follow-up) * but `agent_settled` once, so this tracks runs, not starts: a repeated start for a running session * changes nothing. A session that closes is dropped even if its settle never arrives (#2713). A settled run holds idle * exit until `agent_idle`, because its extension agent_settled handlers may still be running, but only for a bounded * hold, so a handler that never resolves cannot keep the host alive (omo#11419). */ export interface SessionRunActivityOptions { /** * How long a settled session whose extension agent_settled handlers have not finished may hold idle exit. Bounded, * so one handler that never resolves cannot keep the host alive forever; the supervisor uses its idle window. */ readonly settleHoldMs?: number; readonly now?: () => number; /** Told once when a settled session stops holding idle exit while its handlers are still pending. */ readonly onSettleHoldExpired?: (sessionId: string, heldMs: number) => void; } export declare class SessionRunActivity { #private; constructor(options?: SessionRunActivityOptions); /** Applies one host event line; true when it is a run or session event the idle decision must re-read. */ observe(line: string): boolean; /** Sessions with a run in progress. */ get busySessions(): number; /** Settled sessions whose agent_settled handlers may still run, within the settle hold. */ get settlingSessions(): number; } /** An idle window that ran out still waits while a settled session's handlers are within their hold (omo#11419). */ export declare function holdIdleExitForSettling<T extends string>(decision: T, runs: SessionRunActivity): T | "idle"; //# sourceMappingURL=host-run-activity.d.ts.map