# This is a controlled Python script (.dspy file) that will be executed by the web framework # It provides the API endpoint for /hermes-web-cli/sessions/recent import json from hermes_web_cli.init import get_recent_sessions def main(): """Main function to handle the recent sessions API request.""" try: # Get recent sessions from the module sessions = get_recent_sessions(limit=5) # Return as JSON response return { "status": "success", "data": sessions, "total": len(sessions) } except Exception as e: return { "status": "error", "message": str(e), "data": [], "total": 0 } # Execute and return JSON response result = main() print(json.dumps(result, ensure_ascii=False))