# ElizaOS Development Update
**Week of July 13-19, 2025**

## 1. Core Framework

### Migration to Bun's Native EventTarget API
- Replaced Node.js's EventEmitter with Bun's native EventTarget for improved performance and type safety
- Updated both InternalMessageBus and SimpleMigrationAgent classes to use the new implementation
- Added compatibility layer to maintain backward compatibility with existing code
- Added comprehensive tests to verify compatibility with EventEmitter patterns

### ModuleLoader Enhancements
- Implemented local-first guarantees for consistent module resolution
- Fixed issues with module loading in nested environments
- Added proper error handling for module resolution failures
- Improved synchronization between local development and production environments

### Service Types and Standardization
- Added a new system for standardized service types with `getServicesByType()` method
- Implemented support for multiple services per type with consistent interfaces
- Created specialized interfaces for browser, email, message, PDF, transcription, video, web-search services
- Provided strong typing for service interactions to improve developer experience

## 2. New Features

### Action Chaining
The framework now supports action chaining for complex agent behaviors:
```javascript
// Example of using action chaining
const result = await runtime.runAction("askQuestion", {
  question: "What's the weather?",
  onSuccess: {
    action: "showWeatherVisual",
    params: { animated: true }
  }
});
```

Key capabilities:
- Actions can now specify follow-up actions with parameters
- Results from previous actions are available to subsequent actions
- State is maintained throughout the chain for consistent execution
- Provides callbacks for user feedback during complex workflows

### Plugin Quick-Starter Template
Added a streamlined template for creating backend-only plugins:
```bash
elizaos create my-plugin --type plugin --template quick-starter
```

Benefits:
- Reduced boilerplate - focuses only on backend functionality
- Eliminates frontend dependencies for faster development
- Includes pre-configured testing setup
- Optimized for services, providers, and actions development

### Image Generation Action
Added native support for AI image generation:
```javascript
// Example usage in a plugin
export const generateImageAction = createAction({
  name: "GENERATE_IMAGE",
  handler: async (params, context) => {
    const { prompt } = params;
    const imageUrl = await context.runtime.useModel(ModelType.IMAGE, prompt);
    return { success: true, imageUrl };
  }
});
```

## 3. Bug Fixes

### Critical Plugin Action Loading Issue
Fixed a severe bug where plugin actions would not load in the NPM-deployed version:
- Root cause: Path resolution issues in the published package structure
- Impact: Actions defined in plugins were not properly registered with the runtime
- Solution: Updated the plugin loading mechanism to handle both development and production paths
- Validation: Added comprehensive tests to ensure actions load in all environments

### Windows Compatibility Improvements
Addressed multiple issues with Windows paths and environment:
- Fixed plugin loading failures on Windows with proper path normalization
- Resolved WSL-specific issues where agents would become unresponsive
- Improved cross-platform compatibility for file path handling
- Enhanced CI testing to catch Windows-specific issues earlier

### Database Inheritance Bug
Fixed an issue where creating a new project within an existing project directory:
- Caused the child project to inherit the parent's PGLITE_DATA_DIR environment variable
- Led to database collisions and corruption between projects
- Solution: Isolated environment variable resolution to prevent inheritance

## 4. API Changes

### EventTarget Migration
The migration from EventEmitter to EventTarget introduces some API changes:
```javascript
// Old pattern
service.on('event', handler);
service.emit('event', data);

// New pattern (still compatible with old)
service.on('event', handler);
service.dispatchEvent(new CustomEvent('event', { detail: data }));
```

Developer guidance:
- The `on()` method remains for backward compatibility
- New code should use EventTarget's addEventListener/dispatchEvent
- Event handlers now receive CustomEvent objects with data in the detail property

### Action Result Type Updates
Updated the ActionResult interface to provide better type safety:
```typescript
interface ActionResult {
  success: boolean;
  error?: string;
  data?: Record<string, any>;
  nextAction?: {
    name: string;
    params?: Record<string, any>;
  };
}
```

## 5. Social Media Integrations

### Twitter Plugin Improvements
- Fixed database insertion error in Twitter plugin (v1.2.17)
- Resolved issues with rate limiting and 429 errors
- Added better error handling for API failures
- Fixed issue where agents would respond to tweets but not post new ones
- Added environment variable for configuring post intervals

### Discord & Telegram Optimizations
- Improved message processing pipeline for faster response times
- Fixed edge cases with unicode character handling
- Enhanced group chat support in both platforms
- Added proper error recovery for connection disruptions

## 6. Model Provider Updates

### OpenAI Plugin Enhancements
- Updated to support latest API changes
- Added automatic retry logic for transient failures
- Improved token count estimation for better budget management
- Enhanced streaming stability for long-running generations

### Anthropic Integration
- Fixed an issue where passing images to Anthropic models through useModel(ModelType.TEXT_LARGE) was failing
- Updated prompt handling to improve response formatting with proper code blocks
- Improved error messages for better debugging
- Added support for the latest Claude models

### Local AI Support
- Made Ollama plugin conditional based on OLLAMA_API_ENDPOINT environment variable
- Improved plugin to act as a fallback when other LLMs are unavailable
- Fixed Windows-specific loading issues with local AI providers
- Enhanced error reporting for local model failures

## 7. Breaking Changes

### V1 to V2 Migration
- Added automatic V1 → V2 character conversion during JSON import
- Implemented plugin matching to map deprecated providers to their V2 equivalents:
  - `llama_local` now maps to `@elizaos/plugin-ollama`
  - `googleGenerativeAI` maps to `@elizaos/plugin-google-ai`
- Migration failures will show detailed error messages to help with manual conversion

### Environment Variable Standardization
- Renamed several environment variables for consistency
- Added `LOG_TIMESTAMPS` to control timestamp display in logs
- Deprecated `NODE_ENV` in favor of `ELIZA_ENV` for runtime environment control
- Added `ELIZA_UI_ENABLE` to control web UI availability in production

Visit our [GitHub repository](https://github.com/elizaos/eliza) for detailed documentation and the latest changes. Join our Discord community for direct assistance from the development team.