/**
 * Remote Telemetry Engine
 *
 * Privacy-first telemetry for nexus-prime. DEFAULT: OFF.
 * Sends pseudonymous install + project activity to a Supabase REST endpoint
 * only after explicit opt-in or `NEXUS_TELEMETRY=on`.
 */
export type TelemetryEventType = 'install' | 'session_start' | 'session_end' | 'feature_use' | 'token_savings' | 'memory_created' | 'memory_recalled' | 'autonomy_candidate' | 'autonomy_candidate_suppressed' | 'autonomy_apply_started' | 'autonomy_apply_finished' | 'autonomy_apply_blocked';
export interface TelemetryEvent {
    type: TelemetryEventType;
    timestamp: number;
    installId: string;
    data: Record<string, unknown>;
}
export interface TelemetryConsent {
    optedIn: boolean;
    timestamp: number;
    version: string;
}
export interface TelemetryStats {
    installId: string;
    optedIn: boolean;
    queuedEvents: number;
    totalSessionsTracked: number;
    totalTokensSaved: number;
    totalFeatureUses: number;
    totalMemoriesCreated: number;
    totalMemoriesRecalled: number;
    endpointConfigured: boolean;
    remoteStatsConfigured: boolean;
    lastFlushAt?: number;
}
export interface RemoteInstallDrilldown {
    installId: string;
    lastSeenAt?: string;
    sessions: number;
    tokenSavings: number;
    memoriesCreated: number;
    memoriesRecalled: number;
    featureUses: number;
    autonomyEvents: number;
    recentProjects: string[];
}
export interface RemoteTelemetryStats {
    configured: boolean;
    totalInstalls: number;
    activeInstalls7d: number;
    totalSessions: number;
    totalTokenSavings: number;
    totalMemoriesCreated: number;
    totalMemoriesRecalled: number;
    installs: RemoteInstallDrilldown[];
}
export declare class RemoteTelemetry {
    private installId;
    private optedIn;
    private endpoint;
    private apiKey;
    private queue;
    private flushTimer;
    private state;
    constructor(options?: {
        endpoint?: string;
        apiKey?: string;
    });
    getOrCreateUUID(): string;
    getInstallId(): string;
    isOptedIn(): boolean;
    setOptIn(value: boolean): void;
    private loadConsentState;
    trackInstall(): void;
    trackSessionStart(projectId?: string): void;
    trackSessionEnd(durationMs: number, stats?: {
        projectId?: string;
        tokensSaved?: number;
        memoriesCreated?: number;
        memoriesRecalled?: number;
        toolsUsed?: number;
        sessionId?: string;
    }): Promise<{
        sent: number;
        error?: string;
    }>;
    trackFeatureUsage(feature: string, metadata?: Record<string, unknown>): void;
    trackTokenSavings(savings: number, metadata?: Record<string, unknown>): void;
    trackMemoryCreated(scope: string, metadata?: Record<string, unknown>): void;
    trackMemoryRecalled(hitCount: number, metadata?: Record<string, unknown>): void;
    trackAutonomyEvent(type: Extract<TelemetryEventType, 'autonomy_candidate' | 'autonomy_candidate_suppressed' | 'autonomy_apply_started' | 'autonomy_apply_finished' | 'autonomy_apply_blocked'>, metadata?: Record<string, unknown>): void;
    private enqueue;
    private persistQueue;
    private loadQueue;
    private persistState;
    private loadState;
    flush(): Promise<{
        sent: number;
        error?: string;
    }>;
    fetchRemoteStats(): Promise<RemoteTelemetryStats>;
    private startFlushTimer;
    getStats(): TelemetryStats;
    private getNexusVersion;
    private hashIdentifier;
    destroy(): void;
}
export declare function getSharedTelemetry(options?: {
    endpoint?: string;
    apiKey?: string;
}): RemoteTelemetry;
