The only thing that gets flashed to the device is the pipeline (meaning all nodes along with their links and configurations) - in this case that is everything above the bootloader code. When running scripts in normal mode (using usb or eth) the pipeline is executed on the device by:
with depthai.Device(pipeline) as device:. In standalone mode this is automatically called when the device boots up.
Since we can't run the code in a loop like we normally do, we port everything to the script node. Inside the script we also create a socket that is able to send data to the hosts on the other side of the socket.
Hope this helps,