@enclave-vm/core
Advanced tools
| import type { ExecutionContext, ExecutionResult, SandboxAdapter } from '../types'; | ||
| export interface InterpreterAdapterOptions { | ||
| /** Override the instruction budget (default 5,000,000). */ | ||
| maxSteps?: number; | ||
| /** Override the max interpreter call depth (default 256). */ | ||
| maxCallDepth?: number; | ||
| } | ||
| export declare class InterpreterAdapter implements SandboxAdapter { | ||
| private readonly options; | ||
| constructor(options?: InterpreterAdapterOptions); | ||
| execute<T = unknown>(code: string, context: ExecutionContext): Promise<ExecutionResult<T>>; | ||
| dispose(): void; | ||
| private stats; | ||
| private fail; | ||
| } |
| import type * as ESTree from 'estree'; | ||
| /** Thrown when the instruction budget is exceeded (interrupts infinite loops). */ | ||
| export declare class StepLimitError extends Error { | ||
| constructor(limit: number); | ||
| } | ||
| /** Thrown on any disallowed operation (blocked key, unknown identifier, bad call). */ | ||
| export declare class InterpreterError extends Error { | ||
| constructor(message: string); | ||
| } | ||
| export interface InterpreterOptions { | ||
| /** Identifiers + values available to the script (e.g. Math, JSON, __safe_callTool). */ | ||
| globals: Record<string, unknown>; | ||
| /** Max evaluated nodes before aborting (interrupts infinite loops). */ | ||
| maxSteps: number; | ||
| /** Max nested call depth (interpreter-defined functions). */ | ||
| maxCallDepth: number; | ||
| /** Optional cancellation. */ | ||
| signal?: AbortSignal; | ||
| } | ||
| /** | ||
| * Evaluate a parsed AgentScript program. Returns the resolved value of the | ||
| * `__ag_main()` invocation (or the program's last value if no main wrapper). | ||
| */ | ||
| export declare class Interpreter { | ||
| private readonly options; | ||
| private steps; | ||
| private callDepth; | ||
| private readonly globals; | ||
| constructor(options: InterpreterOptions); | ||
| /** Number of AST nodes evaluated so far (for execution stats). */ | ||
| get stepCount(): number; | ||
| run(program: ESTree.Program): Promise<unknown>; | ||
| private tick; | ||
| private execStatement; | ||
| private execBlock; | ||
| private execForOf; | ||
| private execFor; | ||
| private execWhile; | ||
| private evalExpr; | ||
| private evalTemplate; | ||
| private evalBinary; | ||
| /** Resolve a member access to `{ object, key, value }`, blocking escape keys. */ | ||
| private evalMember; | ||
| private evalCall; | ||
| /** | ||
| * Async implementations of the higher-order array methods, so interpreter | ||
| * callbacks (which are async — they may `await` tool calls) are awaited. Each | ||
| * iteration ticks the step budget. | ||
| */ | ||
| private callArrayMethod; | ||
| private evalAssignment; | ||
| /** Assign to an Identifier or MemberExpression target (blocking escape keys). */ | ||
| private assignTo; | ||
| private bindPattern; | ||
| /** Build an interpreter-backed function (declaration / arrow / expression). */ | ||
| private makeFunction; | ||
| private propKey; | ||
| private readGlobal; | ||
| } |
| export { InterpreterAdapter } from './adapters/interpreter-adapter'; | ||
| export type { InterpreterAdapterOptions } from './adapters/interpreter-adapter'; | ||
| export { Interpreter, InterpreterError, StepLimitError } from './interpreter/interpreter'; | ||
| export type { InterpreterOptions } from './interpreter/interpreter'; | ||
| export type { ExecutionContext, ExecutionResult, ExecutionError, ExecutionStats, ToolHandler, } from './types'; |
+4
-0
@@ -22,2 +22,6 @@ /** | ||
| export { ReferenceConfig, REFERENCE_CONFIGS, REF_ID_PREFIX, REF_ID_SUFFIX, REF_ID_PATTERN, isReferenceId, getReferenceConfig, ReferenceSidecar, ReferenceSource, ReferenceMetadata, SidecarLimitError, ReferenceNotFoundError, ReferenceResolver, ResolutionLimitError, CompositeHandle, isCompositeHandle, } from './sidecar'; | ||
| export { InterpreterAdapter } from './adapters/interpreter-adapter'; | ||
| export type { InterpreterAdapterOptions } from './adapters/interpreter-adapter'; | ||
| export { Interpreter, InterpreterError, StepLimitError } from './interpreter/interpreter'; | ||
| export type { InterpreterOptions } from './interpreter/interpreter'; | ||
| export { WorkerPoolAdapter, WorkerSlotStatus, ResourceUsage, WorkerPoolMetrics, DEFAULT_WORKER_POOL_CONFIG, WORKER_POOL_PRESETS, buildWorkerPoolConfig, WorkerPoolError, WorkerTimeoutError, WorkerMemoryError, WorkerCrashedError, WorkerPoolDisposedError, QueueFullError, QueueTimeoutError, ExecutionAbortedError, MessageFloodError, MessageValidationError, MessageSizeError, WorkerStartupError, TooManyPendingCallsError, WorkerSlot, ExecutionQueue, QueueStats, MemoryMonitor, MemoryMonitorStats, } from './adapters/worker-pool'; | ||
@@ -24,0 +28,0 @@ export { Session, createSession, SessionEmitter, createSessionEmitter, SessionStateMachine, createSessionStateMachine, EmbeddedChannel, createEmbeddedChannelPair, } from './session'; |
+9
-3
| { | ||
| "name": "@enclave-vm/core", | ||
| "version": "2.13.0", | ||
| "version": "2.14.0", | ||
| "description": "Sandbox runtime for secure JavaScript code execution", | ||
@@ -37,2 +37,8 @@ "author": "AgentFront <info@agentfront.dev>", | ||
| "default": "./index.js" | ||
| }, | ||
| "./worker": { | ||
| "types": "./worker.d.ts", | ||
| "import": "./esm/worker.mjs", | ||
| "require": "./worker.js", | ||
| "default": "./worker.js" | ||
| } | ||
@@ -42,4 +48,4 @@ }, | ||
| "@babel/standalone": "^7.29.0", | ||
| "@enclave-vm/types": "2.13.0", | ||
| "@enclave-vm/ast": "2.13.0", | ||
| "@enclave-vm/ast": "2.14.0", | ||
| "@enclave-vm/types": "2.14.0", | ||
| "acorn": "8.15.0", | ||
@@ -46,0 +52,0 @@ "acorn-walk": "8.3.4", |
| { | ||
| "name": "@enclave-vm/core", | ||
| "version": "2.13.0", | ||
| "version": "2.14.0", | ||
| "description": "Sandbox runtime for secure JavaScript code execution", | ||
@@ -38,2 +38,9 @@ "author": "AgentFront <info@agentfront.dev>", | ||
| "default": "./dist/index.js" | ||
| }, | ||
| "./worker": { | ||
| "development": "./src/worker.ts", | ||
| "types": "./dist/worker.d.ts", | ||
| "import": "./dist/esm/worker.mjs", | ||
| "require": "./dist/worker.js", | ||
| "default": "./dist/worker.js" | ||
| } | ||
@@ -43,4 +50,4 @@ }, | ||
| "@babel/standalone": "^7.29.0", | ||
| "@enclave-vm/types": "2.13.0", | ||
| "@enclave-vm/ast": "2.13.0", | ||
| "@enclave-vm/ast": "2.14.0", | ||
| "@enclave-vm/types": "2.14.0", | ||
| "acorn": "8.15.0", | ||
@@ -47,0 +54,0 @@ "acorn-walk": "8.3.4", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1112056
4.7%67
4.69%30562
4.96%+ Added
+ Added
- Removed
- Removed
Updated
Updated