Expand description
Blocking cross-platform self-update, hosted on GitHub Releases, static JSON manifests, or Sparkle appcasts. This core has no GPUI dependencies.
GPUI ships no updater of its own, and Zed’s auto_update is GPL-licensed and
wired to Zed’s private update server. This crate is an independent, MIT/Apache
implementation of the same idea: a small state machine that checks a release
source, downloads the platform artifact, verifies it, and swaps it into place.
§Layers
UpdateSource— where releases come from.GitHubSource,StaticManifestSource, andAppcastSourceare built in.UpdateEngine— the blocking pipeline:check→download(with SHA-256, minisign, and Sparkle-compatible Ed25519 verification) →install.install/verify— the platform install strategies and integrity checks, usable on their own.UpdateDriver— the contract for handing the whole flow to an external updater instead of the engine;gpui-updater-sparkleimplements it with Sparkle on macOS.delta(behind thedeltafeature) — binary delta updates: create a per-file bsdiff delta in release CI, and let the engine rebuild the new version from the installed one, falling back to the full download on any problem.UpdateStatus— backend-independent state used by the separategpui-updater(official GPUI) andgpui-updater-preadapters, whichever backend (engine or driver) they run.
§Guides
| Topic | Page |
|---|---|
| Choosing a source, the static manifest format, appcasts, proxies and request headers | source |
| Verification and trust: transport, the checks, policies, key rotation, signed manifests | verify |
| Install strategies, the install location check, installs a package manager owns, platform notes | install |
Delta updates: enabling, generating, publishing, measurements (feature delta) | delta module |
| Error kinds and what to show the user | ErrorKind |
| Status values for a user interface | UpdateStatus |
For a GPUI app, start with the gpui-updater or gpui-updater-pre crate,
which wraps the engine in an observable entity.
§Example (blocking engine)
use gpui_updater_core::{EngineConfig, GitHubSource, UpdateEngine};
use semver::Version;
let source = GitHubSource::new("AprilNEA", "OpenLogi")
.asset_contains("macos")
.asset_contains(".dmg")
.with_checksums("SHA256SUMS")
.with_minisig();
let engine = UpdateEngine::new(
source,
EngineConfig::new(Version::parse(env!("CARGO_PKG_VERSION")).unwrap())
.minisign_public_key("RWQ…"),
);
if let Some(release) = engine.check()? {
let artifact = engine.download(&release, |done, total| {
if let Some(total) = total {
eprintln!("{done}/{total}");
}
})?;
engine.install(&artifact)?;
}Re-exports§
pub use driver::DriverEvent;pub use driver::DriverEvents;pub use driver::UpdateDriver;pub use install::InstallOptions;pub use install::Installed;pub use install::MsiUi;pub use install::Ownership;pub use install::OwnershipHints;pub use install::PackageManager;pub use install::current_install_root;pub use source::AppcastSource;pub use source::AppcastVersion;pub use source::FallbackSource;pub use source::GitHubSource;pub use source::StaticManifestSource;pub use source::UpdateSource;
Modules§
- delta
delta - Binary delta updates in the
files-bsdiff-v1format. - driver
- The contract for handing the whole update flow to an external updater.
- install
- Replacing the installed application with a freshly downloaded artifact.
- manifest
- The static JSON release manifest, as one set of types for both sides.
- source
- Where to look for releases.
- verify
- Integrity and authenticity checks for downloaded artifacts.
The functions here are the checks the engine runs on every download. They
are public so that release tooling can run the same checks. This page
describes the whole trust model of
UpdateEngine.
Structs§
- Artifact
- A downloaded update that passed the engine’s checks, ready for
UpdateEngine::install. - Asset
- A downloadable file attached to a release.
- Cancel
Token - Asks a running
UpdateEngine::download_cancellableto stop. - Delta
Asset - A binary delta that upgrades one specific installed version to another.
- Engine
Config - Configuration for an
UpdateEngine. - Http
Options - HTTP settings for an update source or for the engine’s downloads: extra request headers and the proxy.
- Release
- The latest applicable release resolved for the running platform.
- Update
Engine - Blocking update orchestrator: check → download → verify → install.
- Update
Error - A failed update operation, as the user interface sees it: what kind of failure it was and the message describing it.
- Version
- Re-exported so consumers can build an
EngineConfigwithout depending onsemverdirectly (e.g.Version::parse(env!("CARGO_PKG_VERSION"))). SemVer version as defined by https://semver.org.
Enums§
- Bundle
Version - Whether the app bundle of an update must declare the release’s version (macOS).
- Code
Signing - Which code signature an update must carry: the app bundle’s on macOS, the
.exeor.msiAuthenticode signature on Windows. Linux has no platform code signature, so nothing is checked there. - Error
- Errors produced while checking for, downloading, verifying, or installing an update.
- Error
Kind - The broad class of an
Error, stable enough to drive user interface decisions: which message to show, and whether retrying can help. - Update
Status - Observable state of an update operation.
- Verification
- How strictly
UpdateEngineenforces integrity and authenticity checks on a release. - Version
Binding - Whether a signature must name the version it was made for.
Constants§
- DEFAULT_
MAX_ DELTA_ HOPS - Longest chain of deltas the engine downloads by default.
- DEFAULT_
MAX_ DOWNLOAD_ SIZE - Largest download the engine accepts by default: 4 GiB, twice what GitHub Releases allows for a single asset.
- DELTA_
FORMAT_ FILES_ BSDIFF_ V1 - Format identifier of the deltas produced by the
deltafeature’sdelta::create: per-file bsdiff patches against the installed tree.
Functions§
- parse_
tag - Parse a release tag such as
v1.2.3or1.2.3into aVersion. - parse_
version_ lenient - Parse a version the way feeds that are not strictly semver publish it.
Type Aliases§
- Result
- Convenience alias for results returned by this crate.