/**
 * FeatureAgentSupervisorGateEvaluator
 *
 * Bridges the feature-agent worker's `waiting_approval` transition with
 * the {@link EvaluateSupervisorDecisionUseCase} (spec 093, task 29).
 *
 * On every approval-gate interrupt the worker calls
 * {@link evaluateForGate}. The evaluator:
 *
 *  1. Resolves the configured {@link SupervisorPolicy} for the
 *     (scopeType, scopeId, featureId) scope. When no policy is configured the call
 *     is a no-op — pure additive behaviour preserves the existing
 *     human-only path (NFR-14).
 *  2. Computes the effective per-gate autonomy: a `gateAuthorityJson`
 *     entry overrides the policy's default `autonomyLevel`.
 *  3. Calls {@link EvaluateSupervisorDecisionUseCase} which writes the
 *     {@link SupervisorDecision} row and mirrors it to the audit log.
 *  4. In **autonomous** mode for the gate AND when the supervisor's
 *     verdict is `approve` / `reject`, invokes
 *     {@link ApproveAgentRunUseCase} or {@link RejectAgentRunUseCase}
 *     with `actor = supervisor:<supervisorRunId>` so the existing gate
 *     state machine resolves the gate without further human action.
 *  5. In **advisory** and **co-sign** modes the decision is recorded
 *     but the gate stays in `waiting_approval`. The user still drives
 *     the resolution (user always wins). Co-sign awaits both votes by
 *     leaving the gate open for the user — the supervisor's vote is
 *     visible via `activity_log` but does not auto-close.
 *
 * Failures inside the evaluator MUST NOT crash the worker: the gate
 * already transitioned to `waiting_approval` before this hook runs, so
 * a swallowed error degrades to today's user-only flow (FR-22 fail
 * safe).
 */
import type { IApplicationRepository } from '../../../../application/ports/output/repositories/application-repository.interface.js';
import { ApproveAgentRunUseCase } from '../../../../application/use-cases/agents/approve-agent-run.use-case.js';
import { EvaluateSupervisorDecisionUseCase } from '../../../../application/use-cases/agents/evaluate-supervisor-decision.use-case.js';
import { GetSupervisorPolicyUseCase } from '../../../../application/use-cases/agents/get-supervisor-policy.use-case.js';
import { RejectAgentRunUseCase } from '../../../../application/use-cases/agents/reject-agent-run.use-case.js';
import { SupervisorAutonomy, SupervisorVerdict, type SupervisorPolicy } from '../../../../domain/generated/output.js';
export interface SupervisorGateEvaluationInput {
    /** Agent run that hit the gate. */
    runId: string;
    /** Feature owning the run. */
    featureId: string;
    /** Repository path used to resolve the App scope. */
    repositoryPath: string;
    /** LangGraph node name that triggered the interrupt (e.g. `prd`, `plan`, `merge`). */
    interruptNode?: string;
}
export interface SupervisorGateEvaluationResult {
    /** True when an evaluation actually ran (flag on + policy found). */
    evaluated: boolean;
    /** Effective autonomy level for the gate (only set when evaluated). */
    effectiveAutonomy?: SupervisorAutonomy;
    /** The supervisor's verdict (only set when evaluated). */
    verdict?: SupervisorVerdict;
    /** True when the supervisor auto-resolved the gate in autonomous mode. */
    autoResolved: boolean;
}
export declare class FeatureAgentSupervisorGateEvaluator {
    private readonly applicationRepo;
    private readonly getPolicy;
    private readonly evaluateDecision;
    private readonly approveAgentRun;
    private readonly rejectAgentRun;
    constructor(applicationRepo: IApplicationRepository, getPolicy: GetSupervisorPolicyUseCase, evaluateDecision: EvaluateSupervisorDecisionUseCase, approveAgentRun: ApproveAgentRunUseCase, rejectAgentRun: RejectAgentRunUseCase);
    evaluateForGate(input: SupervisorGateEvaluationInput): Promise<SupervisorGateEvaluationResult>;
    private applyAutonomousVerdict;
    private resolveScope;
}
/**
 * Resolves the per-gate autonomy override stored as JSON on
 * {@link SupervisorPolicy.gateAuthorityJson}. The map is keyed by gate
 * id (matching the LangGraph node name, e.g. `prd`, `plan`, `merge`).
 *
 * Exported so the unit test can exercise the parsing rules without
 * spinning up the full evaluator.
 */
export declare function resolveEffectiveAutonomy(policy: SupervisorPolicy, gateId: string): SupervisorAutonomy;
//# sourceMappingURL=feature-agent-supervisor-gate-evaluator.d.ts.map