/** * The pure auto-compact decision surface: trigger, decision and plan. * * Split out of `auto-compact-orchestrator.ts` (file-size cap campaign). The * orchestrator re-exports every name declared here, so existing importers keep * using `./auto-compact-orchestrator.js` unchanged. */ import { type CompactTrigger, type ConvergencePlan, type InFlightBatchProbe } from '../context/auto-compact-types.js'; import { type AutoCompactMode } from './auto-compact-modes.js'; export declare function evaluateCompactTrigger(ratio: number, mode?: AutoCompactMode): CompactTrigger; /** * Decide whether to run the auto-compact flow. Pure function for the * decision; side effects (checkpoint + IDE dispatch) live in * `runAutoCompact` below. Zero human / zero LLM intervention: * * - ratio < 0.85 → skip (LLM keeps working; no action) * - 0.85 ≤ ratio < 0.95 → pre-compact; if in-flight batch * present, defer (D6.e); else dispatch * IDE compact asynchronously. * - ratio ≥ 0.95 → red-line; ask the harness to compact * regardless of in-flight batch. Nothing is * gated — dispatch is NOT blocked (slice * peaks-loop cannot compact a running session, * so a "block" gated nothing and deadlocked the * runner). */ export declare function evaluateAutoCompactDecision(input: { ratio: number; /** * Caller-provided in-flight batch signal. Accepts either a plain * boolean (convenience / repro seam) or the full `InFlightBatchProbe` * shape (production callers — graph-probe-backed). When the boolean * form is `true`, the normalized probe carries * `hasInFlightBatch: true`. Slice 4.0.8 hotfix. */ inFlightBatch?: boolean | InFlightBatchProbe | undefined; /** * Legacy camelCase alias for `inFlightBatch`. Production repro * inputs use `inflightBatch: true|false`; the orchestrator * normalizes it to the same internal shape. Slice 4.0.8 hotfix. */ inflightBatch?: boolean | InFlightBatchProbe | undefined; force?: boolean | undefined; /** Accepted and ignored — see `AutoCompactInput.bypassRedLine`. */ bypassRedLine?: boolean | undefined; mode?: AutoCompactMode | undefined; /** * Whether the batch in flight has crossed a COMPACTION BOUNDARY — the * ①→② or ③→④ transition of the batch's four stages. * * Why this exists. The in-flight-batch branch below DEFERS a compaction * while a batch is running, because compacting in the middle of a fan-out * interrupts the agents. But a batch is "in flight" for its whole life, * so the deferral postpones the compaction for the whole batch — and the * window is at its worst exactly then, because N reports arrive * together. At a boundary that is false: the stage's agents are done, its * results are on disk, and the recovery cost is the lowest it will be. * So at a boundary the compaction happens NOW instead of being deferred. * * Absent (the default), the behaviour is EXACTLY what it was: a batch in * flight defers, and nothing else changes. */ atPhaseBoundary?: boolean | undefined; /** * Source tag from `readContextPercent.source`. Optional — when absent, the * function behaves exactly as pre-rid (ratio-only). Slice 2026-07-31-rid- * mac-transcript-estimate-trigger uses this to carry forward an explicit * carve-out for the Mac-only `transcript-estimate` signal. */ source?: string | undefined; }): { shouldCompact: boolean; reason: 'below-threshold' | 'in-flight-batch' | 'pre-compact' | 'red-line'; trigger: CompactTrigger; /** Typed verdict enum (RD §4 24h-mode contract). Slice 4.0.8 hotfix. */ action: 'ok' | 'soft-warn' | 'auto-compact-now' | 'red-line' | 'defer'; }; /** * Build the convergence plan that D7's post-compact-detect will read * back. Includes the current plan, open questions, recent decisions, * todo state, and recent artifact paths — strictly more than what a * raw `/compact` would preserve. */ export declare function buildConvergencePlan(input: { readonly sessionId: string; readonly projectRoot: string; readonly ratio: number; readonly checkpointPath: string; readonly nextActions: readonly string[]; readonly redLine?: boolean; }): ConvergencePlan;