@enclave-vm/broker package - the orchestration layer for EnclaveJS.
Installation
EnclaveBroker Class
The main broker class for session management and tool orchestration.Constructor
BrokerOptions
Methods
listen(port)
Start the HTTP server.close()
Stop the server and clean up.execute(code, options?)
Execute code and return a stream.getSession(sessionId)
Get session information.submitToolResult(sessionId, callId, result)
Submit a tool call result.HTTP API Endpoints
POST /execute
Execute code with streaming response. Request:GET /sessions/:sessionId
Get session status. Response:POST /sessions/:sessionId/tool-result
Submit tool execution result. Request:GET /code/actions
Returns the current action catalog derived from connected OpenAPI sources. Response:version field is a deterministic hash of all source spec hashes. It changes whenever an OpenAPI spec is polled with additions or removals. Consumers can compare version strings to detect catalog changes.
Example:
CatalogHandler to register this route:
CatalogAction, CatalogService, CatalogResponse, and CatalogHandler are all exported from the @enclave-vm/broker package.
GET /health
Health check endpoint. Response:ToolRegistry Class
Registry for managing tools.Constructor
Methods
register(tool)
Register a tool.get(name)
Get a tool by name.list()
List all registered tools.getDocumentation()
Get tool documentation for LLM prompts.RuntimePoolOptions
Authentication
Rate Limiting
Events
BrokerEvents
Complete Example
Related
- Broker Overview - Architecture guide
- @enclave-vm/types - Type definitions
- @enclave-vm/client - Client SDK