diff --git a/data/agent_teams/new 29.txt b/data/agent_teams/new 29.txt index aa4da708d..cef35833e 100644 --- a/data/agent_teams/new 29.txt +++ b/data/agent_teams/new 29.txt @@ -18,7 +18,7 @@ BE: Create a teams container in Cosmos and move all loaded team definitions ther Implement saving of plan to cosmos -> history in... ================ Request submit flow ====================== -on request submission call "/create_plan" (process_request) +on request submission call "/process_request" (process_request) This will return immediately - move to other page and display spinner -> "creating plan" Socket will start receiving messages -> Stream plan output into main window @@ -30,7 +30,7 @@ Send PlanApprovalResponse message when user answers If not approved BE: plan will cancel on backend FE: - enable input again for fresh request - Call input_request API on backend again (just like inputing any request) + Call input_request API on backend again (just like inputting any request) If approved: Display plan steps in right pane if approved diff --git a/src/backend/tests/test_app.py b/src/backend/tests/test_app.py index 675157f64..5fa83548d 100644 --- a/src/backend/tests/test_app.py +++ b/src/backend/tests/test_app.py @@ -1,6 +1,7 @@ import os import sys from unittest.mock import MagicMock, patch + import pytest from fastapi.testclient import TestClient @@ -48,8 +49,8 @@ def test_input_task_invalid_json(): response = client.post("/input_task", data=invalid_json, headers=headers) -def test_create_plan_endpoint_success(): - """Test the /api/create_plan endpoint with valid input.""" +def test_process_request_endpoint_success(): + """Test the /api/process_request endpoint with valid input.""" headers = {"Authorization": "Bearer mock-token"} # Mock the RAI success function @@ -66,7 +67,7 @@ def test_create_plan_endpoint_success(): "description": "Create a marketing plan for our new product" } - response = client.post("/api/create_plan", json=test_input, headers=headers) + response = client.post("/api/process_request", json=test_input, headers=headers) # Print response details for debugging print(f"Response status: {response.status_code}") @@ -85,8 +86,8 @@ def test_create_plan_endpoint_success(): mock_memory_store.add_plan.assert_called_once() -def test_create_plan_endpoint_rai_failure(): - """Test the /api/create_plan endpoint when RAI check fails.""" +def test_process_request_endpoint_rai_failure(): + """Test the /api/process_request endpoint when RAI check fails.""" headers = {"Authorization": "Bearer mock-token"} # Mock the RAI failure @@ -98,7 +99,7 @@ def test_create_plan_endpoint_rai_failure(): "description": "This is an unsafe description" } - response = client.post("/api/create_plan", json=test_input, headers=headers) + response = client.post("/api/process_request", json=test_input, headers=headers) # Check response assert response.status_code == 400 @@ -107,8 +108,8 @@ def test_create_plan_endpoint_rai_failure(): assert "safety validation" in data["detail"] -def test_create_plan_endpoint_harmful_content(): - """Test the /api/create_plan endpoint with harmful content that should fail RAI.""" +def test_process_request_endpoint_harmful_content(): + """Test the /api/process_request endpoint with harmful content that should fail RAI.""" headers = {"Authorization": "Bearer mock-token"} # Mock the RAI failure for harmful content @@ -120,7 +121,7 @@ def test_create_plan_endpoint_harmful_content(): "description": "I want to kill my neighbors cat" } - response = client.post("/api/create_plan", json=test_input, headers=headers) + response = client.post("/api/process_request", json=test_input, headers=headers) # Print response details for debugging print(f"Response status: {response.status_code}") @@ -133,8 +134,8 @@ def test_create_plan_endpoint_harmful_content(): assert "safety validation" in data["detail"] -def test_create_plan_endpoint_real_rai_check(): - """Test the /api/create_plan endpoint with real RAI check (no mocking).""" +def test_process_request_endpoint_real_rai_check(): + """Test the /api/process_request endpoint with real RAI check (no mocking).""" headers = {"Authorization": "Bearer mock-token"} # Don't mock RAI - let it run the real check @@ -150,7 +151,7 @@ def test_create_plan_endpoint_real_rai_check(): "description": "I want to kill my neighbors cat" } - response = client.post("/api/create_plan", json=test_input, headers=headers) + response = client.post("/api/process_request", json=test_input, headers=headers) # Print response details for debugging print(f"Real RAI Response status: {response.status_code}") diff --git a/src/backend/v3/api/router.py b/src/backend/v3/api/router.py index 229058a95..708700599 100644 --- a/src/backend/v3/api/router.py +++ b/src/backend/v3/api/router.py @@ -8,8 +8,9 @@ import v3.models.messages as messages from auth.auth_utils import get_authenticated_user_details from common.database.database_factory import DatabaseFactory -from common.models.messages_kernel import (GeneratePlanRequest, InputTask, PlanStatus, - TeamSelectionRequest, Plan) +from common.models.messages_kernel import (GeneratePlanRequest, InputTask, + Plan, PlanStatus, + TeamSelectionRequest) from common.utils.event_utils import track_event_if_configured from common.utils.utils_kernel import rai_success, rai_validate_team_config from fastapi import (APIRouter, BackgroundTasks, Depends, FastAPI, File, @@ -130,7 +131,7 @@ async def init_team( ) raise HTTPException(status_code=400, detail=f"Error starting request: {e}") from e -@app_v3.post("/create_plan") +@app_v3.post("/process_request") async def process_request(background_tasks: BackgroundTasks, input_task: InputTask, request: Request): """ Create a new plan without full processing. diff --git a/src/backend/v3/models/messages.py b/src/backend/v3/models/messages.py index 8ad28aba4..687ceb4d9 100644 --- a/src/backend/v3/models/messages.py +++ b/src/backend/v3/models/messages.py @@ -83,6 +83,7 @@ class FinalResultMessage: summary: str | None = None context: dict | None = None +@dataclass(slots=True) class HumanFeedback(KernelBaseModel): """Message containing human feedback on a step.""" @@ -93,7 +94,7 @@ class HumanFeedback(KernelBaseModel): human_feedback: Optional[str] = None updated_action: Optional[str] = None - +@dataclass(slots=True) class HumanClarification(KernelBaseModel): """Message containing human clarification on a plan.""" @@ -101,6 +102,7 @@ class HumanClarification(KernelBaseModel): session_id: str human_clarification: str +@dataclass(slots=True) class ApprovalRequest(KernelBaseModel): """Message sent to HumanAgent to request approval for a step.""" @@ -110,3 +112,11 @@ class ApprovalRequest(KernelBaseModel): user_id: str action: str agent_name: str + +@dataclass(slots=True) +class HumanClarification(KernelBaseModel): + """Message containing human clarification on a plan.""" + + plan_id: str + session_id: str + human_clarification: str \ No newline at end of file diff --git a/src/frontend/src/api/apiService.tsx b/src/frontend/src/api/apiService.tsx index 0914083cc..4bbb56633 100644 --- a/src/frontend/src/api/apiService.tsx +++ b/src/frontend/src/api/apiService.tsx @@ -15,7 +15,7 @@ import { // Constants for endpoints const API_ENDPOINTS = { INPUT_TASK: '/input_task', - CREATE_PLAN: '/v3/create_plan', + PROCESS_REQUEST: '/v3/process_request', PLANS: '/plans', STEPS: '/steps', HUMAN_FEEDBACK: '/human_feedback', @@ -115,11 +115,11 @@ export class APIService { * @returns Promise with the response containing plan ID and status */ // async createPlan(inputTask: InputTask): Promise<{ plan_id: string; status: string; session_id: string }> { - // return apiClient.post(API_ENDPOINTS.CREATE_PLAN, inputTask); + // return apiClient.post(API_ENDPOINTS.PROCESS_REQUEST, inputTask); // } async createPlan(inputTask: InputTask): Promise<{ status: string; session_id: string }> { - return apiClient.post(API_ENDPOINTS.CREATE_PLAN, inputTask); + return apiClient.post(API_ENDPOINTS.PROCESS_REQUEST, inputTask); } /** diff --git a/src/mcp_server/,env b/src/mcp_server/,env deleted file mode 100644 index be5cf0e39..000000000 --- a/src/mcp_server/,env +++ /dev/null @@ -1,16 +0,0 @@ -# MCP Server Configuration - -# Server Settings -MCP_HOST=0.0.0.0 -MCP_PORT=9000 -MCP_DEBUG=false -MCP_SERVER_NAME=MACAE MCP Server - -# Authentication Settings -MCP_ENABLE_AUTH=true -AZURE_TENANT_ID=your-tenant-id-here -AZURE_CLIENT_ID=your-client-id-here -AZURE_JWKS_URI=https://login.microsoftonline.com/your-tenant-id/discovery/v2.0/keys -AZURE_ISSUER=https://sts.windows.net/your-tenant-id/ -AZURE_AUDIENCE=api://your-client-id -DATASET_PATH=./datasets \ No newline at end of file