@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
33 lines • 2.24 kB
TypeScript
import type { SDKMessage, SDKUserMessage } from "./sdk-boundary.ts";
import { type AnthropicSubscriptionSessionEntry, type AnthropicSubscriptionSessionRegistry } from "./session-registry.ts";
import type { PreReplayBufferLimits, SessionTurnResult } from "./session-turn-types.ts";
export type { SessionTurnResult } from "./session-turn-types.ts";
export declare const DEFAULT_PRE_REPLAY_MAX_MESSAGES = 64;
export declare const DEFAULT_PRE_REPLAY_MAX_BYTES: number;
export declare const SESSION_TURN_ABORT_GRACE_MS = 1000;
/**
* How long a turn submitted while the previous turn of the same session is still active waits for that turn to
* settle before the submission is refused. The common case settles within the abort grace above: the agent loop
* starts the next turn (a steer, a follow-up, a monitor notification) right after it interrupted or finished
* consuming the previous one, while the pump still waits for the SDK's terminal result of that turn.
*/
export declare const SESSION_TURN_ADMISSION_WAIT_MS = 10000;
export interface SessionTurnRequest {
message: SDKUserMessage["message"];
signal?: AbortSignal;
onMessage?: (message: SDKMessage) => void;
writable?: () => Promise<void>;
scheduleAbort?: (callback: () => void, delayMs: number) => () => void;
}
export declare class ConcurrentSessionTurnAdmissionError extends Error {
readonly code = "claude_sdk_oauth_concurrent_turn_admission";
constructor(sessionId: string);
}
/**
* Waits for `settled`, bounded by SESSION_TURN_ADMISSION_WAIT_MS: "admitted" once it settles, "aborted" when
* `signal` aborts first, and a ConcurrentSessionTurnAdmissionError when the bound passes, so a stuck pump cannot
* hold the session's callers forever.
*/
export declare function waitForTurnAdmission(sessionId: string, settled: Promise<unknown>, signal: AbortSignal | undefined, schedule?: (callback: () => void, delayMs: number) => () => void): Promise<"admitted" | "aborted">;
export declare function submitSessionTurn(registry: AnthropicSubscriptionSessionRegistry, entry: AnthropicSubscriptionSessionEntry, request: SessionTurnRequest, limits?: PreReplayBufferLimits): Promise<SessionTurnResult>;
//# sourceMappingURL=session-registry-pump.d.ts.map