It's possible, but you'll have to modify CHDK source code and build a custom version for your purposes. The easiest way may be to modify core/shot_histogram.c since that's already tied to Lua and accesses the RAW buffer after each shot.
Note that you can't read the sensor without shooting a photo (CHDK doesn't handle the sensor at all, it waits for the camera to do that and reads the RAW image from RAM). If you need something more real time, you could take a look at the histogram code or zebra (or motion detector if you want to use scripts) i.e. use the LCD viewfinder image.
Also note that sensor RAW is most definitely not equal to the JPEG before lossy compression. It lacks a huge amount of image processing, meaning those values you will be getting are far from the colors you see in a JPEG. There really isn't even such thing as an RGB value of pixel position [x,y] for the RAW image because the sensor is a Bayer matrix of single color pixels (50% of them green, 25% red, 25% blue).