Improve external service discovery and tool routing

This commit is contained in:
Mikei386
2026-08-23 21:44:33 +02:00
parent b5118099ed
commit feb99293b5
10 changed files with 198 additions and 10 deletions
+10
View File
@@ -187,6 +187,16 @@ class AutoToolSelectorTests(unittest.IsolatedAsyncioTestCase):
["server:mcp:github-local", "server:mcp:athena-operator-local"],
)
async def test_existing_unraid_backend_beats_duplicate_operator_plan(self):
result = await self._select(
"Baue aus https://github.com/foo/deemix einen MCP. Deemix läuft bereits als Container auf Unraid; prüfe ihn zuerst."
)
self.assertEqual(
result["tool_ids"],
["server:mcp:github-local", "server:mcp:unraid-readonly-local"],
)
self.assertIn("Never compensate", result["messages"][0]["content"])
async def test_github_and_explicit_web_are_bounded_to_two(self):
result = await self._select(
"Prüfe dieses GitHub Repository und suche zusätzlich im Netz nach Nutzerstimmen."
+7 -1
View File
@@ -30,16 +30,22 @@ def main():
state = base / "state"
runtime = base / "runtime.json"
(repo / "docs").mkdir(parents=True)
(repo / "config").mkdir(parents=True)
docs.mkdir()
(repo / "docs/PLATFORM_OVERVIEW.md").write_text("# Athena\nRouter and recovery.\n")
(repo / "docs/OPERATIONS.md").write_text("# Operations\nUse bounded tools.\n")
(docs / "PLATFORM_OVERVIEW.md").write_text("# Athena\nRouter and recovery.\n")
(repo / "config/service-catalog.json").write_text(json.dumps({
"version": 1,
"services": [{"id": "test", "name": "Test", "address": "127.0.0.1", "port": 9, "protocol": "tcp", "probe": "tcp"}],
}))
runtime.write_text(json.dumps({"generated_unix": 4102444800, "generated_at": "2100-01-01T00:00:00Z", "source_commit": "abc", "containers": []}))
m = load_module(repo, docs, runtime, state)
assert len(m.TOOLS) == 9
assert len(m.TOOLS) == 10
assert m.overview()["source"] == "docs/PLATFORM_OVERVIEW.md"
assert m.current_state()["available"] is True
assert m.external_services()["services"][0]["id"] == "test"
assert m.search_knowledge({"query": "recovery", "max_results": 3})["count"] >= 1
assert "Operations" in m.read_source({"path": "docs/OPERATIONS.md"})["content"]
try: