@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
44 lines • 2.04 kB
TypeScript
export declare const SESSION_SPAWNS_DIR = "session-spawns";
declare const RECORD_VERSION = 1;
export interface SessionSpawnRecord {
readonly version: typeof RECORD_VERSION;
readonly pid: number;
readonly startedAtMs: number;
/** The boot `startedAtMs` is relative to; null where it is a wall-clock stamp (darwin). */
readonly bootId: string | null;
readonly sessionId: string;
readonly hostPid: number;
readonly hostStartedAtMs: number;
}
export type PidSession = {
readonly attested: true;
readonly pid: number;
readonly sessionId: string;
/** The recorded child on `pid`'s ancestry (`pid` itself when it is that child). */
readonly attestedPid: number;
/** The process that spawned `attestedPid` and wrote its record. */
readonly hostPid: number;
/** `pid` up to `attestedPid`, child first. */
readonly chain: readonly number[];
} | {
readonly attested: false;
readonly pid: number;
readonly reason: "process_not_found" | "no_attested_ancestor";
};
export interface SessionSpawnAttestation {
/** Settles once the record is written; false when the child could not be identified (already gone). */
readonly recorded: Promise<boolean>;
/** Removes the record; call it once the child exited. */
release(): Promise<void>;
}
export interface SessionSpawnStoreOptions {
/** The record directory. Default: `<agentDir>/session-spawns`. */
readonly dir?: string;
}
export declare function sessionSpawnsDir(agentDir?: string): string;
/** Records that `pid`, a child this process just spawned, runs for `sessionId`. Never throws. */
export declare function attestSessionSpawn(sessionId: string, pid: number, options?: SessionSpawnStoreOptions): SessionSpawnAttestation;
/** Which session owns `pid`, from the kernel's ancestry and the spawners' records. Never throws. */
export declare function resolvePidSession(pid: number, options?: SessionSpawnStoreOptions): Promise<PidSession>;
export {};
//# sourceMappingURL=session-spawn-attestation.d.ts.map