fix(tui): restore skills search RPC

This commit is contained in:
Brooklyn Nicholson 2026-04-25 22:11:52 -05:00
parent 7c50ed707c
commit 91a7a0acbe
2 changed files with 32 additions and 5 deletions

View file

@ -5,6 +5,7 @@ import json
import sys
import threading
import time
import types
from unittest.mock import MagicMock, patch
import pytest
@ -311,6 +312,36 @@ def test_command_dispatch_queue_requires_arg(server):
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):
"""command.dispatch /steer with no active agent falls back to send."""
sid = "test-session"