"""Runtime configuration for the agent-permissions library.""" from __future__ import annotations from dataclasses import dataclass, field from typing import Optional from .caching.store import CacheStore, InMemoryCacheStore @dataclass class Settings: """Holds configuration knobs for the library.""" http_timeout: float = 10.0 http_user_agent: str = ( "agent-permissions-python/0.1 (+https://example.com/agent-permissions)" ) enable_cache: bool = True cache_ttl_seconds: int = 900 cache: CacheStore = field(default_factory=InMemoryCacheStore) follow_redirects: bool = True max_redirects: int = 5 _settings = Settings() def configure(settings: Settings) -> None: """Replace the global settings object.""" global _settings _settings = settings def get_settings() -> Settings: """Return the current global settings.""" return _settings def set_cache(store: CacheStore) -> None: """Convenience helper to swap the cache store.""" _settings.cache = store