"""Egress policy subsystem.

A self-contained guardrail that constrains where a research run's traffic,
LLM calls, embeddings, and URL fetches may go. See ``README.md`` in this
package for the full design, threat model, and the list of enforcement
points (PEPs) scattered across the codebase.

This ``__init__`` re-exports the public API so callers can simply do
``from local_deep_research.security.egress import evaluate_url, EgressScope``.
The implementation lives in:
  - ``policy.py``     — the PDP (decisions) + context construction
  - ``audit_hook.py`` — the process-wide PEP-578 socket.connect net
"""

from .policy import (
    Decision,
    EgressContext,
    EgressScope,
    MAX_DENIED_FETCHES_PER_RUN,
    PolicyDeniedError,
    context_from_snapshot,
    evaluate_embeddings,
    evaluate_engine,
    evaluate_llm_endpoint,
    evaluate_retriever,
    evaluate_url,
    filter_candidates_by_egress,
    filter_engines_by_egress,
)
from .audit_hook import (
    active_egress_context,
    clear_active_context,
    get_active_context,
    install_audit_hook,
    is_installed,
    set_active_context,
)

__all__ = [
    # policy / PDP
    "Decision",
    "EgressContext",
    "EgressScope",
    "MAX_DENIED_FETCHES_PER_RUN",
    "PolicyDeniedError",
    "context_from_snapshot",
    "evaluate_embeddings",
    "evaluate_engine",
    "evaluate_llm_endpoint",
    "evaluate_retriever",
    "evaluate_url",
    "filter_candidates_by_egress",
    "filter_engines_by_egress",
    # audit hook / process-wide PEP
    "active_egress_context",
    "clear_active_context",
    "get_active_context",
    "install_audit_hook",
    "is_installed",
    "set_active_context",
]
