UNPKG

@ai2070/l0

Version:

L0: The Missing Reliability Substrate for AI

31 lines 1.82 kB
import type { L0Options, L0Result, L0Interceptor } from "../types/l0"; export interface InterceptorContext { name: string; phase: "before" | "after" | "error"; timestamp: number; duration?: number; } export declare class InterceptorManager { private interceptors; private contexts; constructor(interceptors?: L0Interceptor[]); executeBefore(options: L0Options): Promise<L0Options>; executeAfter(result: L0Result): Promise<L0Result>; executeError(error: Error, options: L0Options): Promise<void>; getContexts(): InterceptorContext[]; reset(): void; } export declare function loggingInterceptor(logger?: { info: (message: string, data?: any) => void; error: (message: string, data?: any) => void; }): L0Interceptor; export declare function metadataInterceptor(metadata: Record<string, any>): L0Interceptor; export declare function authInterceptor(getAuth: () => Promise<Record<string, any>> | Record<string, any>): L0Interceptor; export declare function timingInterceptor(): L0Interceptor; export declare function validationInterceptor(validate: (content: string) => boolean | Promise<boolean>, onInvalid?: (content: string) => void): L0Interceptor; export declare function rateLimitInterceptor(maxRequests: number, windowMs: number): L0Interceptor; export declare function cachingInterceptor(cache: Map<string, L0Result>, getCacheKey: (options: L0Options) => string): L0Interceptor; export declare function transformInterceptor(transform: (content: string) => string | Promise<string>): L0Interceptor; export declare function analyticsInterceptor(track: (event: string, data: any) => void | Promise<void>): L0Interceptor; export declare function createInterceptorManager(interceptors?: L0Interceptor[]): InterceptorManager; //# sourceMappingURL=interceptors.d.ts.map