@setoelkahfi / sigit / commits / 97a5784

Remove unused dependencies and update onde to 1.0.0

Delay ACP model loading until first prompt for cleaner startup Lazily load the default model in ACP mode to keep initialize/session/new lightweight and avoid startup diagnostics on stdout. Add a guard to ensure the model loads only once. Remove unused Unix stdout redirection.

paydii committed Apr 30, 2026 at 10:24 UTC 97a57847b10ddd79b4257658856a69119c470da4
3 files changed +447 -694
Cargo.lock
+363 -668
index 59d597e..e71a296 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -78,24 +78,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1763692fc1416554cf051efc56a3de5595eca47299d731cc5c2b583adf8b4d2f" -[[package]] -name = "aligned" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685" -dependencies = [ - "as-slice", -] - -[[package]] -name = "aligned-vec" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" -dependencies = [ - "equator", -] - [[package]] name = "allocator-api2" version = "0.2.21" @@ -201,23 +183,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "arbitrary" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" - -[[package]] -name = "arg_enum_proc_macro" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "arraydeque" version = "0.5.1" @@ -236,15 +201,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0f477b951e452a0b6b4a10b53ccd569042d1d01729b519e02074a9c0958a063" -[[package]] -name = "as-slice" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" -dependencies = [ - "stable_deref_trait", -] - [[package]] name = "askama" version = "0.14.0" @@ -346,49 +302,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" -[[package]] -name = "av-scenechange" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394" -dependencies = [ - "aligned", - "anyhow", - "arg_enum_proc_macro", - "arrayvec", - "log", - "num-rational", - "num-traits", - "pastey", - "rayon", - "thiserror 2.0.18", - "v_frame", - "y4m", -] - -[[package]] -name = "av1-grain" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8" -dependencies = [ - "anyhow", - "arrayvec", - "log", - "nom 8.0.0", - "num-rational", - "v_frame", -] - -[[package]] -name = "avif-serialize" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375082f007bd67184fb9c0374614b29f9aaa604ec301635f72338bb65386a53d" -dependencies = [ - "arrayvec", -] - [[package]] name = "aws-lc-rs" version = "1.16.3" @@ -480,15 +393,6 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" -[[package]] -name = "bitstream-io" -version = "4.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f" -dependencies = [ - "no_std_io2", -] - [[package]] name = "block" version = "0.1.6" @@ -538,12 +442,6 @@ dependencies = [ "serde", ] -[[package]] -name = "built" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ad8f11f288f48ca24471bbd51ac257aaeaaa07adae295591266b792902ae64" - [[package]] name = "bumpalo" version = "3.20.2" @@ -1543,26 +1441,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "equator" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" -dependencies = [ - "equator-macro", -] - -[[package]] -name = "equator-macro" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "equivalent" version = "1.0.2" @@ -1616,7 +1494,6 @@ dependencies = [ "half", "lebe", "miniz_oxide", - "rayon-core", "smallvec 1.15.1", "zune-inflate", ] @@ -2674,9 +2551,6 @@ dependencies = [ "num-traits", "png", "qoi", - "ravif", - "rayon", - "rgb", "tiff", "zune-core", "zune-jpeg", @@ -2692,12 +2566,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "imgref" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c5cedc30da3a610cac6b4ba17597bdf7152cf974e8aab3afb3d54455e371c8" - [[package]] name = "indexmap" version = "1.9.3" @@ -2770,17 +2638,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "interpolate_name" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "interprocess" version = "2.4.2" @@ -2930,16 +2787,6 @@ version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" -[[package]] -name = "libfuzzer-sys" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12a681b7dd8ce12bff52488013ba614b869148d54dd79836ab85aafdd53f08d" -dependencies = [ - "arbitrary", - "cc", -] - [[package]] name = "libloading" version = "0.8.9" @@ -3034,15 +2881,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "loop9" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" -dependencies = [ - "imgref", -] - [[package]] name = "lrtable" version = "0.14.1" @@ -3149,16 +2987,6 @@ dependencies = [ "rawpointer", ] -[[package]] -name = "maybe-rayon" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" -dependencies = [ - "cfg-if", - "rayon", -] - [[package]] name = "memchr" version = "2.8.0" @@ -3262,263 +3090,42 @@ dependencies = [ ] [[package]] -name = "mistralrs" -version = "0.8.1" -source = "git+https://github.com/setoelkahfi/mistral.rs?branch=fix%2Fall-platform-fixes#e53956bcd1b40c8221f79b919d78c1e496aba634" +name = "monostate" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3341a273f6c9d5bef1908f17b7267bbab0e95c9bf69a0d4dcf8e9e1b2c76ef67" dependencies = [ - "anyhow", - "candle-core", - "candle-nn", - "clap 4.6.1", - "either", - "futures", - "image", - "indexmap 2.14.0", - "mistralrs-core", - "mistralrs-macros", - "rand 0.9.4", - "reqwest 0.13.2", - "schemars 1.2.1", + "monostate-impl", "serde", - "serde_json", - "thiserror 2.0.18", - "tokio", - "tracing", - "tracing-subscriber", - "walkdir", + "serde_core", ] [[package]] -name = "mistralrs-audio" -version = "0.8.1" -source = "git+https://github.com/setoelkahfi/mistral.rs?branch=fix%2Fall-platform-fixes#e53956bcd1b40c8221f79b919d78c1e496aba634" +name = "monostate-impl" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4db6d5580af57bf992f59068d4ea26fd518574ff48d7639b255a36f9de6e7e9" dependencies = [ - "anyhow", - "apodize", - "hound", - "symphonia", + "proc-macro2", + "quote", + "syn 2.0.117", ] [[package]] -name = "mistralrs-core" +name = "moxcms" version = "0.8.1" -source = "git+https://github.com/setoelkahfi/mistral.rs?branch=fix%2Fall-platform-fixes#e53956bcd1b40c8221f79b919d78c1e496aba634" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" dependencies = [ - "ahash", - "akin", - "anyhow", - "apodize", - "as-any", - "async-trait", - "base64 0.22.1", - "bm25", - "bytemuck", - "bytemuck_derive", - "candle-core", - "candle-metal-kernels", - "candle-nn", - "cfgrammar", - "chrono", - "clap 4.6.1", - "csv", - "derive-new", - "derive_more", - "dirs", - "either", - "float8", - "futures", - "galil-seiferas", - "half", - "hashbrown 0.16.1", - "hf-hub", - "hound", - "html2text", - "http", - "image", - "indexmap 2.14.0", - "indicatif 0.18.4", - "interprocess", - "itertools 0.14.0", - "libc", - "llguidance", - "lrtable", - "minijinja", - "minijinja-contrib", - "mistralrs-audio", - "mistralrs-mcp", - "mistralrs-paged-attn", - "mistralrs-quant", - "mistralrs-vision", "num-traits", - "objc", - "objc2-metal", - "openai-harmony", - "ordered-float", - "parking_lot", - "radix_trie", - "rand 0.9.4", - "rand_distr 0.5.1", - "rand_isaac", - "rayon", - "regex", - "regex-automata", - "reqwest 0.13.2", - "rubato", - "rust-mcp-schema", - "rustc-hash 2.1.2", - "rustfft", - "safetensors 0.7.0", - "schemars 1.2.1", - "scraper", - "serde", - "serde-big-array", - "serde-saphyr", - "serde_json", - "serde_plain", - "statrs", - "strum 0.27.2", - "symphonia", - "sysinfo", - "thiserror 2.0.18", - "tokenizers 0.21.4", - "tokio", - "tokio-rayon", - "tokio-tungstenite", - "toktrie", - "toktrie_hf_tokenizers", - "toml", - "tqdm", - "tracing", - "tracing-subscriber", - "urlencoding", - "uuid 1.23.1", - "variantly", - "vob", -] - -[[package]] -name = "mistralrs-macros" -version = "0.8.1" -source = "git+https://github.com/setoelkahfi/mistral.rs?branch=fix%2Fall-platform-fixes#e53956bcd1b40c8221f79b919d78c1e496aba634" -dependencies = [ - "darling 0.23.0", - "proc-macro2", - "quote", - "syn 2.0.117", + "pxfm", ] [[package]] -name = "mistralrs-mcp" -version = "0.8.1" -source = "git+https://github.com/setoelkahfi/mistral.rs?branch=fix%2Fall-platform-fixes#e53956bcd1b40c8221f79b919d78c1e496aba634" -dependencies = [ - "anyhow", - "async-trait", - "futures-util", - "http", - "reqwest 0.13.2", - "rust-mcp-schema", - "serde", - "serde_json", - "tokio", - "tokio-tungstenite", - "tracing", - "utoipa", - "uuid 1.23.1", -] - -[[package]] -name = "mistralrs-paged-attn" -version = "0.8.1" -source = "git+https://github.com/setoelkahfi/mistral.rs?branch=fix%2Fall-platform-fixes#e53956bcd1b40c8221f79b919d78c1e496aba634" -dependencies = [ - "anyhow", - "candle-core", - "candle-metal-kernels", - "dispatch2", - "float8", - "half", - "objc2-foundation", - "objc2-metal", - "thiserror 2.0.18", -] - -[[package]] -name = "mistralrs-quant" -version = "0.8.1" -source = "git+https://github.com/setoelkahfi/mistral.rs?branch=fix%2Fall-platform-fixes#e53956bcd1b40c8221f79b919d78c1e496aba634" -dependencies = [ - "byteorder", - "candle-core", - "candle-metal-kernels", - "candle-nn", - "dispatch2", - "float8", - "half", - "hf-hub", - "lazy_static", - "memmap2", - "objc2-foundation", - "objc2-metal", - "paste", - "rayon", - "regex", - "safetensors 0.7.0", - "serde", - "serde_json", - "thiserror 2.0.18", - "tokio", - "tracing", - "yoke 0.8.2", -] - -[[package]] -name = "mistralrs-vision" -version = "0.8.1" -source = "git+https://github.com/setoelkahfi/mistral.rs?branch=fix%2Fall-platform-fixes#e53956bcd1b40c8221f79b919d78c1e496aba634" -dependencies = [ - "candle-core", - "image", - "rayon", -] - -[[package]] -name = "monostate" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3341a273f6c9d5bef1908f17b7267bbab0e95c9bf69a0d4dcf8e9e1b2c76ef67" -dependencies = [ - "monostate-impl", - "serde", - "serde_core", -] - -[[package]] -name = "monostate-impl" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4db6d5580af57bf992f59068d4ea26fd518574ff48d7639b255a36f9de6e7e9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "moxcms" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" -dependencies = [ - "num-traits", - "pxfm", -] - -[[package]] -name = "nalgebra" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d43ddcacf343185dfd6de2ee786d9e8b1c2301622afab66b6c73baf9882abfd" +name = "nalgebra" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d43ddcacf343185dfd6de2ee786d9e8b1c2301622afab66b6c73baf9882abfd" dependencies = [ "approx", "matrixmultiply", @@ -3546,15 +3153,6 @@ dependencies = [ "smallvec 1.15.1", ] -[[package]] -name = "no_std_io2" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b51ed7824b6e07d354605f4abb3d9d300350701299da96642ee084f5ce631550" -dependencies = [ - "memchr", -] - [[package]] name = "nohash-hasher" version = "0.2.0" @@ -3571,21 +3169,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nom" -version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" -dependencies = [ - "memchr", -] - -[[package]] -name = "noop_proc_macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" - [[package]] name = "ntapi" version = "0.4.3" @@ -3644,17 +3227,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "num-integer" version = "0.1.46" @@ -3707,116 +3279,380 @@ dependencies = [ ] [[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - -[[package]] -name = "objc" -version = "0.2.7" +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.11.1", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.11.1", + "block2", + "libc", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +dependencies = [ + "libc", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.11.1", + "block2", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "onde" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f675186adc948026c62e4e20efde5665ac11c7d44249d3d4afabc59a156c6f" +dependencies = [ + "anyhow", + "cc", + "dotenvy", + "hf-hub", + "home", + "log", + "onde-mistralrs", + "onde-mistralrs-core", + "reqwest 0.12.28", + "serde", + "serde_json", + "smbcloud-gresiq-sdk", + "thiserror 2.0.18", + "tokio", + "tsync", + "uniffi", +] + +[[package]] +name = "onde-mistralrs" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4b5589da2ed82d3962ab4d8278cc8a93fea7c758eb1230894ffadb926c3c16c" +dependencies = [ + "anyhow", + "candle-core", + "candle-nn", + "clap 4.6.1", + "either", + "futures", + "image", + "indexmap 2.14.0", + "onde-mistralrs-core", + "onde-mistralrs-macros", + "rand 0.9.4", + "reqwest 0.13.2", + "schemars 1.2.1", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "tracing", + "tracing-subscriber", + "walkdir", +] + +[[package]] +name = "onde-mistralrs-audio" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed88aa277c613327f393ff5816fed55609a7a93b87ace505d70a6b3438b12dd2" +dependencies = [ + "anyhow", + "apodize", + "hound", + "symphonia", +] + +[[package]] +name = "onde-mistralrs-core" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7872456b7db2d8aaf39da83269dbf77e2503d6d398010f3b9a17eebec3da8dee" +dependencies = [ + "ahash", + "akin", + "anyhow", + "apodize", + "as-any", + "async-trait", + "base64 0.22.1", + "bm25", + "bytemuck", + "bytemuck_derive", + "candle-core", + "candle-metal-kernels", + "candle-nn", + "cfgrammar", + "chrono", + "clap 4.6.1", + "csv", + "derive-new", + "derive_more", + "dirs", + "either", + "float8", + "futures", + "galil-seiferas", + "half", + "hashbrown 0.16.1", + "hf-hub", + "hound", + "html2text", + "http", + "image", + "indexmap 2.14.0", + "indicatif 0.18.4", + "interprocess", + "itertools 0.14.0", + "libc", + "llguidance", + "lrtable", + "minijinja", + "minijinja-contrib", + "num-traits", + "objc", + "objc2-metal", + "onde-mistralrs-audio", + "onde-mistralrs-mcp", + "onde-mistralrs-paged-attn", + "onde-mistralrs-quant", + "onde-mistralrs-vision", + "onde-openai-harmony", + "onde-tqdm", + "ordered-float", + "parking_lot", + "radix_trie", + "rand 0.9.4", + "rand_distr 0.5.1", + "rand_isaac", + "rayon", + "regex", + "regex-automata", + "reqwest 0.13.2", + "rubato", + "rust-mcp-schema", + "rustc-hash 2.1.2", + "rustfft", + "safetensors 0.7.0", + "schemars 1.2.1", + "scraper", + "serde", + "serde-big-array", + "serde-saphyr", + "serde_json", + "serde_plain", + "statrs", + "strum 0.27.2", + "symphonia", + "sysinfo", + "thiserror 2.0.18", + "tokenizers 0.21.4", + "tokio", + "tokio-rayon", + "tokio-tungstenite", + "toktrie", + "toktrie_hf_tokenizers", + "toml", + "tracing", + "tracing-subscriber", + "urlencoding", + "uuid 1.23.1", + "variantly", + "vob", +] + +[[package]] +name = "onde-mistralrs-macros" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +checksum = "ed7a88fcf59377469c00a355065f3ad9723e00c1870c8b3717b0649f86c77bde" dependencies = [ - "malloc_buf", + "darling 0.23.0", + "proc-macro2", + "quote", + "syn 2.0.117", ] [[package]] -name = "objc2" -version = "0.6.4" +name = "onde-mistralrs-mcp" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +checksum = "f708829672943371b2a14cceaa8c09182d11c9049ec6d3a9c303a74ae65dfc1f" dependencies = [ - "objc2-encode", + "anyhow", + "async-trait", + "futures-util", + "http", + "reqwest 0.13.2", + "rust-mcp-schema", + "serde", + "serde_json", + "tokio", + "tokio-tungstenite", + "tracing", + "utoipa", + "uuid 1.23.1", ] [[package]] -name = "objc2-core-foundation" -version = "0.3.2" +name = "onde-mistralrs-paged-attn" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +checksum = "bdd14bcbee553325d640609504117a2a49db166417bd7883329c6d39971b28c2" dependencies = [ - "bitflags 2.11.1", + "anyhow", + "candle-core", + "candle-metal-kernels", "dispatch2", - "objc2", + "float8", + "half", + "objc2-foundation", + "objc2-metal", + "thiserror 2.0.18", ] [[package]] -name = "objc2-encode" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" - -[[package]] -name = "objc2-foundation" -version = "0.3.2" +name = "onde-mistralrs-quant" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +checksum = "36928bb1eec1138ca7b36ee1f4d370e4e374f0874f378915ff0ff34f927c4daf" dependencies = [ - "bitflags 2.11.1", - "block2", - "libc", - "objc2", - "objc2-core-foundation", + "byteorder", + "candle-core", + "candle-metal-kernels", + "candle-nn", + "dispatch2", + "float8", + "half", + "hf-hub", + "lazy_static", + "memmap2", + "objc2-foundation", + "objc2-metal", + "paste", + "rayon", + "regex", + "safetensors 0.7.0", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "tracing", + "yoke 0.8.2", ] [[package]] -name = "objc2-io-kit" -version = "0.3.2" +name = "onde-mistralrs-vision" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +checksum = "2670a611890bfddc7964902f253626cd2b3fd0b7df13f84a779180f35e2a79e9" dependencies = [ - "libc", - "objc2-core-foundation", + "candle-core", + "image", + "rayon", ] [[package]] -name = "objc2-metal" -version = "0.3.2" +name = "onde-openai-harmony" +version = "0.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +checksum = "f0f73e12b7378937cb8aaf832bed02b2afa1687581f73c3298c5af0cca9df5e6" dependencies = [ - "bitflags 2.11.1", - "block2", - "dispatch2", - "objc2", - "objc2-core-foundation", - "objc2-foundation", + "anyhow", + "base64 0.22.1", + "bstr", + "clap 4.6.1", + "fancy-regex 0.13.0", + "futures", + "regex", + "reqwest 0.12.28", + "rustc-hash 1.1.0", + "serde", + "serde_json", + "serde_with", + "sha1", + "sha2", + "thiserror 2.0.18", ] [[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "once_cell_polyfill" -version = "1.70.2" +name = "onde-tqdm" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" - -[[package]] -name = "onde" -version = "0.1.8" -source = "git+https://github.com/ondeinference/onde?branch=development#dfcc6ecfa74ac965af6c33ba0bd06d9cf241fc12" +checksum = "2d96f4fcb4af06959bf9c9b81ace0502e2be2d11d7e037c94f3f7851bde720ea" dependencies = [ "anyhow", - "cc", - "dotenvy", - "hf-hub", - "home", - "log", - "mistralrs", - "mistralrs-core", - "reqwest 0.12.28", - "serde", - "serde_json", - "smbcloud-gresiq-sdk", - "thiserror 2.0.18", - "tokio", - "tsync", - "uniffi", + "crossterm 0.29.0", + "once_cell", ] [[package]] @@ -3841,30 +3677,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "openai-harmony" -version = "0.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77e82af451fc95deeb728a40b84db8ee82d341e136c268de415123a560b9b72" -dependencies = [ - "anyhow", - "base64 0.22.1", - "bstr", - "clap 4.6.1", - "fancy-regex 0.13.0", - "futures", - "image", - "regex", - "reqwest 0.12.28", - "rustc-hash 1.1.0", - "serde", - "serde_json", - "serde_with", - "sha1", - "sha2", - "thiserror 2.0.18", -] - [[package]] name = "openssl-probe" version = "0.2.1" @@ -3930,12 +3742,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "pastey" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" - [[package]] name = "percent-encoding" version = "2.3.2" @@ -4114,25 +3920,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "profiling" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" -dependencies = [ - "profiling-procmacros", -] - -[[package]] -name = "profiling-procmacros" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b" -dependencies = [ - "quote", - "syn 2.0.117", -] - [[package]] name = "pulp" version = "0.21.5" @@ -4387,56 +4174,6 @@ dependencies = [ "unicode-width 0.2.0", ] -[[package]] -name = "rav1e" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b" -dependencies = [ - "aligned-vec", - "arbitrary", - "arg_enum_proc_macro", - "arrayvec", - "av-scenechange", - "av1-grain", - "bitstream-io", - "built", - "cfg-if", - "interpolate_name", - "itertools 0.14.0", - "libc", - "libfuzzer-sys", - "log", - "maybe-rayon", - "new_debug_unreachable", - "noop_proc_macro", - "num-derive", - "num-traits", - "paste", - "profiling", - "rand 0.9.4", - "rand_chacha 0.9.0", - "simd_helpers", - "thiserror 2.0.18", - "v_frame", - "wasm-bindgen", -] - -[[package]] -name = "ravif" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45" -dependencies = [ - "avif-serialize", - "imgref", - "loop9", - "quick-error", - "rav1e", - "rayon", - "rgb", -] - [[package]] name = "raw-cpuid" version = "11.6.0" @@ -4664,12 +4401,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "rgb" -version = "0.8.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" - [[package]] name = "ring" version = "0.17.14" @@ -5341,15 +5072,6 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" -[[package]] -name = "simd_helpers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" -dependencies = [ - "quote", -] - [[package]] name = "siphasher" version = "1.0.2" @@ -5479,7 +5201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5851699c4033c63636f7ea4cf7b7c1f1bf06d0cc03cfb42e711de5a5c46cf326" dependencies = [ "base64 0.13.1", - "nom 7.1.3", + "nom", "serde", "unicode-segmentation", ] @@ -6348,16 +6070,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" -[[package]] -name = "tqdm" -version = "0.8.0" -source = "git+https://github.com/setoelkahfi/tqdm?branch=deps%2Fbump-crossterm#41e4182829136e6dadbdd1c36af824d19219147a" -dependencies = [ - "anyhow", - "crossterm 0.29.0", - "once_cell", -] - [[package]] name = "tracing" version = "0.1.44" @@ -6832,17 +6544,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "v_frame" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" -dependencies = [ - "aligned-vec", - "num-traits", - "wasm-bindgen", -] - [[package]] name = "valuable" version = "0.1.1" @@ -7107,7 +6808,7 @@ version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e" dependencies = [ - "nom 7.1.3", + "nom", ] [[package]] @@ -7734,12 +7435,6 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" -[[package]] -name = "y4m" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" - [[package]] name = "yoke" version = "0.7.5"
Cargo.toml
+1 -1
index 74b82b3..3a1a59d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ agent-client-protocol = { version = "0.10.4", features = ["unstable_session_fork # Onde Inference engine (local LLM) # onde = { path = "../onde" } -onde = { version = "0.1.8", git = "https://github.com/ondeinference/onde", branch = "development" } +onde = "1.0.0" # Async runtime async-trait = "0.1"
src/main.rs
+83 -25
index cf38781..a80b2bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -273,6 +273,8 @@ struct SiGitAgent { current_model: std::sync::Mutex<GgufModelConfig>, /// flipped once the startup model finishes (success or failure) model_ready: Arc<AtomicBool>, + /// guards the one-time lazy startup load for ACP mode + startup_model_load_started: Arc<AtomicBool>, /// set if the startup load failed model_load_error: Arc<std::sync::Mutex<Option<String>>>, /// true when the startup model isn't cached yet @@ -289,6 +291,7 @@ impl SiGitAgent { notification_tx: mpsc::Sender<SessionNotification>, initial_model: GgufModelConfig, model_ready: Arc<AtomicBool>, + startup_model_load_started: Arc<AtomicBool>, model_load_error: Arc<std::sync::Mutex<Option<String>>>, startup_needs_download: bool, ) -> Self { @@ -300,6 +303,7 @@ impl SiGitAgent { session_cwd: std::sync::Mutex::new(None), current_model: std::sync::Mutex::new(initial_model), model_ready, + startup_model_load_started, model_load_error, startup_needs_download, startup_model_name, @@ -307,6 +311,66 @@ impl SiGitAgent { } } + fn start_startup_model_load_if_needed(&self) { + if self + .startup_model_load_started + .compare_exchange(false, true, Ordering::AcqRel, Ordering::Acquire) + .is_err() + { + return; + } + + self.model_ready.store(false, Ordering::Release); + if let Ok(mut guard) = self.model_load_error.lock() { + *guard = None; + } + + let startup_config = self.current_model.lock().unwrap().clone(); + let (max_tokens, tool_calling) = models::build_model_picker_items() + .into_iter() + .find(|item| { + item.config.model_id == startup_config.model_id + && item + .config + .files + .first() + .zip(startup_config.files.first()) + .map(|(left, right)| left == right) + .unwrap_or(false) + }) + .map(|item| (item.max_tokens, item.tool_calling)) + .unwrap_or((4096, false)); + + let sampling = SamplingConfig { + max_tokens: Some(max_tokens), + ..SamplingConfig::default() + }; + + let loader_engine = Arc::clone(&self.engine); + let loader_system_prompt = system_prompt_for_model(tool_calling).to_string(); + let model_ready = Arc::clone(&self.model_ready); + let model_load_error = Arc::clone(&self.model_load_error); + + std::thread::spawn(move || { + let result = tokio::runtime::Runtime::new() + .map_err(|error| error.to_string()) + .and_then(|rt| { + rt.block_on(loader_engine.load_gguf_model( + startup_config, + Some(loader_system_prompt), + Some(sampling), + )) + .map(|_| ()) + .map_err(|error| error.to_string()) + }); + + if let Ok(mut guard) = model_load_error.lock() { + *guard = result.err(); + } + model_ready.store(true, Ordering::Release); + }); + } + /// block until the startup model is ready, showing progress in the session. async fn await_model_ready(&self, session_id: &SessionId) -> agent_client_protocol::Result<()> { if self.model_ready.load(Ordering::Acquire) { @@ -544,6 +608,13 @@ impl SiGitAgent { agent_client_protocol::Error::new(-32603, format!("model switch failed: {error}")) })?; + self.startup_model_load_started + .store(true, Ordering::Release); + self.model_ready.store(true, Ordering::Release); + if let Ok(mut guard) = self.model_load_error.lock() { + *guard = None; + } + if let Some(item) = models::build_model_picker_items() .iter() .find(|item| item.config.model_id == new_config.model_id) @@ -1193,7 +1264,9 @@ impl Agent for SiGitAgent { user_text.chars().take(80).collect::<String>() ); - // wait for the startup model if it's still loading/downloading + // load the default ACP model lazily so initialize/session/new stay clean + // for registry validation and editor startup. + self.start_startup_model_load_if_needed(); self.await_model_ready(&session_id).await?; // ── tool-calling loop ──────────────────────────────────────────── @@ -1318,7 +1391,9 @@ impl Agent for SiGitAgent { // can't switch while the startup model is still loading — the old // weights are in GPU memory and the new load gets "does not fit" - if !self.model_ready.load(Ordering::Acquire) { + if self.startup_model_load_started.load(Ordering::Acquire) + && !self.model_ready.load(Ordering::Acquire) + { log::info!("set_session_config_option: waiting for startup model to finish loading"); while !self.model_ready.load(Ordering::Acquire) { tokio::time::sleep(std::time::Duration::from_millis(200)).await; @@ -1676,23 +1751,6 @@ fn init_logging(is_tty: bool) { .try_init(); } -#[cfg(unix)] -fn redirect_stdout_to_stderr() -> anyhow::Result<()> { - let stderr_dup = unsafe { libc::dup(libc::STDERR_FILENO) }; - anyhow::ensure!( - stderr_dup >= 0, - "dup(stderr) failed: {}", - std::io::Error::last_os_error() - ); - - unsafe { - libc::dup2(stderr_dup, libc::STDOUT_FILENO); - libc::close(stderr_dup); - } - - Ok(()) -} - // ── Interactive TUI mode ────────────────────────────────────────────────────── /// boot the TUI and load the model on a background thread. @@ -1822,9 +1880,10 @@ async fn run_acp_server() -> anyhow::Result<()> { let engine = Arc::new(ChatEngine::new()); - // Delay model loading until after initialize/auth so ACP stdout stays clean - // even if model libraries emit startup diagnostics. + // Delay model loading until the first real prompt so initialize/session/new + // stay lightweight and registry auth checks don't trip over model startup. let model_ready = Arc::new(AtomicBool::new(true)); + let startup_model_load_started = Arc::new(AtomicBool::new(false)); let model_load_error: Arc<std::sync::Mutex<Option<String>>> = Arc::new(std::sync::Mutex::new(None)); @@ -1834,6 +1893,7 @@ async fn run_acp_server() -> anyhow::Result<()> { notification_tx, config, model_ready, + startup_model_load_started, model_load_error, needs_download, ); @@ -1894,10 +1954,8 @@ async fn main() -> anyhow::Result<()> { anyhow::bail!("interactive mode requires Unix (macOS / Linux)"); } } else { - // ACP mode: stdout must contain only ACP JSON messages. - #[cfg(unix)] - redirect_stdout_to_stderr()?; - + // ACP mode: keep stdout untouched for protocol JSON only. + // Logs already go to stderr via `init_logging(false)`. init_logging(false); setup::setup_shared_model_cache(); log::info!("siGit v{} starting (ACP mode)", env!("CARGO_PKG_VERSION"));