/**
 * Cognigate Resource Interceptors
 *
 * Interceptors for network and file system operations that enforce
 * resource limits and track usage.
 *
 * @packageDocumentation
 * @module @vorionsys/cognigate/resource-interceptors
 */
import * as fs from 'node:fs/promises';
import type { ID } from '../common/types.js';
import type { ResourceLimits, ResourceStateProvider } from './types.js';
/**
 * Error thrown when a resource limit is exceeded
 */
export declare class ResourceLimitExceededError extends Error {
    readonly limitType: 'network' | 'filesystem';
    readonly current: number;
    readonly limit: number;
    constructor(message: string, limitType: 'network' | 'filesystem', current: number, limit: number);
}
/**
 * Wrapped fetch function type
 */
export type WrappedFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
/**
 * Create a network interceptor that wraps fetch to track and limit requests.
 *
 * @param executionId - Unique execution identifier
 * @param limits - Resource limits to enforce
 * @param stateProvider - State provider for distributed tracking
 * @param signal - Abort signal for termination
 * @returns Wrapped fetch function
 */
export declare function createNetworkInterceptor(executionId: ID, limits: ResourceLimits, stateProvider: ResourceStateProvider, signal: AbortSignal): WrappedFetch;
/**
 * Wrapped file system functions type
 */
export interface WrappedFileSystemFunctions {
    readFile: typeof fs.readFile;
    writeFile: typeof fs.writeFile;
    appendFile: typeof fs.appendFile;
    unlink: typeof fs.unlink;
    mkdir: typeof fs.mkdir;
    rmdir: typeof fs.rmdir;
    readdir: typeof fs.readdir;
    stat: typeof fs.stat;
    access: typeof fs.access;
    rename: typeof fs.rename;
    copyFile: typeof fs.copyFile;
}
/**
 * Create file system interceptors that wrap fs functions to track and limit operations.
 *
 * @param executionId - Unique execution identifier
 * @param limits - Resource limits to enforce
 * @param stateProvider - State provider for distributed tracking
 * @param signal - Abort signal for termination
 * @returns Object with wrapped file system functions
 */
export declare function createFileSystemInterceptors(executionId: ID, limits: ResourceLimits, stateProvider: ResourceStateProvider, signal: AbortSignal): WrappedFileSystemFunctions;
/**
 * Execution context with interceptors for sandboxed execution
 */
export interface ExecutionInterceptors {
    /** Wrapped fetch function */
    fetch: WrappedFetch;
    /** Wrapped file system functions */
    fs: WrappedFileSystemFunctions;
    /** Abort signal for termination */
    signal: AbortSignal;
}
/**
 * Create all interceptors for an execution
 */
export declare function createExecutionInterceptors(executionId: ID, limits: ResourceLimits, stateProvider: ResourceStateProvider, signal: AbortSignal): ExecutionInterceptors;
//# sourceMappingURL=resource-interceptors.d.ts.map