Omni.UI.FilesComponent (Omni UI v0.1.0)

Copy Markdown View Source

A LiveComponent that renders the files panel.

Receives session_id from the parent LiveView and manages all file state internally: the file index, active selection, content loading, and token signing.

Assigns from parent

  • session_id — the current session ID (triggers rescan on change)

Actions via send_update

  • action: :rescan — rescans the files directory (e.g. after a tool result creates or modifies a file)
  • action: {:view, filename} — opens the named file in the panel (e.g. when the user clicks an inline file tool-use button)

View modes

The active file's MIME type determines its default view mode. A separate view_source boolean can override the default to :source for toggleable types.

  • :iframe — (text/html, application/pdf) served from the file Plug route; HTML gets sandbox="allow-scripts"
  • :markdown — (text/markdown) MDEx-rendered HTML with typography styles
  • :media — (image/*) centered <img> tag served from the Plug route
  • :source — (text/*, application/json, and other text-like types) syntax-highlighted source via Lumis
  • :download — (everything else) download link

HTML, Markdown, and SVG files support a Preview / Code toggle in the file bar, switching between the default view and :source.

Summary

Functions

render(assigns)

Attributes

  • session_id (:string) - Defaults to nil.