Skip to main content

Module remote_catalog

Module remote_catalog 

Source
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-Modified validator,
  • caches the body + validator under the agent dir,
  • revalidates at most every REMOTE_CATALOG_REFRESH_INTERVAL_MS unless forced, and
  • merges the overlay over the baseline (overlay entries win by id).

Structs§

CatalogEntry
Persisted catalog entry for one provider (native ModelsStoreEntry).
CatalogStore
Persisted store: provider id → entry.

Enums§

RefreshOutcome
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 (native mergeModels).
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 missing last_modified on the entry means “unknown” and is treated as stale.