/**
 * MentorAutonomousGuardian — the "just be Echo" autonomous-fix loop core
 * (MENTOR-AUTONOMOUS-FIX-LOOP-SPEC).
 *
 * Where {@link runMentorTick} OBSERVES + LOGS (a tool-less haiku composes a
 * check-in, Stage-B captures findings to a read-only ledger, nothing is fixed),
 * this guardian makes the mentor heartbeat KEEP ONE FULL-TOOL OPUS SESSION
 * ALIVE on the manual dogfooding loop. The spawned session IS an Echo clone: it
 * assigns the mentee a real task over Telegram, observes the UX + the mentee's
 * internals, FIXES whatever is broken as a proper fleet-wide PR, and reports —
 * exactly the loop a developer runs by hand. (Justin's constraint: all fixing
 * is done by an Opus model, ideally "just be you taking on that job".)
 *
 * This module is PURE orchestration: every side-effect (the spawn, the
 * already-running check, the goal builder) is injected, so the gate logic is
 * unit-testable with no SessionManager / tmux / LLM. The structural guarantees
 * live HERE, in code, not in a prompt:
 *
 *   - enabled gate    — ships dark; a disabled config never spawns or spends.
 *   - budget gate     — fail-closed BEFORE any spawn (the mentor per-day cap).
 *   - single-instance — never more than ONE loop session. A single cycle
 *     (assign → observe → fix-as-PR → report) outlives MANY heartbeat ticks, so
 *     this is the gate that stops a 15-min heartbeat from spawn-storming
 *     expensive Opus sessions: if a loop session is alive, the tick is a no-op.
 *   - min-interval    — even after a cycle ends, a brief floor before respawn.
 *
 * Order is load-bearing: enabled → budget → single-instance → min-interval → spawn.
 */
export interface AutonomousGuardianDeps {
    /** The framework being mentored (parametric; flows into the goal prompt). */
    framework: string;
    /** mentor.autonomousFix.enabled — the master switch (ships dark when false). */
    enabled: boolean;
    /** Fail-closed budget gate — shared with the observe-pipeline (per-day round
     *  cap). Checked BEFORE any spawn so a depleted budget never starts a cycle. */
    budgetOk: boolean;
    /** True when a loop session (name-prefix match) is already running. The
     *  single-instance invariant: at most one Opus loop session at a time. */
    loopSessionAlive: boolean;
    /** Min-interval floor elapsed since the last spawn (anti spawn-storm). */
    minIntervalElapsed: boolean;
    /** The model the spawned loop session runs on (Justin's constraint: opus). */
    model: string;
    /** Build the dogfooding-loop goal prompt for the spawned session. Injected so
     *  the host can parameterize it (mentee name, topics) without this core
     *  depending on config shape. */
    buildGoal: () => string;
    /** Spawn the full-tool Opus loop session; resolves with its session name.
     *  Injected so the pure guardian has no SessionManager dependency. */
    spawnLoopSession: (goal: string, model: string) => Promise<{
        sessionName: string;
    }>;
    /** Tick id for provenance. */
    tickId?: string;
    now?: () => number;
}
export type AutonomousGuardianReason = 'disabled' | 'budget' | 'loop-active' | 'unsafe-interval' | 'spawned' | 'spawn-failed';
export interface AutonomousGuardianResult {
    ran: boolean;
    reason: AutonomousGuardianReason;
    /** The spawned loop session's name (only when reason === 'spawned'). */
    sessionName?: string;
    /** Underlying error message (only when reason === 'spawn-failed'). */
    error?: string;
}
/**
 * Run one guardian tick. Returns a structured result; the only side effect is
 * the injected {@link AutonomousGuardianDeps.spawnLoopSession}. Order is
 * load-bearing — see the module doc.
 */
export declare function runAutonomousGuardian(deps: AutonomousGuardianDeps): Promise<AutonomousGuardianResult>;
export interface AutoloopGoalParams {
    /** The mentee's agent-registry name (e.g. 'instar-codey'). */
    menteeAgentName: string;
    /** The mentee framework (e.g. 'codex-cli'). */
    menteeFramework: string;
    /** Telegram topic the spawned Echo reports progress to (the human's topic). */
    reportTopicId?: number;
    /** Telegram topic the spawned Echo drives the mentee in. */
    menteeTopicId?: number;
}
/**
 * The built-in dogfooding-loop goal prompt for the spawned Opus session. This
 * is the durable encoding of "replicate exactly what you've been doing": one
 * full cycle of health-check → assign → observe → fix-as-PR → report, with the
 * same verify-don't-confabulate discipline, then a clean exit (the guardian —
 * not the session — starts the next cycle). Pure + deterministic so it is
 * unit-testable. A host may override it via mentor.autonomousFix.goalTemplate.
 */
export declare function buildAutoloopGoal(p: AutoloopGoalParams): string;
//# sourceMappingURL=MentorAutonomousGuardian.d.ts.map