File size: 1,087 Bytes
d42f795
 
 
8667228
d42f795
 
 
 
8667228
d42f795
 
 
 
 
 
8667228
d42f795
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
from typing import Optional, Dict

# Optional: load .env for local dev; harmless on HF Spaces
try:
    from dotenv import load_dotenv  # type: ignore
    load_dotenv()
except Exception:
    pass

def _as_bool(val: Optional[str], default: bool) -> bool:
    if val is None:
        return default
    return val.strip().lower() in {"1", "true", "yes", "on", "y", "t"}

# Defaults preserve current behaviour (all off unless env enabled)
SANITIZE_ENABLED = _as_bool(os.getenv("LAB_SANITIZE_ENABLED"), False)
STOPSEQ_ENABLED  = _as_bool(os.getenv("LAB_STOPSEQ_ENABLED"),  False)
CRITIC_ENABLED   = _as_bool(os.getenv("LAB_CRITIC_ENABLED"),   False)
JSON_MODE        = _as_bool(os.getenv("LAB_JSON_MODE"),        False)
EVIDENCE_GATE    = _as_bool(os.getenv("LAB_EVIDENCE_GATE"),    False)

def snapshot() -> Dict[str, bool]:
    return {
        "LAB_SANITIZE_ENABLED": SANITIZE_ENABLED,
        "LAB_STOPSEQ_ENABLED":  STOPSEQ_ENABLED,
        "LAB_CRITIC_ENABLED":   CRITIC_ENABLED,
        "LAB_JSON_MODE":        JSON_MODE,
        "LAB_EVIDENCE_GATE":    EVIDENCE_GATE,
    }