small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo robot-docs artifacts.md

# artifacts An **artifact** is a web page the agent made: one HTML file, a few files, or a whole built app. It opens in a window beside the chat that made it (web), or in the browser from a row in the transcript (terminal), on its `latest/` address, which follows updates. Every version is kept, and artifacts outlive their session: deleting a session leaves its artifacts in the gallery, which is the only place an artifact is deleted. The `artifacts` extension (`src/albedo/harness/extensions/artifacts/`, enabled by default) owns the storage, the Python module, the HTTP service and the page bridge. Clients draw it: `web/` has the window and the gallery, `cli/internal/tui` the row, and `albedo web` (`cli/internal/webui`) serves the pages. ## the model's side The Python module `artifacts`: - `artifacts.create(title, html=None, *, files=None, directory=None, entry="index.html")` makes an artifact at version 1. Give exactly one source: `html` (the entry file's text), `files` (a dict of relative path to `str` or `bytes`), or `directory` (a folder to publish whole, such as a build's `dist`). - `artifacts.update(id, html=None, *, files=None, directory=None, entry=None, title=None)` writes the next version. `html` replaces the entry file and keeps the rest; `files` changes only the paths it names (a value of `None` removes that path); `directory` replaces the whole tree; with no source it only renames. - `artifacts.list(limit=20, session=None)` lists artifacts, newest change first; `session="current"` keeps this session's. - `artifacts.get(id, version=None)` describes one version: `id`, `title`, `version`, `versions`, `entry`, `files` (path to size), `session`, `created_at`, `updated_at`. - `artifacts.read(id, path=None, version=None)` returns one file (the entry by default), `str` for text, `bytes` otherwise. - `artifacts.state(id)` is what the page saved through `localStorage`; `artifacts.errors(id)` is what failed in the page (newest last, at most 20). - `artifacts.url(id, version=None)` is the page's address on the…