# ElizaOS Developer Update - July 30, 2025

## Core Framework

The ElizaOS team has made significant architectural improvements to the core framework this week, focused on enhancing event handling, logging, and service management:

### EventTarget Migration
We've migrated from Node.js `EventEmitter` to Bun's native `EventTarget` API across the codebase, providing better performance and runtime compatibility. This change affects core message bus implementations while maintaining backward compatibility:

```typescript
// Before: EventEmitter-based implementation 
this.emitter.on('message', (payload) => {
  // Handler logic
});

// Now: EventTarget-based implementation
this.eventTarget.addEventListener('message', (event) => {
  const payload = event.detail;
  // Handler logic
});
```

### YAML-Based Logging System
A new logging system has been implemented to address excessive console and database logs. The system organizes user interactions as hourly YAML lists:

```typescript
// Implementation preview
const yamlLogger = new YAMLLogger({
  outputDir: path.join(process.cwd(), '.eliza', 'logs'),
  rotationInterval: '1h'
});

// Example usage
yamlLogger.log({
  type: 'message',
  channelId,
  content,
  timestamp: Date.now()
});
```

### Service Types Framework
We've introduced a standardized service types system with a new `getServicesByType()` method, enabling more flexible service discovery:

```typescript
// Example: Getting browser services
const browserServices = runtime.getServicesByType<BrowserService>('browser');
if (browserServices.length > 0) {
  await browserServices[0].navigateTo(url);
}
```

## New Features

### Action Chaining
A powerful new action chaining capability allows agents to execute sequences of actions with state persistence between steps:

```typescript
// Example of action chaining
export const myWorkflow = async (state: State): Promise<ActionResult> => {
  // First action stores result in state
  const firstResult = await actions.searchWeb({
    query: "latest AI research",
    state
  });
  
  // Second action uses result from first action
  return actions.generateSummary({
    content: state.actionState.searchWebResult,
    state
  });
};
```

### Character-Based Model Configuration
Added support for character-specific model configuration settings:

```typescript
// Example character configuration with model settings
{
  "name": "ResearchAssistant",
  "plugins": ["@elizaos/plugin-google-genai", "@elizaos/plugin-knowledge"],
  "modelSettings": {
    "temperature": 0.2,
    "topP": 0.9,
    "maxTokens": 2048
  }
}
```

### Image Generation Action
Added native support for image generation in the agent pipeline, enabling the agent to generate images based on conversational context:

```typescript
// Example usage
const result = await generateImageAction({
  prompt: "A futuristic city with flying cars and holographic displays",
  size: "1024x1024",
  style: "vivid",
  state
});
```

## Bug Fixes

### Plugin Loading on Windows
Fixed a critical issue where plugins would fail to load on Windows systems. The root cause was path normalization problems:

```typescript
// Before
const pluginPath = path.join(pluginDir, pluginName);

// After
const pluginPath = path.normalize(path.join(pluginDir, pluginName));
```

This resolves issue #5407 where plugins like `plugin-local-ai` were failing to load with cryptic error messages.

### SQL Database Serialization
Fixed a bug in the SQL plugin where JSON objects weren't being properly stringified before passing to PostgreSQL:

```typescript
// Before - caused object serialization errors
sql`INSERT INTO memories (content, metadata) VALUES (${content}::jsonb, ${metadata}::jsonb)`;

// After - properly stringifies objects
sql`INSERT INTO memories (content, metadata) VALUES (${JSON.stringify(content)}::jsonb, ${JSON.stringify(metadata)}::jsonb)`;
```

This resolves unexpected database errors during message storage.

### CLI Environment Inheritance 
Fixed an issue where nested ElizaOS project creation would incorrectly inherit parent project database configuration:

```typescript
// Before: Inherited parent project environment
const envVars = { ...process.env };

// After: Fresh environment for each project
const envVars = {
  ...getMinimalEnv(),
  PGLITE_DATA_DIR: path.join(projectDir, '.eliza', '.elizadb')
};
```

## API Changes

### Runtime Service API
The core runtime API has been enhanced with a new service discovery method:

```typescript
// New method
getServicesByType<T extends ServiceType>(type: string): T[]

// Usage example
const emailServices = runtime.getServicesByType<EmailService>('email');
```

This provides a standardized way to access plugin-provided services by type, supporting multiple implementations.

### Bootstrap Event System
The bootstrap plugin now emits standardized events for logging and interception:

```typescript
// Event emission
bootstrap.emit('log', {
  level: 'info',
  message: 'Processing user message',
  metadata: { channelId, messageId }
});

// Event subscription in plugins
bootstrap.on('log', (logData) => {
  // Custom logging implementation
});
```

## Social Media Integrations

### Twitter Plugin Updates
The Twitter plugin has been enhanced with better support for posting capabilities:

- Added default examples to the Eliza character configuration
- Improved error handling for rate limiting (429 errors)
- Fixed database insertion failures after authentication

Note: The project's X (Twitter) accounts remain suspended, though team members report positive signals about reinstatement.

### Discord Integration
Significant progress has been made on Discord voice integration:

- Exploring new voice capabilities for ElizaOS with Discord
- Current limitations identified: whisper has been broken since local-ai was discontinued
- Investigating service-based alternatives for transcription

## Model Provider Updates

### OpenRouter Support
Enhanced the plugin-openrouter configuration with temperature settings:

```typescript
// Now supports passing temperature as a parameter
useModel(TEXT_LARGE, { 
  prompt, 
  temperature: 0.7 
});

// Coming in next release: configuring from character files
```

### GLM-4.5 Performance
The team noted impressive performance of GLM-4.5, an open-source model outperforming most competitors except Sonnet and Opus. This opens opportunities for improved locally-hosted model support.

### Ollama Integration
Improved Ollama plugin integration to make it truly conditional based on configuration:

```typescript
// Environment-based conditional loading
if (process.env.OLLAMA_API_ENDPOINT) {
  plugins.push("@elizaos/plugin-ollama");
}
```

## Breaking Changes

### V1 to V2 Migration

For users migrating characters from V1 to V2:

1. The character importer now automatically converts V1 characters to V2 format during JSON import
2. Plugin names are matched and converted (e.g., `llama_local` → `@elizaos/plugin-ollama`)
3. Temperature settings are now passed differently:

```typescript
// V1 style (deprecated)
useModel("openai:gpt-4", { prompt, params: { temperature: 0.7 } })

// V2 style
useModel(TEXT_LARGE, { prompt, temperature: 0.7 })
```

Character conversion also preserves existing avatar settings and properly handles both string and array types in bio for backward compatibility.