Deprecate V0 endpoints now handled by agent server (#12710)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Tim O'Farrell
2026-02-02 07:25:00 -07:00
committed by GitHub
parent d1f0a01a57
commit 0f05898d55
2 changed files with 36 additions and 2 deletions

View File

@@ -305,7 +305,7 @@ class AddMessageRequest(BaseModel):
message: str
@app.post('/message')
@app.post('/message', deprecated=True)
async def add_message(
data: AddMessageRequest,
conversation: ServerConversation = Depends(get_conversation),
@@ -321,6 +321,9 @@ async def add_message(
Returns:
JSONResponse: A JSON response indicating the success of the operation
For V1 conversations, messages are handled through the agent server.
Use the sandbox's exposed agent server URL to send messages.
"""
try:
# Create a MessageAction from the provided message text

View File

@@ -47,6 +47,7 @@ app = APIRouter(
404: {'description': 'Runtime not initialized', 'model': dict},
500: {'description': 'Error listing or filtering files', 'model': dict},
},
deprecated=True,
)
async def list_files(
conversation: ServerConversation = Depends(get_conversation),
@@ -71,6 +72,9 @@ async def list_files(
Raises:
HTTPException: If there's an error listing the files.
For V1 conversations, file operations are handled through the agent server.
Use the sandbox's exposed agent server URL to access file operations.
"""
if not conversation.runtime:
return JSONResponse(
@@ -131,6 +135,7 @@ async def list_files(
500: {'description': 'Error opening file', 'model': dict},
415: {'description': 'Unsupported media type', 'model': dict},
},
deprecated=True,
)
async def select_file(
file: str, conversation: ServerConversation = Depends(get_conversation)
@@ -152,6 +157,9 @@ async def select_file(
Raises:
HTTPException: If there's an error opening the file.
For V1 conversations, file operations are handled through the agent server.
Use the sandbox's exposed agent server URL to access file operations.
"""
runtime: Runtime = conversation.runtime
@@ -197,10 +205,16 @@ async def select_file(
200: {'description': 'Zipped workspace returned as FileResponse'},
500: {'description': 'Error zipping workspace', 'model': dict},
},
deprecated=True,
)
def zip_current_workspace(
conversation: ServerConversation = Depends(get_conversation),
) -> FileResponse | JSONResponse:
"""Download the current workspace as a zip file.
For V1 conversations, file operations are handled through the agent server.
Use the sandbox's exposed agent server URL to access file operations.
"""
try:
logger.debug('Zipping workspace')
runtime: Runtime = conversation.runtime
@@ -234,12 +248,18 @@ def zip_current_workspace(
404: {'description': 'Not a git repository', 'model': dict},
500: {'description': 'Error getting changes', 'model': dict},
},
deprecated=True,
)
async def git_changes(
conversation: ServerConversation = Depends(get_conversation),
conversation_store: ConversationStore = Depends(get_conversation_store),
user_id: str = Depends(get_user_id),
) -> list[dict[str, str]] | JSONResponse:
"""Get git changes in the workspace.
For V1 conversations, git operations are handled through the agent server.
Use the sandbox's exposed agent server URL to access git operations.
"""
runtime: Runtime = conversation.runtime
cwd = runtime.config.workspace_mount_path_in_sandbox
@@ -271,12 +291,18 @@ async def git_changes(
'/git/diff',
response_model=dict[str, Any],
responses={500: {'description': 'Error getting diff', 'model': dict}},
deprecated=True,
)
async def git_diff(
path: str,
conversation_store: Any = Depends(get_conversation_store),
conversation: ServerConversation = Depends(get_conversation),
) -> dict[str, Any] | JSONResponse:
"""Get git diff for a specific file.
For V1 conversations, git operations are handled through the agent server.
Use the sandbox's exposed agent server URL to access git operations.
"""
runtime: Runtime = conversation.runtime
cwd = runtime.config.workspace_mount_path_in_sandbox
@@ -292,11 +318,16 @@ async def git_diff(
)
@app.post('/upload-files', response_model=POSTUploadFilesModel)
@app.post('/upload-files', response_model=POSTUploadFilesModel, deprecated=True)
async def upload_files(
files: list[UploadFile],
conversation: ServerConversation = Depends(get_conversation),
):
"""Upload files to the workspace.
For V1 conversations, file operations are handled through the agent server.
Use the sandbox's exposed agent server URL to access file operations.
"""
uploaded_files = []
skipped_files = []
runtime: Runtime = conversation.runtime