UNPKG

@ai2070/l0

Version:

L0: The Missing Reliability Substrate for AI

58 lines 2.1 kB
import type { L0Telemetry } from "../types/l0"; import type { GuardrailViolation } from "../types/guardrails"; export interface MonitoringConfig { enabled: boolean; sampleRate: number; includeNetworkDetails: boolean; includeTimings: boolean; metadata?: Record<string, any>; } export declare class L0Monitor { private config; private telemetry; private tokenTimestamps; constructor(config?: Partial<MonitoringConfig>); isEnabled(): boolean; private createInitialTelemetry; private generateSessionId; start(): void; complete(): void; recordToken(timestamp?: number): void; recordNetworkError(error: Error, retried: boolean, delay?: number): void; recordRetry(isNetworkError: boolean): void; recordGuardrailViolations(violations: GuardrailViolation[]): void; recordDrift(detected: boolean, types: string[]): void; recordContinuation(enabled: boolean, used: boolean, checkpointContent?: string): void; logEvent(event: Record<string, any>): void; private calculateTimingMetrics; getTelemetry(): L0Telemetry | undefined; toJSON(): string; export(): L0Telemetry | undefined; getSummary(): { sessionId: string; duration: number; tokens: number; tokensPerSecond: number; retries: number; networkErrors: number; violations: number; } | undefined; getNetworkErrorBreakdown(): Record<string, number>; hasNetworkErrors(): boolean; hasViolations(): boolean; getMostCommonNetworkError(): string | null; reset(): void; } export declare function createMonitor(config?: Partial<MonitoringConfig>): L0Monitor; export declare class TelemetryExporter { static toJSON(telemetry: L0Telemetry): string; static toCSV(telemetry: L0Telemetry): string; static toLogFormat(telemetry: L0Telemetry): Record<string, any>; static toMetrics(telemetry: L0Telemetry): Array<{ name: string; value: number; timestamp: number; tags?: Record<string, string>; }>; } //# sourceMappingURL=monitoring.d.ts.map