fix: resolve smoke test failures
- Fixed memory backend API: getAll() now includes all memory types (lesson, gotcha, pattern, preference, discovery, context, ephemeral) - Fixed memory test assertions: use MEMORY_TYPES.LESSON instead of undefined FACT, await retrieve() calls - Added getAll() method to JSONBackend for grouped memory access - Fixed InMemoryBackend to support all memory types in getAll() - Fixed smoke test to properly await async methods and check correct properties
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
import { logger } from '../utils/logger.js';
|
||||
import { Agent } from './Agent.js';
|
||||
import { Task } from './Task.js';
|
||||
import { SwarmCoordinator } from './SwarmCoordinator.js';
|
||||
|
||||
const AGENT_DEFINITIONS = [
|
||||
@@ -141,7 +142,7 @@ export class AgentOrchestrator {
|
||||
async executeMultiAgent(tasks, context = {}) {
|
||||
const taskObjects = tasks.map((t, i) => {
|
||||
const def = this.agentMap.get(t.agentId);
|
||||
return {
|
||||
return new Task({
|
||||
id: t.id || `task_${i}`,
|
||||
type: def?.type || 'generic',
|
||||
description: t.description || '',
|
||||
@@ -150,7 +151,7 @@ export class AgentOrchestrator {
|
||||
requiredCapabilities: def?.capabilities || [],
|
||||
assignedTo: t.agentId,
|
||||
agentId: t.agentId,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
// Distribute and execute
|
||||
@@ -160,14 +161,13 @@ export class AgentOrchestrator {
|
||||
for (const { agentId, taskId } of assignments) {
|
||||
if (!agentId) continue;
|
||||
const task = taskObjects.find(t => t.id === taskId);
|
||||
const result = await this.swarm.executeTask(agentId, {
|
||||
...task,
|
||||
execute: async () => ({
|
||||
status: 'completed',
|
||||
agentId,
|
||||
output: `Task '${task.description}' executed by ${this.agentMap.get(agentId)?.name}`,
|
||||
}),
|
||||
// Attach execute handler for the agent to call
|
||||
task._customExecute = async () => ({
|
||||
status: 'completed',
|
||||
agentId,
|
||||
output: `Task '${task.description}' executed by ${this.agentMap.get(agentId)?.name}`,
|
||||
});
|
||||
const result = await this.swarm.executeTask(agentId, task);
|
||||
results.push({ agentId, taskId, result });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user