Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
# Artifacts
Artifacts are versioned web pages stored by the daemon. The
[artifacts extension](../src/albedo/harness/extensions/artifacts/extension.gleam)
registers the service and Python host routes. The gallery is global and
artifacts outlive their originating session.
## The model's side
The [Python binding](../priv/python/albedo_plugins/artifacts.py) exposes
asynchronous `artifacts.create` and `update`. Creation accepts one HTML string,
a mapping of files, or a directory. An update with `files` changes named paths
and uses `None` to remove a path. A directory replaces the tree. The binding
requires the entry file and rejects HTML with root-relative `src` or `href`
paths.
A title-only update renames the artifact without creating a version. The
[ledger's `save` implementation](../src/albedo/harness/extensions/artifacts/ledger.gleam)
distinguishes that path from saving new files.
Directory uploads skip `.git`, `.DS_Store`, `node_modules`, and `__pycache__`.
The binding limits a file to 16 MiB and a directory version to 64 MiB. It hashes
files, asks the host which hashes are missing, and uploads missing content.
`list`, `get`, `read`, `state`, `errors`, and `url` inspect saved artifacts.
## Storage
The [ledger](../src/albedo/harness/extensions/artifacts/ledger.gleam) owns
artifact metadata, versions, file manifests, content hashes, state, and recorded
failures. `valid_path` and `valid_title` validate inputs. `save` records a
version. The [RPC handler](../src/albedo/harness/extensions/artifacts/rpc.gleam)
connects kernel calls to the ledger.
## Serving and isolation
The [service](../src/albedo/harness/extensions/artifacts/service.gleam) handles
artifact requests.
[`frame.resolve` and `frame.inject`](../src/albedo/harness/extensions/artifacts/frame.gleam)
resolve files and insert the bridge into HTML before page scripts. The
[bridge](../priv/artifacts/bridge.js) supplies page integration, including
persisted state. Artifact pages run in a sandbox with network access, as
declared in the
[extension instructio…