"""MCP proxy config, policy, and Runtime Gate primitives.

This package includes the local config/policy foundation, encrypted proxy
identity management, MCP stdio passthrough, local classification with privacy
hashing, Runtime Gate enforcement, and durable local approval evidence storage.
Runtime Gate calls use an in-memory circuit breaker for sustained backend
failures.
"""

from importlib.metadata import PackageNotFoundError, version


def _package_version() -> str:
    try:
        return version("agentveil-mcp-proxy")
    except PackageNotFoundError:
        return "0.0.0+dev"


__version__ = _package_version()

from agentveil_mcp_proxy.approval import (
    ApprovalFlowError,
    ApprovalManager,
    ApprovalNotifier,
    ApprovalOutcome,
    ApprovalServer,
    HeadlessPolicy,
    HeadlessPolicyError,
)
from agentveil_mcp_proxy.circuit_breaker import (
    CircuitBreaker,
    CircuitBreakerConfig,
    CircuitBreakerOpenError,
    CircuitState,
)
from agentveil_mcp_proxy.classification import (
    ClassifiedToolCall,
    ToolCallClassifier,
    extract_resource,
    infer_risk_class,
    sha256_jcs,
    sha256_text,
)
from agentveil_mcp_proxy.cli import (
    configure_downstream,
    evidence_summary,
    export_evidence,
    init_proxy,
    list_events,
    load_proxy_config,
    proxy_paths,
    quickstart_filesystem_downstream,
    reissue_grant,
    run_proxy,
    smoke_proxy,
    tail_events,
    vacuum_events,
    verify_evidence,
)
from agentveil_mcp_proxy.evidence import (
    EVIDENCE_EXPORT_SCHEMA_VERSION,
    ApprovalEvidenceCapacityError,
    ApprovalEvidenceDuplicateError,
    ApprovalEvidenceError,
    ApprovalEvidenceNotFoundError,
    ApprovalEvidenceSchemaError,
    ApprovalEvidenceStore,
    ApprovalEvidenceTransitionError,
    ApprovalStatus,
    EvidenceExportError,
    EvidenceProofError,
    EvidenceVerificationError,
    EvidenceVerificationResult,
    PendingApproval,
    RecoveryReport,
    build_evidence_bundle,
    export_evidence_bundle,
    record_hash,
    verify_evidence_bundle,
    verify_evidence_bundle_file,
)
from agentveil_mcp_proxy.passthrough import DownstreamConfig, McpPassthrough, PassthroughError
from agentveil_mcp_proxy.policy import (
    ApprovalConfig,
    AvpConfig,
    DecisionMode,
    FallbackConfig,
    PolicyConfig,
    PolicyDecision,
    PolicyEngine,
    PolicyEvaluation,
    PolicyMatch,
    PolicyReloadResult,
    PolicyRule,
    PolicyRuntime,
    ProxyCircuitBreakerConfig,
    PrivacyConfig,
    ProxyConfig,
    ProxyConfigError,
    RiskClass,
    RoleAuthorityConfig,
    RoleAuthorityMode,
    TimeoutAction,
    ToolCallContext,
    ToolSurfaceConfig,
    ToolSurfaceMode,
    builtin_policy_pack,
    policy_context_hash,
)
from agentveil_mcp_proxy.runtime_gate import (
    RuntimeGateClient,
    RuntimeGateDecision,
    RuntimeGateError,
    RuntimeGateUnavailableError,
    RuntimeGateUntrustedError,
)

__all__ = [
    "__version__",
    "ApprovalConfig",
    "ApprovalEvidenceCapacityError",
    "ApprovalEvidenceDuplicateError",
    "ApprovalEvidenceError",
    "ApprovalEvidenceNotFoundError",
    "ApprovalEvidenceSchemaError",
    "ApprovalEvidenceStore",
    "ApprovalEvidenceTransitionError",
    "ApprovalFlowError",
    "ApprovalManager",
    "ApprovalNotifier",
    "ApprovalOutcome",
    "ApprovalServer",
    "ApprovalStatus",
    "AvpConfig",
    "CircuitBreaker",
    "CircuitBreakerConfig",
    "CircuitBreakerOpenError",
    "CircuitState",
    "ClassifiedToolCall",
    "configure_downstream",
    "DecisionMode",
    "DownstreamConfig",
    "EVIDENCE_EXPORT_SCHEMA_VERSION",
    "evidence_summary",
    "EvidenceExportError",
    "EvidenceProofError",
    "EvidenceVerificationError",
    "EvidenceVerificationResult",
    "FallbackConfig",
    "HeadlessPolicy",
    "HeadlessPolicyError",
    "McpPassthrough",
    "PassthroughError",
    "PendingApproval",
    "PolicyConfig",
    "PolicyDecision",
    "PolicyEngine",
    "PolicyEvaluation",
    "PolicyMatch",
    "PolicyReloadResult",
    "PolicyRule",
    "PolicyRuntime",
    "PrivacyConfig",
    "ProxyConfig",
    "ProxyConfigError",
    "ProxyCircuitBreakerConfig",
    "RecoveryReport",
    "RiskClass",
    "RoleAuthorityConfig",
    "RoleAuthorityMode",
    "RuntimeGateClient",
    "RuntimeGateDecision",
    "RuntimeGateError",
    "RuntimeGateUnavailableError",
    "RuntimeGateUntrustedError",
    "TimeoutAction",
    "ToolCallClassifier",
    "ToolCallContext",
    "ToolSurfaceConfig",
    "ToolSurfaceMode",
    "builtin_policy_pack",
    "build_evidence_bundle",
    "export_evidence",
    "export_evidence_bundle",
    "extract_resource",
    "infer_risk_class",
    "init_proxy",
    "list_events",
    "load_proxy_config",
    "policy_context_hash",
    "proxy_paths",
    "quickstart_filesystem_downstream",
    "reissue_grant",
    "record_hash",
    "run_proxy",
    "smoke_proxy",
    "tail_events",
    "sha256_jcs",
    "sha256_text",
    "vacuum_events",
    "verify_evidence",
    "verify_evidence_bundle",
    "verify_evidence_bundle_file",
]
