Expand description
Cache - account-scoped, atomic cache paths and versioned catalog cache for the Workers AI catalog.
Layout: $HERMES_HOME/cache/auth-cloudflare/<slug>/ (feedback 03 rename
contract). Each account’s catalog is stored as two files written
atomically:
catalog.json- the raw payload (serde_json::Value);catalog.meta.json-CatalogCacheMeta(schema version, fetch time, provenance, model count, account fingerprint).
Reads return Ok(None) when the cache is absent, and Err when a present
file is truncated or corrupt - callers fall back to a live fetch or the
bundled fallback catalog (never panic).
Structs§
- Catalog
Cache Meta - Metadata recorded alongside every cached catalog payload (feedback 02/06: the cache records timestamps, provenance, and model count).
Constants§
- HERMES_
HOME_ ENV - Env var overriding the Hermes home (matches
hermes’s own resolution).
Functions§
- atomic_
write - Atomic write helper - write to a sibling temp file, then rename over the destination. Never leave a half-written catalog behind.
- cache_
dir_ for_ account - Return the account-scoped cache directory for one provider.
- cache_
is_ stale - True when the cache metadata is older than
max_age. - read_
catalog_ cache - Read the versioned catalog cache for an account-scoped directory.
- write_
catalog_ cache - Write the versioned catalog cache for an account-scoped directory.