Files
pipelines/docs/notes/files-panel.md
T

1.8 KiB

Files panel

The chat Files panel lists and navigates the active session's server working directory, with filtering, hidden files, sorting, and list/grid presentation (app/lib/features/chat/files/). The follow-up slice adds file opening, viewing, downloading and image thumbnails.

Server side:

  • Directory listings (list_directory) include file size (bytes) and RFC3339 UTC modified metadata for files; directories carry neither.
  • GET /files?path=... serves one regular file for the client files panel. Paths may be absolute or ~-prefixed and are resolved through the operator home directory; cleaned paths and symlinks must stay inside that home subtree. Directories, special files and escape paths are refused. Add download=1 for attachment disposition.

Viewing and downloads

Files now open in the shared artifact viewer (images, SVG icons in an inert HTML frame, text/code, markdown, JSON, tables, HTML, audio and video). PDFs open through the platform handler. Unknown files show metadata and host-native Open externally/Download actions. Every file has separate Open and Download menu items, including PDFs; folders have neither. Downloads reuse the artifact save bridge on native platforms and attachment URLs on web. Viewer downloads also use attachment URLs.

Image tiles decode at 56 logical pixels (maximum scale 4), show a loading placeholder and error glyph, and evict decoded cache entries when scrolled out. Sorting runs once per panel rebuild. Breadcrumbs navigate to ancestors; filters stay synchronized with folder navigation, and filtered empty states differ from empty folders. Sizes use binary units and mtimes use compact local timestamps.

The capture fixture uses files=1; see app/tool/capture/README.md for bundling its static files. PDF/video fixture entries only show types/menus and do not provide playable sample bytes.