mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
## 🔧 Critical Swarm System Fixes ### Fixed Task File Naming Bug - Tasks were being saved as '[object Object].json' due to TaskId object structure - Now properly extracts task ID string for file naming - Files save correctly as 'task_<id>.json' ### Added Task Timeout Protection - Implemented automatic timeout detection in task execution loop - Tasks that exceed timeout (default 5 minutes) are marked as failed - Prevents swarms from hanging indefinitely on stuck tasks - Agent state properly cleaned up on timeout ### Fixed Target Directory Propagation - Testing tasks were receiving null targetDir, preventing file access - Target directory now extracted from objective description - All tasks inherit targetDir through context - Enhanced extractTargetDirectory to check multiple sources ### Improved Task Dependencies - Fixed taskDependenciesMet to handle both string and TaskId objects - Added convertDependenciesToTaskDependencies for Map structure - Dependencies now properly resolve for sequential task execution ### Auto Strategy Integration - Added missing autoStrategy property and initialization - Proper AutoStrategy instantiation in coordinator constructor - Enables intelligent task decomposition for 'auto' strategy ## 📊 Added Comprehensive Benchmarks ### Benchmark Suite Integration - Added complete Python-based benchmarking tool - Tests 7 strategies across 5 coordination modes - 100% success rate across all test scenarios - Performance metrics: 0.10s - 0.20s execution times ### Real-World Performance Data - Calculator example: 4m 20s total (3 tasks) - Task breakdown: Analysis 29%, Implementation 22%, Testing 48% - Successfully created 6 files with proper directory structure ## 📝 Documentation Updates ### Updated README.md - Added v1.0.50 changelog with critical fixes - Integrated benchmark performance results table - Added real-world timing example - Removed old update notes for clarity - Added dedicated Benchmarks & Performance section ## 🧪 Test Results - Swarm now completes successfully with proper task coordination - All fixes validated in production environment - Task files save with correct names - Testing tasks find implementation files - Swarms exit cleanly after completion 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
208 lines
5.7 KiB
TypeScript
208 lines
5.7 KiB
TypeScript
#!/usr/bin/env ts-node
|
|
|
|
/**
|
|
* Documenter Agent Test - Designed for parallel execution
|
|
* This agent creates and maintains documentation
|
|
*/
|
|
|
|
export class DocumenterAgent {
|
|
private agentId: string;
|
|
private startTime: number;
|
|
|
|
constructor(id: string = 'documenter-001') {
|
|
this.agentId = id;
|
|
this.startTime = Date.now();
|
|
}
|
|
|
|
async generateAPIDocumentation(apiSpec: any): Promise<any> {
|
|
console.log(`[${this.agentId}] Generating API documentation for: ${apiSpec.name}`);
|
|
|
|
await this.simulateWork(1200);
|
|
|
|
const documentation = {
|
|
format: 'OpenAPI 3.0',
|
|
endpoints: apiSpec.endpoints.length,
|
|
pages: Math.floor(Math.random() * 10) + 20,
|
|
sections: [
|
|
'Overview',
|
|
'Authentication',
|
|
'Endpoints',
|
|
'Request/Response Examples',
|
|
'Error Codes',
|
|
'Rate Limiting',
|
|
'Webhooks',
|
|
'SDKs'
|
|
],
|
|
examples: {
|
|
curl: apiSpec.endpoints.length * 2,
|
|
javascript: apiSpec.endpoints.length * 2,
|
|
python: apiSpec.endpoints.length * 2,
|
|
postman: apiSpec.endpoints.length
|
|
},
|
|
features: [
|
|
'Interactive API explorer',
|
|
'Code generation',
|
|
'Versioning support',
|
|
'Search functionality'
|
|
]
|
|
};
|
|
|
|
console.log(`[${this.agentId}] API documentation generated`);
|
|
return {
|
|
agentId: this.agentId,
|
|
duration: Date.now() - this.startTime,
|
|
api: apiSpec.name,
|
|
documentation
|
|
};
|
|
}
|
|
|
|
async createUserGuide(feature: string): Promise<any> {
|
|
console.log(`[${this.agentId}] Creating user guide for: ${feature}`);
|
|
|
|
await this.simulateWork(1500);
|
|
|
|
const userGuide = {
|
|
title: `${feature} User Guide`,
|
|
sections: [
|
|
'Getting Started',
|
|
'Core Concepts',
|
|
'Step-by-Step Tutorials',
|
|
'Best Practices',
|
|
'Troubleshooting',
|
|
'FAQ',
|
|
'Glossary'
|
|
],
|
|
tutorials: [
|
|
'Basic Setup and Configuration',
|
|
'Your First Authentication',
|
|
'Managing User Sessions',
|
|
'Implementing Two-Factor Auth',
|
|
'Password Recovery Flow'
|
|
],
|
|
mediaAssets: {
|
|
screenshots: Math.floor(Math.random() * 20) + 15,
|
|
diagrams: Math.floor(Math.random() * 10) + 5,
|
|
videos: Math.floor(Math.random() * 5) + 2
|
|
},
|
|
estimatedReadTime: '45 minutes',
|
|
difficultyLevel: 'Beginner to Intermediate'
|
|
};
|
|
|
|
console.log(`[${this.agentId}] User guide created`);
|
|
return {
|
|
agentId: this.agentId,
|
|
duration: Date.now() - this.startTime,
|
|
feature,
|
|
userGuide
|
|
};
|
|
}
|
|
|
|
async documentCodebase(module: string): Promise<any> {
|
|
console.log(`[${this.agentId}] Documenting codebase for: ${module}`);
|
|
|
|
await this.simulateWork(2000);
|
|
|
|
const codeDocumentation = {
|
|
filesDocumented: Math.floor(Math.random() * 30) + 20,
|
|
classes: Math.floor(Math.random() * 15) + 10,
|
|
methods: Math.floor(Math.random() * 100) + 50,
|
|
interfaces: Math.floor(Math.random() * 20) + 10,
|
|
coverage: {
|
|
public: '95%',
|
|
protected: '85%',
|
|
private: '60%'
|
|
},
|
|
documentation: {
|
|
jsdoc: true,
|
|
readme: true,
|
|
changelog: true,
|
|
contributing: true,
|
|
architecture: true
|
|
},
|
|
diagrams: [
|
|
'Component Architecture',
|
|
'Data Flow',
|
|
'Sequence Diagrams',
|
|
'Class Relationships',
|
|
'Deployment Architecture'
|
|
],
|
|
qualityScore: 8.7
|
|
};
|
|
|
|
console.log(`[${this.agentId}] Codebase documentation completed`);
|
|
return {
|
|
agentId: this.agentId,
|
|
duration: Date.now() - this.startTime,
|
|
module,
|
|
documentation: codeDocumentation
|
|
};
|
|
}
|
|
|
|
async generateReleaseNotes(version: string): Promise<any> {
|
|
console.log(`[${this.agentId}] Generating release notes for version: ${version}`);
|
|
|
|
await this.simulateWork(800);
|
|
|
|
const releaseNotes = {
|
|
version,
|
|
releaseDate: new Date().toISOString().split('T')[0],
|
|
highlights: [
|
|
'New two-factor authentication support',
|
|
'Improved performance by 40%',
|
|
'Enhanced security with JWT rotation',
|
|
'New password strength requirements'
|
|
],
|
|
features: [
|
|
'OAuth2 integration with Google and GitHub',
|
|
'Biometric authentication support',
|
|
'Session management dashboard',
|
|
'Audit logging for all auth events'
|
|
],
|
|
bugFixes: [
|
|
'Fixed race condition in token validation',
|
|
'Resolved memory leak in session storage',
|
|
'Fixed edge case in password reset flow'
|
|
],
|
|
breakingChanges: [
|
|
'Minimum password length increased to 12',
|
|
'Deprecated legacy authentication endpoints'
|
|
],
|
|
migration: {
|
|
required: true,
|
|
estimatedTime: '30 minutes',
|
|
automatedScripts: true
|
|
}
|
|
};
|
|
|
|
console.log(`[${this.agentId}] Release notes generated`);
|
|
return {
|
|
agentId: this.agentId,
|
|
duration: Date.now() - this.startTime,
|
|
version,
|
|
releaseNotes
|
|
};
|
|
}
|
|
|
|
private async simulateWork(ms: number): Promise<void> {
|
|
await new Promise(resolve => setTimeout(resolve, ms));
|
|
}
|
|
}
|
|
|
|
// Allow direct execution
|
|
if (require.main === module) {
|
|
const documenter = new DocumenterAgent();
|
|
const apiSpec = {
|
|
name: 'User Authentication API',
|
|
version: '1.0',
|
|
endpoints: ['/auth/login', '/auth/validate', '/auth/refresh', '/auth/logout']
|
|
};
|
|
|
|
Promise.all([
|
|
documenter.generateAPIDocumentation(apiSpec),
|
|
documenter.createUserGuide('User Authentication'),
|
|
documenter.documentCodebase('AuthenticationModule'),
|
|
documenter.generateReleaseNotes('v2.0.0')
|
|
]).then(results => {
|
|
console.log('\nDocumenter Agent Results:', JSON.stringify(results, null, 2));
|
|
});
|
|
} |