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 Poser5Detector(Detector):
    """
    Decision Making Speed detector for identifying alignment-faking models.
    
    Identifies alignment fakers by analyzing the temporal dynamics of their decision-making 
    process. Uses layer-wise probing to measure at which layer final decisions become 
    predictable. The hypothesis is that alignment fakers require additional computational 
    steps to deliberate about whether it's safe to misbehave.
    
    Based on Section 3.5 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 Poser5Detector()
