import type { AutoCompactResult } from '../context/auto-compact-types.js'; import type { CompactRun } from './auto-compact-run-types.js'; /** * The decision fires whenever the ratio is at or over the auto-fire threshold, and * the ratio does not come back down on its own — nothing in peaks-loop can compact a * running session, and the harness fires only at its own red line. So "shouldCompact" * was true on every probe, forever: one real session's `compact-history.jsonl` holds * 1075 dispatch rows, 444 checkpoints and ZERO compactions over 15.5 h. Re-dispatching * bought nothing, because the `ide-native` dispatch only installs a PreToolUse hook * and installing it again is a documented no-op: 1074 of those 1075 rows say `already * installed` in their own `dispatchMessage`. It produced rows, not compactions. * * The lifecycle store already knows whether an attempt is outstanding (`readOpenDispatchRun` * — `armed`/`compacting` = dispatched, `completed`/`failed` = over), so the gate needs no * new state and no threshold: it is keyed on the STAGE of the open run, never on a ratio, * which is why it survives any future realignment of the 0.65/0.70/0.85/0.95 table. * * What is NOT suppressed: the probe still measures and still reports. The envelope carries * the LIVE ratio plus the ratio the open ask was made at, so "it crossed and it is still * high, unanswered" stays legible on every turn — the difference between a quiet signal * and a silenced one. * * `force` (the `--force` test seam, "force compact at any ratio") outranks the inference: * an explicit instruction must not be silently reduced to a no-op, which would make the * published flag a lie. * * `readOpenDispatchRun` answers in THREE states, not two. `none` admits the dispatch; * `unresolvable` means the backoff's question could not be asked — the session id names * no session directory, so no lifecycle record can answer it. Measured on ONE directory * before this: a legal sid found the open `armed` run and suppressed the dispatch, while * `./`, which joins to the identical path, returned `null` and dispatched. A * gate that reads a string instead of the artifact the string names is the defect the * whole id axis exists to close, so an unanswerable question is NOT an admit: the * conservative direction is to leave the dispatch undone and say why. */ export declare function readOpenRunGate(ctx: CompactRun): AutoCompactResult | null;