π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Reorganize rust llmchat and UniFFI bindings
Prateek Sunal437bc3c54b24
diff --git a/.gitignore b/.gitignoreindex 6714756010..66853ef8de 100644--- a/.gitignore+++ b/.gitignore@@ -25,7 +25,7 @@ target/# Generated native bindings / binaries (regenerate locally)mobile/native/android/apps/ensu/crypto-auth-core/src/main/jniLibs/-mobile/native/android/apps/ensu/crypto-auth-core/src/main/java/io/ente/ensu/crypto/ensu_uniffi.kt+mobile/native/android/apps/ensu/crypto-auth-core/src/main/java/io/ente/ensu/crypto/core_uniffi.ktmobile/native/android/packages/rust/.gradle/mobile/native/android/packages/rust/src/main/jniLibs/mobile/native/android/packages/rust/src/main/kotlin/io/ente/labs/inference_rs/inference_rs_uniffi.ktdiff --git a/mobile/native/android/apps/ensu/README.md b/mobile/native/android/apps/ensu/README.mdindex a61ad0e87c..cfc5d3b1d6 100644--- a/mobile/native/android/apps/ensu/README.md+++ b/mobile/native/android/apps/ensu/README.md@@ -22,11 +22,11 @@ cd mobile/native/android/packages/rust/toolThis script produces the JNI `.so` artifacts in `android/packages/rust/src/main/jniLibs/`.The UniFFI Kotlin bindings are generated separately into:-- `android/apps/ensu/crypto-auth-core/src/main/java/io/ente/ensu/crypto/ensu_uniffi.kt`+- `android/apps/ensu/crypto-auth-core/src/main/java/io/ente/ensu/crypto/core_uniffi.kt`- `android/packages/rust/src/main/kotlin/io/ente/labs/*/*_uniffi.kt`These generated files are gitignored. If bindings are missing, rebuild the corresponding-`rust/*_uniffi` crate(s) and run `uniffi-bindgen generate` for Kotlin (see each crateβs+`rust/uniffi/*` and `rust/llmchat/uniffi/*` crates and run `uniffi-bindgen generate` for Kotlin (see each crateβs`uniffi.toml` for package names).### 2. Build Debug APKdiff --git a/mobile/native/android/packages/rust/tool/build_android.sh b/mobile/native/android/packages/rust/tool/build_android.shindex bd0735585b..a08531012e 100755--- a/mobile/native/android/packages/rust/tool/build_android.sh+++ b/mobile/native/android/packages/rust/tool/build_android.sh@@ -3,11 +3,11 @@ set -euo pipefailROOT="$(cd "$(dirname "$0")/.." && pwd)"REPO_ROOT="$(cd "$ROOT/../../../../.." && pwd)"-INFERENCE_UNIFFI_RUST_DIR="$REPO_ROOT/rust/inference_rs_uniffi"-CHATDB_UNIFFI_RUST_DIR="$REPO_ROOT/rust/llmchat_db_uniffi"-CHAT_SYNC_UNIFFI_RUST_DIR="$REPO_ROOT/rust/llmchat_sync_uniffi"+INFERENCE_UNIFFI_RUST_DIR="$REPO_ROOT/rust/llmchat/uniffi/inference_rs_uniffi"+CHATDB_UNIFFI_RUST_DIR="$REPO_ROOT/rust/llmchat/uniffi/llmchat_db_uniffi"+CHAT_SYNC_UNIFFI_RUST_DIR="$REPO_ROOT/rust/llmchat/uniffi/llmchat_sync_uniffi"# Patch llama.cpp mtmd sources so mmproj models load correctly.-PATCH_SCRIPT="$REPO_ROOT/rust/inference_rs/tool/patch_llama_mtmd.sh"+PATCH_SCRIPT="$REPO_ROOT/rust/llmchat/inference/tool/patch_llama_mtmd.sh"APPLY_LLAMA_MTMD_PATCH="${APPLY_LLAMA_MTMD_PATCH:-1}"OUT_DIR="$ROOT/src/main/jniLibs"SDK_ROOT="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-}}"diff --git a/mobile/native/darwin/Apps/ensu/README.md b/mobile/native/darwin/Apps/ensu/README.mdindex 46fca1325f..e6b183a665 100644--- a/mobile/native/darwin/Apps/ensu/README.md+++ b/mobile/native/darwin/Apps/ensu/README.md@@ -14,7 +14,7 @@ All commands below assume you run them from `darwin/Apps/ensu`.The Xcode build script (`scripts/build-rust.sh`) builds Rust static libs, but it doesnot regenerate the Swift bindings. If bindings are missing, build the corresponding-`rust/*_uniffi` crate and run `uniffi-bindgen generate` to output into the paths above.+`rust/uniffi/*` or `rust/llmchat/uniffi/*` crate and run `uniffi-bindgen generate` to output into the paths above.`../Packages/Rust/tool/generate_bindings.sh` and `../Packages/Rust/tool/build_xcframework.sh`handle the InferenceRS bindings and xcframework.diff --git a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxprojindex 07658e5fb3..93fceef9d4 100644--- a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj+++ b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj@@ -133,7 +133,7 @@isa = PBXNativeTarget;buildConfigurationList = DA72BC872E5F87A100D128FF /* Build configuration list for PBXNativeTarget "ensu" */;buildPhases = (- CC142736A470612F436ECF8E /* Build Rust (ensu_uniffi) */,+ CC142736A470612F436ECF8E /* Build Rust (core_uniffi) */,DA72BC5D2E5F87A000D128FF /* Sources */,DA72BC5E2E5F87A000D128FF /* Frameworks */,DA72BC5F2E5F87A000D128FF /* Resources */,@@ -161,7 +161,7 @@isa = PBXNativeTarget;buildConfigurationList = 9C5C5C140967470293DCAAF2 /* Build configuration list for PBXNativeTarget "ensu-macos" */;buildPhases = (- 25484CE4873ED7217FB27990 /* Build Rust (ensu_uniffi) */,+ 25484CE4873ED7217FB27990 /* Build Rust (core_uniffi) */,BB83D829CC14232E7E8BDD51 /* Sources */,0BCBB02794980AFFDC386B69 /* Frameworks */,1FDE2B245F9DADEF5E026D0B /* Resources */,@@ -310,16 +310,16 @@/* End PBXResourcesBuildPhase section *//* Begin PBXShellScriptBuildPhase section */- CC142736A470612F436ECF8E /* Build Rust (ensu_uniffi) */ = {+ CC142736A470612F436ECF8E /* Build Rust (core_uniffi) */ = {isa = PBXShellScriptBuildPhase;buildActionMask = 2147483647;files = ();inputPaths = ();- name = "Build Rust (ensu_uniffi)";+ name = "Build Rust (core_uniffi)";outputPaths = (- "$(TARGET_TEMP_DIR)/ensu_rust/libensu_uniffi.a",+ "$(TARGET_TEMP_DIR)/ensu_rust/libcore_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_db_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_sync_uniffi.a",);@@ -327,16 +327,16 @@shellPath = /bin/sh;shellScript = "ENTE_API_ENDPOINT=\"${ENTE_API_ENDPOINT}\" \"${SRCROOT}/scripts/build-rust.sh\"\n";};- 25484CE4873ED7217FB27990 /* Build Rust (ensu_uniffi) */ = {+ 25484CE4873ED7217FB27990 /* Build Rust (core_uniffi) */ = {isa = PBXShellScriptBuildPhase;buildActionMask = 2147483647;files = ();inputPaths = ();- name = "Build Rust (ensu_uniffi)";+ name = "Build Rust (core_uniffi)";outputPaths = (- "$(TARGET_TEMP_DIR)/ensu_rust/libensu_uniffi.a",+ "$(TARGET_TEMP_DIR)/ensu_rust/libcore_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_db_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_sync_uniffi.a",);@@ -544,14 +544,14 @@OTHER_LDFLAGS = ("$(inherited)","-force_load",- "$(TARGET_TEMP_DIR)/ensu_rust/libensu_uniffi.a",+ "$(TARGET_TEMP_DIR)/ensu_rust/libcore_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_db_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_sync_uniffi.a",);OTHER_SWIFT_FLAGS = ("$(inherited)","-Xcc",- "-fmodule-map-file=$(SRCROOT)/ensu/Generated/ensu_uniffiFFI.modulemap",+ "-fmodule-map-file=$(SRCROOT)/ensu/Generated/core_uniffiFFI.modulemap","-Xcc","-fmodule-map-file=$(SRCROOT)/ensu/Generated/llmchat_db_uniffiFFI.modulemap","-Xcc",@@ -605,14 +605,14 @@OTHER_LDFLAGS = ("$(inherited)","-force_load",- "$(TARGET_TEMP_DIR)/ensu_rust/libensu_uniffi.a",+ "$(TARGET_TEMP_DIR)/ensu_rust/libcore_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_db_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_sync_uniffi.a",);OTHER_SWIFT_FLAGS = ("$(inherited)","-Xcc",- "-fmodule-map-file=$(SRCROOT)/ensu/Generated/ensu_uniffiFFI.modulemap",+ "-fmodule-map-file=$(SRCROOT)/ensu/Generated/core_uniffiFFI.modulemap","-Xcc","-fmodule-map-file=$(SRCROOT)/ensu/Generated/llmchat_db_uniffiFFI.modulemap","-Xcc",@@ -664,14 +664,14 @@"-framework","SystemConfiguration","-force_load",- "$(TARGET_TEMP_DIR)/ensu_rust/libensu_uniffi.a",+ "$(TARGET_TEMP_DIR)/ensu_rust/libcore_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_db_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_sync_uniffi.a",);OTHER_SWIFT_FLAGS = ("$(inherited)","-Xcc",- "-fmodule-map-file=$(SRCROOT)/ensu/Generated/ensu_uniffiFFI.modulemap",+ "-fmodule-map-file=$(SRCROOT)/ensu/Generated/core_uniffiFFI.modulemap","-Xcc","-fmodule-map-file=$(SRCROOT)/ensu/Generated/llmchat_db_uniffiFFI.modulemap","-Xcc",@@ -724,14 +724,14 @@"-framework","SystemConfiguration","-force_load",- "$(TARGET_TEMP_DIR)/ensu_rust/libensu_uniffi.a",+ "$(TARGET_TEMP_DIR)/ensu_rust/libcore_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_db_uniffi.a","$(TARGET_TEMP_DIR)/ensu_rust/libllmchat_sync_uniffi.a",);OTHER_SWIFT_FLAGS = ("$(inherited)","-Xcc",- "-fmodule-map-file=$(SRCROOT)/ensu/Generated/ensu_uniffiFFI.modulemap",+ "-fmodule-map-file=$(SRCROOT)/ensu/Generated/core_uniffiFFI.modulemap","-Xcc","-fmodule-map-file=$(SRCROOT)/ensu/Generated/llmchat_db_uniffiFFI.modulemap","-Xcc",diff --git a/mobile/native/darwin/Apps/ensu/scripts/build-rust.sh b/mobile/native/darwin/Apps/ensu/scripts/build-rust.shindex 152b32ce81..a99e111efe 100755--- a/mobile/native/darwin/Apps/ensu/scripts/build-rust.sh+++ b/mobile/native/darwin/Apps/ensu/scripts/build-rust.sh@@ -4,7 +4,7 @@ set -euo pipefail# Build the UniFFI Rust static libraries for the current Xcode build platform.## Outputs universal static libraries at:-# $TARGET_TEMP_DIR/ensu_rust/libensu_uniffi.a+# $TARGET_TEMP_DIR/ensu_rust/libcore_uniffi.a# $TARGET_TEMP_DIR/ensu_rust/libllmchat_db_uniffi.a# $TARGET_TEMP_DIR/ensu_rust/libllmchat_sync_uniffi.a@@ -126,9 +126,9 @@ HOST_SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"export SDKROOT="${HOST_SDKROOT}"build_crate_universal() {- crate_name="$1" # e.g. ensu_uniffi+ crate_name="$1" # e.g. core_unifficrate_dir="$2" # absolute path- lib_name="$3" # e.g. libensu_uniffi.a+ lib_name="$3" # e.g. libcore_uniffi.aecho "π§ Building ${crate_name} β ${lib_name}"@@ -189,6 +189,6 @@ build_crate_universal() {echo "β Built ${universal_lib}"}-build_crate_universal "ensu_uniffi" "${REPO_ROOT}/rust/ensu_uniffi" "libensu_uniffi.a"-build_crate_universal "llmchat_db_uniffi" "${REPO_ROOT}/rust/llmchat_db_uniffi" "libllmchat_db_uniffi.a"-build_crate_universal "llmchat_sync_uniffi" "${REPO_ROOT}/rust/llmchat_sync_uniffi" "libllmchat_sync_uniffi.a"+build_crate_universal "core_uniffi" "${REPO_ROOT}/rust/uniffi/core_uniffi" "libcore_uniffi.a"+build_crate_universal "llmchat_db_uniffi" "${REPO_ROOT}/rust/llmchat/uniffi/llmchat_db_uniffi" "libllmchat_db_uniffi.a"+build_crate_universal "llmchat_sync_uniffi" "${REPO_ROOT}/rust/llmchat/uniffi/llmchat_sync_uniffi" "libllmchat_sync_uniffi.a"diff --git a/mobile/native/darwin/Packages/Rust/README.md b/mobile/native/darwin/Packages/Rust/README.mdindex 9262024546..af3e32e77a 100644--- a/mobile/native/darwin/Packages/Rust/README.md+++ b/mobile/native/darwin/Packages/Rust/README.md@@ -1,6 +1,6 @@# InferenceRS (Swift)-Swift bindings generated via UniFFI for the Rust core in `../rust`.+Swift bindings generated via UniFFI for the Rust core in `rust/llmchat/inference`.## Generate bindingsdiff --git a/mobile/native/darwin/Packages/Rust/rust/Cargo.toml b/mobile/native/darwin/Packages/Rust/rust/Cargo.tomlindex c27283923d..ecbcb6b423 100644--- a/mobile/native/darwin/Packages/Rust/rust/Cargo.toml+++ b/mobile/native/darwin/Packages/Rust/rust/Cargo.toml@@ -8,7 +8,7 @@ name = "inference_rs_uniffi"crate-type = ["staticlib", "cdylib"][dependencies]-inference_rs = { path = "../../../../../../rust/inference_rs" }+inference_rs = { path = "../../../../../../rust/llmchat/inference" }serde = { version = "1", features = ["derive"] }thiserror = "1"uniffi = { version = "0.31.0" }diff --git a/mobile/native/darwin/Packages/Rust/tool/build_xcframework.sh b/mobile/native/darwin/Packages/Rust/tool/build_xcframework.shindex 48710938ab..2c5f72ba12 100755--- a/mobile/native/darwin/Packages/Rust/tool/build_xcframework.sh+++ b/mobile/native/darwin/Packages/Rust/tool/build_xcframework.sh@@ -4,7 +4,7 @@ set -euo pipefailROOT="$(cd "$(dirname "$0")/.." && pwd)"REPO_ROOT="$(cd "$ROOT/../../../../.." && pwd)"RUST_DIR="$ROOT/rust"-CORE_ROOT="$REPO_ROOT/rust/inference_rs"+CORE_ROOT="$REPO_ROOT/rust/llmchat/inference"PATCH_SCRIPT="$CORE_ROOT/tool/patch_llama_mtmd.sh"APPLY_LLAMA_MTMD_PATCH="${APPLY_LLAMA_MTMD_PATCH:-1}"LIB_NAME="libinference_rs_uniffi.a"diff --git a/mobile/native/darwin/Packages/Rust/tool/generate_bindings.sh b/mobile/native/darwin/Packages/Rust/tool/generate_bindings.shindex b06200f41f..3b499a6ec8 100755--- a/mobile/native/darwin/Packages/Rust/tool/generate_bindings.sh+++ b/mobile/native/darwin/Packages/Rust/tool/generate_bindings.sh@@ -4,7 +4,7 @@ set -euo pipefailROOT="$(cd "$(dirname "$0")/.." && pwd)"REPO_ROOT="$(cd "$ROOT/../../../../.." && pwd)"RUST_DIR="$ROOT/rust"-CORE_ROOT="$REPO_ROOT/rust/inference_rs"+CORE_ROOT="$REPO_ROOT/rust/llmchat/inference"PATCH_SCRIPT="$CORE_ROOT/tool/patch_llama_mtmd.sh"APPLY_LLAMA_MTMD_PATCH="${APPLY_LLAMA_MTMD_PATCH:-1}"OUT_DIR="$ROOT/Sources/InferenceRS"diff --git a/rust/README.md b/rust/README.mdindex 5cdbc1f742..b6ae216059 100644--- a/rust/README.md+++ b/rust/README.md@@ -41,55 +41,62 @@## Contents (this repo)- `rust/core/` (`ente-core`) - shared, pure Rust code used by clients (crypto + auth, plus small HTTP/URL helpers).-- `rust/cli/` - Rust CLI (work-in-progress).+- `rust/cli/` (`ente-rs`) - Rust CLI.+- `rust/llmchat/` - LLM chat stack (see `rust/llmchat/README.md`).## Directory Structure```rust/-βββ cli/ # CLI package+βββ cli/ # CLI package (ente-rs)β βββ src/β β βββ main.rsβ βββ Cargo.tomlβ βββ Cargo.lockβ-βββ core/ # Pure Rust shared logic- βββ src/- β βββ lib.rs- β βββ crypto/- β βββ auth/- βββ docs/- β βββ crypto.md- β βββ auth.md- βββ Cargo.toml # crate name: ente-core--web/packages/wasm/ # WASM bindings (lives in web workspace)+βββ core/ # Pure Rust shared logic (ente-core)+β βββ src/+β β βββ lib.rs+β β βββ crypto/+β β βββ auth/+β βββ docs/+β β βββ crypto.md+β β βββ auth.md+β βββ Cargo.toml+β+βββ llmchat/ # LLM chat stack (see rust/llmchat/README.md)++rust/uniffi/ # UniFFI bindings for core crypto/auth+βββ core_uniffi/++web/packages/wasm/ # WASM bindings (lives in web workspace)βββ src/-β βββ lib.rs # #[wasm_bindgen] wrappers around ente-core-βββ Cargo.toml # crate name: ente-wasm-βββ package.json # includes wasm-pack as devDependency-βββ pkg/ # generated output (gitignored)+β βββ lib.rs # #[wasm_bindgen] wrappers around ente-core+βββ Cargo.toml # crate name: ente-wasm+βββ package.json # includes wasm-pack as devDependency+βββ pkg/ # generated output (gitignored)-mobile/packages/rust/ # Shared FRB bindings for all mobile apps+mobile/packages/rust/ # Shared FRB bindings for all mobile appsβββ rust/β βββ src/-β β βββ api/ # #[frb] wrappers around ente-core-β βββ Cargo.toml # crate name: ente_rust-βββ lib/ # Generated Dart bindings-βββ pubspec.yaml # Flutter plugin package+β β βββ api/ # #[frb] wrappers around ente-core+β βββ Cargo.toml # crate name: ente_rust+βββ lib/ # Generated Dart bindings+βββ pubspec.yaml # Flutter plugin package-mobile/apps/photos/rust/ # Photos app-specific FRB bindings+mobile/apps/photos/rust/ # Photos app-specific FRB bindingsβββ src/β βββ lib.rs-β βββ api/ # #[frb] app-specific code (usearch, ML)+β βββ api/ # #[frb] app-specific code (usearch, ML)β βββ *.rs-βββ Cargo.toml # crate name: ente_photos_rust+βββ Cargo.toml # crate name: ente_photos_rust```**Crates:**- `ente-core` - shared business logic (pure Rust, no FFI)- Docs: `rust/core/docs/crypto.md`, `rust/core/docs/auth.md`+- `ente-rs` - CLI binary- `ente-wasm` - wasm-bindgen wrappers for web- `ente_rust` - shared FRB wrappers for mobile (Dart class: `EnteRust`)- `ente_photos_rust` - Photos app-specific FRB (Dart class: `EntePhotosRust`)diff --git a/rust/ensu_uniffi/build.rs b/rust/ensu_uniffi/build.rsdeleted file mode 100644index 7fdeb625f3..0000000000--- a/rust/ensu_uniffi/build.rs+++ /dev/null@@ -1,3 +0,0 @@-fn main() {- uniffi::generate_scaffolding("./src/ensu_uniffi.udl").unwrap();-}diff --git a/rust/llmchat/README.md b/rust/llmchat/README.mdnew file mode 100644index 0000000000..1782286f0d--- /dev/null+++ b/rust/llmchat/README.md@@ -0,0 +1,17 @@+# LLM Chat (Rust)++This directory contains the Rust crates for the Ensu LLM chat stack.++## Crates++- `db/` (`llmchat-db`) β local chat database.+- `sync/` (`llmchat-sync`) β sync engine (uses `llmchat-db`).+- `inference/` (`inference_rs`) β inference runtime.++## UniFFI bindings++UniFFI wrapper crates live under `uniffi/`:++- `uniffi/llmchat_db_uniffi`+- `uniffi/llmchat_sync_uniffi`+- `uniffi/inference_rs_uniffi`diff --git a/rust/llmchat-db/Cargo.lock b/rust/llmchat/db/Cargo.locksimilarity index 100%rename from rust/llmchat-db/Cargo.lockrename to rust/llmchat/db/Cargo.lockdiff --git a/rust/llmchat-db/Cargo.toml b/rust/llmchat/db/Cargo.tomlsimilarity index 92%rename from rust/llmchat-db/Cargo.tomlrename to rust/llmchat/db/Cargo.tomlindex c27112f66e..6f52b2b850 100644--- a/rust/llmchat-db/Cargo.toml+++ b/rust/llmchat/db/Cargo.toml@@ -4,7 +4,7 @@ version = "0.1.0"edition = "2024"[dependencies]-ente-core = { path = "../core" }+ente-core = { path = "../../core" }rusqlite = { version = "0.38", features = ["bundled"], optional = true }serde = { version = "1", features = ["derive"] }serde_json = "1"diff --git a/rust/llmchat-db/src/attachments_db.rs b/rust/llmchat/db/src/attachments_db.rssimilarity index 100%rename from rust/llmchat-db/src/attachments_db.rsrename to rust/llmchat/db/src/attachments_db.rsdiff --git a/rust/llmchat-db/src/attachments_migrations.rs b/rust/llmchat/db/src/attachments_migrations.rssimilarity index 100%rename from rust/llmchat-db/src/attachments_migrations.rsrename to rust/llmchat/db/src/attachments_migrations.rsdiff --git a/rust/llmchat-db/src/attachments_schema.rs b/rust/llmchat/db/src/attachments_schema.rssimilarity index 100%rename from rust/llmchat-db/src/attachments_schema.rsrename to rust/llmchat/db/src/attachments_schema.rsdiff --git a/rust/llmchat-db/src/backend/mod.rs b/rust/llmchat/db/src/backend/mod.rssimilarity index 100%rename from rust/llmchat-db/src/backend/mod.rsrename to rust/llmchat/db/src/backend/mod.rsdiff --git a/rust/llmchat-db/src/backend/sqlite.rs b/rust/llmchat/db/src/backend/sqlite.rssimilarity index 100%rename from rust/llmchat-db/src/backend/sqlite.rsrename to rust/llmchat/db/src/backend/sqlite.rsdiff --git a/rust/llmchat-db/src/crypto.rs b/rust/llmchat/db/src/crypto.rssimilarity index 100%rename from rust/llmchat-db/src/crypto.rsrename to rust/llmchat/db/src/crypto.rsdiff --git a/rust/llmchat-db/src/db.rs b/rust/llmchat/db/src/db.rssimilarity index 100%rename from rust/llmchat-db/src/db.rsrename to rust/llmchat/db/src/db.rsdiff --git a/rust/llmchat-db/src/error.rs b/rust/llmchat/db/src/error.rssimilarity index 100%rename from rust/llmchat-db/src/error.rsrename to rust/llmchat/db/src/error.rsdiff --git a/rust/llmchat-db/src/lib.rs b/rust/llmchat/db/src/lib.rssimilarity index 100%rename from rust/llmchat-db/src/lib.rsrename to rust/llmchat/db/src/lib.rsdiff --git a/rust/llmchat-db/src/llmchat.rs b/rust/llmchat/db/src/llmchat.rssimilarity index 100%rename from rust/llmchat-db/src/llmchat.rsrename to rust/llmchat/db/src/llmchat.rsdiff --git a/rust/llmchat-db/src/migrations.rs b/rust/llmchat/db/src/migrations.rssimilarity index 100%rename from rust/llmchat-db/src/migrations.rsrename to rust/llmchat/db/src/migrations.rsdiff --git a/rust/llmchat-db/src/models.rs b/rust/llmchat/db/src/models.rssimilarity index 100%rename from rust/llmchat-db/src/models.rsrename to rust/llmchat/db/src/models.rsdiff --git a/rust/llmchat-db/src/schema.rs b/rust/llmchat/db/src/schema.rssimilarity index 100%rename from rust/llmchat-db/src/schema.rsrename to rust/llmchat/db/src/schema.rsdiff --git a/rust/llmchat-db/src/traits.rs b/rust/llmchat/db/src/traits.rssimilarity index 100%rename from rust/llmchat-db/src/traits.rsrename to rust/llmchat/db/src/traits.rsdiff --git a/rust/inference_rs/Cargo.lock b/rust/llmchat/inference/Cargo.locksimilarity index 100%rename from rust/inference_rs/Cargo.lockrename to rust/llmchat/inference/Cargo.lockdiff --git a/rust/inference_rs/Cargo.toml b/rust/llmchat/inference/Cargo.tomlsimilarity index 100%rename from rust/inference_rs/Cargo.tomlrename to rust/llmchat/inference/Cargo.tomldiff --git a/rust/inference_rs/src/api.rs b/rust/llmchat/inference/src/api.rssimilarity index 100%rename from rust/inference_rs/src/api.rsrename to rust/llmchat/inference/src/api.rsdiff --git a/rust/inference_rs/src/capi.rs b/rust/llmchat/inference/src/capi.rssimilarity index 100%rename from rust/inference_rs/src/capi.rsrename to rust/llmchat/inference/src/capi.rsdiff --git a/rust/inference_rs/src/lib.rs b/rust/llmchat/inference/src/lib.rssimilarity index 100%rename from rust/inference_rs/src/lib.rsrename to rust/llmchat/inference/src/lib.rsdiff --git a/rust/inference_rs/tool/patch_llama_mtmd.sh b/rust/llmchat/inference/tool/patch_llama_mtmd.shsimilarity index 100%rename from rust/inference_rs/tool/patch_llama_mtmd.shrename to rust/llmchat/inference/tool/patch_llama_mtmd.shdiff --git a/rust/llmchat-sync/Cargo.lock b/rust/llmchat/sync/Cargo.locksimilarity index 100%rename from rust/llmchat-sync/Cargo.lockrename to rust/llmchat/sync/Cargo.lockdiff --git a/rust/llmchat-sync/Cargo.toml b/rust/llmchat/sync/Cargo.tomlsimilarity index 85%rename from rust/llmchat-sync/Cargo.tomlrename to rust/llmchat/sync/Cargo.tomlindex 781b8d0f00..a95c2aef8b 100644--- a/rust/llmchat-sync/Cargo.toml+++ b/rust/llmchat/sync/Cargo.toml@@ -4,8 +4,8 @@ version = "0.1.0"edition = "2024"[dependencies]-llmchat-db = { path = "../llmchat-db" }-ente-core = { path = "../core" }+llmchat-db = { path = "../db" }+ente-core = { path = "../../core" }reqwest = { version = "0.12", default-features = false, features = ["json", "blocking", "http2", "charset", "system-proxy", "rustls-tls-native-roots"] }serde = { version = "1", features = ["derive"] }serde_json = "1"diff --git a/rust/llmchat-sync/src/conflict.rs b/rust/llmchat/sync/src/conflict.rssimilarity index 100%rename from rust/llmchat-sync/src/conflict.rsrename to rust/llmchat/sync/src/conflict.rsdiff --git a/rust/llmchat-sync/src/crypto.rs b/rust/llmchat/sync/src/crypto.rssimilarity index 100%rename from rust/llmchat-sync/src/crypto.rsrename to rust/llmchat/sync/src/crypto.rsdiff --git a/rust/llmchat-sync/src/diff_cursor.rs b/rust/llmchat/sync/src/diff_cursor.rssimilarity index 100%rename from rust/llmchat-sync/src/diff_cursor.rsrename to rust/llmchat/sync/src/diff_cursor.rsdiff --git a/rust/llmchat-sync/src/errors.rs b/rust/llmchat/sync/src/errors.rssimilarity index 100%rename from rust/llmchat-sync/src/errors.rsrename to rust/llmchat/sync/src/errors.rsdiff --git a/rust/llmchat-sync/src/http.rs b/rust/llmchat/sync/src/http.rssimilarity index 100%rename from rust/llmchat-sync/src/http.rsrename to rust/llmchat/sync/src/http.rsdiff --git a/rust/llmchat-sync/src/lib.rs b/rust/llmchat/sync/src/lib.rssimilarity index 100%rename from rust/llmchat-sync/src/lib.rsrename to rust/llmchat/sync/src/lib.rsdiff --git a/rust/llmchat-sync/src/models.rs b/rust/llmchat/sync/src/models.rssimilarity index 100%rename from rust/llmchat-sync/src/models.rsrename to rust/llmchat/sync/src/models.rsdiff --git a/rust/llmchat-sync/src/sync.rs b/rust/llmchat/sync/src/sync.rssimilarity index 100%rename from rust/llmchat-sync/src/sync.rsrename to rust/llmchat/sync/src/sync.rsdiff --git a/rust/inference_rs_uniffi/Cargo.lock b/rust/llmchat/uniffi/inference_rs_uniffi/Cargo.locksimilarity index 100%rename from rust/inference_rs_uniffi/Cargo.lockrename to rust/llmchat/uniffi/inference_rs_uniffi/Cargo.lockdiff --git a/rust/inference_rs_uniffi/Cargo.toml b/rust/llmchat/uniffi/inference_rs_uniffi/Cargo.tomlsimilarity index 85%rename from rust/inference_rs_uniffi/Cargo.tomlrename to rust/llmchat/uniffi/inference_rs_uniffi/Cargo.tomlindex c3921f47bc..ee3ec2eab1 100644--- a/rust/inference_rs_uniffi/Cargo.toml+++ b/rust/llmchat/uniffi/inference_rs_uniffi/Cargo.toml@@ -8,7 +8,7 @@ name = "inference_rs_uniffi"crate-type = ["staticlib", "cdylib"][dependencies]-inference_rs = { path = "../inference_rs" }+inference_rs = { path = "../../inference" }serde = { version = "1", features = ["derive"] }thiserror = "1"uniffi = { version = "0.31.0" }diff --git a/rust/inference_rs_uniffi/src/api.rs b/rust/llmchat/uniffi/inference_rs_uniffi/src/api.rssimilarity index 100%rename from rust/inference_rs_uniffi/src/api.rsrename to rust/llmchat/uniffi/inference_rs_uniffi/src/api.rsdiff --git a/rust/inference_rs_uniffi/src/lib.rs b/rust/llmchat/uniffi/inference_rs_uniffi/src/lib.rssimilarity index 100%rename from rust/inference_rs_uniffi/src/lib.rsrename to rust/llmchat/uniffi/inference_rs_uniffi/src/lib.rsdiff --git a/rust/inference_rs_uniffi/uniffi.toml b/rust/llmchat/uniffi/inference_rs_uniffi/uniffi.tomlsimilarity index 100%rename from rust/inference_rs_uniffi/uniffi.tomlrename to rust/llmchat/uniffi/inference_rs_uniffi/uniffi.tomldiff --git a/rust/llmchat_db_uniffi/Cargo.lock b/rust/llmchat/uniffi/llmchat_db_uniffi/Cargo.locksimilarity index 100%rename from rust/llmchat_db_uniffi/Cargo.lockrename to rust/llmchat/uniffi/llmchat_db_uniffi/Cargo.lockdiff --git a/rust/llmchat_db_uniffi/Cargo.toml b/rust/llmchat/uniffi/llmchat_db_uniffi/Cargo.tomlsimilarity index 87%rename from rust/llmchat_db_uniffi/Cargo.tomlrename to rust/llmchat/uniffi/llmchat_db_uniffi/Cargo.tomlindex 440ef828ca..bd2ffcc380 100644--- a/rust/llmchat_db_uniffi/Cargo.toml+++ b/rust/llmchat/uniffi/llmchat_db_uniffi/Cargo.toml@@ -8,7 +8,7 @@ name = "llmchat_db_uniffi"crate-type = ["staticlib", "cdylib"][dependencies]-llmchat-db = { path = "../llmchat-db" }+llmchat-db = { path = "../../db" }serde = { version = "1", features = ["derive"] }thiserror = "2"uniffi = { version = "0.31.0" }diff --git a/rust/llmchat_db_uniffi/build.rs b/rust/llmchat/uniffi/llmchat_db_uniffi/build.rssimilarity index 100%rename from rust/llmchat_db_uniffi/build.rsrename to rust/llmchat/uniffi/llmchat_db_uniffi/build.rsdiff --git a/rust/llmchat_db_uniffi/src/api.rs b/rust/llmchat/uniffi/llmchat_db_uniffi/src/api.rssimilarity index 100%rename from rust/llmchat_db_uniffi/src/api.rsrename to rust/llmchat/uniffi/llmchat_db_uniffi/src/api.rsdiff --git a/rust/llmchat_db_uniffi/src/api.udl b/rust/llmchat/uniffi/llmchat_db_uniffi/src/api.udlsimilarity index 100%rename from rust/llmchat_db_uniffi/src/api.udlrename to rust/llmchat/uniffi/llmchat_db_uniffi/src/api.udldiff --git a/rust/llmchat_db_uniffi/src/lib.rs b/rust/llmchat/uniffi/llmchat_db_uniffi/src/lib.rssimilarity index 100%rename from rust/llmchat_db_uniffi/src/lib.rsrename to rust/llmchat/uniffi/llmchat_db_uniffi/src/lib.rsdiff --git a/rust/llmchat_db_uniffi/uniffi.toml b/rust/llmchat/uniffi/llmchat_db_uniffi/uniffi.tomlsimilarity index 100%rename from rust/llmchat_db_uniffi/uniffi.tomlrename to rust/llmchat/uniffi/llmchat_db_uniffi/uniffi.tomldiff --git a/rust/llmchat_sync_uniffi/Cargo.lock b/rust/llmchat/uniffi/llmchat_sync_uniffi/Cargo.locksimilarity index 100%rename from rust/llmchat_sync_uniffi/Cargo.lockrename to rust/llmchat/uniffi/llmchat_sync_uniffi/Cargo.lockdiff --git a/rust/llmchat_sync_uniffi/Cargo.toml b/rust/llmchat/uniffi/llmchat_sync_uniffi/Cargo.tomlsimilarity index 86%rename from rust/llmchat_sync_uniffi/Cargo.tomlrename to rust/llmchat/uniffi/llmchat_sync_uniffi/Cargo.tomlindex 684f7e405c..145636a2bf 100644--- a/rust/llmchat_sync_uniffi/Cargo.toml+++ b/rust/llmchat/uniffi/llmchat_sync_uniffi/Cargo.toml@@ -8,7 +8,7 @@ name = "llmchat_sync_uniffi"crate-type = ["staticlib", "cdylib"][dependencies]-llmchat-sync = { path = "../llmchat-sync" }+llmchat-sync = { path = "../../sync" }serde = { version = "1", features = ["derive"] }thiserror = "2"uniffi = { version = "0.31.0" }diff --git a/rust/llmchat_sync_uniffi/build.rs b/rust/llmchat/uniffi/llmchat_sync_uniffi/build.rssimilarity index 100%rename from rust/llmchat_sync_uniffi/build.rsrename to rust/llmchat/uniffi/llmchat_sync_uniffi/build.rsdiff --git a/rust/llmchat_sync_uniffi/src/api.rs b/rust/llmchat/uniffi/llmchat_sync_uniffi/src/api.rssimilarity index 100%rename from rust/llmchat_sync_uniffi/src/api.rsrename to rust/llmchat/uniffi/llmchat_sync_uniffi/src/api.rsdiff --git a/rust/llmchat_sync_uniffi/src/api.udl b/rust/llmchat/uniffi/llmchat_sync_uniffi/src/api.udlsimilarity index 100%rename from rust/llmchat_sync_uniffi/src/api.udlrename to rust/llmchat/uniffi/llmchat_sync_uniffi/src/api.udldiff --git a/rust/llmchat_sync_uniffi/src/lib.rs b/rust/llmchat/uniffi/llmchat_sync_uniffi/src/lib.rssimilarity index 100%rename from rust/llmchat_sync_uniffi/src/lib.rsrename to rust/llmchat/uniffi/llmchat_sync_uniffi/src/lib.rsdiff --git a/rust/llmchat_sync_uniffi/uniffi.toml b/rust/llmchat/uniffi/llmchat_sync_uniffi/uniffi.tomlsimilarity index 100%rename from rust/llmchat_sync_uniffi/uniffi.tomlrename to rust/llmchat/uniffi/llmchat_sync_uniffi/uniffi.tomldiff --git a/rust/ensu_uniffi/.gitignore b/rust/uniffi/core_uniffi/.gitignoresimilarity index 100%rename from rust/ensu_uniffi/.gitignorerename to rust/uniffi/core_uniffi/.gitignorediff --git a/rust/ensu_uniffi/Cargo.lock b/rust/uniffi/core_uniffi/Cargo.locksimilarity index 99%rename from rust/ensu_uniffi/Cargo.lockrename to rust/uniffi/core_uniffi/Cargo.lockindex f9c1bf1529..134eef3972 100644--- a/rust/ensu_uniffi/Cargo.lock+++ b/rust/uniffi/core_uniffi/Cargo.lock@@ -281,6 +281,17 @@ version = "0.8.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"+[[package]]+name = "core_uniffi"+version = "0.1.0"+dependencies = [+ "base64",+ "ente-core",+ "once_cell",+ "thiserror 1.0.69",+ "uniffi",+]+[[package]]name = "cpufeatures"version = "0.2.17"@@ -372,17 +383,6 @@ dependencies = ["cfg-if",]-[[package]]-name = "ensu_uniffi"-version = "0.1.0"-dependencies = [- "base64",- "ente-core",- "once_cell",- "thiserror 1.0.69",- "uniffi",-]-[[package]]name = "ente-core"version = "0.0.1"diff --git a/rust/ensu_uniffi/Cargo.toml b/rust/uniffi/core_uniffi/Cargo.tomlsimilarity index 72%rename from rust/ensu_uniffi/Cargo.tomlrename to rust/uniffi/core_uniffi/Cargo.tomlindex c48838f749..e4ece8704b 100644--- a/rust/ensu_uniffi/Cargo.toml+++ b/rust/uniffi/core_uniffi/Cargo.toml@@ -1,10 +1,10 @@[package]-name = "ensu_uniffi"+name = "core_uniffi"version = "0.1.0"edition = "2021"[lib]-name = "ensu_uniffi"+name = "core_uniffi"crate-type = ["cdylib", "staticlib"][dependencies]@@ -12,7 +12,7 @@ base64 = "0.22"once_cell = "1.19"thiserror = "1.0"uniffi = "0.31.0"-ente-core = { path = "../core", features = ["srp"] }+ente-core = { path = "../../core", features = ["srp"] }[build-dependencies]uniffi = { version = "0.31.0", features = ["build"] }diff --git a/rust/uniffi/core_uniffi/build.rs b/rust/uniffi/core_uniffi/build.rsnew file mode 100644index 0000000000..374ce75562--- /dev/null+++ b/rust/uniffi/core_uniffi/build.rs@@ -0,0 +1,3 @@+fn main() {+ uniffi::generate_scaffolding("./src/core_uniffi.udl").unwrap();+}diff --git a/rust/ensu_uniffi/src/ensu_uniffi.udl b/rust/uniffi/core_uniffi/src/core_uniffi.udlsimilarity index 98%rename from rust/ensu_uniffi/src/ensu_uniffi.udlrename to rust/uniffi/core_uniffi/src/core_uniffi.udlindex fd3ad7c86a..e957181d80 100644--- a/rust/ensu_uniffi/src/ensu_uniffi.udl+++ b/rust/uniffi/core_uniffi/src/core_uniffi.udl@@ -37,7 +37,7 @@ interface EnsuError {Message(string message);};-namespace ensu_uniffi {+namespace core_uniffi {[Throws=EnsuError]void init_crypto();diff --git a/rust/ensu_uniffi/src/lib.rs b/rust/uniffi/core_uniffi/src/lib.rssimilarity index 99%rename from rust/ensu_uniffi/src/lib.rsrename to rust/uniffi/core_uniffi/src/lib.rsindex 24fe6fdc28..2e92e84480 100644--- a/rust/ensu_uniffi/src/lib.rs+++ b/rust/uniffi/core_uniffi/src/lib.rs@@ -7,7 +7,7 @@ use std::sync::{Mutex, MutexGuard};use ente_core::{auth, crypto};-uniffi::include_scaffolding!("ensu_uniffi");+uniffi::include_scaffolding!("core_uniffi");#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct AuthSecrets {diff --git a/rust/ensu_uniffi/uniffi.toml b/rust/uniffi/core_uniffi/uniffi.tomlsimilarity index 100%rename from rust/ensu_uniffi/uniffi.tomlrename to rust/uniffi/core_uniffi/uniffi.toml