Registry
The Smarter Extension registry: discovery, trust badges and updates.
The registry is a public GitHub repository, smarter-sh/extensions-registry, whose CI
publishes a signed index of every released extension: index.json, and its Ed25519
signature, index.json.sig, at extension_registry_url.
Publishers submit releases by pull request; the Smarter team assigns publishers’ trust
badges in a file that only it may change.
This module:
fetches the index, caching the HTTP request for an hour, and verifies its signature with
extension_registry_public_keyon every read;finds each extension’s newest version that is compatible with this platform;
downloads an archive, and checks it against the sha256 in the signed index;
installs or updates an extension from the registry, with its publisher’s trust badge;
records the newest compatible version of each installed extension, so that the admin console can say an update is available.
The index’s models allow fields that they do not know, so that the registry can add fields without breaking older platforms.
- class smarter.apps.llmtool.extension.registry.RegistryExtension(**data)[source]
Bases:
RegistryModelAn extension in the registry, with every released version.
- latest_compatible(platform_version=None)[source]
Return the newest version that works with a Smarter version, this platform’s if None, or None.
- Return type:
- model_config = {'extra': 'ignore'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- versions: list[RegistryVersion]
- class smarter.apps.llmtool.extension.registry.RegistryIndex(**data)[source]
Bases:
RegistryModelThe registry’s index: every publisher, and every extension.
- badge_of(extension)[source]
Return the trust badge of an extension’s publisher;
communityif the publisher is unknown.- Return type:
- extensions: list[RegistryExtension]
- model_config = {'extra': 'ignore'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- publishers: list[RegistryPublisher]
- class smarter.apps.llmtool.extension.registry.RegistryPublisher(**data)[source]
Bases:
RegistryModelA publisher of extensions, and how far the Smarter team trusts them.
- model_config = {'extra': 'ignore'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class smarter.apps.llmtool.extension.registry.RegistryVersion(**data)[source]
Bases:
RegistryModelOne released version of an extension.
- is_compatible(platform_version=None)[source]
Return whether this version works with a Smarter version; this platform’s if None.
- Return type:
- model_config = {'extra': 'ignore'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- smarter.apps.llmtool.extension.registry.check_for_updates(refresh=False)[source]
Record the newest compatible version of every extension installed from the registry.
Extensions installed from uploaded archives are not checked, so that an upload is never offered a registry package that happens to have the same slug.
- Parameters:
refresh (
bool) – Whether to download the index again, rather than reading the cached copy.- Return type:
- Returns:
The extensions for which an update is available.
- Raises:
SmarterExtensionRegistryError – If the registry cannot be read.
- smarter.apps.llmtool.extension.registry.download(version)[source]
Download an extension archive, and check it against the signed index’s sha256.
- Parameters:
version (
RegistryVersion) – The version to download.- Return type:
- Returns:
The archive’s bytes.
- Raises:
SmarterExtensionRegistryError – If it cannot be downloaded, or does not match its sha256.
- smarter.apps.llmtool.extension.registry.get_index()[source]
Return the registry’s verified index.
- Return type:
- Returns:
The index.
- Raises:
SmarterExtensionRegistryError – If the registry is disabled, cannot be reached, or its index is not authentic or not valid.
- smarter.apps.llmtool.extension.registry.index_json_schema()[source]
Return the JSON Schema of the registry’s index.
- Return type:
- smarter.apps.llmtool.extension.registry.install_from_registry(slug, version=None, user=None)[source]
Install an extension from the registry, or update an installed one.
- Parameters:
- Return type:
- Returns:
The extension, installed but disabled if it is new.
- Raises:
SmarterExtensionRegistryError – If the registry, the extension or the version cannot be found or downloaded.
- smarter.apps.llmtool.extension.registry.is_enabled()[source]
Return whether the registry is configured: it is disabled until its public key is set.
- Return type:
- smarter.apps.llmtool.extension.registry.refresh_index()[source]
Download the index again, rather than reading the cached copy, and return it.
- Return type:
- smarter.apps.llmtool.extension.registry.verify(index, signature, public_key)[source]
Verify the index’s Ed25519 signature.
- Parameters:
- Raises:
SmarterExtensionRegistryError – If the key or signature is malformed, or the signature does not match.
- Return type: