@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
30 lines • 1.57 kB
TypeScript
import { type SessionWriteGrant } from "./session-worker-protocol.ts";
/** What a worker still writes: the paths of its live session writers plus its current session path. */
export interface LiveWorkerPaths {
readonly livePaths: readonly string[];
readonly sessionPath?: string;
}
/** Wire code each denial is reported with; distinct so clients can retry only the retryable one. */
export declare const RESERVATION_DENIAL_CODES: {
readonly conflict: "session_path_in_use";
readonly limit: "session_reservation_limit";
};
/**
* Canonical session-path ownership for the shared host: one path, one worker handle.
*
* A grant lives as long as the writer that holds it. Reconciliation against a worker's
* reported live writers releases superseded paths, so a session replaced by /new, /resume
* or /fork no longer keeps its previous file hostage or spends the per-worker budget.
*/
export declare class SessionPathReservations {
private readonly owners;
owner(path: string): string | undefined;
count(handle: string): number;
/** Grants `path` to `handle`; at the budget cap, the live view first releases superseded paths. */
reserve(handle: string, path: string, live?: LiveWorkerPaths): SessionWriteGrant;
/** Releases every path of `handle` that none of its live writers owns anymore. */
reconcile(handle: string, live: LiveWorkerPaths): void;
/** Drops the whole budget of a handle; only a real worker exit may call this. */
releaseAll(handle: string): void;
}
//# sourceMappingURL=session-path-reservations.d.ts.map