@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
39 lines • 1.93 kB
TypeScript
import { type OwnBootReader } from "./extensions/builtin/terminal/process-identity.ts";
export interface WriterClaim {
readonly generation: number;
readonly nonce: string;
/** The machine the writer ran on: its pid, boot and start time mean nothing on another host. */
readonly host: string;
readonly pid: number;
readonly bootAtMs: number;
readonly processStartedAtMs: number;
readonly canonicalPath: string;
}
export interface WriterProbes {
readonly pidAlive: (pid: number) => boolean;
readonly readProcessStartMs: (pid: number) => Promise<number | undefined>;
readonly bootAtMs: OwnBootReader;
readonly host: () => string;
readonly self: () => {
readonly pid: number;
readonly processStartedAtMs: number;
};
}
export declare class SessionWriterBusyError extends Error {
readonly code = "session_writer_busy";
readonly holder: WriterClaim;
constructor(holder: WriterClaim);
}
export declare class SessionWriterClaimError extends Error {
readonly code = "session_writer_claim_invalid";
constructor(message: string);
}
export declare const realWriterProbes: WriterProbes;
export declare function writerClaimsDir(sessionFile: string, sessionId: string): string;
/** Takes the next writer generation, only after proving the current owner can no longer write (senpi#3549). */
export declare function acquireWriterClaim(dir: string, canonicalPath: string, probes?: WriterProbes): Promise<WriterClaim>;
/** True only while `claim` is still the newest generation and has not been released. */
export declare function writerClaimIsCurrent(dir: string, claim: WriterClaim): Promise<boolean>;
/** Publishes the nonce-matched release marker; call only once nothing can append, consume or dispatch. */
export declare function releaseWriterClaim(dir: string, claim: WriterClaim): Promise<void>;
//# sourceMappingURL=session-writer-claims.d.ts.map