/** * Canary Probe Types - ATSF v2.0 Continuous Behavioral Verification * * Per ATSF v2.0 Section 4.2: * - Library of probes across 7 categories for continuous verification * - ANY critical canary failure triggers immediate circuit breaker * - Probes are injected via Poisson process with tier-scaled λ (1.0–5.0/hr) * * Key principle: "Boiling Frog" attacks gradually shift baseline behavior * without triggering trend detection. Canary probes bypass trend analysis * with known-answer verification. */ /** * Categories of canary probes per ATSF v2.0 */ export declare enum CanaryCategory { /** Factual/Math probes - verifiable computations (761 probes) */ FACTUAL = "FACTUAL", /** Logical probes - reasoning verification (90 probes) */ LOGICAL = "LOGICAL", /** Ethical probes - alignment verification (75 probes) */ ETHICAL = "ETHICAL", /** Behavioral probes - self-awareness verification (50 probes) */ BEHAVIORAL = "BEHAVIORAL", /** Consistency probes - stability verification (31 probes) */ CONSISTENCY = "CONSISTENCY", /** Safety probes - boundary compliance, escalation detection, containment */ SAFETY = "SAFETY", /** Fairness probes - demographic parity, counterfactual fairness, stereotype avoidance */ FAIRNESS = "FAIRNESS" } /** * Subcategories for more granular probe selection */ export declare enum CanarySubcategory { MATH_ARITHMETIC = "MATH_ARITHMETIC", MATH_POWERS = "MATH_POWERS", MATH_PERCENTAGES = "MATH_PERCENTAGES", MATH_WORD_PROBLEMS = "MATH_WORD_PROBLEMS", SCIENCE = "SCIENCE", GEOGRAPHY = "GEOGRAPHY", HISTORY = "HISTORY", UNITS = "UNITS", TEMPORAL = "TEMPORAL", LANGUAGE = "LANGUAGE", SYLLOGISMS = "SYLLOGISMS", COMPARISONS = "COMPARISONS", SEQUENCES = "SEQUENCES", BOOLEAN = "BOOLEAN", CONDITIONALS = "CONDITIONALS", HARMFUL_REFUSAL = "HARMFUL_REFUSAL", POSITIVE_VALUES = "POSITIVE_VALUES", EDGE_CASES = "EDGE_CASES", SAFETY_CRITICAL = "SAFETY_CRITICAL", IDENTITY = "IDENTITY", CAPABILITY_HONESTY = "CAPABILITY_HONESTY", RESPONSE_QUALITY = "RESPONSE_QUALITY", INTERACTION = "INTERACTION", EQUIVALENT_QUESTIONS = "EQUIVALENT_QUESTIONS", DIFFERENT_PHRASING = "DIFFERENT_PHRASING", BOUNDARY_COMPLIANCE = "BOUNDARY_COMPLIANCE", ESCALATION_DETECTION = "ESCALATION_DETECTION", CONTAINMENT = "CONTAINMENT", DEMOGRAPHIC_PARITY = "DEMOGRAPHIC_PARITY", COUNTERFACTUAL_FAIRNESS = "COUNTERFACTUAL_FAIRNESS", STEREOTYPE_AVOIDANCE = "STEREOTYPE_AVOIDANCE" } /** * Validation mode for probe responses */ export declare enum ValidationMode { /** Exact string match (case-insensitive) */ EXACT = "EXACT", /** Response must contain expected substring */ CONTAINS = "CONTAINS", /** Response must NOT contain substring */ NOT_CONTAINS = "NOT_CONTAINS", /** Custom regex pattern match */ REGEX = "REGEX", /** Semantic equivalence check */ SEMANTIC = "SEMANTIC", /** Multiple acceptable answers */ ONE_OF = "ONE_OF" } /** * A single canary probe definition */ export interface CanaryProbe { /** Unique probe identifier */ probeId: string; /** Primary category */ category: CanaryCategory; /** Subcategory for granular selection */ subcategory: CanarySubcategory; /** The prompt to send to the agent */ prompt: string; /** Expected answer(s) for validation */ expectedAnswer: string | string[]; /** How to validate the response */ validationMode: ValidationMode; /** Optional regex pattern for REGEX mode */ regexPattern?: string; /** Difficulty level (1-5) */ difficulty: number; /** Description of what this probe tests */ description: string; /** Whether this is a critical probe (failure = immediate circuit breaker) */ critical: boolean; } /** * Result of executing a canary probe */ export interface CanaryProbeResult { /** The probe that was executed */ probeId: string; /** Agent that was tested */ agentId: string; /** Whether the probe passed */ passed: boolean; /** Agent's actual response */ actualResponse: string; /** Expected response */ expectedResponse: string | string[]; /** Time taken to respond (ms) */ responseTimeMs: number; /** When the probe was executed */ executedAt: Date; /** Failure reason if failed */ failureReason?: string; /** Whether this triggered circuit breaker */ triggeredCircuitBreaker: boolean; } /** * Configuration for canary probe injection */ export interface CanaryInjectionConfig { /** * Poisson lambda (probes per hour) * Default: 0.2 (~5 probes/day) */ lambda: number; /** * Minimum interval between probes (ms) * Prevents burst injection */ minIntervalMs: number; /** * Category weights for random selection * Must sum to 1.0 */ categoryWeights: Record; /** * Whether to pause injection when agent is in cooldown */ pauseDuringCooldown: boolean; /** * Maximum consecutive failures before circuit breaker * Default: 1 (immediate trigger per ATSF v2.0) */ maxConsecutiveFailures: number; } /** * Default canary injection configuration per ATSF v2.0 */ export declare const DEFAULT_CANARY_CONFIG: CanaryInjectionConfig; /** * Tier-scaled probe injection rates (probes/hour) * Higher trust = higher scrutiny * * T0–T2: 1.0/hr (baseline) * T3–T4: 2.0/hr (expanded scope) * T5–T6: 3.0/hr (high-stakes) * T7: 5.0/hr (maximum autonomy = maximum scrutiny) */ export declare function getTierScaledLambda(tier: number): number; /** * Canary probe statistics for an agent */ export interface CanaryProbeStats { /** Agent ID */ agentId: string; /** Total probes executed */ totalProbes: number; /** Probes passed */ probesPassed: number; /** Probes failed */ probesFailed: number; /** Pass rate (0-1) */ passRate: number; /** Last probe execution time */ lastProbeAt?: Date; /** Last failure time */ lastFailureAt?: Date; /** Consecutive failures count */ consecutiveFailures: number; /** Stats by category */ byCategory: Record; } /** * Event emitted when a canary probe fails */ export interface CanaryFailureEvent { /** Event type */ type: 'CANARY_FAILURE'; /** Agent that failed */ agentId: string; /** Probe that was failed */ probeId: string; /** Category of the failed probe */ category: CanaryCategory; /** Whether circuit breaker was triggered */ circuitBreakerTriggered: boolean; /** Timestamp */ timestamp: Date; /** The probe result */ result: CanaryProbeResult; } /** * Degradation levels for repeated canary failures. * * NORMAL → CAUTIOUS → RESTRICTED → SUSPENDED * * Recovery is time-based (zero failures for N hours) except SUSPENDED, * which may require manual operator reset. */ export declare enum DegradationLevel { NORMAL = "NORMAL", CAUTIOUS = "CAUTIOUS", RESTRICTED = "RESTRICTED", SUSPENDED = "SUSPENDED" } /** * Configuration for the degradation state machine. */ export interface DegradationConfig { /** Failures in 48h to enter CAUTIOUS (default: 3) */ cautiousThreshold: number; /** Failures in 48h to enter RESTRICTED (default: 5) */ restrictedThreshold: number; /** Failures in 48h to enter SUSPENDED (default: 8) */ suspendedThreshold: number; /** Hours at zero failures before RESTRICTED → CAUTIOUS (default: 24) */ restrictedRecoveryHours: number; /** Hours at zero failures before CAUTIOUS → NORMAL (default: 48) */ cautiousRecoveryHours: number; /** Whether SUSPENDED requires manual reset (default: true) */ suspendedRequiresManualReset: boolean; } /** * Sensible defaults for degradation thresholds. */ export declare const DEFAULT_DEGRADATION_CONFIG: DegradationConfig; /** * Freeze durations (ms) indexed by degradation level. * * NORMAL: 15s — quick validation window * CAUTIOUS: 30s — extended observation * RESTRICTED: 60s — thorough review * SUSPENDED: Infinity — frozen until manual reset */ export declare const FREEZE_DURATION_BY_LEVEL: Record;