Add safe editing for text files opened from chat output
Problem
The file viewer can preview text and download it, but it cannot save a change. The current server routes are read-only. Users must leave the web UI to edit a Markdown or JSON file. This complements the file-opening work in #691 and the user-file links in #730.
Proposal
Design a separate write API for approved text files. Validate the pane sandbox and file type on the server. Use atomic writes, a file revision or hash for conflict detection, and an explicit save result. Add the same checks to the remote machine proxy. Add a small editor with syntax-aware plain text and a clear conflict state.
Acceptance
- Only approved text files under the pane sandbox can be written.
- A stale revision returns a conflict and does not overwrite the file.
- Writes are atomic and preserve file permissions where supported.
- Remote and local panes use the same authorization rules.
- The UI never executes HTML or SVG content.
- Security, API, and browser tests cover traversal, conflict, cancel, and save.
Screenshots
Add editor, conflict, and permission-error screenshots here.
Follow-up: #1196 proposes a Markdown documents panel (list, search, open, edit, create, delete) that would use the write API proposed here for its Save, with the same revision check and sandbox rules.