Require the ability to upload local files for analysis or context
Environment OS: All (Cross-platform) Browser: All (Chrome, Firefox, Safari, Edge)
Require the ability to upload local files for analysis or context
This is a valuable capability gap. ClawLess runs inside a WebContainer (browser sandbox), so the file upload flow needs to go through the browser's File API rather than a native filesystem path.
Suggested implementation approach:
- Add a file picker button to the UI toolbar — a plain
<input type="file" multiple>element, styled to match the existing UI. - On file selection, read file contents via
FileReader.readAsArrayBuffer()(orreadAsText()for text files). - Write the file into the WebContainer virtual filesystem using
webcontainerInstance.fs.writeFile(path, contents). - The agent (GitClaw/OpenClaw) can then reference the file by its in-container path in subsequent commands.
Format considerations:
- Text files (
.md,.txt,.json,.csv, source code) — straightforward text read and write. - Binary files (PDFs, images, Office docs) — write as
Uint8Array. The agent can use in-container tools (pdftotext, etc.) to extract content if needed.
UX note: Show uploaded files in the left file tree immediately after writing so the user can confirm they landed correctly. A toast notification on successful upload would also help.
@shreyas-lyzr is assigned to this — let us know if you need clarification on any of the WebContainer API specifics.
Implementation path for this:
Browser side: Add a hidden <input type="file" multiple> and a visible drag-drop target zone (or a toolbar button) in the UI. On file select, read the file contents via FileReader.readAsArrayBuffer() or readAsText() depending on mime type.
WebContainer side: Use webcontainerInstance.fs.writeFile(path, content) to write the file into the container filesystem. For binary files, pass a Uint8Array; for text, a string. Write to ~/workspace/<filename> so the file appears in the existing file tree.
File tree refresh: After writing, trigger the existing file tree refresh so the uploaded file appears immediately without a reload.
Size limit: WebContainer's in-memory filesystem has practical limits. Consider adding a client-side check (e.g., reject files > 50MB) with a clear error message rather than letting a large upload silently fail or OOM the container.
Context window consideration: For the "analysis or context" use case, if the uploaded file is intended to be read by the agent, the agent will need to be pointed at the file path explicitly. A UX affordance like auto-inserting @filename into the chat input after upload would improve discoverability.
Assigned to @shreyas-lyzr.