"""Core observability — handlers, traces, spans, and logging.

All observability consumers work with ``PathwayEvent`` from the
``VMEventEmitter``.  Attach them as listeners on ``PathwayVM``::

    from core.observability import GraphTraceLogger

    vm.add_listener(GraphTraceLogger())

Trace collection is built into the VM — access the last trace via
``vm.last_trace`` or look up by execution ID with ``vm.get_trace(eid)``.
"""

from core.observability.handlers import (
    Colors,
    DebugHandler,
    GraphTraceLogger,
    JsonLineHandler,
)
from core.observability.html_viewer import (
    render_trace_html,
    save_trace_html,
)
from core.observability.logging import (
    configure_logging,
    pop_trace_depth,
    push_trace_depth,
    reset_log_agent_id,
    reset_log_execution_id,
    reset_log_pathway_id,
    reset_log_request_id,
    reset_log_thread_id,
    set_log_agent_id,
    set_log_execution_id,
    set_log_pathway_id,
    set_log_request_id,
    set_log_thread_id,
)
from core.observability.spans import (
    Span,
    SpanKind,
    SpanStatus,
)
from core.observability.trace import (
    DecisionPoint,
    ExecutionTrace,
    TraceCollector,
    trace_to_mermaid,
)

__all__ = [
    "Colors",
    "DebugHandler",
    "DecisionPoint",
    "ExecutionTrace",
    "GraphTraceLogger",
    "JsonLineHandler",
    "Span",
    "SpanKind",
    "SpanStatus",
    "TraceCollector",
    "configure_logging",
    "pop_trace_depth",
    "push_trace_depth",
    "render_trace_html",
    "reset_log_agent_id",
    "reset_log_execution_id",
    "reset_log_pathway_id",
    "reset_log_request_id",
    "reset_log_thread_id",
    "save_trace_html",
    "set_log_agent_id",
    "set_log_execution_id",
    "set_log_pathway_id",
    "set_log_request_id",
    "set_log_thread_id",
    "trace_to_mermaid",
]
