(
    sessionId: IdentifierType,
    command_request: CommandRequest,
    session_manager: SessionManager = Depends(get_session_manager),
)
return CommandResponse(
        data=command_result, links=get_valid_session_links(sessionId, router)
    )
Execute a session command
Execute a session command
Execute a session command
async def session_command_execute_handler(
    sessionId: IdentifierType,
    command_request: CommandRequest,
    session_manager: SessionManager = Depends(get_session_manager),
) -> CommandResponse:
    """
    Execute a session command
    """
    session_obj = get_session(manager=session_manager, session_id=sessionId)
    if not session_manager.is_active(session_obj.meta.identifier):
        raise CommandExecutionException(
            reason=f"Session '{sessionId}' is not active. "
            "Only the active session can execute commands"
        )

    command_result = await session_obj.execute_command(command_request.data)

    log.debug(f"Command result: {command_result}")

    return CommandResponse(
        data=command_result, links=get_valid_session_links(sessionId, router)
    )
async def session_command_execute_handler ( sessionId : IdentifierType , command_request : CommandRequest , session_manager : SessionManager = Depends ( get_session_manager ) , ) -> CommandResponse : session_obj = get_session ( manager = session_manager , session_id = sessionId ) if not session_manager . is_active ( session_obj . meta . identifier ) : raise CommandExecutionException ( reason = f"Session '{sessionId}' is not active. " "Only the active session can execute commands" ) command_result = await session_obj . execute_command ( command_request . data ) log . debug ( f"Command result: {command_result}" ) return CommandResponse ( data = command_result , links = get_valid_session_links ( sessionId , router ) )