Expand description
Remote model catalog overlay.
Port of native Pi’s packages/coding-agent/src/core/remote-catalog-provider.ts.
A built-in provider ships a static model list; pi.dev publishes a
per-provider catalog (/api/models/providers/<id>) that can add or refresh
entries between releases. This module:
- fetches that catalog with an
ETag/Last-Modifiedvalidator, - caches the body + validator under the agent dir,
- revalidates at most every
REMOTE_CATALOG_REFRESH_INTERVAL_MSunless forced, and - merges the overlay over the baseline (overlay entries win by id).
Structs§
- Catalog
Entry - Persisted catalog entry for one provider (native
ModelsStoreEntry). - Catalog
Store - Persisted store: provider id → entry.
Enums§
- Refresh
Outcome - Outcome of a refresh attempt.
Constants§
- DEFAULT_
CATALOG_ BASE_ URL - Native
DEFAULT_CATALOG_BASE_URL. - REMOTE_
CATALOG_ REFRESH_ INTERVAL_ MS - Native
REMOTE_CATALOG_REFRESH_INTERVAL_MS(4 hours).
Functions§
- merge_
into_ catalog - Merge the remote overlay into a full catalog, provider by provider.
- merge_
models - Merge overlay over baseline; overlay entries win by
id(nativemergeModels). - parse_
catalog - Parse a catalog payload. Native
parseCatalog: accepts a bare array,{models:[…]}, or an object keyed by id. Every entry is stamped with the requesting provider id. - refresh_
provider_ catalog - Fetch and cache the remote catalog for
provider_id. - remote_
models - Overlay selection (native
remoteModels): an entry only contributes when it is newer than the locally generated catalog, and a missinglast_modifiedon the entry means “unknown” and is treated as stale.