Merge pull request #15870 from NousResearch/bb/fix-skills-search
fix(tui): restore skills search RPC
This commit is contained in:
@@ -5,6 +5,7 @@ import json
|
|||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
import types
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@@ -311,6 +312,36 @@ def test_command_dispatch_queue_requires_arg(server):
|
|||||||
assert resp["error"]["code"] == 4004
|
assert resp["error"]["code"] == 4004
|
||||||
|
|
||||||
|
|
||||||
|
def test_skills_manage_search_uses_tools_hub_sources(server):
|
||||||
|
result = type("Result", (), {
|
||||||
|
"description": "Build better terminal demos",
|
||||||
|
"name": "showroom",
|
||||||
|
})()
|
||||||
|
auth = MagicMock(return_value="auth")
|
||||||
|
router = MagicMock(return_value=["source"])
|
||||||
|
search = MagicMock(return_value=[result])
|
||||||
|
fake_hub = types.SimpleNamespace(
|
||||||
|
GitHubAuth=auth,
|
||||||
|
create_source_router=router,
|
||||||
|
unified_search=search,
|
||||||
|
)
|
||||||
|
|
||||||
|
with patch.dict(sys.modules, {"tools.skills_hub": fake_hub}):
|
||||||
|
resp = server.handle_request({
|
||||||
|
"id": "skills-search",
|
||||||
|
"method": "skills.manage",
|
||||||
|
"params": {"action": "search", "query": "showroom"},
|
||||||
|
})
|
||||||
|
|
||||||
|
assert "error" not in resp
|
||||||
|
assert resp["result"] == {
|
||||||
|
"results": [{"description": "Build better terminal demos", "name": "showroom"}]
|
||||||
|
}
|
||||||
|
auth.assert_called_once_with()
|
||||||
|
router.assert_called_once_with("auth")
|
||||||
|
search.assert_called_once_with("showroom", ["source"], source_filter="all", limit=20)
|
||||||
|
|
||||||
|
|
||||||
def test_command_dispatch_steer_fallback_sends_message(server):
|
def test_command_dispatch_steer_fallback_sends_message(server):
|
||||||
"""command.dispatch /steer with no active agent falls back to send."""
|
"""command.dispatch /steer with no active agent falls back to send."""
|
||||||
sid = "test-session"
|
sid = "test-session"
|
||||||
|
|||||||
@@ -4569,11 +4569,7 @@ def _(rid, params: dict) -> dict:
|
|||||||
|
|
||||||
return _ok(rid, {"skills": get_available_skills()})
|
return _ok(rid, {"skills": get_available_skills()})
|
||||||
if action == "search":
|
if action == "search":
|
||||||
from hermes_cli.skills_hub import (
|
from tools.skills_hub import GitHubAuth, create_source_router, unified_search
|
||||||
unified_search,
|
|
||||||
GitHubAuth,
|
|
||||||
create_source_router,
|
|
||||||
)
|
|
||||||
|
|
||||||
raw = (
|
raw = (
|
||||||
unified_search(
|
unified_search(
|
||||||
|
|||||||
Reference in New Issue
Block a user