1 [package]
2 name = "onde"
3 version = "1.3.3"
4 edition = "2021"
5 description = "On-device inference engine for Apple silicon."
6 license = "MIT OR Apache-2.0"
7 repository = "https://github.com/ondeinference/onde"
8 homepage = "https://ondeinference.com"
9 documentation = "https://docs.rs/onde"
10 readme = "README.md"
11 keywords = ["inference", "on-device", "chat", "llm", "mistral"]
12 categories = ["artificial-intelligence", "api-bindings"]
13
14 [workspace]
15 resolver = "2"
16 members = [".", "uniffi-bindgen", "sdk/dart/rust", "sdk/react-native/rust"]
17 exclude = ["sdk/react-native/example"]
18
19 # Shared dependency versions. Members opt in with `workspace = true` and keep
20 # their own `features` list — only the version requirement is hoisted here, so
21 # a single bump stays consistent across the root crate and the SDK crates.
22 [workspace.dependencies]
23 log = "0.4"
24 serde = "1"
25 serde_json = "1"
26 thiserror = "2"
27 tokio = "1"
28 # Pinned to =0.31.0 — the version MUST be identical across the onde crate and
29 # the uniffi-bindgen binary crate.
30 uniffi = "=0.31.0"
31 smbcloud-gresiq-sdk = "0.4.7"
32
33 [lib]
34 name = "onde"
35 # "lib" – normal Rust dependency for other crates.
36 # "cdylib" – shared library (.dylib / .so / .dll) consumed by UniFFI bindgen
37 # to generate Swift / Kotlin / Python bindings.
38 # "staticlib" – static library (.a) required for iOS targets where dynamic
39 # linking is not allowed.
40 crate-type = ["lib", "cdylib", "staticlib"]
41
42
43 # Android: CPU-only GGUF inference via candle; also needs hf-hub and
44 # mistralrs-core for explicit cache path seeding (dirs::home_dir() panics
45 # in the Android sandbox).
46 [target.'cfg(target_os = "android")'.dependencies]
47 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false }
48 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = [] }
49 mistralrs-core = { version = "0.9.3", package = "onde-mistralrs-core", features = [] }
50
51 # iOS: Metal-accelerated inference; hf-hub + mistralrs-core needed for
52 # GLOBAL_HF_CACHE sandbox workaround (~/.cache is outside the container).
53 [target.'cfg(target_os = "ios")'.dependencies]
54 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false }
55 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = ["metal"] }
56 mistralrs-core = { version = "0.9.3", package = "onde-mistralrs-core", features = ["metal"] }
57
58 # Linux: CPU-only baseline (no GPU features).
59 # For NVIDIA GPU builds, patch this to features = ["cuda"] in CI before building.
60 [target.'cfg(target_os = "linux")'.dependencies]
61 mistralrs = { version = "0.9.3", package = "onde-mistralrs" }
62
63 # macOS: Metal-accelerated inference.
64 [target.'cfg(target_os = "macos")'.dependencies]
65 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = ["metal"] }
66
67 # tvOS: Metal-accelerated inference (Apple TV has Apple GPU); hf-hub +
68 # mistralrs-core needed for GLOBAL_HF_CACHE sandbox workaround.
69 [target.'cfg(target_os = "tvos")'.dependencies]
70 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false }
71 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = ["metal"] }
72 mistralrs-core = { version = "0.9.3", package = "onde-mistralrs-core", features = ["metal"] }
73
74 # visionOS: Metal-accelerated inference (Apple Vision Pro has M2 GPU);
75 # hf-hub + mistralrs-core needed for GLOBAL_HF_CACHE sandbox workaround.
76 [target.'cfg(target_os = "visionos")'.dependencies]
77 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false }
78 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = ["metal"] }
79 mistralrs-core = { version = "0.9.3", package = "onde-mistralrs-core", features = ["metal"] }
80
81 # watchOS: Metal-accelerated inference (Apple Watch Series 4+ has Apple GPU);
82 # hf-hub + mistralrs-core needed for GLOBAL_HF_CACHE sandbox workaround.
83 # Memory constrained — default to 1.5B model.
84 [target.'cfg(target_os = "watchos")'.dependencies]
85 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false }
86 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = ["metal"] }
87 mistralrs-core = { version = "0.9.3", package = "onde-mistralrs-core", features = ["metal"] }
88
89 # Windows: CPU-only baseline (no GPU features).
90 # For NVIDIA GPU builds, patch this to features = ["cuda"] in CI before building.
91 [target.'cfg(target_os = "windows")'.dependencies]
92 mistralrs = { version = "0.9.3", package = "onde-mistralrs" }
93
94 [dependencies]
95 anyhow = "1"
96 home = "0.5.4"
97 log = { workspace = true }
98 reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
99 serde = { workspace = true, features = ["derive"] }
100 serde_json = { workspace = true }
101
102 thiserror = { workspace = true }
103 tokio = { workspace = true, features = ["macros", "rt", "sync"] }
104 tsync = "2"
105
106 uniffi = { workspace = true, features = ["tokio"] }
107
108 [dependencies.smbcloud-gresiq-sdk]
109 # 0.4.7 adds the document-gateway methods (upsert_document/get_collection) the
110 # M2 dual-write path uses. See ADR-0003 M2.
111 workspace = true
112 # path = "../smbcloud-cli/crates/smbcloud-gresiq-sdk"
113
114 [build-dependencies]
115 # Used by build.rs to compile the tvOS ___chkstk_darwin assembly stub.
116 cc = "1"
117 dotenvy = "0.15"
118 # Required for UniFFI scaffolding code generation at build time.
119 uniffi = { workspace = true, features = ["build"] }
120
121 # The target-conditional mistralrs deps above resolve to the published
122 # onde-mistralrs{,-core} 0.9.3 crates (setoelkahfi/mistral.rs fork,
123 # fix/all-platform-fixes, synced with upstream 0.9.x). Those in turn pull
124 # onde-candle-{core,nn} 0.11.0 (candle rev 27f20fea published under new names;
125 # upstream mistral.rs needs post-0.11.0 candle APIs no released candle has).
126 # For local dev against the fork, point them back at
127 # git = "https://github.com/setoelkahfi/mistral.rs", branch = "fix/all-platform-fixes"
128 # with package = "onde-mistralrs{,-core}" (the fork's crates carry the onde names
129 # now); flip to registry form before publishing, cargo publish rejects git deps.
130
131 # Patch sysctl with watchOS support until upstream merges it.
132 # PR: https://github.com/johalun/sysctl-rs/pull/74
133 # NOTE: [patch.crates-io] is ignored by crates.io consumers — safe to keep.
134 #
135 # The branch is cut from sysctl v0.6.0, not the fork's master (0.7.1), because
136 # our only consumer is gemm-common, which requires sysctl "0.6". A patch whose
137 # version is semver-incompatible with the requirement in the graph is silently
138 # dropped — cargo just logs "patch was not used in the crate graph" and builds
139 # the unpatched registry crate, which is how the watchOS check kept failing.
140 #
141 # mio no longer needs patching: onde-mistralrs-core pulls tqdm with crossterm
142 # 0.29 -> mio 1.x, so the old tqdm -> crossterm 0.25 -> mio 0.8.11 chain (which
143 # lacked visionOS support) is gone from the tree. 0.9.3 got that via the
144 # onde-tqdm fork crate; from 0.9.4 it comes from upstream tqdm 0.8.1, which
145 # carries the merged crossterm bump. onde-tqdm is retired.
146 [patch.crates-io]
147 sysctl = { git = "https://github.com/setoelkahfi/sysctl-rs.git", branch = "feature/watchos-0.6" }