OmniJS is a completely different embedding of a JSContext, and doesn’t expose JXA’s Automation object at all.

You won’t be able to evaluate Standard Additions code in the omniJS interpreter, but you can evaluate omniJS source code from JXA, using the OO.evaluate(strSource) method, and get a return value back to JXA, so its possible to write scripts in which JXA and omniJS cooperate.

PS a useful way of shining a torch around a new or unfamiliar JS interpreter, and seeing what interfaces are available in its global namespace, is to evaluate the following snippet:

Object.getOwnPropertyNames(this)

The landscape will look very different in each of the following, for example:

You won’t be able to evaluate Standard Additions code in the omniJS interpreter, but you can evaluate omniJS source code from JXA, using the OO.evaluate(strSource) method, and get a return value back to JXA, so its possible to write scripts in which JXA and omniJS cooperate.

I would love an example showing how to evaluate OmniJS from JXA with a return value. (I know how to execute OmniJS source from JXA via a URL, but that doesn’t provide a return value.)

I see what you are saying, and I realize how naïve my post was, but I can’t quite put the pieces together. In particular, what (where) is OO.evaluate? A very simple example for which I would want to get the result back to JXA would be:

The JXA interface for the omniOutliner application object has an .evaluateJavascript(strCode) method.

As you probably know, JS functions have a .toString() method (and can even be coerced to their source code by simple string concatenation), so you can define the main omniJS function in your JXA code, and then pass a stringification of it into the omniJS interpreter with .evaluateJavascript(strCode).

That method can return a string value.

There are some notes here on the use of the omnigraffle instance of .evaluateJavascript:

I’m not sure when the .evaluateJavascript() method was added to macOS OG7, but it’s going to be very useful.
Unlike the more fiddly technique of invoking omnijs-run urls, evaluateJavascript() actually returns a value from omniJS code.
In current OG builds (as in current OO) builds, it already works well with simple JSON-representable return values, but will still crash the app if we try to return complex object values.
For example, I find that I can successfully obtain a list of shape texts…