# ElizaOS Developer Update - May 25, 2025

## 1. Core Framework

ElizaOS's core architecture has undergone significant enhancements this week as we prepare for the highly anticipated v2 release next week. The framework has been refactored to emphasize modularity and plugin-based functionality, with several key changes:

### Service Registry Pattern

A new service registry pattern has been implemented for typed services in external plugins, consolidating how the framework handles integrations:

```typescript
// Example of registering a service with the new pattern
export function registerService<T extends keyof ServiceRegistry>(
  runtime: AgentRuntime,
  type: T,
  service: ServiceRegistry[T]
): void {
  runtime.services.set(type, service);
}

// Accessing a typed service
const knowledgeService = runtime.getService<KnowledgeService>('knowledge');
```

### Runtime Improvements

The AgentRuntime system has been optimized to better support provider-based model selection with priorities:

```typescript
// New ModelHandler type with provider and priority support
interface ModelHandler {
  provider: string;
  priority?: number;
  handler: (params: ModelParams) => Promise<ModelResponse>;
}

// Enhanced model registration
runtime.registerModel('TEXT_LARGE', {
  provider: 'openai',
  priority: 10,
  handler: async (params) => { /* ... */ }
});
```

### Knowledge System Migration

Knowledge functionality has been completely moved from the runtime to a dedicated plugin architecture:

- Previous runtime methods like `addKnowledge()` are now provided by the knowledge plugin
- The new pattern improves modularity and reduces core dependencies
- Documentation about the "llms-full.txt" file has been clarified - it functions as a "brain-menu" for characters to select which LLM to use for different cognitive tasks

## 2. New Features

### Comprehensive Media Support

A major feature addition is the new image and video chat support ([PR #4750](https://github.com/elizaOS/eliza/pull/4750)), enabling rich media interactions:

```javascript
// Client-side image upload with automatic description
const handleFileUpload = async (file) => {
  const formData = new FormData();
  formData.append('file', file);
  
  const response = await fetch('/api/upload', {
    method: 'POST',
    body: formData
  });
  
  // Image will be described and processed by the agent
  const { url, description } = await response.json();
  return { url, description };
};
```

### WebSocket Log Streaming

Real-time log streaming has been implemented via WebSockets with intelligent fallback to API polling ([PR #4765](https://github.com/elizaOS/eliza/pull/4765)):

```javascript
// Example of connecting to log stream
const connectToLogs = () => {
  const ws = new WebSocket(`ws://${window.location.host}/api/logs/stream`);
  
  ws.onmessage = (event) => {
    const log = JSON.parse(event.data);
    addLogToDisplay(log);
  };
  
  // Fallback to polling if WebSocket fails
  ws.onerror = () => {
    console.warn("WebSocket failed, falling back to polling");
    startPollingLogs();
  };
};
```

### Memory UI Enhancements

The memory management interface has been redesigned with improved visualization and interaction capabilities ([PR #4761](https://github.com/elizaOS/eliza/pull/4761)):

- Enhanced Memory UI with cleaner visual design
- Added chat clearing and message deletion features
- Improved context display and memory navigation

## 3. Bug Fixes

### Critical Embedding Error Fixed

A widespread issue causing "No handler found for delegate type: TEXT_EMBEDDING" errors has been resolved. The error appeared after updating to beta.57 or later and affected many users:

```bash
Error: No handler found for delegate type: TEXT_EMBEDDING
```

The fix involves proper initialization of the embedding handler in the OpenAI plugin. Users experiencing this issue should:

```bash
# Clear node modules and cache
rm -rf node_modules
npm cache clean --force

# Ensure the latest OpenAI plugin is in package.json
npm install @elizaos/plugin-openai@latest

# Restart the application
npm start
```

### RAG Processing Improvements

Issues with large document processing in RAG have been addressed ([Issue #3745](https://github.com/elizaOS/eliza/issues/3745)). Previously, the system attempted to embed entire document contents at once, often exceeding token limits:

```
API Response: {
  "error": {
    "message": "This model's maximum context length is 8192 tokens, 
               however you requested 16376 tokens..."
  }
}
```

The fix implements proper chunking before embedding, allowing larger documents to be processed without errors.

### Plugin Installation Issues

Multiple plugin installation and loading issues have been fixed, particularly with Discord integration. Users were reporting that plugins would install but fail to load correctly:

```
[2025-05-24 16:42:17] ERROR: Failed to load plugin: discord
TypeError: runtime.addKnowledge is not a function
```

These issues have been resolved by ensuring correct export patterns in plugins and implementing better plugin state handling.

## 4. API Changes

### Room and World Management

New API endpoints have been added for creating and managing rooms and worlds:

```javascript
// Create a new room
const createRoom = async (agentId, roomName) => {
  const response = await fetch(`/api/agents/${agentId}/rooms`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ name: roomName })
  });
  return response.json();
};

// Create a new world
const createWorld = async (worldName) => {
  const response = await fetch('/api/worlds', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ name: worldName })
  });
  return response.json();
};
```

### Message API Enhancements

The message API now supports selecting worlds and includes improved handling of responses:

```javascript
// Send message with world context
const sendMessage = async (agentId, text, worldId) => {
  const url = worldId 
    ? `/api/agents/${agentId}/message?worldId=${worldId}` 
    : `/api/agents/${agentId}/message`;
    
  const response = await fetch(url, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ text })
  });
  return response.json();
};
```

### Database API Improvements

The database API has been enhanced with batch operations and more efficient entity retrieval:

```javascript
// Example of using the improved DB API
const getEntitiesById = async (entityIds) => {
  // Previously required multiple separate calls
  // Now handles batch retrieval efficiently
  return await db.getEntitiesByIds(entityIds);
};
```

## 5. Social Media Integrations

### Twitter Plugin Updates

The Twitter plugin has received significant updates to improve posting, interaction handling, and timeline monitoring:

```javascript
// New Twitter timeline functionality example
const monitorTwitterTimeline = async (agent) => {
  // To enable Twitter timeline monitoring, add:
  // TWITTER_TIMELINE_ENABLED=true
  // TWITTER_TIMELINE_INTERVAL_MS=60000 (check every minute)
  
  plugin.on('timeline:mention', async (tweet) => {
    // Handle mentions of the agent
  });
  
  plugin.on('timeline:keyword', async (tweet) => {
    // React to tweets containing specified keywords
  });
};
```

Additional Twitter fixes include better formatting for tweets, with proper handling of newlines and improved error handling for Cloudflare authentication issues.

### Discord Plugin Enhancements

The Discord plugin now supports channel filtering, allowing agents to focus on specific channels:

```
# Configure Discord plugin to only respond in certain channels
DISCORD_CHANNEL_IDS=1234567890123456789,9876543210987654321
```

## 6. Model Provider Updates

### OpenAI Plugin Improvements

The OpenAI plugin has been enhanced with custom embedding endpoint support and better usage tracking:

```javascript
// Configure a custom embedding endpoint
OPENAI_EMBEDDING_ENDPOINT=https://your-custom-endpoint.com/v1/embeddings

// The plugin now emits usage events for all operations
plugin.on('model:usage', (usageData) => {
  console.log(`Used ${usageData.totalTokens} tokens for ${usageData.operation}`);
});
```

### Local AI Configuration Update

Local AI support has been streamlined with a focus on llama.cpp:

```javascript
// Configuration for local AI models
LOCAL_AI_MODEL=/path/to/model.gguf
LOCAL_AI_CONTEXT_SIZE=4096
LOCAL_AI_THREADS=4
```

## 7. Breaking Changes

### Plugin Architecture Migration

The transition to v2 includes a significant shift in plugin architecture, with plugins being moved to dedicated repositories:

- Several plugins have been removed from the monorepo, including:
  - plugin-twitter → https://github.com/elizaos-plugins/plugin-twitter
  - plugin-discord → https://github.com/elizaos-plugins/plugin-discord
  - plugin-telegram → https://github.com/elizaos-plugins/plugin-telegram
  - plugin-farcaster → https://github.com/elizaos-plugins/plugin-farcaster
  
Applications depending on these plugins should update their dependencies to point to the new repositories.

### Runtime API Changes

Several runtime methods have been deprecated or relocated to plugins:

```javascript
// DEPRECATED: Direct runtime knowledge methods
runtime.addKnowledge(); // Now requires knowledge plugin

// NEW: Using the knowledge plugin
const knowledgeService = runtime.getService('knowledge');
await knowledgeService.addKnowledge();
```

### Environment Handling

The environment configuration system has been improved with more consistent file handling:

```javascript
// Previously, global env files could be used
// Now environment files are project-specific only

// Old method (no longer supported)
elizaos env --global set KEY VALUE

// New method (recommended)
elizaos env set KEY VALUE
```

Visit [docs.eliza.how](https://docs.eliza.how) for complete documentation on migrating from v1 to v2.

The ElizaOS v2 release is scheduled for next week, with six developers currently finalizing the no-code platform. Daily updates will be posted in the discussion channel, with weekly summaries in a dedicated channel.