Shared types, enums, and utilities for the Hexos framework.

This package provides the foundational type contracts used across all Hexos packages — frontend (react-core, react-ui) and backend (runtime).

Installation

npm install @hexos/common

Peer dependency: zod ^3.0.0

What’s Included

LLM Provider Enums

import { LLMProvider, AnthropicModel, OpenAIModel, OllamaModel } from '@hexos/common';
 
LLMProvider.Anthropic  // 'anthropic'
LLMProvider.OpenAI     // 'openai'
LLMProvider.Ollama     // 'ollama'
LLMProvider.Google     // 'google'
LLMProvider.Azure      // 'azure'

Core Types

TypeDescription
ModelConfigLLM provider connection configuration (provider, model, apiKey, temperature)
AgentDefinitionComplete agent specification (id, name, model, systemPrompt, tools, handoffs)
RuntimeConfigMaster runtime configuration (agents, MCP servers, hooks, limits)
ToolDefinitionTool contract with Zod input schema, execute function, and approval flag
ToolContextExecution context passed to tools (agentId, conversationId, userId)
AgentMessageConversation message with role, content, tool calls, and attachments
RuntimeEventDiscriminated union of all streaming events (text, tool calls, handoffs, errors)

MCP Types

TypeDescription
MCPServerConfigUnion of STDIO and SSE server configurations
MCPStdioServerConfigLocal MCP server via child process
MCPSSEServerConfigRemote MCP server via HTTP SSE
MCPToolInfoTool metadata discovered from an MCP server

Transport Types

TypeDescription
AgentConfigFrontend connection configuration (endpoint, headers, transport)
TransportMessageOutbound message payload from client to server
AgentTransportAbstract transport interface (connect, send, onMessage, disconnect)
TransportEventAlias for RuntimeEvent on the frontend

Tool Approval & Handoff Types

TypeDescription
ToolApprovalPending approval request
ApprovalDecisionUser’s approve/reject response
HandoffResultMarker object signaling agent-to-agent transition
HandoffRecordHistorical record of a handoff

Infrastructure Types

TypeDescription
RateLimitConfigSliding window rate limiting configuration
RetryConfigExponential backoff retry configuration
RuntimeHooksLifecycle callbacks (onAgentStart, onToolCall, onHandoff, etc.)

Utility Functions

import {
  isHandoffResult,    // Type guard for HandoffResult
  isMCPSSEConfig,     // Type guard for MCPSSEServerConfig
  isMCPStdioConfig,   // Type guard for MCPStdioServerConfig
  notNullOrUndefined, // Array filter for null/undefined
  assertNever,        // Exhaustiveness check for discriminated unions
} from '@hexos/common';

License

MIT

API Reference

Agent Config Core Types Infrastructure Mcp Runtime Tools Transport Utilities