Skip to content

Commit 45c4f28

Browse files
fix(search): reconcile managed SearXNG endpoint
1 parent ccf8f56 commit 45c4f28

3 files changed

Lines changed: 66 additions & 1 deletion

File tree

‎config/ulysses/runtime-management.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"recommended": true,
3939
"capability_group": "search",
4040
"role": "Firecrawl search backend",
41+
"integration": "diogenes-searxng",
4142
"root": "${ULYSSES_MICROSERVICES_ROOT}/SEARXNG/searxng",
4243
"compose": "docker-compose.yml",
4344
"compose_fallbacks": ["container/docker-compose.yml"],

‎src/diogenes_dependency_integration.py‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
POLICY_PATH = ROOT / "config" / "ulysses" / "hermes-stack.json"
3535
MANAGED_SHELL_START = "# >>> diogenes services >>>"
3636
MANAGED_SHELL_END = "# <<< diogenes services <<<"
37+
DIOGENES_SEARXNG_URL = "http://localhost:7070"
3738

3839

3940
class IntegrationError(RuntimeError):
@@ -1659,6 +1660,31 @@ def _integrate_workspace() -> None:
16591660
)
16601661

16611662

1663+
def _integrate_searxng() -> None:
1664+
"""Point Diogenes at the SearXNG instance managed by Services.
1665+
1666+
Upstream's standalone default is port 8080, while the managed workstation
1667+
service is intentionally published on loopback port 7070. Persist the
1668+
latter through Diogenes' own settings API so web search and Deep Research
1669+
share the same live backend without rewriting an operator's provider
1670+
choice.
1671+
"""
1672+
from src.settings import load_settings, save_settings
1673+
1674+
settings = dict(load_settings())
1675+
settings["search_url"] = DIOGENES_SEARXNG_URL
1676+
save_settings(settings)
1677+
1678+
1679+
def _diogenes_searxng_current() -> bool:
1680+
try:
1681+
from src.settings import get_setting
1682+
1683+
return get_setting("search_url") == DIOGENES_SEARXNG_URL
1684+
except Exception:
1685+
return False
1686+
1687+
16621688
def _integrate_firecrawl() -> None:
16631689
_set_config_value("default", "FIRECRAWL_API_URL", "http://localhost:3002")
16641690
_set_config_value("default", "FIRECRAWL_API_KEY", "fc-local")
@@ -1773,6 +1799,8 @@ def _contract_current(
17731799
and _config_value("default", "web.use_gateway") is False
17741800
and _shell_environment_current()
17751801
)
1802+
if integration == "diogenes-searxng":
1803+
return _diogenes_searxng_current()
17761804
if integration == "hermes-camofox":
17771805
return bool(
17781806
_config_value("default", "CAMOFOX_URL")
@@ -1872,7 +1900,9 @@ def integrate(runtime_id: str) -> bool:
18721900
print(f"{item['label']}: integration is current{suffix}. Nothing to do.")
18731901
return False
18741902

1875-
if integration == "hermes-firecrawl":
1903+
if integration == "diogenes-searxng":
1904+
_integrate_searxng()
1905+
elif integration == "hermes-firecrawl":
18761906
_integrate_firecrawl()
18771907
elif integration == "hermes-camofox":
18781908
_integrate_camofox_browser()
@@ -1948,6 +1978,8 @@ def integrate(runtime_id: str) -> bool:
19481978
next_step = (
19491979
"Review ~/.config/persephone, then start its installed user service when ready."
19501980
if integration == "persephone"
1981+
else "Diogenes web search and Deep Research now share the managed SearXNG endpoint."
1982+
if integration == "diogenes-searxng"
19511983
else "Continue configuring or restart Hermes when ready."
19521984
)
19531985
print(f"{item['label']}: integration applied. {next_step}")
@@ -1958,6 +1990,7 @@ def integrate_all() -> None:
19581990
# Dependency ordering mirrors the verified host: service routing, MCP
19591991
# substrates, isolated Librarian profile, Retrieval, then curated skills.
19601992
ordered = (
1993+
"searxng.search",
19611994
"firecrawl.api",
19621995
"camofox.browser",
19631996
"context.mode.mcp",

‎tests/test_diogenes_dependency_integration.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,34 @@ def test_retrieval_intake_migration_preserves_existing_sources(
8585
assert content.count('name = "skill-intake"') == 1
8686
assert (services / "skill-library").is_dir()
8787
assert (root / "category-overrides.toml").read_text(encoding="utf-8") == "[skills]\n"
88+
89+
90+
def test_integrate_searxng_updates_only_the_managed_url(monkeypatch) -> None:
91+
import src.settings as settings_module
92+
93+
current = {
94+
"search_provider": "duckduckgo",
95+
"search_url": "http://localhost:8080",
96+
}
97+
saved = {}
98+
monkeypatch.setattr(settings_module, "load_settings", lambda: dict(current))
99+
monkeypatch.setattr(settings_module, "save_settings", lambda value: saved.update(value))
100+
101+
integration._integrate_searxng()
102+
103+
assert saved["search_url"] == "http://localhost:7070"
104+
assert saved["search_provider"] == "duckduckgo"
105+
106+
107+
def test_diogenes_searxng_contract_checks_the_managed_url(monkeypatch) -> None:
108+
import src.settings as settings_module
109+
110+
monkeypatch.setattr(
111+
settings_module,
112+
"get_setting",
113+
lambda key: "http://localhost:7070" if key == "search_url" else None,
114+
)
115+
assert integration._diogenes_searxng_current() is True
116+
117+
monkeypatch.setattr(settings_module, "get_setting", lambda _key: "http://localhost:8080")
118+
assert integration._diogenes_searxng_current() is False

0 commit comments

Comments
 (0)