Skip to content

feat(web): open, edit and save files an agent names - #498

Merged
M-Zajace merged 2 commits into
feat/file-accessfrom
feat/file-viewer
Nov 10, 2026
Merged

M-Zajace merged 2 commits into
feat/file-accessfrom
feat/file-viewer

Conversation

@M-Zajace

@M-Zajace M-Zajace commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Stack 3/3 (base: worker/gateway file access).

Summary

  • File paths in an agent's messages become buttons in a thread: inline code that looks like a file (out/report.md, C:\work\q.sql, ~/notes.txt, src/app.ts:12) and Markdown links to files ([report](out/report.md), file:///…).
  • Device setting Open files in (Settings → Interface): Canopy (default) opens the file viewer, Default app asks the worker to open it in its computer's default app.
  • File viewer: Markdown Rendered/Source, other files highlighted with Shiki by extension; Edit loads CodeMirror 6 lazily (language from the file name via @codemirror/language-data, colours from the theme's --code-* tokens and palette); Unsaved changes badge in reserved space, Mod+S, close asks before discarding, conflict when the file changed on disk (Discard and reload), Delete… with confirmation, Open in default app, Copy path, Reload. Editing is off for binary, truncated and >400 KB files (BFF body limit 512 KB).
  • New dependencies (exact): @codemirror/{state,view,commands,language,language-data,search,autocomplete}, @lezer/highlight.
  • Docs: docs/ui-api.md "Pliki wątku".

Verification

  • Web typecheck, lint and vite build clean.
  • Manually tested by the owner in the desktop app on Windows: clickable paths, viewer (Markdown rendered/source, SQL/C#/Go/Python/Rust highlighting), edit + save, unsaved badge, line numbers excluded from selection, Mod+A confined to the file, selection cleared on close.
  • Not checked at phone width.

Copy audit (docs/copy.md §8)

  • Buttons (verb first, sentence case): Edit, Save, Discard changes, Stop editing, Reload, Open in default app, Delete…, Delete file, Cancel, Keep editing, Discard and reload; tooltip Open <path>; Copy path.
  • Dialog titles: Delete file? (confirm button repeats the verb: Delete file), Discard unsaved changes? (confirm Discard changes).
  • Status: badge Unsaved changes; Opening the file…; This file is empty.; Canopy cannot show this file. Open it in its default app.; Showing the first 2 MB. Open the file in its default app to see all of it.; Files over 400 KB open read-only.
  • Errors (what happened → what to do): This file no longer exists., This file is outside the thread's folders, so Canopy cannot open it., Only files can be opened, not folders., The file changed on disk since you opened it. Reload it to see the changes., Open the file again before changing it., This computer is offline. Reconnect it to open files., Update this computer to open files from Canopy., This file is too large to save from Canopy., No app on this computer opened the file. Copy the path instead., The editor could not load. Reload Canopy and try again.
  • Setting: Open files in — "Where a file path in an agent's message opens when you click it." Options Canopy / Default app.
  • No new glossary terms; no text relies on colour alone (badge has text and icon).

File paths in an agent's messages (inline code and Markdown links) are
buttons in a thread. By default they open Canopy's file viewer: Markdown
rendered or as source, other files highlighted by extension, editing in
CodeMirror 6 (loaded on first edit, colours from the theme's code tokens)
with an unsaved-changes badge, Mod+S, a conflict when the file changed on
disk, Delete and Open in default app. The device setting "Open files in"
can open them straight in the worker computer's default app instead.
The file viewer shows line numbers in a column that is never selected.
Mod+A in the viewer selects only the focused file content and nothing
outside it, and closing the viewer clears the selection, so the page
behind it is never left selected.
@M-Zajace
M-Zajace marked this pull request as ready for review November 10, 2026 15:57
@M-Zajace
M-Zajace merged commit df70157 into feat/file-access Nov 10, 2026
8 checks passed
@M-Zajace
M-Zajace deleted the feat/file-viewer branch November 10, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant