mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-18 15:29:36 +00:00
Complete Tier-1 closure follow-through by wiring docs governance gates, RC release readiness checks, source-of-truth enforcement, executive weekly contract surface, and go-live severity notes. Add full go-live revenue execution documentation set (production activation, real production playbook, trust expansion, first 3 clients, live deployment, and automated revenue engine) and register all canonical paths. Made-with: Cursor
72 lines
2.2 KiB
Python
72 lines
2.2 KiB
Python
"""Contradiction Engine API — detect and manage system contradictions.
|
|
|
|
See repo root: `docs/trust/ledger-vs-tool-verification.md` for how this relates to
|
|
`VerificationLedger` / `tool_verification`.
|
|
"""
|
|
|
|
from fastapi import APIRouter, Depends, HTTPException
|
|
from pydantic import BaseModel as PydanticBase
|
|
from typing import Any, Dict, List, Optional
|
|
|
|
router = APIRouter(prefix="/contradictions", tags=["Contradictions"])
|
|
|
|
|
|
class ContradictionCreate(PydanticBase):
|
|
source_a: str
|
|
source_b: str
|
|
claim_a: str
|
|
claim_b: str
|
|
contradiction_type: str = "factual"
|
|
severity: str = "medium"
|
|
detected_by: str = "manual"
|
|
evidence: Optional[Dict[str, Any]] = None
|
|
|
|
|
|
class ContradictionResolve(PydanticBase):
|
|
resolution: str
|
|
status: str = "resolved"
|
|
|
|
|
|
@router.post("/")
|
|
async def register_contradiction(body: ContradictionCreate) -> Dict[str, Any]:
|
|
"""Register a new contradiction."""
|
|
sev = (body.severity or "").strip().lower()
|
|
if sev in ("v3", "critical") and not (body.evidence or {}):
|
|
raise HTTPException(
|
|
status_code=422,
|
|
detail="severity V3/critical requires non-empty evidence (trust plane receipt)",
|
|
)
|
|
return {
|
|
"status": "registered",
|
|
"source_a": body.source_a,
|
|
"source_b": body.source_b,
|
|
"contradiction_type": body.contradiction_type,
|
|
"severity": body.severity,
|
|
}
|
|
|
|
|
|
@router.get("/")
|
|
async def list_contradictions() -> Dict[str, Any]:
|
|
"""List active contradictions."""
|
|
return {"contradictions": [], "total": 0}
|
|
|
|
|
|
@router.get("/stats")
|
|
async def contradiction_stats() -> Dict[str, Any]:
|
|
"""Get contradiction statistics."""
|
|
return {"total": 0, "active": 0, "resolved": 0, "critical_active": 0}
|
|
|
|
|
|
@router.get("/{contradiction_id}")
|
|
async def get_contradiction(contradiction_id: str) -> Dict[str, Any]:
|
|
"""Get a specific contradiction."""
|
|
return {"id": contradiction_id, "status": "not_found"}
|
|
|
|
|
|
@router.put("/{contradiction_id}/resolve")
|
|
async def resolve_contradiction(
|
|
contradiction_id: str, body: ContradictionResolve
|
|
) -> Dict[str, Any]:
|
|
"""Resolve a contradiction."""
|
|
return {"id": contradiction_id, "status": body.status, "resolution": body.resolution}
|