/** * What the other sessions on this checkout are doing right now. * * Two KONECK sessions in the same repository cannot see each other's work. One edits a file the * other has just rewritten and the second write silently wins; both run the same test suite, which * on a four-core machine is a hundred and seventy seconds each; one restarts a dev server the other * is using. That is not hypothetical — a dev server on port 3000 was killed here by exactly this * blindness, while another session depended on it. * * The registry in `session-bus` already knows which sessions are alive, with their pids and repos. * What it does not know is what each of them is *touching*. So this is a claim: a session says * "I am writing this file" or "I am running this command" before it does, and any other session * asking about the same target is told who else is on it and how long ago. * * Three decisions worth stating, because each could sensibly have gone the other way: * * It reports rather than blocks. A lock between two agents that each wait for the other is a * deadlock with no user present to break it, and a lock held by a session that dies mid-turn is * worse than no lock. Telling the model "another session wrote this forty seconds ago" lets it * decide — re-read first, work elsewhere, or say so and stop — which is what a person in the same * position would do. * * A claim is evidence, not permission. It carries a pid, so a claim from a session that no longer * exists is discarded on sight rather than trusted because it was recent. * * It is keyed by repository, not by directory. Two sessions in different subdirectories of one * checkout are working on the same code and must see each other; two sessions in unrelated repos * that happen to share a filename must not. */ /** What a session can be in the middle of. */ export type ClaimKind = 'file' | 'command'; export interface Claim { kind: ClaimKind; /** A repo-relative path, or the command line. */ target: string; session: string; /** A name a person would recognise, when the surface has one. Falls back to a short id. */ label?: string; pid: number; /** ISO. Age is the whole point: a claim from an hour ago says something different from one now. */ at: string; /** Set when the work finished, so "is editing" and "edited" are not the same report. */ done?: string; } /** * How long a finished claim is still worth mentioning. * * A file another session wrote a minute ago is a reason to re-read before editing. The same file an * hour ago is just history, and reporting it would train the reader to ignore these. */ export declare const CLAIM_INTEREST_MS: number; /** One file per repository, so unrelated checkouts never see each other's claims. */ export declare function claimsPath(repo: string, home?: string): string; /** Records that this session is starting on something. Returns what else is already on it. */ export declare function claim(repo: string, kind: ClaimKind, target: string, session: string, home?: string, now?: Date, label?: string): Claim[]; /** Marks this session's claim finished, so it becomes "edited" rather than "is editing". */ export declare function release(repo: string, kind: ClaimKind, target: string, session: string, home?: string, now?: Date): void; /** Everything this session had open, finished at once. For the end of a session. */ export declare function releaseAll(repo: string, session: string, home?: string, now?: Date): void; /** Who else is on a target, newest first, without claiming it. */ export declare function whoElse(repo: string, kind: ClaimKind, target: string, session: string, home?: string, now?: Date): Claim[]; /** Everything live across the repo, for a status view. */ export declare function allClaims(repo: string, home?: string, now?: Date): Claim[]; /** * What to tell the model, or nothing when there is nothing worth saying. * * Written as an observation rather than an instruction. The reader is better placed to decide what * to do about it than this function is: re-read before editing, work elsewhere, or wait for a build * that is already running. Being told what to do on evidence this thin is how a warning gets * ignored. */ export declare function describeClaims(claims: readonly Claim[], now?: number): string | null; /** Clears a repository's claims entirely. For tests, and for a user who wants a clean slate. */ export declare function forgetClaims(repo: string, home?: string): void; /** The directory claims live in, so it can be reported. */ export declare function claimsRoot(): string; //# sourceMappingURL=claims.d.ts.map