- Migrate OpenClaw from HTTP (port 8004) to WebSocket (port 18789) - Add workspace file list and content preview handlers - Add OpenClawStatus component with agent/skills view - Add OpenClawView panel in trader interface - Add Zustand store for OpenClaw state management - Fix gateway logging noise (yfinance, websockets) - Fix RunWorkspaceManager.get_agent_asset_dir attribute error - Handle missing workspace files gracefully in preview Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Read-only OpenClaw CLI FastAPI surface."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import Depends, FastAPI
|
|
|
|
from backend.api import openclaw_router
|
|
from backend.apps.cors import add_cors_middleware
|
|
from backend.api.openclaw import get_openclaw_cli_service
|
|
|
|
|
|
def create_app() -> FastAPI:
|
|
"""Create the OpenClaw service app."""
|
|
app = FastAPI(
|
|
title="EvoTraders OpenClaw Service",
|
|
description="Read-only OpenClaw CLI integration service surface",
|
|
version="0.1.0",
|
|
)
|
|
|
|
add_cors_middleware(app)
|
|
|
|
@app.get("/health")
|
|
async def health_check(
|
|
service=Depends(get_openclaw_cli_service),
|
|
) -> dict[str, object]:
|
|
return service.health()
|
|
|
|
@app.get("/api/status")
|
|
async def api_status(
|
|
service=Depends(get_openclaw_cli_service),
|
|
) -> dict[str, object]:
|
|
return {
|
|
"status": "operational",
|
|
"service": "openclaw-service",
|
|
"openclaw": service.health(),
|
|
}
|
|
|
|
app.include_router(openclaw_router)
|
|
return app
|
|
|
|
|
|
app = create_app()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
|
|
uvicorn.run(app, host="0.0.0.0", port=8004)
|