/**
 * @module policy
 * PolicyEngine for agent.call() constraint enforcement
 *
 * Enforces spending limits, rate limits, scope restrictions, and data filters
 * on agent tool calls. Separate from SecurityPolicy (risk classification).
 */
import type { Result } from '@private.me/shared';
import { AgentError } from './agent-call.js';
import type { PolicyConstraints } from './agent-call.js';
/**
 * Policy evaluation result
 */
export interface PolicyResult {
    /** Whether the request is allowed */
    allowed: boolean;
    /** Reason for denial (if not allowed) */
    reason?: string;
    /** Which constraint was violated (if not allowed) */
    violatedConstraint?: 'amount' | 'daily' | 'rate' | 'scope' | 'tool';
}
/**
 * Detailed policy violation information for AI agents
 */
export interface PolicyViolationDetails extends Record<string, unknown> {
    /** What was requested/denied */
    requested: string | number;
    /** What the limit/constraint is */
    allowed: string | number | string[];
    /** Which constraint type was violated */
    constraint: 'amountPerTxn' | 'dailyAmount' | 'callsPerMinute' | 'scope' | 'tool';
    /** How to fix the issue */
    fix: string;
    /** Additional context (optional) */
    current?: number;
    /** New total after this request (optional, for daily limits) */
    newTotal?: number;
}
/**
 * Policy limits with time-window tracking
 */
export interface PolicyLimits {
    /** Maximum amount per transaction */
    amountPerTxn?: number;
    /** Maximum amount per day (24-hour window) */
    dailyAmount?: number;
    /** Maximum amount per month (30-day window) */
    monthlyAmount?: number;
    /** Maximum calls per minute */
    callsPerMinute?: number;
}
/**
 * PolicyEngine - Enforces constraints on agent.call() requests
 *
 * Tracks:
 * - Per-transaction spending limits
 * - Daily spending limits
 * - Rate limits (calls per minute)
 * - Allowed tools/scopes
 *
 * Thread-safe for concurrent requests from the same agent.
 */
export declare class PolicyEngine {
    /** Rate limit tracker by agent DID */
    private readonly rateLimits;
    /** Daily spending tracker by agent DID */
    private readonly dailySpending;
    /** Monthly spending tracker by agent DID */
    private readonly monthlySpending;
    /**
     * Evaluate a policy against a request
     *
     * @param agentDID - Agent DID making the request
     * @param tool - Tool being called (e.g., "stripe:createCharge")
     * @param params - Tool parameters
     * @param constraints - Policy constraints to enforce
     * @returns Policy evaluation result
     */
    evaluate(agentDID: string, tool: string, params: unknown, constraints: PolicyConstraints): Result<void, AgentError>;
    /**
     * Record a successful call (for rate limiting)
     *
     * @param agentDID - Agent DID
     */
    recordCall(agentDID: string): void;
    /**
     * Record successful spending (for daily and monthly limits)
     *
     * @param agentDID - Agent DID
     * @param amount - Amount spent
     */
    recordSpending(agentDID: string, amount: number): void;
    /**
     * Get current rate limit status for an agent
     *
     * @param agentDID - Agent DID
     * @returns Calls in current minute
     */
    getCurrentRateLimit(agentDID: string): number;
    /**
     * Get current daily spending for an agent
     *
     * @param agentDID - Agent DID
     * @returns Amount spent today
     */
    getDailySpending(agentDID: string): number;
    /**
     * Get current monthly spending for an agent
     *
     * @param agentDID - Agent DID
     * @returns Amount spent this month
     */
    getMonthlySpending(agentDID: string): number;
    /**
     * Reset all limits for an agent (for testing)
     *
     * @param agentDID - Agent DID
     */
    reset(agentDID: string): void;
    /**
     * Check rate limit
     */
    private checkRateLimit;
    /**
     * Check daily spending limit
     */
    private checkDailyLimit;
    /**
     * Extract amount from params
     */
    private extractAmount;
    /**
     * Get current day identifier (YYYY-MM-DD in UTC)
     */
    private getCurrentDay;
    /**
     * Get current month identifier (YYYY-MM in UTC)
     */
    private getCurrentMonth;
    /**
     * Check monthly spending limit
     */
    private checkMonthlyLimit;
}
/**
 * Get the global policy engine instance
 *
 * @returns PolicyEngine instance
 */
export declare function getGlobalPolicyEngine(): PolicyEngine;
