"""Load intern catalog from config.yaml.""" from __future__ import annotations from pathlib import Path from typing import Any import yaml from .interns.base import Intern from .interns.bulk_text_read import BulkTextRead from .interns.grep_audit import GrepAudit from .interns.repo_read import RepoRead from .interns.transcript_distill import TranscriptDistill # Explicit registry — MVP choice (see design spec open questions). INTERN_CLASSES: dict[str, type[Intern]] = { "bulk_text_read": BulkTextRead, "grep_audit": GrepAudit, "repo_read": RepoRead, "transcript_distill": TranscriptDistill, } def load_config(config_path: Path) -> dict[str, Any]: with open(config_path, encoding="utf-8") as f: return yaml.safe_load(f) def load_interns(config: dict[str, Any], client: Any = None, safety: Any = None) -> list[Intern]: """Instantiate interns from config, wiring shared client and safety.""" interns = [] for intern_id, intern_cfg in config.get("interns", {}).items(): cls = INTERN_CLASSES.get(intern_id) if cls is None: continue interns.append(cls(config=intern_cfg, client=client, safety=safety)) return interns