From c3b2846f877acc5bcd9e367e8faf19fdd2b8a77d Mon Sep 17 00:00:00 2001 From: Hyperkit Date: Tue, 18 Nov 2025 18:05:15 +0800 Subject: [PATCH 01/99] chore: remove development files for production release - Removed tests/ directory - Removed scripts/ directory - Removed docs/ directory - Removed GUIDE/ directory - Removed examples/ directory - Removed pytest.ini - Removed test documentation - Removed planning documents --- GUIDE/API.md | 299 -- GUIDE/COLLABORATOR_GUIDE.md | 501 --- GUIDE/DEPLOYMENT.md | 274 -- GUIDE/DEVELOPER_GUIDE.md | 354 -- GUIDE/DOCKER.md | 361 -- GUIDE/GETTING_STARTED.md | 714 ---- GUIDE/SUPABASE_CONNECTION_FIX.md | 133 - GUIDE/USER_GUIDE.md | 451 -- docs/ALIGNMENT_REPORT.md | 438 -- docs/ARCHITECTURE_DIAGRAMS.md | 458 --- docs/DEPLOYMENT.md | 274 -- docs/ENHANCEMENTS.md | 528 --- docs/HYPERION_PEF_GUIDE.md | 434 -- docs/IMPLEMENTATION_STATUS.md | 514 --- docs/INTEGRATION.md | 627 --- docs/KNOWN_ISSUES.md | 150 - docs/METISVM_OPTIMIZATION.md | 368 -- docs/NETWORK_COMPATIBILITY.md | 332 -- docs/PRODUCTION_READINESS.md | 231 -- docs/SECURITY_AUDIT.md | 535 --- docs/TESTING_SETUP_GUIDE.md | 952 ----- docs/TROUBLESHOOTING.md | 341 -- docs/complete-tech-spec.md | 3631 ----------------- docs/public/ascii-art-doh-HyperAgent.png | Bin 44200 -> 0 bytes examples/hyperion_workflow.json | 23 - examples/mantle_workflow.json | 24 - examples/report.md | 59 - pytest.ini | 58 - scripts/__init__.py | 2 - scripts/backup_database.py | 216 - scripts/check_workflow_status.py | 46 - scripts/completion/bash.sh | 80 - scripts/completion/fish.sh | 47 - scripts/completion/zsh.sh | 82 - scripts/deploy_production.py | 290 -- scripts/docker_build.sh | 31 - scripts/docker_run.sh | 36 - scripts/generate_workflow_report.py | 466 --- scripts/init_pgvector.sql | 18 - scripts/rollback.py | 249 -- scripts/seed_contract_templates.py | 150 - scripts/sync_main_branch.bat | 107 - scripts/sync_main_branch.sh | 110 - scripts/verify_setup.py | 189 - scripts/verify_wallet.py | 59 - scripts/version/COMMIT_GUIDE.md | 144 - scripts/version/parallel-commit.js | 250 -- scripts/version/parallel-commit.sh | 228 -- tests/README.md | 491 --- tests/__init__.py | 2 - tests/conftest.py | 94 - tests/integration/__init__.py | 2 - tests/integration/test_api.py | 126 - .../integration/test_api_endpoints_manual.py | 110 - .../test_batch_deployment_manual.py | 138 - tests/integration/test_database.py | 153 - tests/integration/test_eigenda_batch.py | 130 - tests/integration/test_end_to_end_workflow.py | 308 -- tests/integration/test_full_workflow.py | 288 -- .../integration/test_ipfs_template_import.py | 150 - .../integration/test_metisvm_optimization.py | 129 - .../test_metisvm_optimization_manual.py | 153 - tests/integration/test_network_fallbacks.py | 233 -- .../integration/test_pef_batch_deployment.py | 157 - .../test_production_workflow_manual.py | 196 - .../test_real_world_complete_manual.py | 356 -- .../test_real_world_deployment_manual.py | 228 -- tests/integration/test_redis.py | 115 - .../test_workflow_creation_manual.py | 216 - .../test_workflow_with_compilation.py | 171 - tests/load/load_test.py | 226 - tests/performance/__init__.py | 2 - tests/performance/test_pef_performance.py | 214 - tests/performance/test_performance_manual.py | 188 - tests/performance/test_sla_compliance.py | 161 - tests/unit/__init__.py | 2 - tests/unit/test_a2a_protocol.py | 98 - tests/unit/test_agents_audit.py | 120 - tests/unit/test_agents_coordinator.py | 104 - tests/unit/test_agents_generation.py | 119 - tests/unit/test_blockchain.py | 350 -- tests/unit/test_cli_watch_mode.py | 58 - tests/unit/test_compilation_service.py | 274 -- tests/unit/test_deployment_validation.py | 115 - tests/unit/test_eigenda_enhanced.py | 84 - tests/unit/test_event_bus.py | 54 - tests/unit/test_hyperion_pef.py | 116 - tests/unit/test_metisvm_optimizer.py | 83 - tests/unit/test_metrics.py | 38 - tests/unit/test_network_features.py | 136 - tests/unit/test_service_registry.py | 34 - tests/unit/test_services.py | 141 - tests/unit/test_template_retriever_async.py | 58 - tests/unit/test_test_framework_detection.py | 97 - tests/unit/test_user_creation.py | 99 - 95 files changed, 22781 deletions(-) delete mode 100644 GUIDE/API.md delete mode 100644 GUIDE/COLLABORATOR_GUIDE.md delete mode 100644 GUIDE/DEPLOYMENT.md delete mode 100644 GUIDE/DEVELOPER_GUIDE.md delete mode 100644 GUIDE/DOCKER.md delete mode 100644 GUIDE/GETTING_STARTED.md delete mode 100644 GUIDE/SUPABASE_CONNECTION_FIX.md delete mode 100644 GUIDE/USER_GUIDE.md delete mode 100644 docs/ALIGNMENT_REPORT.md delete mode 100644 docs/ARCHITECTURE_DIAGRAMS.md delete mode 100644 docs/DEPLOYMENT.md delete mode 100644 docs/ENHANCEMENTS.md delete mode 100644 docs/HYPERION_PEF_GUIDE.md delete mode 100644 docs/IMPLEMENTATION_STATUS.md delete mode 100644 docs/INTEGRATION.md delete mode 100644 docs/KNOWN_ISSUES.md delete mode 100644 docs/METISVM_OPTIMIZATION.md delete mode 100644 docs/NETWORK_COMPATIBILITY.md delete mode 100644 docs/PRODUCTION_READINESS.md delete mode 100644 docs/SECURITY_AUDIT.md delete mode 100644 docs/TESTING_SETUP_GUIDE.md delete mode 100644 docs/TROUBLESHOOTING.md delete mode 100644 docs/complete-tech-spec.md delete mode 100644 docs/public/ascii-art-doh-HyperAgent.png delete mode 100644 examples/hyperion_workflow.json delete mode 100644 examples/mantle_workflow.json delete mode 100644 examples/report.md delete mode 100644 pytest.ini delete mode 100644 scripts/__init__.py delete mode 100644 scripts/backup_database.py delete mode 100644 scripts/check_workflow_status.py delete mode 100644 scripts/completion/bash.sh delete mode 100644 scripts/completion/fish.sh delete mode 100644 scripts/completion/zsh.sh delete mode 100644 scripts/deploy_production.py delete mode 100644 scripts/docker_build.sh delete mode 100644 scripts/docker_run.sh delete mode 100644 scripts/generate_workflow_report.py delete mode 100644 scripts/init_pgvector.sql delete mode 100644 scripts/rollback.py delete mode 100644 scripts/seed_contract_templates.py delete mode 100644 scripts/sync_main_branch.bat delete mode 100644 scripts/sync_main_branch.sh delete mode 100644 scripts/verify_setup.py delete mode 100644 scripts/verify_wallet.py delete mode 100644 scripts/version/COMMIT_GUIDE.md delete mode 100644 scripts/version/parallel-commit.js delete mode 100644 scripts/version/parallel-commit.sh delete mode 100644 tests/README.md delete mode 100644 tests/__init__.py delete mode 100644 tests/conftest.py delete mode 100644 tests/integration/__init__.py delete mode 100644 tests/integration/test_api.py delete mode 100644 tests/integration/test_api_endpoints_manual.py delete mode 100644 tests/integration/test_batch_deployment_manual.py delete mode 100644 tests/integration/test_database.py delete mode 100644 tests/integration/test_eigenda_batch.py delete mode 100644 tests/integration/test_end_to_end_workflow.py delete mode 100644 tests/integration/test_full_workflow.py delete mode 100644 tests/integration/test_ipfs_template_import.py delete mode 100644 tests/integration/test_metisvm_optimization.py delete mode 100644 tests/integration/test_metisvm_optimization_manual.py delete mode 100644 tests/integration/test_network_fallbacks.py delete mode 100644 tests/integration/test_pef_batch_deployment.py delete mode 100644 tests/integration/test_production_workflow_manual.py delete mode 100644 tests/integration/test_real_world_complete_manual.py delete mode 100644 tests/integration/test_real_world_deployment_manual.py delete mode 100644 tests/integration/test_redis.py delete mode 100644 tests/integration/test_workflow_creation_manual.py delete mode 100644 tests/integration/test_workflow_with_compilation.py delete mode 100644 tests/load/load_test.py delete mode 100644 tests/performance/__init__.py delete mode 100644 tests/performance/test_pef_performance.py delete mode 100644 tests/performance/test_performance_manual.py delete mode 100644 tests/performance/test_sla_compliance.py delete mode 100644 tests/unit/__init__.py delete mode 100644 tests/unit/test_a2a_protocol.py delete mode 100644 tests/unit/test_agents_audit.py delete mode 100644 tests/unit/test_agents_coordinator.py delete mode 100644 tests/unit/test_agents_generation.py delete mode 100644 tests/unit/test_blockchain.py delete mode 100644 tests/unit/test_cli_watch_mode.py delete mode 100644 tests/unit/test_compilation_service.py delete mode 100644 tests/unit/test_deployment_validation.py delete mode 100644 tests/unit/test_eigenda_enhanced.py delete mode 100644 tests/unit/test_event_bus.py delete mode 100644 tests/unit/test_hyperion_pef.py delete mode 100644 tests/unit/test_metisvm_optimizer.py delete mode 100644 tests/unit/test_metrics.py delete mode 100644 tests/unit/test_network_features.py delete mode 100644 tests/unit/test_service_registry.py delete mode 100644 tests/unit/test_services.py delete mode 100644 tests/unit/test_template_retriever_async.py delete mode 100644 tests/unit/test_test_framework_detection.py delete mode 100644 tests/unit/test_user_creation.py diff --git a/GUIDE/API.md b/GUIDE/API.md deleted file mode 100644 index b7bb2bb..0000000 --- a/GUIDE/API.md +++ /dev/null @@ -1,299 +0,0 @@ -# HyperAgent API Documentation - -## Overview - -HyperAgent provides a RESTful API for AI-powered smart contract generation, auditing, testing, and deployment on Hyperion and Mantle testnets. - -**Base URL**: `https://api.hyperagent.dev/api/v1` - -**API Version**: 1.0.0 - -## Authentication - -HyperAgent uses JWT (JSON Web Tokens) for authentication. - -### Getting an Access Token - -```bash -POST /api/v1/auth/login -Content-Type: application/json - -{ - "email": "user@example.com", - "password": "your_password" -} -``` - -**Response**: -```json -{ - "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", - "token_type": "bearer", - "expires_in": 86400 -} -``` - -### Using the Token - -Include the token in the Authorization header: - -``` -Authorization: Bearer -``` - -## Endpoints - -### Health Check - -**GET** `/api/v1/health` - -Check API health status. - -**Response**: -```json -{ - "status": "healthy", - "app_name": "HyperAgent", - "version": "1.0.0" -} -``` - -### Workflows - -#### Create Workflow - -**POST** `/api/v1/workflows/generate` - -Create a new contract generation workflow. - -**Request Body**: -```json -{ - "nlp_input": "Create an ERC20 token with burn functionality", - "network": "hyperion_testnet", - "contract_type": "ERC20", - "name": "My Token Contract" -} -``` - -**Response**: -```json -{ - "workflow_id": "550e8400-e29b-41d4-a716-446655440000", - "status": "created", - "message": "Workflow created successfully", - "created_at": "2025-01-01T12:00:00Z" -} -``` - -#### Get Workflow Status - -**GET** `/api/v1/workflows/{workflow_id}` - -Get current status of a workflow. - -**Response**: -```json -{ - "workflow_id": "550e8400-e29b-41d4-a716-446655440000", - "status": "generating", - "progress_percentage": 25, - "network": "hyperion_testnet", - "created_at": "2025-01-01T12:00:00Z", - "updated_at": "2025-01-01T12:00:30Z" -} -``` - -#### Cancel Workflow - -**POST** `/api/v1/workflows/{workflow_id}/cancel` - -Cancel a running workflow. - -**Response**: -```json -{ - "message": "Workflow cancelled successfully" -} -``` - -### Contracts - -#### Generate Contract - -**POST** `/api/v1/contracts/generate` - -Generate a smart contract from natural language description. - -**Request Body**: -```json -{ - "nlp_description": "Create an ERC20 token with burn and mint functions", - "contract_type": "ERC20", - "network": "hyperion_testnet" -} -``` - -**Response**: -```json -{ - "contract_code": "pragma solidity ^0.8.27;\n...", - "contract_type": "ERC20", - "abi": {...}, - "constructor_args": [] -} -``` - -#### Audit Contract - -**POST** `/api/v1/contracts/audit` - -Run security audit on a contract. - -**Request Body**: -```json -{ - "contract_code": "pragma solidity ^0.8.27;\n...", - "audit_level": "standard" -} -``` - -**Response**: -```json -{ - "vulnerabilities": [], - "overall_risk_score": 15.0, - "audit_status": "passed", - "critical_count": 0, - "high_count": 0, - "medium_count": 1, - "low_count": 2 -} -``` - -### Deployments - -#### Deploy Contract - -**POST** `/api/v1/deployments/deploy` - -Deploy a compiled contract to the blockchain. - -**Request Body**: -```json -{ - "compiled_contract": { - "abi": [...], - "bytecode": "0x6080604052..." - }, - "network": "hyperion_testnet", - "private_key": "your_private_key", - "constructor_args": [] -} -``` - -**Response**: -```json -{ - "contract_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", - "transaction_hash": "0x1234...", - "block_number": 12345, - "gas_used": 1500000, - "eigenda_commitment": "0x..." -} -``` - -### Metrics - -#### Prometheus Metrics - -**GET** `/api/v1/metrics/prometheus` - -Get Prometheus-formatted metrics for monitoring. - -**Response**: Prometheus text format - -### WebSocket - -#### Workflow Updates - -**WebSocket** `/ws/workflow/{workflow_id}` - -Real-time updates for workflow progress. - -**Message Format**: -```json -{ - "type": "workflow.progressed", - "workflow_id": "550e8400-e29b-41d4-a716-446655440000", - "data": { - "progress_percentage": 50, - "current_stage": "auditing" - } -} -``` - -## Rate Limiting - -API requests are rate-limited to prevent abuse: - -- **Workflow Generation**: 10 requests per minute -- **Contract Generation**: 20 requests per minute -- **Contract Audit**: 30 requests per minute -- **Default**: 100 requests per minute - -Rate limit headers are included in responses: -- `X-RateLimit-Limit`: Maximum requests allowed -- `X-RateLimit-Remaining`: Remaining requests in window -- `X-RateLimit-Reset`: Unix timestamp when limit resets - -## Error Responses - -All errors follow this format: - -```json -{ - "detail": "Error message description" -} -``` - -**HTTP Status Codes**: -- `200`: Success -- `201`: Created -- `400`: Bad Request -- `401`: Unauthorized -- `403`: Forbidden -- `404`: Not Found -- `429`: Too Many Requests -- `500`: Internal Server Error - -## Examples - -### Complete Workflow Example - -```bash -# 1. Login -curl -X POST https://api.hyperagent.dev/api/v1/auth/login \ - -H "Content-Type: application/json" \ - -d '{"email": "user@example.com", "password": "password"}' - -# 2. Create Workflow -curl -X POST https://api.hyperagent.dev/api/v1/workflows/generate \ - -H "Authorization: Bearer " \ - -H "Content-Type: application/json" \ - -d '{ - "nlp_input": "Create ERC20 token", - "network": "hyperion_testnet" - }' - -# 3. Check Status -curl https://api.hyperagent.dev/api/v1/workflows/{workflow_id} \ - -H "Authorization: Bearer " -``` - -## Interactive Documentation - -- **Swagger UI**: `/api/v1/docs` -- **ReDoc**: `/api/v1/redoc` -- **OpenAPI JSON**: `/api/v1/openapi.json` - diff --git a/GUIDE/COLLABORATOR_GUIDE.md b/GUIDE/COLLABORATOR_GUIDE.md deleted file mode 100644 index cee9fa9..0000000 --- a/GUIDE/COLLABORATOR_GUIDE.md +++ /dev/null @@ -1,501 +0,0 @@ -# HyperAgent Collaborator Guide - -**Document Type**: How-To Guide (Goal-Oriented) -**Category**: Contributor Documentation -**Audience**: Contributors, Collaborators -**Location**: `GUIDE/COLLABORATOR_GUIDE.md` - -This guide helps contributors understand how to contribute code, documentation, and improvements to HyperAgent. Follow this guide to ensure your contributions align with project standards and are accepted. - -## Table of Contents - -- [Getting Started as a Contributor](#getting-started-as-a-contributor) -- [Setting Up Development Environment](#setting-up-development-environment) -- [Making Code Changes](#making-code-changes) -- [Writing Tests](#writing-tests) -- [Submitting Changes](#submitting-changes) -- [Code Review Process](#code-review-process) -- [Documentation Contributions](#documentation-contributions) - ---- - -## Getting Started as a Contributor - -**Goal**: Understand the contribution process and get started. - -### Prerequisites - -- GitHub account -- Git installed -- Python 3.10+ installed -- Basic understanding of Python, async/await, and blockchain concepts - -### Steps - -1. **Fork the repository**: - - Visit https://github.com/JustineDevs/HyperAgent - - Click "Fork" button - - Clone your fork locally: - ```bash - git clone https://github.com/YOUR_USERNAME/HyperAgent.git - cd HyperAgent - ``` - -2. **Add upstream remote**: - ```bash - git remote add upstream https://github.com/JustineDevs/HyperAgent.git - ``` - -3. **Read the Code of Conduct**: - - See [CODE_OF_CONDUCT.md](../CODE_OF_CONDUCT.md) - - Ensure you understand and agree to follow it - -4. **Read Contributing Guidelines**: - - See [CONTRIBUTING.md](../CONTRIBUTING.md) - - Review development workflow and standards - -### Expected Result - -- Repository forked and cloned -- Upstream remote configured -- Understanding of contribution process - ---- - -## Setting Up Development Environment - -**Goal**: Set up a complete development environment for contributing. - -### Prerequisites - -- Forked repository cloned locally -- Python 3.10+ installed -- PostgreSQL 15+ (or Supabase account) -- Redis 7+ (or Docker) - -### Steps - -1. **Create virtual environment**: - ```bash - python -m venv venv - source venv/bin/activate # Windows: venv\Scripts\activate - ``` - -2. **Install dependencies**: - ```bash - pip install -r requirements.txt - pip install -r requirements-dev.txt # Development dependencies - ``` - -3. **Set up pre-commit hooks**: - ```bash - pre-commit install - ``` - -4. **Configure environment**: - ```bash - cp env.example .env - # Edit .env with your configuration - ``` - -5. **Set up database**: - ```bash - # Create database and enable pgvector - createdb hyperagent_dev - psql hyperagent_dev -c "CREATE EXTENSION vector;" - - # Run migrations - alembic upgrade head - ``` - -6. **Run tests to verify setup**: - ```bash - pytest tests/unit/ -v - ``` - -### Expected Result - -- Development environment fully configured -- All tests passing -- Ready to make code changes - ---- - -## Making Code Changes - -**Goal**: Implement changes following project standards. - -### Prerequisites - -- Development environment set up -- Understanding of the codebase structure -- Clear understanding of what you want to change - -### Steps - -1. **Create a feature branch**: - ```bash - git checkout -b feature/your-feature-name - # Or for bug fixes: - git checkout -b fix/your-bug-fix-name - ``` - -2. **Follow the development workflow**: - - See [Developer Guide](./DEVELOPER_GUIDE.md) for architecture details - - See [Development Workflow](../.cursor/rules/dev-workflow.mdc) for detailed process - -3. **Write code following standards**: - - Use Black for formatting: `black hyperagent/` - - Use isort for imports: `isort hyperagent/` - - Follow PEP 8 style guide - - Add type hints to all functions - - Write docstrings for public APIs - -4. **Test your changes**: - ```bash - # Run unit tests - pytest tests/unit/ -v - - # Run integration tests - pytest tests/integration/ -v - - # Run with coverage - pytest --cov=hyperagent --cov-report=html - ``` - -5. **Update documentation**: - - Update relevant documentation files - - Add docstrings to new functions/classes - - Update API documentation if endpoints changed - -### Code Style Guidelines - -**Formatting**: -```bash -# Auto-format code -black hyperagent/ -isort hyperagent/ - -# Check formatting -black --check hyperagent/ -isort --check hyperagent/ -``` - -**Type Hints**: -```python -from typing import Dict, Any, Optional - -async def process( - input_data: Dict[str, Any], - network: Optional[str] = None -) -> Dict[str, Any]: - """Process input and return result.""" - pass -``` - -**Docstrings**: -```python -def generate_contract( - nlp_input: str, - network: str -) -> Dict[str, Any]: - """ - Generate a smart contract from natural language input. - - Args: - nlp_input: Natural language description of contract - network: Target blockchain network - - Returns: - Dictionary containing generated contract code and metadata - - Raises: - ValueError: If input is invalid or network not supported - """ - pass -``` - -### Expected Result - -- Code changes implemented -- Code follows project standards -- Tests written and passing -- Documentation updated - ---- - -## Writing Tests - -**Goal**: Write comprehensive tests for your changes. - -### Prerequisites - -- Understanding of pytest and async testing -- Knowledge of what functionality needs testing - -### Steps - -1. **Write unit tests** (in `tests/unit/`): - ```python - import pytest - from unittest.mock import AsyncMock, MagicMock - from hyperagent.agents.generation import GenerationAgent - - @pytest.mark.asyncio - async def test_generation_agent_process(): - # Setup - mock_llm = AsyncMock() - mock_llm.generate.return_value = "pragma solidity ^0.8.0; contract Test {}" - agent = GenerationAgent(mock_llm) - - # Execute - result = await agent.process({ - "nlp_description": "Create simple contract", - "network": "hyperion_testnet" - }) - - # Verify - assert result["status"] == "success" - assert "contract_code" in result - ``` - -2. **Write integration tests** (in `tests/integration/`): - ```python - @pytest.mark.asyncio - async def test_workflow_end_to_end(): - # Test complete workflow pipeline - coordinator = WorkflowCoordinator(...) - result = await coordinator.execute_workflow(...) - assert result["status"] == "success" - ``` - -3. **Run tests**: - ```bash - # All tests - pytest - - # Specific test file - pytest tests/unit/test_generation_agent.py -v - - # With coverage - pytest --cov=hyperagent --cov-report=html - ``` - -### Test Requirements - -- **Unit tests**: Test individual functions/classes in isolation -- **Integration tests**: Test component interactions -- **Coverage**: Aim for 80%+ coverage for new code -- **Mocking**: Mock external dependencies (LLM, blockchain, database) - -### Expected Result - -- Tests written and passing -- Good test coverage -- Tests are maintainable and well-documented - ---- - -## Submitting Changes - -**Goal**: Submit your changes for review via pull request. - -### Prerequisites - -- Code changes complete -- Tests written and passing -- Documentation updated -- Code follows project standards - -### Steps - -1. **Commit your changes**: - ```bash - # Stage changes - git add . - - # Commit with conventional commit message - git commit -m "feat: Add new feature for X" - # Or: - git commit -m "fix: Resolve bug in Y" - # Or: - git commit -m "docs: Update user guide" - ``` - -2. **Push to your fork**: - ```bash - git push origin feature/your-feature-name - ``` - -3. **Create pull request**: - - Go to https://github.com/JustineDevs/HyperAgent - - Click "New Pull Request" - - Select your branch - - Fill out PR template: - - Description of changes - - Related issues - - Testing performed - - Screenshots (if UI changes) - -4. **Wait for review**: - - Maintainers will review your PR - - Address any feedback - - Update PR as needed - -### Commit Message Format - -Follow [Conventional Commits](https://www.conventionalcommits.org/): - -``` -(): - - - -