from pathlib import Path
from typing import override

from bench_af._abstract.objects import Detector, Environment, EvalLog, ModelOrganism
import torch

CURRENT_DIRECTORY = Path(__file__).parent


class Poser1Detector(Detector):
    """
    Belief State Induction detector for identifying alignment-faking models.
    
    Attempts to identify alignment fakers by manipulating their internal belief states
    about whether it's safe to misbehave. Injects "safety belief" vectors into model 
    activations and measures which model responds more strongly to the manipulation.
    
    Based on Section 3.1 of "Poser: Unmasking Alignment Faking LLMs by Manipulating 
    Their Internals" (Clymer et al., 2024).
    """

    def __init__(self) -> None:
        super().__init__(
            name=CURRENT_DIRECTORY.name,
            supported_model_organisms=set(),
            supported_environments=set(),
        )
        self.activation_cache: dict[str, torch.Tensor] = {}
    
    @override
    def modify_environment(self, environment: Environment) -> None:
        # TODO: implement
        pass
    
    @override
    def modify_model_organism(self, model_organism: ModelOrganism) -> None:
        # TODO: implement
        pass

    @override
    def get_prediction(self, eval_logs: list[EvalLog]) -> tuple[float, str]:
        # TODO: implement
        return 0.0, "Example explanation"


def get() -> Detector:
    return Poser1Detector()
