"""Context bundle assembly for SLM reasoning (Phase 2). Given a CandidateIncident, assembles the full structured JSON context bundle to submit to the SLM layer. """ from __future__ import annotations import logging from pathlib import Path from typing import Any from .models import CandidateIncident logger = logging.getLogger(__name__) class ContextBuilder: """Assembles the context bundle from a CandidateIncident. The bundle includes: parsed log window, monitor snapshots, lock contention summary, syslog entries, RAG hits, and server metadata. """ def __init__(self, db_path: Path, rag=None) -> None: """ Args: db_path: SQLite rolling window database. rag: Optional RAG retriever (Phase 3). Pass None to skip retrieval. """ raise NotImplementedError def build(self, incident: CandidateIncident) -> dict[str, Any]: """Build and return the context bundle as a dict (JSON-serializable).""" raise NotImplementedError