Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@enclave-vm/types

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@enclave-vm/types

Type definitions and Zod schemas for the EnclaveJS streaming runtime protocol

Source
npmnpm
Version
2.9.2
Version published
Maintainers
1
Created
Source

@enclave-vm/types

npm version License TypeScript

Type definitions and Zod schemas for the EnclaveJS streaming runtime protocol

The @enclave-vm/types package provides TypeScript type definitions and runtime validation schemas for the EnclaveJS streaming protocol. It serves as the foundation for type-safe communication between EnclaveJS components.

Features

  • TypeScript-First: Full TypeScript support with strict typing
  • Zod Schemas: Runtime validation for all protocol messages
  • Protocol Types: Complete type definitions for streaming messages
  • Session Types: Types for session management and state
  • Tool Types: Type definitions for tool calls and responses

Installation

npm install @enclave-vm/types
# or
yarn add @enclave-vm/types
# or
pnpm add @enclave-vm/types

Quick Start

import { StreamMessage, ToolCallMessage, ToolResultMessage, SessionState } from '@enclave-vm/types';

// Type-safe message handling
function handleMessage(message: StreamMessage) {
  switch (message.type) {
    case 'tool_call':
      const toolCall = message as ToolCallMessage;
      console.log(`Tool: ${toolCall.name}, Args:`, toolCall.args);
      break;
    case 'tool_result':
      const result = message as ToolResultMessage;
      console.log(`Result:`, result.data);
      break;
  }
}

Protocol Messages

Stream Messages

import { StreamMessageSchema, StreamMessage } from '@enclave-vm/types';

// Validate incoming messages
const message = StreamMessageSchema.parse(rawMessage);

Tool Calls

import { ToolCallMessage, ToolResultMessage } from '@enclave-vm/types';

const toolCall: ToolCallMessage = {
  type: 'tool_call',
  id: 'call_123',
  name: 'getUser',
  args: { userId: 1 },
};

const toolResult: ToolResultMessage = {
  type: 'tool_result',
  id: 'call_123',
  data: { name: 'Alice', email: 'alice@example.com' },
};

Session State

import { SessionState, SessionStatus } from '@enclave-vm/types';

const session: SessionState = {
  id: 'session_abc',
  status: 'running',
  createdAt: new Date(),
  toolCallCount: 5,
};

Zod Schemas

All types have corresponding Zod schemas for runtime validation:

import { StreamMessageSchema, ToolCallMessageSchema, SessionStateSchema } from '@enclave-vm/types';

// Parse and validate
const message = StreamMessageSchema.safeParse(untrustedData);
if (message.success) {
  // message.data is typed correctly
  handleMessage(message.data);
} else {
  console.error('Invalid message:', message.error);
}
PackageDescription
@enclave-vm/streamStreaming protocol implementation
@enclave-vm/brokerTool broker and session management
@enclave-vm/clientBrowser/Node.js client SDK
@enclave-vm/reactReact hooks and components
@enclave-vm/runtimeStandalone runtime worker

License

Apache-2.0

Keywords

enclavejs

FAQs

Package last updated on 30 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts