# 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/active import json from hermes_web_cli.init import get_active_sessions def main(): """Main function to handle the active sessions API request.""" try: # Get active sessions from the module sessions = get_active_sessions() # 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))