1 [package]
2 name = "onde"
3 version = "1.2.2"
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 = ["multimedia::audio", "artificial-intelligence", "api-bindings"]
13
14 [lib]
15 name = "onde"
16 # "lib" - normal Rust dependency for other crates.
17 # "cdylib" - shared library (.dylib / .so / .dll) consumed by UniFFI bindgen
18 # to generate Swift / Kotlin / Python bindings.
19 # "staticlib" - static library (.a) required for iOS targets where dynamic
20 # linking is not allowed.
21 crate-type = ["lib", "cdylib", "staticlib"]
22
23 # -- Feature flags -----------------------------------------------------------
24 [features]
25 default = []
26
27 # Android: CPU-only GGUF inference via candle; also needs hf-hub and
28 # mistralrs-core for explicit cache path seeding (dirs::home_dir() panics
29 # in the Android sandbox).
30 [target.'cfg(target_os = "android")'.dependencies]
31 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false }
32 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = [] }
33 mistralrs-core = { version = "0.9.3", package = "onde-mistralrs-core", features = [] }
34
35 # iOS: Metal-accelerated inference; hf-hub + mistralrs-core needed for
36 # GLOBAL_HF_CACHE sandbox workaround (~/.cache is outside the container).
37 [target.'cfg(target_os = "ios")'.dependencies]
38 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false }
39 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = ["metal"] }
40 mistralrs-core = { version = "0.9.3", package = "onde-mistralrs-core", features = ["metal"] }
41
42 # Linux: CPU-only baseline (no GPU features).
43 # For NVIDIA GPU builds, patch this to features = ["cuda"] in CI before building.
44 [target.'cfg(target_os = "linux")'.dependencies]
45 mistralrs = { version = "0.9.3", package = "onde-mistralrs" }
46
47 # macOS: Metal-accelerated inference.
48 [target.'cfg(target_os = "macos")'.dependencies]
49 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = ["metal"] }
50
51 # tvOS: Metal-accelerated inference (Apple TV has Apple GPU); hf-hub +
52 # mistralrs-core needed for GLOBAL_HF_CACHE sandbox workaround.
53 [target.'cfg(target_os = "tvos")'.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 # visionOS: Metal-accelerated inference (Apple Vision Pro has M2 GPU);
59 # hf-hub + mistralrs-core needed for GLOBAL_HF_CACHE sandbox workaround.
60 [target.'cfg(target_os = "visionos")'.dependencies]
61 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false }
62 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = ["metal"] }
63 mistralrs-core = { version = "0.9.3", package = "onde-mistralrs-core", features = ["metal"] }
64
65 # watchOS: Metal-accelerated inference (Apple Watch Series 4+ has Apple GPU);
66 # hf-hub + mistralrs-core needed for GLOBAL_HF_CACHE sandbox workaround.
67 # Memory constrained - default to 1.5B model.
68 [target.'cfg(target_os = "watchos")'.dependencies]
69 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false }
70 mistralrs = { version = "0.9.3", package = "onde-mistralrs", features = ["metal"] }
71 mistralrs-core = { version = "0.9.3", package = "onde-mistralrs-core", features = ["metal"] }
72
73 # Windows: CPU-only baseline (no GPU features).
74 # For NVIDIA GPU builds, patch this to features = ["cuda"] in CI before building.
75 [target.'cfg(target_os = "windows")'.dependencies]
76 mistralrs = { version = "0.9.3", package = "onde-mistralrs" }
77
78 [dependencies]
79 anyhow = "1"
80 home = "0.5.4"
81 log = "^0.4"
82 reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
83 serde = { version = "1.0", features = ["derive"] }
84 serde_json = "1"
85
86 thiserror = "2"
87 tokio = { version = "1", features = ["macros", "rt", "sync"] }
88 tsync = "2"
89
90 # Pinned to =0.31.0 -- the versions MUST be identical across the crate and
91 # the uniffi-bindgen binary crate.
92 uniffi = { version = "=0.31.0", features = ["tokio"] }
93
94 hf-hub = { version = "0.4", features = ["tokio", "rustls-tls"], default-features = false, optional = true }
95
96 [dependencies.smbcloud-gresiq-sdk]
97 # 0.4.7 adds the document-gateway methods (upsert_document/get_collection) the
98 # M2 dual-write path uses. See ADR-0003 M2.
99 version = "0.4.7"
100 # path = "../smbcloud-cli/crates/smbcloud-gresiq-sdk"
101
102 [build-dependencies]
103 # Used by build.rs to compile the tvOS ___chkstk_darwin assembly stub.
104 cc = "1"
105 dotenvy = "0.15"
106 # Required for UniFFI scaffolding code generation at build time.
107 uniffi = { version = "=0.31.0", features = ["build"] }
108
109 # ── Local development patches ────────────────────────────────────────────────
110 #
111 # The target-conditional mistralrs deps above resolve to the published
112 # onde-mistralrs{,-core} 0.9.3 crates (setoelkahfi/mistral.rs fork,
113 # fix/all-platform-fixes, synced with upstream 0.9.x). Those in turn pull
114 # onde-candle-{core,nn} 0.11.0 (candle rev 27f20fea published under new names;
115 # upstream mistral.rs needs post-0.11.0 candle APIs no released candle has).
116 #
117 # [patch.crates-io] is stripped by `cargo publish` and never seen by crates.io
118 # consumers. These patches only apply when building from this local checkout.
119 # Flip back to the registry form before publishing either way — cargo publish
120 # rejects git deps.
121 #
122 # To develop against the mistral.rs git fork locally instead of the published
123 # onde-mistralrs crates, uncomment the block below (the fork's crates carry the
124 # onde-* names now, so no `package =` rename is needed):
125 #
126 # [patch.crates-io]
127 # onde-mistralrs = { git = "https://github.com/setoelkahfi/mistral.rs", branch = "fix/all-platform-fixes" }
128 # onde-mistralrs-core = { git = "https://github.com/setoelkahfi/mistral.rs", branch = "fix/all-platform-fixes" }
129 # onde-mistralrs-quant = { git = "https://github.com/setoelkahfi/mistral.rs", branch = "fix/all-platform-fixes" }
130 # onde-mistralrs-paged-attn = { git = "https://github.com/setoelkahfi/mistral.rs", branch = "fix/all-platform-fixes" }
131 # onde-mistralrs-vision = { git = "https://github.com/setoelkahfi/mistral.rs", branch = "fix/all-platform-fixes" }
132 # onde-mistralrs-audio = { git = "https://github.com/setoelkahfi/mistral.rs", branch = "fix/all-platform-fixes" }
133 # onde-mistralrs-mcp = { git = "https://github.com/setoelkahfi/mistral.rs", branch = "fix/all-platform-fixes" }
134 # onde-mistralrs-macros = { git = "https://github.com/setoelkahfi/mistral.rs", branch = "fix/all-platform-fixes" }
135
136 # Patch sysctl with watchOS support until upstream merges it.
137 # PR: https://github.com/johalun/sysctl-rs/pull/74
138 # NOTE: [patch.crates-io] is ignored by crates.io consumers — safe to keep.
139 #
140 # mio no longer needs patching: onde-mistralrs-core 0.9.3 depends on onde-tqdm
141 # 0.8.2 (crossterm 0.29 -> mio 1.x), so the old tqdm -> crossterm 0.25 -> mio
142 # 0.8.11 chain (which lacked visionOS support) is gone from the tree.
143 [patch.crates-io]
144 sysctl = { git = "https://github.com/setoelkahfi/sysctl-rs.git", branch = "feature/watchos" }