From af417e5faa0dfd9dbb9abc4765708a74aa913bbc Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 25 Feb 2026 19:44:18 -0600 Subject: [PATCH] refac --- open_terminal/main.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/open_terminal/main.py b/open_terminal/main.py index a8cfc97..832a305 100644 --- a/open_terminal/main.py +++ b/open_terminal/main.py @@ -462,6 +462,24 @@ async def read_file( } +@app.get( + "/files/display", + operation_id="display_file", + summary="Display a file to the user", + description="Open a file in the user's file viewer so they can see it. Use this when the user wants to view or look at a file. This does not return file content to you — use read_file if you need to read the content yourself.", + dependencies=[Depends(verify_api_key)], + responses={ + 401: {"description": "Invalid or missing API key."}, + }, +) +async def display_file( + path: str = Query(..., description="Absolute path to the file to display."), +): + target = os.path.abspath(path) + exists = await aiofiles.os.path.isfile(target) + return {"path": target, "exists": exists} + + @app.get( "/files/view", include_in_schema=False, @@ -1093,7 +1111,7 @@ async def get_status( ): background_process = _get_process(process_id) - if wait and background_process.status == "running": + if wait is not None and background_process.status == "running": try: await asyncio.wait_for( asyncio.shield(background_process.log_task), timeout=wait