refactor(cleanup): remove legacy runtime directories and fix API semantics
Task 1: Clean up root-level runtime directories
- Backup live/, backtest/, production/ to runs/_legacy/
- Remove legacy directories from repo root
Task 2: API route semantics cleanup
- Create /api/runs/{run_id}/agents/* routes for runtime agent operations
- Keep /api/workspaces/{id}/agents/* for design-time (deprecated)
- Update frontend runtimeApi.js to use new /runs/ prefix
- Update legacy-inventory.md with completion status
New files:
- backend/api/runs.py - Runtime agent routes with proper run_id semantics
Modified:
- backend/api/__init__.py - Export runs_router
- backend/apps/agent_service.py - Include runs_router, update scope docs
- frontend/src/services/runtimeApi.js - Use /runs/ instead of /workspaces/
- docs/legacy-inventory.md - Mark cleanup as completed
Constraint: Maintain backward compatibility with old /workspaces/ routes
Rejected: Remove old routes entirely | need backward compatibility during transition
Confidence: high
Scope-risk: moderate
Directive: Old /api/workspaces/ routes remain functional but deprecated
Not-tested: Full integration test with active runtime
This commit is contained in:
@@ -11,7 +11,7 @@ from fastapi import FastAPI
|
||||
|
||||
from backend.apps.cors import add_cors_middleware
|
||||
|
||||
from backend.api import agents_router, guard_router, workspaces_router
|
||||
from backend.api import agents_router, guard_router, workspaces_router, runs_router
|
||||
from backend.agents import AgentFactory, WorkspaceManager, get_registry
|
||||
|
||||
# Global instances (initialized on startup)
|
||||
@@ -30,9 +30,9 @@ def _build_scope_payload(project_root: Path) -> dict[str, object]:
|
||||
"meaning": "Run-scoped runtime state and agent assets",
|
||||
},
|
||||
"agent_route_note": (
|
||||
"On `/api/workspaces/{workspace_id}/agents/...`, design-time CRUD "
|
||||
"routes still use `workspaces/`, while profile/skills/file routes "
|
||||
"use `workspace_id` as a run id under `runs/<run_id>/`."
|
||||
"Runtime routes use `/api/runs/{run_id}/agents/...`. "
|
||||
"Legacy `/api/workspaces/{workspace_id}/agents/...` routes are deprecated "
|
||||
"but remain for backward compatibility."
|
||||
),
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ def create_app(project_root: Path | None = None) -> FastAPI:
|
||||
|
||||
app.include_router(workspaces_router)
|
||||
app.include_router(agents_router)
|
||||
app.include_router(runs_router)
|
||||
app.include_router(guard_router)
|
||||
return app
|
||||
|
||||
|
||||
Reference in New Issue
Block a user