/**
 * Per-action recovery tier — Phase 5a of
 * `2026-05-14-PER-ACTION-RECOVERY-TIER.md`.
 *
 * The realize per-owner runner has three tiers:
 *
 *   Tier 1 — whole-owner emit (`per-owner-emit.ts`). One LLM call emits
 *            the entire `<Owner>.ai.ts`. Works for the easy majority.
 *   Tier 2 — THIS MODULE. When Tier 1 fails (structural-preservation
 *            reject, parse failure, LLM decline), instead of dropping
 *            straight to a γ-stub file, retry the owner ACTION-BY-ACTION
 *            — but with the FULL owner context in every call.
 *   Tier 3 — γ-stub placeholder file (`renderFallbackPlaceholderFile`
 *            in `per-owner-runner.ts`). Only reached if Tier 2 produced
 *            ZERO real bodies.
 *
 * "Wide context, narrow output" — the distinction from the abandoned
 * Realize L3 per-action emit: L3 gave the LLM NARROW context (one
 * action's steps, no class shell, no capabilities) and it starved
 * (29/94 actions came back as throw-stubs). This keeps the FULL owner
 * context — every action's [PRE-BAKED] scaffolding, the target runtime,
 * manifest capabilities, V2 clients, cross-service operation surface —
 * in every per-action call, and only narrows the OUTPUT to one function
 * body. The reasoning load per call drops (the model holds one function
 * in its head, not all of them) without re-introducing context
 * starvation.
 *
 * Motivation (Phase 3 trial, 2026-05-14): the quant-fidelity gap between
 * Ollama (Q4 GGUF) and MarrBox (FP8) — SAME model, Qwen3-Coder-30B-A3B
 * — localized to the single hardest owner (`ReactiveStateEngine`, 7
 * interrelated functions). The Mac Mini's 24GB RAM structurally pins it
 * at ~Q4 (Q6/Q8 don't fit), so "run a better quant" is closed. This
 * makes the TASK easier instead.
 *
 * Phase 5a scope: declaration-order emission, full owner SCAFFOLDING
 * context per call. Phase 5b adds dependency-ordered emission +
 * already-emitted siblings shown as concrete code. Phase 5c adds the
 * action-count cap telemetry.
 */
import type { LanguageModel } from 'ai';
import { type PerOwnerEmitRequest } from './per-owner-emit.js';
/** Per-action recovery function signature — takes the SAME request the
 *  whole-owner emit took (it needs the same context), returns the
 *  assembled `<Owner>.ai.ts` contents, or null when ZERO actions
 *  emitted a real body (caller falls through to the Tier 3 γ-stub). */
export type PerActionRecoveryFn = (request: PerOwnerEmitRequest) => Promise<string | null>;
export interface CreatePerActionRecoveryOptions {
    /** LLM model — the shared model used by the rest of realize. */
    model?: LanguageModel;
    /** Per-action call timeout. Default 5min — per-action calls emit one
     *  function (1.5-4K tokens) vs the whole-owner emit's 5-15K, so they
     *  finish much faster than the per-owner 15min budget. */
    timeoutMs?: number;
    /** Skills to inline into the system prompt for non-claude-cli
     *  providers. Defaults to `['realize-emit']` — same skill the
     *  whole-owner emit + the post-emit reemit use. */
    skills?: string[];
    /** Structural drop threshold (per action). Defaults to the shared
     *  `DEFAULT_STRUCTURAL_DROP_THRESHOLD`; honours
     *  `SPECVERSE_REALIZE_STRUCTURAL_DROP_THRESHOLD` when unset. */
    dropThreshold?: number;
    /** Test seam — override the LLM call. Given (system, user) returns
     *  the raw model text. */
    generateOverride?: (system: string, user: string) => Promise<string>;
}
/**
 * Build a {@link PerActionRecoveryFn}. The returned function loops over
 * the owner's actions, emits each with full owner context, validates
 * (structural + parse), γ-stubs the ones that fail, and assembles the
 * owner file. Returns null only when EVERY action γ-stubbed (caller
 * then uses the Tier 3 placeholder, which is equivalent).
 */
export declare function createPerActionRecovery(opts?: CreatePerActionRecoveryOptions): PerActionRecoveryFn;
//# sourceMappingURL=per-action-recovery.d.ts.map