Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

fix(macos): Intel Macs open on macOS 12 again, and the AI features say what they need (#372, #333, #342)

Jareere1009cd0bfc7
diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml
index 7d56d75f..a0b7e778 100644
--- a/.github/workflows/build-app.yml
+++ b/.github/workflows/build-app.yml
@@ -86,20 +86,16 @@ env:
# shared build.
ORT_VERSION: 1.28.0
# And for Intel Macs, which neither ort nor Microsoft build for any more:
- # the last release Microsoft made for them.
- #
- # NOTE: ort 2.0.0-rc.13 with its default features asks the runtime for
- # API 27 (its `api-27` feature), and 1.23.2 serves API 23 and below, so
- # on an Intel Mac the first ONNX session (a cutout, Chatterbox) should
- # fail to get the API. That predates the pinning here, and wants a look
- # on an Intel Mac: either an older `api-*` feature for ort, or no
- # cutouts there.
+ # the last release Microsoft made for them. It serves API 23, which is
+ # what ort asks for there, and it is built for macOS 13.4, so it is not
+ # linked: the app loads it at first use, and not on an older macOS (see
+ # concat-vision's manifest and onnx.rs, and #333).
ORT_INTEL_MAC_VERSION: 1.23.2
# WiX for the Windows .msi, as a dotnet tool, pinned by version.
WIX_VERSION: 6.0.2
- # Oldest macOS the bundles run on, unless a target sets its own
- # (`macos-min` below): Apple silicon's. scripts/ci/check-min-os.sh lists
- # every bundled library built for a newer one.
+ # Oldest macOS the bundles run on. Apple silicon Macs all run newer than
+ # this; it is the Intel floor. scripts/ci/check-min-os.sh lists every
+ # bundled library built for a newer one.
MACOSX_DEPLOYMENT_TARGET: "12.0"
# ggml (whisper.cpp's kernels) tunes itself to the machine it is built
# on unless told otherwise, and these bundles run on other machines: a
@@ -138,9 +134,6 @@ jobs:
os: macos-15-intel
target: x86_64-apple-darwin
sherpa: osx-x64
- # The ONNX Runtime it ships (1.23.2, the last for Intel Macs)
- # is built for 13.4 and dies at launch on 12 (#333).
- macos-min: "13.4"
# 22.04, not latest: the binary links the build machine's glibc,
# so the oldest supported runner is what keeps it runnable on
# older distributions.
@@ -184,8 +177,6 @@ jobs:
# at most 155 minutes between them on any one target, so a stuck step
# is named by its own timeout; this is for a job stuck anywhere else.
timeout-minutes: 190
- env:
- MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-min || '12.0' }}
steps:
# The ref release.yml names, which is its tag: without one a run
# started by hand builds main and publishes it under the tag's name.
@@ -287,12 +278,14 @@ jobs:
# target set, the check is folded away at compile time.)
echo "RUSTFLAGS=-C link-arg=$(xcrun clang --print-file-name=libclang_rt.osx.a)" >> "$GITHUB_ENV"
- # ONNX Runtime on an Intel Mac. ort ships no static build for
+ # ONNX Runtime on an Intel Mac. ort ships no build for
# x86_64-apple-darwin, so the cutout's runtime is Microsoft's shared
- # one, linked dynamically the way Linux does it, and bundled into
- # Frameworks by dylibbundler along with FFmpeg's - the install name
- # is @rpath, so the bundler is told where to look. Apple silicon
- # keeps ort's static build.
+ # one - and that is built for macOS 13.4, while the app runs on 12.
+ # Linked at load time it closed the app at launch on 12 (#333), so
+ # it is not linked at all: ort is built with `load-dynamic` there,
+ # the bundle step copies the library into Frameworks, and the app
+ # opens it at the first cutout or Chatterbox read, on a macOS new
+ # enough for it. Apple silicon keeps ort's static build.
- name: ONNX Runtime (Intel macOS)
if: matrix.platform == 'macos' && matrix.arch == 'x86_64'
run: |
@@ -301,12 +294,7 @@ jobs:
scripts/ci/fetch.sh onnxruntime-osx-x86_64 onnxruntime.tgz
tar -xzf onnxruntime.tgz
test -f "$stem/lib/libonnxruntime.$ORT_INTEL_MAC_VERSION.dylib"
- ln -sf "libonnxruntime.$ORT_INTEL_MAC_VERSION.dylib" "$stem/lib/libonnxruntime.dylib"
- {
- echo "ORT_LIB_LOCATION=$PWD/$stem/lib"
- echo "ORT_PREFER_DYNAMIC_LINK=1"
- echo "ORT_DIR=$PWD/$stem"
- } >> "$GITHUB_ENV"
+ echo "ORT_MAC_DYLIB=$PWD/$stem/lib/libonnxruntime.$ORT_INTEL_MAC_VERSION.dylib" >> "$GITHUB_ENV"
# Thin LTO and sixteen codegen units for the Intel Mac, in place of the
# app profile's fat LTO and one unit. The Intel runner is the slowest
@@ -600,8 +588,7 @@ jobs:
dylibbundler -od -b \
-x "$app/Contents/MacOS/concat" \
-d "$app/Contents/Frameworks" \
- -p @executable_path/../Frameworks \
- ${ORT_DIR:+-s "$ORT_DIR/lib"}
+ -p @executable_path/../Frameworks
# Nothing outside the bundle may remain: a load path into
# Homebrew would break on a Mac without it.
@@ -610,11 +597,28 @@ jobs:
exit 1
fi
+ # ONNX Runtime is never linked at launch: on an Intel Mac it is
+ # loaded at first use from Frameworks, under the name the app
+ # looks for (concat-vision's onnx.rs), and on Apple silicon it is
+ # inside the binary. A link here is #333 back: the app closing at
+ # launch on every macOS older than the runtime.
+ if otool -L "$app/Contents/MacOS/concat" | grep libonnxruntime ; then
+ echo "the binary links ONNX Runtime at launch" >&2
+ exit 1
+ fi
+ lazy=()
+ if [ -n "${ORT_MAC_DYLIB:-}" ]; then
+ cp "$ORT_MAC_DYLIB" "$app/Contents/Frameworks/libonnxruntime.dylib"
+ lazy=(--lazy Contents/Frameworks/libonnxruntime.dylib)
+ fi
+
# Every library in the bundle against the floor it declares. A
# warning for now: Homebrew's FFmpeg is built for the runner's
# macOS, so every Mac bundle has some until FFmpeg is built here
- # for the floor.
- scripts/ci/check-min-os.sh "$app" "$MACOSX_DEPLOYMENT_TARGET"
+ # for the floor. ONNX Runtime is listed apart, with the macOS it
+ # needs: the app reads that same field before loading it, and on
+ # an older one the AI features say so instead.
+ scripts/ci/check-min-os.sh "$app" "$MACOSX_DEPLOYMENT_TARGET" ${lazy[@]+"${lazy[@]}"}
# Signed with the repository's Developer ID when it has one, and
# notarised so Gatekeeper opens it without a warning; ad-hoc signed
diff --git a/scripts/ci/check-min-os.sh b/scripts/ci/check-min-os.sh
index 2dee1c13..8c9ab13b 100755
--- a/scripts/ci/check-min-os.sh
+++ b/scripts/ci/check-min-os.sh
@@ -3,6 +3,7 @@
# says it runs on.
#
# Usage: check-min-os.sh <bundle> <declared-minimum> [--enforce]
+# [--lazy <path in the bundle>]...
#
# A bundle declares its floor once (LSMinimumSystemVersion on a Mac,
# MinimumOSVersion on a phone), but every library in it was built for a
@@ -14,11 +15,38 @@
#
# Lists each file whose own minimum is newer than the declared one, as a
# warning, in the job summary too. With --enforce, any such file fails.
+#
+# A --lazy file is one the app opens itself, at first use, and only on a
+# system at least as new as the minimum in that file's own header - the
+# Intel Mac's ONNX Runtime, which needs 13.4 where the app needs 12
+# (#333; concat-vision's onnx.rs reads the same field). dyld never loads
+# it at launch, so it is held against its own minimum rather than the
+# bundle's: listed with the system it needs, and an error if it is not
+# there, since then the features behind it are missing.
set -euo pipefail
bundle="$1"
declared="$2"
-enforce="${3:-}"
+shift 2
+enforce=
+lazy=()
+while [ "$#" -gt 0 ]; do
+ case "$1" in
+ --enforce) enforce=--enforce ;;
+ --lazy) lazy+=("$2"); shift ;;
+ *) echo "check-min-os: unknown argument $1" >&2; exit 2 ;;
+ esac
+ shift
+done
+
+# Whether a path in the bundle is one of the --lazy ones.
+is_lazy() {
+ local path
+ for path in ${lazy[@]+"${lazy[@]}"}; do
+ [ "$path" = "$1" ] && return 0
+ done
+ return 1
+}
# The newer of two dotted versions.
newer() { printf '%s\n%s\n' "$1" "$2" | sort -V | tail -n 1; }
@@ -33,10 +61,19 @@ minimum_of() {
legacy && $1 == "version" { print $2; exit }'
}
+for path in ${lazy[@]+"${lazy[@]}"}; do
+ if [ ! -f "$bundle/$path" ]; then
+ echo "check-min-os: $path, loaded at first use, is not in $bundle" >&2
+ exit 1
+ fi
+ echo "check-min-os: $path is loaded at first use, on macOS $(minimum_of "$bundle/$path") or later"
+done
+
over=()
checked=0
while IFS= read -r -d '' file; do
file -b "$file" | grep -q 'Mach-O' || continue
+ is_lazy "${file#"$bundle"/}" && continue
checked=$((checked + 1))
own=$(minimum_of "$file")
[ -n "$own" ] || continue
@@ -45,7 +82,7 @@ while IFS= read -r -d '' file; do
fi
done < <(find "$bundle" -type f -print0)
-echo "check-min-os: $checked Mach-O files in $bundle, declared minimum $declared"
+echo "check-min-os: $checked Mach-O files in $bundle loaded at launch, declared minimum $declared"
if [ "${#over[@]}" -eq 0 ]; then
echo "check-min-os: every file runs on $declared"
exit 0
diff --git a/src/Cargo.lock b/src/Cargo.lock
index 9dad8132..ec47e8dc 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -393,7 +393,7 @@ version = "0.38.0+1.3.281"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
dependencies = [
- "libloading",
+ "libloading 0.8.9",
]
[[package]]
@@ -1010,7 +1010,7 @@ checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
dependencies = [
"glob",
"libc",
- "libloading",
+ "libloading 0.8.9",
]
[[package]]
@@ -1316,6 +1316,7 @@ dependencies = [
"bzip2 0.6.1",
"concat-host",
"concat-media",
+ "concat-vision",
"log",
"ort",
"serde",
@@ -1821,7 +1822,7 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"
dependencies = [
- "libloading",
+ "libloading 0.8.9",
]
[[package]]
@@ -2521,7 +2522,7 @@ dependencies = [
"glutin_egl_sys",
"glutin_glx_sys",
"glutin_wgl_sys",
- "libloading",
+ "libloading 0.8.9",
"objc2 0.6.4",
"objc2-app-kit 0.3.2",
"objc2-core-foundation",
@@ -3592,7 +3593,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
dependencies = [
"libc",
- "libloading",
+ "libloading 0.8.9",
"pkg-config",
]
@@ -3660,6 +3661,16 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "libloading"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
+dependencies = [
+ "cfg-if",
+ "windows-link",
+]
+
[[package]]
name = "libm"
version = "0.2.16"
@@ -4790,6 +4801,7 @@ version = "2.0.0-rc.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4336a1e2b38848325241c72889086886004e589b7c74f335e60a8e8db5138a0b"
dependencies = [
+ "libloading 0.9.0",
"ndarray",
"ort-sys",
"smallvec",
@@ -6541,7 +6553,7 @@ checksum = "a90a0ca3ee6a69f2ad28fd11621a4c3f03b371f366be500b64df260c4ffbafb4"
dependencies = [
"as-raw-xcb-connection",
"ctor",
- "libloading",
+ "libloading 0.8.9",
"pkg-config",
"tracing",
]
@@ -7551,7 +7563,7 @@ dependencies = [
"js-sys",
"khronos-egl",
"libc",
- "libloading",
+ "libloading 0.8.9",
"log",
"naga",
"naga-types",
@@ -8160,7 +8172,7 @@ dependencies = [
"as-raw-xcb-connection",
"gethostname",
"libc",
- "libloading",
+ "libloading 0.8.9",
"once_cell",
"rustix 1.1.4",
"x11rb-protocol",
diff --git a/src/Cargo.toml b/src/Cargo.toml
index b816b7f1..af1a8607 100644
--- a/src/Cargo.toml
+++ b/src/Cargo.toml
@@ -38,7 +38,12 @@ pollster = "0.4"
# ONNX Runtime, for the cutout models. The binaries come prebuilt for every
# target the app ships on, with the platform's own accelerator behind them:
# CoreML on macOS and iOS, DirectML on Windows, NNAPI on Android.
-ort = "=2.0.0-rc.13"
+#
+# ort's default features less the API version, which is not one for every
+# target: the ONNX Runtime an Intel Mac gets is older than the others, and
+# a feature cannot be taken away per target, only added. concat-vision's
+# manifest adds it, and says why.
+ort = { version = "=2.0.0-rc.13", default-features = false, features = ["std", "ndarray", "tracing", "download-binaries", "tls-native", "copy-dylibs"] }
[workspace.lints.rust]
missing_docs = "warn"
diff --git a/src/crates/concat-host/src/cutout.rs b/src/crates/concat-host/src/cutout.rs
index 8bb0bae4..d158e522 100644
--- a/src/crates/concat-host/src/cutout.rs
+++ b/src/crates/concat-host/src/cutout.rs
@@ -386,12 +386,16 @@ impl Cutouts {
/// [`crate::models`]. Whichever answers, the bytes are checked against the
/// digest the table carries before anything is renamed into place, so a
/// truncated or substituted file never becomes an installed model.
+///
+/// Nothing is fetched for a runtime that cannot run it: an Intel Mac older
+/// than its ONNX Runtime is told so here, before the download.
pub(crate) fn fetch(
id: ModelId,
file: &Path,
cancel: &AtomicBool,
progress: &mut dyn FnMut(Progress),
) -> Result<(), String> {
+ concat_vision::runtime::ready()?;
let spec = id.spec();
if let Some(parent) = file.parent() {
std::fs::create_dir_all(parent)
diff --git a/src/crates/concat-speech/Cargo.toml b/src/crates/concat-speech/Cargo.toml
index 700db998..dbbfd008 100644
--- a/src/crates/concat-speech/Cargo.toml
+++ b/src/crates/concat-speech/Cargo.toml
@@ -27,6 +27,11 @@ bzip2 = "0.6"
# pure-Rust regex backend, so no C library rides along. Behind `chatterbox`,
# which the desktop app turns on: a gigabyte of model is not for a phone.
ort = { workspace = true, optional = true }
+# Where ONNX Runtime is made ready, the one place for the cutout's models
+# and these: on an Intel Mac it is loaded at first use, and not at all on a
+# macOS older than it. concat-vision's manifest also picks the runtime API
+# version ort asks for, per target.
+concat-vision = { workspace = true, optional = true, features = ["infer"] }
tokenizers = { version = "0.23", optional = true, default-features = false, features = ["fancy-regex"] }
# What a run says about itself: which model loaded, how long a read took,
@@ -80,7 +85,7 @@ ort = { workspace = true, optional = true, features = ["coreml"] }
ort = { workspace = true, optional = true, features = ["directml"] }
[features]
-chatterbox = ["dep:ort", "dep:tokenizers"]
+chatterbox = ["dep:ort", "dep:tokenizers", "dep:concat-vision"]
[lints]
workspace = true
diff --git a/src/crates/concat-speech/src/chatterbox.rs b/src/crates/concat-speech/src/chatterbox.rs
index 412d67ae..944e2c5a 100644
--- a/src/crates/concat-speech/src/chatterbox.rs
+++ b/src/crates/concat-speech/src/chatterbox.rs
@@ -192,12 +192,15 @@ pub fn installed(dir: &Path) -> bool {
/// Fetches whatever of the bundle is not in `dir` yet, file by file, the
/// mirror first and Resemble's upstream second, reporting the bytes of
-/// the whole as one download. Blocks: run it on its own thread.
+/// the whole as one download. Blocks: run it on its own thread. Nothing is
+/// fetched where ONNX Runtime cannot run: an Intel Mac older than its
+/// runtime is told so before a gigabyte comes down for nothing.
pub fn download(
dir: &Path,
cancel: &AtomicBool,
progress: &mut dyn FnMut(DownloadProgress),
) -> Result<(), String> {
+ concat_vision::runtime::ready()?;
let total: u64 = FILES.iter().map(|file| file.bytes).sum();
let mut before: u64 = 0;
for file in FILES {
@@ -282,6 +285,7 @@ fn session(path: &Path, accelerated: bool) -> Result<Session, String> {
.map(|count| count.get())
.unwrap_or(1)
.clamp(1, 8);
+ concat_vision::runtime::ready()?;
let mut builder = Session::builder()
.map_err(|error| format!("onnx runtime: {error}"))?
.with_intra_threads(threads)
diff --git a/src/crates/concat-vision/Cargo.toml b/src/crates/concat-vision/Cargo.toml
index 6b864989..4d0946a5 100644
--- a/src/crates/concat-vision/Cargo.toml
+++ b/src/crates/concat-vision/Cargo.toml
@@ -42,5 +42,22 @@ ort = { workspace = true, optional = true, features = ["directml"] }
[target.'cfg(target_os = "android")'.dependencies]
ort = { workspace = true, optional = true, features = ["nnapi"] }
+# The ONNX Runtime API ort asks for: 27, served by the 1.28 every other
+# target links, everywhere but an Intel Mac.
+[target.'cfg(not(all(target_os = "macos", target_arch = "x86_64")))'.dependencies]
+ort = { workspace = true, optional = true, features = ["api-27"] }
+
+# An Intel Mac runs Microsoft's 1.23.2, the last ONNX Runtime built for it,
+# which serves API 23 at most: asked for 27 it hands back nothing and ort
+# panics on the first session. And that build needs macOS 13.4 - it calls
+# libc++'s floating-point to_chars, which macOS has from 13.3 - while the
+# app runs on 12. Linked at load time, it kept the whole app from starting
+# on 12 (#333). So there it is loaded at first use instead (`load-dynamic`),
+# from Contents/Frameworks, and only on a macOS it says it runs on; on an
+# older one the AI features say what they need and the rest of the app
+# works. See runtime::ready.
+[target.'cfg(all(target_os = "macos", target_arch = "x86_64"))'.dependencies]
+ort = { workspace = true, optional = true, features = ["api-23", "load-dynamic"] }
+
[lints]
workspace = true
diff --git a/src/crates/concat-vision/src/lib.rs b/src/crates/concat-vision/src/lib.rs
index 6708bdbd..f2762d91 100644
--- a/src/crates/concat-vision/src/lib.rs
+++ b/src/crates/concat-vision/src/lib.rs
@@ -28,7 +28,8 @@
//! object model are downloaded on first use ([`models`] says where from);
//! a small person model is compiled in so a cutout works with nothing
//! downloaded at all. The renderer reads masks and never infers; the
-//! host infers and writes them.
+//! host infers and writes them. [`onnx`] says whether this machine can run
+//! the runtime at all, which an Intel Mac older than its runtime cannot.
//!
//! A mask is whatever shape its model answers in - square for the object
//! model, the picture's own aspect for the person model - and every
@@ -45,6 +46,7 @@ pub mod brush;
pub mod enhance;
pub mod mask;
pub mod models;
+pub mod onnx;
#[cfg(feature = "infer")]
pub mod runtime;
#[cfg(feature = "infer")]
diff --git a/src/crates/concat-vision/src/onnx.rs b/src/crates/concat-vision/src/onnx.rs
new file mode 100644
index 00000000..55fce37a
--- /dev/null
+++ b/src/crates/concat-vision/src/onnx.rs
@@ -0,0 +1,237 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors
+
+//! Whether this machine can run ONNX Runtime at all.
+//!
+//! Everywhere but an Intel Mac the runtime is linked into the app, or
+//! shipped beside it and loaded at launch, and it runs wherever the app
+//! does. An Intel Mac gets Microsoft's 1.23.2, the last build there is for
+//! it, and that one is built for macOS 13.4 while the app runs on 12: it
+//! calls libc++'s floating-point `to_chars`, which macOS has from 13.3, and
+//! linked at load time it kept the app from starting at all on 12 (#333).
+//! So there it is loaded at first use, from the bundle's Frameworks, and
+//! only on a macOS at least as new as the one its own header names. The
+//! minimum is read from the file rather than written down here, so a
+//! different runtime in the bundle brings its own.
+//!
+//! This part does no inference and needs no runtime: Settings asks it
+//! too, to say up front what the AI features need.
+
+// Elsewhere only the tests read the header and the version: the answer
+// there is always that nothing is known against the runtime.
+#![cfg_attr(
+ not(all(target_os = "macos", target_arch = "x86_64")),
+ allow(dead_code)
+)]
+
+use std::fmt;
+#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
+use std::path::PathBuf;
+
+/// Why the AI features - background removal, the smart brushes, Enhance
+/// and Chatterbox - cannot run on this machine.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub struct Unavailable {
+ /// The macOS the runtime needs, as `13.4`.
+ pub needs: String,
+ /// The macOS this Mac runs.
+ pub runs: String,
+}
+
+impl fmt::Display for Unavailable {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(
+ f,
+ "the AI features need macOS {} or later, and this Mac runs {}",
+ self.needs, self.runs
+ )
+ }
+}
+
+/// Why the AI features cannot run here, or `None` when nothing is known
+/// against them. Worked out once: neither the runtime in the bundle nor
+/// the running system changes under a process.
+pub fn unavailable() -> Option<&'static Unavailable> {
+ #[cfg(all(target_os = "macos", target_arch = "x86_64"))]
+ {
+ static ANSWER: std::sync::OnceLock<Option<Unavailable>> = std::sync::OnceLock::new();
+ ANSWER
+ .get_or_init(|| {
+ let needs = minimum_macos(&header(&library())?)?;
+ let plist =
+ std::fs::read_to_string("/System/Library/CoreServices/SystemVersion.plist")
+ .ok()?;
+ let runs = product_version(&plist)?;
+ (packed(runs)? < needs).then(|| Unavailable {
+ needs: dotted(needs),
+ runs: runs.to_owned(),
+ })
+ })
+ .as_ref()
+ }
+ #[cfg(not(all(target_os = "macos", target_arch = "x86_64")))]
+ None
+}
+
+/// Where an Intel Mac loads the runtime from: `ORT_DYLIB_PATH` when it is
+/// set, which is how a build run from the source tree finds one; the
+/// bundle's Frameworks, where the release puts it; beside the executable;
+/// and failing those, the bare name, for dyld's own search.
+#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
+pub fn library() -> PathBuf {
+ const NAME: &str = "libonnxruntime.dylib";
+ if let Some(path) = std::env::var_os("ORT_DYLIB_PATH").filter(|path| !path.is_empty()) {
+ return PathBuf::from(path);
+ }
+ let beside = std::env::current_exe()
+ .ok()
+ .and_then(|exe| exe.parent().map(std::path::Path::to_path_buf));
+ if let Some(dir) = beside {
+ for candidate in [dir.join("../Frameworks").join(NAME), dir.join(NAME)] {
+ if candidate.is_file() {
+ return candidate;
+ }
+ }
+ }
+ PathBuf::from(NAME)
+}
+
+/// The Mach-O header and load commands at the front of `path`: enough to
+/// read its minimum, without reading the rest of a library that is tens of
+/// megabytes.
+#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
+fn header(path: &std::path::Path) -> Option<Vec<u8>> {
+ use std::io::Read;
+ let mut file = std::fs::File::open(path).ok()?;
+ let mut head = vec![0u8; 32];
+ file.read_exact(&mut head).ok()?;
+ let commands = u32::from_le_bytes(head[20..24].try_into().ok()?) as usize;
+ let mut rest = vec![0u8; commands.min(1 << 20)];
+ file.read_exact(&mut rest).ok()?;
+ head.extend_from_slice(&rest);
+ Some(head)
+}
+
+/// The minimum macOS a 64-bit Mach-O file names for itself, packed the
+/// way Mach-O packs it (`0xMMMMmmpp`): its `LC_BUILD_VERSION`'s `minos`,
+/// or an older file's `LC_VERSION_MIN_MACOSX`. `None` for anything else,
+/// a universal file among them.
+fn minimum_macos(bytes: &[u8]) -> Option<u32> {
+ const MH_MAGIC_64: u32 = 0xfeed_facf;
+ const LC_VERSION_MIN_MACOSX: u32 = 0x24;
+ const LC_BUILD_VERSION: u32 = 0x32;
+ let word = |at: usize| -> Option<u32> {
+ Some(u32::from_le_bytes(bytes.get(at..at + 4)?.try_into().ok()?))
+ };
+ if word(0)? != MH_MAGIC_64 {
+ return None;
+ }
+ let mut at = 32;
+ for _ in 0..word(16)? {
+ let (command, size) = (word(at)?, word(at + 4)? as usize);
+ match command {
+ LC_BUILD_VERSION => return word(at + 12),
+ LC_VERSION_MIN_MACOSX => return word(at + 8),
+ _ => {}
+ }
+ if size < 8 {
+ return None;
+ }
+ at += size;
+ }
+ None
+}
+
+/// `ProductVersion` from SystemVersion.plist's XML.
+fn product_version(plist: &str) -> Option<&str> {
+ let after = &plist[plist.find("<key>ProductVersion</key>")?..];
+ let start = after.find("<string>")? + "<string>".len();
+ let end = start + after[start..].find("</string>")?;
+ Some(after[start..end].trim())
+}
+
+/// `12.7.6` packed as Mach-O packs a version, to compare with one.
+fn packed(version: &str) -> Option<u32> {
+ let mut parts = version.split('.').map(str::parse::<u32>);
+ let major = parts.next()?.ok()?;
+ let minor = parts.next().unwrap_or(Ok(0)).ok()?;
+ let patch = parts.next().unwrap_or(Ok(0)).ok()?;
+ Some((major << 16) | (minor.min(0xff) << 8) | patch.min(0xff))
+}
+
+/// A packed version as people write it: `13.4`, or `13.4.1`.
+fn dotted(version: u32) -> String {
+ let (major, minor, patch) = (version >> 16, (version >> 8) & 0xff, version & 0xff);
+ if patch == 0 {
+ format!("{major}.{minor}")
+ } else {
+ format!("{major}.{minor}.{patch}")
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// A Mach-O header with one unrelated command ahead of the one asked
+ /// about, the way a real file has a dozen.
+ fn file(command: u32, version_at: usize, version: u32) -> Vec<u8> {
+ let mut bytes = Vec::new();
+ let words = |bytes: &mut Vec<u8>, words: &[u32]| {
+ for word in words {
+ bytes.extend_from_slice(&word.to_le_bytes());
+ }
+ };
+ // magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags, reserved
+ words(&mut bytes, &[0xfeed_facf, 0x0100_0007, 3, 6, 2, 40, 0, 0]);
+ // LC_UUID: cmd, cmdsize, sixteen bytes.
+ words(&mut bytes, &[0x1b, 24, 0, 0, 0, 0]);
+ let mut found = vec![command, 16, 1, 0];
+ found[version_at / 4] = version;
+ words(&mut bytes, &found);
+ bytes
+ }
+
+ #[test]
+ fn the_minimum_is_read_from_either_command() {
+ assert_eq!(
+ minimum_macos(&file(0x32, 12, 0x000d_0400)),
+ Some(0x000d_0400)
+ );
+ assert_eq!(
+ minimum_macos(&file(0x24, 8, 0x000a_0e00)),
+ Some(0x000a_0e00)
+ );
+ assert_eq!(minimum_macos(&file(0x1d, 8, 1)), None);
+ assert_eq!(minimum_macos(b"\xca\xfe\xba\xbe"), None);
+ assert_eq!(minimum_macos(&[]), None);
+ }
+
+ #[test]
+ fn versions_compare_the_way_macos_numbers_them() {
+ assert_eq!(packed("13.4"), Some(0x000d_0400));
+ assert!(packed("12.7.6") < packed("13.4"));
+ assert!(packed("13.4.1") >= packed("13.4"));
+ assert!(packed("26.0") > packed("13.4"));
+ assert_eq!(packed("twelve"), None);
+ assert_eq!(dotted(0x000d_0400), "13.4");
+ assert_eq!(dotted(0x000c_0706), "12.7.6");
+ }
+
+ #[test]
+ fn the_running_version_is_read_from_the_plist() {
+ let plist = "<dict>\n\t<key>ProductName</key>\n\t<string>macOS</string>\n\t\
+ <key>ProductVersion</key>\n\t<string>12.7.6</string>\n</dict>";
+ assert_eq!(product_version(plist), Some("12.7.6"));
+ assert_eq!(product_version("<dict></dict>"), None);
+ }
+
+ /// The test binary itself, on a Mac: a real file's header parses.
+ #[cfg(target_os = "macos")]
+ #[test]
+ fn a_real_binary_names_its_minimum() {
+ let bytes = std::fs::read(std::env::current_exe().unwrap()).unwrap();
+ let minimum = minimum_macos(&bytes).expect("a minimum");
+ assert!(minimum >= 0x000a_0000, "{}", dotted(minimum));
+ }
+}
diff --git a/src/crates/concat-vision/src/runtime.rs b/src/crates/concat-vision/src/runtime.rs
index d1449510..533f3890 100644
--- a/src/crates/concat-vision/src/runtime.rs
+++ b/src/crates/concat-vision/src/runtime.rs
@@ -53,6 +53,38 @@ pub struct Output {
pub data: Vec<f32>,
}
+/// Makes ONNX Runtime ready for a first session, or says why it cannot
+/// run here. Every session goes through here first, Chatterbox's too, and
+/// so does every model download: a gigabyte fetched for a runtime that
+/// cannot run it is a gigabyte wasted.
+///
+/// Only an Intel Mac has anything to do. Its runtime is loaded now rather
+/// than at launch (see [`crate::onnx`]), and not at all on a macOS older
+/// than the one it is built for, where loading it is what closed the app.
+/// The answer is kept: neither changes while the process runs.
+pub fn ready() -> Result<(), String> {
+ #[cfg(all(target_os = "macos", target_arch = "x86_64"))]
+ {
+ static LOADED: std::sync::OnceLock<Result<(), String>> = std::sync::OnceLock::new();
+ LOADED
+ .get_or_init(|| {
+ if let Some(why) = crate::onnx::unavailable() {
+ return Err(why.to_string());
+ }
+ let library = crate::onnx::library();
+ // `commit` is false when an environment is already set,
+ // which is nothing to report: the library is loaded.
+ let _ = ort::init_from(&library)
+ .map_err(|error| format!("could not load ONNX Runtime: {error}"))?
+ .commit();
+ Ok(())
+ })
+ .clone()
+ }
+ #[cfg(not(all(target_os = "macos", target_arch = "x86_64")))]
+ Ok(())
+}
+
/// A loaded model.
pub struct Model {
session: Session,
@@ -61,6 +93,7 @@ pub struct Model {
impl Model {
/// Loads a model from its bytes.
pub fn from_bytes(bytes: &[u8]) -> Result<Model, String> {
+ ready()?;
let mut builder = Session::builder().map_err(|error| format!("onnx runtime: {error}"))?;
builder = builder
.with_execution_providers(accelerators())
diff --git a/src/crates/concat/locales/ar.json b/src/crates/concat/locales/ar.json
index ba8f385c..aa211715 100644
--- a/src/crates/concat/locales/ar.json
+++ b/src/crates/concat/locales/ar.json
@@ -577,6 +577,8 @@
"studio.track": "المسار {0}",
"studio.undo": "تراجع",
"studio.upgradedEffects": "تُفتح بعض التأثيرات في هذا المشروع على أنها التأثيرات التي حلّت محلها: {0}. احفظ للإبقاء على التغيير.",
+ "sysinfo.aiFeatures": "ميزات الذكاء الاصطناعي",
+ "sysinfo.aiNeedsMacos": "غير متاحة: تتطلب macOS {0} أو أحدث",
"sysinfo.application": "التطبيق",
"sysinfo.build": "البنية",
"sysinfo.engine": "المحرّك",
diff --git a/src/crates/concat/locales/bn.json b/src/crates/concat/locales/bn.json
index 93d95d1a..58e7e32a 100644
--- a/src/crates/concat/locales/bn.json
+++ b/src/crates/concat/locales/bn.json
@@ -577,6 +577,8 @@
"studio.track": "ট্র্যাক {0}",
"studio.undo": "আনডু",
"studio.upgradedEffects": "এই প্রজেক্টের কিছু ইফেক্ট সেগুলোর বদলে আসা ইফেক্ট হিসেবে খোলে: {0}। পরিবর্তন রাখতে সংরক্ষণ করুন।",
+ "sysinfo.aiFeatures": "এআই বৈশিষ্ট্য",
+ "sysinfo.aiNeedsMacos": "উপলভ্য নয়: macOS {0} বা পরবর্তী সংস্করণ প্রয়োজন",
"sysinfo.application": "অ্যাপ্লিকেশন",
"sysinfo.build": "বিল্ড",
"sysinfo.engine": "ইঞ্জিন",
diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.json
index a592bac7..5b2f275e 100644
--- a/src/crates/concat/locales/de.json
+++ b/src/crates/concat/locales/de.json
@@ -577,6 +577,8 @@
"studio.track": "Track {0}",
"studio.undo": "Rückgängig",
"studio.upgradedEffects": "Einige Effekte in diesem Projekt öffnen sich als ihre Nachfolger: {0}. Speichere, um die Änderung zu behalten.",
+ "sysinfo.aiFeatures": "KI-Funktionen",
+ "sysinfo.aiNeedsMacos": "Nicht verfügbar: benötigt macOS {0} oder neuer",
"sysinfo.application": "Anwendung",
"sysinfo.build": "Build",
"sysinfo.engine": "Engine",
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index bb3e01ba..ed405c16 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -602,6 +602,8 @@
"studio.track": "Track {0}",
"studio.undo": "Undo",
"studio.upgradedEffects": "Some effects in this project open as the ones that replace them: {0}. Save to keep the change.",
+ "sysinfo.aiFeatures": "AI features",
+ "sysinfo.aiNeedsMacos": "Unavailable: needs macOS {0} or later",
"sysinfo.application": "Application",
"sysinfo.build": "Build",
"sysinfo.engine": "Engine",
diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.json
index e3009867..d125d35b 100644
--- a/src/crates/concat/locales/es.json
+++ b/src/crates/concat/locales/es.json
@@ -577,6 +577,8 @@
"studio.track": "Track {0}",
"studio.undo": "Deshacer",
"studio.upgradedEffects": "Algunos efectos de este proyecto se abren como los que los sustituyen: {0}. Guarda para conservar el cambio.",
+ "sysinfo.aiFeatures": "Funciones de IA",
+ "sysinfo.aiNeedsMacos": "No disponibles: requieren macOS {0} o posterior",
"sysinfo.application": "Aplicación",
"sysinfo.build": "Compilación",
"sysinfo.engine": "Motor",
diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.json
index c17e7726..c9a88c98 100644
--- a/src/crates/concat/locales/fa.json
+++ b/src/crates/concat/locales/fa.json
@@ -577,6 +577,8 @@
"studio.track": "ترک {0}",
"studio.undo": "واگرد",
"studio.upgradedEffects": "برخی افکت‌های این پروژه به‌صورت افکت‌های جایگزینشان باز می‌شوند: {0}. برای نگه‌داشتن این تغییر ذخیره کنید.",
+ "sysinfo.aiFeatures": "قابلیت‌های هوش مصنوعی",
+ "sysinfo.aiNeedsMacos": "در دسترس نیست: macOS {0} یا جدیدتر لازم است",
"sysinfo.application": "برنامه",
"sysinfo.build": "ساخت",
"sysinfo.engine": "موتور",
diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.json
index 34eaeead..684be9d0 100644
--- a/src/crates/concat/locales/fr.json
+++ b/src/crates/concat/locales/fr.json
@@ -577,6 +577,8 @@
"studio.track": "Track {0}",
"studio.undo": "Annuler",
"studio.upgradedEffects": "Certains effets de ce projet s'ouvrent sous la forme de ceux qui les remplacent : {0}. Enregistrez pour conserver le changement.",
+ "sysinfo.aiFeatures": "Fonctions d'IA",
+ "sysinfo.aiNeedsMacos": "Indisponibles : macOS {0} ou ultérieur requis",
"sysinfo.application": "Application",
"sysinfo.build": "Build",
"sysinfo.engine": "Moteur",
diff --git a/src/crates/concat/locales/he.json b/src/crates/concat/locales/he.json
index ac061e66..ed4bd74c 100644
--- a/src/crates/concat/locales/he.json
+++ b/src/crates/concat/locales/he.json
@@ -577,6 +577,8 @@
"studio.track": "ערוץ {0}",
"studio.undo": "ביטול פעולה",
"studio.upgradedEffects": "חלק מהאפקטים בפרויקט הזה נפתחים כאפקטים שמחליפים אותם: {0}. יש לשמור כדי לשמור על השינוי.",
+ "sysinfo.aiFeatures": "תכונות בינה מלאכותית",
+ "sysinfo.aiNeedsMacos": "לא זמינות: נדרש macOS {0} ואילך",
"sysinfo.application": "יישום",
"sysinfo.build": "גרסת בנייה",
"sysinfo.engine": "מנוע",
diff --git a/src/crates/concat/locales/hi.json b/src/crates/concat/locales/hi.json
index eb3e85d8..23764120 100644
--- a/src/crates/concat/locales/hi.json
+++ b/src/crates/concat/locales/hi.json
@@ -577,6 +577,8 @@
"studio.track": "ट्रैक {0}",
"studio.undo": "पहले जैसा करें",
"studio.upgradedEffects": "इस प्रोजेक्ट के कुछ इफ़ेक्ट उन इफ़ेक्ट के रूप में खुलते हैं जो उनकी जगह आए हैं: {0}। बदलाव रखने के लिए सेव करें।",
+ "sysinfo.aiFeatures": "एआई सुविधाएँ",
+ "sysinfo.aiNeedsMacos": "उपलब्ध नहीं: macOS {0} या बाद का संस्करण चाहिए",
"sysinfo.application": "ऐप्लिकेशन",
"sysinfo.build": "बिल्ड",
"sysinfo.engine": "इंजन",
diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.json
index 7db1d197..d2aea68a 100644
--- a/src/crates/concat/locales/hr.json
+++ b/src/crates/concat/locales/hr.json
@@ -577,6 +577,8 @@
"studio.track": "Traka {0}",
"studio.undo": "Poništi",
"studio.upgradedEffects": "Neki efekti u ovom projektu otvaraju se kao efekti koji ih zamjenjuju: {0}. Spremi da zadržiš promjenu.",
+ "sysinfo.aiFeatures": "AI značajke",
+ "sysinfo.aiNeedsMacos": "Nedostupno: potreban je macOS {0} ili noviji",
"sysinfo.application": "Aplikacija",
"sysinfo.build": "Build",
"sysinfo.engine": "Pogon",
diff --git a/src/crates/concat/locales/id.json b/src/crates/concat/locales/id.json
index 411293da..6aa271c5 100644
--- a/src/crates/concat/locales/id.json
+++ b/src/crates/concat/locales/id.json
@@ -577,6 +577,8 @@
"studio.track": "Trek {0}",
"studio.undo": "Urungkan",
"studio.upgradedEffects": "Beberapa efek di proyek ini dibuka sebagai efek penggantinya: {0}. Simpan untuk mempertahankan perubahan.",
+ "sysinfo.aiFeatures": "Fitur AI",
+ "sysinfo.aiNeedsMacos": "Tidak tersedia: memerlukan macOS {0} atau lebih baru",
"sysinfo.application": "Aplikasi",
"sysinfo.build": "Build",
"sysinfo.engine": "Mesin",
diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.json
index f1f213a3..442072ff 100644
--- a/src/crates/concat/locales/it.json
+++ b/src/crates/concat/locales/it.json
@@ -577,6 +577,8 @@
"studio.track": "Track {0}",
"studio.undo": "Annulla",
"studio.upgradedEffects": "Alcuni effetti di questo progetto si aprono come quelli che li sostituiscono: {0}. Salva per mantenere la modifica.",
+ "sysinfo.aiFeatures": "Funzioni IA",
+ "sysinfo.aiNeedsMacos": "Non disponibili: richiedono macOS {0} o successivo",
"sysinfo.application": "Applicazione",
"sysinfo.build": "Build",
"sysinfo.engine": "Motore",
diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.json
index f092d184..7bdd5e7c 100644
--- a/src/crates/concat/locales/ja.json
+++ b/src/crates/concat/locales/ja.json
@@ -577,6 +577,8 @@
"studio.track": "トラック {0}",
"studio.undo": "元に戻す",
"studio.upgradedEffects": "このプロジェクトの一部のエフェクトは、後継のエフェクトとして開かれます : {0}。変更を残すには保存してください。",
+ "sysinfo.aiFeatures": "AI 機能",
+ "sysinfo.aiNeedsMacos": "利用不可 : macOS {0} 以降が必要です",
"sysinfo.application": "アプリケーション",
"sysinfo.build": "ビルド",
"sysinfo.engine": "エンジン",
diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.json
index c6bdd1bb..dbe98438 100644
--- a/src/crates/concat/locales/ko.json
+++ b/src/crates/concat/locales/ko.json
@@ -577,6 +577,8 @@
"studio.track": "Track {0}",
"studio.undo": "실행 취소",
"studio.upgradedEffects": "이 프로젝트의 일부 효과는 이를 대체하는 효과로 열립니다: {0}. 변경 사항을 유지하려면 저장하세요.",
+ "sysinfo.aiFeatures": "AI 기능",
+ "sysinfo.aiNeedsMacos": "사용할 수 없음: macOS {0} 이상 필요",
"sysinfo.application": "응용 프로그램",
"sysinfo.build": "빌드",
"sysinfo.engine": "엔진",
diff --git a/src/crates/concat/locales/nl.json b/src/crates/concat/locales/nl.json
index 552a7d5c..5db7ef89 100644
--- a/src/crates/concat/locales/nl.json
+++ b/src/crates/concat/locales/nl.json
@@ -577,6 +577,8 @@
"studio.track": "Spoor {0}",
"studio.undo": "Ongedaan maken",
"studio.upgradedEffects": "Sommige effecten in dit project openen als de effecten die ze vervangen: {0}. Sla op om de wijziging te behouden.",
+ "sysinfo.aiFeatures": "AI-functies",
+ "sysinfo.aiNeedsMacos": "Niet beschikbaar: vereist macOS {0} of nieuwer",
"sysinfo.application": "Toepassing",
"sysinfo.build": "Build",
"sysinfo.engine": "Engine",
diff --git a/src/crates/concat/locales/pl.json b/src/crates/concat/locales/pl.json
index 72f355de..928b9cd6 100644
--- a/src/crates/concat/locales/pl.json
+++ b/src/crates/concat/locales/pl.json
@@ -577,6 +577,8 @@
"studio.track": "Ścieżka {0}",
"studio.undo": "Cofnij",
"studio.upgradedEffects": "Niektóre efekty w tym projekcie otwierają się jako efekty, które je zastępują: {0}. Zapisz, aby zachować zmianę.",
+ "sysinfo.aiFeatures": "Funkcje AI",
+ "sysinfo.aiNeedsMacos": "Niedostępne: wymagają systemu macOS {0} lub nowszego",
"sysinfo.application": "Aplikacja",
"sysinfo.build": "Kompilacja",
"sysinfo.engine": "Silnik",
diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.json
index 3ed50d29..645f6f48 100644
--- a/src/crates/concat/locales/pt-BR.json
+++ b/src/crates/concat/locales/pt-BR.json
@@ -577,6 +577,8 @@
"studio.track": "Faixa {0}",
"studio.undo": "Desfazer",
"studio.upgradedEffects": "Alguns efeitos deste projeto abrem como os que os substituem: {0}. Salve para manter a mudança.",
+ "sysinfo.aiFeatures": "Recursos de IA",
+ "sysinfo.aiNeedsMacos": "Indisponíveis: exigem macOS {0} ou posterior",
"sysinfo.application": "Aplicativo",
"sysinfo.build": "Build",
"sysinfo.engine": "Motor",
diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.json
index 380178e6..c59ee909 100644
--- a/src/crates/concat/locales/ru.json
+++ b/src/crates/concat/locales/ru.json
@@ -577,6 +577,8 @@
"studio.track": "Дорожка {0}",
"studio.undo": "Отменить",
"studio.upgradedEffects": "Некоторые эффекты проекта открываются как заменившие их: {0}. Сохраните проект, чтобы оставить изменение.",
+ "sysinfo.aiFeatures": "Функции ИИ",
+ "sysinfo.aiNeedsMacos": "Недоступны: нужна macOS {0} или новее",
"sysinfo.application": "Приложение",
"sysinfo.build": "Сборка",
"sysinfo.engine": "Движок",
diff --git a/src/crates/concat/locales/th.json b/src/crates/concat/locales/th.json
index aafd2364..a825bb0b 100644
--- a/src/crates/concat/locales/th.json
+++ b/src/crates/concat/locales/th.json
@@ -577,6 +577,8 @@
"studio.track": "แทร็ก {0}",
"studio.undo": "เลิกทำ",
"studio.upgradedEffects": "เอฟเฟกต์บางรายการในโปรเจกต์นี้จะเปิดเป็นเอฟเฟกต์ที่มาแทน: {0} บันทึกเพื่อเก็บการเปลี่ยนแปลง",
+ "sysinfo.aiFeatures": "ฟีเจอร์ AI",
+ "sysinfo.aiNeedsMacos": "ใช้งานไม่ได้: ต้องใช้ macOS {0} ขึ้นไป",
"sysinfo.application": "แอปพลิเคชัน",
"sysinfo.build": "บิลด์",
"sysinfo.engine": "เอนจิน",
diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.json
index 988b83a5..9b5ea6db 100644
--- a/src/crates/concat/locales/tr.json
+++ b/src/crates/concat/locales/tr.json
@@ -577,6 +577,8 @@
"studio.track": "Track {0}",
"studio.undo": "Geri al",
"studio.upgradedEffects": "Bu projedeki bazı efektler, yerlerini alan efektler olarak açılıyor: {0}. Değişikliği korumak için kaydedin.",
+ "sysinfo.aiFeatures": "Yapay zekâ özellikleri",
+ "sysinfo.aiNeedsMacos": "Kullanılamıyor: macOS {0} veya üstü gerekir",
"sysinfo.application": "Uygulama",
"sysinfo.build": "Derleme",
"sysinfo.engine": "Motor",
diff --git a/src/crates/concat/locales/uk.json b/src/crates/concat/locales/uk.json
index 8cb161ca..82a09d5b 100644
--- a/src/crates/concat/locales/uk.json
+++ b/src/crates/concat/locales/uk.json
@@ -577,6 +577,8 @@
"studio.track": "Доріжка {0}",
"studio.undo": "Скасувати",
"studio.upgradedEffects": "Деякі ефекти в цьому проєкті відкриваються як ті, що їх замінюють: {0}. Збережіть проєкт, щоб залишити зміну.",
+ "sysinfo.aiFeatures": "Функції ШІ",
+ "sysinfo.aiNeedsMacos": "Недоступні: потрібна macOS {0} або новіша",
"sysinfo.application": "Програма",
"sysinfo.build": "Збірка",
"sysinfo.engine": "Рушій",
diff --git a/src/crates/concat/locales/ur.json b/src/crates/concat/locales/ur.json
index 6a146cc4..575c26da 100644
--- a/src/crates/concat/locales/ur.json
+++ b/src/crates/concat/locales/ur.json
@@ -577,6 +577,8 @@
"studio.track": "ٹریک {0}",
"studio.undo": "واپس لیں",
"studio.upgradedEffects": "اس پروجیکٹ کے کچھ ایفیکٹس اپنی جگہ لینے والے ایفیکٹس کے طور پر کھلتے ہیں: {0}۔ تبدیلی برقرار رکھنے کے لیے محفوظ کریں۔",
+ "sysinfo.aiFeatures": "اے آئی خصوصیات",
+ "sysinfo.aiNeedsMacos": "دستیاب نہیں: macOS {0} یا نیا درکار ہے",
"sysinfo.application": "ایپلیکیشن",
"sysinfo.build": "بلڈ",
"sysinfo.engine": "انجن",
diff --git a/src/crates/concat/locales/vi.json b/src/crates/concat/locales/vi.json
index 197994c1..40b3008a 100644
--- a/src/crates/concat/locales/vi.json
+++ b/src/crates/concat/locales/vi.json
@@ -577,6 +577,8 @@
"studio.track": "Đường {0}",
"studio.undo": "Hoàn tác",
"studio.upgradedEffects": "Một số hiệu ứng trong dự án được mở bằng hiệu ứng thay thế: {0}. Hãy lưu để giữ thay đổi.",
+ "sysinfo.aiFeatures": "Tính năng AI",
+ "sysinfo.aiNeedsMacos": "Không khả dụng: cần macOS {0} trở lên",
"sysinfo.application": "Ứng dụng",
"sysinfo.build": "Bản dựng",
"sysinfo.engine": "Bộ máy",
diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.json
index cfd44498..5c55eafd 100644
--- a/src/crates/concat/locales/zh-Hans.json
+++ b/src/crates/concat/locales/zh-Hans.json
@@ -577,6 +577,8 @@
"studio.track": "轨道 {0}",
"studio.undo": "撤销",
"studio.upgradedEffects": "此项目中的部分效果会以取代它们的效果打开:{0}。保存即可保留此更改。",
+ "sysinfo.aiFeatures": "AI 功能",
+ "sysinfo.aiNeedsMacos": "不可用:需要 macOS {0} 或更高版本",
"sysinfo.application": "应用程序",
"sysinfo.build": "构建",
"sysinfo.engine": "引擎",
diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.json
index bda01020..8877e176 100644
--- a/src/crates/concat/locales/zh-TW.json
+++ b/src/crates/concat/locales/zh-TW.json
@@ -577,6 +577,8 @@
"studio.track": "軌道 {0}",
"studio.undo": "復原",
"studio.upgradedEffects": "此專案中的部分效果會以取代它們的效果開啟:{0}。儲存即可保留這項變更。",
+ "sysinfo.aiFeatures": "AI 功能",
+ "sysinfo.aiNeedsMacos": "無法使用:需要 macOS {0} 或更新版本",
"sysinfo.application": "應用程式",
"sysinfo.build": "建置",
"sysinfo.engine": "引擎",
diff --git a/src/crates/concat/src/sysinfo.rs b/src/crates/concat/src/sysinfo.rs
index 43649010..3139c03f 100644
--- a/src/crates/concat/src/sysinfo.rs
+++ b/src/crates/concat/src/sysinfo.rs
@@ -3,7 +3,7 @@
//! What Settings > About reports about this machine and this build.
-use crate::i18n::t;
+use crate::i18n::{t, tf};
pub fn os_description() -> String {
#[cfg(target_os = "macos")]
@@ -77,7 +77,7 @@ pub fn os_description() -> String {
/// from the report. Gathered once — every line of it is fixed for the life of
/// the process — and handed over as a model that is never replaced.
pub fn system_facts() -> Vec<(String, String)> {
- vec![
+ let mut facts = vec![
(
t("sysinfo.application"),
format!("Concat {}", env!("CARGO_PKG_VERSION")),
@@ -112,5 +112,16 @@ pub fn system_facts() -> Vec<(String, String)> {
),
),
(t("sysinfo.toolchain"), env!("BUILD_RUSTC").into()),
- ]
+ ];
+ // An Intel Mac older than the ONNX Runtime it carries runs everything
+ // but background removal, the smart brushes, Enhance and Chatterbox
+ // (#333). Each says so when asked; this says it once, where a person
+ // looks to see what their machine can do, and in the report they paste.
+ if let Some(why) = concat_vision::onnx::unavailable() {
+ facts.push((
+ t("sysinfo.aiFeatures"),
+ tf("sysinfo.aiNeedsMacos", &[&why.needs]),
+ ));
+ }
+ facts
}