/**
 * A2A Attestation Service
 *
 * Generates and processes attestations for agent-to-agent interactions.
 * Integrates with the Agent Anchor attestation system for trust scoring.
 *
 * @packageDocumentation
 */
import { type A2AAttestationData, type A2AMessage, type ChainLink } from './types.js';
/**
 * A2A attestation record
 */
export interface A2AAttestation {
    /** Unique attestation ID */
    id: string;
    /** Attestation type (always 'a2a_interaction') */
    type: 'a2a_interaction';
    /** Caller CAR ID */
    callerCarId: string;
    /** Callee CAR ID */
    calleeCarId: string;
    /** Action invoked */
    action: string;
    /** Request ID */
    requestId: string;
    /** Root request ID (for chains) */
    rootRequestId?: string;
    /** Success/failure */
    outcome: 'success' | 'failure' | 'timeout' | 'rejected';
    /** Attestation data */
    data: A2AAttestationData;
    /** Chain information */
    chain: {
        depth: number;
        trustFloor: number;
        links: ChainLink[];
    };
    /** Timestamp */
    timestamp: string;
    /** Signed by callee */
    calleeSignature?: string;
}
/**
 * Attestation batch for efficient processing
 */
export interface AttestationBatch {
    attestations: A2AAttestation[];
    batchId: string;
    createdAt: string;
}
/**
 * Trust score impact calculation
 */
export interface TrustImpact {
    carId: string;
    scoreChange: number;
    reason: string;
    factors: Record<string, number>;
}
/**
 * Attestation submission callback
 */
export type AttestationCallback = (attestation: A2AAttestation) => Promise<void>;
export declare class A2AAttestationService {
    private pendingAttestations;
    private callbacks;
    private batchSize;
    private flushIntervalMs;
    private flushTimer;
    constructor(config?: {
        batchSize?: number;
        flushIntervalMs?: number;
    });
    /**
     * Start periodic flushing
     */
    start(): void;
    /**
     * Stop periodic flushing
     */
    stop(): Promise<void>;
    /**
     * Register callback for attestation submission
     */
    onAttestation(callback: AttestationCallback): void;
    /**
     * Generate attestation from A2A invoke result
     */
    generateAttestation(request: A2AMessage, response: A2AMessage | null, durationMs: number): A2AAttestation;
    /**
     * Record an attestation
     */
    record(attestation: A2AAttestation): Promise<void>;
    /**
     * Flush pending attestations
     */
    flush(): Promise<number>;
    /**
     * Calculate trust impact for both caller and callee
     */
    calculateTrustImpact(attestation: A2AAttestation): TrustImpact[];
    /**
     * Calculate caller trust impact
     */
    private calculateCallerImpact;
    /**
     * Calculate callee trust impact
     */
    private calculateCalleeImpact;
    /**
     * Determine outcome from response
     */
    private determineOutcome;
    /**
     * Extract violations from response
     */
    private extractViolations;
    /**
     * Calculate trust floor from chain
     */
    private calculateTrustFloor;
    /**
     * Generate A2A analytics for an agent
     */
    generateAnalytics(attestations: A2AAttestation[], carId: string): {
        asCallerStats: Record<string, number>;
        asCalleeStats: Record<string, number>;
        topPartners: {
            carId: string;
            count: number;
        }[];
        avgResponseTime: number;
        successRate: number;
    };
    /**
     * Get pending attestation count
     */
    getPendingCount(): number;
}
export declare function createA2AAttestationService(config?: {
    batchSize?: number;
    flushIntervalMs?: number;
}): A2AAttestationService;
export declare function getA2AAttestationService(): A2AAttestationService;
//# sourceMappingURL=attestation.d.ts.map