/**
 * ToolRateLimiter -- Per-(agentId, toolName) sliding-window rate gate.
 *
 * Fires during PreToolUse before any tool dispatches. If the limit is
 * breached the gate throws synchronously (fail-closed). Supports per-tool
 * and per-pack override policies so compliance packs can enforce
 * tighter invocation budgets on sensitive tools.
 *
 * P3-T1 coverage gap: Tool-scoped rate limiting per agent.
 *
 * Compliance bindings:
 *   - SOC 2 CC6.1: access control
 *   - HIPAA 164.312(a)(1): access control minimum-necessary
 *   - MRPC 1.6 / legal packs: per-matter tool budget
 *
 * @connexum/ai-governance
 */
export declare class ToolRateLimitExceededError extends Error {
    readonly agentId: string;
    readonly toolName: string;
    readonly retryAfterMs: number;
    readonly packBinding: string[];
    constructor(opts: {
        agentId: string;
        toolName: string;
        retryAfterMs: number;
        packBinding?: string[];
    });
}
export interface ToolRateLimitWindow {
    windowMs: number;
    maxInvocations: number;
}
export interface ToolRateLimiterConfig {
    /** Default limit applied when no per-tool or per-pack override matches. */
    defaultLimit: ToolRateLimitWindow;
    /** Override limits keyed by tool name. */
    perToolOverrides: Record<string, ToolRateLimitWindow>;
    /**
     * Override limits keyed by pack ID.
     * Applied when the active pack ID matches. Per-tool overrides take
     * precedence over per-pack overrides. Per-pack overrides take precedence
     * over defaultLimit.
     */
    perPackOverrides: Record<string, ToolRateLimitWindow>;
    /**
     * Callback invoked on every rate-limited call (for audit integration).
     * The caller is responsible for routing this to the audit chain.
     */
    onRateLimited?: (event: ToolRateLimitAuditEvent) => void;
}
export interface ToolRateLimitAuditEvent {
    type: 'governance:tool-rate-limited';
    agentId: string;
    toolName: string;
    windowMs: number;
    maxInvocations: number;
    currentCount: number;
    retryAfterMs: number;
    packBinding: string[];
    timestamp: string;
}
export declare class ToolRateLimiter {
    private readonly config;
    /** Map key: `${agentId}::${toolName}` */
    private readonly windows;
    constructor(config: ToolRateLimiterConfig);
    /**
     * Resolve the rate-limit window for a given tool, considering the active
     * pack binding. Returns the most-specific matching window.
     */
    resolveWindow(toolName: string, activePackIds?: string[]): ToolRateLimitWindow;
    /**
     * PreToolUse hook entry point.
     *
     * Records the invocation timestamp and throws synchronously if the sliding
     * window limit is exceeded.
     *
     * @param agentId     Identity of the calling agent.
     * @param toolName    Name of the tool being invoked.
     * @param activePackIds Active compliance pack IDs for context/override.
     */
    hook(agentId: string, toolName: string, activePackIds?: string[]): void;
    /**
     * Return the current invocation count in the sliding window for a key.
     * Useful for monitoring and tests.
     */
    getCount(agentId: string, toolName: string, activePackIds?: string[]): number;
    /**
     * Reset counters for a specific agent/tool pair (for tests or operator reset).
     */
    reset(agentId: string, toolName: string): void;
}
//# sourceMappingURL=tool-rate-limit.d.ts.map