Installation
Protocol Constants and Identifiers
Stream Events
BaseEvent
Every event has these fields. There is no timestamp field.StreamEvent
Union type of all possible stream events.EventType holds the type values: SessionInit ('session_init'), Stdout, Log, ToolCall ('tool_call'), ToolResultApplied ('tool_result_applied'), Final, Heartbeat, Error, PartialResult ('partial_result'), ToolProgress ('tool_progress'), DeadlineExceeded ('deadline_exceeded'), CatalogChanged ('catalog_changed') and Encrypted ('enc').
SessionInitEvent
Session initialization event.StdoutEvent
Console output event.LogEvent
Structured log event.ToolCallEvent
Tool call event.ToolResultAppliedEvent
Tool result confirmation event.HeartbeatEvent
Keep-alive event.FinalEvent
The last event of a session.ErrorEvent
An error during a session that does not end it.Events of protocol version 2
Zod Schemas
Event Schemas
PartialResultEventSchema, ToolProgressEventSchema, DeadlineExceededEventSchema and CatalogChangedEventSchema for the version 2 events), and each payload has one (SessionInitPayloadSchema, FinalPayloadSchema, …).
Usage
Each returns the result of
safeParse. The schemas describe the wire format; a component may accept less. The body the broker accepts for POST /sessions is described with the broker.
Session Types
SessionLimits
DEFAULT_SESSION_LIMITS holds the defaults, and SessionLimitsSchema validates the type. What each limit bounds is decided by the component that applies it: see the limits of the broker.
SessionState
ToolConfig
timeout. It does not retry tools and does not read runtimeReadable.
Encryption Types
These are type definitions for an optional encryption layer.@enclave-vm/client, @enclave-vm/react, @enclave-vm/broker and @enclave-vm/runtime do not encrypt: sessions are plain JSON protected by the transport. @enclave-vm/stream exports primitives for these types; its key exchange is not authenticated, and no package uses it.
EncryptedEnvelope
Key Exchange
SupportedCurve, EncryptionAlgorithm, KeyDerivation, EncryptionMode, EncryptionErrorCode and HkdfInfo hold the constants, next to AES_GCM_NONCE_SIZE (12), AES_GCM_TAG_SIZE (16), AES_256_KEY_SIZE (32) and MAX_MESSAGES_PER_KEY (2^30). isEncryptedEnvelope(value) is the type guard.
Filter Types
EventFilterConfig
FilterMode and PatternType hold the constants, and DEFAULT_ALWAYS_ALLOW the default of alwaysAllow. The broker applies a filter; see Event Filtering.
Runtime Channel Messages
Reference Tokens
@enclave-vm/core does not use this type: there a reference is a string of the form __REF_<uuid>__.
Type Guards
Related
- @enclave-vm/types - Usage examples
- Streaming Protocol - Protocol details
- @enclave-vm/stream - Stream utilities
- @enclave-vm/client - Client SDK