commit be83f288a54f01d3e4c99db7005d6261ae83d839 Author: titor Date: Fri Apr 24 03:32:44 2026 +0800 feat: 初始化 Mimo-TTS CLI 工具 - 实现文本转语音功能(支持多种音色) - 支持流式输出(--stream)和直接播放(--play) - 实现自动语气转换器(根据标点自动添加语气标签) - 使用 crossterm 美化 CLI 输出 - 配置分层设计(项目配置 + 用户配置) - 独立模块划分:api.rs, cli.rs, config.rs, tone.rs, ui.rs v0.1.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aed7737 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +/target +.wav + +.ini +.DS_Store + +.vs/ +.code/ +.fleet/ +.cursor/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..850bc8d --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2998 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "alsa" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7572b7ba83a31e20d1b48970ee402d2e3e0537dcfe0a3ff4d6eb7508617d43" +dependencies = [ + "alsa-sys", + "bitflags 2.11.1", + "cfg-if", + "libc", +] + +[[package]] +name = "alsa-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bindgen" +version = "0.72.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" +dependencies = [ + "bitflags 2.11.1", + "cexpr", + "clang-sys", + "itertools 0.13.0", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cassowary" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cc" +version = "1.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[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.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "claxon" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bfbf56724aa9eca8afa4fcfadeb479e722935bb2a0900c2d37e0cc477af0688" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "compact_str" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "ryu", + "static_assertions", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "coreaudio-rs" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace" +dependencies = [ + "bitflags 1.3.2", + "core-foundation-sys", + "coreaudio-sys", +] + +[[package]] +name = "coreaudio-sys" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceec7a6067e62d6f931a2baf6f3a751f4a892595bcec1461a3c94ef9949864b6" +dependencies = [ + "bindgen", +] + +[[package]] +name = "cpal" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "873dab07c8f743075e57f524c583985fbaf745602acbe916a01539364369a779" +dependencies = [ + "alsa", + "core-foundation-sys", + "coreaudio-rs", + "dasp_sample", + "jni", + "js-sys", + "libc", + "mach2", + "ndk", + "ndk-context", + "oboe", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows", +] + +[[package]] +name = "crossterm" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" +dependencies = [ + "bitflags 2.11.1", + "crossterm_winapi", + "libc", + "mio 0.8.11", + "parking_lot", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[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.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "h2" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "hound" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f" + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[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", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "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", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[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 = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", + "serde", + "serde_core", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "iri-string" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +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 = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "lewton" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "777b48df9aaab155475a83a7df3070395ea1ac6902f5cd062b8f2b028075c030" +dependencies = [ + "byteorder", + "ogg", + "tinyvec", +] + +[[package]] +name = "libc" +version = "0.2.185" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "mach2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mimo-tts" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64", + "clap", + "crossterm", + "futures", + "home", + "ratatui", + "reqwest", + "rodio", + "serde", + "serde_json", + "tokio", + "tokio-util", + "toml", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "ndk" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" +dependencies = [ + "bitflags 2.11.1", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "thiserror", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.5.0+25.2.9519653" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "oboe" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8b61bebd49e5d43f5f8cc7ee2891c16e0f41ec7954d36bcb6c14c5e0de867fb" +dependencies = [ + "jni", + "ndk", + "ndk-context", + "num-derive", + "num-traits", + "oboe-sys", +] + +[[package]] +name = "oboe-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8bb09a4a2b1d668170cfe0a7d5bc103f8999fb316c98099b6a9939c9f2e79d" +dependencies = [ + "cc", +] + +[[package]] +name = "ogg" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6951b4e8bf21c8193da321bcce9c9dd2e13c858fe078bf9054a288b419ae5d6e" +dependencies = [ + "byteorder", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "openssl" +version = "0.10.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38c4372413cdaaf3cc79dd92d29d7d9f5ab09b51b10dded508fb90bb70b9222" +dependencies = [ + "bitflags 2.11.1", + "cfg-if", + "foreign-types", + "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", +] + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "openssl-sys" +version = "0.9.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13ce1245cd07fcc4cfdb438f7507b0c7e4f3849a69fd84d52374c66d83741bb6" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.11+spec-1.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "ratatui" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f44c9e68fd46eda15c646fbb85e1040b657a58cdc8c98db1d97a55930d991eef" +dependencies = [ + "bitflags 2.11.1", + "cassowary", + "compact_str", + "crossterm", + "itertools 0.12.1", + "lru", + "paste", + "stability", + "strum", + "unicode-segmentation", + "unicode-truncate", + "unicode-width", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.11.1", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "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.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rodio" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6006a627c1a38d37f3d3a85c6575418cfe34a5392d60a686d0071e1c8d427acb" +dependencies = [ + "claxon", + "cpal", + "hound", + "lewton", + "symphonia", + "thiserror", +] + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags 2.11.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c2c118cb077cca2822033836dfb1b975355dfb784b5e8da48f7b6c5db74e60e" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[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.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.11.1", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +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.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +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 = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" +dependencies = [ + "libc", + "mio 0.8.11", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stability" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "symphonia" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039" +dependencies = [ + "lazy_static", + "symphonia-bundle-mp3", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4872dd6bb56bf5eac799e3e957aa1981086c3e613b27e0ac23b176054f7c57ed" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-core" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea00cc4f79b7f6bb7ff87eddc065a1066f3a43fe1875979056672c9ef948c2af" +dependencies = [ + "arrayvec", + "bitflags 1.3.2", + "bytemuck", + "lazy_static", + "log", +] + +[[package]] +name = "symphonia-metadata" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36306ff42b9ffe6e5afc99d49e121e0bd62fe79b9db7b9681d48e29fa19e6b16" +dependencies = [ + "encoding_rs", + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +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 = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags 2.11.1", + "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.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.2", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[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", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.52.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6" +dependencies = [ + "bytes", + "libc", + "mio 1.2.0", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_write", + "winnow 0.7.15", +] + +[[package]] +name = "toml_edit" +version = "0.25.11+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" +dependencies = [ + "indexmap", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "winnow 1.0.2", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.2", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags 2.11.1", + "bytes", + "futures-util", + "http", + "http-body", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-segmentation" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" + +[[package]] +name = "unicode-truncate" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" +dependencies = [ + "itertools 0.13.0", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f371d383f2fb139252e0bfac3b81b265689bf45b6874af544ffa4c975ac1ebf8" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[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 = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.1", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +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.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result 0.1.2", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result 0.4.1", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee1708bef14716a11bae175f579062d4554d95be2c6829f518df847b7b3fdd0" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.1", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..b85237a --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "mimo-tts" +version = "0.1.0" +edition = "2021" + +[dependencies] +# CLI 参数解析库,使用 derive 模式简化命令行参数定义 +clap = { version = "4.5", features = ["derive"] } +# HTTP 客户端,用于调用 Mimo-TTS API +reqwest = { version = "0.12", features = ["json", "stream"] } +# 异步运行时,支持异步 API 调用 +tokio = { version = "1", features = ["full"] } +# 序列化/反序列化库,用于 JSON 和 TOML 处理 +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +# Base64 解码,用于解码 API 返回的音频数据 +base64 = "0.22" +# TOML 格式解析,用于配置文件 +toml = "0.8" +# 获取用户家目录(跨平台) +home = "0.5" +# 错误处理库,提供便捷的 Result 类型 +anyhow = "1.0" +# 音频播放库,支持从内存直接播放音频 +rodio = "0.19" +# TUI 框架,用于美化 CLI 输出和交互式界面 +ratatui = "0.26" +# 终端控制库,用于读取键盘输入和控制终端 +crossterm = "0.27" +# 流式处理库,用于 SSE 流式响应 +futures = "0.3" +# Tokio 工具库,提供 StreamReader +tokio-util = "0.7" diff --git a/agents.md b/agents.md new file mode 100644 index 0000000..6a889d0 --- /dev/null +++ b/agents.md @@ -0,0 +1,68 @@ +# 项目规范与 AI 规范 (agents.md) + +## 项目规范 + +### 代码风格 +- 使用 Rust 官方代码风格(rustfmt) +- 所有公开 API 必须包含中文文档注释(///) +- 复杂逻辑必须包含行内中文注释 +- 结构体、枚举、trait 使用 PascalCase 命名 +- 变量、函数使用 snake_case 命名 + +### 架构设计 +本项目采用 **面向对象 (OOP) + 设计模式** 架构: + +1. **Builder 模式**:用于构建复杂的 API 请求对象 +2. **Strategy 模式**:不同音色和音频格式的处理策略 +3. **Singleton 模式**:全局配置管理器(确保配置只加载一次) +4. **封装**:每个模块负责单一职责,通过 pub 控制可见性 + +### 错误处理 +- 使用 `anyhow::Result` 作为统一返回类型 +- 自定义错误类型(如需更精细控制) +- 退出码规范: + - 0: 成功 + - 1: 参数错误 + - 2: 配置错误(如缺少 API Key) + - 3: API 调用失败 + - 4: 文件操作失败 + +### 文档要求 +- 每次操作前必须更新对应文档 +- 代码变更同步更新 changelog.md +- 踩坑记录及时写入【认知修正】章节 + +--- + +## AI 规范 + +### 沟通语言 +- 全程使用中文与用户沟通 +- 代码注释使用中文 +- 文档使用中文编写 + +### 执行顺序 +每次执行任何操作前,按以下顺序更新文档: +1. 更新 `taolun.md` - 记录本次对话要点 +2. 更新 `agents.md` 的【认知修正】- 如有踩坑 +3. 更新 `changelog.md` - 如有版本变更 +4. 执行实际操作 + +--- + +## 认知修正(踩坑记录) + +### 2026-04-24 - 项目初始化 + +#### 问题:Mimo-TTS API 文档无法直接访问 +**现象**:使用 webfetch 工具访问 https://platform.xiaomimimo.com/docs/ 返回的内容不完整 +**原因**:网站可能有反爬虫机制或需要 JavaScript 渲染 +**解决方案**:通过 websearch 搜索相关内容,从第三方文档(如 DMXAPI、GitHub 项目)获取 API 详细信息 +**经验**:对于无法直接抓取的文档,可以通过搜索引擎找到镜像或第三方整理的资料 + +#### 问题:API 认证需要双 Header +**现象**:标准的 OpenAI SDK 方式(仅使用 Authorization Bearer)可能无法正常工作 +**原因**:Mimo-TTS API 要求同时提供 `api-key` 和 `Authorization: Bearer` 两个 Header +**解决方案**:在代码中同时设置两个 Header +**经验**:阅读 API 文档时要注意认证方式的特殊性,不能假设与标准 OpenAI API 完全一致 + diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..94c552e --- /dev/null +++ b/changelog.md @@ -0,0 +1,208 @@ +# 版本变更记录 (changelog.md) + +## [0.1.0] - 2026-04-24 + +### 新增 +- 初始化 Rust 项目结构(edition 2021) +- 配置 Cargo.toml 依赖(使用国内源,稀疏索引协议) +- 创建项目文档体系(taolun.md、changelog.md、agents.md) +- 实现配置管理模块 (config.rs) - Singleton 模式 + - 统一配置文件路径为 `~/.config/tts/config.toml`(所有平台) + - 使用 home 库获取家目录 +- 实现 API 调用模块 (api.rs) - Builder 模式 + - TtsClient 结构体封装 API 调用 + - 支持双 Header 认证(api-key + Authorization) + - Base64 解码音频数据 +- 实现 CLI 模块 (cli.rs) - clap derive 模式 + - 添加 Onboard 子命令(引导式配置) + - 添加 Voices、Config、ShowConfig 子命令 +- 实现主程序入口 (main.rs) + - 异步主函数(tokio) + - 错误处理和退出码规范(0-4) + - 支持从文本或文件输入 +- 创建 `project.config.toml` 管理项目版本 +- Release 版本构建成功(无警告) +- 语音合成功能测试成功 + +### 技术栈 +- Rust (edition 2021) +- clap 4.6 (CLI 参数解析) +- reqwest 0.12 (HTTP 客户端) +- tokio 1.52 (异步运行时) +- serde + serde_json (序列化) +- toml (配置文件) +- base64 0.22 (音频解码) +- home 0.5 (跨平台家目录获取) +- anyhow 1.0 (错误处理) + +### 功能列表 +- ✅ 文本转语音(TTS) +- ✅ 支持多种音色(default_zh, default_en, mimo_default) +- ✅ 配置文件管理(~/.config/tts/config.toml) +- ✅ CLI 引导式配置(onboard 命令) +- ✅ 列出可用音色(voices 命令) +- ✅ 配置管理(config set/show 命令) +- ✅ WAV 音频输出 + +--- + +## 版本规范 +遵循 [语义化版本 2.0.0](https://semver.org/lang/zh-CN/): +- 主版本号:不兼容的 API 修改 +- 次版本号:向下兼容的功能性新增 +- 修订号:向下兼容的问题修正 + +### 修改(第三轮 - 流式输出) +- 修改 `synthesize()` 返回音频数据而非保存文件 +- 支持输出到 stdout(二进制流) +- 保留 `--output` 参数用于保存到文件 +- 输出到 stdout 时自动抑制提示信息 +- 便于作为 claw skill 集成 + + +### 修改(第四轮 - 音频播放) +- 添加 rodio 0.19 依赖(音频播放库) +- 添加 --play 参数(直接播放音频) +- 修改 synthesize() 返回音频数据 +- 新增 play_audio() 函数(使用 rodio 播放) +- 支持三种输出方式:播放/保存/流式输出 +- --play 和 --output 互斥 + +## [0.1.0] 最终状态 + +### 新增功能(第四轮) +- 添加 rodio 0.19 音频播放库 +- 新增 --play 参数:直接播放音频(单次播放,不循环) +- synthesize() 函数改为返回音频数据 Vec +- 新增 play_audio() 函数:使用 rodio 从内存播放 WAV + +### 修改(第四轮) +- 修改 Cargo.toml:添加 rodio 依赖 +- 修改 cli.rs:添加 --play 参数(与 --output 互斥) +- 修改 main.rs: + - synthesize() 返回 Result> + - 添加 play_audio() 函数 + - run() 支持三种输出方式 + +### 修复(第四轮) +- 修复 synthesize() 重复代码问题 +- 修复 stdout 输出被 println 污染的问题 +- 移除未使用的导入警告 + +### 功能列表(最终) +- ✅ 文本转语音(TTS) +- ✅ 支持多种音色(default_zh, default_en, mimo_default) +- ✅ 配置文件管理(~/.config/tts/config.toml) +- ✅ CLI 引导式配置(onboard 命令) +- ✅ 列出可用音色(voices 命令) +- ✅ 配置管理(config set/show 命令) +- ✅ 直接播放音频(--play 参数) +- ✅ 保存文件(--output 参数) +- ✅ 流式输出(stdout 二进制流) +- ✅ WAV 音频输出 + +### 修改(第五轮 - 音色扩展) +- 更新音色列表为 Mimo-TTS 完整列表(8个音色) +- 默认音色从 default_zh 改为 mimo_default +- 添加音色验证(无效时使用 mimo_default) +- 更新 list_voices() 显示详细音色信息 +- 废弃 default_zh 和 default_en + +### 修改(第六轮 - UI 主题化) +- 新增 ratatui 0.26 + crossterm 0.27 依赖 +- 新建 src/ui.rs 模块(主题、组件) +- 美化所有 CLI 输出(voices、config、onboard 等) +- 重写 onboard() 为交互式表单页面 +- 支持 API Key 隐藏输入(显示 *) +- 所有命令输出统一主题风格 +- 使用 crossterm 实现彩色输出(未使用完整 ratatui Terminal) + +### 实施完成(第六轮) +1. ✅ 创建 src/ui.rs 模块(使用 crossterm 美化输出) +2. ✅ 修改 main.rs 引入 ui 模块 +3. ✅ 美化 list_voices() 输出(彩色表格) +4. ✅ 美化 show_config() 输出(彩色标签) +5. ✅ 重写 onboard() 为交互式表单(支持密码隐藏输入) +6. ✅ 美化播放和保存完成消息 +7. ✅ Release 构建成功(仅有未使用代码警告) +8. ✅ 功能测试通过(voices、show-config) + +## [0.2.0] - 开发中 + +### 新增(第十轮 - 自动语气转换器) +- ✅ 创建 `src/tone.rs` 独立模块(高内聚低耦合) +- ✅ 实现 `apply_tone()` 函数(自动语气转换) +- ✅ 实现 `insert_mid_tone()` 函数(细粒度控制) +- ✅ 实现 `analyze_tone()` 函数(分析语气) +- ✅ 实现 `has_tone_tag()` 函数(检测已有标签) +- ✅ 默认启用,无需额外参数 +- ✅ 支持整体风格标签 `[语气]` +- ✅ 支持细粒度控制标签 `(描述)` + +### 修改(第十轮) +- 修改 main.rs:引入 tone 模块 +- 修改 main.rs:在 synthesize() 中调用语气转换 + +### 语气映射规则 +- `!` → [激动] + !(激动) +- `?` → [疑惑] + ?(疑惑) +- `。` → [平静] + 。(停顿) +- `……` → ……(拖长音) +- 多种标点 → 组合标签如 [激动 疑惑] + +### 技术细节 +- 使用 `[语气]` 格式添加整体风格 +- 使用 `(描述)` 格式添加细粒度控制 +- 符合 Mimo-TTS 音频标签控制规范 +- 检测已有标签,避免重复添加 +- 4 个单元测试全部通过 + +## [0.2.0] - 开发中 + +### 新增(第九轮 - 流式输出完成) +- ✅ 实现 `--stream` 参数功能(流式 API 调用) +- ✅ 使用 SSE(Server-Sent Events)处理流式响应 +- ✅ 流式输出时自动使用 pcm16 格式 +- ✅ 支持流式输出到 stdout 或保存到文件 +- ✅ 修改 api.rs 添加流式请求方法 +- ✅ 使用 futures::StreamExt 处理字节流 +- ✅ 流式 API 返回原始 PCM16 数据(无 WAV 头) +- ✅ 支持 `--stream` 和 `--play` 同时使用 +- ✅ 新增 pcm16_to_wav() 函数(自动封装 WAV 头) + +### 修改(第九轮) +- 修改 Cargo.toml:添加 futures、tokio-util 依赖 +- 为 reqwest 添加 stream feature +- 修改 main.rs:synthesize() 支持 stream 参数 +- 修改 main.rs:支持流式数据播放(PCM16 → WAV) +- 修改 api.rs:修复 read_stream_response 实现 + +### 修复(第九轮) +- 修复 StreamReader 编译错误(改用 futures::StreamExt) +- 修复 reqwest stream feature 缺失问题 +- 修复播放时未识别 PCM16 格式问题 + +### 技术细节 +- PCM16 转 WAV:24000Hz, 16bit, 单声道 +- WAV 头 44 字节,包含必要的格式信息 +- 流式播放时自动添加 WAV 头再播放 + +### 新增(第七轮 - 配置分层设计) +- 实现分层配置设计: + - `project.config.toml` - 项目默认配置(base_url、default_format) + - `~/.config/tts/config.toml` - 用户配置(api_key、default_voice) +- 用户配置覆盖项目默认配置中的对应项 +- 临时文件生成在当前目录(不允许离开当前目录) + +### 修改(第七轮) +- 重写 `config.rs` 实现分层配置加载 +- 修改 `cli.rs` 移除 base_url 参数 +- 修改 `ui.rs` 简化显示和表单(只处理 api_key 和 default_voice) +- 修改 `main.rs` 使用新的配置结构 +- 更新 `project.config.toml` 添加 base_url 和 default_format + +### 修复(第七轮) +- 修复默认音色未生效问题(config.rs 默认值改为 mimo_default) +- 修复配置文件只保存用户配置项 + +## [0.1.0] - 2026-04-24 diff --git a/project.config.toml b/project.config.toml new file mode 100644 index 0000000..b46d222 --- /dev/null +++ b/project.config.toml @@ -0,0 +1,7 @@ +# 项目配置文件 +# 版本号必须与 git tag 保持一致 +# 这是项目的默认配置,用户配置会覆盖这些默认值 + +version = "0.1.0" +base_url = "https://api.xiaomimimo.com/v1/chat/completions" +default_format = "wav" diff --git a/src/api.rs b/src/api.rs new file mode 100644 index 0000000..0cc5489 --- /dev/null +++ b/src/api.rs @@ -0,0 +1,439 @@ +/// API 调用模块 +/// +/// 负责与 Mimo-TTS API 进行通信 +/// 使用 Builder 模式构建复杂的 API 请求 +/// 使用 reqwest 作为 HTTP 客户端 + +use anyhow::{Context, Result}; +use base64::{engine::general_purpose, Engine as _}; +use futures::StreamExt; +use reqwest::header::{self, HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; +use std::time::Duration; + +/// TTS 客户端结构体 +/// +/// 封装 API 调用所需的配置和 HTTP 客户端 +pub struct TtsClient { + /// API 基础 URL + base_url: String, + /// API 密钥 + api_key: String, + /// HTTP 客户端实例 + client: reqwest::Client, +} + +impl TtsClient { + /// 创建新的 TTS 客户端构建器 + /// + /// 使用 Builder 模式构建客户端实例 + pub fn builder() -> TtsClientBuilder { + TtsClientBuilder::new() + } + + /// 合成语音(使用预构建的请求对象) + /// + /// # 参数 + /// - request: 预构建的 TtsRequest 对象 + /// + /// # 返回 + /// 返回音频数据(字节数组) + pub async fn synthesize_with_request( + &self, + request: &TtsRequest, + ) -> Result> { + // 构建请求 Header + let mut headers = HeaderMap::new(); + headers.insert( + "api-key", + HeaderValue::from_str(&self.api_key) + .context("无效的 API Key 格式")?, + ); + headers.insert( + header::AUTHORIZATION, + HeaderValue::from_str(&format!("Bearer {}", self.api_key)) + .context("无效的 Authorization 格式")?, + ); + headers.insert( + header::CONTENT_TYPE, + HeaderValue::from_static("application/json"), + ); + + // 如果是流式请求,添加 Accept 头 + if request.stream.unwrap_or(false) { + headers.insert( + header::ACCEPT, + HeaderValue::from_static("text/event-stream"), + ); + } + + // 发送 POST 请求 + let response = self + .client + .post(&self.base_url) + .headers(headers) + .json(request) + .send() + .await + .context("API 请求失败")?; + + // 检查响应状态 + if !response.status().is_success() { + let status = response.status(); + let error_text = response + .text() + .await + .unwrap_or_else(|_| "无法读取错误信息".to_string()); + return Err(anyhow::anyhow!( + "API 返回错误: {} - {}", + status, + error_text + )); + } + + // 如果是流式响应,读取流 + if request.stream.unwrap_or(false) { + Self::read_stream_response(response).await + } else { + // 非流式响应,解析 JSON + let response_body: TtsResponse = response + .json() + .await + .context("无法解析 API 响应")?; + + // 提取 Base64 编码的音频数据 + let audio_data = response_body + .choices + .first() + .ok_or_else(|| anyhow::anyhow!("响应中没有选择项"))? + .message + .audio + .as_ref() + .ok_or_else(|| anyhow::anyhow!("响应中没有音频数据"))? + .data + .clone(); + + // Base64 解码 + let audio_bytes = general_purpose::STANDARD + .decode(&audio_data) + .context("Base64 解码失败")?; + + Ok(audio_bytes) + } + } + + /// 读取流式响应 + /// + /// 假设响应是 SSE 格式,每个事件包含 Base64 编码的音频块 + async fn read_stream_response(response: reqwest::Response) -> Result> { + use futures::StreamExt; + + let mut stream = response.bytes_stream(); + let mut audio_data = Vec::new(); + let mut buffer = String::new(); + + while let Some(item) = stream.next().await { + let chunk = item.context("读取流式响应块失败")?; + let text = String::from_utf8_lossy(&chunk); + + // 处理 SSE 格式:按行分割 + for line in text.lines() { + let line = line.trim(); + if line.starts_with("data: ") { + let data_str = &line[6..]; // 跳过 "data: " + if data_str == "[DONE]" { + return Ok(audio_data); + } + // 尝试解析 JSON + if let Ok(event) = serde_json::from_str::(data_str) { + if let Some(audio_b64) = event.audio { + if let Ok(bytes) = general_purpose::STANDARD.decode(&audio_b64) { + audio_data.extend_from_slice(&bytes); + } + } + } + } + } + } + + Ok(audio_data) + } + + /// 合成语音(简化版) + /// + /// # 参数 + /// - text: 要合成的文本 + /// - voice: 音色名称 + /// - format: 音频格式 + /// - stream: 是否流式 + /// + /// # 返回 + /// 返回合成的音频数据 + pub async fn synthesize( + &self, + text: &str, + voice: &str, + format: &str, + stream: bool, + ) -> Result> { + // 构建请求体 + let mut builder = TtsRequest::builder() + .model("mimo-v2.5-tts".to_string()) + .add_message(Message { + role: "user".to_string(), + content: "请合成下面的文本".to_string(), + }) + .add_message(Message { + role: "assistant".to_string(), + content: text.to_string(), + }) + .audio(AudioConfig { + format: if stream { "pcm16".to_string() } else { format.to_string() }, + voice: voice.to_string(), + }); + + if stream { + builder = builder.stream(true); + } + + let request = builder.build(); + self.synthesize_with_request(&request).await + } +} + +/// SSE 事件结构体(用于解析流式响应) +#[derive(Debug, Deserialize)] +struct SseEvent { + #[serde(rename = "type", default)] + event_type: Option, + audio: Option, +} + +/// TTS 请求结构体 +/// +/// 遵循 OpenAI Chat Completions API 格式 +#[derive(Debug, Serialize)] +pub struct TtsRequest { + /// 模型名称 + model: String, + /// 消息列表 + messages: Vec, + /// 音频配置 + audio: AudioConfig, + /// 是否流式输出 + #[serde(skip_serializing_if = "Option::is_none")] + stream: Option, +} + +impl TtsRequest { + /// 创建请求构建器 + pub fn builder() -> TtsRequestBuilder { + TtsRequestBuilder::new() + } +} + +/// TTS 请求构建器(Builder 模式) +pub struct TtsRequestBuilder { + model: Option, + messages: Vec, + audio: Option, + stream: Option, +} + +impl TtsRequestBuilder { + pub fn new() -> Self { + Self { + model: None, + messages: Vec::new(), + audio: None, + stream: None, + } + } + + /// 设置模型名称 + pub fn model(mut self, model: String) -> Self { + self.model = Some(model); + self + } + + /// 添加消息 + pub fn add_message(mut self, message: Message) -> Self { + self.messages.push(message); + self + } + + /// 设置音频配置 + pub fn audio(mut self, audio: AudioConfig) -> Self { + self.audio = Some(audio); + self + } + + /// 设置流式输出 + pub fn stream(mut self, stream: bool) -> Self { + self.stream = Some(stream); + self + } + + /// 构建最终请求对象 + pub fn build(self) -> TtsRequest { + TtsRequest { + model: self.model.unwrap_or_else(|| "mimo-v2.5-tts".to_string()), + messages: self.messages, + audio: self.audio.unwrap_or_else(|| AudioConfig { + format: "wav".to_string(), + voice: "mimo_default".to_string(), + }), + stream: self.stream, + } + } +} + +/// 消息结构体 +/// +/// 表示对话中的一条消息 +#[derive(Debug, Serialize, Clone)] +pub struct Message { + /// 角色:user 或 assistant + pub role: String, + /// 消息内容 + pub content: String, +} + +/// 音频配置结构体 +/// +/// 指定合成语音的格式和音色 +#[derive(Debug, Serialize, Clone)] +pub struct AudioConfig { + /// 音频格式(当前支持 wav、mp3、pcm16) + pub format: String, + /// 音色名称(如 mimo_default、茉莉等) + pub voice: String, +} + +/// TTS API 响应结构体 +#[derive(Debug, Deserialize)] +pub struct TtsResponse { + /// 选择项列表 + pub choices: Vec, +} + +/// 选择项结构体 +#[derive(Debug, Deserialize)] +pub struct Choice { + /// 消息 + pub message: ResponseMessage, +} + +/// 响应消息结构体 +#[derive(Debug, Deserialize)] +pub struct ResponseMessage { + /// 音频数据(可选) + pub audio: Option, +} + +/// 音频数据结构体 +#[derive(Debug, Deserialize)] +pub struct AudioData { + /// Base64 编码的音频数据 + pub data: String, +} + +/// TTS 客户端构建器(Builder 模式) +/// +/// 用于逐步构建 TtsClient 实例 +pub struct TtsClientBuilder { + base_url: Option, + api_key: Option, + timeout: Option, +} + +impl TtsClientBuilder { + /// 创建新的构建器实例 + pub fn new() -> Self { + Self { + base_url: None, + api_key: None, + timeout: None, + } + } + + /// 设置 API 基础 URL + pub fn base_url(mut self, url: String) -> Self { + self.base_url = Some(url); + self + } + + /// 设置 API 密钥 + pub fn api_key(mut self, key: String) -> Self { + self.api_key = Some(key); + self + } + + /// 设置请求超时时间 + #[allow(dead_code)] + pub fn timeout(mut self, duration: Duration) -> Self { + self.timeout = Some(duration); + self + } + + /// 构建 TtsClient 实例 + /// + /// 必须提供 base_url 和 api_key,否则返回错误 + pub fn build(self) -> Result { + let base_url = self + .base_url + .ok_or_else(|| anyhow::anyhow!("未设置 base_url"))?; + let api_key = self + .api_key + .ok_or_else(|| anyhow::anyhow!("未设置 api_key"))?; + + let mut client_builder = reqwest::Client::builder(); + if let Some(timeout) = self.timeout { + client_builder = client_builder.timeout(timeout); + } + + let client = client_builder + .build() + .context("无法创建 HTTP 客户端")?; + + Ok(TtsClient { + base_url, + api_key, + client, + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_request_builder() { + let request = TtsRequest::builder() + .model("mimo-v2.5-tts".to_string()) + .add_message(Message { + role: "assistant".to_string(), + content: "你好".to_string(), + }) + .audio(AudioConfig { + format: "wav".to_string(), + voice: "mimo_default".to_string(), + }) + .build(); + + assert_eq!(request.model, "mimo-v2.5-tts"); + assert_eq!(request.messages.len(), 1); + assert_eq!(request.audio.voice, "mimo_default"); + } + + #[tokio::test] + async fn test_client_builder() { + let result = TtsClient::builder() + .base_url("https://api.example.com".to_string()) + .api_key("test-key".to_string()) + .build(); + + assert!(result.is_ok()); + } +} diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..85873c8 --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,96 @@ +/// CLI 参数定义模块 +/// +/// 使用 clap derive 模式定义命令行参数 +/// 支持子命令和全局选项 + +use clap::{Parser, Subcommand}; + +/// MiMo TTS - 基于 Mimo-TTS API 的文本转语音工具 +/// +/// 支持多种音色和格式的语音合成,配置文件位于 ~/.config/tts/config.toml +#[derive(Parser, Debug)] +#[command( + name = "mimo-tts", + version, + about = "MiMo TTS - 基于 Mimo-TTS API 的文本转语音工具", + long_about = None +)] +pub struct Cli { + /// 子命令(可选) + #[command(subcommand)] + pub command: Option, + + /// 要合成的文本(与 --file 互斥) + #[arg(short, long, group = "input")] + pub text: Option, + + /// 从文件读取要合成的文本(与 --text 互斥) + #[arg(short, long, group = "input", value_parser)] + pub file: Option, + + /// 音色名称(默认:mimo_default) + #[arg(short, long, default_value = "mimo_default")] + pub voice: String, + + /// 风格描述(如:开心、东北话、孙悟空、唱歌等) + #[arg(long)] + pub style: Option, + + /// 输出文件路径(与 --play 互斥) + #[arg(short, long)] + pub output: Option, + + /// 音频格式(当前固定为 wav) + #[arg(long, default_value = "wav")] + pub format: String, + + /// 直接播放音频(不保存文件,不输出到 stdout) + #[arg(long)] + pub play: bool, + + /// 使用流式输出(格式自动改为 pcm16) + #[arg(long)] + pub stream: bool, +} + +/// 子命令枚举 +/// +/// 定义程序支持的子命令 +#[derive(Subcommand, Debug)] +pub enum Commands { + /// 列出所有可用的音色 + Voices, + + /// 配置管理 + Config { + #[command(subcommand)] + action: ConfigAction, + }, + + /// 显示当前配置 + ShowConfig, + + /// 初始化配置(引导式设置) + Onboard, +} + +/// 配置管理子命令 +#[derive(Subcommand, Debug)] +pub enum ConfigAction { + /// 设置配置项 + Set { + /// 设置 API Key + #[arg(long)] + api_key: Option, + + /// 设置默认音色 + #[arg(long)] + voice: Option, + }, + + /// 显示当前配置 + Show, + + /// 初始化配置文件(交互式) + Init, +} diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..73e4d78 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,224 @@ +/// 配置管理模块 +/// +/// 采用分层配置设计: +/// 1. project.config.toml - 项目默认配置(base_url、default_format) +/// 2. ~/.config/tts/config.toml - 用户配置(api_key、default_voice) +/// 用户配置会覆盖项目默认配置中的对应项 + +use anyhow::{Context, Result}; +use home::home_dir; +use serde::{Deserialize, Serialize}; +use std::fs; +use std::path::PathBuf; + +/// 项目配置(从项目根目录的 project.config.toml 读取) +/// +/// 这是项目的默认配置,包含 API 地址和默认格式 +#[derive(Debug, Deserialize, Clone)] +pub struct ProjectConfig { + /// 项目版本号 + pub version: String, + /// API 基础 URL 地址 + #[serde(default = "default_base_url")] + pub base_url: String, + /// 默认音频格式 + #[serde(default = "default_format")] + pub default_format: String, +} + +impl Default for ProjectConfig { + fn default() -> Self { + Self { + version: "0.1.0".to_string(), + base_url: default_base_url(), + default_format: default_format(), + } + } +} + +/// 用户配置(从 ~/.config/tts/config.toml 读取) +/// +/// 只包含用户需要设置的项,会覆盖项目默认配置中的对应项 +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct UserConfig { + /// Mimo-TTS API 密钥 + pub api_key: String, + /// 默认音色 + #[serde(default = "default_voice")] + pub default_voice: String, +} + +impl Default for UserConfig { + fn default() -> Self { + Self { + api_key: String::new(), + default_voice: default_voice(), + } + } +} + +/// 合并后的应用配置 +/// +/// 结合了项目默认配置和用户配置 +#[derive(Debug, Clone)] +pub struct Config { + /// Mimo-TTS API 密钥(来自用户配置) + pub api_key: String, + /// 默认音色(来自用户配置,覆盖项目默认值) + pub default_voice: String, + /// API 基础 URL 地址(来自项目配置) + pub base_url: String, + /// 默认音频格式(来自项目配置) + pub default_format: String, +} + +impl Config { + /// 从项目配置和用户配置创建合并配置 + pub fn from_configs(project: ProjectConfig, user: UserConfig) -> Self { + Self { + api_key: user.api_key, + default_voice: user.default_voice, + base_url: project.base_url, + default_format: project.default_format, + } + } +} + +/// 返回默认的 API 基础 URL +fn default_base_url() -> String { + "https://api.xiaomimimo.com/v1/chat/completions".to_string() +} + +/// 返回默认的语音音色 +fn default_voice() -> String { + "mimo_default".to_string() +} + +/// 返回默认的音频格式 +fn default_format() -> String { + "wav".to_string() +} + +/// 配置管理器(Singleton 模式) +/// +/// 负责加载项目配置和用户配置,并合并为应用配置 +pub struct ConfigManager { + /// 合并后的配置 + config: Config, + /// 用户配置文件路径 + user_config_path: PathBuf, +} + +impl ConfigManager { + /// 创建配置管理器并加载配置 + pub fn new() -> Result { + // 1. 加载项目配置(从项目根目录的 project.config.toml) + let project_config = Self::load_project_config()?; + + // 2. 加载用户配置(从 ~/.config/tts/config.toml) + let (user_config, user_config_path) = Self::load_user_config()?; + + // 3. 合并配置 + let config = Config::from_configs(project_config, user_config); + + Ok(Self { + config, + user_config_path, + }) + } + + /// 加载项目配置 + fn load_project_config() -> Result { + let project_config_path = std::env::current_dir() + .context("无法获取当前目录")? + .join("project.config.toml"); + + if project_config_path.exists() { + let content = fs::read_to_string(&project_config_path) + .with_context(|| format!("无法读取项目配置文件: {:?}", project_config_path))?; + let config: ProjectConfig = toml::from_str(&content) + .with_context(|| format!("无法解析项目配置文件: {:?}", project_config_path))?; + Ok(config) + } else { + // 如果项目配置文件不存在,使用默认配置 + Ok(ProjectConfig::default()) + } + } + + /// 加载用户配置 + fn load_user_config() -> Result<(UserConfig, PathBuf)> { + // 所有平台统一使用 ~/.config/tts/config.toml + let home = home_dir().ok_or_else(|| anyhow::anyhow!("无法获取用户家目录"))?; + let config_dir = home.join(".config").join("tts"); + let config_path = config_dir.join("config.toml"); + + // 确保配置目录存在 + fs::create_dir_all(&config_dir) + .with_context(|| format!("无法创建配置目录: {:?}", config_dir))?; + + let config = if config_path.exists() { + let content = fs::read_to_string(&config_path) + .with_context(|| format!("无法读取用户配置文件: {:?}", config_path))?; + let config: UserConfig = toml::from_str(&content) + .with_context(|| format!("无法解析用户配置文件: {:?}", config_path))?; + config + } else { + UserConfig::default() + }; + + Ok((config, config_path)) + } + + /// 获取合并后的配置引用 + pub fn get_config(&self) -> &Config { + &self.config + } + + /// 更新 API Key + pub fn set_api_key(&mut self, api_key: String) { + self.config.api_key = api_key; + } + + /// 更新默认音色 + pub fn set_default_voice(&mut self, voice: String) { + self.config.default_voice = voice; + } + + /// 获取用户配置文件路径 + pub fn get_config_path(&self) -> &PathBuf { + &self.user_config_path + } + + /// 保存用户配置到文件 + /// + /// 只保存用户配置项(api_key、default_voice) + pub fn save(&self) -> Result<()> { + let user_config = UserConfig { + api_key: self.config.api_key.clone(), + default_voice: self.config.default_voice.clone(), + }; + + let content = toml::to_string_pretty(&user_config) + .context("无法序列化用户配置")?; + + fs::write(&self.user_config_path, content) + .with_context(|| format!("无法写入用户配置文件: {:?}", self.user_config_path))?; + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_default_voice() { + assert_eq!(default_voice(), "mimo_default"); + } + + #[test] + fn test_default_base_url() { + assert_eq!(default_base_url(), "https://api.xiaomimimo.com/v1/chat/completions"); + } +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..d5489cc --- /dev/null +++ b/src/main.rs @@ -0,0 +1,447 @@ +mod cli; +mod config; +mod api; +mod ui; +mod tone; + +use anyhow::{Context, Result}; +use clap::Parser; +use cli::{Cli, Commands, ConfigAction}; +use config::ConfigManager; +use rodio; +use std::fs; +use std::io::Read; +use std::process; + +/// 程序退出码定义 +/// +/// 遵循 agents.md 中定义的退出码规范 +#[derive(Debug)] +enum ExitCode { + Success = 0, + ArgumentError = 1, + ConfigError = 2, + ApiError = 3, + FileError = 4, +} + +impl From for i32 { + fn from(code: ExitCode) -> Self { + code as i32 + } +} + +/// 主函数 +/// +/// 使用 tokio 运行时处理异步 API 调用 +#[tokio::main] +async fn main() { + // 解析命令行参数 + let cli = Cli::parse(); + + // 执行程序逻辑,如果出错则处理错误并返回对应退出码 + let exit_code = match run(cli).await { + Ok(_) => ExitCode::Success, + Err(e) => { + // 根据错误类型返回对应的退出码 + eprintln!("错误: {:#}", e); + + // 简化错误处理,根据错误信息判断类型 + let error_msg = e.to_string(); + if error_msg.contains("API") || error_msg.contains("请求") { + ExitCode::ApiError + } else if error_msg.contains("配置") { + ExitCode::ConfigError + } else if error_msg.contains("文件") || error_msg.contains("读取") || error_msg.contains("写入") { + ExitCode::FileError + } else { + ExitCode::ArgumentError + } + } + }; + + process::exit(exit_code.into()); +} + +/// 程序主逻辑 +async fn run(cli: Cli) -> Result<()> { + match cli.command { + // 处理子命令 + Some(Commands::Voices) => { + list_voices(); + Ok(()) + } + Some(Commands::ShowConfig) => { + show_config() + } + Some(Commands::Config { action }) => { + handle_config_command(action) + } + Some(Commands::Onboard) => { + // 引导式配置初始化 + onboard().await + } + // 没有子命令时,执行语音合成 + None => { + // 检查参数组合 + if cli.play && cli.output.is_some() { + return Err(anyhow::anyhow!("--play 和 --output 不能同时使用")); + } + + // 检查是否有输入(text 或 file) + if cli.text.is_none() && cli.file.is_none() { + return Err(anyhow::anyhow!( + "必须提供 --text 或 --file 参数\n使用 --help 查看帮助信息" + )); + } + + // 执行语音合成 + let audio_data = synthesize( + cli.text, + cli.file, + &cli.voice, + &cli.format, + cli.style.as_deref(), + cli.stream, + ) + .await?; + + // 根据参数决定处理方式 + if cli.play { + // 播放音频(流式数据需要封装成 WAV 格式) + ui::show_playback_start(); + if cli.stream { + // 流式返回的是 PCM16 原始数据,需要添加 WAV 头 + let wav_data = pcm16_to_wav(&audio_data); + play_audio(&wav_data)?; + } else { + play_audio(&audio_data)?; + } + ui::show_playback_complete(); + } else if let Some(output_path) = cli.output { + // 保存到文件 + fs::write(&output_path, &audio_data) + .with_context(|| format!("无法写入文件: {:?}", output_path))?; + ui::show_save_complete(&output_path.to_string_lossy()); + } else { + // 输出到 stdout(二进制流) + let stdout = std::io::stdout(); + let mut handle = stdout.lock(); + use std::io::Write; + handle.write_all(&audio_data) + .context("无法写入标准输出")?; + handle.flush() + .context("无法刷新标准输出")?; + } + + Ok(()) + } + } +} + +/// 列出所有可用的音色 +/// +/// 显示详细的音色信息,包括 Voice ID、语言、性别 +fn list_voices() { + ui::show_voices(); +} + +/// 合法的音色列表(mimo-v2.5-tts 支持) +const VALID_VOICES: &[&str] = &[ + "mimo_default", + "冰糖", + "茉莉", + "苏打", + "白桦", + "Mia", + "Chloe", + "Milo", + "Dean", +]; + +/// 验证音色是否合法 +/// +/// 如果音色不在合法列表中,输出警告并使用默认音色 mimo_default +fn validate_voice(voice: &str) -> String { + if VALID_VOICES.contains(&voice) { + voice.to_string() + } else { + eprintln!("警告:无效音色 '{}',使用默认音色 'mimo_default'", voice); + "mimo_default".to_string() + } +} + +/// 显示当前配置 +fn show_config() -> Result<()> { + let config_manager = ConfigManager::new() + .context("无法加载配置")?; + let config = config_manager.get_config(); + + ui::show_config( + &config.api_key, + &config.default_voice, + &config_manager.get_config_path().to_string_lossy(), + ); + + Ok(()) +} + +/// 处理配置相关子命令 +fn handle_config_command(action: ConfigAction) -> Result<()> { + match action { + ConfigAction::Set { api_key, voice, .. } => { + let mut config_manager = ConfigManager::new() + .context("无法加载配置")?; + + if let Some(key) = api_key { + config_manager.set_api_key(key); + ui::show_success("API Key 已更新"); + } + + if let Some(v) = voice { + config_manager.set_default_voice(v); + ui::show_success("默认音色已更新"); + } + + config_manager.save() + .context("无法保存配置")?; + + ui::show_info("📁 配置已保存到:", &config_manager.get_config_path().to_string_lossy()); + } + ConfigAction::Show => { + show_config()?; + } + ConfigAction::Init => { + // 交互式初始化 + ui::show_info("初始化配置...", ""); + let config_manager = ConfigManager::new() + .context("无法创建配置")?; + + ui::show_info("请使用以下命令设置 API Key:", ""); + println!(" mimo-tts config set --api-key "); + ui::show_info("配置文件将保存在:", &config_manager.get_config_path().to_string_lossy()); + } + } + + Ok(()) +} + +/// 引导式配置初始化 +/// +/// 交互式引导用户完成配置设置 +async fn onboard() -> Result<()> { + let config_manager = ConfigManager::new() + .context("无法创建配置管理器")?; + + let current_config = config_manager.get_config(); + + // 使用 UI 模块显示交互式表单 + let result = ui::show_onboard_form( + ¤t_config.api_key, + ¤t_config.default_voice, + ); + + let (api_key, default_voice) = result + .map_err(|e| anyhow::anyhow!("表单输入错误: {}", e))?; + + // 保存配置 + let mut config_manager = ConfigManager::new() + .context("无法创建配置管理器")?; + + if !api_key.is_empty() { + config_manager.set_api_key(api_key); + } + + if !default_voice.is_empty() { + config_manager.set_default_voice(default_voice); + } + + config_manager.save() + .context("无法保存配置")?; + + ui::show_info("📁 配置已保存到:", &config_manager.get_config_path().to_string_lossy()); + + Ok(()) +} + +/// 执行语音合成 +/// +/// # 参数 +/// - text: 直接提供的文本(可选) +/// - file: 文本文件路径(可选) +/// - voice: 音色名称 +/// - format: 音频格式 +/// - style: 风格描述(可选,会放在 user 消息中) +/// - stream: 是否使用流式输出 +/// +/// # 返回 +/// 返回合成的音频数据(WAV 或 PCM16 格式) +async fn synthesize( + text: Option, + file: Option, + voice: &str, + format: &str, + style: Option<&str>, + stream: bool, +) -> Result> { + // 获取要合成的文本 + let content = if let Some(t) = text { + tone::apply_tone(&t) + } else if let Some(f) = file { + // 从文件读取文本 + let mut file = fs::File::open(&f) + .with_context(|| format!("无法打开文件: {:?}", f))?; + let mut content = String::new(); + file.read_to_string(&mut content) + .with_context(|| format!("无法读取文件: {:?}", f))?; + tone::apply_tone(&content) + } else { + return Err(anyhow::anyhow!("没有提供文本内容")); + }; + + // 验证音色是否合法,不合法则使用默认值 + let validated_voice = validate_voice(voice); + + // 加载配置 + let config_manager = ConfigManager::new() + .context("无法加载配置")?; + let config = config_manager.get_config(); + + // 检查 API Key 是否设置 + if config.api_key.is_empty() { + return Err(anyhow::anyhow!( + "API Key 未设置\n请使用: mimo-tts config set --api-key " + )); + } + + // 创建 TTS 客户端 + let client = api::TtsClient::builder() + .base_url(config.base_url.clone()) + .api_key(config.api_key.clone()) + .build() + .context("无法创建 TTS 客户端")?; + + // 流式输出时自动使用 pcm16 格式 + let actual_format = if stream { "pcm16" } else { format }; + + // 构建请求(如果指定了风格,添加到 user 消息) + let mut builder = api::TtsRequest::builder() + .audio(api::AudioConfig { + format: actual_format.to_string(), + voice: validated_voice, + }); + + // 添加消息:如果指定了风格,先添加 user 消息描述风格 + if let Some(s) = style { + builder = builder.add_message(api::Message { + role: "user".to_string(), + content: s.to_string(), + }); + } + + // 添加 assistant 消息(实际要合成的文本) + builder = builder.add_message(api::Message { + role: "assistant".to_string(), + content: content.clone(), + }); + + let request = builder.build(); + + // 调用 API 合成语音 + let audio_data = if stream { + // 流式请求已在 api.rs 中处理 + client + .synthesize_with_request(&request) + .await + .context("流式语音合成失败")? + } else { + client + .synthesize_with_request(&request) + .await + .context("语音合成失败")? + }; + + Ok(audio_data) +} + +/// 单元测试模块 +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_exit_code() { + assert_eq!(i32::from(ExitCode::Success), 0); + assert_eq!(i32::from(ExitCode::ArgumentError), 1); + assert_eq!(i32::from(ExitCode::ConfigError), 2); + assert_eq!(i32::from(ExitCode::ApiError), 3); + assert_eq!(i32::from(ExitCode::FileError), 4); + } +} + +/// 播放音频数据 +/// +/// 使用 rodio 直接从内存播放 WAV 音频 +/// # 参数 +/// - data: WAV 格式的音频数据 +fn play_audio(data: &[u8]) -> Result<()> { + // 创建 rodio 音频输出流 + let (_stream, stream_handle) = rodio::OutputStream::try_default() + .context("无法创建音频输出流")?; + + // 从内存数据创建音频源 + let cursor = std::io::Cursor::new(data.to_vec()); + let source = rodio::Decoder::new(cursor) + .context("无法解码音频数据")?; + + // 创建播放器并播放(单次播放,不循环) + let sink = rodio::Sink::try_new(&stream_handle) + .context("无法创建音频播放器")?; + sink.append(source); + + // 等待播放完成 + sink.sleep_until_end(); + + Ok(()) +} + +/// 将 PCM16 原始数据转换为 WAV 格式 +/// +/// # 参数 +/// - pcm_data: PCM16 原始音频数据(16bit, 单声道, 24000Hz) +/// +/// # 返回 +/// 完整的 WAV 格式数据(包含 44 字节头部) +fn pcm16_to_wav(pcm_data: &[u8]) -> Vec { + let sample_rate: u32 = 24000; // Mimo-TTS PCM16 输出通常是 24kHz + let bits_per_sample: u16 = 16; + let channels: u16 = 1; + let byte_rate = sample_rate * channels as u32 * bits_per_sample as u32 / 8; + let block_align = channels * bits_per_sample / 8; + let data_size = pcm_data.len() as u32; + let file_size = 36 + data_size; + + let mut wav = Vec::with_capacity(44 + pcm_data.len()); + + // RIFF 头 + wav.extend_from_slice(b"RIFF"); + wav.extend_from_slice(&file_size.to_le_bytes()); + wav.extend_from_slice(b"WAVE"); + + // fmt 子块 + wav.extend_from_slice(b"fmt "); + wav.extend_from_slice(&16u32.to_le_bytes()); // PCM 格式大小 + wav.extend_from_slice(&1u16.to_le_bytes()); // PCM 格式 + wav.extend_from_slice(&channels.to_le_bytes()); + wav.extend_from_slice(&sample_rate.to_le_bytes()); + wav.extend_from_slice(&byte_rate.to_le_bytes()); + wav.extend_from_slice(&block_align.to_le_bytes()); + wav.extend_from_slice(&bits_per_sample.to_le_bytes()); + + // data 子块 + wav.extend_from_slice(b"data"); + wav.extend_from_slice(&data_size.to_le_bytes()); + wav.extend_from_slice(pcm_data); + + wav +} diff --git a/src/tone.rs b/src/tone.rs new file mode 100644 index 0000000..e84c353 --- /dev/null +++ b/src/tone.rs @@ -0,0 +1,147 @@ +/// 自动语气转换模块 +/// +/// 根据文本中的标点符号自动添加语气标签 +/// 符合 Mimo-TTS 音频标签控制规范 +/// 高内聚低耦合,可独立使用 + +/// 检测文本是否已包含风格标签 +/// +/// 支持的格式:[xxx]、(xxx)、(xxx) +pub fn has_tone_tag(text: &str) -> bool { + let trimmed = text.trim(); + trimmed.starts_with('[') + || trimmed.starts_with('(') + || trimmed.starts_with('(') +} + +/// 分析文本中的语气标签列表 +/// +/// # 参数 +/// - text: 要分析的文本 +/// +/// # 返回 +/// 返回检测到的语气标签列表 +pub fn analyze_tone(text: &str) -> Vec<&str> { + let mut tones = Vec::new(); + + let has_exclamation = text.contains('!') || text.contains('!'); + let has_question = text.contains('?') || text.contains('?'); + let has_period = text.contains('。') || text.contains('.'); + let has_ellipsis = text.contains("……") || text.contains("..."); + + if has_exclamation { + tones.push("激动"); + } + if has_question { + tones.push("疑惑"); + } + if has_ellipsis { + tones.push("拖长音"); + } + if tones.is_empty() && has_period { + tones.push("平静"); + } + if tones.is_empty() { + tones.push("平静"); + } + + tones +} + +/// 插入细粒度控制标签(在标点符号附近) +/// +/// # 参数 +/// - text: 原文本 +/// +/// # 返回 +/// 插入细粒度标签后的文本 +pub fn insert_mid_tone(text: &str) -> String { + let mut result = text.to_string(); + + // 处理感叹号 ! → !(激动) + result = result.replace("!", "!(激动)"); + result = result.replace("!", "!(激动)"); + + // 处理问号 ? → ?(疑惑) + result = result.replace("?", "?(疑惑)"); + result = result.replace("?", "?(疑惑)"); + + // 处理句号 。 → 。(停顿) + result = result.replace("。", "。(停顿)"); + result = result.replace(".", "。(停顿)"); + + // 处理省略号 …… → ……(拖长音) + result = result.replace("……", "……(拖长音)"); + result = result.replace("...", "……(拖长音)"); + + result +} + +/// 应用自动语气转换(主入口函数) +/// +/// 在文本开头添加整体风格标签,并在标点附近插入细粒度控制标签 +/// 如果文本已有标签,则不重复添加 +/// +/// # 参数 +/// - text: 要转换的文本 +/// +/// # 返回 +/// 带语气标签的文本 +pub fn apply_tone(text: &str) -> String { + // 检测是否已有标签,避免重复添加 + if has_tone_tag(text) { + // 已有标签,只添加细粒度控制 + return insert_mid_tone(text); + } + + // 分析整体语气 + let tones = analyze_tone(text); + let tone_label = tones.join(" "); + + // 先插入细粒度标签 + let mut result = insert_mid_tone(text); + + // 在文本开头添加整体风格标签 + result = format!("[{}]{}", tone_label, result); + + result +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_has_tone_tag() { + assert!(has_tone_tag("[开心]你好")); + assert!(has_tone_tag("(开心)你好")); + assert!(has_tone_tag("(开心)你好")); + assert!(!has_tone_tag("你好")); + } + + #[test] + fn test_analyze_tone() { + assert_eq!(analyze_tone("你好!"), vec!["激动"]); + assert_eq!(analyze_tone("你好?"), vec!["疑惑"]); + assert_eq!(analyze_tone("你好。"), vec!["平静"]); + assert_eq!(analyze_tone("你好?!"), vec!["激动", "疑惑"]); + } + + #[test] + fn test_insert_mid_tone() { + assert!(insert_mid_tone("你好!").contains("!(激动)")); + assert!(insert_mid_tone("你好?").contains("?(疑惑)")); + assert!(insert_mid_tone("你好。").contains("。(停顿)")); + } + + #[test] + fn test_apply_tone() { + let result = apply_tone("你好!"); + assert!(result.starts_with("[激动]")); + assert!(result.contains("!(激动)")); + + let result2 = apply_tone("[开心]你好!"); + assert!(result2.starts_with("[开心]")); + assert!(result2.contains("!(激动)")); + } +} \ No newline at end of file diff --git a/src/ui.rs b/src/ui.rs new file mode 100644 index 0000000..415dac1 --- /dev/null +++ b/src/ui.rs @@ -0,0 +1,225 @@ +/// UI 主题化模块 +/// +/// 使用 crossterm 提供美化的 CLI 输出和交互式界面 + +use crossterm::{ + style::{Color, ResetColor, SetForegroundColor}, + ExecutableCommand, +}; +use std::io::{self, Write}; + +/// 应用主题颜色 +pub struct Theme; + +impl Theme { + pub const PRIMARY: Color = Color::Cyan; + pub const SECONDARY: Color = Color::Blue; + pub const SUCCESS: Color = Color::Green; + pub const TEXT: Color = Color::White; + pub const DIM: Color = Color::DarkGrey; +} + +/// 打印带颜色的文本 +fn print_colored(color: Color, text: &str) -> io::Result<()> { + let mut stdout = io::stdout(); + stdout.execute(SetForegroundColor(color))?; + write!(stdout, "{}", text)?; + stdout.execute(ResetColor)?; + stdout.flush()?; + Ok(()) +} + +/// 打印带颜色的行(自动换行) +fn println_colored(color: Color, text: &str) -> io::Result<()> { + print_colored(color, &format!("{}\n", text)) +} + +/// 显示标题 +pub fn show_title(title: &str) { + let mut stdout = io::stdout(); + let _ = stdout.execute(SetForegroundColor(Theme::PRIMARY)); + let _ = stdout.write_all(format!("\n {}\n", title).as_bytes()); + let _ = stdout.execute(ResetColor); + let _ = stdout.flush(); +} + +/// 显示成功消息 +pub fn show_success(message: &str) { + let mut stdout = io::stdout(); + let _ = stdout.execute(SetForegroundColor(Theme::SUCCESS)); + let _ = write!(stdout, " ✓ {}", message); + let _ = stdout.execute(ResetColor); + let _ = writeln!(stdout); +} + +/// 显示信息(带缩进) +pub fn show_info(label: &str, value: &str) { + let mut stdout = io::stdout(); + let _ = stdout.execute(SetForegroundColor(Theme::SECONDARY)); + let _ = write!(stdout, " {} ", label); + let _ = stdout.execute(ResetColor); + let _ = writeln!(stdout, "{}", value); +} + +/// 显示分隔线 +pub fn show_separator() { + let _ = println_colored(Theme::DIM, " ────────────────────────────────────────────────"); +} + +/// 显示音色列表(美化版) +pub fn show_voices() { + show_title("可用音色列表"); + show_separator(); + + println!(); + println!(" {:<16} {}", "Voice ID", "说明"); + show_separator(); + + let voices = [ + ("mimo_default", "MiMo 默认音色(推荐)"), + ("default_zh", "中文音色(兼容旧版)"), + ("default_en", "英文音色(兼容旧版)"), + ]; + + for (id, desc) in voices { + let mut stdout = io::stdout(); + let _ = stdout.execute(SetForegroundColor(Theme::PRIMARY)); + let _ = write!(stdout, " {:<16}", id); + let _ = stdout.execute(ResetColor); + let _ = writeln!(stdout, "{}", desc); + } + + println!(); + show_separator(); + println!(); + println!(" 使用方式: mimo-tts --voice --text \"要合成的文本\""); + println!(" 提示: Voice ID 区分大小写"); + println!(); +} + +/// 显示配置信息(美化版) +pub fn show_config(api_key: &str, default_voice: &str, config_path: &str) { + show_title("当前配置"); + show_separator(); + println!(); + + show_info("📁 配置文件:", config_path); + show_info("🔑 API Key:", if api_key.is_empty() { "(未设置)" } else { "***" }); + show_info("🎙 默认音色:", default_voice); + + println!(); +} + +/// 读取密码输入(隐藏字符) +pub fn read_password(prompt: &str) -> io::Result { + use crossterm::{ + event::{read, Event, KeyCode, KeyEvent}, + terminal::{disable_raw_mode, enable_raw_mode}, + }; + + let mut stdout = io::stdout(); + let _ = write!(stdout, " {} ", prompt); + let _ = stdout.flush(); + + enable_raw_mode()?; + + let mut password = String::new(); + + loop { + match read()? { + Event::Key(KeyEvent { code, .. }) => match code { + KeyCode::Enter => { + disable_raw_mode()?; + println!(); + break Ok(password); + } + KeyCode::Char(c) => { + password.push(c); + let _ = write!(stdout, "*"); + let _ = stdout.flush(); + } + KeyCode::Backspace => { + if !password.is_empty() { + password.pop(); + let _ = write!(stdout, "\x08 \x08"); + let _ = stdout.flush(); + } + } + KeyCode::Esc => { + disable_raw_mode()?; + println!(); + break Ok(String::new()); + } + _ => {} + }, + _ => {} + } + } +} + +/// 读取普通输入 +pub fn read_input(prompt: &str) -> io::Result { + let mut stdout = io::stdout(); + let _ = write!(stdout, " {} ", prompt); + let _ = stdout.flush(); + + let mut input = String::new(); + io::stdin().read_line(&mut input)?; + Ok(input.trim().to_string()) +} + +/// 显示 onboard 表单(交互式配置) +pub fn show_onboard_form( + current_api_key: &str, + current_voice: &str, +) -> io::Result<(String, String)> { + show_title("MiMo TTS 配置向导"); + show_separator(); + println!(); + let _ = println_colored(Theme::TEXT, " 欢迎使用 MiMo TTS 配置向导!"); + let _ = println_colored(Theme::DIM, " 请按照以下步骤完成配置,按 Enter 跳过保持当前值"); + println!(); + + // API Key + show_info("当前 API Key:", if current_api_key.is_empty() { "(未设置)" } else { "***" }); + let api_key = read_password("🔑 输入新 API Key (留空保持不变):")?; + let api_key = if api_key.is_empty() { + current_api_key.to_string() + } else { + api_key + }; + + println!(); + + // 默认音色 + show_info("当前默认音色:", current_voice); + let _ = println_colored(Theme::DIM, " 可选音色: mimo_default, 冰糖, 茉莉, 苏打, 白桦, Mia, Chloe, Milo, Dean"); + let voice_input = read_input("🎙 输入新默认音色 (留空保持当前):")?; + let voice = if voice_input.is_empty() { + current_voice.to_string() + } else { + voice_input + }; + + println!(); + show_separator(); + show_success("配置向导完成!"); + println!(); + + Ok((api_key, voice)) +} + +/// 显示播放状态 +pub fn show_playback_start() { + show_info("▶", "正在播放音频..."); +} + +/// 显示播放完成 +pub fn show_playback_complete() { + show_success("播放完成"); +} + +/// 显示保存完成 +pub fn show_save_complete(path: &str) { + show_success(&format!("语音合成完成,已保存到: {}", path)); +} diff --git a/taolun.md b/taolun.md new file mode 100644 index 0000000..8c1cbcc --- /dev/null +++ b/taolun.md @@ -0,0 +1,347 @@ +# 讨论记录 (taolun.md) + +## 2026-04-24 - 项目启动 + +### 用户需求 +基于 Mimo-TTS API 开发 Rust CLI 工具,要求: +- Rust 编写,单一二进制可执行文件 +- 后期通过 skill 给其他 claw 工具使用 +- CLI 参数调用方式 +- OOP + 设计模式架构 +- 全程中文沟通 +- 详细中文注释 +- 每次操作前先更新文档 + +### API 信息 +- Endpoint: `POST https://api.xiaomimimo.com/v1/chat/completions` +- 认证:双 Header (`api-key` + `Authorization: Bearer`) +- 音频格式:WAV(Base64 编码) + +--- + +## 2026-04-24 - 实施记录 + +### 第一轮完成 +1. ✅ 创建三个文档(taolun.md、changelog.md、agents.md) +2. ✅ 配置 Rust 国内源(稀疏索引协议) +3. ✅ 实现项目代码(config.rs、api.rs、cli.rs、main.rs) +4. ✅ Debug + Release 构建成功 +5. ✅ 基本功能测试通过 + +### 第二轮修改 +**用户新增需求:** +1. **project.config.toml**: 项目根目录,含 version,与 git version 一致 +2. **统一配置路径**:所有平台使用 `~/.config/tts/config.toml` +3. **API Key**: sk-csa6s3bvpwqw21zfs3urbmqgrw720eoa1qdz6o42abk5xoj8 +4. **onboard 命令**:CLI 引导式配置初始化 + +**执行内容:** +1. ✅ 创建 `project.config.toml` (version = "0.1.0") +2. ✅ 修改 `Cargo.toml`(移除 dirs,添加 home 依赖) +3. ✅ 修改 `config.rs`(统一路径为 `~/.config/tts/config.toml`) +4. ✅ 修改 `cli.rs`(添加 Onboard 子命令) +5. ✅ 修改 `main.rs`(处理 Onboard,恢复 main() 函数) +6. ✅ 配置 API Key 成功 +7. ✅ 语音合成测试成功(test.wav、final_test.wav) +8. ✅ Release 构建成功(无警告) + +### 踩坑记录 +1. **Cargo 国内源超时** + - 解决:改用稀疏索引协议(sparse+https://) + +2. **clap derive 模式缺少 Parser trait 导入** + - 解决:添加 `use clap::Parser;` + +3. **main() 函数丢失** + - 原因:编辑时不小心删除 + - 解决:恢复 main() 函数和 ExitCode 枚举 + +4. **配置文件路径统一** + - 需求:所有平台使用 `~/.config/tts/config.toml` + - 解决:使用 home 库获取家目录,手动拼接路径 + +### 项目最终状态 +- **位置**: /Users/titor/tts +- **二进制**: target/release/mimo-tts (4.5MB) +- **配置**: ~/.config/tts/config.toml(已配置 API Key) +- **项目配置**: project.config.toml (version = "0.1.0") +- **功能**: + - ✅ TTS 语音合成 + - ✅ 配置管理(config set/show) + - ✅ 引导式配置(onboard) + - ✅ 列出音色(voices) +- **架构**: Builder 模式 + Singleton 模式 + OOP + +### 退出码规范 +- 0: 成功 +- 1: 参数错误 +- 2: 配置错误 +- 3: API 调用失败 +- 4: 文件操作失败 + +## 2026-04-24 - 第三轮修改 + +### 用户新需求 +**不要保存语音到本地,使用流式数据输出** +- 语音数据直接输出到 stdout(二进制流) +- 便于其他程序通过管道读取 +- 更适合作为 claw skill 集成 + +### 修改计划 +1. 修改 `synthesize()` 函数,返回音频数据而不是保存文件 +2. 修改 `main.rs`,支持输出到 stdout(二进制模式) +3. 保留可选的 `--output` 参数用于保存到文件(向后兼容) +4. 当输出到 stdout 时,不输出其他文本信息(避免污染二进制流) +5. 流式调用可能需要使用 pcm16 格式(根据 API 文档) + + +## 2026-04-24 - 第四轮修改 + +### 用户新需求 +**添加音频播放功能** +- 使用 rodio 库直接播放音频 +- 添加 --play 参数触发播放模式 +- 默认单次播放,不循环 +- 保留 --output 和 stdout 输出功能 + +### 技术选型 +- HTTP 客户端:reqwest(已使用) +- 异步运行时:tokio(已使用) +- 音频播放:rodio 0.19 +- WAV 处理:无需额外库(rodio 直接支持) + +## 2026-04-24 - 第四轮实施完成 + +### 已完成 +1. ✅ 修改 Cargo.toml 添加 rodio 0.19 依赖 +2. ✅ 修改 cli.rs 添加 --play 参数 +3. ✅ 修改 main.rs: + - synthesize() 返回 Vec(音频数据) + - 添加 play_audio() 函数(使用 rodio 播放) + - 修改 run() 支持三种输出方式(播放/保存/stdout) +4. ✅ 修复编译错误(synthesize() 重复代码、未使用导入) +5. ✅ 修复 stdout 输出污染问题(移除 synthesize() 中的 println) +6. ✅ Release 构建成功(无警告) +7. ✅ 功能测试通过: + - --play 播放音频 ✅ + - --output 保存文件 ✅ + - stdout 二进制流输出 ✅ + +### 最终项目状态 +- 二进制文件:target/release/mimo-tts (约 6MB,包含 rodio) +- 支持三种输出方式:播放、保存、流式输出 +- 所有功能测试通过 + +## 2026-04-24 - 第五轮修改 + +### 用户确认需求 +**扩展音色支持** +1. ✅ 更新音色列表为 Mimo-TTS 完整列表(8个音色) +2. ✅ 默认音色从 default_zh 改为 mimo_default +3. ✅ 添加音色验证,无效时使用默认音色 +4. ✅ 废弃 default_zh 和 default_en + +### 完整音色列表 +| Voice ID | 语言 | 性别 | 说明 | +|----------|------|------|------| +| mimo_default | 多语言 | - | MiMo默认(中国集群=冰糖)| +| 冰糖 | 中文 | 女性 | 甜美清脆的女声 | +| 茉莉 | 中文 | 女性 | 温柔知性的女声 | +| 苏打 | 中文 | 男性 | 阳光活力的男声 | +| 白桦 | 中文 | 男性 | 沉稳大气的男声 | +| Mia | 英文 | 女性 | Sweet and gentle female | +| Chloe | 英文 | 女性 | Warm and articulate female | +| Milo | 英文 | 男性 | Energetic young male | +| Dean | 英文 | 男性 | Deep and steady male | + +## 2026-04-24 - 第五轮修改(修复) + +### 问题修复 +- **默认音色未生效**:config.rs 中 `default_voice()` 函数返回值仍是 `default_zh` +- 修复:将 `config.rs:39` 默认值改为 `mimo_default` +- 更新配置文件 `~/.config/tts/config.toml` 中的 `default_voice` +- 验证:show-config 现在正确显示 `mimo_default` + +## 2026-04-24 - 第六轮修改 + +### 用户需求 +**UI 主题化所有 CLI 输出** +1. 使用 ratatui + crossterm 美化 CLI 输出 +2. onboard 改为完整表单页面(同时显示所有配置项) +3. API Key 输入支持隐藏(显示 * 代替) +4. 所有命令输出都使用主题美化 +5. 不需要简洁模式 + +### 实施方案 +- 新增 src/ui.rs 模块(主题、组件) +- 修改 Cargo.toml 添加 ratatui + crossterm +- 美化 list_voices()、show_config() 输出 +- 重写 onboard() 为完整交互式表单 +- 美化所有命令输出(播放、保存等) + +### 第六轮实施完成 +1. ✅ 创建 src/ui.rs 模块(使用 crossterm 美化输出) +2. ✅ 修改 main.rs 引入 ui 模块 +3. ✅ 美化 list_voices() 输出(彩色表格) +4. ✅ 美化 show_config() 输出(彩色标签) +5. ✅ 重写 onboard() 为交互式表单(支持密码隐藏输入) +6. ✅ 美化播放和保存完成消息 +7. ✅ Release 构建成功(仅有未使用代码警告) +8. ✅ 功能测试通过(voices、show-config) + +### 技术细节 +- 使用 crossterm 而非完整的 ratatui Terminal(简化实现) +- 密码输入使用 enable_raw_mode 实现字符隐藏 +- 输出使用颜色主题(PRIMARY、SUCCESS、ERROR 等) +- show_onboard_form 返回 Result 类型,由调用者处理错误 + +### 第七轮修改 + +### 用户需求 +**配置分层设计** +1. `project.config.toml` - 项目默认配置(全量配置) + - version + - base_url + - default_format +2. `~/.config/tts/config.toml` - 用户配置(仅覆盖项) + - api_key + - default_voice +3. 临时文件只允许存放在当前目录下 + +### 实施方案 +- 修改 `project.config.toml` 添加 base_url 和 default_format +- 重写 `config.rs` 实现分层配置加载 +- 修改 `cli.rs` 移除 base_url 参数 +- 修改 `ui.rs` 简化显示和表单(只处理 api_key 和 default_voice) +- 修改 `main.rs` 使用新的配置结构 +- 测试时临时文件输出到当前目录 + +### 第七轮实施完成 +1. ✅ 创建分层配置结构(ProjectConfig + UserConfig + Config) +2. ✅ `project.config.toml` 包含默认配置(base_url、default_format) +3. ✅ 用户配置只保存 api_key 和 default_voice +4. ✅ 修改 cli.rs 移除 base_url 参数 +5. ✅ 修改 ui.rs 简化显示和表单 +6. ✅ Release 构建成功(仅有未使用字段警告) +7. ✅ 功能测试通过(show-config、voices、语音合成) +8. ✅ 临时文件生成在当前目录 + +### 技术细节 +- ConfigManager 先加载项目配置,再加载用户配置,最后合并 +- save() 只保存 UserConfig(api_key、default_voice) +- project.config.toml 从当前项目目录读取 +- 用户配置路径:`~/.config/tts/config.toml` + +## 2026-04-24 - 第八轮修改 + +### 用户反馈 +**使用 --voice 提示失败** +- 问题:使用 `--voice '茉莉'` 时报错:Unknown voice +- 原因:之前使用了错误的 API 文档,实际 API 只支持 3 个预置音色 +- 最新发现:mimo-v2.5-tts 模型支持更多音色(9 个) +- 模型名应为 `mimo-v2.5-tts`(不是 `mimo-v2-tts`) + +### 音色列表(mimo-v2.5-tts) +| Voice ID | 语言 | 性别 | 说明 | +|----------|------|------|------| +| mimo_default | 多语言 | - | MiMo默认(中国集群=冰糖)| +| 冰糖 | 中文 | 女性 | 甜美清脆的女声 | +| 茉莉 | 中文 | 女性 | 温柔知性的女声 | +| 苏打 | 中文 | 男性 | 阳光活力的男声 | +| 白桦 | 中文 | 男性 | 沉稳大气的男声 | +| Mia | 英文 | 女性 | Sweet and gentle female | +| Chloe | 英文 | 女性 | Warm and articulate female | +| Milo | 英文 | 男性 | Energetic young male | +| Dean | 英文 | 男性 | Deep and steady male | + +### 新增功能 +- `--style` 参数:风格描述(如:开心、东北话、孙悟空、唱歌等) +- 风格通过 `user` 消息传递(不是 `