Hello,
when build mode is activated, the code setup some listeners for key input and store them in an array, then clear them and empty the array when build mode is deactivated.
By checking if this array is empty or not, you can check if build mode is activated or not.
The script call to do so would be
Drag.SandboxMap?.listeners?.length > 0;
Hope that helps !