* refactor(plugins): remove the Sep 2026 decomposition compat layer on schedule The PLUGIN-COMPAT layer (2776813df3+d63e380324+0a5164cebe) kept pre-#102117 import paths alive for external plugins until 2026-09-14. That window closed two weeks ago; since then the loader has already been skipping plugins that use the old paths. This removes the layer itself: - 328 appended `PLUGIN-COMPAT` blocks (lazy `__getattr__` pointer tables, re-exported third-party names, restored dead definitions) and the three re-export stub modules (gateway/startup_watchdog, hermes_cli/observability/relay_runtime, tools/environments/modal_utils) - COMPAT_MANIFEST.md, compat_manifest.json, scripts/check_compat_pointers.py and its lint step - the reporting surfaces: CLI banner notice, `hermes plugins compat`, the `hermes doctor` section, the post-update notice, the Desktop one-time dialog, the loader's pre-import skip and the `plugins.allow_deprecated_imports` escape hatch An external plugin that still imports an old path now fails to load with its ImportError as the reason in `hermes plugins list`, the same path as any broken plugin. hermes_cli/plugin_compat.py stays as three inert stubs (compat_report, removal_in_effect, summary_lines): an already-running pre-removal `hermes update` lazy-imports them after the checkout swap (tests/compat/old_updater_surface.json). In-tree fallout, both already dead: hermes_cli/setup.py::_check_espeak_ng (no callers; its `shutil` came from a compat block) and gateway/config.py::SessionResetPolicy ("retained solely for the scheduled plugin-compat window"). Two test_run_agent patches targeted the removed `run_agent.handle_function_call` pointer; they now patch `model_tools.handle_function_call`, the seam production reads, like every sibling test in that file. * chore: retrigger CI (zero-job startup_failure phantom) * test: drop resolution allowlist rows for the two deleted which() sites hermes_cli/setup.py::_check_espeak_ng (dead) and tools/skillevaluator_scan.py::scanner_available (a restored definition inside a PLUGIN-COMPAT block) no longer exist; the stale-row gate requires their allowlist entries go with them.
87 lines
3.9 KiB
Python
87 lines
3.9 KiB
Python
"""Keenable (https://keenable.ai) web search + fetch — keyless-ring member.
|
|
|
|
Env: ``KEENABLE_API_KEY`` (optional; keyless free tier works without it).
|
|
Config: ``web.provider_tier.keenable: free|paid`` pins the tier (unset = auto).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
from typing import Any, Dict, List
|
|
|
|
from plugins.web._common import (
|
|
SEARCH_LIMIT_CAP, BaseWebSearchProvider, document, http_status_detail, keyless_extract, keyless_search,
|
|
keyless_variant_schema, page_error, provider_env, run_extract, run_search, search_fail, search_ok, use_keyless, web_hit,
|
|
)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
_KEENABLE_API_URL = "https://api.keenable.ai"
|
|
|
|
|
|
def _keenable_headers(api_key: str) -> Dict[str, str]:
|
|
# The keyless tier structurally requires an app-identifier header; no user identifiers are sent.
|
|
headers = {"X-Keenable-Title": "hermes-agent"}
|
|
if api_key:
|
|
headers["Authorization"] = f"Bearer {api_key}"
|
|
return headers
|
|
|
|
|
|
class KeenableWebSearchProvider(BaseWebSearchProvider):
|
|
"""Keenable search + extract provider (keyed or keyless)."""
|
|
|
|
NAME = "keenable"
|
|
DISPLAY_NAME = "Keenable"
|
|
KEY_ENV = "KEENABLE_API_KEY"
|
|
EXTRACT = True
|
|
KEYLESS = True
|
|
|
|
def search(self, query: str, limit: int = 5) -> Dict[str, Any]:
|
|
def _body() -> Dict[str, Any]:
|
|
api_key = provider_env("KEENABLE_API_KEY")
|
|
if use_keyless("keenable", api_key):
|
|
return keyless_search("Keenable", "keenable", query, limit, logger)
|
|
import requests
|
|
logger.info("Keenable search: '%s' (limit=%d)", query, limit)
|
|
response = requests.post(
|
|
f"{_KEENABLE_API_URL}/v1/search",
|
|
json={"query": query, "max_results": min(max(1, int(limit)), SEARCH_LIMIT_CAP)},
|
|
headers=_keenable_headers(api_key), timeout=30,
|
|
)
|
|
if response.status_code >= 400:
|
|
return search_fail(f"Keenable search failed: {http_status_detail(response)}")
|
|
return search_ok([
|
|
web_hit(r.get("url") or "", r.get("title") or "", r.get("snippet") or r.get("description") or "", i + 1)
|
|
for i, r in enumerate(response.json().get("results") or [])
|
|
])
|
|
|
|
return run_search("Keenable", logger, _body, verbatim_value_error=False)
|
|
|
|
def extract(self, urls: List[str], **kwargs: Any) -> List[Dict[str, Any]]:
|
|
def _body() -> List[Dict[str, Any]]:
|
|
api_key = provider_env("KEENABLE_API_KEY")
|
|
if use_keyless("keenable", api_key):
|
|
return keyless_extract("Keenable", "keenable", urls, logger)
|
|
import requests
|
|
logger.info("Keenable extract: %d URL(s)", len(urls))
|
|
results: List[Dict[str, Any]] = []
|
|
for url in urls:
|
|
try:
|
|
response = requests.get(f"{_KEENABLE_API_URL}/v1/fetch", params={"url": url}, headers=_keenable_headers(api_key), timeout=30)
|
|
if response.status_code >= 400:
|
|
raise ValueError(http_status_detail(response))
|
|
data = response.json()
|
|
results.append(document(data.get("url") or url, data.get("title") or "", data.get("content") or "", source_url=url))
|
|
except Exception as exc: # noqa: BLE001 — per-URL error entry
|
|
results.append(page_error(url, f"Keenable extract failed: {exc}"))
|
|
return results
|
|
|
|
return run_extract("Keenable", logger, urls, _body, verbatim_value_error=False)
|
|
|
|
def get_setup_schema(self) -> Dict[str, Any]:
|
|
return keyless_variant_schema(
|
|
"Keenable", "KEENABLE_API_KEY", "https://keenable.ai",
|
|
free_tag="Independent web index for AI apps — fast search + page fetch on Keenable's anonymous free tier.",
|
|
paid_tag="Independent web index for AI apps. Keyed access with higher limits and guaranteed service.",
|
|
)
|