AxJSRuntime
Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/funcs/jsRuntime.ts#L41
Browser-compatible JavaScript interpreter for RLM using Web Workers.
Creates persistent sessions where variables survive across execute() calls.
Implements
Constructors
Constructor
new AxJSRuntime(options?: Readonly<{
allowDenoRemoteImport?: boolean;
allowedModules?: readonly string[];
allowUnsafeNodeHostAccess?: boolean;
blockDynamicImport?: boolean;
blockShadowRealm?: boolean;
captureConsole?: boolean;
debugNodeWorkerPool?: boolean;
freezeIntrinsics?: boolean;
lockWorkerIPC?: boolean;
nodePermissionAllowlist?: Readonly<{
addons?: boolean;
childProcess?: boolean;
fsRead?: readonly string[];
fsWrite?: readonly string[];
wasi?: boolean;
}>;
nodeWorkerPoolSize?: number;
outputMode?: AxJSRuntimeOutputMode;
permissions?: readonly AxJSRuntimePermission[];
preventGlobalThisExtensions?: boolean;
resourceLimits?: Readonly<{
codeRangeSizeMb?: number;
maxOldGenerationSizeMb?: number;
maxYoungGenerationSizeMb?: number;
stackSizeMb?: number;
}>;
timeout?: number;
useNodePermissionModel?: boolean | "auto";
}>): AxJSRuntime;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/funcs/jsRuntime.ts#L61
Parameters
| Parameter | Type |
|---|---|
options? | Readonly<{ allowDenoRemoteImport?: boolean; allowedModules?: readonly string[]; allowUnsafeNodeHostAccess?: boolean; blockDynamicImport?: boolean; blockShadowRealm?: boolean; captureConsole?: boolean; debugNodeWorkerPool?: boolean; freezeIntrinsics?: boolean; lockWorkerIPC?: boolean; nodePermissionAllowlist?: Readonly<{ addons?: boolean; childProcess?: boolean; fsRead?: readonly string[]; fsWrite?: readonly string[]; wasi?: boolean; }>; nodeWorkerPoolSize?: number; outputMode?: AxJSRuntimeOutputMode; permissions?: readonly AxJSRuntimePermission[]; preventGlobalThisExtensions?: boolean; resourceLimits?: Readonly<{ codeRangeSizeMb?: number; maxOldGenerationSizeMb?: number; maxYoungGenerationSizeMb?: number; stackSizeMb?: number; }>; timeout?: number; useNodePermissionModel?: boolean | "auto"; }> |
Returns
AxJSRuntime
Properties
Methods
createSession()
createSession(globals?: Record<string, unknown>, options?: object): AxCodeSession;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/funcs/jsRuntime.ts#L241
Creates a persistent execution session.
Message flow:
- Main thread sends
initwith globals, function proxies, permissions. - Main thread sends
executewith correlation ID and code. - Worker returns
resultor requests host callbacks viafn-call. - Host responds to callback requests with
fn-result.
Session closes on:
- explicit close(),
- timeout,
- abort signal,
- worker error.
Parameters
| Parameter | Type |
|---|---|
globals? | Record<string, unknown> |
options? | { shouldBubbleError?: (err: unknown) => boolean; } |
options.shouldBubbleError? | (err: unknown) => boolean |
Returns
Implementation of
getUsageInstructions()
getUsageInstructions(): string;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/funcs/jsRuntime.ts#L206
Optional runtime-specific usage guidance injected into the RLM system prompt. Use this for execution semantics that differ by runtime/language.
Returns
string
Implementation of
AxCodeRuntime.getUsageInstructions
toFunction()
toFunction(): AxFunction;Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/funcs/jsRuntime.ts#L895