What are the best open-source licenses to publish a project, without taking the risk to see it repacked into another project or commercial product? AGPL?
Open source licenses permit commercial usage. AGPL still fully permits it. Someone can still take your code and sell it as a commercial product. AGPL requires them to make the source code available to users even for a service. They aren't required to make it available to others.
A lot of companies will avoid GPLv3 code due to the terms conflicting with what they want and that's even more true for AGPLv3. If you release an application as AGPLv3, nothing in the license stops someone taking it and selling a product based on it without giving anything back.
It may stop them from using it because they want to make a locked down device where the code can't be replaced, which is a major reason for companies avoiding even GPLv3 code. They may also not want to release their derived code to users and AGPLv3 applies that to services too.