feat: add autonomous fiscal completion v1

This commit is contained in:
gti
2026-09-22 13:08:38 -03:00
parent eada0df37e
commit e3ac68c70e
28 changed files with 44630 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
"""Evidence-gated origin resolution; CST digits are never an origin source."""
def resolve_origin(product_id: str, aggregate: dict, kb_facts: dict) -> dict:
if aggregate.get("conflict_count", 0):
status = "ORIGIN_CONFLICT"
elif aggregate.get("strong_evidence") and aggregate.get("value") in {str(i) for i in range(9)}:
status = "ORIGIN_CONFIRMED"
else:
status = "ORIGIN_NEEDS_EVIDENCE"
return {
"product_id": product_id,
"status": status,
"value": aggregate.get("value") if status == "ORIGIN_CONFIRMED" else None,
"provenance": aggregate.get("provenance", []),
"reason": "explicit supplier observations only; CST digit ignored",
}