#!/usr/bin/env npx tsx
/**
 * longitudinalHarness.ts — Longitudinal dogfood benchmark harness for NodeBench MCP.
 *
 * Orchestrates N=1, N=5, N=10, N=100 cohort evaluations to measure whether
 * NodeBench compounds value across users, roles, sessions, and time horizons.
 *
 * Core metrics:
 *   RCA  — Repeated Cognition Avoided (% of sessions not restating prior context)
 *   PRR  — Packet Reuse Rate (% of sessions reusing a prior packet)
 *
 * Usage:
 *   cd packages/mcp-local && npx tsx src/benchmarks/longitudinalHarness.ts [n1|n5|n10|n100|all]
 */
export interface CohortUser {
    userId: string;
    role: "founder" | "banker" | "ceo" | "researcher" | "student" | "legal" | "pm" | "contractor" | "investor" | "content";
    preset: string;
    typicalScenarios: string[];
}
export interface SessionRun {
    runId: string;
    userId: string;
    role: string;
    scenarioId: string;
    sessionIndex: number;
    timeHorizon: "same_session" | "same_day" | "next_day" | "weekly" | "monthly" | "quarterly" | "yearly";
    surface: "mcp" | "ai_app" | "local_dashboard" | "engine_api";
    toolCallCount: number;
    latencyMs: number;
    packetGenerated: boolean;
    packetReused: boolean;
    repeatQuestionDetected: boolean;
    contextRestated: boolean;
    exportProduced: boolean;
    judgeScore: number;
    errors: string[];
}
export interface CohortReport {
    cohortSize: number;
    totalSessions: number;
    rolesCovered: string[];
    coreLoopsCovered: number;
    repeatedCognitionAvoided: number;
    packetReuseRate: number;
    importantChangePrecision: number;
    contradictionPrecision: number;
    falseAlertRate: number;
    exportToActionRate: number;
    topRecurringRootCause: string;
    topRegressionRisk: string;
    passed: boolean;
    passThresholds: Record<string, number>;
}
/**
 * Repeated Cognition Avoided (RCA): % of sessions where the user did NOT
 * restate context or re-ask old questions.
 */
export declare function computeRCA(sessions: SessionRun[]): number;
/**
 * Packet Reuse Rate (PRR): % of sessions where a prior packet was reused
 * rather than regenerated from scratch.
 */
export declare function computePRR(sessions: SessionRun[]): number;
/**
 * Aggregate all metrics from a batch of sessions into a CohortReport.
 */
export declare function generateCohortReport(sessions: SessionRun[], cohortSize: number, layer: "n1" | "n5" | "n10" | "n100"): CohortReport;
/**
 * N=1: Single golden-path founder run.
 * Validates that the core tool chain works end-to-end for one scenario.
 */
export declare function runN1(): Promise<{
    session: SessionRun;
    report: CohortReport;
}>;
/**
 * N=5: 5 users (founder, banker, ceo, researcher, student), 1 session each.
 * All against the same entity "Anthropic".
 */
export declare function runN5(): Promise<CohortReport>;
/**
 * N=10: 10 users x 1 session each OR 5 users x 2 sessions.
 * Tests session-continuity metrics.
 */
export declare function runN10(): Promise<CohortReport>;
/**
 * N=100: 10 users x 10 sessions each (simulated across time horizons).
 * Measures RCA + PRR compounding over time.
 */
export declare function runN100(): Promise<CohortReport>;
