@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
29 lines • 1.74 kB
TypeScript
import { SessionHeldError, type SessionHolder, type SessionHolderEndpoint, SessionMovedError, SessionMovingError } from "./session-hold-errors.ts";
import { type HolderGeneration, type SessionHolderProbes } from "./session-holder-records.ts";
export { type HolderGeneration, SessionHeldError, type SessionHolder, type SessionHolderProbes, SessionMovedError, SessionMovingError, };
export interface SessionHold {
release(): void;
}
/**
* Publishes this process as a holder of `sessionFile` until `release()`. Throws `SessionMovingError`
* while another process is moving the session, and `SessionMovedError` when a session that was read
* from disk (`expectExisting`) is gone, so nothing is ever appended to a path the session left.
*/
export declare function holdSessionFile(sessionFile: string, sessionId: string, options: {
readonly cwd?: string;
readonly expectExisting: boolean;
readonly holderEndpoint?: SessionHolderEndpoint;
}): SessionHold;
/**
* Live processes that have `sessionFile` open right now (stale records of dead or reused pids are
* reclaimed on the way). A caller about to start another writer uses it to wait instead of racing one.
*/
export declare function liveSessionHolders(sessionFile: string, sessionId: string, probes?: SessionHolderProbes): Promise<SessionHolder[]>;
/**
* Runs `move` holding the session's move lock, after proving no live process holds the session.
* Waits up to `waitMs` for a concurrent move to finish, then fails with `SessionMovingError`.
*/
export declare function withSessionMoveLock<T>(sessionFile: string, sessionId: string, move: () => T | Promise<T>, options?: {
readonly waitMs?: number;
}): Promise<T>;
//# sourceMappingURL=session-holders.d.ts.map