UNPKG

@code-yeongyu/senpi

Version:

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

40 lines • 2.06 kB
import { type HostToSessionWorker, type SessionWorkerToHost } from "./session-worker-protocol.ts"; type Request = Extract<HostToSessionWorker, { request: number; }>; type Reply = Extract<SessionWorkerToHost, { request: number; }>; export type WorkerRequestInput = Request extends infer T ? (T extends Request ? Omit<T, "request"> : never) : never; /** Bounded request debt, with separate admission for interrupt and extension-UI responses. */ export declare class SessionWorkerRequests { private readonly pending; private serial; private closed; /** * When the worker's owed, timed answers run out of no-progress budget. Re-armed whenever the worker * starts owing one after owing none, and on every message from it: idle time, when the worker owes * nothing, is never charged (senpi#1719 for the first open, senpi#6452 for a request after a quiet * spell), while a request sent behind another still owed shares that answer's deadline. */ private progressDeadline; private readonly send; private readonly timeout; constructor(send: (message: Request) => void, timeout: () => void); /** * Any inbound worker message shows the request pipeline is alive: a request that merely runs long * under load is not a dead worker, so the no-progress deadline restarts instead of quarantining the * session (senpi#6452). The timeout VALUE is unchanged; only a worker that stops answering at all * reaches it. Interrupt and extension-UI timers keep their own `controlMs` bound from send: an abort * the worker never answers is cut even while the worker streams other messages. */ noteProgress(): void; /** What is left of the no-progress budget for a new timed request; a worker that owed nothing starts afresh. */ private progressBudgetMs; get activeCount(): number; request(message: WorkerRequestInput): Promise<Reply>; receive(message: Reply): void; close(error: Error): void; } export {}; //# sourceMappingURL=session-worker-requests.d.ts.map