/**
 * M4.0: Review inbox — derive review items from existing truth.
 *
 * No new store: review items are a query-time projection of
 *   - mesh_status node statuses (daemon-owned branchConvergence), and
 *   - the task ledger (completion evidence envelopes + refine job results).
 *
 * Scope (M4.0): host-daemon-local nodes only. Remote nodes are excluded and
 * surfaced via remoteNodesExcluded/excludedRemoteNodeIds until the
 * daemon↔daemon P2P relay path is live-verified (M4.2).
 */
import type { MeshLedgerEntry } from './mesh-ledger.js';
export type MeshReviewInboxReason = 'merge_candidate' | 'refine_blocked_review';
export interface MeshReviewInboxConvergence {
    status: string;
    reason: string | null;
    nextStep: string | null;
    needsConvergence: boolean;
}
export interface MeshReviewInboxEvidence {
    available: boolean;
    /** Ledger kind of the entry the evidence came from. */
    kind?: 'task_completed' | 'task_failed';
    /** 'task_completion' = ordinary worker completion envelope; 'refine_job' = Refinery result. */
    source?: 'task_completion' | 'refine_job';
    timestamp?: string;
    taskId?: string;
    sessionId?: string;
    /** M2-3 bootstrap stage from the refine validation gate: cached|ran|failed|skipped|legacy|not_configured. */
    bootstrap?: Record<string, unknown> | null;
    validation?: Record<string, unknown> | null;
    checkpoint?: Record<string, unknown> | null;
    worker?: {
        status: string;
        classification?: string;
        changedFiles: string[];
        changedFilesTruncated?: true;
        validationResults: Array<Record<string, unknown>>;
        errors: string[];
        requiresUserAction: boolean;
    } | null;
    finalBranchConvergenceState?: Record<string, unknown>;
    refineJob?: Record<string, unknown>;
}
export interface MeshReviewInboxDiffFile {
    path: string;
    status?: string;
    insertions?: number;
    deletions?: number;
    binary?: boolean;
    oldPath?: string;
}
export interface MeshReviewInboxDiffSummary {
    baseRef: string;
    files: MeshReviewInboxDiffFile[];
    totalFiles: number;
    totalInsertions: number;
    totalDeletions: number;
    truncated: boolean;
    error?: string;
}
export interface MeshReviewInboxItem {
    nodeId: string;
    workspace: string | null;
    branch: string | null;
    defaultBranch: string | null;
    isLocalWorktree: boolean;
    reviewReason: MeshReviewInboxReason;
    convergence: MeshReviewInboxConvergence;
    evidence: MeshReviewInboxEvidence;
    transcriptHandle: Record<string, unknown> | null;
    /** Latest non-terminal Refinery job for this node (accepted/running), if any. */
    activeRefineJob: Record<string, unknown> | null;
    lastActivityAt: string | null;
    /** Filled by the daemon command with a bounded base-branch diff probe; null when the workspace is not locally readable. */
    diffSummary?: MeshReviewInboxDiffSummary | null;
}
export interface MeshReviewInboxDerivation {
    items: MeshReviewInboxItem[];
    remoteNodesExcluded: boolean;
    excludedRemoteNodeIds: string[];
}
/**
 * Derive review inbox items from mesh_status node statuses and a bounded
 * ledger tail. Pure and read-only; the caller attaches diffSummary separately.
 */
export declare function deriveMeshReviewInboxItems(args: {
    nodes: Array<Record<string, unknown>>;
    ledgerEntries: MeshLedgerEntry[];
}): MeshReviewInboxDerivation;
