"""Configuration for the Debug Oracle."""
from dataclasses import dataclass, field
from pathlib import Path
from typing import Optional
@dataclass
class LLMConfig:
"""LLM endpoint configuration."""
# Default to local Qwen model
base_url: str = "http://127.0.0.1:8080/v1"
model: str = "local"
max_tokens: int = 8192
temperature: float = 0.1 # Low for deterministic analysis
timeout: int = 180 # Reasoning can take time
@dataclass
class IngestConfig:
"""Data ingestion configuration."""
# How far back to look
lookback_minutes: int = 60
# Max log lines per source
max_log_lines: int = 500
# Docker containers to monitor (empty = all)
containers: list[str] = field(default_factory=list)
# Systemd units to monitor
systemd_units: list[str] = field(default_factory=list)
# Git repos to check
git_repos: list[str] = field(default_factory=list)
# Include system metrics
include_metrics: bool = True
# Include recent config changes
include_config_changes: bool = True
@dataclass
class OracleConfig:
"""Main configuration."""
llm: LLMConfig = field(default_factory=LLMConfig)
ingest: IngestConfig = field(default_factory=IngestConfig)
# Output format: text, json, rich
output_format: str = "rich"
# Verbosity level (0 = summary only, 1 = details, 2 = raw data)
verbosity: int = 1
# Working directory for state files
state_dir: Path = field(default_factory=lambda: Path.home() / ".debug-oracle")
# Alert target for watchdog
alert_target: str = "telegram"
def __post_init__(self):
self.state_dir.mkdir(parents=True, exist_ok=True)