A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
Compare update versions by scheme rather than by bytes
RoversX29c4189b5e21
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 50cd6426..7fb6e14d 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -173,6 +173,18 @@ jobs:- name: Check submodulesrun: bash ci/check-submodules.sh+ # wezterm-version's build.rs prefers a `.tag` file over deriving the+ # version from git. Without it a released binary reports a commit stamp,+ # and wezterm-gui's update check compares that against a `v*` release tag+ # -- two unrelated schemes, so every release looks newer forever.+ # Via env rather than a ${{ }} splice: on a tag push this is+ # GITHUB_REF_NAME, and git accepts refs containing shell metacharacters.+ - name: Stamp version+ shell: bash+ env:+ RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}+ run: echo "$RELEASE_TAG" > .tag+- name: Install Rustuses: dtolnay/rust-toolchain@stablewith:@@ -239,6 +251,15 @@ jobs:shell: bashrun: bash ci/check-submodules.sh+ # See the macOS job: without this a released binary reports a commit+ # stamp rather than the release tag, and the update check compares two+ # unrelated version schemes.+ - name: Stamp version+ shell: bash+ env:+ RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}+ run: echo "$RELEASE_TAG" > .tag+- name: Install Rustuses: dtolnay/rust-toolchain@stablewith:@@ -334,6 +355,18 @@ jobs:- name: Check submodulesrun: bash ci/check-submodules.sh+ # wezterm-version's build.rs prefers a `.tag` file over deriving the+ # version from git. Without it a released binary reports a commit stamp,+ # and wezterm-gui's update check compares that against a `v*` release tag+ # -- two unrelated schemes, so every release looks newer forever.+ # Via env rather than a ${{ }} splice: on a tag push this is+ # GITHUB_REF_NAME, and git accepts refs containing shell metacharacters.+ - name: Stamp version+ shell: bash+ env:+ RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}+ run: echo "$RELEASE_TAG" > .tag+- name: Install Rustuses: dtolnay/rust-toolchain@stablediff --git a/Cargo.lock b/Cargo.lockindex c2ffa65c..8b2112de 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -7967,6 +7967,7 @@ dependencies = ["percent-encoding","phf","phf_codegen 0.10.0",+ "plist","portable-pty","promise","pulldown-cmark",@@ -7976,6 +7977,7 @@ dependencies = ["regex","reqwest","resvg",+ "semver","serde","serde_json","shared_library",diff --git a/Cargo.toml b/Cargo.tomlindex bbae94f9..280b990a 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -202,6 +202,7 @@ serde-funcs = { path = "lua-api-crates/serde-funcs" }serde_json = "1.0"serde_with = {version="2.0", features = ["chrono_0_4"]}serde_yaml = "0.9"+semver = "1.0"serial2 = "0.2"sha2 = "0.10"share-data = { path = "lua-api-crates/share-data" }diff --git a/ci/macos-package.sh b/ci/macos-package.shindex 6cfd1c85..678364b1 100755--- a/ci/macos-package.sh+++ b/ci/macos-package.sh@@ -68,6 +68,9 @@ if [[ "$MODE" != adhoc && "$MODE" != developerid ]]; thenexit 2fi+INFO_PLIST=assets/macos/ThinkTerm.app/Contents/Info.plist+bundle_version=$(plutil -extract CFBundleShortVersionString raw "$INFO_PLIST")+if [[ -z "$TAG" ]]; then# The tag names the archive, and ci/wezterm-homebrew-macos.rb.template builds# its download URL out of it, so it has to match the GitHub release tag byte@@ -75,8 +78,7 @@ if [[ -z "$TAG" ]]; then# only triggers on 'v*', so every release this has to line up with has one.# Deliberately not ci/tag-name.sh's build timestamp -- that identifies a build# rather than a release, and `thinkterm --version` already reports it.- suggested="v$(plutil -extract CFBundleShortVersionString raw \- assets/macos/ThinkTerm.app/Contents/Info.plist)"+ suggested="v$bundle_version"printf "Version tag [%s]: " "$suggested"read -r TAG || { echo; exit 1; }TAG=${TAG:-$suggested}@@ -92,6 +94,17 @@ if [[ ! "$TAG" =~ ^[A-Za-z0-9._-]+$ ]]; thenexit 2fi+# The bundle's version is what the shipped app reports to the update check, and+# the tag is what it gets compared against. A mismatch ships an app that+# announces an update to the version it already is, on every launch, because+# installing that update cannot change what the binary claims about itself.+if [[ "${TAG#v}" != "$bundle_version" ]]; then+ echo "Tag $TAG does not match the bundle version $bundle_version." >&2+ echo "Bump CFBundleShortVersionString in $INFO_PLIST first," >&2+ echo "or package the version the bundle already declares." >&2+ exit 2+fi+echo "==> Checking prerequisites"# Catch a missing build here rather than letting deploy.sh fail halfway throughdiff --git a/wezterm-gui/Cargo.toml b/wezterm-gui/Cargo.tomlindex 1f891380..d22c0e89 100644--- a/wezterm-gui/Cargo.toml+++ b/wezterm-gui/Cargo.toml@@ -93,6 +93,7 @@ rayon.workspace = trueregex.workspace = truereqwest = { workspace = true, features = ["blocking"] }resvg.workspace = true+semver.workspace = trueserde = {workspace=true, features = ["rc", "derive"]}serde_json.workspace = trueshlex.workspace = true@@ -135,6 +136,9 @@ wgpu.workspace = truewindow-funcs.workspace = truewindow.workspace = true+[target.'cfg(target_os = "macos")'.dependencies]+plist.workspace = true+[target.'cfg(windows)'.dependencies]shared_library.workspace = truewinapi = { workspace=true, features = [diff --git a/wezterm-gui/src/update.rs b/wezterm-gui/src/update.rsindex c3f7cad9..b08814dd 100644--- a/wezterm-gui/src/update.rs+++ b/wezterm-gui/src/update.rs@@ -77,9 +77,9 @@ pub fn load_last_release_info_and_set_banner() {Err(_) => return,};- let current = wezterm_version();+ let current = running_release_version();let force_ui = always_show_update_ui();- if latest.tag_name.as_str() <= current && !force_ui {+ if !is_newer_release(&latest.tag_name, ¤t) && !force_ui {return;}@@ -132,8 +132,8 @@ fn set_banner_from_release_info(latest: &Release) {}fn schedule_set_banner_from_release_info(latest: &Release) {- let current = wezterm_version();- if latest.tag_name.as_str() <= current {+ let current = running_release_version();+ if !is_newer_release(&latest.tag_name, ¤t) {return;}promise::spawn::spawn_into_main_thread({@@ -145,6 +145,118 @@ fn schedule_set_banner_from_release_info(latest: &Release) {.detach();}+/// The release version of the running build, for comparison against the tag+/// of the latest GitHub release.+///+/// `wezterm_version()` is baked in at compile time from `.tag`, which only the+/// release workflow writes -- and macOS is the one platform whose packages are+/// built by hand rather than in CI, so its binaries carry a commit stamp that+/// `is_newer_release` deliberately refuses to compare against a `v*` tag. The+/// bundle's Info.plist does carry the release version, is read at runtime+/// rather than compile time, and is already what Finder and the About panel+/// show, so prefer it when we are running from inside an app bundle.+fn running_release_version() -> String {+ #[cfg(target_os = "macos")]+ {+ if let Some(version) = macos_bundle_version() {+ return version;+ }+ }+ wezterm_version().to_string()+}++/// `<bundle>.app/Contents/MacOS/<exe>` puts Info.plist one level up from the+/// executable's directory. Returns None for a bare `cargo build` binary, which+/// has no bundle and should keep reporting its commit stamp.+#[cfg(target_os = "macos")]+fn macos_bundle_version() -> Option<String> {+ let exe = std::env::current_exe().ok()?;+ version_from_info_plist(exe.parent()?.parent()?.join("Info.plist"))+}++#[cfg(target_os = "macos")]+fn version_from_info_plist(path: std::path::PathBuf) -> Option<String> {+ let value = plist::Value::from_file(path).ok()?;+ let version = value+ .as_dictionary()?+ .get("CFBundleShortVersionString")?+ .as_string()?+ .trim()+ .to_string();+ if version.is_empty() {+ None+ } else {+ Some(version)+ }+}++/// Is `latest` a release the running build should be told about?+///+/// The two strings only compare meaningfully when they use the same scheme.+/// A CI build carries the release tag (the workflow writes `.tag`, which+/// wezterm-version's build.rs prefers); anything built from a plain checkout+/// carries a `<date>-<hash>` commit stamp instead. Comparing across the two+/// with `>` is what made every `v*` release look permanently newer than every+/// local build: 'v' sorts above every digit, so the banner never went away.+fn is_newer_release(latest: &str, current: &str) -> bool {+ let parse = |s: &str| semver::Version::parse(s.trim_start_matches('v')).ok();+ match (parse(latest), parse(current)) {+ (Some(latest), Some(current)) => latest > current,+ // Both on the commit-stamp scheme, which upstream still uses for its+ // own tags. It starts with a zero-padded date, so lexicographic order+ // is chronological order.+ (None, None) => latest > current,+ // One of each: there is no ordering between the schemes, and a build+ // that never came from a release is not something to nag about.+ _ => false,+ }+}++#[cfg(test)]+mod update_version_tests {+ use super::is_newer_release;++ const STAMP: &str = "20260819-153532-9d50c4cc";++ #[test]+ fn semver_releases_compare_numerically() {+ assert!(is_newer_release("v0.2.0", "v0.1.0"));+ assert!(!is_newer_release("v0.1.0", "v0.2.0"));+ assert!(!is_newer_release("v0.1.0", "v0.1.0"));+ // The reason a plain string compare is not good enough.+ assert!(is_newer_release("v0.10.0", "v0.9.0"));+ }++ #[test]+ fn a_release_never_nags_a_local_build() {+ assert!(!is_newer_release("v0.1.0", STAMP));+ assert!(!is_newer_release("v9.9.9", STAMP));+ assert!(!is_newer_release(STAMP, "v0.1.0"));+ }++ #[test]+ fn commit_stamps_still_compare_chronologically() {+ assert!(is_newer_release("20260901-000000-aaaaaaaa", STAMP));+ assert!(!is_newer_release("20260101-000000-aaaaaaaa", STAMP));+ }++ /// The bundle template is the version a hand-built macOS package reports,+ /// so a release that forgets to bump it silently stops notifying users.+ #[cfg(target_os = "macos")]+ #[test]+ fn bundle_template_carries_a_comparable_version() {+ let plist = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))+ .join("../assets/macos/ThinkTerm.app/Contents/Info.plist");+ let version = super::version_from_info_plist(plist)+ .expect("the shipped Info.plist must declare CFBundleShortVersionString");+ assert!(+ semver::Version::parse(version.trim_start_matches('v')).is_ok(),+ "Info.plist version {version:?} must parse as semver, or macOS \+ builds cannot be compared against a release tag"+ );+ }+}+/// Returns true if the provided socket path is dead.fn update_checker() {// Compute how long we should sleep for;@@ -183,8 +295,8 @@ fn update_checker() {if configuration().check_for_updates {if let Ok(latest) = get_latest_release_info() {schedule_set_banner_from_release_info(&latest);- let current = wezterm_version();- if latest.tag_name.as_str() > current || force_ui {+ let current = running_release_version();+ if is_newer_release(&latest.tag_name, ¤t) || force_ui {log::info!("latest release {} is newer than current build {}",latest.tag_name,