# echo_cog/__init__.py
"""
Echo Cog - Cognitive wrapper for Helix-regenerated models.

This package provides:
  - SeState: Symbolic environment state tracking
  - FibPi3DScheduler: Wave scheduling for specialist routing
  - EchoCogRuntime: Main runtime that wraps a GGUF model
  - Index loaders: Get configs from mistral_model_index.json

Quick start:

    from echo_cog import EchoCogRuntime, get_helix_regen_config

    config = get_helix_regen_config()
    runtime = EchoCogRuntime(config)

    # For MMLU-style questions
    answer, latency, raw = runtime.answer_sample(sample)

    # For free-form questions
    answer, latency = runtime.answer_question("What is the capital of France?")
"""

from .se_state import SeState, TaskStats, QuestionRecord
from .fibpi3d_scheduler import FibPi3DScheduler, WaveInfo
from .runtime import (
    EchoCogRuntime,
    EchoCogConfig,
    MMLUSample,
    load_mmlu_file,
    ProfileName,
    ModeName,
    BackendName,
    PromptStyle,
    RICH_SYSTEM_PROMPT,
)
from .index import (
    get_helix_regen_config,
    get_vendor_config,
    get_model_config,
    get_canonical_pair,
    load_index,
)
from .se_controller_adapter import (
    SeControllerAdapter,
    CogSeDecision,
    get_se_adapter,
    is_se_controller_available,
)

# Lazy imports for backends (avoid hard dependencies)
def __getattr__(name):
    """Lazy import of backend modules."""
    if name == "backend_ollama":
        from . import backend_ollama
        return backend_ollama
    if name == "backend_llama_cpp":
        from . import backend_llama_cpp
        return backend_llama_cpp
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

__all__ = [
    # State
    "SeState",
    "TaskStats",
    "QuestionRecord",
    # Scheduling
    "FibPi3DScheduler",
    "WaveInfo",
    # Runtime
    "EchoCogRuntime",
    "EchoCogConfig",
    "MMLUSample",
    "load_mmlu_file",
    "ProfileName",
    "ModeName",
    "BackendName",
    "PromptStyle",
    "RICH_SYSTEM_PROMPT",
    # Index
    "get_helix_regen_config",
    "get_vendor_config",
    "get_model_config",
    "get_canonical_pair",
    "load_index",
    # SeController Adapter
    "SeControllerAdapter",
    "CogSeDecision",
    "get_se_adapter",
    "is_se_controller_available",
]

__version__ = "0.1.0"
