import type { AgentGovernanceQueries } from '../spi/governance-queries.js';
import type { ScorableRun } from './types.js';
/**
 * The corpus behind {@link import('./scorers/approval-risk.scorer.js').ApprovalRiskScorer}: how
 * often humans have approved each `action` tool, across the HITL decisions in view.
 */
/** One recorded human decision on an `action` tool call. */
export interface ToolApprovalDecision {
    toolName: string;
    /** The tool call's final status, as the store recorded it. */
    status: string;
}
/** How a single tool has fared with humans. */
export interface ToolApprovalCounts {
    approved: number;
    rejected: number;
}
/** Approval counts per tool name. */
export type ToolApprovalPrior = ReadonlyMap<string, ToolApprovalCounts>;
/** Fold recorded decisions into per-tool approval counts. Undecided statuses are ignored. */
export declare function buildApprovalPrior(decisions: Iterable<ToolApprovalDecision>): Map<string, ToolApprovalCounts>;
/**
 * The prior over the runs a batch already loaded — the cheapest way to get one, and free of extra
 * reads. {@link import('./governance-sample-source.js').GovernanceRunSampleSource} returns each run
 * with its tool calls already attached, so the whole sample's HITL history is in hand before the
 * first scorer runs. It is a prior over the corpus being scored, which is the honest reading of a
 * batch that also IS the corpus; reach for {@link loadApprovalPrior} when the prior should come from
 * a wider slice of history than the batch covers.
 */
export declare function priorFromRuns(runs: Iterable<ScorableRun>): Map<string, ToolApprovalCounts>;
/** How much decision history {@link loadApprovalPrior} reads. */
export interface ApprovalPriorQuery {
    /**
     * How many of the most recent tool calls to read. The read-model's activity feed is not filtered
     * by tool type, so this bounds calls of EVERY kind and a deployment whose traffic is mostly reads
     * needs a generous number to see its actions. Hard cap on the work, by design: building a prior
     * must never turn into an unbounded scan.
     */
    limit?: number;
    /** Inclusive UTC day bounds on when the call was made, `YYYY-MM-DD`. */
    fromDay?: string;
    toDay?: string;
}
/**
 * Build the prior from the store's own HITL history, off the governance activity feed. Offline by
 * construction: it reads decisions humans already made, so a batch can score a whole backlog against
 * the taste of the people who have been running the system.
 */
export declare function loadApprovalPrior(args: {
    queries: AgentGovernanceQueries;
    query?: ApprovalPriorQuery;
}): Promise<Map<string, ToolApprovalCounts>>;
/**
 * The smoothed probability that a human approves this tool the next time it is proposed. `0.5` for a
 * tool nobody has ever decided on, which is what "we have no evidence" should look like.
 */
export declare function approvalPosterior(counts: ToolApprovalCounts | undefined): number;
//# sourceMappingURL=approval-prior.d.ts.map