/** A crashed session disappears from "who is here" after 10 minutes. */ export declare const PRESENCE_TTL_MS: number; /** Heartbeat interval: refresh presence every 2 minutes so live sessions * never expire (TTL is 10 min — 5× margin). */ export declare const PRESENCE_HEARTBEAT_MS: number; export interface PresenceEntry { pid: number; startedAt: string; updatedAt?: string; agentId?: string; kind?: string; taskId?: string; projectId?: string; } /** Live occupants of `path`, oldest first. */ export declare function listPresent(path: string): PresenceEntry[]; /** * Register (or heartbeat-refresh) THIS process in the folder. * * Idempotent on BOTH the pid and the logical session identity * `(agentId, kind, taskId)`. The pid alone was not enough: a re-run of the same * task gets a new pid, so a dead row from the previous attempt survived and the * next one appended beside it - which is how one folder's registry accumulated * several rows for a single task and made "who is here" unreadable. Replacing * the dead row for the same logical session is what keeps it to one. * * A LIVE row for the same identity is left alone: that is a genuinely * concurrent session, and hiding it would defeat the folder-serialization gate. */ export declare function registerPresence(path: string, info?: Omit): void; /** Remove THIS process from the folder's registry. */ export declare function unregisterPresence(path: string): void; /** * Kinds that occupy a folder WITHOUT excluding anyone (2026-10). * * ── WHY A PLAN PASS IS NOT AN OCCUPANT ─────────────────────────────────────── * * A planning pass runs no git pipeline — no branch, no stash, no commit, no * push (that is the whole reason `preflightWake` gives it `needsMirror: false` * and it works in the linked folder). It reads the tree and writes NOTHING to it: * the deliverable is the task's description, acceptance criteria, subtasks, * checklist and a `plan.md` note, all persisted over MCP. * * It nevertheless registered `presence`, and the folder-serialization gate * treated any presence row as exclusive. So two agents planning in one folder * locked each other out — and because the queue that gate pushed into was never * drained (see `wake-handler.ts`), the loser did not wait, it was **lost**. That * is the incident behind this set: a human pressed "Improve plan" twice and saw * two `Wake received` rows and no work. * * So a plan is CONCURRENT by construction. This is only safe because a plan is * also mechanically read-only: the session runs with `TS_READ_ONLY=1`, which * makes the arbitration shims REFUSE every mutating command instead of queueing * it (`shim-runner.ts` + `classify.ts#readOnlyRefusal`). A plan that cannot * write cannot corrupt the tree it shares, so it has no reason to exclude * anyone — and no reason to be excluded. * * Keep this set and `TS_READ_ONLY` in step. Adding a kind here is a claim that * the session writes nothing; if that is not enforced, it is a bug. */ export declare const NON_BLOCKING_PRESENCE_KINDS: ReadonlySet; /** True when this occupant excludes other sessions from the folder. */ export declare function presenceBlocks(entry: Pick): boolean; /** * True when at least one OTHER live process occupies the folder. Used by the * daemon's auto-worktree escalation ("second agent showed up") and by * status endpoints. */ export declare function hasOtherOccupants(path: string, excludePid?: number): boolean;