import type { MeshLedgerEntry } from './mesh-ledger.js';
import type { MagiGitSkew } from '@adhdev/mesh-shared';
export type MeshMagiActivityStatus = 'running' | 'synthesized';
/** A bounded needs_verification preview item (claim text + category only). */
export interface MeshMagiNeedsVerificationItem {
    claim: string;
    category: string;
}
export interface MeshMagiActivitySummary {
    consensusGroupId: string;
    status: MeshMagiActivityStatus;
    missionId?: string;
    panel?: string;
    question?: string;
    replicaCount?: number;
    answered?: number;
    missing?: number;
    staleReplicas?: number;
    needsVerificationCount?: number;
    agreedCount?: number;
    independenceBanner?: string | null;
    gitSkew?: MagiGitSkew;
    /** Bounded sample of the needs_verification clusters (claim + category). */
    needsVerification?: MeshMagiNeedsVerificationItem[];
    openQuestions?: string[];
    lastLedgerKind?: string;
    lastUpdatedAt?: string;
}
/** Cap on inlined needs_verification preview items per group (keeps the payload bounded). */
export declare const MAGI_NEEDS_VERIFICATION_PREVIEW_CAP = 8;
/**
 * Reconstruct per-consensusGroup MAGI activity from a ledger window. The newest
 * `magi_synthesis` for a group supplies the synthesis fields; a `magi_dispatched`
 * with no later synthesis stays `running`. Deduped by consensusGroupId, newest first.
 */
export declare function buildMeshMagiActivity(args: {
    meshId?: string;
    ledgerEntries?: MeshLedgerEntry[];
}): MeshMagiActivitySummary[];
/** Synthesized groups older than this (relative to the newest activity in the set) are
 *  folded out of the active list — already-resolved historical runs that should not keep
 *  inflating mesh_status. 6h covers a long working session. */
export declare const STALE_MAGI_WINDOW_MS: number;
/** Cap on recent synthesized groups kept in the active list even if all are fresh. */
export declare const RECENT_MAGI_CAP = 6;
export interface MeshMagiActivitySummaryFold {
    total: number;
    byStatus: Record<string, number>;
    /** Synthesized groups dropped from the active list as stale historical residue. */
    staleSynthesized: number;
    /** Bounded set of recent/active groups (running first, then recent synthesized). */
    groups: MeshMagiActivitySummary[];
}
/**
 * Bound the MAGI activity list for mesh_status: running groups are always kept; synthesized
 * groups are kept only when recent (within STALE_MAGI_WINDOW_MS of the newest activity AND
 * among the RECENT_MAGI_CAP most-recent). Freshness is measured relative to the newest group
 * (not wall-clock) so the result is deterministic for a given input. Mirrors
 * summarizeMeshAsyncRefineJobs.
 */
export declare function summarizeMeshMagiActivity(activity: MeshMagiActivitySummary[]): MeshMagiActivitySummaryFold;
/** Latest persisted synthesis activity for one consensusGroupId, or undefined. */
export declare function getMeshMagiActivityByGroup(ledgerEntries: MeshLedgerEntry[], consensusGroupId: string): MeshMagiActivitySummary | undefined;
