AbstractProtectedconstructorAbstractBuildBuild the per-execution handler map exposed to sandboxed user code via
__bridgeCall(name, args). Each handler runs in the host process and
is responsible for its own authorization checks against ctx.config
(the permission allowlists in RuntimeActionConfiguration.permissions).
The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared because it is possible that a given class might have copies of its code in multiple paths in a deployed application. This approach ensures that no matter how many code copies might exist, there is only one instance of the object in question by using the Global Object Store.
AbstractGetReturns the JavaScript preamble that ActionEngine prepends to the
user's Runtime action code. The preamble defines the utilities.*
namespace object whose methods proxy through __bridgeCall to the
handlers returned by BuildHandlers. Preamble and handler map MUST
stay in sync — a utilities.foo.bar(x) call requires a
'foo.bar' handler to be registered.
Protected StaticgetReturns the singleton instance of the class. If the instance does not exist, it is created and stored in the Global Object Store. If className is provided it will be used as part of the key in the Global Object Store, otherwise the actual class name will be used. NOTE: the class name used by default is the lowest level of the object hierarchy, so if you have a class that extends another class, the lowest level class name will be used.
OptionalclassName: string
Abstract contract for building the bridge handler map that
CodeExecutionServiceexposes to sandboxed Runtime-action code, plus the JavaScript preamble injected at the top of the user code to define theutilities.*namespace.Why this is abstract
The concrete bridge needs to call into
@memberjunction/ai-agents,@memberjunction/ai-prompts, and@memberjunction/aiengine— packages that already depend on@memberjunction/actions. Putting the concrete implementation directly inside@memberjunction/actionscreates a cycle.Instead, the actions package takes a runtime dependency on this abstract via
ClassFactory.CreateInstance, and a top-of-stack package (@memberjunction/action-runtime-host) registers a concrete subclass via@RegisterClass. External consumers can register their own subclass with higher auto-priority to override the default bridge — for example, to add custom namespaces, restrict the surface area, or swap in a mock for tests.If no subclass is registered, ActionEngine falls through to pure-compute mode (no bridge available, user code sees only
input/output) — a graceful degradation, not an error.