"""Canonical completion contract for production AI automation runs.""" from __future__ import annotations AI_AUTOMATION_RUNTIME_CONTRACT_SCHEMA_VERSION = ( "ai_automation_runtime_completion_contract_v2" ) # Every stage is required before the product may claim an autonomous security # or operations loop is complete. A source contract or historical aggregate is # useful evidence, but it is not a same-run production receipt. AI_AUTOMATION_REQUIRED_LOOP_STAGES = ( "mcp_context", "service_log_evidence", "normalized_asset_identity", "source_truth_diff", "risk_policy_decision", "candidate", "check_mode", "executor_log_projection", "controlled_apply", "auto_repair_execution_receipt", "post_apply_verifier", "retry_or_rollback", "incident_closure", "km_playbook_writeback", "rag_writeback", "playbook_trust", "timeline_projection", "telegram_receipt", ) AI_AUTOMATION_EXECUTION_CORRELATED_STAGES = ( "candidate", "check_mode", "controlled_apply", "auto_repair_execution_receipt", "post_apply_verifier", "km_playbook_writeback", "telegram_receipt", ) AI_AUTOMATION_REQUIRED_OUTCOME_METRICS = ( "mtta_seconds", "mttr_seconds", "false_positive_rate", "recurrence_rate", "human_intervention_rate", "verifier_pass_rate", "rollback_rate", "signal_freshness_slo_pass_rate", "asset_coverage_percent", )