The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(webapp): play videos over 100 MiB in chat
Tekniumc93394528569
diff --git a/hermes_cli/web_routers/files.py b/hermes_cli/web_routers/files.pyindex 9927020be3b..80c83e0cb98 100644--- a/hermes_cli/web_routers/files.py+++ b/hermes_cli/web_routers/files.py@@ -691,7 +691,9 @@ async def _managed_file_response(content_disposition_type: str,media_only: bool = False,) -> FileResponse:- """Range-aware response after applying managed-file policy."""+ """Range-aware response after applying managed-file policy. A player source+ (``media_only``) has no size cap: it is served from disk one Range at a+ time, as an SSH profile's clip already is, so a long recording plays."""authority = getattr(request.state, "file_ticket_authority", None)if authority is not None:from hermes_cli.web_server_file_response import OpenedFileResponse@@ -707,7 +709,8 @@ async def _managed_file_response(_policy, target, _display_path, max_bytes, mime_type = _managed_readable_file(request, path)if media_only and target.suffix.lower() not in _STREAMABLE_MEDIA_EXTENSIONS:raise HTTPException(status_code=415, detail="Unsupported media type")- _managed_file_size(target, max_bytes)+ if not media_only:+ _managed_file_size(target, max_bytes)await asyncio.to_thread(_refuse_live_database, target)return FileResponse(path=str(target),@@ -726,7 +729,7 @@ def _open_ticket_file(request: Request, authority: file_tickets.FileAuthority, *)if media_only and target.suffix.lower() not in _STREAMABLE_MEDIA_EXTENSIONS:raise HTTPException(status_code=415, detail="Unsupported media type")- return target, max_bytes+ return target, None if media_only else max_bytesreturn _pin_ticket_file(authority, checked)@@ -833,7 +836,7 @@ async def stream_managed_file(media pipeline may reject an attachment response as an ``<audio>``/``<video>`` source. Browser media elements authenticate with a reusablepath-bound ``?ticket=``; the session token is never accepted in this URL.- Same size cap, sensitive guard and MIME detection as download. A+ No size cap (Range-served); sensitive guard and MIME detection as download. A``session_id`` resolves ``/workspace`` in that session's own sandbox, as theticket route does. An SSH profile's clip streams from its SSH machine(``_remote_fs_backend``, the rule download uses), one Range at a time.diff --git a/tests/hermes_cli/test_web_server_files.py b/tests/hermes_cli/test_web_server_files.pyindex 51df8982792..0f3abf4fd9c 100644--- a/tests/hermes_cli/test_web_server_files.py+++ b/tests/hermes_cli/test_web_server_files.py@@ -339,7 +339,12 @@ def test_stream_file_uri_uses_host_resolution_without_bypassing_policy(200 if locked else 400)monkeypatch.setattr(web_server, "_MANAGED_FILE_MAX_BYTES", 1)- assert client.get("/api/files/stream", params=params).status_code == 413+ # A player source streams one Range at a time, so the whole-file cap that guards the+ # base64 read and attachment download never stops a long recording from playing.+ capped = client.get("/api/files/stream", params=params, headers={"Range": "bytes=1-3"})+ assert capped.status_code == 206, capped.text+ assert capped.content == b"ell"+ assert client.get("/api/files/read", params={"path": str(artifact)}).status_code == 413@pytest.mark.platforms("windows")