refactor: reorganize imports to use bounded context structure
Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Documentation Validation / validate-docs (push) Failing after 13s
Documentation Validation / validate-policies-strict (push) Successful in 11s
Integration Tests / test-service-integration (push) Failing after 55s
Python Tests / test-python (push) Failing after 38s
Security Scanning / security-scan (push) Successful in 3m2s
Systemd Sync / sync-systemd (push) Successful in 32s
Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Documentation Validation / validate-docs (push) Failing after 13s
Documentation Validation / validate-policies-strict (push) Successful in 11s
Integration Tests / test-service-integration (push) Failing after 55s
Python Tests / test-python (push) Failing after 38s
Security Scanning / security-scan (push) Successful in 3m2s
Systemd Sync / sync-systemd (push) Successful in 32s
- Updated import paths across agent_identity modules to use contexts.agent_identity.domain - Updated import paths in routers to use context-based service locations - Fixed database configuration fields in config.py (db_echo, db_pool_size, db_max_overflow, db_pool_recycle, db_pool_pre_ping) - Changed IdentityVerification table name from IDENTITY_VERIFICATION_TABLE constant to hardcoded "identity_verifications" - Added BlockchainService
This commit is contained in:
@@ -15,7 +15,7 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from ..domain.agent_identity import (
|
||||
from ..contexts.agent_identity.domain.agent_identity import (
|
||||
AgentIdentity,
|
||||
AgentIdentityCreate,
|
||||
AgentIdentityUpdate,
|
||||
|
||||
@@ -13,7 +13,7 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session
|
||||
|
||||
from ..domain.agent_identity import (
|
||||
from ..contexts.agent_identity.domain.agent_identity import (
|
||||
AgentIdentityCreate,
|
||||
AgentIdentityUpdate,
|
||||
AgentWalletUpdate,
|
||||
|
||||
@@ -15,7 +15,7 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from ..domain.agent_identity import (
|
||||
from ..contexts.agent_identity.domain.agent_identity import (
|
||||
AgentIdentity,
|
||||
ChainType,
|
||||
CrossChainMapping,
|
||||
|
||||
@@ -14,7 +14,7 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from ..domain.agent_identity import AgentWallet, AgentWalletUpdate, ChainType
|
||||
from ..contexts.agent_identity.domain.agent_identity import AgentWallet, AgentWalletUpdate, ChainType
|
||||
|
||||
|
||||
class WalletAdapter(ABC):
|
||||
|
||||
@@ -16,7 +16,7 @@ from aitbc import get_logger, derive_ethereum_address, sign_transaction_hash, ve
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
from ..domain.agent_identity import ChainType
|
||||
from ..contexts.agent_identity.domain.agent_identity import ChainType
|
||||
|
||||
|
||||
class WalletStatus(StrEnum):
|
||||
|
||||
@@ -56,6 +56,11 @@ class Settings(BaseAITBCConfig):
|
||||
|
||||
# Database
|
||||
database: DatabaseConfig = Field(default_factory=DatabaseConfig, description="Database configuration")
|
||||
db_echo: bool = Field(default=False, description="Enable SQLAlchemy query echo")
|
||||
db_pool_pre_ping: bool = Field(default=True, description="Enable connection pool pre-ping")
|
||||
db_pool_size: int = Field(default=10, description="Database connection pool size")
|
||||
db_max_overflow: int = Field(default=20, description="Database connection pool max overflow")
|
||||
db_pool_recycle: int = Field(default=3600, description="Database connection pool recycle time in seconds")
|
||||
|
||||
# API Keys
|
||||
client_api_keys: list[str] = []
|
||||
|
||||
@@ -16,7 +16,7 @@ from sqlalchemy.orm import Session
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
|
||||
from aitbc import get_logger
|
||||
from ....services.ai_analytics.adaptive_learning import AdaptiveLearningService
|
||||
from ...ai_analytics.services.ai_analytics.adaptive_learning import AdaptiveLearningService
|
||||
from ....storage import get_session
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
@@ -18,7 +18,7 @@ logger = get_logger(__name__)
|
||||
|
||||
from ....domain.agent_performance import CreativeCapability
|
||||
from sqlmodel import select
|
||||
from ....services.creative_capabilities_service import (
|
||||
from ..services.creative_capabilities_service import (
|
||||
CreativityEnhancementEngine,
|
||||
CrossDomainCreativeIntegrator,
|
||||
IdeationAlgorithm,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Annotated
|
||||
from typing import Annotated, Any
|
||||
|
||||
"""
|
||||
Agent Integration and Deployment API Router for Verifiable AI Agent Orchestration
|
||||
|
||||
@@ -10,9 +10,10 @@ Provides REST API endpoints for agent workflow management and execution
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Request
|
||||
|
||||
from aitbc import get_logger
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
Stub service for creative capabilities
|
||||
Placeholder for future implementation
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
class CreativityEnhancementEngine:
|
||||
"""Stub class for CreativityEnhancementEngine"""
|
||||
pass
|
||||
|
||||
|
||||
class CrossDomainCreativeIntegrator:
|
||||
"""Stub class for CrossDomainCreativeIntegrator"""
|
||||
pass
|
||||
|
||||
|
||||
class IdeationAlgorithm:
|
||||
"""Stub class for IdeationAlgorithm"""
|
||||
pass
|
||||
@@ -136,7 +136,7 @@ class CrossChainMapping(SQLModel, table=True):
|
||||
class IdentityVerification(SQLModel, table=True):
|
||||
"""Verification records for cross-chain identities"""
|
||||
|
||||
__tablename__ = IDENTITY_VERIFICATION_TABLE
|
||||
__tablename__ = "identity_verifications"
|
||||
__table_args__ = {"extend_existing": True}
|
||||
|
||||
id: str = Field(default_factory=lambda: f"verify_{uuid4().hex[:8]}", primary_key=True)
|
||||
|
||||
@@ -11,7 +11,7 @@ from fastapi.responses import JSONResponse
|
||||
from sqlmodel import Session
|
||||
|
||||
from ....agent_identity.manager import AgentIdentityManager
|
||||
from ....domain.agent_identity import (
|
||||
from ..domain.agent_identity import (
|
||||
CrossChainMappingResponse,
|
||||
IdentityStatus,
|
||||
VerificationType,
|
||||
|
||||
@@ -17,7 +17,7 @@ from typing import Any
|
||||
|
||||
import numpy as np
|
||||
|
||||
from ...storage import get_session
|
||||
from app.storage import get_session
|
||||
|
||||
|
||||
class LearningAlgorithm(StrEnum):
|
||||
|
||||
@@ -13,7 +13,7 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, and_, select
|
||||
|
||||
from ...domain.analytics import (
|
||||
from app.domain.analytics import (
|
||||
AnalyticsAlert,
|
||||
AnalyticsPeriod,
|
||||
DashboardConfig,
|
||||
|
||||
@@ -28,7 +28,7 @@ from ....domain.analytics import (
|
||||
MetricType,
|
||||
ReportType,
|
||||
)
|
||||
from ....services.ai_analytics.analytics import MarketplaceAnalytics
|
||||
from ....services.agent_coordination.marketplace import MarketplaceAnalytics
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter(prefix="/v1/analytics", tags=["analytics"])
|
||||
|
||||
@@ -16,6 +16,13 @@ BLOCKCHAIN_RPC = "http://127.0.0.1:9080/rpc"
|
||||
ADDRESS_PATTERN = re.compile(r'^[a-zA-Z0-9]{20,50}$')
|
||||
|
||||
|
||||
class BlockchainService:
|
||||
"""Stub blockchain service for staking router compatibility"""
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def validate_address(address: str) -> bool:
|
||||
"""Validate that address is safe to use in URL construction"""
|
||||
if not address:
|
||||
|
||||
@@ -8,13 +8,13 @@ REST API for AI agent bounty system with ZK-proof verification
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Request
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Query, Request
|
||||
from pydantic import BaseModel, Field, validator
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from aitbc import get_logger
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
from ....auth import get_current_user
|
||||
from ....routers.users import get_current_user
|
||||
from ....domain.bounty import (
|
||||
Bounty,
|
||||
BountyIntegration,
|
||||
@@ -24,7 +24,7 @@ from ....domain.bounty import (
|
||||
BountyTier,
|
||||
SubmissionStatus,
|
||||
)
|
||||
from ....services.blockchain_service import BlockchainService
|
||||
from ...blockchain.services.blockchain import BlockchainService
|
||||
from ....services.bounty_service import BountyService
|
||||
from ....storage import get_session
|
||||
|
||||
@@ -148,8 +148,8 @@ class BountyFilterRequest(BaseModel):
|
||||
deadline_after: Optional[datetime] = None
|
||||
tags: Optional[List[str]] = None
|
||||
requires_zk_proof: Optional[bool] = None
|
||||
page: int = Field(default=1, ge=1)
|
||||
limit: int = Field(default=20, ge=1, le=100)
|
||||
page: int = Query(default=1, ge=1)
|
||||
limit: int = Query(default=20, ge=1, le=100)
|
||||
|
||||
class BountyStatsResponse(BaseModel):
|
||||
total_bounties: int
|
||||
@@ -433,8 +433,8 @@ async def dispute_bounty_submission(
|
||||
async def get_my_created_bounties(
|
||||
request: Request,
|
||||
status: Optional[BountyStatus] = None,
|
||||
page: int = Field(default=1, ge=1),
|
||||
limit: int = Field(default=20, ge=1, le=100),
|
||||
page: int = Query(default=1, ge=1),
|
||||
limit: int = Query(default=20, ge=1, le=100),
|
||||
session: Session = Depends(get_session),
|
||||
bounty_service: BountyService = Depends(get_bounty_service),
|
||||
current_user: dict = Depends(get_current_user)
|
||||
@@ -459,8 +459,8 @@ async def get_my_created_bounties(
|
||||
async def get_my_submissions(
|
||||
request: Request,
|
||||
status: Optional[SubmissionStatus] = None,
|
||||
page: int = Field(default=1, ge=1),
|
||||
limit: int = Field(default=20, ge=1, le=100),
|
||||
page: int = Query(default=1, ge=1),
|
||||
limit: int = Query(default=20, ge=1, le=100),
|
||||
session: Session = Depends(get_session),
|
||||
bounty_service: BountyService = Depends(get_bounty_service),
|
||||
current_user: dict = Depends(get_current_user)
|
||||
@@ -484,8 +484,8 @@ async def get_my_submissions(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_bounty_leaderboard(
|
||||
request: Request,
|
||||
period: str = Field(default="weekly", regex="^(daily|weekly|monthly)$"),
|
||||
limit: int = Field(default=50, ge=1, le=100),
|
||||
period: str = Query(default="weekly", pattern="^(daily|weekly|monthly)$"),
|
||||
limit: int = Query(default=50, ge=1, le=100),
|
||||
session: Session = Depends(get_session),
|
||||
bounty_service: BountyService = Depends(get_bounty_service)
|
||||
) -> Dict[str, Any]:
|
||||
@@ -506,7 +506,7 @@ async def get_bounty_leaderboard(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_bounty_stats(
|
||||
request: Request,
|
||||
period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
bounty_service: BountyService = Depends(get_bounty_service)
|
||||
) -> BountyStatsResponse:
|
||||
@@ -583,7 +583,7 @@ async def get_bounty_categories(
|
||||
@rate_limit(rate=500, per=60)
|
||||
async def get_bounty_tags(
|
||||
request: Request,
|
||||
limit: int = Field(default=100, ge=1, le=500),
|
||||
limit: int = Query(default=100, ge=1, le=500),
|
||||
session: Session = Depends(get_session),
|
||||
bounty_service: BountyService = Depends(get_bounty_service)
|
||||
) -> Dict[str, Any]:
|
||||
@@ -600,9 +600,9 @@ async def get_bounty_tags(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def search_bounties(
|
||||
request: Request,
|
||||
query: str = Field(..., min_length=1, max_length=100),
|
||||
page: int = Field(default=1, ge=1),
|
||||
limit: int = Field(default=20, ge=1, le=100),
|
||||
query: str = Query(..., min_length=1, max_length=100),
|
||||
page: int = Query(default=1, ge=1),
|
||||
limit: int = Query(default=20, ge=1, le=100),
|
||||
session: Session = Depends(get_session),
|
||||
bounty_service: BountyService = Depends(get_bounty_service)
|
||||
) -> List[BountyResponse]:
|
||||
|
||||
@@ -32,7 +32,7 @@ from ....domain.certification import (
|
||||
VerificationRecord,
|
||||
VerificationType,
|
||||
)
|
||||
from ....services.certification import (
|
||||
from ..services.certification import (
|
||||
BadgeSystem,
|
||||
CertificationAndPartnershipService,
|
||||
CertificationSystem,
|
||||
|
||||
@@ -12,8 +12,8 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, and_, select
|
||||
|
||||
from ...domain.certification import AchievementBadge, AgentBadge, BadgeType
|
||||
from ...domain.reputation import AgentReputation
|
||||
from app.domain.certification import AchievementBadge, AgentBadge, BadgeType
|
||||
from app.domain.reputation import AgentReputation
|
||||
|
||||
|
||||
class BadgeSystem:
|
||||
|
||||
@@ -14,13 +14,13 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, and_, select
|
||||
|
||||
from ...domain.certification import (
|
||||
from app.domain.certification import (
|
||||
AgentCertification,
|
||||
CertificationLevel,
|
||||
CertificationStatus,
|
||||
VerificationType,
|
||||
)
|
||||
from ...domain.reputation import AgentReputation
|
||||
from app.domain.reputation import AgentReputation
|
||||
|
||||
|
||||
class CertificationSystem:
|
||||
|
||||
@@ -12,12 +12,12 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, and_, select
|
||||
|
||||
from ...domain.certification import (
|
||||
from app.domain.certification import (
|
||||
AgentPartnership,
|
||||
PartnershipProgram,
|
||||
PartnershipType,
|
||||
)
|
||||
from ...domain.reputation import AgentReputation
|
||||
from app.domain.reputation import AgentReputation
|
||||
|
||||
|
||||
class PartnershipManager:
|
||||
|
||||
@@ -7,7 +7,7 @@ from typing import Any
|
||||
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from ...domain.certification import (
|
||||
from app.domain.certification import (
|
||||
AgentBadge,
|
||||
AgentCertification,
|
||||
AgentPartnership,
|
||||
|
||||
@@ -137,9 +137,9 @@ async def publish_solution(request: SolutionPublishRequest, request_http: Reques
|
||||
@rate_limit(rate=100, per=60)
|
||||
async def list_solutions(
|
||||
request: Request,
|
||||
session: Annotated[Session, Depends(get_session)],
|
||||
category: str | None = None,
|
||||
limit: int = 50,
|
||||
session: Annotated[Session, Depends(get_session)] = Depends(get_session),
|
||||
) -> list[AgentSolution]:
|
||||
"""List available third-party agent solutions"""
|
||||
service = ThirdPartySolutionService(session)
|
||||
@@ -167,9 +167,9 @@ async def purchase_solution(
|
||||
@rate_limit(rate=10, per=60)
|
||||
async def propose_innovation_lab(
|
||||
request_http: Request,
|
||||
session: Annotated[Session, Depends(get_session)],
|
||||
researcher_id: str = Query(...),
|
||||
request: LabProposalRequest = Body(...),
|
||||
session: Annotated[Session, Depends(get_session)] = Depends(get_session),
|
||||
) -> InnovationLab:
|
||||
"""Propose a new agent innovation lab or research program"""
|
||||
service = InnovationLabService(session)
|
||||
@@ -213,9 +213,9 @@ async def fund_innovation_lab(
|
||||
@rate_limit(rate=20, per=60)
|
||||
async def create_community_post(
|
||||
request_http: Request,
|
||||
session: Annotated[Session, Depends(get_session)],
|
||||
author_id: str = Query(...),
|
||||
request: PostCreateRequest = Body(...),
|
||||
session: Annotated[Session, Depends(get_session)] = Depends(get_session),
|
||||
) -> CommunityPost:
|
||||
"""Create a new post in the community forum"""
|
||||
service = CommunityPlatformService(session)
|
||||
@@ -230,9 +230,9 @@ async def create_community_post(
|
||||
@rate_limit(rate=100, per=60)
|
||||
async def get_community_feed(
|
||||
request: Request,
|
||||
session: Annotated[Session, Depends(get_session)],
|
||||
category: str | None = None,
|
||||
limit: int = 20,
|
||||
session: Annotated[Session, Depends(get_session)] = Depends(get_session),
|
||||
) -> list[CommunityPost]:
|
||||
"""Get the latest community posts and discussions"""
|
||||
service = CommunityPlatformService(session)
|
||||
@@ -256,9 +256,9 @@ async def upvote_community_post(post_id: str, request: Request, session: Annotat
|
||||
@rate_limit(rate=10, per=60)
|
||||
async def create_hackathon(
|
||||
request_http: Request,
|
||||
session: Annotated[Session, Depends(get_session)],
|
||||
organizer_id: str = Query(...),
|
||||
request: HackathonCreateRequest = Body(...),
|
||||
session: Annotated[Session, Depends(get_session)] = Depends(get_session),
|
||||
) -> Hackathon:
|
||||
"""Create a new agent innovation hackathon (requires high reputation)"""
|
||||
service = CommunityPlatformService(session)
|
||||
|
||||
@@ -25,9 +25,9 @@ from ....schemas import (
|
||||
KeyRegistrationRequest,
|
||||
KeyRegistrationResponse,
|
||||
)
|
||||
from ....services.access_control import AccessController
|
||||
from ....services.encryption import EncryptedData, EncryptionService
|
||||
from ....services.key_management import KeyManagementError, KeyManager
|
||||
from ...security.services.access_control import AccessController
|
||||
from ...security.services.encryption import EncryptedData, EncryptionService
|
||||
from ...security.services.key_management import KeyManagementError, KeyManager
|
||||
|
||||
# Initialize router and security
|
||||
router = APIRouter(prefix="/confidential", tags=["confidential"])
|
||||
@@ -44,7 +44,7 @@ def get_encryption_service() -> EncryptionService:
|
||||
global encryption_service
|
||||
if encryption_service is None:
|
||||
# Initialize with key manager
|
||||
from ..services.key_management import FileKeyStorage
|
||||
from ....contexts.security.services.key_management import FileKeyStorage
|
||||
import tempfile
|
||||
|
||||
key_storage = FileKeyStorage(tempfile.gettempdir() + "/aitbc_keys")
|
||||
@@ -57,7 +57,7 @@ def get_key_manager() -> KeyManager:
|
||||
"""Get key manager instance"""
|
||||
global key_manager
|
||||
if key_manager is None:
|
||||
from ..services.key_management import FileKeyStorage
|
||||
from ....contexts.security.services.key_management import FileKeyStorage
|
||||
import tempfile
|
||||
|
||||
key_storage = FileKeyStorage(tempfile.gettempdir() + "/aitbc_keys")
|
||||
@@ -69,7 +69,7 @@ def get_access_controller() -> AccessController:
|
||||
"""Get access controller instance"""
|
||||
global access_controller
|
||||
if access_controller is None:
|
||||
from ..services.access_control import PolicyStore
|
||||
from ....contexts.security.services.access_control import PolicyStore
|
||||
|
||||
policy_store = PolicyStore()
|
||||
access_controller = AccessController(policy_store)
|
||||
|
||||
@@ -25,7 +25,7 @@ from ..services.cross_chain.bridge_enhanced import (
|
||||
BridgeSecurityLevel,
|
||||
CrossChainBridgeService,
|
||||
)
|
||||
from ..services.multi_chain_transaction_manager import (
|
||||
from ....services.multi_chain_transaction_manager import (
|
||||
MultiChainTransactionManager,
|
||||
RoutingStrategy,
|
||||
TransactionPriority,
|
||||
|
||||
@@ -18,16 +18,16 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, func, select, update
|
||||
|
||||
from ..agent_identity.wallet_adapter_enhanced import (
|
||||
from .....agent_identity.wallet_adapter_enhanced import (
|
||||
EnhancedWalletAdapter,
|
||||
SecurityLevel,
|
||||
WalletAdapterFactory,
|
||||
)
|
||||
from ..domain.cross_chain_bridge import (
|
||||
from .....domain.cross_chain_bridge import (
|
||||
BridgeRequest,
|
||||
BridgeRequestStatus,
|
||||
)
|
||||
from ..reputation.engine import CrossChainReputationEngine
|
||||
from .....reputation.engine import CrossChainReputationEngine
|
||||
|
||||
|
||||
class BridgeProtocol(StrEnum):
|
||||
|
||||
@@ -20,7 +20,7 @@ from ....domain.developer_platform import (
|
||||
)
|
||||
from ....schemas.developer_platform import BountyCreate, BountySubmissionCreate, CertificationGrant, DeveloperCreate
|
||||
from ....services.developer_platform_service import DeveloperPlatformService
|
||||
from ....services.governance_service import GovernanceService
|
||||
from ...governance.services.governance_service import GovernanceService
|
||||
from ....storage.db import get_session
|
||||
|
||||
router = APIRouter(prefix="/developer-platform", tags=["Developer Platform"])
|
||||
|
||||
@@ -8,13 +8,13 @@ REST API for developer ecosystem metrics and analytics
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request
|
||||
from pydantic import BaseModel, Field
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from aitbc import get_logger
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
from ....auth import get_current_user
|
||||
from ....routers.users import get_current_user
|
||||
from ....domain.bounty import AgentMetrics, BountyStats, EcosystemMetrics
|
||||
from ....services.ecosystem_service import EcosystemService
|
||||
from ....storage import get_session
|
||||
@@ -78,7 +78,7 @@ class EcosystemOverviewResponse(BaseModel):
|
||||
growth_indicators: Dict[str, float]
|
||||
|
||||
class MetricsFilterRequest(BaseModel):
|
||||
period_type: str = Field(default="daily", regex="^(hourly|daily|weekly|monthly)$")
|
||||
period_type: str = Field(default="daily", pattern="^(hourly|daily|weekly|monthly)$")
|
||||
start_date: Optional[datetime] = None
|
||||
end_date: Optional[datetime] = None
|
||||
compare_period: Optional[str] = None
|
||||
@@ -92,7 +92,7 @@ def get_ecosystem_service(session: Session = Depends(get_session)) -> EcosystemS
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_developer_earnings(
|
||||
request: Request,
|
||||
period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service),
|
||||
current_user: dict = Depends(get_current_user)
|
||||
@@ -114,7 +114,7 @@ async def get_developer_earnings(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_agent_utilization(
|
||||
request: Request,
|
||||
period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> AgentUtilizationResponse:
|
||||
@@ -135,7 +135,7 @@ async def get_agent_utilization(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_treasury_allocation(
|
||||
request: Request,
|
||||
period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> TreasuryAllocationResponse:
|
||||
@@ -156,7 +156,7 @@ async def get_treasury_allocation(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_staking_metrics(
|
||||
request: Request,
|
||||
period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> StakingMetricsResponse:
|
||||
@@ -177,7 +177,7 @@ async def get_staking_metrics(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_bounty_analytics(
|
||||
request: Request,
|
||||
period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> BountyAnalyticsResponse:
|
||||
@@ -198,7 +198,7 @@ async def get_bounty_analytics(
|
||||
@rate_limit(rate=100, per=60)
|
||||
async def get_ecosystem_overview(
|
||||
request: Request,
|
||||
period_type: str = Field(default="daily", regex="^(hourly|daily|weekly|monthly)$"),
|
||||
period_type: str = Query(default="daily", pattern="^(hourly|daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> EcosystemOverviewResponse:
|
||||
@@ -226,10 +226,10 @@ async def get_ecosystem_overview(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_ecosystem_metrics(
|
||||
request: Request,
|
||||
period_type: str = Field(default="daily", regex="^(hourly|daily|weekly|monthly)$"),
|
||||
period_type: str = Query(default="daily", pattern="^(hourly|daily|weekly|monthly)$"),
|
||||
start_date: Optional[datetime] = None,
|
||||
end_date: Optional[datetime] = None,
|
||||
limit: int = Field(default=100, ge=1, le=1000),
|
||||
limit: int = Query(default=100, ge=1, le=1000),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> Dict[str, Any]:
|
||||
@@ -276,7 +276,7 @@ async def get_ecosystem_health_score(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_growth_indicators(
|
||||
request: Request,
|
||||
period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> Dict[str, Any]:
|
||||
@@ -299,9 +299,9 @@ async def get_growth_indicators(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_top_performers(
|
||||
request: Request,
|
||||
category: str = Field(default="all", regex="^(developers|agents|stakers|all)$"),
|
||||
period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
limit: int = Field(default=50, ge=1, le=100),
|
||||
category: str = Query(default="all", pattern="^(developers|agents|stakers|all)$"),
|
||||
period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
limit: int = Query(default=50, ge=1, le=100),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> Dict[str, Any]:
|
||||
@@ -328,8 +328,8 @@ async def get_top_performers(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_ecosystem_predictions(
|
||||
request: Request,
|
||||
metric: str = Field(default="all", regex="^(earnings|staking|bounties|agents|all)$"),
|
||||
horizon: int = Field(default=30, ge=1, le=365), # days
|
||||
metric: str = Query(default="all", pattern="^(earnings|staking|bounties|agents|all)$"),
|
||||
horizon: int = Query(default=30, ge=1, le=365), # days
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> Dict[str, Any]:
|
||||
@@ -356,7 +356,7 @@ async def get_ecosystem_predictions(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_ecosystem_alerts(
|
||||
request: Request,
|
||||
severity: str = Field(default="all", regex="^(low|medium|high|critical|all)$"),
|
||||
severity: str = Query(default="all", pattern="^(low|medium|high|critical|all)$"),
|
||||
session: Session = Depends(get_session),
|
||||
ecosystem_service: EcosystemService = Depends(get_ecosystem_service)
|
||||
) -> Dict[str, Any]:
|
||||
@@ -379,8 +379,8 @@ async def get_ecosystem_alerts(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_ecosystem_comparison(
|
||||
request: Request,
|
||||
current_period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
compare_period: str = Field(default="previous", regex="^(previous|same_last_year|custom)$"),
|
||||
current_period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
compare_period: str = Query(default="previous", pattern="^(previous|same_last_year|custom)$"),
|
||||
custom_start_date: Optional[datetime] = None,
|
||||
custom_end_date: Optional[datetime] = None,
|
||||
session: Session = Depends(get_session),
|
||||
@@ -410,8 +410,8 @@ async def get_ecosystem_comparison(
|
||||
@rate_limit(rate=50, per=60)
|
||||
async def export_ecosystem_data(
|
||||
request: Request,
|
||||
format: str = Field(default="json", regex="^(json|csv|xlsx)$"),
|
||||
period_type: str = Field(default="daily", regex="^(hourly|daily|weekly|monthly)$"),
|
||||
format: str = Query(default="json", pattern="^(json|csv|xlsx)$"),
|
||||
period_type: str = Query(default="daily", pattern="^(hourly|daily|weekly|monthly)$"),
|
||||
start_date: Optional[datetime] = None,
|
||||
end_date: Optional[datetime] = None,
|
||||
session: Session = Depends(get_session),
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
"""Edge GPU context for edge computing and GPU resource allocation."""
|
||||
|
||||
from .routers import router as edge_gpu_router
|
||||
|
||||
__all__ = ["edge_gpu_router"]
|
||||
@@ -0,0 +1,5 @@
|
||||
"""Edge GPU routers."""
|
||||
|
||||
from .edge_gpu import router
|
||||
|
||||
__all__ = ["router"]
|
||||
@@ -0,0 +1,5 @@
|
||||
"""Edge GPU services."""
|
||||
|
||||
from .edge_gpu_service import edge_gpu_service
|
||||
|
||||
__all__ = ["edge_gpu_service"]
|
||||
@@ -4,9 +4,9 @@ from fastapi import Depends
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlmodel import select
|
||||
|
||||
from ..data.consumer_gpu_profiles import CONSUMER_GPU_PROFILES
|
||||
from ..domain.gpu_marketplace import ConsumerGPUProfile, EdgeGPUMetrics, GPUArchitecture
|
||||
from ..storage import get_session
|
||||
from ...data.consumer_gpu_profiles import CONSUMER_GPU_PROFILES
|
||||
from ...domain.gpu_marketplace import ConsumerGPUProfile, EdgeGPUMetrics, GPUArchitecture
|
||||
from ...storage import get_session
|
||||
|
||||
|
||||
class EdgeGPUService:
|
||||
@@ -27,7 +27,7 @@ from ....domain.governance import (
|
||||
Vote,
|
||||
VoteType,
|
||||
)
|
||||
from ....services.governance_service import GovernanceService
|
||||
from ..services.governance_service import GovernanceService
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter(prefix="/governance", tags=["governance"])
|
||||
|
||||
@@ -15,7 +15,7 @@ from ....domain.governance import (
|
||||
GovernanceProfile,
|
||||
VoteType,
|
||||
)
|
||||
from ....services.governance_service import GovernanceService
|
||||
from ..services.governance_service import GovernanceService
|
||||
from ....storage.db import get_session
|
||||
|
||||
router = APIRouter(prefix="/governance-enhanced", tags=["Enhanced Governance"])
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
"""Governance services."""
|
||||
|
||||
from .governance_service import GovernanceService
|
||||
|
||||
__all__ = ["GovernanceService"]
|
||||
|
||||
@@ -31,7 +31,7 @@ from ....schemas.hermes_enhanced import (
|
||||
SkillRoutingRequest,
|
||||
SkillRoutingResponse,
|
||||
)
|
||||
from ....services.hermes_enhanced import hermesEnhancedService
|
||||
from ..services.hermes_enhanced import hermesEnhancedService
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter(prefix="/hermes/enhanced", tags=["hermes Enhanced"])
|
||||
|
||||
@@ -17,7 +17,7 @@ from aitbc.rate_limiting import rate_limit
|
||||
|
||||
from aitbc import get_logger
|
||||
|
||||
from ....services.hermes_enhanced import hermesEnhancedService
|
||||
from ..services.hermes_enhanced import hermesEnhancedService
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -19,7 +19,7 @@ from sqlmodel import Session
|
||||
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
from ....deps import require_admin_key
|
||||
from ....services.hermes_enhanced_simple import hermesEnhancedService, SkillType
|
||||
from ..services.hermes_enhanced_simple import hermesEnhancedService, SkillType
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter(prefix="/hermes/enhanced", tags=["hermes Enhanced"])
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
"""Language context for multi-language support and translation services."""
|
||||
|
||||
from .services.multi_language import translation_engine, translation_cache, language_detector
|
||||
|
||||
__all__ = ["translation_engine", "translation_cache", "language_detector"]
|
||||
@@ -0,0 +1,5 @@
|
||||
"""Language services."""
|
||||
|
||||
from .multi_language import translation_engine, translation_cache, language_detector, quality_assurance
|
||||
|
||||
__all__ = ["translation_engine", "translation_cache", "language_detector", "quality_assurance"]
|
||||
@@ -6,6 +6,8 @@ from uuid import uuid4
|
||||
from sqlalchemy import JSON, Column
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
from ..storage.schema import MARKETPLACE_BID_TABLE
|
||||
|
||||
|
||||
class MarketplaceOffer(SQLModel, table=True):
|
||||
__tablename__ = "marketplaceoffer"
|
||||
|
||||
@@ -10,7 +10,7 @@ from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Query
|
||||
from sqlmodel import Session, func, select
|
||||
|
||||
from ....agent_identity.manager import AgentIdentityManager
|
||||
from ....domain.global_marketplace import (
|
||||
from ..domain.global_marketplace import (
|
||||
GlobalMarketplaceConfig,
|
||||
GlobalMarketplaceOffer,
|
||||
GlobalMarketplaceTransaction,
|
||||
@@ -18,7 +18,7 @@ from ....domain.global_marketplace import (
|
||||
MarketplaceStatus,
|
||||
RegionStatus,
|
||||
)
|
||||
from ....services.global_marketplace import GlobalMarketplaceService, RegionManager
|
||||
from ..services.global_marketplace import GlobalMarketplaceService, RegionManager
|
||||
from ....storage.db import get_session
|
||||
|
||||
router = APIRouter(prefix="/global-marketplace", tags=["Global Marketplace"])
|
||||
|
||||
@@ -10,12 +10,12 @@ from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from ....agent_identity.manager import AgentIdentityManager
|
||||
from ....domain.global_marketplace import (
|
||||
from ..domain.global_marketplace import (
|
||||
GlobalMarketplaceOffer,
|
||||
)
|
||||
from ....reputation.engine import CrossChainReputationEngine
|
||||
from ....services.cross_chain_bridge_enhanced import BridgeProtocol
|
||||
from ....services.global_marketplace_integration import (
|
||||
from ...cross_chain.services.cross_chain.bridge_enhanced import BridgeProtocol
|
||||
from ..services.global_marketplace_integration import (
|
||||
GlobalMarketplaceIntegrationService,
|
||||
IntegrationStatus,
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ from aitbc import get_logger
|
||||
from ....config import settings
|
||||
from ....metrics import marketplace_errors_total, marketplace_requests_total
|
||||
from ....schemas import MarketplaceBidRequest, MarketplaceBidView, MarketplaceOfferView, MarketplaceStatsView
|
||||
from ...services import MarketplaceService
|
||||
from ..services import MarketplaceService
|
||||
from ....storage import get_session
|
||||
from ....utils.cache import cached, get_cache_config
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ from sqlmodel import col, func, select
|
||||
|
||||
from aitbc import get_logger
|
||||
from ....custom_types import Constraints
|
||||
from ....domain.gpu_marketplace import GPUBooking, GPURegistry, GPUReview
|
||||
from ..domain.gpu_marketplace import GPUBooking, GPURegistry, GPUReview
|
||||
from ....domain.job import Job
|
||||
from ....schemas import JobCreate, JobPaymentCreate
|
||||
from ....services.dynamic_pricing_engine import DynamicPricingEngine, PricingStrategy, ResourceType
|
||||
from ...trading.services.trading_marketplace.dynamic_pricing import DynamicPricingEngine, PricingStrategy, ResourceType
|
||||
from ....services.jobs import JobService
|
||||
from ....services.market_data_collector import MarketDataCollector
|
||||
from ..services.payments import PaymentService
|
||||
from ..storage.db import get_session
|
||||
from ....contexts.payments.services.payments import PaymentService
|
||||
from ....storage.db import get_session
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
@@ -306,11 +306,11 @@ async def buy_gpu(
|
||||
payment_status = None
|
||||
try:
|
||||
# Lazy import to avoid blocking startup
|
||||
from ..custom_types import Constraints
|
||||
from ..domain.job import Job
|
||||
from ..schemas import JobCreate, JobPaymentCreate
|
||||
from ..services.jobs import JobService
|
||||
from ..services.payments import PaymentService
|
||||
from ....custom_types import Constraints
|
||||
from ....domain.job import Job
|
||||
from ....schemas import JobCreate, JobPaymentCreate
|
||||
from ....services.jobs import JobService
|
||||
from ....contexts.payments.services.payments import PaymentService
|
||||
from sqlmodel import Session as SQLModelSession
|
||||
|
||||
# Create a new session for job creation to ensure it persists
|
||||
|
||||
@@ -13,7 +13,8 @@ from sqlmodel import Session, select
|
||||
|
||||
from aitbc import get_logger
|
||||
from ....deps import require_admin_key
|
||||
from ....domain import MarketplaceOffer, Miner
|
||||
from ....domain import Miner
|
||||
from ..domain.marketplace import MarketplaceOffer
|
||||
from ....schemas import MarketplaceOfferView
|
||||
from ....storage import get_session
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""Marketplace services."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .marketplace import MarketplaceService
|
||||
|
||||
__all__ = ["MarketplaceService"]
|
||||
|
||||
@@ -19,7 +19,7 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from ..domain.agent_identity import AgentIdentity
|
||||
from ...agent_identity.domain.agent_identity import AgentIdentity
|
||||
from ..domain.global_marketplace import (
|
||||
GlobalMarketplaceAnalytics,
|
||||
GlobalMarketplaceOffer,
|
||||
@@ -28,7 +28,7 @@ from ..domain.global_marketplace import (
|
||||
MarketplaceStatus,
|
||||
RegionStatus,
|
||||
)
|
||||
from ..reputation.engine import CrossChainReputationEngine
|
||||
from ....reputation.engine import CrossChainReputationEngine
|
||||
|
||||
|
||||
class GlobalMarketplaceService:
|
||||
|
||||
@@ -13,14 +13,14 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from ..agent_identity.wallet_adapter_enhanced import WalletAdapterFactory
|
||||
from ....agent_identity.wallet_adapter_enhanced import WalletAdapterFactory
|
||||
from ..domain.global_marketplace import (
|
||||
GlobalMarketplaceOffer,
|
||||
)
|
||||
from ..reputation.engine import CrossChainReputationEngine
|
||||
from ..services.cross_chain.bridge_enhanced import BridgeProtocol, CrossChainBridgeService
|
||||
from ....reputation.engine import CrossChainReputationEngine
|
||||
from ...cross_chain.services.cross_chain.bridge_enhanced import BridgeProtocol, CrossChainBridgeService
|
||||
from ..services.global_marketplace import GlobalMarketplaceService, RegionManager
|
||||
from ..services.multi_chain_transaction_manager import MultiChainTransactionManager, TransactionPriority
|
||||
from ....services.multi_chain_transaction_manager import MultiChainTransactionManager, TransactionPriority
|
||||
|
||||
|
||||
class IntegrationStatus(StrEnum):
|
||||
|
||||
@@ -4,7 +4,7 @@ from statistics import mean
|
||||
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from ....domain import MarketplaceBid, MarketplaceOffer
|
||||
from ..domain.marketplace import MarketplaceBid, MarketplaceOffer
|
||||
from ....schemas import (
|
||||
MarketplaceBidRequest,
|
||||
MarketplaceBidView,
|
||||
|
||||
@@ -15,7 +15,7 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
|
||||
from ....services.multimodal_agent import MultiModalAgentService
|
||||
from ..services.multimodal_agent import MultiModalAgentService
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -17,7 +17,7 @@ from datetime import datetime, timezone
|
||||
from enum import StrEnum
|
||||
from typing import Any
|
||||
|
||||
from ..storage import get_session
|
||||
from ....storage import get_session
|
||||
from .multimodal_agent import ModalityType
|
||||
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ from datetime import datetime, timezone
|
||||
from enum import StrEnum
|
||||
from typing import Any
|
||||
|
||||
from ..domain import AgentExecution, AgentStatus
|
||||
from ..storage import get_session
|
||||
from ....domain import AgentExecution, AgentStatus
|
||||
from ....storage import get_session
|
||||
|
||||
|
||||
class ModalityType(StrEnum):
|
||||
|
||||
@@ -50,7 +50,7 @@ class JobPayment(SQLModel, table=True):
|
||||
class PaymentEscrow(SQLModel, table=True):
|
||||
"""Escrow record for holding payments"""
|
||||
|
||||
__tablename__ = PAYMENT_ESCROW_TABLE
|
||||
__tablename__ = "payment_escrows"
|
||||
__table_args__ = {"extend_existing": True}
|
||||
|
||||
id: str = Field(default_factory=lambda: uuid4().hex, primary_key=True, index=True)
|
||||
|
||||
@@ -9,7 +9,7 @@ from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from ....deps import require_client_key
|
||||
from ....schemas import EscrowRelease, JobPaymentCreate, JobPaymentView, PaymentReceipt, RefundRequest
|
||||
from ...services.payments import PaymentService
|
||||
from ..services.payments import PaymentService
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter(tags=["payments"])
|
||||
|
||||
@@ -12,7 +12,7 @@ from datetime import datetime, timezone, timedelta
|
||||
from aitbc import get_logger, AITBCHTTPClient, NetworkError
|
||||
logger = get_logger(__name__)
|
||||
|
||||
from ....domain.payment import JobPayment, PaymentEscrow
|
||||
from ..domain.payment import JobPayment, PaymentEscrow
|
||||
from ....schemas import JobPaymentCreate, JobPaymentView
|
||||
from ....storage import get_session
|
||||
|
||||
|
||||
@@ -21,12 +21,16 @@ logger = get_logger(__name__)
|
||||
from sqlmodel import Field, func, select
|
||||
|
||||
from ....domain.reputation import AgentReputation, CommunityFeedback, ReputationLevel, TrustScoreCategory
|
||||
from ....services.reputation_service import ReputationService
|
||||
from ..services.reputation_service import ReputationService
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter(prefix="/v1/reputation", tags=["reputation"])
|
||||
|
||||
|
||||
def get_reputation_service(session: Session = Depends(get_session)) -> ReputationService:
|
||||
return ReputationService(session)
|
||||
|
||||
|
||||
# Pydantic models for API requests/responses
|
||||
class ReputationProfileResponse(BaseModel):
|
||||
"""Response model for reputation profile"""
|
||||
@@ -558,7 +562,7 @@ async def get_cross_chain_reputation(
|
||||
request: Request,
|
||||
agent_id: str,
|
||||
session: Session = Depends(get_session),
|
||||
reputation_service: ReputationService = Depends()
|
||||
reputation_service: ReputationService = Depends(get_reputation_service)
|
||||
) -> Dict[str, Any]:
|
||||
"""Get cross-chain reputation data for an agent"""
|
||||
|
||||
@@ -609,7 +613,7 @@ async def sync_cross_chain_reputation(
|
||||
agent_id: str,
|
||||
background_tasks: Any, # FastAPI BackgroundTasks
|
||||
session: Session = Depends(get_session),
|
||||
reputation_service: ReputationService = Depends()
|
||||
reputation_service: ReputationService = Depends(get_reputation_service)
|
||||
) -> Dict[str, Any]:
|
||||
"""Synchronize reputation across chains for an agent"""
|
||||
|
||||
@@ -645,7 +649,7 @@ async def get_cross_chain_leaderboard(
|
||||
limit: int = Query(50, ge=1, le=100),
|
||||
min_score: float = Query(0.0, ge=0.0, le=1.0),
|
||||
session: Session = Depends(get_session),
|
||||
reputation_service: ReputationService = Depends()
|
||||
reputation_service: ReputationService = Depends(get_reputation_service)
|
||||
) -> Dict[str, Any]:
|
||||
"""Get cross-chain reputation leaderboard"""
|
||||
|
||||
@@ -694,7 +698,7 @@ async def submit_cross_chain_event(
|
||||
event_data: Dict[str, Any],
|
||||
background_tasks: Any, # FastAPI BackgroundTasks
|
||||
session: Session = Depends(get_session),
|
||||
reputation_service: ReputationService = Depends()
|
||||
reputation_service: ReputationService = Depends(get_reputation_service)
|
||||
) -> Dict[str, Any]:
|
||||
"""Submit a cross-chain reputation event"""
|
||||
|
||||
@@ -760,7 +764,7 @@ async def get_cross_chain_analytics(
|
||||
request: Request,
|
||||
chain_id: Optional[int] = Query(None),
|
||||
session: Session = Depends(get_session),
|
||||
reputation_service: ReputationService = Depends()
|
||||
reputation_service: ReputationService = Depends(get_reputation_service)
|
||||
) -> Dict[str, Any]:
|
||||
"""Get cross-chain reputation analytics"""
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ from aitbc.rate_limiting import rate_limit
|
||||
logger = get_logger(__name__)
|
||||
|
||||
from ....domain.rewards import AgentRewardProfile, RewardStatus, RewardTier, RewardType
|
||||
from ....services.reward_service import RewardEngine
|
||||
from ..services.reward_service import RewardEngine
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter(prefix="/v1/rewards", tags=["rewards"])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Annotated
|
||||
from typing import Annotated, Any
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from datetime import datetime, timezone, timedelta
|
||||
from enum import StrEnum
|
||||
from typing import Any
|
||||
|
||||
from ..schemas import ConfidentialAccessRequest
|
||||
from ....schemas import ConfidentialAccessRequest
|
||||
|
||||
|
||||
class AccessPurpose(StrEnum):
|
||||
|
||||
@@ -11,7 +11,7 @@ from datetime import datetime, timezone, timedelta
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey, X25519PublicKey
|
||||
|
||||
from ..schemas import KeyPair, KeyRotationLog
|
||||
from ....schemas import KeyPair, KeyRotationLog
|
||||
|
||||
|
||||
class KeyManager:
|
||||
|
||||
@@ -11,7 +11,7 @@ from pydantic import BaseModel, Field
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
|
||||
from ....auth import get_api_key
|
||||
from .settlement.manager import BridgeManager
|
||||
from app.settlement.manager import BridgeManager
|
||||
|
||||
router = APIRouter(prefix="/settlement", tags=["settlement"])
|
||||
|
||||
|
||||
@@ -8,16 +8,16 @@ REST API for AI agent staking system with reputation-based yield farming
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Request, Field
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Query, Request
|
||||
from pydantic import BaseModel, Field, validator
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from aitbc import get_logger
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
from ....auth import get_current_user
|
||||
from ....routers.users import get_current_user
|
||||
from ....domain.bounty import AgentMetrics, AgentStake, EcosystemMetrics, PerformanceTier, StakeStatus, StakingPool
|
||||
from ....services.blockchain_service import BlockchainService
|
||||
from ....services.staking_service import StakingService
|
||||
from ...blockchain.services.blockchain import BlockchainService
|
||||
from ..services.staking_service import StakingService
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter()
|
||||
@@ -466,7 +466,7 @@ async def get_staking_pool(
|
||||
async def get_agent_apy(
|
||||
request: Request,
|
||||
agent_wallet: str,
|
||||
lock_period: int = Field(default=30, ge=1, le=365),
|
||||
lock_period: int = Query(default=30, ge=1, le=365),
|
||||
session: Session = Depends(get_session),
|
||||
staking_service: StakingService = Depends(get_staking_service)
|
||||
) -> Dict[str, Any]:
|
||||
@@ -575,8 +575,8 @@ async def distribute_agent_earnings(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_supported_agents(
|
||||
request: Request,
|
||||
page: int = Field(default=1, ge=1),
|
||||
limit: int = Field(default=50, ge=1, le=100),
|
||||
page: int = Query(default=1, ge=1),
|
||||
limit: int = Query(default=50, ge=1, le=100),
|
||||
tier: Optional[PerformanceTier] = None,
|
||||
session: Session = Depends(get_session),
|
||||
staking_service: StakingService = Depends(get_staking_service)
|
||||
@@ -604,7 +604,7 @@ async def get_supported_agents(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_staking_stats(
|
||||
request: Request,
|
||||
period: str = Field(default="daily", regex="^(hourly|daily|weekly|monthly)$"),
|
||||
period: str = Query(default="daily", regex="^(hourly|daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
staking_service: StakingService = Depends(get_staking_service)
|
||||
) -> StakingStatsResponse:
|
||||
@@ -622,9 +622,9 @@ async def get_staking_stats(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_staking_leaderboard(
|
||||
request: Request,
|
||||
period: str = Field(default="weekly", regex="^(daily|weekly|monthly)$"),
|
||||
metric: str = Field(default="total_staked", regex="^(total_staked|total_rewards|apy)$"),
|
||||
limit: int = Field(default=50, ge=1, le=100),
|
||||
period: str = Query(default="weekly", regex="^(daily|weekly|monthly)$"),
|
||||
metric: str = Query(default="total_staked", regex="^(total_staked|total_rewards|apy)$"),
|
||||
limit: int = Query(default=50, ge=1, le=100),
|
||||
session: Session = Depends(get_session),
|
||||
staking_service: StakingService = Depends(get_staking_service)
|
||||
) -> Dict[str, Any]:
|
||||
@@ -648,8 +648,8 @@ async def get_my_staking_positions(
|
||||
request: Request,
|
||||
status: Optional[StakeStatus] = None,
|
||||
agent_wallet: Optional[str] = None,
|
||||
page: int = Field(default=1, ge=1),
|
||||
limit: int = Field(default=20, ge=1, le=100),
|
||||
page: int = Query(default=1, ge=1),
|
||||
limit: int = Query(default=20, ge=1, le=100),
|
||||
session: Session = Depends(get_session),
|
||||
staking_service: StakingService = Depends(get_staking_service),
|
||||
current_user: dict = Depends(get_current_user)
|
||||
@@ -674,7 +674,7 @@ async def get_my_staking_positions(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_my_staking_rewards(
|
||||
request: Request,
|
||||
period: str = Field(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
period: str = Query(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
staking_service: StakingService = Depends(get_staking_service),
|
||||
current_user: dict = Depends(get_current_user)
|
||||
|
||||
@@ -29,7 +29,7 @@ from ....domain.trading import (
|
||||
TradeStatus,
|
||||
TradeType,
|
||||
)
|
||||
from ....services.trading_marketplace.trading import P2PTradingProtocol
|
||||
from ..services.trading_marketplace.trading import P2PTradingProtocol
|
||||
from ....storage import get_session
|
||||
|
||||
router = APIRouter(prefix="/v1/trading", tags=["trading"])
|
||||
|
||||
@@ -6,12 +6,9 @@ Provides trading, marketplace optimization, bid strategy, and dynamic pricing se
|
||||
from .bid_strategy import BidStrategyEngine
|
||||
from .dynamic_pricing import DynamicPricingEngine
|
||||
from .gpu_optimizer import MarketplaceGPUOptimizer
|
||||
from .trading import MatchingEngine, NegotiationSystem
|
||||
|
||||
__all__ = [
|
||||
"BidStrategyEngine",
|
||||
"DynamicPricingEngine",
|
||||
"MarketplaceGPUOptimizer",
|
||||
"MatchingEngine",
|
||||
"NegotiationSystem",
|
||||
]
|
||||
|
||||
@@ -13,7 +13,7 @@ logger = get_logger(__name__)
|
||||
|
||||
from sqlmodel import Session, or_, select
|
||||
|
||||
from ...domain.trading import (
|
||||
from app.domain.trading import (
|
||||
NegotiationStatus,
|
||||
SettlementType,
|
||||
TradeAgreement,
|
||||
|
||||
5
apps/coordinator-api/src/app/contexts/wallet/__init__.py
Normal file
5
apps/coordinator-api/src/app/contexts/wallet/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
"""Wallet context for wallet management and cryptocurrency operations."""
|
||||
|
||||
from .services import bitcoin_wallet, wallet_crypto, wallet_service, secure_wallet_service
|
||||
|
||||
__all__ = ["bitcoin_wallet", "wallet_crypto", "wallet_service", "secure_wallet_service"]
|
||||
@@ -0,0 +1,7 @@
|
||||
"""Wallet services."""
|
||||
|
||||
from .bitcoin_wallet import get_wallet_balance, get_wallet_info
|
||||
from .wallet_service import WalletService
|
||||
from .secure_wallet_service import SecureWalletService
|
||||
|
||||
__all__ = ["get_wallet_balance", "get_wallet_info", "WalletService", "SecureWalletService"]
|
||||
@@ -11,9 +11,9 @@ from datetime import datetime, timezone
|
||||
from sqlalchemy import select
|
||||
from sqlmodel import Session
|
||||
|
||||
from ..blockchain.contract_interactions import ContractInteractionService
|
||||
from ..domain.wallet import AgentWallet, TokenBalance, TransactionStatus, WalletTransaction
|
||||
from ..schemas.wallet import TransactionRequest, WalletCreate
|
||||
# from ...blockchain.services.contract_interactions import ContractInteractionService
|
||||
from ....domain.wallet import AgentWallet, TokenBalance, TransactionStatus, WalletTransaction
|
||||
from ....schemas.wallet import TransactionRequest, WalletCreate
|
||||
|
||||
# Import our fixed crypto utilities
|
||||
from .wallet_crypto import (
|
||||
@@ -13,15 +13,15 @@ from sqlalchemy import select
|
||||
from sqlmodel import Session
|
||||
|
||||
from aitbc import get_logger
|
||||
from ..blockchain.contract_interactions import ContractInteractionService
|
||||
from ..domain.wallet import AgentWallet, TokenBalance, TransactionStatus, WalletTransaction
|
||||
from ..schemas.wallet import TransactionRequest, WalletCreate
|
||||
# from ...blockchain.services.contract_interactions import ContractInteractionService
|
||||
from ....domain.wallet import AgentWallet, TokenBalance, TransactionStatus, WalletTransaction
|
||||
from ....schemas.wallet import TransactionRequest, WalletCreate
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
class WalletService:
|
||||
def __init__(self, session: Session, contract_service: ContractInteractionService):
|
||||
def __init__(self, session: Session, contract_service=None):
|
||||
self.session = session
|
||||
self.contract_service = contract_service
|
||||
|
||||
@@ -47,7 +47,7 @@ def init_async_db() -> None:
|
||||
|
||||
try:
|
||||
# Build async URL from sync settings
|
||||
sync_url = str(settings.database.url)
|
||||
sync_url = str(settings.database.effective_url)
|
||||
async_url = _build_async_url(sync_url)
|
||||
|
||||
logger.info(f"Initializing async database connection: {async_url.split('://')[0]}://...")
|
||||
|
||||
@@ -48,7 +48,6 @@ from .routers import (
|
||||
admin,
|
||||
agent_router,
|
||||
client,
|
||||
cross_chain_integration,
|
||||
developer_platform,
|
||||
edge_gpu,
|
||||
exchange,
|
||||
@@ -66,8 +65,6 @@ from .contexts.marketplace.routers import (
|
||||
marketplace,
|
||||
marketplace_gpu,
|
||||
marketplace_offers,
|
||||
global_marketplace,
|
||||
global_marketplace_integration,
|
||||
)
|
||||
from .contexts.payments.routers import payments
|
||||
from .contexts.blockchain.routers import blockchain
|
||||
@@ -75,35 +72,33 @@ from .contexts.agent_identity.routers import agent_identity
|
||||
|
||||
# Skip optional routers with missing dependencies
|
||||
try:
|
||||
from .routers.ml_zk_proofs import router as ml_zk_proofs
|
||||
from .contexts.zk_applications.routers.ml_zk_proofs import router as ml_zk_proofs
|
||||
except ImportError:
|
||||
ml_zk_proofs = None
|
||||
logger.warning("ML ZK proofs router not available (missing tenseal)")
|
||||
from .routers.marketplace_enhanced_simple import router as marketplace_enhanced
|
||||
from .routers.monitoring_dashboard import router as monitoring_dashboard
|
||||
from .routers.hermes_enhanced_simple import router as hermes_enhanced
|
||||
from .contexts.infrastructure.routers.monitoring_dashboard import router as monitoring_dashboard
|
||||
from .contexts.hermes.routers.hermes_enhanced_simple import router as hermes_enhanced
|
||||
|
||||
# Skip optional routers with missing dependencies
|
||||
try:
|
||||
from .routers.multi_modal_rl import router as multi_modal_rl_router
|
||||
from .contexts.multimodal.routers.multi_modal_rl import router as multi_modal_rl_router
|
||||
except ImportError:
|
||||
multi_modal_rl_router = None
|
||||
logger.warning("Multi-modal RL router not available (missing torch)")
|
||||
|
||||
try:
|
||||
from .routers.ml_zk_proofs import router as ml_zk_proofs
|
||||
from .contexts.zk_applications.routers.ml_zk_proofs import router as ml_zk_proofs
|
||||
except ImportError:
|
||||
ml_zk_proofs = None
|
||||
logger.warning("ML ZK proofs router not available (missing dependencies)")
|
||||
|
||||
from .routers.marketplace_enhanced_simple import router as marketplace_enhanced
|
||||
|
||||
from aitbc.aitbc_logging import configure_logging
|
||||
from aitbc import (
|
||||
RequestIDMiddleware,
|
||||
PerformanceLoggingMiddleware,
|
||||
RequestValidationMiddleware,
|
||||
ErrorHandlerMiddleware,
|
||||
get_logger,
|
||||
)
|
||||
from .exceptions import AITBCError, ErrorResponse
|
||||
|
||||
@@ -162,7 +157,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
|
||||
# Continue startup even if warmup fails
|
||||
|
||||
# Validate configuration
|
||||
if settings.app_env == "production":
|
||||
if settings.environment == "production":
|
||||
logger.info("Production environment detected, validating configuration")
|
||||
# Configuration validation happens automatically via Pydantic validators
|
||||
logger.info("Configuration validation passed")
|
||||
@@ -182,13 +177,13 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
|
||||
logger.info(f" Admin stats: {settings.rate_limit_admin_stats}")
|
||||
|
||||
# Log service startup details
|
||||
logger.info(f"Coordinator API started on {settings.app_host}:{settings.app_port}")
|
||||
logger.info(f"Coordinator API started on {settings.app_host}:{settings.port}")
|
||||
logger.info(f"Database adapter: {settings.database.adapter}")
|
||||
logger.info(f"Environment: {settings.app_env}")
|
||||
logger.info(f"Environment: {settings.environment}")
|
||||
|
||||
# Log complete configuration summary
|
||||
logger.info("=== Coordinator API Configuration Summary ===")
|
||||
logger.info(f"Environment: {settings.app_env}")
|
||||
logger.info(f"Environment: {settings.environment}")
|
||||
logger.info(f"Database: {settings.database.adapter}")
|
||||
logger.info("Rate Limits:")
|
||||
logger.info(f" Jobs submit: {settings.rate_limit_jobs_submit}")
|
||||
@@ -359,15 +354,11 @@ def create_app() -> FastAPI:
|
||||
|
||||
if ml_zk_proofs:
|
||||
app.include_router(ml_zk_proofs)
|
||||
app.include_router(marketplace_enhanced, prefix="/v1")
|
||||
app.include_router(hermes_enhanced, prefix="/v1")
|
||||
app.include_router(monitoring_dashboard, prefix="/v1")
|
||||
app.include_router(agent_router.router, prefix="/v1/agents")
|
||||
app.include_router(agent_router.router, prefix="/api/v1/agents") # CLI compatibility
|
||||
app.include_router(agent_router, prefix="/v1/agents")
|
||||
app.include_router(agent_router, prefix="/api/v1/agents") # CLI compatibility
|
||||
app.include_router(agent_identity, prefix="/v1")
|
||||
app.include_router(global_marketplace, prefix="/v1")
|
||||
app.include_router(cross_chain_integration, prefix="/v1")
|
||||
app.include_router(global_marketplace_integration, prefix="/v1")
|
||||
app.include_router(developer_platform, prefix="/v1")
|
||||
app.include_router(governance_enhanced, prefix="/v1")
|
||||
|
||||
@@ -384,11 +375,11 @@ def create_app() -> FastAPI:
|
||||
app.include_router(multi_modal_rl, prefix="/v1")
|
||||
|
||||
# Add swarm router for CLI compatibility
|
||||
app.include_router(swarm.router, prefix="/v1")
|
||||
app.include_router(swarm.router) # CLI compatibility (calls /swarm/list directly)
|
||||
app.include_router(swarm, prefix="/v1")
|
||||
app.include_router(swarm) # CLI compatibility (calls /swarm/list directly)
|
||||
|
||||
# Add monitor router for CLI compatibility
|
||||
app.include_router(monitor.router)
|
||||
app.include_router(monitor)
|
||||
|
||||
# Add Prometheus metrics endpoint
|
||||
metrics_app = make_asgi_app()
|
||||
|
||||
@@ -11,15 +11,19 @@ from ..custom_types import (
|
||||
# Import domain models
|
||||
from ..domain import (
|
||||
Job,
|
||||
JobPayment,
|
||||
JobReceipt,
|
||||
MarketplaceBid,
|
||||
MarketplaceOffer,
|
||||
Miner,
|
||||
PaymentEscrow,
|
||||
User,
|
||||
Wallet,
|
||||
)
|
||||
from ..contexts.marketplace.domain.marketplace import (
|
||||
MarketplaceBid,
|
||||
MarketplaceOffer,
|
||||
)
|
||||
from ..contexts.payments.domain.payment import (
|
||||
JobPayment,
|
||||
PaymentEscrow,
|
||||
)
|
||||
|
||||
# Import schemas from schemas.py
|
||||
from ..schemas import (
|
||||
|
||||
@@ -11,102 +11,112 @@ except ImportError:
|
||||
admin = None
|
||||
logger.warning("Admin router not available (missing slowapi)")
|
||||
|
||||
from .agent_identity import router as agent_identity
|
||||
from .blockchain import router as blockchain
|
||||
from .cache_management import router as cache_management
|
||||
from .client import router as client
|
||||
from .edge_gpu import router as edge_gpu
|
||||
|
||||
# Agent identity router moved to contexts/agent_identity
|
||||
from ..contexts.agent_identity.routers.agent_identity import router as agent_identity
|
||||
|
||||
# Blockchain router moved to contexts/blockchain
|
||||
from ..contexts.blockchain.routers.blockchain import router as blockchain
|
||||
|
||||
# Edge GPU router moved to contexts/edge_gpu
|
||||
from ..contexts.edge_gpu.routers.edge_gpu import router as edge_gpu
|
||||
|
||||
from .exchange import router as exchange
|
||||
from .explorer import router as explorer
|
||||
from .marketplace import router as marketplace
|
||||
from .marketplace_gpu import router as marketplace_gpu
|
||||
from .marketplace_offers import router as marketplace_offers
|
||||
|
||||
# Marketplace routers moved to contexts/marketplace
|
||||
from ..contexts.marketplace.routers.marketplace import router as marketplace
|
||||
from ..contexts.marketplace.routers.marketplace_gpu import router as marketplace_gpu
|
||||
from ..contexts.marketplace.routers.marketplace_offers import router as marketplace_offers
|
||||
|
||||
from .miner import router as miner
|
||||
from .payments import router as payments
|
||||
|
||||
# Payments router moved to contexts/payments
|
||||
from ..contexts.payments.routers.payments import router as payments
|
||||
from .services import router as services
|
||||
from .users import router as users
|
||||
from .web_vitals import router as web_vitals
|
||||
from .multi_modal_rl import router as multi_modal_rl
|
||||
|
||||
# from .registry import router as registry
|
||||
|
||||
# Governance routers moved to contexts/governance
|
||||
from .contexts.governance.routers.governance import router as governance
|
||||
from .contexts.governance.routers.governance_enhanced import router as governance_enhanced
|
||||
from ..contexts.governance.routers.governance import router as governance
|
||||
from ..contexts.governance.routers.governance_enhanced import router as governance_enhanced
|
||||
|
||||
# Staking router moved to contexts/staking
|
||||
from .contexts.staking.routers.staking import router as staking
|
||||
from ..contexts.staking.routers.staking import router as staking
|
||||
|
||||
# Reputation router moved to contexts/reputation
|
||||
from .contexts.reputation.routers.reputation import router as reputation
|
||||
from ..contexts.reputation.routers.reputation import router as reputation
|
||||
|
||||
# Rewards router moved to contexts/rewards
|
||||
from .contexts.rewards.routers.rewards import router as rewards
|
||||
from ..contexts.rewards.routers.rewards import router as rewards
|
||||
|
||||
# Trading router moved to contexts/trading
|
||||
from .contexts.trading.routers.trading import router as trading
|
||||
from ..contexts.trading.routers.trading import router as trading
|
||||
|
||||
# Hermes routers moved to contexts/hermes
|
||||
from .contexts.hermes.routers.hermes_enhanced import router as hermes_enhanced
|
||||
from .contexts.hermes.routers.hermes_enhanced_simple import router as hermes_enhanced_simple
|
||||
from .contexts.hermes.routers.hermes_enhanced_health import router as hermes_enhanced_health
|
||||
from ..contexts.hermes.routers.hermes_enhanced import router as hermes_enhanced
|
||||
from ..contexts.hermes.routers.hermes_enhanced_simple import router as hermes_enhanced_simple
|
||||
from ..contexts.hermes.routers.hermes_enhanced_health import router as hermes_enhanced_health
|
||||
|
||||
# Security router moved to contexts/security
|
||||
from .contexts.security.routers.agent_security_router import router as agent_security_router
|
||||
from ..contexts.security.routers.agent_security_router import router as agent_security_router
|
||||
|
||||
# Analytics router moved to contexts/analytics
|
||||
from .contexts.analytics.routers.analytics import router as analytics
|
||||
from ..contexts.analytics.routers.analytics import router as analytics
|
||||
|
||||
# Certification router moved to contexts/certification
|
||||
from .contexts.certification.routers.certification import router as certification
|
||||
from ..contexts.certification.routers.certification import router as certification
|
||||
|
||||
# Multimodal routers moved to contexts/multimodal
|
||||
from .contexts.multimodal.routers.multi_modal_rl import router as multi_modal_rl
|
||||
from .contexts.multimodal.routers.multimodal_health import router as multimodal_health
|
||||
from .contexts.multimodal.routers.modality_optimization_health import router as modality_optimization_health
|
||||
from ..contexts.multimodal.routers.multi_modal_rl import router as multi_modal_rl
|
||||
from ..contexts.multimodal.routers.multimodal_health import router as multimodal_health
|
||||
from ..contexts.multimodal.routers.modality_optimization_health import router as modality_optimization_health
|
||||
|
||||
# Developer platform router moved to contexts/developer_platform
|
||||
from .contexts.developer_platform.routers.developer_platform import router as developer_platform
|
||||
from ..contexts.developer_platform.routers.developer_platform import router as developer_platform
|
||||
|
||||
# Community router moved to contexts/community
|
||||
from .contexts.community.routers.community import router as community
|
||||
from ..contexts.community.routers.community import router as community
|
||||
|
||||
# Bounty router moved to contexts/bounty
|
||||
from .contexts.bounty.routers.bounty import router as bounty
|
||||
from ..contexts.bounty.routers.bounty import router as bounty
|
||||
|
||||
# Confidential router moved to contexts/confidential
|
||||
from .contexts.confidential.routers.confidential import router as confidential
|
||||
from ..contexts.confidential.routers.confidential import router as confidential
|
||||
|
||||
# ZK applications routers moved to contexts/zk_applications
|
||||
from .contexts.zk_applications.routers.zk_applications import router as zk_applications
|
||||
from .contexts.zk_applications.routers.ml_zk_proofs import router as ml_zk_proofs
|
||||
from ..contexts.zk_applications.routers.zk_applications import router as zk_applications
|
||||
from ..contexts.zk_applications.routers.ml_zk_proofs import router as ml_zk_proofs
|
||||
|
||||
# Agent coordination routers moved to contexts/agent_coordination
|
||||
from .contexts.agent_coordination.routers.agent_router import router as agent_router
|
||||
from .contexts.agent_coordination.routers.agent_integration_router import router as agent_integration_router
|
||||
from .contexts.agent_coordination.routers.agent_creativity import router as agent_creativity
|
||||
from .contexts.agent_coordination.routers.agent_performance import router as agent_performance
|
||||
from .contexts.agent_coordination.routers.swarm import router as swarm
|
||||
from ..contexts.agent_coordination.routers.agent_router import router as agent_router
|
||||
from ..contexts.agent_coordination.routers.agent_integration_router import router as agent_integration_router
|
||||
from ..contexts.agent_coordination.routers.agent_creativity import router as agent_creativity
|
||||
from ..contexts.agent_coordination.routers.agent_performance import router as agent_performance
|
||||
from ..contexts.agent_coordination.routers.swarm import router as swarm
|
||||
|
||||
# Enterprise integration router moved to contexts/enterprise_integration
|
||||
from .contexts.enterprise_integration.routers.partners import router as partners
|
||||
from ..contexts.enterprise_integration.routers.partners import router as partners
|
||||
|
||||
# Advanced AI router moved to contexts/advanced_ai
|
||||
from .contexts.advanced_ai.routers.adaptive_learning_health import router as adaptive_learning_health
|
||||
from ..contexts.advanced_ai.routers.adaptive_learning_health import router as adaptive_learning_health
|
||||
|
||||
# Ecosystem router moved to contexts/ecosystem
|
||||
from .contexts.ecosystem.routers.ecosystem_dashboard import router as ecosystem_dashboard
|
||||
from ..contexts.ecosystem.routers.ecosystem_dashboard import router as ecosystem_dashboard
|
||||
|
||||
# GPU multimodal router moved to contexts/gpu_multimodal
|
||||
from .contexts.gpu_multimodal.routers.gpu_multimodal_health import router as gpu_multimodal_health
|
||||
from ..contexts.gpu_multimodal.routers.gpu_multimodal_health import router as gpu_multimodal_health
|
||||
|
||||
# Settlement router moved to contexts/settlement
|
||||
from .contexts.settlement.routers.settlement import router as settlement
|
||||
from ..contexts.settlement.routers.settlement import router as settlement
|
||||
|
||||
# Infrastructure routers moved to contexts/infrastructure
|
||||
from .contexts.infrastructure.routers.monitor import router as monitor
|
||||
from .contexts.infrastructure.routers.monitoring_dashboard import router as monitoring_dashboard
|
||||
from ..contexts.infrastructure.routers.monitor import router as monitor
|
||||
from ..contexts.infrastructure.routers.monitoring_dashboard import router as monitoring_dashboard
|
||||
|
||||
__all__ = [
|
||||
"client",
|
||||
@@ -125,9 +135,6 @@ __all__ = [
|
||||
"cache_management",
|
||||
"agent_identity",
|
||||
"blockchain",
|
||||
"global_marketplace",
|
||||
"cross_chain_integration",
|
||||
"global_marketplace_integration",
|
||||
"developer_platform",
|
||||
"governance",
|
||||
"governance_enhanced",
|
||||
|
||||
@@ -14,7 +14,7 @@ from ..custom_types import JobState
|
||||
from ..deps import require_client_key
|
||||
from ..schemas import JobCreate, JobPaymentCreate, JobResult, JobView
|
||||
from ..services import JobService
|
||||
from ..services.payments import PaymentService
|
||||
from ..contexts.payments.services.payments import PaymentService
|
||||
from ..storage import get_session
|
||||
from ..utils.cache import cached, get_cache_config
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ from ..schemas.pricing import (
|
||||
PricingStrategyRequest,
|
||||
PricingStrategyResponse,
|
||||
)
|
||||
from ..services.trading_marketplace.dynamic_pricing import DynamicPricingEngine, PriceConstraints, PricingStrategy, ResourceType
|
||||
from ..contexts.trading.services.trading_marketplace.dynamic_pricing import DynamicPricingEngine, PriceConstraints, PricingStrategy, ResourceType
|
||||
from ..services.market_data_collector import MarketDataCollector
|
||||
|
||||
router = APIRouter(prefix="/v1/pricing", tags=["dynamic-pricing"])
|
||||
|
||||
@@ -23,7 +23,7 @@ from ..schemas import (
|
||||
WalletBalanceResponse,
|
||||
WalletInfoResponse,
|
||||
)
|
||||
from ..services.bitcoin_wallet import get_wallet_balance, get_wallet_info
|
||||
from ..contexts.wallet.services.bitcoin_wallet import get_wallet_balance, get_wallet_info
|
||||
from ..utils.cache import cached, get_cache_config
|
||||
|
||||
router = APIRouter(tags=["exchange"])
|
||||
@@ -127,7 +127,7 @@ async def confirm_payment(
|
||||
|
||||
# Mint AITBC tokens to user's wallet
|
||||
try:
|
||||
from ..services.blockchain import mint_tokens
|
||||
from ..contexts.blockchain.services.blockchain import mint_tokens
|
||||
|
||||
mint_tokens(payment["user_id"], payment["aitbc_amount"])
|
||||
except Exception as e:
|
||||
|
||||
@@ -25,7 +25,7 @@ from ..schemas.marketplace_enhanced import (
|
||||
RoyaltyDistributionRequest,
|
||||
RoyaltyDistributionResponse,
|
||||
)
|
||||
from ..services.marketplace_enhanced import EnhancedMarketplaceService
|
||||
from ..contexts.marketplace.services.marketplace_enhanced import EnhancedMarketplaceService
|
||||
from ..storage import get_session
|
||||
|
||||
router = APIRouter(prefix="/marketplace/enhanced", tags=["Enhanced Marketplace"])
|
||||
|
||||
@@ -16,7 +16,7 @@ from sqlalchemy.orm import Session
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
|
||||
from aitbc import get_logger
|
||||
from ..services.marketplace_enhanced import EnhancedMarketplaceService
|
||||
from ..contexts.marketplace.services.marketplace_enhanced import EnhancedMarketplaceService
|
||||
from ..storage import get_session
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
@@ -19,7 +19,7 @@ from sqlmodel import Session
|
||||
from aitbc import get_logger
|
||||
from aitbc.rate_limiting import rate_limit
|
||||
from ..deps import require_admin_key
|
||||
from ..services.marketplace_enhanced_simple import EnhancedMarketplaceService, LicenseType, VerificationType
|
||||
from ..contexts.marketplace.services.marketplace_enhanced_simple import EnhancedMarketplaceService, LicenseType, VerificationType
|
||||
from ..storage import get_session
|
||||
|
||||
router = APIRouter(prefix="/marketplace/enhanced", tags=["Marketplace Enhanced"])
|
||||
|
||||
@@ -102,7 +102,7 @@ async def submit_result(
|
||||
|
||||
# Auto-release payment if job has payment
|
||||
if job.payment_id and job.payment_status == "escrowed":
|
||||
from ..services.payments import PaymentService
|
||||
from ..contexts.payments.services.payments import PaymentService
|
||||
|
||||
payment_service = PaymentService(session)
|
||||
success = await payment_service.release_payment(job.id, job.payment_id, reason="Job completed successfully")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from .wallet import TransactionStatus, WalletType
|
||||
from ..domain.wallet import TransactionStatus, WalletType
|
||||
|
||||
|
||||
class WalletCreate(BaseModel):
|
||||
|
||||
@@ -9,7 +9,7 @@ Adaptive Learning Service - FastAPI Entry Point
|
||||
from fastapi import Depends, FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from ..routers.adaptive_learning_health import router as health_router
|
||||
from ..contexts.advanced_ai.routers.adaptive_learning_health import router as health_router
|
||||
from ..storage import get_session
|
||||
from .adaptive_learning import AdaptiveLearningService, LearningAlgorithm
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from datetime import datetime, timezone, timedelta
|
||||
from enum import StrEnum
|
||||
from typing import Any
|
||||
|
||||
from ..cross_chain_reputation import CrossChainReputationService
|
||||
from app.contexts.cross_chain.services.cross_chain.reputation import CrossChainReputationService
|
||||
|
||||
|
||||
class MessageType(StrEnum):
|
||||
|
||||
@@ -13,7 +13,7 @@ from datetime import datetime, timezone, timedelta
|
||||
from enum import StrEnum
|
||||
from typing import Any
|
||||
|
||||
from ..bid_strategy_engine import BidResult
|
||||
from app.contexts.trading.services.trading_marketplace.bid_strategy import BidResult
|
||||
from ..task_decomposition import GPU_Tier, SubTask, SubTaskStatus, TaskDecomposition
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
|
||||
from ..models.confidential import ConfidentialTransaction
|
||||
from ..services.encryption import EncryptionService
|
||||
from ..services.key_management import KeyManager
|
||||
from ..contexts.security.services.encryption import EncryptionService
|
||||
from ..contexts.security.services.key_management import KeyManager
|
||||
|
||||
|
||||
class ConfidentialTransactionService:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user