INNER CODE UNIT · Python
_coerce_kg_home
TianGzlab/OmicsClaw · omicsclaw/surfaces/desktop/server.py:400
def _coerce_kg_home(candidate: str) -> Path:
"""Accept either a project root or a concrete `.omicsclaw/knowledge` path."""
value = str(candidate or "").strip()
path = Path(value).expanduser()
if path.name == "knowledge" and path.parent.name == ".omicsclaw":
return path
return path / ".omicsclaw" / "knowledge"
# Bench Phase 3.2 (ADR 0019) — availability of the optional OmicsClaw-KG
# integration, surfaced to the frontend via ``/health`` so it can show/hide
# KG-dependent UI. Set by ``_register_optional_kg_router`` at startup (mirrors
# the ``_NOTEBOOK_AVAILABLE`` flag pattern). Defaults to unavailable.
_KG_AVAILABLE: bool = False
_KG_IMPORT_ERROR: str = ""
def _register_optional_kg_router(app: FastAPI) -> None: