Skip to main content

cera/bundle/
mod.rs

1//! Bundle fetching + caching.
2//!
3//! Two layers, split by what they need from the host:
4//!
5//! - [`cache_key`] is pure and always compiled: URL-to-cache-entry
6//!   addressing, the path-segment allowlist, LeapBundles manifest URLs
7//!   and catalog parsing. The browser store in `cera-wasm` builds on
8//!   this, which is why it isn't behind the `remote` feature.
9//! - `BundleRepo` (behind `remote`, so named and not linked) is the native store: a
10//!   `reqwest::blocking` downloader over an on-disk tree, with
11//!   SHA-256 integrity and sidecar caching.
12//!
13//! A `wasm32` build gets the first and not the second (there is no
14//! filesystem and no reqwest) and supplies its own OPFS-backed store
15//! that shares the addressing above. See `cera-wasm`'s bundle module.
16
17pub mod cache_key;
18pub mod hf;
19
20pub use cache_key::{LeapBundleEntry, known_bundle_manifest, leap_bundles_manifest_url};
21pub use hf::{
22    GgufFileEntry, HfModelInfo, HfRepoContents, HfSibling, HfSpec, classify_repo_siblings,
23    default_cache_dir, extract_quant_from_filename, resolve_hf_manifest,
24};
25
26#[cfg(feature = "remote")]
27pub(crate) mod download;
28
29#[cfg(feature = "remote")]
30mod repo;
31
32#[cfg(feature = "remote")]
33pub use hf::{
34    fetch_generation_defaults, fetch_model_info, get_hf_auth_token, inspect_and_resolve_manifest,
35};
36
37#[cfg(feature = "remote")]
38pub use repo::{BundleRepo, DownloadProgress, list_leap_bundles};