@enclave-vm/types
Type definitions and Zod schemas for the EnclaveJS streaming runtime protocol. This package provides the foundation for type-safe communication between all EnclaveJS components. It holds types, constants, schemas and type guards; it sends and receives nothing.Installation
Protocol Identifiers
Session and Call IDs
Session States
Session Limits
Stream Events
Event Types
Event Structures
Every event hasprotocolVersion, sessionId, a sequence number seq, a type and a payload. There is no timestamp field.
ok: false and error: { message, code? } in its final payload.
Zod Schemas
The types have corresponding Zod schemas for runtime validation:parseStreamEvent, parseEncryptedEnvelope, parseRuntimeChannelMessage, parseCreateSessionRequest and parseStreamEventOrEncrypted return the result of safeParse.
Available Schemas
These schemas describe the wire format. A component may accept less than a schema allows: the broker, for example, accepts session ids of a fixed alphabet and length only.
Encryption Types
Event Filtering Types
Runtime Channel Messages
@enclave-vm/core sessions and of @enclave-vm/runtime carry them. The broker does not use such a channel: it runs the sandbox in process and applies tool results itself, and @enclave-vm/runtime does not execute scripts.
Reference Tokens
@enclave-vm/core does not use it: there a reference is a string of the form __REF_<uuid>__ (see Reference Sidecar).