"""Hard-disable shim for native (unhardened) community web tools.

In this hardened DeerFlow build, the only allowed web access surface is
``deerflow.community.searx.tools`` (web_search, web_fetch, image_search).
The legacy providers below have been deliberately stubbed out and will
raise on import so that misconfiguration cannot silently fall back to
unsanitized output:

  - ddg_search   (DuckDuckGo)
  - tavily       (Tavily)
  - exa          (Exa)
  - firecrawl    (Firecrawl)
  - jina_ai      (Jina Reader)
  - infoquest    (InfoQuest)
  - image_search (DDG image fallback)

If you really need one of these back, undo the change in the matching
``community/<name>/tools.py`` and audit the call site for prompt-injection
hardening first.
"""

from __future__ import annotations


class NativeWebToolDisabledError(RuntimeError):
    """Raised when a hard-disabled native web tool is imported or invoked."""


_MESSAGE_TEMPLATE = (
    "Native web tool '{provider}' is disabled in this hardened DeerFlow build. "
    "Use 'deerflow.community.searx.tools' (web_search / web_fetch / image_search) instead. "
    "If you really need '{provider}', re-enable it in "
    "deerflow/community/{provider}/tools.py and harden it first."
)


def reject_native_provider(provider: str) -> None:
    """Raise a clear error pointing the operator at the searx replacement."""
    raise NativeWebToolDisabledError(_MESSAGE_TEMPLATE.format(provider=provider))
