import { StreamIdentity } from './log-stream'; /** * The detached, fire-and-forget refresher spawned (by file path, not a bin) from * main-sync-refresh.ts. It does the SLOW work (merged-PR lookup + git fetch + merge-base + * same-file-overlap) and writes `.webpieces/main-sync-status.json` so the next hook call reads it * instantly. Nobody reads our exit code or output — we run after the spawning hook has returned. * * Concurrency: a lock file (`.webpieces/main-sync.lock.json`) holds `inprocess`/`finished` + a start * epoch + the holder's pid, taken with an ATOMIC exclusive create. If another refresher already holds * it and is alive, we exit immediately (don't pile up `git fetch`es). If the holder is finished, dead, * or older than hangTimeoutMinutes, the lock is reclaimed and we proceed. * * argv: [, , repoRoot, hangTimeoutMinutes, sessionId, agentId, hook] * * The last three are the SPAWNER's LogStream identity, and adopting them here is the whole reason * they are passed. This process has its own fresh module-level `logStream`; left unidentified it * named every line `unknown-coordinator-hook.log` — one shared file that every * agent's refresher child appended to concurrently (the PIPE_BUF tearing LogStream exists to remove), * and which held this run's START/FINISH while the parent's SPAWN_ATTEMPT sat in a different file * entirely. Adopting the parent's identity puts one refresh cycle back in one stream. Absent argv * (a hand-run of this file) leaves the default, which still prefixes. */ export declare function main(): void; /** * Parse the hang timeout off argv, WITHOUT `||`. * * `Number(argv[3]) || DEFAULT` silently rewrote a configured `0` — "never treat a lock as stale" — into * the 5-minute default, because `0` is falsy. The knob now has exactly one reader (the branch-state * policy entry), so a value that survives the config only to be discarded at the process boundary is * the whole knob being a lie. Only a MISSING or non-numeric argument falls back. */ export declare function hangTimeoutFromArgv(raw: string | undefined): number; /** * The spawner's LogStream identity as it arrives on this child's argv — positions 4/5/6, which is * where `triggerMainSyncRefresh` puts them (its own array is offset by two: node + script path). * * Exported so ONE test can pin BOTH ends of the contract at once. The bug this closes is precisely a * disagreement between two files about argv positions, and a test that only checks the reader would * have stayed green through it. */ export declare function spawnerIdentity(argv: string[]): StreamIdentity; /** * The refresh itself, argv-free so it can be driven by a test. `main()` is only the argv parse — a * test importing another module's `main` is what no-process-exit-outside-main exists to prevent. */ export declare function refreshMainSync(repoRoot: string, hangTimeoutMinutes: number, argvDetail?: string): void;