/**
 * Two-stage wedge gate applied to schedule outcomes (SCHED.4).
 *
 * Authoritative source: `docs/tasks/scheduling.md` §"Task SCHED.4" +
 * `docs/opensquid-real-design.md` §"Two-stage wedge gate" + the Phase 7
 * capture/promote pattern (see `./capture.ts` + `./promote.ts`).
 *
 * What this module is:
 *
 *   - A new lesson type, `schedule_outcome`, that captures one (fire, signal)
 *     pair per scheduled run. Each capture is Stage 1 — surfaced to the user
 *     via the same Phase 7.2 buffer (`automation_buffer.ts`) under the
 *     `potential-lessons` category. Nothing auto-promotes from Stage 1.
 *
 *   - A Stage 2 evaluator (`evaluateSchedulePromotion`) that reads the
 *     append-only outcome log and recommends one of three actions based on
 *     EXTERNAL user signals only:
 *       * `promote`             → schedule has earned permanent status.
 *       * `retire`              → schedule is doing harm; user should remove.
 *       * `keep_probationary`   → not enough signal yet.
 *
 *   - A persistence helper (`applyScheduleVerdict`) that gates the status
 *     change behind eviction-immunity: once a schedule is `permanent`, it
 *     cannot auto-retire (matches `feedback_user_authored_lessons_immune`).
 *     The recommend → status transition is intentionally a separate function
 *     so the audit log can record (recommendation, applied?, reason) without
 *     the evaluator making policy calls.
 *
 * Why a separate file (not extending promote.ts):
 *
 *   - `promote.ts` is a PURE function over `OutcomeSignal`. It has no I/O,
 *     no clock, no filesystem. Schedule outcomes are inherently time-series
 *     (N events over the lifetime of a schedule) and need persistence. Mixing
 *     would muddy the audit grep for "no LLM call in promote.ts" — the audit
 *     pattern is module-scoped.
 *
 *   - The new lesson type is additive in `types.ts`; the existing wedge gate
 *     remains untouched. SCHED.4 reuses the Phase 7.2 buffer for Stage 1
 *     capture but owns its own Stage 2 evaluator.
 *
 * Anti-self-grading invariant (the moat):
 *
 *   - This module MUST NOT call an LLM primitive. The decision inputs are
 *     EXTERNAL: `userSignal.kind` ('redo' | 'approve' | 'manual_override').
 *     `redo` is sourced from `full_stop_and_redo` (AUTO.4); `approve` from
 *     the user's buffer walk; `manual_override` from explicit CLI.
 *
 *   - The schedule does NOT promote itself based on its own verdict counts.
 *     `resultKind` (pass/block/warn/surface/error) is recorded for the audit
 *     log but is NOT a promotion input — only the user signal is.
 *
 * Imports from: node:fs/promises, node:path, ../paths, ./automation_buffer,
 *               ./capture, ./types.
 * Imported by: src/runtime/wedge/index.ts, daemon dispatch path (SCHED.1 +
 *              user signal hooks).
 */
export interface ScheduleOutcome {
    scheduleId: string;
    runId: string;
    fireTime: string;
    durationMs: number;
    resultKind: 'pass' | 'block' | 'warn' | 'surface' | 'error';
    userSignal?: {
        kind: 'redo';
        redoneAt: string;
    } | {
        kind: 'approve';
        approvedAt: string;
    } | {
        kind: 'manual_override';
        overriddenAt: string;
        reason: string;
    };
}
export interface ScheduleVerdict {
    scheduleId: string;
    status: 'probationary' | 'permanent' | 'retired';
    runCount: number;
    approvedCount: number;
    redoCount: number;
    manualOverrideCount: number;
    recommend: 'promote' | 'retire' | 'keep_probationary';
}
export interface SchedulePromotionThreshold {
    windowN: number;
    minApproved: number;
    minRedoRetire: number;
}
export declare const DEFAULT_SCHEDULE_THRESHOLD: SchedulePromotionThreshold;
export declare function scheduleOutcomeDir(sessionId: string): string;
export declare function captureScheduleOutcome(sessionId: string, outcome: ScheduleOutcome): Promise<void>;
export declare function evaluateSchedulePromotion(sessionId: string, scheduleId: string, threshold?: SchedulePromotionThreshold): Promise<ScheduleVerdict>;
export interface ApplyVerdictOpts {
    /** If true, force-apply even on eviction-immune statuses. ONLY set this
     *  from a user-initiated path (CLI / cycle UI). Library code never sets
     *  it. The flag exists so the helper has a single audit-able entry point;
     *  user actions go through the same function as auto-recommendations but
     *  are distinguishable in the audit log. */
    userOverride?: boolean;
}
export interface ApplyVerdictResult {
    applied: boolean;
    newStatus: 'probationary' | 'permanent' | 'retired';
    reason?: string;
}
export declare function applyScheduleVerdict(sessionId: string, verdict: ScheduleVerdict, opts?: ApplyVerdictOpts): Promise<ApplyVerdictResult>;
//# sourceMappingURL=schedule_outcome.d.ts.map