M25: expose provenance-aware knowledge statistics

This commit is contained in:
NuklearRabbit
2026-08-10 16:04:39 +02:00
parent 0935901f11
commit 90cc3cf378
22 changed files with 238 additions and 10 deletions
@@ -1,5 +1,6 @@
from __future__ import annotations
from datetime import datetime
from functools import lru_cache
from typing import Literal, Protocol
@@ -8,6 +9,7 @@ from pydantic import BaseModel
from app.core.config import get_settings
EvidenceState = Literal["grounded", "insufficient", "unavailable"]
KnowledgeStatisticsState = Literal["verified", "sync_reported", "not_reported"]
class SourceCard(BaseModel):
@@ -36,6 +38,11 @@ class KnowledgeHealth(BaseModel):
# A provider may be healthy without exposing a corpus-size endpoint. `None` means
# unknown, never "zero procedures".
document_count: int | None
source_document_count: int
reported_synced_document_count: int | None
reported_failed_document_count: int | None
last_sync_at: datetime | None
statistics_state: KnowledgeStatisticsState
class KnowledgeProvider(Protocol):