# ElizaOS Developer Update - Week of June 2-6, 2025

## 1. Core Framework

The ElizaOS team has made significant strides in the core architecture this week with the release of v1.0.5 and continued work toward the v2 launch.

### Message Server Refactoring

A complete overhaul of the messaging system has been implemented, making the message server standalone and separate from agents:

```javascript
// New message handling architecture with dedicated channels
export interface MessageChannel {
  id: string;
  type: ChannelType;
  participants: MessageParticipant[];
  serverId: string;
}

// Improved shouldRespond logic to prevent agent cross-talk
if (!shouldRespond(message, agent)) {
  logger.debug(`Agent ${agent.id} skipping message ${message.id} (shouldRespond=false)`);
  return;
}
```

This architecture improves message isolation between agents, prevents cross-interference loops, and enables more robust group creation and channel management features.

### Plugin System Enhancements

Plugin loading has been thoroughly optimized to reduce startup log spam and improve performance:

```javascript
// Smart strategy selection that checks file existence before attempting imports
const importPaths = [
  // Package.json entry first (most likely)
  `${pluginPath}/dist/index.js`,
  // Then commonjs
  `${pluginPath}/index.js`,
  // Then source
  `${pluginPath}/src/index.ts`
];

for (const path of importPaths) {
  if (await fileExists(path)) {
    return await import(path);
  }
}
```

## 2. New Features

### Environment Variable Prompting for Plugins

A new feature has been added to prompt users for required environment variables during plugin installation:

```javascript
import { z } from 'zod';

export const pluginConfigSchema = z.object({
  TWITTER_API_KEY: z.string().min(1, { message: "Twitter API key is required" }),
  TWITTER_API_SECRET: z.string().min(1, { message: "Twitter API secret is required" }),
  TWITTER_ACCESS_TOKEN: z.string().min(1, { message: "Twitter access token is required" }),
  TWITTER_ACCESS_SECRET: z.string().min(1, { message: "Twitter access token secret is required" })
});
```

This improves the developer experience by guiding users through the configuration process with clear validation rules and error messages.

### Automatic Bun Installation in CLI

The CLI now automatically installs Bun when needed:

```javascript
async function ensureBunInstalled() {
  try {
    await exec('bun --version');
    logger.info('Bun is already installed.');
    return true;
  } catch (error) {
    logger.info('Bun is not installed. Installing...');
    try {
      await exec('npm install -g bun');
      logger.info('Bun installed successfully.');
      return true;
    } catch (installError) {
      logger.error('Failed to install Bun:', installError);
      return false;
    }
  }
}
```

## 3. Bug Fixes

### Agent Cross-Interference Loop

A critical bug causing agents to respond to each other's messages and create infinite loops has been fixed:

```javascript
// Problem: agents were processing and responding to any agent_response messages
// Fix: Added additional metadata checks and improved shouldRespond logic
export function shouldRespond(message: Message, agent: Agent): boolean {
  // Skip if message is from same agent
  if (message.agentId === agent.id) {
    return false;
  }

  // Skip if message is an agent response not directed to this agent
  if (message.type === MessageType.AGENT_RESPONSE && 
      message.metadata?.targetAgentId !== agent.id) {
    return false;
  }
  
  // Continue with regular checks...
}
```

This fix prevents cascading agent conversations and significantly improves system stability.

### Memory Viewer Display Issues

The agent memory viewer was not displaying memories correctly, which has been resolved:

```javascript
// Fix for memory viewer not displaying memories
export const useMemories = (agentId: string, roomId?: string) => {
  const { data, error, isLoading } = useSWR<MemoriesResponse>(
    agentId ? `/api/agents/${agentId}/memories${roomId ? `?roomId=${roomId}` : ''}` : null,
    fetcher
  );

  return {
    memories: data?.memories || [],
    isLoading,
    error
  };
};
```

## 4. API Changes

### New Endpoints

Several API endpoints have been added or improved:

```typescript
// New GET endpoint for retrieving room information
router.get('/agents/:agentId/rooms/:roomId', async (req, res) => {
  const { agentId, roomId } = req.params;

  try {
    const room = await db.query.rooms.findFirst({
      where: eq(rooms.id, roomId),
      with: {
        connections: {
          where: eq(connections.agentId, agentId),
        },
      },
    });

    if (!room) {
      return res.status(404).json({ error: 'Room not found' });
    }

    return res.json(room);
  } catch (error) {
    return res.status(500).json({ error: 'Failed to get room' });
  }
});
```

### Breaking Changes in Core API

The core API has been updated with improved plugin specifications, which will be fully documented in the v2 release:

```typescript
// New plugin specification import path for v2
import { Plugin } from '@elizaos/core/v2';

// Example of implementing a v2 plugin
export default class MyPlugin implements Plugin {
  id = 'my-plugin';
  version = '1.0.0';
  
  async onLoad(runtime: PluginRuntime): Promise<void> {
    // Implementation
  }
}
```

## 5. Social Media Integrations

### Twitter Plugin Updates

The Twitter plugin has been updated to version 1.0.3 with important fixes:

```javascript
// Added support for targeted users
export const pluginConfigSchema = z.object({
  // ... existing fields
  TWITTER_TARGET_USERS: z.string().optional(),
});

// Fix for duplicate tweets
export async function sendTweet(runtime, content, options = {}) {
  // Generate unique ID to prevent duplicate tweets
  const tweetId = crypto.randomUUID();
  
  // Track sent tweets to prevent duplicates
  if (sentTweets.has(content)) {
    runtime.logger.warn(`Duplicate tweet detected: ${content.substring(0, 30)}...`);
    return null;
  }
  
  // ... sending logic
  sentTweets.add(content);
}
```

These changes improve reliability for social media integrations and address a long-standing issue with duplicate tweets.

### Discord Plugin Fixes

The Discord plugin has received significant improvements in action callbacks:

```javascript
// Improved shouldRespond logic and action callback handling
runtime.on('message', async (message) => {
  // Ensure callbacks reach users
  if (message.type === 'ACTION_CALLBACK' && message.action?.type === 'DISCORD_REPLY') {
    const { channelId, content } = message.action.data;
    await discordClient.channels.cache.get(channelId).send(content);
  }
});
```

## 6. Model Provider Updates

### OpenRouter Integration Limitations

It was discovered that OpenRouter integration lacks embedding support, requiring OpenAI plugin as a fallback:

```javascript
// Check if OpenRouter is configured as the model provider
if (runtime.getConfig('MODEL_PROVIDER') === 'openrouter' && 
    runtime.getConfig('CTX_KNOWLEDGE_ENABLED') === 'true') {
  
  // Verify OpenAI is available as fallback for embeddings
  if (!runtime.getConfig('OPENAI_API_KEY')) {
    throw new Error('OpenRouter does not support embeddings. ' + 
                    'Please configure OPENAI_API_KEY as a fallback for embeddings.');
  }
  
  // Use OpenAI for embeddings while keeping OpenRouter for completions
  runtime.logger.info('Using OpenAI for embeddings with OpenRouter for completions');
}
```

### ElevenLabs V3 API

The council/clank tank system has been updated to use the new ElevenLabs v3 API:

```javascript
// Updated ElevenLabs v3 API integration
export async function generateSpeech(text, voiceId = 'default') {
  const response = await fetch('https://api.elevenlabs.io/v3/text-to-speech/' + voiceId, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'xi-api-key': process.env.ELEVENLABS_API_KEY
    },
    body: JSON.stringify({
      text,
      model_id: 'eleven_multilingual_v2',
      voice_settings: {
        stability: 0.5,
        similarity_boost: 0.75
      }
    })
  });
  
  return await response.arrayBuffer();
}
```

## 7. Breaking Changes

### V1 to V2 Migration Issues

As the team prepares for the v2 announcement next week, several migration issues have been identified:

- The bootstrap plugin is now mandatory for agent functionality:

```javascript
// Before (v1):
const plugins = [
  '@elizaos/plugin-openai',
  '@elizaos/plugin-discord',
  // bootstrap was optional
];

// After (v2):
const plugins = [
  '@elizaos/plugin-openai',
  '@elizaos/plugin-discord',
  // bootstrap is now required
  '@elizaos/plugin-bootstrap'
];
```

- Older methods like `runtime.addKnowledge()` have been moved to the knowledge plugin:

```javascript
// Before (v1):
await runtime.addKnowledge('My document', 'This is important information');

// After (v2):
// First ensure knowledge plugin is included
await runtime.plugins.knowledge.addDocument({
  title: 'My document',
  content: 'This is important information',
  metadata: { source: 'manual' }
});
```

For detailed migration instructions, refer to the upcoming v2 documentation: https://eliza.how/docs/intro

---

For help with these updates, join us in the [ElizaOS Discord](https://discord.gg/ai16z) or visit our [GitHub repository](https://github.com/elizaOS/eliza).