@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/README.md +30 -1
- package/bounded-json.d.ts +33 -0
- package/enclave.d.ts +4 -1
- package/esm/index.mjs +875 -147
- package/esm/worker.mjs +1647 -67
- package/index.js +883 -155
- package/interpreter/interpreter.d.ts +4 -5
- package/package.json +3 -3
- package/portable-enclave.d.ts +51 -0
- package/portable-globals.d.ts +2 -0
- package/realm-regex-backstop.d.ts +18 -0
- package/scoring/scoring-gate.d.ts +2 -0
- package/sidecar/reference-resolver.d.ts +7 -2
- package/src/adapters/worker-pool/package.json +3 -3
- package/src/adapters/worker-pool/worker-script.js +657 -109
- package/types.d.ts +13 -3
- package/worker.d.ts +2 -0
- package/worker.js +1637 -67
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.
|
|
303
|
-
* operations that make text and arrays grow;
|
|
304
|
-
*
|
|
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';
|