@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
49 lines • 2.85 kB
TypeScript
/** How long any request waits for the host's answer - for an open, for its `queued` acknowledgement. */
export declare const REQUEST_DEADLINE_MS = 30000;
/**
* How long one request may wait for its answer before the client gives up. An awaited abort answers only
* after the turn stopped or its `graceMs` ran out (up to 60 s), so its wait is that grace plus the
* ordinary allowance; every other command keeps the plain request deadline. A `graceMs` the host would
* refuse (out of range, fractional, NaN, Infinity) gets the plain deadline too: the host answers it at once
* with `invalid_argument`, and the client must still be listening for that refusal.
*/
export declare function requestDeadlineMs(command: {
readonly type: string;
readonly awaitIdle?: unknown;
readonly graceMs?: unknown;
}): number;
/** Remote compaction may exhaust its budget before a local summary uses its maximum override. */
export declare const PROMPT_COMPACTION_DEADLINE_MS: number;
/**
* The longest a prompt waits for its acknowledgement, however many compactions start and end while it
* is pending: one full compaction budget plus the ordinary allowance it may already have spent first.
*/
export declare const PROMPT_ACK_MAX_WAIT_MS: number;
/**
* How long an open the host acknowledged with `queued` may take to answer. The host is building the
* session on its loop, which on a loaded in-process host was measured at ~57 s; a lost transport
* still rejects at once, so this ceiling only bounds a host that accepted and then went silent
* (senpi#2209).
*/
export declare const OPEN_AFTER_QUEUED_DEADLINE_MS: number;
/**
* How long a prompt the host acknowledged as received may take to be accepted. Its preflight runs on the
* session's loop, which on a starved shared host outlived the 30 s request deadline: the client gave up,
* discarded the session, and the host answered into its closed scope (senpi#2871). A lost transport still
* rejects at once; this only bounds a host that received the prompt and then went silent.
*/
export declare const PROMPT_AFTER_QUEUED_DEADLINE_MS: number;
export declare function promptStalledMessage(): string;
export declare function openStalledMessage(position: unknown): string;
/** A request the host did not answer within its deadline: the host is not responding on this connection. */
export declare class RpcRequestTimeoutError extends Error {
readonly code: "rpc_request_timeout";
constructor(message: string);
}
export interface RequestDeadline {
/** Restarts the wait with a new budget and the message it fails with. */
extend(ms: number, message: () => string): void;
clear(): void;
}
export declare function armRequestDeadline(ms: number, message: () => string, expire: (error: Error) => void): RequestDeadline;
//# sourceMappingURL=rpc-request-deadline.d.ts.map