mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-14 19:02:22 +02:00
Consolidate Odysseus agent harness and tool contracts
This commit is contained in:
@@ -9,6 +9,7 @@ toggle" error - the advertised capability was dead.
|
||||
import asyncio
|
||||
|
||||
from src.ai_interaction import do_ui_control
|
||||
from routes import prefs_routes
|
||||
|
||||
|
||||
def test_toggle_rag_on_is_accepted():
|
||||
@@ -50,3 +51,42 @@ def test_open_calendar_panel_accepts_view_and_target_date():
|
||||
assert r.get("view") == "month"
|
||||
assert r.get("target_date") == "2026-09"
|
||||
assert "error" not in r
|
||||
|
||||
|
||||
def test_models_panel_alias_opens_cookbook_models_view():
|
||||
r = asyncio.run(do_ui_control("open_panel models"))
|
||||
assert r.get("panel") == "cookbook"
|
||||
assert r.get("view") == "Search"
|
||||
assert r.get("view_label") == "models"
|
||||
assert "models view" in r.get("results", "")
|
||||
|
||||
|
||||
def test_cookbook_panel_accepts_named_subview():
|
||||
r = asyncio.run(do_ui_control("open_panel cookbook serve"))
|
||||
assert r.get("panel") == "cookbook"
|
||||
assert r.get("view") == "Serve"
|
||||
assert r.get("view_label") == "launch"
|
||||
|
||||
|
||||
def test_set_theme_persists_owner_scoped_name_for_later_verification(monkeypatch):
|
||||
stores = {"alice": {}}
|
||||
monkeypatch.setattr(prefs_routes, "_load_for_user", lambda owner: dict(stores.get(owner, {})))
|
||||
monkeypatch.setattr(prefs_routes, "_save_for_user", lambda owner, prefs: stores.__setitem__(owner, dict(prefs)))
|
||||
|
||||
changed = asyncio.run(do_ui_control("set_theme dark", owner="alice"))
|
||||
current = asyncio.run(do_ui_control("get_theme", owner="alice"))
|
||||
|
||||
assert changed.get("ui_event") == "set_theme"
|
||||
assert stores["alice"]["theme"] == {"name": "dark"}
|
||||
assert current == {
|
||||
"results": "Current theme: dark",
|
||||
"current_theme": "dark",
|
||||
"theme_known": True,
|
||||
}
|
||||
|
||||
|
||||
def test_get_theme_does_not_invent_unsynchronized_client_state(monkeypatch):
|
||||
monkeypatch.setattr(prefs_routes, "_load_for_user", lambda owner: {})
|
||||
result = asyncio.run(do_ui_control("get_theme", owner="alice"))
|
||||
assert result["theme_known"] is False
|
||||
assert "not been synchronized" in result["results"].lower()
|
||||
|
||||
Reference in New Issue
Block a user