import type { ActivityEntry, ActivityStatus, DebugLogger } from "./logger.js"; export declare const SERVER_ACTIVITY_EVENTS: Set; export interface ServerActivityEvent { event_id: string; name: string; status: ActivityStatus; occurred_at: string; session_id?: string; attributes?: Record; } export interface EventReporterOptions { projectUrl: string; agentSecurityUrl: string; token?: (sessionId?: string, principalKey?: string) => string | undefined; request?: (url: string, init: RequestInit, sessionId?: string, principalKey?: string) => Promise | undefined; onUnauthorized?: (sessionId: string | undefined, principalKey: string | undefined, rejectedToken: string) => void; logger?: DebugLogger; fetch?: typeof fetch; maxQueueSize?: number; requestTimeoutMs?: number; /** Durable per-event storage. Omitted reporters remain memory-only. */ outboxDir?: string; now?: () => number; eventId?: () => string; retryBaseMs?: number; retryMaxMs?: number; random?: () => number; } export interface PendingEventScope { sessionId?: string; principalKey?: string; } /** Best-effort delivery of privacy-safe client activity to Agent Security. */ export declare class AgentSecurityEventReporter { private readonly options; private readonly queue; private readonly fetcher; private readonly maxQueueSize; private readonly requestTimeoutMs; private readonly now; private readonly eventId; private delivery; private scheduled; private activeRequest; private flushDeadline; private suppressRetry; private retryTimer; private retryAttempt; private readonly retryBaseMs; private readonly retryMaxMs; private readonly random; constructor(options: EventReporterOptions); get pending(): number; get pendingScopes(): ReadonlyArray; enqueue(entry: ActivityEntry, principalKey?: string): void; /** Attempt all currently deliverable batches, bounded by the caller's deadline. */ flush(timeoutMs?: number): Promise; private schedule; private startDelivery; private scheduleRetry; private drain; private deliver; private request; private persist; private syncOutbox; private acquireOutboxLock; private cleanRenamedLocks; private enforceBounds; private removeFile; private prune; private diagnostic; } export declare function projectActivityEntry(entry: ActivityEntry, createEventId?: () => string): ServerActivityEvent | undefined; /** Stable, non-identifying directory name that prevents cross-project replay. */ export declare function eventOutboxProjectScope(projectUrl: string): string; /** Stable local selector for a bearer without persisting its identifying subject. */ export declare function eventPrincipalKey(subject: string): string;