import type { Intent, Decision, ID } from '../common/types.js';
import type { OutputBinding } from '../semantic-governance/types.js';
import type { ResourceLimits, ResourceUsage, ResourceStateProvider, OutputValidationOptions, TerminationReason } from './types.js';
import { ResourceTracker, createResourceTracker } from './resource-tracker.js';
import { createResourceStateProvider, RedisResourceStateProvider } from './resource-state-provider.js';
import { ResourceLimitExceededError, type ExecutionInterceptors } from './resource-interceptors.js';
import { OutputIntegrator, createStrictOutputIntegrator, createPermissiveOutputIntegrator } from './output-integration.js';
export type { ResourceLimits, ResourceUsage, OutputValidationOptions, TerminationReason };
export { ResourceTracker, createResourceTracker };
export { RedisResourceStateProvider, createResourceStateProvider };
export { ResourceLimitExceededError };
export { OutputIntegrator, createStrictOutputIntegrator, createPermissiveOutputIntegrator };
/**
 * Execution context for running an intent
 */
export interface ExecutionContext {
    intent: Intent;
    decision: Decision;
    resourceLimits: ResourceLimits;
    /** Output validation options */
    outputValidation?: OutputValidationOptions;
    /** Output binding for schema validation */
    outputBinding?: OutputBinding;
}
/**
 * Execution result
 */
export interface ExecutionResult {
    intentId: ID;
    executionId: ID;
    success: boolean;
    outputs: Record<string, unknown>;
    resourceUsage: ResourceUsage;
    startedAt: string;
    completedAt: string;
    error?: string;
    /** Whether execution was terminated due to resource limits */
    terminated?: boolean;
    /** Termination reason if applicable */
    terminationReason?: TerminationReason;
    /** Output validation result */
    outputValidation?: {
        valid: boolean;
        piiDetected: boolean;
        piiTypes: string[];
        sanitized: boolean;
    };
}
/**
 * Execution handler function type.
 * Handlers receive interceptors for sandboxed network/filesystem access.
 */
export type ExecutionHandler = (intent: Intent, context: Record<string, unknown>, interceptors?: ExecutionInterceptors) => Promise<Record<string, unknown>>;
/**
 * Cognigate gateway options
 */
export interface CognigateGatewayOptions {
    /** Default resource limits */
    defaultLimits?: Partial<ResourceLimits>;
    /** State provider for distributed tracking (optional, uses Redis if not provided) */
    stateProvider?: ResourceStateProvider;
    /** Default output validation options */
    defaultOutputValidation?: OutputValidationOptions;
    /** Default output binding for schema validation */
    defaultOutputBinding?: OutputBinding;
    /** Whether to use distributed state (default: true) */
    useDistributedState?: boolean;
}
/**
 * Cognigate execution gateway
 */
export declare class CognigateGateway {
    private handlers;
    private activeExecutions;
    private defaultLimits;
    private stateProvider?;
    private outputIntegrator?;
    private useDistributedState;
    private defaultOutputValidation?;
    private defaultOutputBinding?;
    constructor(options?: CognigateGatewayOptions);
    /**
     * Register an execution handler for an intent type
     */
    registerHandler(intentType: string, handler: ExecutionHandler): void;
    /**
     * Execute an approved intent with resource limiting and output validation
     */
    execute(context: ExecutionContext): Promise<ExecutionResult>;
    /**
     * Execute a promise with a timeout and abort signal support.
     */
    private withAbortableTimeout;
    /**
     * Create empty resource usage
     */
    private emptyUsage;
    /**
     * Terminate an execution by intent ID
     */
    terminate(intentId: ID, reason?: string): Promise<boolean>;
    /**
     * Get active execution info
     */
    getActiveExecution(intentId: ID): {
        executionId: ID;
        startedAt: string;
    } | undefined;
    /**
     * Get count of active executions
     */
    getActiveExecutionCount(): number;
    /**
     * List all active execution IDs
     */
    listActiveExecutions(): Array<{
        intentId: ID;
        executionId: ID;
        startedAt: string;
    }>;
}
/**
 * Create a new Cognigate gateway instance
 */
export declare function createGateway(options?: CognigateGatewayOptions): CognigateGateway;
export declare function createGatewayWithLimits(defaultLimits?: Partial<ResourceLimits>): CognigateGateway;
//# sourceMappingURL=index.d.ts.map