Problem
The rich file preview path for Cloud conversations still fetches file bytes through /api/file/download and converts them into data: URLs. That breaks previews that depend on relative assets, especially HTML files with sibling CSS/JS/images.
Current code path:
src/hooks/query/use-workspace-file-content.ts
- local mode uses the static workspace fileserver URL from
useWorkspaceSession() and renders images/PDFs/HTML-ish content from a real URL.
- cloud mode calls
AgentServerRuntimeService.downloadFile() and creates a data: URL.
src/api/runtime-service/agent-server-runtime-service.ts
- cloud mode calls the runtime endpoint
/api/file/download?path=... through callCloudProxy().
A data:text/html;base64,... document has no useful workspace-relative base URL, so relative references like ./style.css, ./bundle.js, or images cannot resolve to the runtime's static webserver. The result is a broken rich file view even though the runtime could serve those assets as static files.
I did not find an existing agent-canvas issue specifically tracking this. #205 is about trajectory export downloads and is unrelated.
Expected behavior
Cloud rich file previews should render from a browser-reachable static workspace URL (or an equivalent proxy URL that preserves path/base semantics), not from /api/file/download data URIs, so relative assets resolve correctly.
Possible approaches:
- Expose/mint a Cloud-compatible static workspace session URL whose cookies/auth work in the browser.
- Add a same-origin proxy route that serves workspace files with stable paths and forwards auth server-side.
- For HTML previews, inject a
<base href="..."> only if that can be done safely and all asset requests remain authenticated.
Acceptance criteria
- HTML files in Cloud conversations can load sibling CSS/JS/image assets in the rich file viewer.
- The preview path no longer depends on
data: URLs for renderable rich documents that need relative assets.
- Binary/text fallback behavior still works.
- Regression coverage includes a Cloud-mode HTML file with at least one relative asset.
This issue was created by an AI agent (OpenHands) on behalf of the user.
Problem
The rich file preview path for Cloud conversations still fetches file bytes through
/api/file/downloadand converts them intodata:URLs. That breaks previews that depend on relative assets, especially HTML files with sibling CSS/JS/images.Current code path:
src/hooks/query/use-workspace-file-content.tsuseWorkspaceSession()and renders images/PDFs/HTML-ish content from a real URL.AgentServerRuntimeService.downloadFile()and creates adata:URL.src/api/runtime-service/agent-server-runtime-service.ts/api/file/download?path=...throughcallCloudProxy().A
data:text/html;base64,...document has no useful workspace-relative base URL, so relative references like./style.css,./bundle.js, or images cannot resolve to the runtime's static webserver. The result is a broken rich file view even though the runtime could serve those assets as static files.I did not find an existing agent-canvas issue specifically tracking this. #205 is about trajectory export downloads and is unrelated.
Expected behavior
Cloud rich file previews should render from a browser-reachable static workspace URL (or an equivalent proxy URL that preserves path/base semantics), not from
/api/file/downloaddata URIs, so relative assets resolve correctly.Possible approaches:
<base href="...">only if that can be done safely and all asset requests remain authenticated.Acceptance criteria
data:URLs for renderable rich documents that need relative assets.This issue was created by an AI agent (OpenHands) on behalf of the user.