mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 01:40:15 +08:00
1.3 KiB
1.3 KiB
Tasks: Fix RuntimeStatusStar Spec Compliance
Implementation Tasks
1. Update Orchestrator for message tracking
- Add
_message_count: int = 0to__init__ - Add
_last_activity_timestamp: float | None = Noneto__init__ - Add
record_activity()method that increments count and updates timestamp - Add
record_activity()method (infrastructure ready, caller integration separate)
2. Update RuntimeStatusStar.get_protocol_status
- Add
namefield to each protocol's return dict - Verify format matches:
{"connected": bool, "name": "xxx-client"}
3. Update RuntimeStatusStar.get_stats
- Import
datetimefor timestamp formatting - Return
total_messagesfrom orchestrator's_message_count - Return
last_activityas ISO formatted timestamp from_last_activity_timestamp - Keep
uptime_secondsfor backward compatibility
4. Update Tests
- Update
test_get_protocol_statusto verifynamefield exists and has correct value - Update
test_get_statsto verifytotal_messagesandlast_activityfields exist - Add test for
record_activity()method
5. Verification
- Run
uv run pytest tests/unit/test_runtime_status_star.py -v - Run
uv run pytest tests/unit/test_internal_runtime.py -v - Run full test suite:
uv run pytest --cov=astrbot tests/