#!/usr/bin/env node /** * Report Generation Script * Creates detailed HTML/Markdown reports from simulation data */ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const args = process.argv.slice(2); const reportFile = args[0]; if (!reportFile) { console.error('Usage: node generate-report.js '); process.exit(1); } const report = JSON.parse(fs.readFileSync(reportFile, 'utf-8')); const markdown = generateMarkdownReport(report); const outputPath = reportFile.replace('.json', '.md'); fs.writeFileSync(outputPath, markdown); console.log(`✅ Report generated: ${outputPath}`); function generateMarkdownReport(report) { return `# Edge-Net Genesis Phase Simulation Report **Generated:** ${new Date().toISOString()} **Phase:** ${report.summary.finalPhase.toUpperCase()} ## Executive Summary This report presents the results of a comprehensive simulation of the Edge-Net distributed compute network, tracking its evolution from genesis to ${report.summary.finalPhase}. - **Total Nodes:** ${report.summary.totalNodes.toLocaleString()} - **Active Nodes:** ${report.summary.activeNodes.toLocaleString()} - **Total Compute:** ${Math.floor(report.summary.totalComputeHours).toLocaleString()} hours - **Simulation Duration:** ${(report.summary.simulationDuration / 1000).toFixed(2)}s - **Network Health:** ${(report.metrics.networkHealth * 100).toFixed(2)}% --- ## Network Metrics ### Task Processing | Metric | Value | |--------|-------| | Tasks Completed | ${report.metrics.totalTasksCompleted.toLocaleString()} | | Tasks Submitted | ${report.metrics.totalTasksSubmitted.toLocaleString()} | | Average Latency | ${Math.floor(report.metrics.averageLatency)}ms | | Success Rate | ${(report.metrics.averageSuccessRate * 100).toFixed(2)}% | ### Node Distribution | Type | Count | |------|-------| | Total Nodes | ${report.summary.totalNodes.toLocaleString()} | | Active Nodes | ${report.summary.activeNodes.toLocaleString()} | | Genesis Nodes | ${report.metrics.genesisNodeCount} | --- ## Economic Analysis ### Supply Distribution The total supply of **${report.economics.supply.total.toLocaleString()} rUv** is distributed as follows: | Pool | Amount (rUv) | Percentage | |------|--------------|------------| | Contributors | ${report.economics.supply.contributors.toLocaleString()} | ${((report.economics.supply.contributors / report.economics.supply.total) * 100).toFixed(2)}% | | Treasury | ${report.economics.supply.treasury.toLocaleString()} | ${((report.economics.supply.treasury / report.economics.supply.total) * 100).toFixed(2)}% | | Protocol Fund | ${report.economics.supply.protocol.toLocaleString()} | ${((report.economics.supply.protocol / report.economics.supply.total) * 100).toFixed(2)}% | | Founder Pool | ${report.economics.supply.founders.toLocaleString()} | ${((report.economics.supply.founders / report.economics.supply.total) * 100).toFixed(2)}% | ### Economic Health | Metric | Value | Status | |--------|-------|--------| | Velocity | ${report.economics.health.velocity.toFixed(4)} | ${report.economics.health.velocity > 0.3 ? '✅' : '⚠️'} | | Utilization | ${(report.economics.health.utilization * 100).toFixed(2)}% | ${report.economics.health.utilization > 0.5 ? '✅' : '⚠️'} | | Growth Rate | ${(report.economics.health.growthRate * 100).toFixed(2)}% | ${report.economics.health.growthRate > 0 ? '✅' : '⚠️'} | | Stability | ${(report.economics.health.stability * 100).toFixed(2)}% | ${report.economics.health.stability > 0.6 ? '✅' : '⚠️'} | | **Overall Health** | **${(report.economics.health.overall * 100).toFixed(2)}%** | ${report.economics.health.overall > 0.7 ? '✅ Healthy' : '⚠️ Attention Needed'} | --- ## Phase Transitions ${report.phases.transitions.map((t, i) => ` ### ${i + 1}. ${t.from.toUpperCase()} → ${t.to.toUpperCase()} - **Tick:** ${t.tick.toLocaleString()} - **Node Count:** ${t.nodeCount.toLocaleString()} - **Total Compute:** ${Math.floor(t.totalCompute).toLocaleString()} hours `).join('\n')} --- ## Genesis Node Performance ${report.nodes.genesis.slice(0, 10).map((node, i) => ` ### ${i + 1}. ${node.id} - **Status:** ${node.active ? '🟢 Active' : '🔴 Retired'} - **rUv Balance:** ${node.ruvBalance.toLocaleString()} - **rUv Earned:** ${node.ruvEarned.toLocaleString()} - **Tasks Completed:** ${node.tasksCompleted.toLocaleString()} - **Success Rate:** ${(node.successRate * 100).toFixed(2)}% - **Compute Hours:** ${Math.floor(node.totalComputeHours).toLocaleString()} - **Connections:** ${node.connections} `).join('\n')} --- ## Validation & Insights ### Genesis Phase (0 - 10K nodes) ✅ Network bootstrapped successfully ✅ Early adopter multiplier effective (10x) ✅ Initial task distribution functional ✅ Genesis nodes provided stable foundation ### Transition Phase (10K - 50K nodes) ✅ Genesis connection limiting implemented ✅ Network remained resilient ✅ Task routing optimization learned ✅ Economic sustainability threshold approached ### Maturity Phase (50K - 100K nodes) ${report.summary.totalNodes >= 50000 ? ` ✅ Genesis nodes in read-only mode ✅ Network self-sustaining ✅ Economic health maintained ` : '_Not yet reached_'} ### Post-Genesis Phase (100K+ nodes) ${report.summary.totalNodes >= 100000 ? ` ✅ Genesis nodes retired ✅ Network operates independently ✅ Long-term stability achieved ✅ Economic equilibrium established ` : '_Not yet reached_'} --- ## Recommendations 1. **Network Health:** ${report.metrics.networkHealth > 0.8 ? 'Excellent network health. Continue monitoring.' : 'Consider optimizing task distribution and connection patterns.'} 2. **Economic Balance:** ${report.economics.health.stability > 0.7 ? 'Economic pools are well-balanced.' : 'Rebalance economic distribution to improve stability.'} 3. **Genesis Sunset:** ${report.metrics.genesisNodeCount === 0 ? 'Genesis sunset completed successfully.' : `Monitor ${report.metrics.genesisNodeCount} remaining genesis nodes for graceful retirement.`} 4. **Scalability:** ${report.summary.totalNodes >= 100000 ? 'Network has achieved target scale.' : `Continue growth towards ${100000 - report.summary.totalNodes} additional nodes.`} --- ## Conclusion The simulation demonstrates ${report.summary.finalPhase === 'post-genesis' ? 'successful completion of the full lifecycle' : `progression through the ${report.summary.finalPhase} phase`} with ${report.metrics.networkHealth > 0.75 ? 'strong' : 'moderate'} network health metrics. Key achievements: - ✅ ${report.summary.totalNodes.toLocaleString()} nodes coordinated - ✅ ${report.metrics.totalTasksCompleted.toLocaleString()} tasks processed - ✅ ${report.economics.supply.total.toLocaleString()} rUv circulating - ✅ ${(report.metrics.averageSuccessRate * 100).toFixed(1)}% success rate maintained The network is ${report.economics.health.overall > 0.7 ? 'ready for production deployment' : 'progressing towards production readiness'}. --- *Generated by Edge-Net Genesis Phase Simulator* `; }