Hack: Using Apple's JavaScript for Automation in OG Action scripts

Perhaps the design of OG6 script actions predates Apple’s newer (Yosemite onwards) ‘JavaScript for Automation’ osascript language ?

In any case, script actions are still, for the moment, like flies in the amber of an an earlier AppleScript-only epoch – the Check Syntax and Run Script buttons are not aware of JXA.

An interim hack is to wrap the JavaScript for Automation script in a call to the AS version of .doShellScript():

do shell script "
osascript -l JavaScript <<JXA_END 2>/dev/null

    var  a = Application.currentApplication(),
        sa = (a.includeStandardAdditions = true, a); 
   
    sa.displayDialog('hello');
  
JXA_END"