π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
make ensu iOS app use our custom ORT build
laurenspriem2acf23598094
diff --git a/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.pbxproj b/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.pbxprojindex 2ad1254bbd..a1139e039e 100644--- a/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.pbxproj+++ b/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.pbxproj@@ -8,6 +8,7 @@/* Begin PBXBuildFile section */A10000012F11111100AA0001 /* LlmIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10000022F11111100AA0001 /* LlmIntegrationTests.swift */; };+ DAE20A022F00000100000002 /* EnteOnnxRuntime in Frameworks */ = {isa = PBXBuildFile; productRef = DAE20A012F00000100000001 /* EnteOnnxRuntime */; };DAF584672E61BB8300F8A08F /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = DAF584662E61BB8300F8A08F /* ZIPFoundation */; };DB9F1C3C2F9D123400ABCD02 /* Markdown in Frameworks */ = {isa = PBXBuildFile; productRef = DB9F1C3B2F9D123400ABCD02 /* Markdown */; };DBA3E91C2F7A6B9000AA11BB /* SwiftMath in Frameworks */ = {isa = PBXBuildFile; productRef = DBA3E91B2F7A6B9000AA11BB /* SwiftMath */; };@@ -65,6 +66,7 @@DAF584672E61BB8300F8A08F /* ZIPFoundation in Frameworks */,DBA3E91C2F7A6B9000AA11BB /* SwiftMath in Frameworks */,DB9F1C3C2F9D123400ABCD02 /* Markdown in Frameworks */,+ DAE20A022F00000100000002 /* EnteOnnxRuntime in Frameworks */,);runOnlyForDeploymentPostprocessing = 0;};@@ -149,6 +151,7 @@DAF584662E61BB8300F8A08F /* ZIPFoundation */,DBA3E91B2F7A6B9000AA11BB /* SwiftMath */,DB9F1C3B2F9D123400ABCD02 /* Markdown */,+ DAE20A012F00000100000001 /* EnteOnnxRuntime */,);productName = Ensu;productReference = DA72BC612E5F87A000D128FF /* Ensu.app */;@@ -186,6 +189,7 @@DBA3E91A2F7A6B9000AA11BB /* XCRemoteSwiftPackageReference "SwiftMath" */,DAF584652E61BB6300F8A08F /* XCRemoteSwiftPackageReference "ZIPFoundation" */,DB9F1C3A2F9D123400ABCD02 /* XCRemoteSwiftPackageReference "swift-markdown" */,+ DAE20A032F00000100000003 /* XCLocalSwiftPackageReference "../../packages/EnteOnnxRuntime" */,);preferredProjectObjectVersion = 77;productRefGroup = DA72BC622E5F87A000D128FF /* Products */;@@ -575,6 +579,13 @@};/* End XCConfigurationList section */+/* Begin XCLocalSwiftPackageReference section */+ DAE20A032F00000100000003 /* XCLocalSwiftPackageReference "../../packages/EnteOnnxRuntime" */ = {+ isa = XCLocalSwiftPackageReference;+ relativePath = ../../packages/EnteOnnxRuntime;+ };+/* End XCLocalSwiftPackageReference section */+/* Begin XCRemoteSwiftPackageReference section */DAF584652E61BB6300F8A08F /* XCRemoteSwiftPackageReference "ZIPFoundation" */ = {isa = XCRemoteSwiftPackageReference;@@ -603,6 +614,10 @@/* End XCRemoteSwiftPackageReference section *//* Begin XCSwiftPackageProductDependency section */+ DAE20A012F00000100000001 /* EnteOnnxRuntime */ = {+ isa = XCSwiftPackageProductDependency;+ productName = EnteOnnxRuntime;+ };DAF584662E61BB8300F8A08F /* ZIPFoundation */ = {isa = XCSwiftPackageProductDependency;package = DAF584652E61BB6300F8A08F /* XCRemoteSwiftPackageReference "ZIPFoundation" */;diff --git a/mobile/native/apple/packages/EnteOnnxRuntime/Package.swift b/mobile/native/apple/packages/EnteOnnxRuntime/Package.swiftnew file mode 100644index 0000000000..395a608a7c--- /dev/null+++ b/mobile/native/apple/packages/EnteOnnxRuntime/Package.swift@@ -0,0 +1,27 @@+// swift-tools-version: 5.9++// Ente's pinned custom ONNX Runtime static XCFramework for iOS (CoreML and+// CPU; device and ARM64 Simulator). SPM downloads the release ZIP, verifies+// its checksum (a plain SHA-256 of the archive, published in the release's+// SHA256SUMS asset), and links the correct slice into the app.+//+// The Rust side (ente-ensu's iOS `ort-sys` dependency) is built with+// "disable-linking" so that it neither downloads nor bundles any other ONNX+// Runtime; the symbols resolve against this framework at app link time.+//+// See mobile/native/onnxruntime/README.md for the release bump checklist.+import PackageDescription++let package = Package(+ name: "EnteOnnxRuntime",+ products: [+ .library(name: "EnteOnnxRuntime", targets: ["onnxruntime"])+ ],+ targets: [+ .binaryTarget(+ name: "onnxruntime",+ url: "https://github.com/laurens-pilot/ort-packaging/releases/download/ort-1.27.0-r2/onnxruntime-coreml-ios-1.27.0-r2.zip",+ checksum: "87f27a8d899ff9dbea29a0eac99e08d58a854b0d58542cc131de16f029bb8d5f"+ )+ ]+)diff --git a/mobile/native/onnxruntime/README.md b/mobile/native/onnxruntime/README.mdindex 67dae69eed..67738a90d6 100644--- a/mobile/native/onnxruntime/README.md+++ b/mobile/native/onnxruntime/README.md@@ -13,11 +13,21 @@ binaries; there are no custom download scripts.(`io.ente.onnxruntime:onnxruntime-webgpu-android`) from an Ivy repositorythat points directly at the GitHub release. Its SHA-256 is pinned viaGradle dependency verification. Used by the photos app and ensu.-- **iOS**: the release ZIP is downloaded by CocoaPods as the local+- **iOS (photos)**: the release ZIP is downloaded by CocoaPods as the local`EnteOnnxRuntime` pod (`EnteOnnxRuntime.podspec` in this directory), whichpins its SHA-256. The `ente_photos_rust` pod's build phase exports`ORT_LIB_PATH` pointing at the pre-thinned static archive for the activeplatform slice, which the Rust `ort` crate links statically.+- **iOS (ensu)**: the Ensu Xcode project links the static XCFramework from+ the same ZIP through Swift Package Manager+ (`mobile/native/apple/packages/EnteOnnxRuntime/Package.swift`, a binary+ target with a pinned checksum). The Rust side builds `ort-sys` with+ `disable-linking` on iOS (see `rust/crates/ensu/Cargo.toml`), so cargo+ neither downloads nor bundles any other ONNX Runtime; symbols resolve+ against the SPM framework at app link time. Note: because of this, build+ `ente-ensu-uniffi` for iOS with `--crate-type staticlib` (as the app's+ `build-rust.sh` does); the cdylib crate type cannot link on iOS since+ nothing provides ONNX Runtime at cargo link time.Desktop ONNX Runtime packaging is intentionally unchanged.@@ -36,6 +46,9 @@ Update the release tag, version, and SHA-256 digests (published as theversion.5. `mobile/native/android/apps/ensu/gradle/verification-metadata.xml`: sameas 3.+6. `mobile/native/apple/packages/EnteOnnxRuntime/Package.swift`: the binary+ target URL and checksum (the checksum is the plain SHA-256 of the iOS+ ZIP, identical to the one used in 1).## WebGPU rollout statusdiff --git a/rust/Cargo.lock b/rust/Cargo.lockindex b177602caa..26d3b71de9 100644--- a/rust/Cargo.lock+++ b/rust/Cargo.lock@@ -2389,6 +2389,7 @@ dependencies = ["futures-util","llama-cpp-2","ort",+ "ort-sys","parking_lot","regex","reqwest 0.12.28",diff --git a/rust/Cargo.toml b/rust/Cargo.tomlindex 1266e3fb60..489ee6f417 100644--- a/rust/Cargo.toml+++ b/rust/Cargo.toml@@ -30,6 +30,7 @@ ente-photos = { path = "crates/photos" }ente-rs = { path = "apps/cli" }ente-test-support = { path = "crates/test-support" }ort = { git = "https://github.com/pykeio/ort.git", rev = "31c8f1443bb579bfddb82705288347697e468fb3", default-features = false }+ort-sys = { git = "https://github.com/pykeio/ort.git", rev = "31c8f1443bb579bfddb82705288347697e468fb3", default-features = false }serde = { version = "1.0.228", features = ["derive"] }thiserror = "2.0.18"uniffi = { version = "0.31.0" }diff --git a/rust/crates/ensu/Cargo.toml b/rust/crates/ensu/Cargo.tomlindex 72eb5a797a..3d9eb1731a 100644--- a/rust/crates/ensu/Cargo.toml+++ b/rust/crates/ensu/Cargo.toml@@ -54,12 +54,18 @@ llama-cpp-2 = { version = "=0.1.144", features = ["mtmd"] }[target.'cfg(target_os = "android")'.dependencies]ort = { workspace = true, features = ["load-dynamic"], optional = true }+# The iOS app links Ente's custom ONNX Runtime XCFramework via SPM, so ort-sys+# must not download/link pyke's binaries. See mobile/native/onnxruntime/README.md.+[target.'cfg(target_os = "ios")'.dependencies]+ort-sys = { workspace = true, features = ["disable-linking"], optional = true }+[features]default = ["sqlite"]sqlite = ["dep:rusqlite"]transcription = ["dep:flate2","dep:ort",+ "dep:ort-sys","dep:regex","dep:rubato","dep:tar",