AxJSRuntime
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/funcs/jsRuntime.ts#L601
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<{
allowUnsafeNodeHostAccess?: boolean;
captureConsole?: boolean;
debugNodeWorkerPool?: boolean;
nodeWorkerPoolSize?: number;
outputMode?: AxJSRuntimeOutputMode;
permissions?: readonly AxJSRuntimePermission[];
timeout?: number;
}>): AxJSRuntime;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/funcs/jsRuntime.ts#L611
Parameters
| Parameter | Type |
|---|---|
options? | Readonly<{ allowUnsafeNodeHostAccess?: boolean; captureConsole?: boolean; debugNodeWorkerPool?: boolean; nodeWorkerPoolSize?: number; outputMode?: AxJSRuntimeOutputMode; permissions?: readonly AxJSRuntimePermission[]; timeout?: number; }> |
Returns
AxJSRuntime
Properties
| Property | Modifier | Type | Default value |
|---|---|---|---|
language | readonly | "JavaScript" | 'JavaScript' |
Methods
createSession()
createSession(globals?: Record<string, unknown>): AxCodeSession;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/funcs/jsRuntime.ts#L684
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> |
Returns
Implementation of
getUsageInstructions()
getUsageInstructions(): string;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/funcs/jsRuntime.ts#L649
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/71ea5064d766efdc031d375243a8e525911833e7/src/ax/funcs/jsRuntime.ts#L1007