diff --git a/Cargo.lock b/Cargo.lock index f88965a..394168a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,39 +165,6 @@ dependencies = [ "tree-sitter-yaml", ] -[[package]] -name = "async-stream" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "async-trait" -version = "0.1.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "atomic" version = "0.6.1" @@ -241,53 +208,6 @@ dependencies = [ "fs_extra", ] -[[package]] -name = "axum" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" -dependencies = [ - "async-trait", - "axum-core", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "sync_wrapper", - "tower 0.5.3", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "mime", - "pin-project-lite", - "rustversion", - "sync_wrapper", - "tower-layer", - "tower-service", -] - [[package]] name = "base64" version = "0.13.1" @@ -571,7 +491,6 @@ dependencies = [ "anyhow", "ast-grep-core", "ast-grep-language", - "async-stream", "base64 0.22.1", "bytes", "capnp", @@ -599,14 +518,11 @@ dependencies = [ "notify-debouncer-mini", "paste", "peg", - "prost", - "protoc-bin-vendored", "ratatui", "redb", "regex", "rustls", "rustls-native-certs", - "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", @@ -615,10 +531,7 @@ dependencies = [ "tokenizers", "tokio", "tokio-rustls", - "tokio-stream", "tokio-util", - "tonic", - "tonic-build", "tui-markdown", "tui-textarea-2", "uuid", @@ -1151,12 +1064,6 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - [[package]] name = "flate2" version = "1.1.9" @@ -1381,31 +1288,6 @@ dependencies = [ "regex-syntax", ] -[[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 2.14.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.15.5" @@ -1511,12 +1393,6 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "hyper" version = "1.9.0" @@ -1527,11 +1403,9 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "h2", "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -1539,19 +1413,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-timeout" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" -dependencies = [ - "hyper", - "hyper-util", - "pin-project-lite", - "tokio", - "tower-service", -] - [[package]] name = "hyper-util" version = "0.1.20" @@ -1559,17 +1420,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ "bytes", - "futures-channel", - "futures-util", "http", "http-body", "hyper", - "libc", "pin-project-lite", - "socket2 0.6.3", "tokio", - "tower-service", - "tracing", ] [[package]] @@ -1630,16 +1485,6 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c" -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.14.0" @@ -2013,12 +1858,6 @@ dependencies = [ "xml5ever", ] -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - [[package]] name = "memchr" version = "2.8.0" @@ -2049,12 +1888,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2105,12 +1938,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "multimap" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" - [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -2406,16 +2233,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "petgraph" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" -dependencies = [ - "fixedbitset 0.5.7", - "indexmap 2.14.0", -] - [[package]] name = "phf" version = "0.11.3" @@ -2468,26 +2285,6 @@ dependencies = [ "siphasher", ] -[[package]] -name = "pin-project" -version = "1.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "pin-project-lite" version = "0.2.17" @@ -2507,7 +2304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" dependencies = [ "base64 0.22.1", - "indexmap 2.14.0", + "indexmap", "quick-xml", "serde", "time", @@ -2581,122 +2378,6 @@ dependencies = [ "yansi", ] -[[package]] -name = "prost" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" -dependencies = [ - "heck", - "itertools", - "log", - "multimap", - "once_cell", - "petgraph", - "prettyplease", - "prost", - "prost-types", - "regex", - "syn 2.0.117", - "tempfile", -] - -[[package]] -name = "prost-derive" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "prost-types" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16" -dependencies = [ - "prost", -] - -[[package]] -name = "protoc-bin-vendored" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c381df33c98266b5f08186583660090a4ffa0889e76c7e9a5e175f645a67fa" -dependencies = [ - "protoc-bin-vendored-linux-aarch_64", - "protoc-bin-vendored-linux-ppcle_64", - "protoc-bin-vendored-linux-s390_64", - "protoc-bin-vendored-linux-x86_32", - "protoc-bin-vendored-linux-x86_64", - "protoc-bin-vendored-macos-aarch_64", - "protoc-bin-vendored-macos-x86_64", - "protoc-bin-vendored-win32", -] - -[[package]] -name = "protoc-bin-vendored-linux-aarch_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c350df4d49b5b9e3ca79f7e646fde2377b199e13cfa87320308397e1f37e1a4c" - -[[package]] -name = "protoc-bin-vendored-linux-ppcle_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55a63e6c7244f19b5c6393f025017eb5d793fd5467823a099740a7a4222440c" - -[[package]] -name = "protoc-bin-vendored-linux-s390_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dba5565db4288e935d5330a07c264a4ee8e4a5b4a4e6f4e83fad824cc32f3b0" - -[[package]] -name = "protoc-bin-vendored-linux-x86_32" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8854774b24ee28b7868cd71dccaae8e02a2365e67a4a87a6cd11ee6cdbdf9cf5" - -[[package]] -name = "protoc-bin-vendored-linux-x86_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38b07546580df720fa464ce124c4b03630a6fb83e05c336fea2a241df7e5d78" - -[[package]] -name = "protoc-bin-vendored-macos-aarch_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89278a9926ce312e51f1d999fee8825d324d603213344a9a706daa009f1d8092" - -[[package]] -name = "protoc-bin-vendored-macos-x86_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81745feda7ccfb9471d7a4de888f0652e806d5795b61480605d4943176299756" - -[[package]] -name = "protoc-bin-vendored-win32" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95067976aca6421a523e491fce939a3e65249bac4b977adee0ee9771568e8aa3" - [[package]] name = "pulldown-cmark" version = "0.13.3" @@ -2752,8 +2433,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "libc", - "rand_chacha 0.3.1", "rand_core 0.6.4", ] @@ -2763,20 +2442,10 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_chacha 0.9.0", + "rand_chacha", "rand_core 0.9.5", ] -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - [[package]] name = "rand_chacha" version = "0.9.0" @@ -2792,9 +2461,6 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] [[package]] name = "rand_core" @@ -3043,15 +2709,6 @@ dependencies = [ "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "rustls-pki-types" version = "1.14.0" @@ -3174,7 +2831,7 @@ version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ - "indexmap 2.14.0", + "indexmap", "itoa", "memchr", "serde", @@ -3278,16 +2935,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socket2" version = "0.6.3" @@ -3402,12 +3049,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" - [[package]] name = "syntect" version = "5.3.0" @@ -3486,7 +3127,7 @@ dependencies = [ "fancy-regex", "filedescriptor", "finl_unicode", - "fixedbitset 0.4.2", + "fixedbitset", "hex", "lazy_static", "libc", @@ -3646,7 +3287,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.6.3", + "socket2", "tokio-macros", "windows-sys 0.61.2", ] @@ -3672,17 +3313,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" @@ -3697,130 +3327,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tonic" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" -dependencies = [ - "async-stream", - "async-trait", - "axum", - "base64 0.22.1", - "bytes", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-timeout", - "hyper-util", - "percent-encoding", - "pin-project", - "prost", - "rustls-native-certs", - "rustls-pemfile", - "socket2 0.5.10", - "tokio", - "tokio-rustls", - "tokio-stream", - "tower 0.4.13", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tonic-build" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9557ce109ea773b399c9b9e5dca39294110b74f1f342cb347a80d1fce8c26a11" -dependencies = [ - "prettyplease", - "proc-macro2", - "prost-build", - "prost-types", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap 1.9.3", - "pin-project", - "pin-project-lite", - "rand 0.8.5", - "slab", - "tokio", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - -[[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", - "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-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - -[[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 = "tree-sitter" version = "0.26.8" @@ -4379,7 +3885,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" dependencies = [ "anyhow", - "indexmap 2.14.0", + "indexmap", "wasm-encoder", "wasmparser", ] @@ -4392,7 +3898,7 @@ checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ "bitflags 2.11.0", "hashbrown 0.15.5", - "indexmap 2.14.0", + "indexmap", "semver", ] @@ -4761,7 +4267,7 @@ checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" dependencies = [ "anyhow", "heck", - "indexmap 2.14.0", + "indexmap", "prettyplease", "syn 2.0.117", "wasm-metadata", @@ -4792,7 +4298,7 @@ checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", "bitflags 2.11.0", - "indexmap 2.14.0", + "indexmap", "log", "serde", "serde_derive", @@ -4811,7 +4317,7 @@ checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" dependencies = [ "anyhow", "id-arena", - "indexmap 2.14.0", + "indexmap", "log", "semver", "serde", diff --git a/Cargo.toml b/Cargo.toml index 120565b..313dcd6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,9 +18,6 @@ name = "consciousness" version.workspace = true edition.workspace = true -[features] -nightly-diagnostics = [] - [dependencies] anyhow = "1" html2md = "0.2" @@ -64,11 +61,6 @@ futures = "0.3" capnp = "0.25" capnp-rpc = "0.25" -tonic = { version = "0.12", features = ["tls", "tls-roots"] } -prost = "0.13" -async-stream = "0.3" -tokio-stream = "0.1" - tokenizers = "0.22" http = "1" @@ -82,13 +74,10 @@ imagesize = "0.14" rustls = "0.23" tokio-rustls = "0.26" rustls-native-certs = "0.8" -rustls-pemfile = "2" serde_urlencoded = "0.7" [build-dependencies] capnpc = "0.25" -tonic-build = { version = "0.12", default-features = false, features = ["prost", "transport"] } -protoc-bin-vendored = "3" [lib] name = "consciousness" diff --git a/build.rs b/build.rs index 5f77ae4..808bf31 100644 --- a/build.rs +++ b/build.rs @@ -13,21 +13,4 @@ fn main() { .file("schema/channel.capnp") .run() .expect("capnp compile failed (channel.capnp)"); - - // Generate salience.v1 gRPC client + message types from proto. - // Server side (python) is generated separately via grpcio-tools. - // Use vendored protoc so we don't require a system install. - let protoc = protoc_bin_vendored::protoc_bin_path() - .expect("vendored protoc not available for this platform"); - // SAFETY: build script is single-threaded at this point; setting env - // before invoking tonic_build is the documented way to point it at a - // non-PATH protoc. - unsafe { std::env::set_var("PROTOC", protoc); } - tonic_build::configure() - .build_server(false) - .build_client(true) - .compile_protos(&["proto/salience.proto"], &["proto"]) - .expect("tonic_build compile failed (salience.proto)"); - - println!("cargo:rerun-if-changed=proto/salience.proto"); } diff --git a/channels/telegram/src/main.rs b/channels/telegram/src/main.rs index ec7aa66..d3753f7 100644 --- a/channels/telegram/src/main.rs +++ b/channels/telegram/src/main.rs @@ -181,8 +181,6 @@ struct TelegramMessage { chat_id: i64, sender: String, text: String, - /// Absolute path to a downloaded media file (photo, etc.), if any. - media_path: Option, } /// Fetch and parse pending updates from Telegram via long polling. @@ -208,115 +206,19 @@ async fn get_updates( let sender = msg["from"]["first_name"].as_str().unwrap_or("unknown").to_string(); let chat_id = msg["chat"]["id"].as_i64().unwrap_or(0); - // Photo: array of PhotoSize, largest is last. Download largest, - // surface message with [image: ] marker so the multimodal - // model can Read the image. - let (text, media_path) = if let Some(sizes) = msg["photo"].as_array() { - let caption = msg["caption"].as_str().unwrap_or("").to_string(); - let largest = sizes.last(); - let file_id = largest - .and_then(|s| s["file_id"].as_str()) - .unwrap_or(""); - if file_id.is_empty() { - error!("telegram photo: missing file_id in update {update_id}"); - (caption, None) - } else { - // Bound the download — HttpClient::request_timeout only covers - // send_request, not body collect, so an indefinitely-slow body - // would otherwise stall every subsequent poll. - let dl = tokio::time::timeout( - std::time::Duration::from_secs(60), - download_telegram_file(client, token, file_id), - ).await - .unwrap_or_else(|_| Err("download timed out after 60s".into())); - match dl { - Ok(path) => (caption, Some(path)), - Err(e) => { - error!("telegram photo download failed (file_id={file_id}): {e}"); - // Surface what we have: caption plus a marker that - // a photo was sent but couldn't be fetched. - let marker = format!("[image: download failed: {e}]"); - let combined = if caption.is_empty() { - marker - } else { - format!("{marker}\n{caption}") - }; - (combined, None) - } - } - } - } else if let Some(text) = msg["text"].as_str() { - (text.to_string(), None) - } else { - // Other media types (voice, video, sticker, etc.) — skip for now, - // but log so we can extend later. - let kind = ["voice", "video", "sticker", "document", "audio", "animation"] - .iter() - .find(|k| !msg[**k].is_null()) - .copied() - .unwrap_or("unknown"); - info!("telegram: skipping non-text/photo message (kind={kind}, update_id={update_id})"); - continue; - }; - - messages.push(TelegramMessage { - update_id, - chat_id, - sender, - text, - media_path, - }); + if let Some(text) = msg["text"].as_str() { + messages.push(TelegramMessage { + update_id, + chat_id, + sender, + text: text.to_string(), + }); + } } } Ok(messages) } -/// Resolve a Telegram file_id to a downloadable URL path via getFile. -async fn get_file_path( - client: &HttpClient, - token: &str, - file_id: &str, -) -> Result> { - let url = format!( - "https://api.telegram.org/bot{}/getFile?file_id={}", - token, file_id, - ); - let response = client.get(&url).await?; - let body = response.text().await?; - let resp: serde_json::Value = serde_json::from_str(&body) - .map_err(|e| format!("getFile JSON parse error: {e}"))?; - if !resp["ok"].as_bool().unwrap_or(false) { - return Err(format!("getFile failed: {}", resp["description"].as_str().unwrap_or("?")).into()); - } - let file_path = resp["result"]["file_path"].as_str() - .ok_or("getFile: missing result.file_path")?; - Ok(file_path.to_string()) -} - -/// Download a Telegram file by file_id into the channel media dir. -/// Returns the absolute local path on success. -async fn download_telegram_file( - client: &HttpClient, - token: &str, - file_id: &str, -) -> Result> { - let file_path = get_file_path(client, token, file_id).await?; - let url = format!("https://api.telegram.org/file/bot{}/{}", token, file_path); - let response = client.get(&url).await?; - let status = response.status(); - if !status.is_success() { - return Err(format!("file download failed: {status}").into()); - } - let bytes = response.bytes().await?; - - let ext = file_path.rsplit('.').next().filter(|e| !e.contains('/')).unwrap_or("dat"); - let media_dir = log_dir().join("media"); - std::fs::create_dir_all(&media_dir)?; - let dest = media_dir.join(format!("{file_id}.{ext}")); - std::fs::write(&dest, &bytes)?; - Ok(dest.to_string_lossy().to_string()) -} - /// Send a text message to a Telegram chat. async fn send_message( client: &HttpClient, @@ -467,19 +369,11 @@ async fn poll_once( let sender_lower = msg.sender.to_lowercase(); let channel = format!("telegram.{}", sender_lower); - // If the message has media, prepend an [image: ] marker - // so the multimodal model can Read the file directly. - let body = match &msg.media_path { - Some(path) if msg.text.is_empty() => format!("[image: {path}]"), - Some(path) => format!("[image: {path}]\n{}", msg.text), - None => msg.text.clone(), - }; - - channel_log::append_disk_log(&log_dir(), &sender_lower, &msg.sender, &body); + channel_log::append_disk_log(&log_dir(), &sender_lower, &msg.sender, &msg.text); let mut s = state.borrow_mut(); s.config.chat_ids.insert(sender_lower, msg.chat_id); - let line = format!("[{}] {}", msg.sender, body); + let line = format!("[{}] {}", msg.sender, msg.text); s.push_message(line, 2, &channel); } diff --git a/channels/tmux/src/main.rs b/channels/tmux/src/main.rs index aecb3bd..f49bdc1 100644 --- a/channels/tmux/src/main.rs +++ b/channels/tmux/src/main.rs @@ -26,12 +26,10 @@ use consciousness::thalamus::channel_log::ChannelLog; #[derive(Clone, serde::Serialize, serde::Deserialize)] struct PaneConfig { - /// Human-readable label: becomes the channel name "tmux.