decomposer: generate deliverable files for Define the normalized ingestion contract and pluggable source-connector interface for SCM, CMS, and other content sources.; Implement a GitHub SCM connector that conforms to the normalized ingestion contract and supports scoped full and incremental ingestion of Markdown, plain-text, and source files with webhook and revision metadata.; Implement a SharePoint CMS connector that conforms to the normalized ingestion contract and supports scoped full and incremental ingestion of PDF, DOCX, and HTML files with webhook and revision metadata.; Implement ingestion orchestration and triggers; Normalize, govern, and publish ingested content to the shared knowledge store.; Add deployment/configuration, tests, and documentation for the ingestion agent.; Validate end-to-end ingestion and downstream content availability.
Some checks failed
ci / test (push) Failing after 7s
Some checks failed
ci / test (push) Failing after 7s
This commit is contained in:
18
kab_ingestion/util.py
Normal file
18
kab_ingestion/util.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import hashlib, json
|
||||
from datetime import datetime, timezone
|
||||
|
||||
def now() -> str:
|
||||
return datetime.now(timezone.utc).isoformat()
|
||||
|
||||
def digest(value: bytes | str) -> str:
|
||||
return hashlib.sha256(value if isinstance(value, bytes) else value.encode()).hexdigest()
|
||||
|
||||
def stable_id(tenant: str, source: str, item: str) -> str:
|
||||
return digest(f"{tenant}:{source}:{item}")[:32]
|
||||
|
||||
def require_scope(scope: dict, keys: tuple[str, ...]) -> None:
|
||||
if any(not scope.get(key) for key in keys):
|
||||
raise ValueError(f"missing required scope: {', '.join(keys)}")
|
||||
|
||||
def json_headers(token: str) -> dict[str, str]:
|
||||
return {"Authorization": f"Bearer {token}", "Accept": "application/json"}
|
||||
Reference in New Issue
Block a user