UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

34 lines • 1.99 kB
export { PROCESS_START_TOLERANCE_MS, sameProcessStartMs as sameProcessStart, } from "../../../../utils/process-identity.ts"; /** * Two boot instants further apart than this belong to different boots. Where the kernel's boot record is readable two * processes read the same value; on the `now - os.uptime()` fallback a laptop's sleep is accounted in uptime, so the * only drift left there is whole-second rounding on either side. */ export declare const BOOT_INSTANT_TOLERANCE_MS = 120000; export declare function processBootAtMs(now?: () => number, platform?: NodeJS.Platform): Promise<number>; /** Floored like `ps -o lstart`, which truncates to the second: rounding up could land after now. */ export declare function ownProcessStartedAtMs(now?: () => number): number; export declare function sameBoot(bootAtMs: number, otherBootAtMs: number | undefined): boolean; /** * This process's boot instant: the cached kernel record, or with `fresh` a new read of it that replaces the cache. The * kernel's recorded boot instant moves with a wall-clock step, so a value cached before a step can be stale. */ export type OwnBootReader = (options?: { readonly fresh?: boolean; }) => Promise<number>; export declare const ownBootAtMs: OwnBootReader; /** * Whether `otherBootAtMs` belongs to this machine's current boot. A 'different boot' verdict on the cached record is * checked once more against a fresh read before it stands: after a wall-clock step past the tolerance the cache is * stale while a live peer recorded the moved instant, and calling that peer's lock or claim stale would let a second * owner in. */ export declare function sameBootAsOwn(otherBootAtMs: number | undefined, read?: OwnBootReader): Promise<boolean>; export interface ChildProcessIdentity { readonly pid: number; readonly processGroupId?: number; readonly startedAtMs: number; readonly bootAtMs: number; readonly argv: readonly string[]; } //# sourceMappingURL=process-identity.d.ts.map