Merge branch 'aitbc1/debug-services' into main and apply local fixes
Some checks failed
AITBC CI/CD Pipeline / lint-and-test (3.11) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (push) Has been cancelled
AITBC CI/CD Pipeline / test-cli (push) Has been cancelled
AITBC CI/CD Pipeline / test-services (push) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (push) Has been cancelled
AITBC CI/CD Pipeline / security-scan (push) Has been cancelled
AITBC CI/CD Pipeline / build (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (push) Has been cancelled
AITBC CI/CD Pipeline / performance-test (push) Has been cancelled
AITBC CI/CD Pipeline / docs (push) Has been cancelled
AITBC CI/CD Pipeline / release (push) Has been cancelled
AITBC CI/CD Pipeline / notify (push) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (push) Has been cancelled
Security Scanning / Dependency Security Scan (push) Has been cancelled
Security Scanning / Container Security Scan (push) Has been cancelled
Security Scanning / OSSF Scorecard (push) Has been cancelled
Security Scanning / Security Summary Report (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.11) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.12) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.13) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-summary (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.11) (pull_request) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (pull_request) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (pull_request) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (pull_request) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (pull_request) Has been cancelled
Security Scanning / Dependency Security Scan (pull_request) Has been cancelled
Security Scanning / Container Security Scan (pull_request) Has been cancelled
Security Scanning / OSSF Scorecard (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-cli (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-services (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (pull_request) Has been cancelled
AITBC CI/CD Pipeline / security-scan (pull_request) Has been cancelled
AITBC CI/CD Pipeline / build (pull_request) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (pull_request) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (pull_request) Has been cancelled
AITBC CI/CD Pipeline / performance-test (pull_request) Has been cancelled
AITBC CI/CD Pipeline / docs (pull_request) Has been cancelled
AITBC CI/CD Pipeline / release (pull_request) Has been cancelled
AITBC CI/CD Pipeline / notify (pull_request) Has been cancelled
Security Scanning / Security Summary Report (pull_request) Has been cancelled
Some checks failed
AITBC CI/CD Pipeline / lint-and-test (3.11) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (push) Has been cancelled
AITBC CI/CD Pipeline / test-cli (push) Has been cancelled
AITBC CI/CD Pipeline / test-services (push) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (push) Has been cancelled
AITBC CI/CD Pipeline / security-scan (push) Has been cancelled
AITBC CI/CD Pipeline / build (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (push) Has been cancelled
AITBC CI/CD Pipeline / performance-test (push) Has been cancelled
AITBC CI/CD Pipeline / docs (push) Has been cancelled
AITBC CI/CD Pipeline / release (push) Has been cancelled
AITBC CI/CD Pipeline / notify (push) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (push) Has been cancelled
Security Scanning / Dependency Security Scan (push) Has been cancelled
Security Scanning / Container Security Scan (push) Has been cancelled
Security Scanning / OSSF Scorecard (push) Has been cancelled
Security Scanning / Security Summary Report (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.11) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.12) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.13) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-summary (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.11) (pull_request) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (pull_request) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (pull_request) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (pull_request) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (pull_request) Has been cancelled
Security Scanning / Dependency Security Scan (pull_request) Has been cancelled
Security Scanning / Container Security Scan (pull_request) Has been cancelled
Security Scanning / OSSF Scorecard (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-cli (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-services (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (pull_request) Has been cancelled
AITBC CI/CD Pipeline / security-scan (pull_request) Has been cancelled
AITBC CI/CD Pipeline / build (pull_request) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (pull_request) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (pull_request) Has been cancelled
AITBC CI/CD Pipeline / performance-test (pull_request) Has been cancelled
AITBC CI/CD Pipeline / docs (pull_request) Has been cancelled
AITBC CI/CD Pipeline / release (pull_request) Has been cancelled
AITBC CI/CD Pipeline / notify (pull_request) Has been cancelled
Security Scanning / Security Summary Report (pull_request) Has been cancelled
This commit is contained in:
@@ -16,6 +16,7 @@ from .mempool import init_mempool
|
||||
from .metrics import metrics_registry
|
||||
from .rpc.router import router as rpc_router
|
||||
from .rpc.websocket import router as websocket_router
|
||||
from .escrow_routes import router as escrow_router
|
||||
|
||||
_app_logger = get_logger("aitbc_chain.app")
|
||||
|
||||
@@ -128,9 +129,12 @@ def create_app() -> FastAPI:
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# Include routers
|
||||
app.include_router(rpc_router, prefix="/rpc", tags=["rpc"])
|
||||
app.include_router(websocket_router, prefix="/rpc")
|
||||
app.include_router(escrow_router, prefix="/rpc")
|
||||
|
||||
# Metrics and health endpoints
|
||||
metrics_router = APIRouter()
|
||||
|
||||
@metrics_router.get("/metrics", response_class=PlainTextResponse, tags=["metrics"], summary="Prometheus metrics")
|
||||
|
||||
@@ -7,6 +7,9 @@ from sqlalchemy import event
|
||||
|
||||
from .config import settings
|
||||
|
||||
# Import all models to ensure they are registered with SQLModel.metadata
|
||||
from .models import Block, Transaction, Account, Receipt, Escrow # noqa: F401
|
||||
|
||||
_engine = create_engine(f"sqlite:///{settings.db_path}", echo=False)
|
||||
|
||||
@event.listens_for(_engine, "connect")
|
||||
@@ -29,3 +32,6 @@ def init_db() -> None:
|
||||
def session_scope() -> Session:
|
||||
with Session(_engine) as session:
|
||||
yield session
|
||||
|
||||
# Expose engine for escrow routes
|
||||
engine = _engine
|
||||
|
||||
@@ -155,3 +155,12 @@ class Account(SQLModel, table=True):
|
||||
balance: int = 0
|
||||
nonce: int = 0
|
||||
updated_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
|
||||
class Escrow(SQLModel, table=True):
|
||||
__tablename__ = "escrow"
|
||||
job_id: str = Field(primary_key=True)
|
||||
buyer: str = Field(foreign_key="account.address")
|
||||
provider: str = Field(foreign_key="account.address")
|
||||
amount: int
|
||||
created_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
released_at: Optional[datetime] = None
|
||||
|
||||
@@ -468,3 +468,7 @@ def create_app() -> FastAPI:
|
||||
|
||||
|
||||
app = create_app()
|
||||
|
||||
# Register jobs router
|
||||
from .routers import jobs as jobs_router
|
||||
app.include_router(jobs_router.router)
|
||||
|
||||
@@ -33,8 +33,13 @@ else:
|
||||
|
||||
try:
|
||||
from regulatory_reporting import (
|
||||
generate_sar, generate_compliance_summary, list_reports,
|
||||
regulatory_reporter, ReportType, ReportStatus, RegulatoryBody
|
||||
generate_sar as generate_sar_svc,
|
||||
generate_compliance_summary as generate_compliance_summary_svc,
|
||||
list_reports as list_reports_svc,
|
||||
regulatory_reporter,
|
||||
ReportType,
|
||||
ReportStatus,
|
||||
RegulatoryBody
|
||||
)
|
||||
_import_error = None
|
||||
except ImportError as e:
|
||||
@@ -45,7 +50,7 @@ except ImportError as e:
|
||||
f"Required service module 'regulatory_reporting' could not be imported: {_import_error}. "
|
||||
"Ensure coordinator-api dependencies are installed or set AITBC_SERVICES_PATH."
|
||||
)
|
||||
generate_sar = generate_compliance_summary = list_reports = regulatory_reporter = _missing
|
||||
generate_sar_svc = generate_compliance_summary_svc = list_reports_svc = regulatory_reporter = _missing
|
||||
|
||||
class ReportType:
|
||||
pass
|
||||
@@ -91,7 +96,7 @@ def generate_sar(ctx, user_id: str, activity_type: str, amount: float, descripti
|
||||
}
|
||||
|
||||
# Generate SAR
|
||||
result = asyncio.run(generate_sar([activity]))
|
||||
result = asyncio.run(generate_sar_svc([activity]))
|
||||
|
||||
click.echo(f"\n✅ SAR Report Generated Successfully!")
|
||||
click.echo(f"📋 Report ID: {result['report_id']}")
|
||||
@@ -124,7 +129,7 @@ def compliance_summary(ctx, period_start: str, period_end: str):
|
||||
click.echo(f"📈 Duration: {(end_date - start_date).days} days")
|
||||
|
||||
# Generate compliance summary
|
||||
result = asyncio.run(generate_compliance_summary(
|
||||
result = asyncio.run(generate_compliance_summary_svc(
|
||||
start_date.isoformat(),
|
||||
end_date.isoformat()
|
||||
))
|
||||
@@ -169,7 +174,7 @@ def list(ctx, report_type: str, status: str, limit: int):
|
||||
try:
|
||||
click.echo(f"📋 Regulatory Reports")
|
||||
|
||||
reports = list_reports(report_type, status)
|
||||
reports = list_reports_svc(report_type, status)
|
||||
|
||||
if not reports:
|
||||
click.echo(f"✅ No reports found")
|
||||
@@ -454,7 +459,7 @@ def test(ctx, period_start: str, period_end: str):
|
||||
|
||||
# Test SAR generation
|
||||
click.echo(f"\n📋 Test 1: SAR Generation")
|
||||
result = asyncio.run(generate_sar([{
|
||||
result = asyncio.run(generate_sar_svc([{
|
||||
"id": "test_sar_001",
|
||||
"timestamp": datetime.now().isoformat(),
|
||||
"user_id": "test_user_123",
|
||||
@@ -471,13 +476,13 @@ def test(ctx, period_start: str, period_end: str):
|
||||
|
||||
# Test compliance summary
|
||||
click.echo(f"\n📊 Test 2: Compliance Summary")
|
||||
compliance_result = asyncio.run(generate_compliance_summary(period_start, period_end))
|
||||
compliance_result = asyncio.run(generate_compliance_summary_svc(period_start, period_end))
|
||||
click.echo(f" ✅ Compliance Summary: {compliance_result['report_id']}")
|
||||
click.echo(f" 📈 Overall Score: {compliance_result['overall_score']:.1%}")
|
||||
|
||||
# Test report listing
|
||||
click.echo(f"\n📋 Test 3: Report Listing")
|
||||
reports = list_reports()
|
||||
reports = list_reports_svc()
|
||||
click.echo(f" ✅ Total Reports: {len(reports)}")
|
||||
|
||||
# Test export
|
||||
|
||||
@@ -58,8 +58,16 @@ from .commands.regulatory import regulatory
|
||||
from .commands.ai_trading import ai_trading
|
||||
from .commands.advanced_analytics import advanced_analytics_group
|
||||
from .commands.ai_surveillance import ai_surveillance_group
|
||||
from .commands.enterprise_integration import enterprise_integration_group
|
||||
|
||||
# AI provider commands
|
||||
from .commands.ai import ai_group
|
||||
|
||||
# Enterprise integration (optional)
|
||||
try:
|
||||
from .commands.enterprise_integration import enterprise_integration_group
|
||||
except ImportError:
|
||||
enterprise_integration_group = None
|
||||
|
||||
from .commands.explorer import explorer
|
||||
from .plugins import plugin, load_plugins
|
||||
|
||||
@@ -243,6 +251,7 @@ cli.add_command(transfer_control)
|
||||
cli.add_command(agent)
|
||||
cli.add_command(multimodal)
|
||||
cli.add_command(optimize)
|
||||
cli.add_command(ai_group)
|
||||
# cli.add_command(openclaw) # Temporarily disabled
|
||||
cli.add_command(swarm)
|
||||
cli.add_command(chain)
|
||||
@@ -259,6 +268,7 @@ cli.add_command(regulatory)
|
||||
cli.add_command(ai_trading)
|
||||
cli.add_command(advanced_analytics_group)
|
||||
cli.add_command(ai_surveillance_group)
|
||||
if enterprise_integration_group is not None:
|
||||
cli.add_command(enterprise_integration_group)
|
||||
cli.add_command(explorer)
|
||||
cli.add_command(plugin)
|
||||
|
||||
@@ -118,7 +118,13 @@ dependencies = [
|
||||
"tabulate==0.9.0",
|
||||
"colorama==0.4.6",
|
||||
"python-dotenv==1.0.0",
|
||||
"asyncpg==0.31.0"
|
||||
"asyncpg==0.31.0",
|
||||
# Dependencies for service module imports (coordinator-api services)
|
||||
"numpy>=1.26.0",
|
||||
"pandas>=2.0.0",
|
||||
"aiohttp>=3.9.0",
|
||||
"fastapi>=0.111.0",
|
||||
"uvicorn[standard]>=0.30.0"
|
||||
]
|
||||
classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
|
||||
Reference in New Issue
Block a user