import type { Model } from "../../internal/llm.js";
import { type MaybeCompactOptions } from "../auto-compaction.js";
import { type ModelPricing } from "../pricing.js";
import type { Brain, RunnerDeps, TaskSpec } from "../types.js";
import type { Stats } from "./assemble-result.js";
import type { Prepared, RunnerDepsSeat, RunState } from "./contracts.js";
import { type SideCallBook } from "./side-call-account.js";
export interface RunCompactionMachineryInput {
    /** borrowed-readonly — the task spec: the compaction settings. */
    spec: TaskSpec;
    /** borrowed-readonly — the leg's prepared seat: the model, the prompt overhead, the usage governance and the session id. */
    prepared: Prepared;
    /** borrowed-mutable — the run's mutable state: `telemetry.unpricedSpend` is set when a summarizer model is unpriced;
     *  the budget ceiling and the telemetry are read. */
    rs: RunState;
    /** borrowed-mutable — the run's usage counters: every accounted summary call adds to them (compaction spend
     *  tracked separately too). */
    stats: Stats;
    /** borrowed-readonly — the telemetry lane's price-table door, consulted for every summarizer table adopted. */
    noteUnevaluablePriceTable: (p: ModelPricing) => void;
    /** borrowed-readonly — the deployment's model catalog: where a degraded side-call reply's serving model is looked up. */
    modelCatalog: RunnerDeps["models"];
    /** borrowed-readonly — the Runner's deployment deps, read LIVE (`brain`, `pricing`, `onError`). */
    runner: RunnerDepsSeat;
}
export interface RunCompactionMachineryResult {
    /** The accounted compaction brain — `complete` always provided, usage recorded inline. */
    compactionBrain: Brain;
    /** Whether ROUTINE turn-boundary compaction runs for this task, asked AT THE BOUNDARY. The request's own
     *  `compaction` is fixed for the leg, but the deployment's per-model overlay is a live seat — an operator
     *  who turns routine compaction off for a model reaches the legs already on it. */
    withinTaskCompaction: () => boolean;
    /** §17.4: the consecutive-failure circuit breaker shared by every compaction lane of the run. */
    compactionBreaker: {
        failures: number;
    };
    /** The window-safety wiring (per call — a mid-task degrade moves the fallback target). */
    windowSafetyOptions: (mainModel: Model) => Pick<MaybeCompactOptions, "fallbackBudget" | "onWindowSafety">;
    /** The leg's one door onto the run's usage account (the same function `Prepared.sideCallBookRef.book` holds): every
     *  model call made beside the main loop is booked through it, once, with its lane. */
    bookSideCall: SideCallBook;
}
export declare function runCompactionMachinery(input: RunCompactionMachineryInput): RunCompactionMachineryResult;
