28 lines
716 B
Python
28 lines
716 B
Python
|
|
"""Registered derived-record kinds. No prompt templates, no domain heuristics."""
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import json
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
KINDS_PATH = Path(__file__).resolve().parent / "config" / "derived_kinds.json"
|
||
|
|
|
||
|
|
|
||
|
|
def load_kinds() -> dict[str, dict]:
|
||
|
|
payload = json.loads(KINDS_PATH.read_text(encoding="utf-8"))
|
||
|
|
return {item["id"]: item for item in payload.get("kinds", [])}
|
||
|
|
|
||
|
|
|
||
|
|
def known_kind_ids() -> set[str]:
|
||
|
|
return set(load_kinds())
|
||
|
|
|
||
|
|
|
||
|
|
def require_kind(kind: str) -> dict:
|
||
|
|
kinds = load_kinds()
|
||
|
|
if kind not in kinds:
|
||
|
|
raise ValueError(kind)
|
||
|
|
return kinds[kind]
|
||
|
|
|
||
|
|
|
||
|
|
def catalog() -> list[dict]:
|
||
|
|
return sorted(load_kinds().values(), key=lambda item: item["id"])
|