import type { LoopMonitorScanResult } from "./loop-monitor.js"; export declare const TEAM_MONITOR_TIMING: { readonly scanIntervalMs: 5000; readonly heartbeatIntervalMs: 5000; readonly pendingGraceMs: 15000; readonly runningStaleMs: 20000; readonly targetLockStaleMs: 15000; readonly noLiveTargetConsecutiveScanThreshold: 2; readonly terminalStateGraceMs: number; readonly retainedEvents: 100; }; export interface MonitorChild { on?: (event: string, listener: (...args: unknown[]) => void) => void; unref?: () => void; } export type MonitorSpawn = (command: string, args: string[], options: { detached: boolean; stdio: "ignore"; }) => MonitorChild; export interface EnsureLoopTeamMonitorDeps { spawn?: MonitorSpawn; cliPath?: string; now?: () => number; token?: () => string; pid?: number; } export type EnsureLoopTeamMonitorResult = { started: true; token: string; } | { started: false; reason: "no-active-loop" | "no-live-targets" | "already-pending" | "already-running" | "spawn-failed"; error?: string; }; export interface AdoptLoopTeamMonitorDeps { now?: () => number; pid?: number; buildId: string; } export type AdoptLoopTeamMonitorResult = { adopted: true; } | { adopted: false; reason: "owner-mismatch"; }; export interface RunLoopTeamMonitorDeps extends AdoptLoopTeamMonitorDeps { scan?: () => Promise; sleep?: (ms: number) => Promise; maxScans?: number; } export interface RunLoopTeamMonitorResult { ok: boolean; reason: "no-active-loop" | "no-live-targets" | "owner-mismatch" | "owner-lost" | "max-scans" | "error"; scans: number; } export declare function ownsLoopTeamMonitor(cwd: string, token: string): boolean; export declare function adoptLoopTeamMonitorOwner(cwd: string, token: string, deps: AdoptLoopTeamMonitorDeps): AdoptLoopTeamMonitorResult; export declare function runLoopTeamMonitor(cwd: string, token: string, deps: RunLoopTeamMonitorDeps): Promise; export declare function ensureLoopTeamMonitor(cwd: string, deps?: EnsureLoopTeamMonitorDeps): EnsureLoopTeamMonitorResult;