import { StreamIdentity } from './log-stream'; export declare function resetMainSyncRefreshLatchForTest(): void; /** * The detached child's argv, spawner side. Positions here are offset by two from the child's * `process.argv` (node + script path), so this array's 3/4/5 are the child's 4/5/6 — which is what * `sync-main.ts:spawnerIdentity` reads. The two are pinned against each other by ONE test, because a * silent disagreement about these positions IS the bug being fixed: the child previously received no * identity at all and wrote every line to the shared `unknown-coordinator-hook-` stream. */ export declare function refresherArgv(refresher: string, workspaceRoot: string, hangTimeoutMinutes: number, identity: StreamIdentity): string[]; /** * Fire-and-forget spawn of the detached refresher (sync-main.js in this same dir — spawned by path, * not a bin). The child outlives this hook process (`detached` + `unref`), does the slow * merged-PR/fetch/merge-base/overlap work, and writes the cache the feature-branch-guard reads on * the NEXT call. This is the first detached spawn in the codebase — every existing hook is synchronous. * * Observability: we log SPAWN_ATTEMPT here and the child logs START/FINISH/ERROR, all to * `.webpieces/logs/async-refresh/.log` (LogStream names every writer). The child's * stdout/stderr are redirected to a sibling file (not * /dev/null) so a crash before the child's own logging is still captured. If the async-refresh stream shows * SPAWN_ATTEMPT but never START, the detached child was killed before it ran. * * `hangTimeoutMinutes` IS REQUIRED, deliberately. It used to default to DEFAULT_HANG_TIMEOUT_MINUTES, * and that default is the mechanism by which three of the four configured values could never reach a * spawn: two callers ran before any guard and simply omitted the argument, and the at-most-once latch * below then meant the guard's own call — the one carrying the configured value — was a no-op. An * omitted argument that silently means "the default" is unreadable at the call site and impossible to * grep. Required makes every caller say which value it is passing, and makes forgetting a compile error. * * THE IDENTITY GOES ON ARGV, and that is what makes the sentence above true. The child is a separate * node process whose `logStream` starts unidentified, so it used to write every line to the shared * `unknown-coordinator-hook.log` while this parent wrote SPAWN_ATTEMPT to its own * prefixed stream. One cycle, two files — the SPAWN_ATTEMPT-without-START check then read as a * failure on every cycle even when the child ran perfectly — and every agent's child appending to * that one shared path is exactly the multi-writer tearing LogStream exists to remove. Passing * session/agent/hook through (positional argv, alongside the root and timeout the child already * takes) puts the whole cycle back in ONE file. */ export declare function triggerMainSyncRefresh(workspaceRoot: string, hangTimeoutMinutes: number): void;