@enclave-vm/core 2.19.2 → 2.20.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types.d.ts CHANGED
@@ -299,9 +299,11 @@ export interface EnclaveConfig {
299
299
  * When set, the VM adapter tracks String and Array allocations and throws
300
300
  * a MemoryLimitError if the limit is exceeded. Tracking adds ~5-10% overhead.
301
301
  *
302
- * Note: This is enforced via allocation tracking, not V8 heap limits. It counts the
303
- * operations that make text and arrays grow; a copy is not charged, and objects, Maps and
304
- * Sets are not counted. For the engine's own limit, use the worker_threads adapter.
302
+ * Note: This is enforced via allocation tracking, not V8 heap limits. The VM adapter counts
303
+ * operations that make text and arrays grow; copies, objects, Maps and Sets are not counted.
304
+ * The portable interpreter additionally charges copied host-function results and tool responses
305
+ * by serialized size.
306
+ * For the engine's own limit, use the worker_threads adapter.
305
307
  *
306
308
  * Default: 1 * 1024 * 1024 (1 MB); 0 switches the tracking off
307
309
  */
@@ -521,6 +523,14 @@ export interface ExecutionContext {
521
523
  * Tool handler
522
524
  */
523
525
  toolHandler?: ToolHandler;
526
+ /** Synchronous policy: return true to allow the copied request, or throw/return false to refuse. */
527
+ beforeToolCall?: (name: string, args: Record<string, unknown>) => boolean;
528
+ /** Synchronous policy: return true before a custom host global function may run. */
529
+ beforeGlobalCall?: () => boolean;
530
+ /** Called when a successful host tool result is refused before it reaches the script. */
531
+ onToolBridgeFailure?: () => void;
532
+ /** Optional host limit on the JSON bytes of one sanitized tool result. */
533
+ maxToolResultBytes?: number;
524
534
  /**
525
535
  * What the host has in flight for this execution: tool calls and async functions from
526
536
  * `globals` (see ./execution-deadline). Set by the enclave, which ends the execution once the
package/worker.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { InterpreterAdapter } from './adapters/interpreter-adapter';
2
2
  export type { InterpreterAdapterOptions } from './adapters/interpreter-adapter';
3
+ export { PortableEnclave, AgentScriptRunner } from './portable-enclave';
4
+ export type { PortableEnclaveOptions, PortableRunOptions, AgentScriptRunnerOptions } from './portable-enclave';
3
5
  export { Interpreter, InterpreterError, StepLimitError } from './interpreter/interpreter';
4
6
  export type { InterpreterOptions } from './interpreter/interpreter';
5
7
  export type { ExecutionContext, ExecutionResult, ExecutionError, ExecutionStats, ToolHandler } from './types';