refactor(cleanup): remove legacy CLI and complete EvoAgent migration cleanup
- Delete backend/cli.py and all CLI-specific tests (test_cli.py, test_openclaw_cli_service.py, test_skills_cli.py) - Remove evotraders console script from pyproject.toml - Update README/CLAUDE.md to reference python backend/main.py instead of CLI - Add pytest-asyncio to dev dependencies - Enhance EvoAgent with reload_runtime_assets and backward-compat attrs - Align tests with updated API semantics and gateway process models Constraint: CLI is deprecated in favor of split-service runtime model Confidence: high Scope-risk: moderate
This commit is contained in:
@@ -43,11 +43,49 @@ class _FakeOpenClawCliService:
|
||||
"items": [{"role": "assistant", "text": "hello"}],
|
||||
}
|
||||
|
||||
def status_model(self):
|
||||
from shared.models.openclaw import OpenClawStatus
|
||||
return OpenClawStatus(runtimeVersion="2026.3.24")
|
||||
|
||||
def get_session_model(self, session_key: str):
|
||||
from shared.models.openclaw import SessionEntry
|
||||
for session in self.list_sessions()["sessions"]:
|
||||
if session["key"] == session_key:
|
||||
return SessionEntry.model_validate(session, strict=False)
|
||||
raise KeyError(session_key)
|
||||
|
||||
def list_sessions_model(self):
|
||||
from shared.models.openclaw import SessionsList, SessionEntry
|
||||
sessions = [
|
||||
SessionEntry.model_validate(s, strict=False)
|
||||
for s in self.list_sessions()["sessions"]
|
||||
]
|
||||
return SessionsList(sessions=sessions)
|
||||
|
||||
def get_session_history_model(self, session_key: str, *, limit: int = 20):
|
||||
from shared.models.openclaw import SessionHistory
|
||||
raw = self.get_session_history(session_key, limit=limit)
|
||||
return SessionHistory(
|
||||
sessionKey=raw["sessionKey"],
|
||||
session_id=None,
|
||||
events=raw["items"],
|
||||
history=raw["items"],
|
||||
raw_text=None,
|
||||
)
|
||||
|
||||
def list_cron_jobs(self):
|
||||
return {"jobs": [{"id": "job-1", "name": "Daily sync"}]}
|
||||
|
||||
def list_cron_jobs_model(self):
|
||||
from shared.models.openclaw import CronList
|
||||
return CronList.from_raw(self.list_cron_jobs())
|
||||
|
||||
def list_approvals(self):
|
||||
return {"approvals": [{"id": "ap-1", "status": "pending"}]}
|
||||
return {"approvals": [{"approvalId": "ap-1", "toolName": "test_tool", "status": "pending"}]}
|
||||
|
||||
def list_approvals_model(self):
|
||||
from shared.models.openclaw import ApprovalsList
|
||||
return ApprovalsList.from_raw(self.list_approvals())
|
||||
|
||||
|
||||
def test_openclaw_service_routes_are_exposed():
|
||||
@@ -85,17 +123,17 @@ def test_openclaw_service_read_routes():
|
||||
assert status.status_code == 200
|
||||
assert status.json()["status"] == "operational"
|
||||
assert openclaw_status.status_code == 200
|
||||
assert openclaw_status.json()["runtimeVersion"] == "2026.3.24"
|
||||
assert openclaw_status.json()["runtime_version"] == "2026.3.24"
|
||||
assert sessions.status_code == 200
|
||||
assert len(sessions.json()["sessions"]) == 2
|
||||
assert session.status_code == 200
|
||||
assert session.json()["session"]["agentId"] == "main"
|
||||
assert session.json()["session"]["agent_id"] == "main"
|
||||
assert history.status_code == 200
|
||||
assert history.json()["limit"] == 5
|
||||
assert len(history.json()["events"]) == 1
|
||||
assert cron.status_code == 200
|
||||
assert cron.json()["jobs"][0]["id"] == "job-1"
|
||||
assert approvals.status_code == 200
|
||||
assert approvals.json()["approvals"][0]["id"] == "ap-1"
|
||||
assert approvals.json()["approvals"][0]["approval_id"] == "ap-1"
|
||||
|
||||
|
||||
def test_openclaw_service_session_404():
|
||||
|
||||
Reference in New Issue
Block a user