A high-performance inference engine for AI models
xgrammar policy
uuuvne79ac764fed0
diff --git a/Cargo.lock b/Cargo.lockindex 19f001918..f137cf46a 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -90,6 +90,19 @@ dependencies = ["windows-sys 0.59.0",]+[[package]]+name = "aquamarine"+version = "0.1.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a941c39708478e8eea39243b5983f1c42d2717b3620ee91f4a52115fd02ac43f"+dependencies = [+ "itertools 0.9.0",+ "proc-macro-error",+ "proc-macro2",+ "quote",+ "syn 1.0.109",+]+[[package]]name = "async-stream"version = "0.3.6"@@ -109,7 +122,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -120,7 +133,7 @@ checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -138,12 +151,133 @@ dependencies = ["bytemuck",]+[[package]]+name = "atomic-waker"+version = "1.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"++[[package]]+name = "atty"+version = "0.2.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"+dependencies = [+ "hermit-abi 0.1.19",+ "libc",+ "winapi",+]+[[package]]name = "autocfg"version = "1.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"+[[package]]+name = "autocxx"+version = "0.30.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5ae6bbbec65d053b6fd803a4d63d21d0bd4a92f84f917847f216fec8bb8ae6ae"+dependencies = [+ "aquamarine",+ "autocxx-macro",+ "cxx",+ "moveit",+]++[[package]]+name = "autocxx-bindgen"+version = "0.73.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ecaaf84d9cf1a772409c0abdac7d2477a31fd890dbdf606d8f684dc60129aa94"+dependencies = [+ "bitflags 2.9.4",+ "cexpr",+ "clang-sys",+ "itertools 0.13.0",+ "log",+ "proc-macro2",+ "quote",+ "regex",+ "rustc-hash",+ "shlex",+ "syn 2.0.102",+]++[[package]]+name = "autocxx-build"+version = "0.30.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b16fa879472d80dc40ca826a59347772b3f15e69a7a74df41c4935942f62cf30"+dependencies = [+ "autocxx-engine",+ "env_logger",+ "indexmap 1.9.3",+ "syn 2.0.102",+]++[[package]]+name = "autocxx-engine"+version = "0.30.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9866b109f7091a3470a49906d35c7f34597828be8885508e9395d1194f8283ca"+dependencies = [+ "aquamarine",+ "autocxx-bindgen",+ "autocxx-parser",+ "cc",+ "cxx-gen",+ "indexmap 1.9.3",+ "indoc",+ "itertools 0.10.5",+ "log",+ "miette",+ "once_cell",+ "prettyplease",+ "proc-macro2",+ "quote",+ "regex",+ "regex_static",+ "rustversion",+ "serde_json",+ "syn 2.0.102",+ "tempfile",+ "thiserror 1.0.69",+ "version_check",+]++[[package]]+name = "autocxx-macro"+version = "0.30.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c26712d744702e6fe61fdc618cc107a581a009ec8bfaffc67707d82501dbd907"+dependencies = [+ "autocxx-parser",+ "proc-macro-error",+ "proc-macro2",+ "quote",+ "syn 2.0.102",+]++[[package]]+name = "autocxx-parser"+version = "0.30.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6bcfc473ec409e612fb0e0c5c4a1b5b7611eca2bac71bc27b3cda98f15a25124"+dependencies = [+ "indexmap 1.9.3",+ "itertools 0.10.5",+ "log",+ "once_cell",+ "proc-macro2",+ "quote",+ "serde",+ "serde_json",+ "syn 2.0.102",+ "thiserror 1.0.69",+]+[[package]]name = "backtrace"version = "0.3.75"@@ -165,6 +299,12 @@ version = "0.13.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"+[[package]]+name = "base64"+version = "0.22.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"+[[package]]name = "binascii"version = "0.1.4"@@ -230,7 +370,7 @@ checksum = "4f154e572231cb6ba2bd1176980827e3d5dc04cc183a75dea38109fbdd672d29"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -263,6 +403,15 @@ dependencies = ["shlex",]+[[package]]+name = "cexpr"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"+dependencies = [+ "nom",+]+[[package]]name = "cfg-if"version = "1.0.1"@@ -275,6 +424,17 @@ version = "0.2.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"+[[package]]+name = "clang-sys"+version = "1.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"+dependencies = [+ "glob",+ "libc",+ "libloading",+]+[[package]]name = "clap"version = "4.5.47"@@ -306,7 +466,7 @@ dependencies = ["heck","proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -331,6 +491,26 @@ dependencies = ["uzu",]+[[package]]+name = "cmake"+version = "0.1.54"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0"+dependencies = [+ "cc",+]++[[package]]+name = "codespan-reporting"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681"+dependencies = [+ "serde",+ "termcolor",+ "unicode-width 0.2.1",+]+[[package]]name = "colorchoice"version = "1.0.4"@@ -389,6 +569,16 @@ dependencies = ["version_check",]+[[package]]+name = "core-foundation"+version = "0.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"+dependencies = [+ "core-foundation-sys",+ "libc",+]+[[package]]name = "core-foundation"version = "0.10.1"@@ -412,7 +602,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"dependencies = ["bitflags 2.9.4",- "core-foundation",+ "core-foundation 0.10.1","libc",]@@ -425,6 +615,15 @@ dependencies = ["libc",]+[[package]]+name = "crc32fast"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"+dependencies = [+ "cfg-if",+]+[[package]]name = "crossbeam-deque"version = "0.8.6"@@ -501,6 +700,81 @@ dependencies = ["windows-sys 0.59.0",]+[[package]]+name = "cxx"+version = "1.0.190"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7620f6cfc4dcca21f2b085b7a890e16c60fd66f560cd69ee60594908dc72ab1"+dependencies = [+ "cc",+ "cxx-build",+ "cxxbridge-cmd",+ "cxxbridge-flags",+ "cxxbridge-macro",+ "foldhash",+ "link-cplusplus",+]++[[package]]+name = "cxx-build"+version = "1.0.190"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a9bc1a22964ff6a355fbec24cf68266a0ed28f8b84c0864c386474ea3d0e479"+dependencies = [+ "cc",+ "codespan-reporting",+ "indexmap 2.9.0",+ "proc-macro2",+ "quote",+ "scratch",+ "syn 2.0.102",+]++[[package]]+name = "cxx-gen"+version = "0.7.190"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0e660ae76bd5fcfe7baa8510b93bdb684be66a5f84b72fd91eb7f90ad24a7c3b"+dependencies = [+ "codespan-reporting",+ "indexmap 2.9.0",+ "proc-macro2",+ "quote",+ "syn 2.0.102",+]++[[package]]+name = "cxxbridge-cmd"+version = "1.0.190"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b1f29a879d35f7906e3c9b77d7a1005a6a0787d330c09dfe4ffb5f617728cb44"+dependencies = [+ "clap",+ "codespan-reporting",+ "indexmap 2.9.0",+ "proc-macro2",+ "quote",+ "syn 2.0.102",+]++[[package]]+name = "cxxbridge-flags"+version = "1.0.190"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d67109015f93f683e364085aa6489a5b2118b4a40058482101d699936a7836d6"++[[package]]+name = "cxxbridge-macro"+version = "1.0.190"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d187e019e7b05a1f3e69a8396b70800ee867aa9fc2ab972761173ccee03742df"+dependencies = [+ "indexmap 2.9.0",+ "proc-macro2",+ "quote",+ "syn 2.0.102",+]+[[package]]name = "darling"version = "0.20.11"@@ -522,7 +796,7 @@ dependencies = ["proc-macro2","quote","strsim",- "syn",+ "syn 2.0.102",][[package]]@@ -533,7 +807,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"dependencies = ["darling_core","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -572,7 +846,7 @@ dependencies = ["darling","proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -582,7 +856,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"dependencies = ["derive_builder_core",- "syn",+ "syn 2.0.102",][[package]]@@ -615,7 +889,7 @@ dependencies = ["proc-macro2","proc-macro2-diagnostics","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -628,6 +902,27 @@ dependencies = ["crypto-common",]+[[package]]+name = "dirs"+version = "6.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"+dependencies = [+ "dirs-sys",+]++[[package]]+name = "dirs-sys"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"+dependencies = [+ "libc",+ "option-ext",+ "redox_users",+ "windows-sys 0.60.2",+]+[[package]]name = "dispatch2"version = "0.3.0"@@ -638,6 +933,17 @@ dependencies = ["objc2",]+[[package]]+name = "displaydoc"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.102",+]+[[package]]name = "dyn-clone"version = "1.0.19"@@ -665,6 +971,19 @@ dependencies = ["cfg-if",]+[[package]]+name = "env_logger"+version = "0.9.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7"+dependencies = [+ "atty",+ "humantime",+ "log",+ "regex",+ "termcolor",+]+[[package]]name = "equivalent"version = "1.0.2"@@ -710,12 +1029,37 @@ dependencies = ["version_check",]+[[package]]+name = "flate2"+version = "1.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb"+dependencies = [+ "crc32fast",+ "miniz_oxide",+]+[[package]]name = "fnv"version = "1.0.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"+[[package]]+name = "foldhash"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"++[[package]]+name = "foreign-types"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"+dependencies = [+ "foreign-types-shared 0.1.1",+]+[[package]]name = "foreign-types"version = "0.5.0"@@ -723,7 +1067,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"dependencies = ["foreign-types-macros",- "foreign-types-shared",+ "foreign-types-shared 0.3.1",][[package]]@@ -734,15 +1078,30 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",]+[[package]]+name = "foreign-types-shared"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"+[[package]]name = "foreign-types-shared"version = "0.3.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"+[[package]]+name = "form_urlencoded"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"+dependencies = [+ "percent-encoding",+]+[[package]]name = "futures"version = "0.3.31"@@ -751,6 +1110,7 @@ checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"dependencies = ["futures-channel","futures-core",+ "futures-executor","futures-io","futures-sink","futures-task",@@ -773,12 +1133,34 @@ version = "0.3.31"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"+[[package]]+name = "futures-executor"+version = "0.3.31"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"+dependencies = [+ "futures-core",+ "futures-task",+ "futures-util",+]+[[package]]name = "futures-io"version = "0.3.31"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"+[[package]]+name = "futures-macro"+version = "0.3.31"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.102",+]+[[package]]name = "futures-sink"version = "0.3.31"@@ -800,6 +1182,7 @@ dependencies = ["futures-channel","futures-core","futures-io",+ "futures-macro","futures-sink","futures-task","memchr",@@ -896,7 +1279,26 @@ dependencies = ["futures-sink","futures-util","http 0.2.12",- "indexmap",+ "indexmap 2.9.0",+ "slab",+ "tokio",+ "tokio-util",+ "tracing",+]++[[package]]+name = "h2"+version = "0.4.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386"+dependencies = [+ "atomic-waker",+ "bytes",+ "fnv",+ "futures-core",+ "futures-sink",+ "http 1.3.1",+ "indexmap 2.9.0","slab","tokio","tokio-util",@@ -915,6 +1317,12 @@ dependencies = ["num-traits",]+[[package]]+name = "hashbrown"+version = "0.12.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"+[[package]]name = "hashbrown"version = "0.15.4"@@ -927,12 +1335,45 @@ version = "0.5.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"+[[package]]+name = "hermit-abi"+version = "0.1.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"+dependencies = [+ "libc",+]+[[package]]name = "hermit-abi"version = "0.5.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08"+[[package]]+name = "hf-hub"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "629d8f3bbeda9d148036d6b0de0a3ab947abd08ce90626327fc3547a49d59d97"+dependencies = [+ "dirs",+ "futures",+ "http 1.3.1",+ "indicatif 0.17.11",+ "libc",+ "log",+ "native-tls",+ "num_cpus",+ "rand 0.9.2",+ "reqwest",+ "serde",+ "serde_json",+ "thiserror 2.0.16",+ "tokio",+ "ureq",+ "windows-sys 0.60.2",+]+[[package]]name = "http"version = "0.2.12"@@ -966,6 +1407,29 @@ dependencies = ["pin-project-lite",]+[[package]]+name = "http-body"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"+dependencies = [+ "bytes",+ "http 1.3.1",+]++[[package]]+name = "http-body-util"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"+dependencies = [+ "bytes",+ "futures-core",+ "http 1.3.1",+ "http-body 1.0.1",+ "pin-project-lite",+]+[[package]]name = "httparse"version = "1.10.1"@@ -978,6 +1442,12 @@ version = "1.0.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"+[[package]]+name = "humantime"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424"+[[package]]name = "hyper"version = "0.14.32"@@ -988,9 +1458,9 @@ dependencies = ["futures-channel","futures-core","futures-util",- "h2",+ "h2 0.3.26","http 0.2.12",- "http-body",+ "http-body 0.4.6","httparse","httpdate","itoa",@@ -1002,12 +1472,205 @@ dependencies = ["want",]+[[package]]+name = "hyper"+version = "1.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11"+dependencies = [+ "atomic-waker",+ "bytes",+ "futures-channel",+ "futures-core",+ "h2 0.4.12",+ "http 1.3.1",+ "http-body 1.0.1",+ "httparse",+ "itoa",+ "pin-project-lite",+ "pin-utils",+ "smallvec",+ "tokio",+ "want",+]++[[package]]+name = "hyper-rustls"+version = "0.27.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58"+dependencies = [+ "http 1.3.1",+ "hyper 1.8.1",+ "hyper-util",+ "rustls",+ "rustls-pki-types",+ "tokio",+ "tokio-rustls",+ "tower-service",+]++[[package]]+name = "hyper-tls"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"+dependencies = [+ "bytes",+ "http-body-util",+ "hyper 1.8.1",+ "hyper-util",+ "native-tls",+ "tokio",+ "tokio-native-tls",+ "tower-service",+]++[[package]]+name = "hyper-util"+version = "0.1.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56"+dependencies = [+ "base64 0.22.1",+ "bytes",+ "futures-channel",+ "futures-core",+ "futures-util",+ "http 1.3.1",+ "http-body 1.0.1",+ "hyper 1.8.1",+ "ipnet",+ "libc",+ "percent-encoding",+ "pin-project-lite",+ "socket2",+ "system-configuration",+ "tokio",+ "tower-service",+ "tracing",+ "windows-registry",+]++[[package]]+name = "icu_collections"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"+dependencies = [+ "displaydoc",+ "potential_utf",+ "yoke",+ "zerofrom",+ "zerovec",+]++[[package]]+name = "icu_locale_core"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"+dependencies = [+ "displaydoc",+ "litemap",+ "tinystr",+ "writeable",+ "zerovec",+]++[[package]]+name = "icu_normalizer"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"+dependencies = [+ "icu_collections",+ "icu_normalizer_data",+ "icu_properties",+ "icu_provider",+ "smallvec",+ "zerovec",+]++[[package]]+name = "icu_normalizer_data"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"++[[package]]+name = "icu_properties"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99"+dependencies = [+ "icu_collections",+ "icu_locale_core",+ "icu_properties_data",+ "icu_provider",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "icu_properties_data"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899"++[[package]]+name = "icu_provider"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"+dependencies = [+ "displaydoc",+ "icu_locale_core",+ "writeable",+ "yoke",+ "zerofrom",+ "zerotrie",+ "zerovec",+]+[[package]]name = "ident_case"version = "1.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"+[[package]]+name = "idna"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"+dependencies = [+ "idna_adapter",+ "smallvec",+ "utf8_iter",+]++[[package]]+name = "idna_adapter"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"+dependencies = [+ "icu_normalizer",+ "icu_properties",+]++[[package]]+name = "indexmap"+version = "1.9.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"+dependencies = [+ "autocfg",+ "hashbrown 0.12.3",+ "serde",+]+[[package]]name = "indexmap"version = "2.9.0"@@ -1015,7 +1678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"dependencies = ["equivalent",- "hashbrown",+ "hashbrown 0.15.4","serde",]@@ -1045,6 +1708,12 @@ dependencies = ["web-time",]+[[package]]+name = "indoc"+version = "1.0.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"+[[package]]name = "inlinable_string"version = "0.1.15"@@ -1068,13 +1737,29 @@ dependencies = ["unicode-width 0.1.14",]+[[package]]+name = "ipnet"+version = "2.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"++[[package]]+name = "iri-string"+version = "0.7.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397"+dependencies = [+ "memchr",+ "serde",+]+[[package]]name = "is-terminal"version = "0.4.16"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9"dependencies = [- "hermit-abi",+ "hermit-abi 0.5.1","libc","windows-sys 0.59.0",]@@ -1094,6 +1779,33 @@ version = "1.70.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"+[[package]]+name = "itertools"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"+dependencies = [+ "either",+]++[[package]]+name = "itertools"+version = "0.10.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"+dependencies = [+ "either",+]++[[package]]+name = "itertools"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"+dependencies = [+ "either",+]+[[package]]name = "itertools"version = "0.14.0"@@ -1131,18 +1843,53 @@ version = "0.2.175"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"+[[package]]+name = "libloading"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"+dependencies = [+ "cfg-if",+ "windows-link 0.2.1",+]+[[package]]name = "libm"version = "0.2.15"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"+[[package]]+name = "libredox"+version = "0.1.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"+dependencies = [+ "bitflags 2.9.4",+ "libc",+]++[[package]]+name = "link-cplusplus"+version = "1.0.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f78c730aaa7d0b9336a299029ea49f9ee53b0ed06e9202e8cb7db9bae7b8c82"+dependencies = [+ "cc",+]+[[package]]name = "linux-raw-sys"version = "0.9.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"+[[package]]+name = "litemap"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"+[[package]]name = "lock_api"version = "0.4.13"@@ -1233,12 +1980,35 @@ dependencies = ["bitflags 2.9.4","block","core-graphics-types",- "foreign-types",+ "foreign-types 0.5.0","log","objc","paste",]+[[package]]+name = "miette"+version = "5.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e"+dependencies = [+ "miette-derive",+ "once_cell",+ "thiserror 1.0.69",+ "unicode-width 0.1.14",+]++[[package]]+name = "miette-derive"+version = "5.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.102",+]+[[package]]name = "mime"version = "0.3.17"@@ -1277,6 +2047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"dependencies = ["adler2",+ "simd-adler32",][[package]]@@ -1320,7 +2091,16 @@ checksum = "c402a4092d5e204f32c9e155431046831fa712637043c58cb73bc6bc6c9663b5"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",+]++[[package]]+name = "moveit"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "87d7335204cb6ef7bd647fa6db0be3e4d7aa25b5823a7aa030027ddf512cefba"+dependencies = [+ "cxx",][[package]]@@ -1355,6 +2135,23 @@ dependencies = ["version_check",]+[[package]]+name = "native-tls"+version = "0.2.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e"+dependencies = [+ "libc",+ "log",+ "openssl",+ "openssl-probe",+ "openssl-sys",+ "schannel",+ "security-framework",+ "security-framework-sys",+ "tempfile",+]+[[package]]name = "ndarray"version = "0.16.1"@@ -1460,7 +2257,7 @@ version = "1.17.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"dependencies = [- "hermit-abi",+ "hermit-abi 0.5.1","libc",]@@ -1571,6 +2368,56 @@ dependencies = ["pkg-config",]+[[package]]+name = "openssl"+version = "0.10.75"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328"+dependencies = [+ "bitflags 2.9.4",+ "cfg-if",+ "foreign-types 0.3.2",+ "libc",+ "once_cell",+ "openssl-macros",+ "openssl-sys",+]++[[package]]+name = "openssl-macros"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.102",+]++[[package]]+name = "openssl-probe"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"++[[package]]+name = "openssl-sys"+version = "0.9.111"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321"+dependencies = [+ "cc",+ "libc",+ "pkg-config",+ "vcpkg",+]++[[package]]+name = "option-ext"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"+[[package]]name = "overload"version = "0.1.1"@@ -1626,7 +2473,7 @@ dependencies = ["proc-macro2","proc-macro2-diagnostics","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -1642,7 +2489,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323"dependencies = ["memchr",- "thiserror",+ "thiserror 2.0.16","ucd-trie",]@@ -1666,7 +2513,7 @@ dependencies = ["pest_meta","proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -1712,6 +2559,15 @@ dependencies = ["portable-atomic",]+[[package]]+name = "potential_utf"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"+dependencies = [+ "zerovec",+]+[[package]]name = "powerfmt"version = "0.2.0"@@ -1727,6 +2583,40 @@ dependencies = ["zerocopy",]+[[package]]+name = "prettyplease"+version = "0.2.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55"+dependencies = [+ "proc-macro2",+ "syn 2.0.102",+]++[[package]]+name = "proc-macro-error"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"+dependencies = [+ "proc-macro-error-attr",+ "proc-macro2",+ "quote",+ "syn 1.0.109",+ "version_check",+]++[[package]]+name = "proc-macro-error-attr"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"+dependencies = [+ "proc-macro2",+ "quote",+ "version_check",+]+[[package]]name = "proc-macro2"version = "1.0.95"@@ -1744,7 +2634,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102","version_check","yansi",]@@ -1846,7 +2736,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2964d0cf57a3e7a06e8183d14a8b527195c706b7983549cd5462d5aa3747438f"dependencies = ["either",- "itertools",+ "itertools 0.14.0","rayon",]@@ -1869,6 +2759,17 @@ dependencies = ["bitflags 2.9.4",]+[[package]]+name = "redox_users"+version = "0.5.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"+dependencies = [+ "getrandom 0.2.16",+ "libredox",+ "thiserror 2.0.16",+]+[[package]]name = "ref-cast"version = "1.0.24"@@ -1886,7 +2787,7 @@ checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -1933,6 +2834,97 @@ version = "0.8.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"+[[package]]+name = "regex_static"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6126d61c5e4b41929098f73b42fc1d257116cc95d19739248c51591f77cc0021"+dependencies = [+ "once_cell",+ "regex",+ "regex_static_macro",+]++[[package]]+name = "regex_static_impl"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9c3755019886a70e772e6360b0b58501d75cf7dc17a53e08aa97e59ecb2c2bc5"+dependencies = [+ "proc-macro2",+ "quote",+ "regex-syntax 0.6.29",+ "syn 1.0.109",+]++[[package]]+name = "regex_static_macro"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "79b15495fd034158635bc8b762a132dfc83864d6992aeda1ffabf01b03b611a1"+dependencies = [+ "proc-macro2",+ "regex_static_impl",+ "syn 1.0.109",+]++[[package]]+name = "reqwest"+version = "0.12.24"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f"+dependencies = [+ "base64 0.22.1",+ "bytes",+ "encoding_rs",+ "futures-core",+ "futures-util",+ "h2 0.4.12",+ "http 1.3.1",+ "http-body 1.0.1",+ "http-body-util",+ "hyper 1.8.1",+ "hyper-rustls",+ "hyper-tls",+ "hyper-util",+ "js-sys",+ "log",+ "mime",+ "native-tls",+ "percent-encoding",+ "pin-project-lite",+ "rustls-pki-types",+ "serde",+ "serde_json",+ "serde_urlencoded",+ "sync_wrapper",+ "tokio",+ "tokio-native-tls",+ "tokio-util",+ "tower",+ "tower-http",+ "tower-service",+ "url",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "wasm-streams",+ "web-sys",+]++[[package]]+name = "ring"+version = "0.17.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"+dependencies = [+ "cc",+ "cfg-if",+ "getrandom 0.2.16",+ "libc",+ "untrusted",+ "windows-sys 0.52.0",+]+[[package]]name = "rocket"version = "0.5.1"@@ -1947,7 +2939,7 @@ dependencies = ["either","figment","futures",- "indexmap",+ "indexmap 2.9.0","log","memchr","multer",@@ -1979,11 +2971,11 @@ checksum = "575d32d7ec1a9770108c879fc7c47815a80073f96ca07ff9525a94fcede1dd46"dependencies = ["devise","glob",- "indexmap",+ "indexmap 2.9.0","proc-macro2","quote","rocket_http",- "syn",+ "syn 2.0.102","unicode-xid","version_check",]@@ -1998,8 +2990,8 @@ dependencies = ["either","futures","http 0.2.12",- "hyper",- "indexmap",+ "hyper 0.14.32",+ "indexmap 2.9.0","log","memchr","pear",@@ -2021,6 +3013,12 @@ version = "0.1.25"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f"+[[package]]+name = "rustc-hash"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"+[[package]]name = "rustix"version = "1.0.7"@@ -2034,6 +3032,41 @@ dependencies = ["windows-sys 0.59.0",]+[[package]]+name = "rustls"+version = "0.23.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f"+dependencies = [+ "log",+ "once_cell",+ "ring",+ "rustls-pki-types",+ "rustls-webpki",+ "subtle",+ "zeroize",+]++[[package]]+name = "rustls-pki-types"+version = "1.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c"+dependencies = [+ "zeroize",+]++[[package]]+name = "rustls-webpki"+version = "0.103.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52"+dependencies = [+ "ring",+ "rustls-pki-types",+ "untrusted",+]+[[package]]name = "rustversion"version = "1.0.21"@@ -2046,6 +3079,49 @@ version = "1.0.20"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"+[[package]]+name = "same-file"+version = "1.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"+dependencies = [+ "winapi-util",+]++[[package]]+name = "schannel"+version = "0.1.28"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "schemars"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289"+dependencies = [+ "dyn-clone",+ "ref-cast",+ "schemars_derive",+ "serde",+ "serde_json",+]++[[package]]+name = "schemars_derive"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "301858a4023d78debd2353c7426dc486001bddc91ae31a76fb1f55132f7e2633"+dependencies = [+ "proc-macro2",+ "quote",+ "serde_derive_internals",+ "syn 2.0.102",+]+[[package]]name = "scoped-tls"version = "1.0.1"@@ -2058,36 +3134,87 @@ version = "1.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"+[[package]]+name = "scratch"+version = "1.0.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d68f2ec51b097e4c1a75b681a8bec621909b5e91f15bb7b840c4f2f7b01148b2"++[[package]]+name = "security-framework"+version = "2.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"+dependencies = [+ "bitflags 2.9.4",+ "core-foundation 0.9.4",+ "core-foundation-sys",+ "libc",+ "security-framework-sys",+]++[[package]]+name = "security-framework-sys"+version = "2.15.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0"+dependencies = [+ "core-foundation-sys",+ "libc",+]+[[package]]name = "serde"-version = "1.0.219"+version = "1.0.228"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"+dependencies = [+ "serde_core",+ "serde_derive",+]++[[package]]+name = "serde_core"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"dependencies = ["serde_derive",][[package]]name = "serde_derive"-version = "1.0.219"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.102",+]++[[package]]+name = "serde_derive_internals"+version = "0.29.1"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"+checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]name = "serde_json"-version = "1.0.143"+version = "1.0.145"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a"+checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"dependencies = ["itoa","memchr","ryu","serde",+ "serde_core",][[package]]@@ -2110,6 +3237,18 @@ dependencies = ["serde",]+[[package]]+name = "serde_urlencoded"+version = "0.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"+dependencies = [+ "form_urlencoded",+ "itoa",+ "ryu",+ "serde",+]+[[package]]name = "sha2"version = "0.10.9"@@ -2166,6 +3305,12 @@ dependencies = ["libc",]+[[package]]+name = "simd-adler32"+version = "0.3.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"+[[package]]name = "slab"version = "0.4.9"@@ -2191,6 +3336,17 @@ dependencies = ["windows-sys 0.52.0",]+[[package]]+name = "socks"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b"+dependencies = [+ "byteorder",+ "libc",+ "winapi",+]+[[package]]name = "spin"version = "0.9.8"@@ -2203,7 +3359,7 @@ version = "0.1.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5851699c4033c63636f7ea4cf7b7c1f1bf06d0cc03cfb42e711de5a5c46cf326"dependencies = [- "base64",+ "base64 0.13.1","nom","serde","unicode-segmentation",@@ -2218,6 +3374,12 @@ dependencies = ["memchr",]+[[package]]+name = "stable_deref_trait"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"+[[package]]name = "state"version = "0.6.0"@@ -2234,20 +3396,57 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"[[package]]-name = "strsim"-version = "0.11.1"+name = "strsim"+version = "0.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"++[[package]]+name = "subtle"+version = "2.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"++[[package]]+name = "syn"+version = "1.0.109"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "syn"+version = "2.0.102"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "sync_wrapper"+version = "1.0.2"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"+dependencies = [+ "futures-core",+][[package]]-name = "syn"-version = "2.0.102"+name = "synstructure"+version = "0.13.2"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462"+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"dependencies = ["proc-macro2","quote",- "unicode-ident",+ "syn 2.0.102",][[package]]@@ -2264,6 +3463,27 @@ dependencies = ["windows 0.61.3",]+[[package]]+name = "system-configuration"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"+dependencies = [+ "bitflags 2.9.4",+ "core-foundation 0.9.4",+ "system-configuration-sys",+]++[[package]]+name = "system-configuration-sys"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"+dependencies = [+ "core-foundation-sys",+ "libc",+]+[[package]]name = "tempfile"version = "3.20.0"@@ -2277,13 +3497,42 @@ dependencies = ["windows-sys 0.59.0",]+[[package]]+name = "termcolor"+version = "1.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"+dependencies = [+ "winapi-util",+]++[[package]]+name = "thiserror"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"+dependencies = [+ "thiserror-impl 1.0.69",+]+[[package]]name = "thiserror"version = "2.0.16"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"dependencies = [- "thiserror-impl",+ "thiserror-impl 2.0.16",+]++[[package]]+name = "thiserror-impl"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.102",][[package]]@@ -2294,7 +3543,7 @@ checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -2338,11 +3587,21 @@ dependencies = ["time-core",]+[[package]]+name = "tinystr"+version = "0.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"+dependencies = [+ "displaydoc",+ "zerovec",+]+[[package]]name = "tokenizers"-version = "0.22.0"+version = "0.22.1"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "af10f51be57162b69d90a15cb226eef12c9e4faecbd5e3ea98a86bfb920b3d71"+checksum = "6475a27088c98ea96d00b39a9ddfb63780d1ad4cceb6f48374349a96ab2b7842"dependencies = ["ahash","aho-corasick",@@ -2352,7 +3611,7 @@ dependencies = ["esaxx-rs","getrandom 0.3.3","indicatif 0.17.11",- "itertools",+ "itertools 0.14.0","log","macro_rules_attribute","monostate",@@ -2366,7 +3625,7 @@ dependencies = ["serde","serde_json","spm_precompiled",- "thiserror",+ "thiserror 2.0.16","unicode-normalization-alignments","unicode-segmentation","unicode_categories",@@ -2398,7 +3657,27 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",+]++[[package]]+name = "tokio-native-tls"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"+dependencies = [+ "native-tls",+ "tokio",+]++[[package]]+name = "tokio-rustls"+version = "0.26.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"+dependencies = [+ "rustls",+ "tokio",][[package]]@@ -2452,7 +3731,7 @@ version = "0.22.27"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"dependencies = [- "indexmap",+ "indexmap 2.9.0","serde","serde_spanned","toml_datetime",@@ -2466,6 +3745,45 @@ version = "0.1.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"+[[package]]+name = "tower"+version = "0.5.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"+dependencies = [+ "futures-core",+ "futures-util",+ "pin-project-lite",+ "sync_wrapper",+ "tokio",+ "tower-layer",+ "tower-service",+]++[[package]]+name = "tower-http"+version = "0.6.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9cf146f99d442e8e68e585f5d798ccd3cad9a7835b917e09728880a862706456"+dependencies = [+ "bitflags 2.9.4",+ "bytes",+ "futures-util",+ "http 1.3.1",+ "http-body 1.0.1",+ "iri-string",+ "pin-project-lite",+ "tower",+ "tower-layer",+ "tower-service",+]++[[package]]+name = "tower-layer"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"+[[package]]name = "tower-service"version = "0.3.3"@@ -2491,7 +3809,7 @@ checksum = "1b1ffbcf9c6f6b99d386e7444eb608ba646ae452a36b39737deb9663b610f662"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -2621,6 +3939,49 @@ version = "0.5.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "323402cff2dd658f39ca17c789b502021b3f18707c91cdf22e3838e1b4023817"+[[package]]+name = "untrusted"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"++[[package]]+name = "ureq"+version = "2.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d"+dependencies = [+ "base64 0.22.1",+ "flate2",+ "log",+ "native-tls",+ "once_cell",+ "rustls",+ "rustls-pki-types",+ "serde",+ "serde_json",+ "socks",+ "url",+ "webpki-roots 0.26.11",+]++[[package]]+name = "url"+version = "2.5.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"+dependencies = [+ "form_urlencoded",+ "idna",+ "percent-encoding",+]++[[package]]+name = "utf8_iter"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"+[[package]]name = "utf8parse"version = "0.2.2"@@ -2648,7 +4009,7 @@ dependencies = ["clap","half","is_close",- "itertools",+ "itertools 0.14.0","libc","metal","minijinja",@@ -2660,12 +4021,14 @@ dependencies = ["objc2-foundation","rand 0.9.2","regex",+ "schemars","serde","serde_json","serde_json5","sysinfo",- "thiserror",+ "thiserror 2.0.16","tokenizers",+ "xgrammar-rs",][[package]]@@ -2674,12 +4037,28 @@ version = "0.1.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"+[[package]]+name = "vcpkg"+version = "0.2.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"+[[package]]name = "version_check"version = "0.9.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"+[[package]]+name = "walkdir"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"+dependencies = [+ "same-file",+ "winapi-util",+]+[[package]]name = "want"version = "0.3.1"@@ -2726,10 +4105,23 @@ dependencies = ["log","proc-macro2","quote",- "syn",+ "syn 2.0.102","wasm-bindgen-shared",]+[[package]]+name = "wasm-bindgen-futures"+version = "0.4.50"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"+dependencies = [+ "cfg-if",+ "js-sys",+ "once_cell",+ "wasm-bindgen",+ "web-sys",+]+[[package]]name = "wasm-bindgen-macro"version = "0.2.100"@@ -2748,7 +4140,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102","wasm-bindgen-backend","wasm-bindgen-shared",]@@ -2762,6 +4154,29 @@ dependencies = ["unicode-ident",]+[[package]]+name = "wasm-streams"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65"+dependencies = [+ "futures-util",+ "js-sys",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+]++[[package]]+name = "web-sys"+version = "0.3.77"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"+dependencies = [+ "js-sys",+ "wasm-bindgen",+]+[[package]]name = "web-time"version = "1.1.0"@@ -2772,6 +4187,24 @@ dependencies = ["wasm-bindgen",]+[[package]]+name = "webpki-roots"+version = "0.26.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"+dependencies = [+ "webpki-roots 1.0.4",+]++[[package]]+name = "webpki-roots"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e"+dependencies = [+ "rustls-pki-types",+]+[[package]]name = "winapi"version = "0.3.9"@@ -2788,6 +4221,15 @@ version = "0.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"+[[package]]+name = "winapi-util"+version = "0.1.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"+dependencies = [+ "windows-sys 0.60.2",+]+[[package]]name = "winapi-x86_64-pc-windows-gnu"version = "0.4.0"@@ -2812,7 +4254,7 @@ dependencies = ["windows-collections","windows-core","windows-future",- "windows-link",+ "windows-link 0.1.3","windows-numerics",]@@ -2833,9 +4275,9 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"dependencies = ["windows-implement","windows-interface",- "windows-link",- "windows-result",- "windows-strings",+ "windows-link 0.1.3",+ "windows-result 0.3.4",+ "windows-strings 0.4.2",][[package]]@@ -2845,7 +4287,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"dependencies = ["windows-core",- "windows-link",+ "windows-link 0.1.3","windows-threading",]@@ -2857,7 +4299,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -2868,7 +4310,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",][[package]]@@ -2877,6 +4319,12 @@ version = "0.1.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"+[[package]]+name = "windows-link"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"+[[package]]name = "windows-numerics"version = "0.2.0"@@ -2884,7 +4332,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"dependencies = ["windows-core",- "windows-link",+ "windows-link 0.1.3",+]++[[package]]+name = "windows-registry"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"+dependencies = [+ "windows-link 0.2.1",+ "windows-result 0.4.1",+ "windows-strings 0.5.1",][[package]]@@ -2893,7 +4352,16 @@ version = "0.3.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"dependencies = [- "windows-link",+ "windows-link 0.1.3",+]++[[package]]+name = "windows-result"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"+dependencies = [+ "windows-link 0.2.1",][[package]]@@ -2902,7 +4370,16 @@ version = "0.4.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"dependencies = [- "windows-link",+ "windows-link 0.1.3",+]++[[package]]+name = "windows-strings"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"+dependencies = [+ "windows-link 0.2.1",][[package]]@@ -2941,6 +4418,15 @@ dependencies = ["windows-targets 0.53.3",]+[[package]]+name = "windows-sys"+version = "0.61.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"+dependencies = [+ "windows-link 0.2.1",+]+[[package]]name = "windows-targets"version = "0.48.5"@@ -2978,7 +4464,7 @@ version = "0.53.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"dependencies = [- "windows-link",+ "windows-link 0.1.3","windows_aarch64_gnullvm 0.53.0","windows_aarch64_msvc 0.53.0","windows_i686_gnu 0.53.0",@@ -2995,7 +4481,7 @@ version = "0.1.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"dependencies = [- "windows-link",+ "windows-link 0.1.3",][[package]]@@ -3154,6 +4640,28 @@ dependencies = ["bitflags 2.9.4",]+[[package]]+name = "writeable"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"++[[package]]+name = "xgrammar-rs"+version = "0.1.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac85eff00b9853aab820a5b384e277c250044302ceb5ea5204265651b1777fcf"+dependencies = [+ "autocxx",+ "autocxx-build",+ "cmake",+ "cxx",+ "hf-hub",+ "serde_json",+ "tokenizers",+ "walkdir",+]+[[package]]name = "yansi"version = "1.0.1"@@ -3163,6 +4671,29 @@ dependencies = ["is-terminal",]+[[package]]+name = "yoke"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"+dependencies = [+ "stable_deref_trait",+ "yoke-derive",+ "zerofrom",+]++[[package]]+name = "yoke-derive"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.102",+ "synstructure",+]+[[package]]name = "zerocopy"version = "0.8.25"@@ -3180,5 +4711,65 @@ checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef"dependencies = ["proc-macro2","quote",- "syn",+ "syn 2.0.102",+]++[[package]]+name = "zerofrom"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"+dependencies = [+ "zerofrom-derive",+]++[[package]]+name = "zerofrom-derive"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.102",+ "synstructure",+]++[[package]]+name = "zeroize"+version = "1.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"++[[package]]+name = "zerotrie"+version = "0.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"+dependencies = [+ "displaydoc",+ "yoke",+ "zerofrom",+]++[[package]]+name = "zerovec"+version = "0.11.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"+dependencies = [+ "yoke",+ "zerofrom",+ "zerovec-derive",+]++[[package]]+name = "zerovec-derive"+version = "0.11.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.102",]diff --git a/crates/uzu/Cargo.toml b/crates/uzu/Cargo.tomlindex a1c60081b..e1075a314 100644--- a/crates/uzu/Cargo.toml+++ b/crates/uzu/Cargo.toml@@ -5,6 +5,7 @@ edition = "2024"build = "build.rs"[dependencies]+xgrammar = { package = "xgrammar-rs", version = "0.1.27", features = ["hf"] }half = { version = "2.6.0", features = ["bytemuck", "num-traits"] }ndarray = "0.16.1"serde = { version = "1.0.219", features = ["derive"] }@@ -27,10 +28,12 @@ clap = { version = "4.5.47", features = ["derive"] }rand = "0.9.2"sysinfo = "0.37.0"itertools = "0.14.0"+schemars = "1.0.5"[dev-dependencies]is_close = "0.1.3"serde_json5 = "0.2.1"+schemars = { version = "1.0.5", features = ["derive"] }[features]default = ["metal-shaders"]diff --git a/crates/uzu/src/backends/metal/forward_pass/buffers.rs b/crates/uzu/src/backends/metal/forward_pass/buffers.rsindex 7561371fb..f49d93795 100644--- a/crates/uzu/src/backends/metal/forward_pass/buffers.rs+++ b/crates/uzu/src/backends/metal/forward_pass/buffers.rs@@ -14,6 +14,7 @@ pub struct ForwardPassBuffers {// 1-Dpub token_ids: MTLBuffer,pub token_positions: MTLBuffer,+ pub token_bitmask: MTLBuffer,pub token_seeds: MTLBuffer,pub sampling_output: MTLBuffer,@@ -94,6 +95,10 @@ impl ForwardPassBuffers {// 1-Dtoken_ids: alloc(&[max_suffix_len], DataType::U64),token_positions: alloc(&[max_suffix_len], DataType::I32),+ token_bitmask: alloc(+ &model_shape.bitmask_shape(max_suffix_len),+ DataType::U32,+ ),token_seeds: alloc(&[max_suffix_len], DataType::U64),sampling_output: alloc(&[max_suffix_len], DataType::U32),diff --git a/crates/uzu/src/backends/metal/forward_pass/model_shape.rs b/crates/uzu/src/backends/metal/forward_pass/model_shape.rsindex 52dd9e470..e8c7f4685 100644--- a/crates/uzu/src/backends/metal/forward_pass/model_shape.rs+++ b/crates/uzu/src/backends/metal/forward_pass/model_shape.rs@@ -170,6 +170,13 @@ impl ModelShape {[suffix_length, self.vocabulary_size]}+ pub fn bitmask_shape(+ &self,+ suffix_length: usize,+ ) -> [usize; 2] {+ [suffix_length, self.vocabulary_size.div_ceil(32)]+ }+pub fn embeddings_input_shape(&self) -> [usize; 2] {[self.vocabulary_size, self.model_dim]}diff --git a/crates/uzu/src/backends/metal/forward_pass/state.rs b/crates/uzu/src/backends/metal/forward_pass/state.rsindex 6fb3f027d..ead7c014b 100644--- a/crates/uzu/src/backends/metal/forward_pass/state.rs+++ b/crates/uzu/src/backends/metal/forward_pass/state.rs@@ -909,6 +909,8 @@ pub struct ForwardPassState {token_ids: ArrayCell,/// [suffix_length] - i32token_positions: ArrayCell,+ /// [suffix_length, vocabulary_size] - bitmask packed in u32 (0 = disallowed, 1 = allowed)+ token_bitmask: Option<ArrayCell>,/// [suffix_length] - u64token_seeds: ArrayCell,/// [suffix_length, suffix_length + prefix_length]@@ -937,6 +939,7 @@ impl ForwardPassState {shared_buffers: Rc<RefCell<SharedBuffers>>,token_ids: &[u64],token_positions: &[usize],+ token_bitmask: Option<&[u32]>,token_seeds: &[u64],active_suffix_length: usize,is_prefilling: bool,@@ -1048,6 +1051,24 @@ impl ForwardPassState {RefCell::new(token_seeds_array)};+ // --------------------+ // Token Bitmask+ // --------------------+ let token_bitmask_refcell = if let Some(token_bitmask) = token_bitmask {+ let mut token_bitmask_array = unsafe {+ MetalArray::new(+ scratch.token_bitmask.clone(),+ &model_shape.bitmask_shape(suffix_length),+ DataType::U32,+ )+ };+ context+ .copy_from_view(&mut token_bitmask_array, token_bitmask.into());+ Some(RefCell::new(token_bitmask_array))+ } else {+ None+ };+// --------------------// Attention Bias// --------------------@@ -1122,6 +1143,7 @@ impl ForwardPassState {context,token_ids: token_ids_refcell,token_positions: token_positions_refcell,+ token_bitmask: token_bitmask_refcell,token_seeds: token_seeds_refcell,attention_bias,logits,@@ -1136,6 +1158,10 @@ impl ForwardPassState {}}+ pub fn has_bitmask(&self) -> bool {+ self.token_bitmask.is_some()+ }+fn array_cell(&self,id: ArrayId,@@ -1143,6 +1169,7 @@ impl ForwardPassState {match id {ArrayId::TokenIds => self.token_ids.clone(),ArrayId::TokenPositions => self.token_positions.clone(),+ ArrayId::TokenBitmask => self.token_bitmask.as_ref().unwrap().clone(),ArrayId::TokenSeeds => self.token_seeds.clone(),ArrayId::Logits => self.logits.clone(),ArrayId::Main => self.aux_buffers.main.clone(),@@ -1468,8 +1495,9 @@ pub enum RopeType {pub enum ArrayId {TokenIds,TokenPositions,- Logits,+ TokenBitmask,TokenSeeds,+ Logits,Main,Shortcut,diff --git a/crates/uzu/src/backends/metal/kernel/sampling/bitmask.metal b/crates/uzu/src/backends/metal/kernel/sampling/bitmask.metalnew file mode 100644index 000000000..999f7b150--- /dev/null+++ b/crates/uzu/src/backends/metal/kernel/sampling/bitmask.metal@@ -0,0 +1,58 @@+#include <metal_stdlib>+#include "../definitions.metal"++#define GRAIN_SIZE 64+#define BLOCK_SIZE 1024++#define BITS_IN_U32 32++template <typename T>+void batched_bitmask(+ device const T* logits_data,+ device const uint32_t* bitmask_data,+ device T* processed_logits,+ constant uint& vocab_size,+ uint group_idx,+ uint batch_idx,+ uint thread_idx+) {+ uint base_idx = batch_idx * vocab_size + group_idx * BLOCK_SIZE * GRAIN_SIZE + thread_idx;+ uint batch_end = batch_idx * vocab_size + vocab_size;++ #pragma unroll(4)+ for (uint i = 0; i < GRAIN_SIZE; i++) {+ uint global_idx = base_idx + i * BLOCK_SIZE;+ if (global_idx < batch_end) {+ bool mask = (bitmask_data[global_idx / BITS_IN_U32] >> (global_idx % BITS_IN_U32)) & 0b1;+ processed_logits[global_idx] = select(T(-INFINITY), logits_data[global_idx], mask);+ }+ }+}++#define outerArguments(T) \+(device const T* logits_data [[ buffer(0) ]], \+device const uint32_t* bitmask_data [[ buffer(1) ]], \+device T* processed_logits [[ buffer(2) ]], \+constant uint& vocab_size [[ buffer(3) ]], \+uint3 threadgroup_idx [[ threadgroup_position_in_grid ]], \+uint3 thread_idx [[ thread_position_in_threadgroup ]])++#define innerArguments (logits_data, bitmask_data, processed_logits, vocab_size, threadgroup_idx.x, threadgroup_idx.y, thread_idx.x)++#define generateBitmaskKernel(functionName, scalarType, outerArgs, innerArgs) \+[[max_total_threads_per_threadgroup(1024)]] kernel void functionName##_##scalarType outerArgs { \+ functionName innerArgs; \+}++#define generateBitmaskKernels(functionName) \+generateBitmaskKernel(functionName, float, outerArguments(float), innerArguments); \+generateBitmaskKernel(functionName, bfloat, outerArguments(bfloat), innerArguments); \+generateBitmaskKernel(functionName, half, outerArguments(half), innerArguments);++generateBitmaskKernels(batched_bitmask)++#undef outerArguments+#undef innerArguments+#undef generatebitmaskKernel+#undef generatebitmaskKernels+diff --git a/crates/uzu/src/backends/metal/kernel/sampling/mod.rs b/crates/uzu/src/backends/metal/kernel/sampling/mod.rsindex f1c5a3c59..216e26933 100644--- a/crates/uzu/src/backends/metal/kernel/sampling/mod.rs+++ b/crates/uzu/src/backends/metal/kernel/sampling/mod.rs@@ -58,6 +58,8 @@ enum ArgmaxImplementation {}pub struct SamplingKernel {+ bitmask_pipeline: MTLComputePipelineState,+ partial_bitmask_buffer: MTLBuffer,temperature_pipeline: MTLComputePipelineState,partial_temperature_buffer: MTLBuffer,topk_pipeline: MTLComputePipelineState,@@ -111,6 +113,20 @@ impl SamplingKernel {let data_suffix = data_type.function_name_suffix();let max_elements = max_batch_size * max_vocab_size;+ let bitmask_pipeline = context+ .compute_pipeline_state_with_reflection(+ &format!("batched_bitmask_{}", data_suffix),+ None,+ )+ .map(|(pipeline, _)| pipeline)+ .map_err(SamplingError::MetalError)?;++ let partial_bitmask_buffer = context.device.new_buffer(+ (max_elements * Into::<DataType>::into(data_type).size_in_bytes())+ as u64,+ MTLResourceOptions::StorageModeShared,+ );+let temperature_pipeline = context.compute_pipeline_state_with_reflection(&format!("batched_temperature_{}", data_suffix),@@ -219,6 +235,8 @@ impl SamplingKernel {};Ok(Self {+ bitmask_pipeline,+ partial_bitmask_buffer,temperature_pipeline,partial_temperature_buffer,topk_pipeline,@@ -236,6 +254,7 @@ impl SamplingKernel {pub fn encode(&self,logits_buffer: &MTLBuffer,+ bitmask_buffer: Option<&MTLBuffer>,seeds_buffer: Option<&MTLBuffer>,sampled_tokens_buffer: &MTLBuffer,sampling_method: SamplingMethod,@@ -246,6 +265,7 @@ impl SamplingKernel {let compute_encoder = command_buffer.new_compute_command_encoder();self.encode_with_encoder(logits_buffer,+ bitmask_buffer,seeds_buffer,0, // No offset for non-async pathsampled_tokens_buffer,@@ -261,6 +281,7 @@ impl SamplingKernel {pub fn encode_with_encoder(&self,logits_buffer: &MTLBuffer,+ bitmask_buffer: Option<&MTLBuffer>,seeds_buffer: Option<&MTLBuffer>,seeds_offset: usize,sampled_tokens_buffer: &MTLBuffer,@@ -284,6 +305,18 @@ impl SamplingKernel {let mut last_logits_buffer = logits_buffer;+ if let Some(bitmask_buffer) = bitmask_buffer {+ self.encode_bitmask(+ last_logits_buffer,+ bitmask_buffer,+ &self.partial_bitmask_buffer,+ batch_size as u32,+ vocab_size as u32,+ compute_encoder,+ )?;+ last_logits_buffer = &self.partial_bitmask_buffer;+ }+if let SamplingMethod::Stochastic {temperature,top_k,@@ -366,6 +399,38 @@ impl SamplingKernel {}}+ pub fn encode_bitmask(+ &self,+ logits_buffer: &MTLBuffer,+ bitmask_buffer: &MTLBuffer,+ processed_logits_buffer: &MTLBuffer,+ batch_size: u32,+ vocab_size: u32,+ compute_encoder: &ComputeCommandEncoderRef,+ ) -> Result<(), SamplingError> {+ compute_encoder.set_compute_pipeline_state(&self.bitmask_pipeline);++ compute_encoder.set_buffer(0, Some(logits_buffer), 0);+ compute_encoder.set_buffer(1, Some(bitmask_buffer), 0);+ compute_encoder.set_buffer(2, Some(processed_logits_buffer), 0);+ compute_encoder.set_bytes(+ 3,+ size_of::<u32>() as u64,+ &vocab_size as *const u32 as *const std::ffi::c_void,+ );++ let elements_in_group = BLOCK_SIZE * ELEMENTWISE_GRAIN_SIZE;+ let groups = (vocab_size + (elements_in_group as u32 - 1))+ / elements_in_group as u32;++ compute_encoder.dispatch_thread_groups(+ MTLSize::new(groups as u64, batch_size as u64, 1),+ MTLSize::new(BLOCK_SIZE as u64, 1, 1),+ );++ Ok(())+ }+pub fn encode_temperature(&self,logits_buffer: &MTLBuffer,@@ -694,6 +759,18 @@ impl SamplingKernelEncodable {let batch_size = state.active_suffix_length();let vocab_size = logits_shape[1];+ let bitmask_binding = if state.has_bitmask() {+ let bitmask_binding = state.arrays(&[+ crate::backends::metal::forward_pass::ArrayId::TokenBitmask,+ ]);+ Some(bitmask_binding)+ } else {+ None+ };++ let mut bitmask =+ bitmask_binding.as_ref().map(|bind| bind[0].borrow_mut());+let seeds_binding = state.arrays(&[crate::backends::metal::forward_pass::ArrayId::TokenSeeds,]);@@ -707,6 +784,7 @@ impl SamplingKernelEncodable {if let Err(e) = self.kernel.encode_with_encoder(unsafe { &logits.mtl_buffer() },+ unsafe { bitmask.as_mut().map(|arr| arr.mtl_buffer()) },unsafe { Some(&seeds.mtl_buffer()) },seeds_offset,unsafe { &output_buffer_ref.mtl_buffer() },diff --git a/crates/uzu/src/backends/metal/kernel/sampling/top_k.metal b/crates/uzu/src/backends/metal/kernel/sampling/top_k.metalindex 06dd82d52..69f7f70c1 100644--- a/crates/uzu/src/backends/metal/kernel/sampling/top_k.metal+++ b/crates/uzu/src/backends/metal/kernel/sampling/top_k.metal@@ -23,7 +23,7 @@ void batched_topk(for (uint i = thread_idx; i < vocab_size; i += BLOCK_SIZE) {float logit_value = float(logits_data[batch_start + i]);local_max = fmax(local_max, logit_value);- local_min = fmin(local_min, logit_value);+ local_min = select(local_min, fmin(local_min, logit_value), logit_value > -INFINITY);}float max_logit = threadgroup_cooperative_reduce_max<BLOCK_SIZE>(local_max, shared_reduce_buffer, thread_idx);float min_logit = threadgroup_cooperative_reduce_min<BLOCK_SIZE>(local_min, shared_reduce_buffer, thread_idx);diff --git a/crates/uzu/src/backends/metal/kernel/sampling/top_p.metal b/crates/uzu/src/backends/metal/kernel/sampling/top_p.metalindex 10b00eb2c..4bbcc8478 100644--- a/crates/uzu/src/backends/metal/kernel/sampling/top_p.metal+++ b/crates/uzu/src/backends/metal/kernel/sampling/top_p.metal@@ -25,7 +25,7 @@ void batched_topp(for (uint i = thread_idx; i < vocab_size; i += BLOCK_SIZE) {float logit_value = float(logits_data[batch_start + i]);local_max = fmax(local_max, logit_value);- local_min = fmin(local_min, logit_value);+ local_min = select(local_min, fmin(local_min, logit_value), logit_value > -INFINITY);}float max_logit = threadgroup_cooperative_reduce_max<BLOCK_SIZE>(local_max, shared_reduce_buffer, thread_idx);float min_logit = threadgroup_cooperative_reduce_min<BLOCK_SIZE>(local_min, shared_reduce_buffer, thread_idx);@@ -35,7 +35,7 @@ void batched_topp(#pragma unroll(4)for (uint i = thread_idx; i < vocab_size; i += BLOCK_SIZE) {float logit_value = float(logits_data[batch_start + i]);- local_sum += fast::exp(logit_value - max_logit);+ local_sum += select(0.0, fast::exp(logit_value - max_logit), logit_value > -INFINITY);}float total_sum = threadgroup_cooperative_reduce_sum<BLOCK_SIZE>(local_sum, shared_reduce_buffer, thread_idx);diff --git a/crates/uzu/src/device/data_type_ext.rs b/crates/uzu/src/device/data_type_ext.rsnew file mode 100644index 000000000..8a41c85df--- /dev/null+++ b/crates/uzu/src/device/data_type_ext.rs@@ -0,0 +1,81 @@+use xgrammar::{DLDataType, DLDataTypeCode};++use crate::DataType;++// Standard conversion from crate DataType to DLDataType+impl Into<DLDataType> for DataType {+ fn into(self) -> DLDataType {+ match self {+ DataType::BF16 => DLDataType {+ code: DLDataTypeCode::kDLBfloat as u8,+ bits: 16,+ lanes: 1,+ },+ DataType::F16 => DLDataType {+ code: DLDataTypeCode::kDLFloat as u8,+ bits: 16,+ lanes: 1,+ },+ DataType::F32 => DLDataType {+ code: DLDataTypeCode::kDLFloat as u8,+ bits: 32,+ lanes: 1,+ },+ DataType::F64 => DLDataType {+ code: DLDataTypeCode::kDLFloat as u8,+ bits: 64,+ lanes: 1,+ },+ DataType::I4 => DLDataType {+ code: DLDataTypeCode::kDLInt as u8,+ bits: 4,+ lanes: 1,+ },+ DataType::U4 => DLDataType {+ code: DLDataTypeCode::kDLUInt as u8,+ bits: 4,+ lanes: 1,+ },+ DataType::I8 => DLDataType {+ code: DLDataTypeCode::kDLInt as u8,+ bits: 8,+ lanes: 1,+ },+ DataType::U8 => DLDataType {+ code: DLDataTypeCode::kDLUInt as u8,+ bits: 8,+ lanes: 1,+ },+ DataType::I16 => DLDataType {+ code: DLDataTypeCode::kDLInt as u8,+ bits: 16,+ lanes: 1,+ },+ DataType::U16 => DLDataType {+ code: DLDataTypeCode::kDLUInt as u8,+ bits: 16,+ lanes: 1,+ },+ DataType::I32 => DLDataType {+ code: DLDataTypeCode::kDLInt as u8,+ bits: 32,+ lanes: 1,+ },+ DataType::U32 => DLDataType {+ code: DLDataTypeCode::kDLUInt as u8,+ bits: 32,+ lanes: 1,+ },+ DataType::I64 => DLDataType {+ code: DLDataTypeCode::kDLInt as u8,+ bits: 64,+ lanes: 1,+ },+ DataType::U64 => DLDataType {+ code: DLDataTypeCode::kDLUInt as u8,+ bits: 64,+ lanes: 1,+ },+ }+ }+}diff --git a/crates/uzu/src/device/mod.rs b/crates/uzu/src/device/mod.rsindex 52ae2e87a..63badd4dd 100644--- a/crates/uzu/src/device/mod.rs+++ b/crates/uzu/src/device/mod.rs@@ -2,5 +2,6 @@ pub mod array;pub use array::*;pub mod data_type;pub use data_type::*;+pub mod data_type_ext;pub mod device_context;pub use device_context::*;diff --git a/crates/uzu/src/generator/generator.rs b/crates/uzu/src/generator/generator.rsindex 1ada08fb6..8197d0af8 100644--- a/crates/uzu/src/generator/generator.rs+++ b/crates/uzu/src/generator/generator.rs@@ -3,7 +3,7 @@ use std::{};use block::ConcreteBlock;-use itertools::izip;+use itertools::{Either, Itertools, izip};use mpsgraph::CommandBuffer;use super::{@@ -18,6 +18,7 @@ use crate::{ForwardPassState, INVALID_POSITION,encodable_with_state::{EncodableWithState, EncodingParameters},},+ generator::grammar::CompiledGrammar,session::{config::DecodingConfig,parameter::{ConfigResolvableValue, SamplingMethod},@@ -68,6 +69,7 @@ impl Generator {pub fn prefill(&mut self,tokens: Vec<u64>,+ mut compiled_grammar: Option<&mut CompiledGrammar>,sampling_method: SamplingMethod,prefix_offset: usize,sample_suffix: bool,@@ -91,6 +93,7 @@ impl Generator {let suffix_root = TrieNode::from_speculator(&tokens,&mut self.context.next_seed,+ compiled_grammar.as_deref_mut(),speculator.as_ref(),&TrieCreationConfig::default(),suffix_length + 1,@@ -104,7 +107,7 @@ impl Generator {.take(tokens_length - 1).chain(flat_trie.token_ids()).chain(repeat_n(0, suffix_length - active_suffix_length))- .collect::<Box<[u64]>>();+ .chunks(prefill_step_size);let token_positions = (prefix_offset..prefix_offset + tokens_length - 1)@@ -115,27 +118,54 @@ impl Generator {INVALID_POSITION,suffix_length - active_suffix_length,))- .collect::<Box<[usize]>>();+ .chunks(prefill_step_size);++ let single_token_bitmask_size =+ self.context.model_shape.bitmask_shape(1)[1];+ let token_bitmasks = repeat_n(None, tokens_length - 1)+ .chain(flat_trie.token_masks())+ .chain(repeat_n(None, suffix_length - active_suffix_length))+ .chunks(prefill_step_size);let token_seeds = repeat_n(0, tokens_length - 1).chain(flat_trie.token_seeds()).chain(repeat_n(0, suffix_length - active_suffix_length))- .collect::<Box<[u64]>>();+ .chunks(prefill_step_size);let mut last_state: Option<ForwardPassState> = None;let mut run_times: Vec<f64> = Vec::new();// Process each prefill step and update the KV cache.- for (step, (step_token_ids, step_token_positions, step_token_seeds)) in- izip!(- token_ids.chunks(prefill_step_size),- token_positions.chunks(prefill_step_size),- token_seeds.chunks(prefill_step_size)- )- .enumerate()+ for (+ step,+ (+ step_token_ids,+ step_token_positions,+ step_token_bitmask,+ step_token_seeds,+ ),+ ) in+ izip!(&token_ids, &token_positions, &token_bitmasks, &token_seeds)+ .enumerate(){let tokens_start_index = step * prefill_step_size;let tokens_end_index = tokens_start_index + prefill_step_size;++ let step_token_ids = step_token_ids.collect::<Box<[u64]>>();+ let step_token_positions =+ step_token_positions.collect::<Box<[usize]>>();+ let step_token_bitmask = step_token_bitmask+ .map(|mask| match mask {+ Some(mask) => Either::Left(mask.iter().copied()),+ None => Either::Right(repeat_n(+ u32::MAX,+ single_token_bitmask_size,+ )),+ })+ .flatten()+ .collect::<Box<[u32]>>();+ let step_token_seeds = step_token_seeds.collect::<Box<[u64]>>();+let active_suffix_length = step_token_positions.iter().position(|&pos| pos == INVALID_POSITION)@@ -158,9 +188,10 @@ impl Generator {});let task = GeneratorRunTask {- token_ids: step_token_ids,- token_positions: step_token_positions,- token_seeds: step_token_seeds,+ token_ids: &step_token_ids,+ token_positions: &step_token_positions,+ token_bitmask: Some(&step_token_bitmask),+ token_seeds: &step_token_seeds,expected_number_of_new_tokens: prefill_step_size,active_suffix_length,is_prefilling: !should_sample_after_step,@@ -236,6 +267,12 @@ impl Generator {let (accepted_tokens, accepted_token_indices) =flat_trie.accept(&sampled_tokens[suffix_root_index..]);+ if let Some(compiled_grammar) = compiled_grammar.as_deref_mut() {+ for &token in &accepted_tokens {+ compiled_grammar.accept_token(token);+ }+ }+self.update_cache_layers(&accepted_token_indices.into_iter()@@ -256,6 +293,7 @@ impl Generator {pub fn generate(&mut self,+ mut compiled_grammar: Option<&mut CompiledGrammar>,sampling_method: SamplingMethod,) -> Result<GenerateResult, Error> {let speculator = &self.decoding_config.speculator_config.speculator;@@ -264,6 +302,7 @@ impl Generator {let suffix_root = TrieNode::from_speculator(&self.tokens,&mut self.context.next_seed,+ compiled_grammar.as_deref_mut(),speculator.as_ref(),&TrieCreationConfig::default(),suffix_length,@@ -277,6 +316,20 @@ impl Generator {.chain(repeat_n(0, suffix_length - active_suffix_length)).collect::<Box<[u64]>>();+ let single_token_bitmask_size =+ self.context.model_shape.bitmask_shape(1)[1];+ let token_bitmask = flat_trie+ .token_masks()+ .chain(repeat_n(None, suffix_length - active_suffix_length))+ .map(|mask| match mask {+ Some(mask) => Either::Left(mask.iter().copied()),+ None => {+ Either::Right(repeat_n(u32::MAX, single_token_bitmask_size))+ },+ })+ .flatten()+ .collect::<Box<[u32]>>();+let start_position = self.tokens.len() - 1;let token_positions = flat_trie.token_positions()@@ -295,6 +348,7 @@ impl Generator {let task = GeneratorRunTask {token_ids: &token_ids,token_positions: &token_positions,+ token_bitmask: Some(&token_bitmask),token_seeds: &token_seeds,expected_number_of_new_tokens: 1,active_suffix_length,@@ -313,6 +367,12 @@ impl Generator {let (accepted_tokens, accepted_token_indices) =flat_trie.accept(&sampled_tokens);+ if let Some(compiled_grammar) = compiled_grammar.as_deref_mut() {+ for &token in &accepted_tokens {+ compiled_grammar.accept_token(token);+ }+ }+self.update_cache_layers(&accepted_token_indices[1..], None, false);self.tokens.extend(accepted_tokens.clone());@@ -349,6 +409,7 @@ impl Generator {let task = GeneratorRunTask {token_ids: &repeat_n(0, suffix_length).collect::<Box<[u64]>>(),token_positions: &(0..suffix_length).collect::<Box<[usize]>>(),+ token_bitmask: None,token_seeds: &repeat_n(0, suffix_length).collect::<Box<[u64]>>(),expected_number_of_new_tokens: suffix_length,active_suffix_length: suffix_length,@@ -574,6 +635,7 @@ impl Generator {let task = GeneratorRunTask {token_ids: &[last_token],token_positions: &[0], // Ignored, using async buffer+ token_bitmask: None, // Ignored, using async buffertoken_seeds: &[0], // Ignored, using async bufferexpected_number_of_new_tokens: 1,active_suffix_length: 1,@@ -592,6 +654,7 @@ impl Generator {self.context.shared_buffers.clone(),&task.token_ids,&task.token_positions,+ task.token_bitmask,&task.token_seeds,task.active_suffix_length,task.is_prefilling,diff --git a/crates/uzu/src/generator/grammar.rs b/crates/uzu/src/generator/grammar.rsnew file mode 100644index 000000000..d2ede8835--- /dev/null+++ b/crates/uzu/src/generator/grammar.rs@@ -0,0 +1,203 @@+use std::iter::repeat_n;++use xgrammar::{+ DLDataType, DLDevice, DLDeviceType, DLTensor, Grammar, GrammarCompiler,+ GrammarMatcher, TokenizerInfo,+};++use crate::session::{config::GrammarConfig, types::Error};++enum CompiledGrammarEngagementState {+ Always,+ Triggered {+ trigger_token_id: u64,+ trigger_distance: Option<usize>,+ },+}++impl CompiledGrammarEngagementState {+ fn is_engaged(&self) -> bool {+ match self {+ Self::Always => true,+ Self::Triggered {+ trigger_token_id: _,+ trigger_distance,+ } => trigger_distance.is_some(),+ }+ }++ pub fn accept_token(+ &mut self,+ token_id: u64,+ ) {+ match self {+ Self::Always => (),+ Self::Triggered {+ trigger_token_id,+ trigger_distance,+ } => {+ if let Some(trigger_distance) = trigger_distance {+ *trigger_distance += 1;+ } else if token_id == *trigger_token_id {+ *trigger_distance = Some(0);+ }+ },+ }+ }++ pub fn rollback(+ &mut self,+ num_tokens: usize,+ ) -> usize {+ match self {+ Self::Always => num_tokens,+ Self::Triggered {+ trigger_token_id: _,+ trigger_distance,+ } => {+ let num_grammar_tokens =+ usize::min(trigger_distance.unwrap_or(0), num_tokens);+ *trigger_distance =+ trigger_distance.and_then(|x| x.checked_sub(num_tokens));+ num_grammar_tokens+ },+ }+ }++ pub fn reset(&mut self) {+ match self {+ Self::Always => (),+ Self::Triggered {+ trigger_token_id: _,+ trigger_distance,+ } => *trigger_distance = None,+ }+ }+}++pub struct CompiledGrammar {+ vocab_size: usize,+ matcher: GrammarMatcher,+ engagement_state: CompiledGrammarEngagementState,+}++impl CompiledGrammar {+ pub fn from_config(+ config: &GrammarConfig,+ trigger_token_id: Option<u64>,+ tokenizer_info: &TokenizerInfo,+ ) -> Result<Self, Error> {+ let vocab_size = tokenizer_info.vocab_size() as usize;++ let grammar = match config {+ GrammarConfig::JsonSchema {+ schema,+ any_whitespace,+ indent,+ separators,+ strict_mode,+ } => {+ let separators_ref =+ separators.as_ref().map(|(a, b)| (a.as_str(), b.as_str()));+ Grammar::from_json_schema(+ schema,+ *any_whitespace,+ *indent,+ separators_ref,+ *strict_mode,+ None,+ false,+ )+ },+ GrammarConfig::Regex {+ pattern,+ print_converted_ebnf,+ } => Grammar::from_regex(pattern, *print_converted_ebnf),+ GrammarConfig::BuiltinJson => Grammar::builtin_json_grammar(),+ };+ let mut compiler = GrammarCompiler::new(tokenizer_info, 8, true, -1);+ let compiled = compiler.compile_grammar(&grammar);+ let matcher = GrammarMatcher::new(&compiled, None, true, -1);++ let engagement_state = if let Some(trigger_token_id) = trigger_token_id+ {+ CompiledGrammarEngagementState::Triggered {+ trigger_token_id,+ trigger_distance: None,+ }+ } else {+ CompiledGrammarEngagementState::Always+ };++ Ok(Self {+ vocab_size,+ matcher,+ engagement_state,+ })+ }++ pub fn next_bitmask(&mut self) -> Result<Option<Box<[u32]>>, Error> {+ if self.engagement_state.is_engaged() {+ let mut cpu_mask = repeat_n(0, self.vocab_size.div_ceil(32))+ .collect::<Box<[u32]>>();+ let batch_mask_slice = &mut cpu_mask;+ let mut shape_i64 = [self.vocab_size.div_ceil(32) as i64];+ let mut bitmask_tensor = DLTensor {+ data: batch_mask_slice.as_mut_ptr() as *mut core::ffi::c_void,+ device: DLDevice {+ device_type: DLDeviceType::kDLCPU,+ device_id: 0,+ },+ ndim: 1,+ dtype: DLDataType {+ code: 0,+ bits: 32,+ lanes: 1,+ },+ shape: shape_i64.as_mut_ptr(),+ strides: core::ptr::null_mut(),+ byte_offset: 0,+ };++ let success = self.matcher.fill_next_token_bitmask(+ &mut bitmask_tensor,+ 0,+ false,+ );+ if !success {+ return Err(Error::GrammarError);+ }++ Ok(Some(cpu_mask))+ } else {+ Ok(None)+ }+ }++ pub fn accept_token(+ &mut self,+ token_id: u64,+ ) {+ if self.engagement_state.is_engaged() {+ self.matcher.accept_token(token_id as i32);+ }++ self.engagement_state.accept_token(token_id);+ }++ pub fn rollback(+ &mut self,+ num_tokens: usize,+ ) {+ let num_grammar_tokens = self.engagement_state.rollback(num_tokens);++ if num_grammar_tokens > 0 {+ self.matcher.rollback(num_grammar_tokens as i32);+ }+ }++ pub fn reset(&mut self) {+ self.matcher.reset();+ self.engagement_state.reset();+ }+}diff --git a/crates/uzu/src/generator/mod.rs b/crates/uzu/src/generator/mod.rsindex c599c436e..dbe4efd98 100644--- a/crates/uzu/src/generator/mod.rs+++ b/crates/uzu/src/generator/mod.rs@@ -1,6 +1,7 @@pub mod context;pub mod generator;pub mod gpu_capture;+pub mod grammar;pub mod gumbel;pub mod result;pub mod rng;diff --git a/crates/uzu/src/generator/tasks.rs b/crates/uzu/src/generator/tasks.rsindex dcf7fb170..af6cb4bdb 100644--- a/crates/uzu/src/generator/tasks.rs+++ b/crates/uzu/src/generator/tasks.rs@@ -36,6 +36,7 @@ impl GeneratorEncodedTask {pub struct GeneratorRunTask<'a> {pub token_ids: &'a [u64],pub token_positions: &'a [usize],+ pub token_bitmask: Option<&'a [u32]>,pub token_seeds: &'a [u64],pub expected_number_of_new_tokens: usize,pub active_suffix_length: usize,@@ -47,6 +48,7 @@ impl<'a> GeneratorRunTask<'a> {GeneratorRunTask {token_ids: self.token_ids,token_positions: self.token_positions,+ token_bitmask: self.token_bitmask,token_seeds: self.token_seeds,expected_number_of_new_tokens: self.expected_number_of_new_tokens,active_suffix_length: self.active_suffix_length,@@ -78,6 +80,7 @@ impl<'a> GeneratorRunTask<'a> {context.shared_buffers.clone(),self.token_ids,self.token_positions,+ self.token_bitmask,self.token_seeds,self.active_suffix_length,self.is_prefilling,diff --git a/crates/uzu/src/runners/decoder_runner.rs b/crates/uzu/src/runners/decoder_runner.rsindex caade4528..cca97cc23 100644--- a/crates/uzu/src/runners/decoder_runner.rs+++ b/crates/uzu/src/runners/decoder_runner.rs@@ -127,6 +127,7 @@ impl DecoderTestContext {shared_buffers.clone(),&token_ids,&token_positions,+ None,&token_seeds,token_ids.len(),false,diff --git a/crates/uzu/src/session/config/grammar_config.rs b/crates/uzu/src/session/config/grammar_config.rsnew file mode 100644index 000000000..68f3fc91b--- /dev/null+++ b/crates/uzu/src/session/config/grammar_config.rs@@ -0,0 +1,99 @@+use schemars::JsonSchema;+use serde_json;++#[derive(Debug, Clone)]+pub enum GrammarConfig {+ JsonSchema {+ schema: String,+ any_whitespace: bool,+ indent: Option<i32>,+ separators: Option<(String, String)>,+ strict_mode: bool,+ },+ Regex {+ pattern: String,+ print_converted_ebnf: bool,+ },+ BuiltinJson,+}++impl GrammarConfig {+ pub fn json_schema(+ schema: String,+ any_whitespace: bool,+ indent: Option<i32>,+ separators: Option<(String, String)>,+ strict_mode: bool,+ ) -> Self {+ Self::JsonSchema {+ schema,+ any_whitespace,+ indent,+ separators,+ strict_mode,+ }+ }++ pub fn json_schema_simple(schema: String) -> Self {+ Self::JsonSchema {+ schema,+ any_whitespace: true,+ indent: Some(2),+ separators: Some((",".to_string(), ":".to_string())),+ strict_mode: true,+ }+ }++ pub fn regex(+ pattern: String,+ print_converted_ebnf: bool,+ ) -> Self {+ Self::Regex {+ pattern,+ print_converted_ebnf,+ }+ }++ pub fn builtin_json() -> Self {+ Self::BuiltinJson+ }++ pub fn from_json_schema_type<T>() -> Result<Self, String>+ where+ T: JsonSchema,+ {+ let schema_root = schemars::schema_for!(T);+ let schema_str = serde_json::to_string(&schema_root)+ .map_err(|e| format!("Failed to serialize schema: {}", e))?;++ Ok(Self::JsonSchema {+ schema: schema_str,+ any_whitespace: true,+ indent: Some(2),+ separators: Some((",".to_string(), ":".to_string())),+ strict_mode: true,+ })+ }++ pub fn from_json_schema_type_with_config<T>(+ any_whitespace: bool,+ indent: Option<i32>,+ separators: Option<(String, String)>,+ strict_mode: bool,+ ) -> Result<Self, String>+ where+ T: JsonSchema,+ {+ let schema_root = schemars::schema_for!(T);+ let schema_str = serde_json::to_string(&schema_root)+ .map_err(|e| format!("Failed to serialize schema: {}", e))?;++ Ok(Self::JsonSchema {+ schema: schema_str,+ any_whitespace,+ indent,+ separators,+ strict_mode,+ })+ }+}diff --git a/crates/uzu/src/session/config/mod.rs b/crates/uzu/src/session/config/mod.rsindex 28ba4b356..50dfc113c 100644--- a/crates/uzu/src/session/config/mod.rs+++ b/crates/uzu/src/session/config/mod.rs@@ -1,7 +1,9 @@mod decoding_config;+mod grammar_config;mod run_config;mod speculator_config;pub use decoding_config::DecodingConfig;+pub use grammar_config::GrammarConfig;pub use run_config::RunConfig;pub use speculator_config::SpeculatorConfig;diff --git a/crates/uzu/src/session/config/run_config.rs b/crates/uzu/src/session/config/run_config.rsindex aa07e06d7..ad0a3f9de 100644--- a/crates/uzu/src/session/config/run_config.rs+++ b/crates/uzu/src/session/config/run_config.rs@@ -1,10 +1,11 @@-use crate::session::parameter::SamplingPolicy;+use crate::session::{config::GrammarConfig, parameter::SamplingPolicy};#[derive(Debug, Clone)]pub struct RunConfig {pub tokens_limit: u64,pub enable_thinking: bool,pub sampling_policy: SamplingPolicy,+ pub grammar_config: Option<GrammarConfig>,}impl RunConfig {@@ -17,6 +18,7 @@ impl RunConfig {tokens_limit,enable_thinking,sampling_policy,+ grammar_config: None,}}@@ -43,6 +45,14 @@ impl RunConfig {self.sampling_policy = sampling_policy;self}++ pub fn grammar_config(+ mut self,+ grammar_config: GrammarConfig,+ ) -> Self {+ self.grammar_config = Some(grammar_config);+ self+ }}impl Default for RunConfig {diff --git a/crates/uzu/src/session/session.rs b/crates/uzu/src/session/session.rsindex 9da0294b5..d732913a5 100644--- a/crates/uzu/src/session/session.rs+++ b/crates/uzu/src/session/session.rs@@ -16,12 +16,14 @@ fn nanos_to_secs(nanos: u64) -> f64 {use objc2::rc::autoreleasepool;use tokenizers::Tokenizer;+use xgrammar::TokenizerInfo;use crate::{backends::metal::forward_pass::cache_layers::CacheLayer,config::{ModelMetadata, decoder_layer::MixerConfig},generator::{generator::Generator,+ grammar::CompiledGrammar,result::{GenerateResult, PrefillResult},},session::{@@ -55,6 +57,7 @@ pub struct Session {pub model_metadata: ModelMetadata,tokenizer: Tokenizer,+ tokenizer_info: TokenizerInfo,input_processor: Box<dyn InputProcessor>,output_parser: OutputParser,generator: Option<Generator>,@@ -122,6 +125,9 @@ impl Session {let tokenizer = Tokenizer::from_file(&tokenizer_path).map_err(|_| Error::UnableToLoadTokenizer)?;+ let tokenizer_info =+ TokenizerInfo::from_huggingface(&tokenizer, None, None);+let input_processor = InputProcessorDefault::new(model_metadata.model_config.message_processor_config.clone(),);@@ -141,6 +147,7 @@ impl Session {model_path,model_metadata,tokenizer,+ tokenizer_info,input_processor: Box::new(input_processor),output_parser,generator: Some(generator),@@ -249,6 +256,17 @@ impl Session {let generator =self.generator.as_mut().ok_or(Error::GeneratorNotLoaded)?;+ let mut compiled_grammar: Option<CompiledGrammar> =+ if let Some(ref grammar_config) = config.grammar_config {+ Some(CompiledGrammar::from_config(+ grammar_config,+ None,+ &self.tokenizer_info,+ )?)+ } else {+ None+ };+let run_start = Instant::now();let text =self.input_processor.process(&input, config.enable_thinking)?;@@ -288,6 +306,7 @@ impl Session {let sample_suffix = config.tokens_limit > 0;let prefill_result = generator.prefill(tokens.clone(),+ compiled_grammar.as_mut(),sampling_method,prefix_offset,sample_suffix,@@ -343,7 +362,8 @@ impl Session {let can_use_async = generator.decoding_config.generate_suffix_length()== 1- && !generator.has_attention_layers();+ && !generator.has_attention_layers()+ && compiled_grammar.is_none();let generate_output = if can_use_async {let batch_size = generator@@ -377,6 +397,7 @@ impl Session {&self.output_parser,&run_context,generator,+ compiled_grammar.as_mut(),sampling_method,&progress,)?@@ -672,6 +693,7 @@ impl Session {output_parser: &OutputParser,run_context: &RunContext,generator: &mut Generator,+ mut compiled_grammar: Option<&mut CompiledGrammar>,sampling_method: SamplingMethod,progress: &Option<F>,) -> Result<Output, Error>@@ -683,7 +705,8 @@ impl Session {loop {let start = Instant::now();- let result = generator.generate(sampling_method)?;+ let result = generator+ .generate(compiled_grammar.as_deref_mut(), sampling_method)?;let new_tokens = result.tokens.clone();let duration = start.elapsed().as_secs_f64();diff --git a/crates/uzu/src/session/types/error.rs b/crates/uzu/src/session/types/error.rsindex 2d58fcf82..e39bc9f6f 100644--- a/crates/uzu/src/session/types/error.rs+++ b/crates/uzu/src/session/types/error.rs@@ -38,4 +38,6 @@ pub enum Error {GenerateFailed,#[error("Sampling failed")]SamplingFailed,+ #[error("Grammar error")]+ GrammarError,}diff --git a/crates/uzu/src/tracer/tracer.rs b/crates/uzu/src/tracer/tracer.rsindex d9c0e6f5f..e17fe6103 100644--- a/crates/uzu/src/tracer/tracer.rs+++ b/crates/uzu/src/tracer/tracer.rs@@ -315,6 +315,7 @@ impl Tracer {self.generator_context.shared_buffers.clone(),&token_ids,&token_positions,+ None,&token_seeds,token_ids.len(),false,diff --git a/crates/uzu/src/trie.rs b/crates/uzu/src/trie.rsindex 7bede11fc..399420a28 100644--- a/crates/uzu/src/trie.rs+++ b/crates/uzu/src/trie.rs@@ -1,5 +1,7 @@use crate::{- generator::{gumbel::speculator_sample, rng::DerivableSeed},+ generator::{+ grammar::CompiledGrammar, gumbel::speculator_sample, rng::DerivableSeed,+ },speculators::speculator::Speculator,};@@ -26,6 +28,7 @@ impl Default for TrieCreationConfig {#[derive(Debug)]pub struct TrieNode {token: u64,+ mask: Option<Box<[u32]>>,seed: u64,next: Vec<TrieNode>,}@@ -38,10 +41,12 @@ pub struct FlatTrie<'a> {impl TrieNode {pub fn new(token: u64,+ mask: Option<Box<[u32]>>,seed: u64,) -> Self {Self {token,+ mask,seed,next: Vec::new(),}@@ -84,6 +89,7 @@ impl TrieNode {pub fn from_speculator(prefix: &[u64],next_seed: &mut DerivableSeed,+ mut compiled_grammar: Option<&mut CompiledGrammar>,speculator: &dyn Speculator,creation_config: &TrieCreationConfig,max_length: usize,@@ -94,7 +100,12 @@ impl TrieNode {let mut speculated_suffix = prefix.to_vec();let mut length = 1;- let mut root = Self::new(*prefix.last().unwrap(), next_seed.next());+ let mut grammar_accept_count = 0;+ let mask = compiled_grammar+ .as_deref_mut()+ .and_then(|g| g.next_bitmask().unwrap());+ let mut root =+ Self::new(*prefix.last().unwrap(), mask, next_seed.next());let mut cur_node = &mut root;let mut cur_node_width = 0;@@ -109,8 +120,20 @@ impl TrieNode {speculator_sample(cur_node.seed(), &cur_node_speculator_weights){// Add speculated token to the trie+ let mask = if let Some(compiled_grammar) =+ compiled_grammar.as_deref_mut()+ {+ compiled_grammar.accept_token(next_speculated_token);+ let next_bitmask = compiled_grammar.next_bitmask().unwrap();+ compiled_grammar.rollback(1);++ next_bitmask+ } else {+ None+ };+let leaf_node =- Self::new(next_speculated_token, next_seed.next());+ Self::new(next_speculated_token, mask, next_seed.next());cur_node.add(leaf_node).unwrap();// If this is the first node we sampled (most likely to be selected after gumbel noise application) - set it as the next one@@ -129,6 +152,11 @@ impl TrieNode {} else if let Some(next_node_token) = next_node.take() {// Out of speculated tokens for this node, move onto the likeliest next nodespeculated_suffix.push(next_node_token);+ if let Some(compiled_grammar) = compiled_grammar.as_deref_mut()+ {+ compiled_grammar.accept_token(next_node_token);+ grammar_accept_count += 1;+ }cur_node = cur_node.get_mut(next_node_token).unwrap();cur_node_width = 0;cur_node_speculator_weights =@@ -140,6 +168,10 @@ impl TrieNode {};}+ if let Some(compiled_grammar) = compiled_grammar.as_deref_mut() {+ compiled_grammar.rollback(grammar_accept_count);+ }+root}@@ -184,6 +216,10 @@ impl<'a> FlatTrie<'a> {self.tokens.iter().map(|&(_n, p)| p)}+ pub fn token_masks(&self) -> impl Iterator<Item = Option<&[u32]>> {+ self.tokens.iter().map(|&(n, _p)| n.mask.as_deref())+ }+pub fn token_seeds(&self) -> impl Iterator<Item = u64> {self.tokens.iter().map(|&(n, _p)| n.seed)}diff --git a/crates/uzu/tests/grammar_json_schema_test.rs b/crates/uzu/tests/grammar_json_schema_test.rsnew file mode 100644index 000000000..c52f38fb0--- /dev/null+++ b/crates/uzu/tests/grammar_json_schema_test.rs@@ -0,0 +1,121 @@+#![cfg(target_os = "macos")]++use std::path::PathBuf;++use schemars::JsonSchema;+use serde::{Deserialize, Serialize};+use uzu::session::{+ Session,+ config::{DecodingConfig, GrammarConfig, RunConfig},+ parameter::SamplingPolicy,+ types::Input,+};++#[derive(Debug, Serialize, Deserialize, JsonSchema)]+struct Address {+ street: String,+ city: String,+ country: String,+ postal_code: String,+}++#[derive(Debug, Serialize, Deserialize, JsonSchema)]+struct Person {+ name: String,+ age: u32,+ email: String,+ address: Address,+ hobbies: Vec<String>,+}++#[test]+fn test_grammar_json_schema() {+ let crate_version = env!("CARGO_PKG_VERSION");+ let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));+ let repo_root = manifest_dir.parent().unwrap().parent().unwrap();+ let model_dir = repo_root+ .join("models")+ .join(crate_version)+ .join("Llama-3.2-1B-Instruct");++ if !model_dir.exists() {+ eprintln!(+ "Skipping test: model not found at {}.\nRun scripts/download_test_model.sh first.",+ model_dir.display()+ );+ return;+ }++ let decoding_config = DecodingConfig::default();+ let mut session = Session::new(model_dir, decoding_config)+ .expect("Failed to create session");++ let input = Input::Text(+ "Generate a detailed person profile with address and hobbies in JSON format.".to_string(),+ );++ let grammar_config_simple =+ GrammarConfig::from_json_schema_type::<Person>()+ .expect("Failed to create grammar config");++ let _grammar_config_advanced =+ GrammarConfig::from_json_schema_type_with_config::<Person>(+ true,+ Some(4),+ Some((",".to_string(), ": ".to_string())),+ true,+ )+ .expect("Failed to create grammar config");++ let run_config = RunConfig::default()+ .tokens_limit(1000)+ .sampling_policy(SamplingPolicy::Default)+ .grammar_config(grammar_config_simple);++ let output = session+ .run(input, run_config, None::<fn(uzu::session::types::Output) -> bool>)+ .expect("Failed to run session");++ let stats = output.stats;+ let total_tokens = stats.total_stats.tokens_count_input+ + stats.total_stats.tokens_count_output;++ println!("\n=== Test Results ===");+ println!("Generated output length: {} chars", output.text.original.len());+ println!(+ "Input tokens: {}, Output tokens: {}",+ stats.total_stats.tokens_count_input,+ stats.total_stats.tokens_count_output+ );+ println!("Total time: {:.2}s", stats.total_stats.duration);+ println!(+ "Throughput: {:.2} tokens/s",+ total_tokens as f64 / stats.total_stats.duration+ );++ match serde_json::from_str::<Person>(&output.text.original) {+ Ok(person) => {+ println!("✓ Valid Person JSON!");+ println!(" Name: {}", person.name);+ println!(" Age: {}", person.age);+ println!(" Email: {}", person.email);+ println!(+ " Address: {}, {}",+ person.address.city, person.address.country+ );+ println!(" Hobbies: {:?}", person.hobbies);++ assert!(!person.name.is_empty());+ assert!(person.age > 0);+ assert!(person.email.contains('@'));+ assert!(!person.address.city.is_empty());+ assert!(!person.hobbies.is_empty());+ },+ Err(e) => {+ panic!(+ "✗ Generated invalid JSON: {}\nOutput: {}",+ e, output.text.original+ );+ },+ }+}diff --git a/crates/uzu/tests/person_schema_metal_bitmask_test.rs b/crates/uzu/tests/person_schema_metal_bitmask_test.rsnew file mode 100644index 000000000..da5a82656--- /dev/null+++ b/crates/uzu/tests/person_schema_metal_bitmask_test.rs@@ -0,0 +1,104 @@+#![cfg(target_os = "macos")]++use std::path::PathBuf;++use metal::{Device as MTLDevice, MTLResourceOptions};+use schemars::JsonSchema;+use serde::{Deserialize, Serialize};+use tokenizers::Tokenizer;+use uzu::{Array, DataType, backends::metal::MetalArray};+use xgrammar::{+ DLDevice, DLDeviceType, DLTensor, Grammar, GrammarCompiler, GrammarMatcher,+ TokenizerInfo,+};++#[derive(Debug, Serialize, Deserialize, JsonSchema)]+struct Person {+ name: String,+ age: u32,+}++#[test]+fn person_schema_metal_bitmask() {+ // Locate the tokenizer.json under {repo}/models/{version}/Llama-3.2-1B-Instruct+ let crate_version = env!("CARGO_PKG_VERSION");+ let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));+ let repo_root = manifest_dir.parent().unwrap().parent().unwrap();+ let model_dir = repo_root+ .join("models")+ .join(crate_version)+ .join("Llama-3.2-1B-Instruct");++ let tokenizer_path = model_dir.join("tokenizer.json");+ if !tokenizer_path.exists() {+ eprintln!(+ "Skipping test: tokenizer.json not found at {}.\nRun scripts/download_test_model.sh first.",+ tokenizer_path.display()+ );+ return;+ }++ let schema_root = schemars::schema_for!(Person);+ let schema_str =+ serde_json::to_string(&schema_root).expect("schema to string");++ let tokenizer =+ Tokenizer::from_file(&tokenizer_path).expect("load tokenizer.json");+ let tokenizer_info =+ TokenizerInfo::from_huggingface(&tokenizer, None, None);++ let grammar = Grammar::from_json_schema(+ &schema_str,+ true,+ Some(2),+ Some((",", ":")),+ true,+ None,+ false,+ );+ let mut compiler = GrammarCompiler::new(&tokenizer_info, 8, true, -1);+ let compiled = compiler.compile_grammar(&grammar);++ let mut matcher = GrammarMatcher::new(&compiled, None, true, -1);++ let device = match MTLDevice::system_default() {+ Some(d) => d,+ None => {+ eprintln!("Skipping test: no Metal device available");+ return;+ },+ };+ let device_id = device.registry_id() as i32;+ let batch: usize = 1;+ let vocab = tokenizer_info.vocab_size() as usize;+ // xgrammar uses a dynamic bitset over the vocab, packed into i32 words+ let buffer_size = (vocab + 31) / 32; // number of i32s required+ let shape = [batch, buffer_size];++ // xgrammar expects an int32 mask tensor of shape [buffer_size]+ let elems = batch * buffer_size;+ let bytes = (elems * core::mem::size_of::<i32>()) as u64;+ let buffer =+ device.new_buffer(bytes, MTLResourceOptions::StorageModeShared);+ let mut metal_bitmask =+ unsafe { MetalArray::new(buffer, &shape, DataType::I32) };++ let mut shape_i64 = [buffer_size as i64];+ let mut bitmask_tensor = DLTensor {+ data: unsafe { metal_bitmask.mtl_buffer().contents() },+ device: DLDevice {+ device_type: DLDeviceType::kDLCPU,+ device_id,+ },+ ndim: 1,+ dtype: DataType::I32.into(),+ shape: shape_i64.as_mut_ptr(),+ strides: core::ptr::null_mut(),+ byte_offset: 0,+ };++ let _ok = matcher.fill_next_token_bitmask(&mut bitmask_tensor, 0, false);++ assert_eq!(metal_bitmask.shape(), &shape);+ assert_eq!(metal_bitmask.as_slice::<i32>().unwrap().len(), elems);+}diff --git a/crates/uzu/tests/sampling_test.rs b/crates/uzu/tests/sampling_test.rsindex 5811be40e..ae42926b2 100644--- a/crates/uzu/tests/sampling_test.rs+++ b/crates/uzu/tests/sampling_test.rs@@ -107,6 +107,7 @@ fn test_argmax_sampling_with_strategy(strategy: ArgmaxStrategy) {.encode(&logits_buffer,None,+ None,&output_buffer,SamplingMethod::Greedy,batch_size,@@ -246,6 +247,7 @@ fn test_topp_sampling_from_prob_exact_match(kernel.encode(&logits_buf,+ None,Some(&seeds_buf),&output_buf,SamplingMethod::Stochastic {@@ -373,6 +375,7 @@ fn test_topp_sampling_statistical_large() {kernel.encode(&logits_buf,+ None,Some(&seeds_buf),&output_buf,SamplingMethod::Stochastic {@@ -481,6 +484,7 @@ fn perf_topp_128k_vocab() {kernel.encode(&logits_buf,+ None,Some(&seeds_buf),&output_buf,SamplingMethod::Stochastic {@@ -586,6 +590,7 @@ fn perf_argmax_128k_vocab_with_strategy(strategy: ArgmaxStrategy) {kernel.encode(&logits_buf,+ None,Some(&seeds_buf),&output_buf,SamplingMethod::Greedy,@@ -707,6 +712,7 @@ fn test_categorical_sampling() {kernel.encode(&logits_buffer,+ None,Some(&seeds_buffer),&output_buffer,SamplingMethod::Stochastic {@@ -850,6 +856,7 @@ fn test_categorical_sampling_statistical() {kernel.encode(&logits_buffer,+ None,Some(&seeds_buffer),&output_buffer,SamplingMethod::Stochastic {@@ -956,6 +963,7 @@ fn perf_categorical_128k_vocab() {kernel.encode(&logits_buf,+ None,Some(&seeds_buf),&output_buf,SamplingMethod::Stochastic {diff --git a/crates/uzu/tests/trie_test.rs b/crates/uzu/tests/trie_test.rsindex 6bf8faa38..b3344d100 100644--- a/crates/uzu/tests/trie_test.rs+++ b/crates/uzu/tests/trie_test.rs@@ -35,9 +35,9 @@ fn verify_sprout(assert_eq!(flat_trie.len(), 1);assert_eq!(flat_trie.index(&trie_root), Some(0));- assert_eq!(flat_trie.index(&TrieNode::new(1, 0)), None);- assert_eq!(flat_trie.index(&TrieNode::new(0, 1)), None);- assert_eq!(flat_trie.index(&TrieNode::new(0, 0)), None);+ assert_eq!(flat_trie.index(&TrieNode::new(1, None, 0)), None);+ assert_eq!(flat_trie.index(&TrieNode::new(0, None, 1)), None);+ assert_eq!(flat_trie.index(&TrieNode::new(0, None, 0)), None);assert_eq!(flat_trie.token_ids().collect::<Vec<u64>>(), vec![0]);assert_eq!(flat_trie.token_positions().collect::<Vec<usize>>(), vec![0]);assert_eq!(@@ -48,7 +48,7 @@ fn verify_sprout(#[test]fn test_trie_manual_sprout() {- let trie_root = TrieNode::new(0, 0);+ let trie_root = TrieNode::new(0, None, 0);verify_sprout(&trie_root, 0);}@@ -63,6 +63,7 @@ fn test_trie_from_speculator_sprout() {let trie_root = TrieNode::from_speculator(&[0],&mut trie_rng,+ None,&speculator,&TrieCreationConfig {width: 5,@@ -110,11 +111,11 @@ fn verify_stick(#[test]fn test_trie_manual_stick() {- let mut trie_root = TrieNode::new(0, 0);+ let mut trie_root = TrieNode::new(0, None, 0);let mut trie_leaf = &mut trie_root;for (token, seed) in std::iter::zip(1..10, 1..10) {- trie_leaf.add(TrieNode::new(token, seed)).unwrap();+ trie_leaf.add(TrieNode::new(token, None, seed)).unwrap();trie_leaf = trie_leaf.get_mut(token).unwrap();}@@ -138,6 +139,7 @@ fn test_trie_from_speculator_stick() {let trie_root = TrieNode::from_speculator(&[0],&mut trie_rng,+ None,&speculator,&TrieCreationConfig {width: 1,@@ -186,14 +188,14 @@ fn verify_bush(#[test]fn test_trie_manual_bush() {- let mut trie_root = TrieNode::new(0, 0);+ let mut trie_root = TrieNode::new(0, None, 0);- assert!(trie_root.add(TrieNode::new(1, 1)).is_ok());- assert!(trie_root.add(TrieNode::new(1, 1)).is_err());- assert!(trie_root.add(TrieNode::new(1, 10)).is_err());+ assert!(trie_root.add(TrieNode::new(1, None, 1)).is_ok());+ assert!(trie_root.add(TrieNode::new(1, None, 1)).is_err());+ assert!(trie_root.add(TrieNode::new(1, None, 10)).is_err());- assert!(trie_root.add(TrieNode::new(2, 2)).is_ok());- assert!(trie_root.add(TrieNode::new(3, 3)).is_ok());+ assert!(trie_root.add(TrieNode::new(2, None, 2)).is_ok());+ assert!(trie_root.add(TrieNode::new(3, None, 3)).is_ok());verify_bush(&trie_root, (0..4).into_iter().collect());}@@ -215,6 +217,7 @@ fn test_trie_from_speculator_bush() {let trie_root = TrieNode::from_speculator(&[0],&mut trie_rng,+ None,&speculator,&TrieCreationConfig {width: 3,@@ -265,21 +268,21 @@ fn verify_tree(trie_root: &TrieNode) {#[test]fn test_trie_manual_tree() {- let mut trie_root = TrieNode::new(0, 0);+ let mut trie_root = TrieNode::new(0, None, 0);- assert!(trie_root.add(TrieNode::new(1, 1)).is_ok());- assert!(trie_root.add(TrieNode::new(1, 1)).is_err());- assert!(trie_root.add(TrieNode::new(1, 10)).is_err());+ assert!(trie_root.add(TrieNode::new(1, None, 1)).is_ok());+ assert!(trie_root.add(TrieNode::new(1, None, 1)).is_err());+ assert!(trie_root.add(TrieNode::new(1, None, 10)).is_err());- assert!(trie_root.add(TrieNode::new(2, 1)).is_ok());- assert!(trie_root.add(TrieNode::new(3, 2)).is_ok());+ assert!(trie_root.add(TrieNode::new(2, None, 1)).is_ok());+ assert!(trie_root.add(TrieNode::new(3, None, 2)).is_ok());let mid_b = trie_root.get_mut(2).unwrap();- assert!(mid_b.add(TrieNode::new(10, 15)).is_ok());+ assert!(mid_b.add(TrieNode::new(10, None, 15)).is_ok());let mid_c = trie_root.get_mut(3).unwrap();- assert!(mid_c.add(TrieNode::new(20, 25)).is_ok());- assert!(mid_c.add(TrieNode::new(21, 26)).is_ok());+ assert!(mid_c.add(TrieNode::new(20, None, 25)).is_ok());+ assert!(mid_c.add(TrieNode::new(21, None, 26)).is_ok());verify_tree(&trie_root)}