diff --git a/ide/Cargo.lock b/ide/Cargo.lock deleted file mode 100644 index c222798..0000000 --- a/ide/Cargo.lock +++ /dev/null @@ -1,2505 +0,0 @@ -# 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 = "anyhow" -version = "1.0.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" - -[[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", -] - -[[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", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "axum" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" -dependencies = [ - "async-trait", - "axum-core 0.4.5", - "axum-macros", - "base64", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-util", - "itoa", - "matchit 0.7.3", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sha1", - "sync_wrapper", - "tokio", - "tokio-tungstenite", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "axum" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" -dependencies = [ - "axum-core 0.5.6", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-util", - "itoa", - "matchit 0.8.4", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "serde_core", - "sync_wrapper", - "tokio", - "tower", - "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", - "tracing", -] - -[[package]] -name = "axum-core" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "http-body-util", - "mime", - "pin-project-lite", - "sync_wrapper", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bitflags" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bumpalo" -version = "3.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" - -[[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 = "cc" -version = "1.2.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d" -dependencies = [ - "find-msvc-tools", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[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 = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "data-encoding" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8" - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[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 = "el-ide-server" -version = "0.1.0" -dependencies = [ - "async-stream", - "axum 0.7.9", - "el-lsp", - "el-plugin-host", - "futures-util", - "mime_guess", - "reqwest", - "rust-embed", - "serde", - "serde_json", - "thiserror 2.0.18", - "tokio", - "tokio-stream", - "tower", - "tower-http 0.5.2", - "tracing", - "tracing-subscriber", - "urlencoding", - "which", -] - -[[package]] -name = "el-lexer" -version = "0.1.0" -dependencies = [ - "thiserror 2.0.18", -] - -[[package]] -name = "el-lsp" -version = "0.1.0" -dependencies = [ - "el-lexer", - "el-parser", - "el-types", - "serde", - "serde_json", - "thiserror 2.0.18", -] - -[[package]] -name = "el-parser" -version = "0.1.0" -dependencies = [ - "el-lexer", - "thiserror 2.0.18", -] - -[[package]] -name = "el-plugin-host" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", - "thiserror 2.0.18", -] - -[[package]] -name = "el-types" -version = "0.1.0" -dependencies = [ - "el-lexer", - "el-parser", - "thiserror 2.0.18", -] - -[[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-channel" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" - -[[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-core", - "futures-macro", - "futures-sink", - "futures-task", - "pin-project-lite", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[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.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasip2", - "wasip3", -] - -[[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 = [ - "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 = "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 = "http-range-header" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" - -[[package]] -name = "httparse" -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" -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", - "httpdate", - "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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" -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 = "itoa" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" - -[[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 = "libc" -version = "0.2.186" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" - -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - -[[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 = "matchers" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - -[[package]] -name = "matchit" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" - -[[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 = "mime_guess" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" -dependencies = [ - "mime", - "unicase", -] - -[[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 = "nu-ansi-term" -version = "0.50.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "openssl" -version = "0.10.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38c4372413cdaaf3cc79dd92d29d7d9f5ab09b51b10dded508fb90bb70b9222" -dependencies = [ - "bitflags", - "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 = "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 = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[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-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 = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" - -[[package]] -name = "rand" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[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", -] - -[[package]] -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 = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags", -] - -[[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", - "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", - "tower", - "tower-http 0.6.8", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "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 = "rust-embed" -version = "8.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04113cb9355a377d83f06ef1f0a45b8ab8cd7d8b1288160717d66df5c7988d27" -dependencies = [ - "axum 0.8.9", - "rust-embed-impl", - "rust-embed-utils", - "walkdir", -] - -[[package]] -name = "rust-embed-impl" -version = "8.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0902e4c7c8e997159ab384e6d0fc91c221375f6894346ae107f47dd0f3ccaa" -dependencies = [ - "proc-macro2", - "quote", - "rust-embed-utils", - "syn", - "walkdir", -] - -[[package]] -name = "rust-embed-utils" -version = "8.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bcdef0be6fe7f6fa333b1073c949729274b05f123a0ad7efcb8efd878e5c3b1" -dependencies = [ - "sha2", - "walkdir", -] - -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustix" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.12.1", - "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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" -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", - "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_path_to_error" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" -dependencies = [ - "itoa", - "serde", - "serde_core", -] - -[[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 = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[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 = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[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", - "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 1.1.4", - "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 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" -dependencies = [ - "thiserror-impl 2.0.18", -] - -[[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 = "thiserror-impl" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "tinystr" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tokio" -version = "1.52.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6" -dependencies = [ - "bytes", - "libc", - "mio", - "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-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-tungstenite" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite", -] - -[[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 = "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", - "tracing", -] - -[[package]] -name = "tower-http" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" -dependencies = [ - "bitflags", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "http-range-header", - "httpdate", - "mime", - "mime_guess", - "percent-encoding", - "pin-project-lite", - "tokio", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-http" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" -dependencies = [ - "bitflags", - "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 = [ - "log", - "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", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex-automata", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "tungstenite" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand", - "sha1", - "thiserror 1.0.69", - "utf-8", -] - -[[package]] -name = "typenum" -version = "1.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" - -[[package]] -name = "unicase" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" - -[[package]] -name = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[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 = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "valuable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -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 = "wasmparser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" -dependencies = [ - "bitflags", - "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 = "which" -version = "6.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f" -dependencies = [ - "either", - "home", - "rustix 0.38.44", - "winsafe", -] - -[[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 = "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", - "windows-strings", -] - -[[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.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[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.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[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.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[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.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[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.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winsafe" -version = "0.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" - -[[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", - "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 = "zerocopy" -version = "0.8.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[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/ide/Cargo.toml b/ide/Cargo.toml deleted file mode 100644 index d9d79b4..0000000 --- a/ide/Cargo.toml +++ /dev/null @@ -1,41 +0,0 @@ -[workspace] -members = [ - "vessels/el-ide-server", - "vessels/el-lsp", - "vessels/el-plugin-host", -] -resolver = "2" - -[workspace.package] -version = "0.1.0" -edition = "2021" -license = "MIT" -authors = ["Neuron Technologies"] - -[workspace.dependencies] -# Internal crates (el-ide workspace) -el-lsp = { path = "vessels/el-lsp" } -el-plugin-host = { path = "vessels/el-plugin-host" } - -# Engram lang crates (path deps) -el-lexer = { path = "../el/engrams/el-lexer" } -el-parser = { path = "../el/engrams/el-parser" } -el-types = { path = "../el/engrams/el-types" } -el-compiler = { path = "../el/engrams/el-compiler" } - -# External -serde = { version = "1", features = ["derive"] } -serde_json = "1" -thiserror = "2" -tokio = { version = "1", features = ["full"] } -axum = { version = "0.7", features = ["macros", "ws"] } -futures-util = "0.3" -tower-http = { version = "0.5", features = ["cors", "fs"] } -rust-embed = { version = "8", features = ["axum"] } -tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["env-filter"] } -reqwest = { version = "0.12", features = ["json"] } -async-stream = "0.3" -tokio-stream = "0.1" -which = "6" -mime_guess = "2" diff --git a/ide/vessels/el-ide-server/Cargo.toml b/ide/vessels/el-ide-server/Cargo.toml deleted file mode 100644 index 53c8709..0000000 --- a/ide/vessels/el-ide-server/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -name = "el-ide-server" -version.workspace = true -edition.workspace = true -license.workspace = true - -[[bin]] -name = "el-ide" -path = "src/main.rs" - -[dependencies] -el-lsp = { workspace = true } -el-plugin-host = { workspace = true } - -serde = { workspace = true } -serde_json = { workspace = true } -thiserror = { workspace = true } -tokio = { workspace = true } -axum = { workspace = true } -tower-http = { workspace = true } -rust-embed = { workspace = true } -tracing = { workspace = true } -tracing-subscriber = { workspace = true } -reqwest = { workspace = true } -async-stream = { workspace = true } -tokio-stream = { workspace = true } -which = { workspace = true } -urlencoding = "2" -mime_guess = { workspace = true } -futures-util = { workspace = true } - -[dev-dependencies] -tokio = { workspace = true, features = ["macros", "rt"] } -tower = "0.5" diff --git a/ide/vessels/el-ide-server/src/api/build.rs b/ide/vessels/el-ide-server/src/api/build.rs deleted file mode 100644 index 0b8a033..0000000 --- a/ide/vessels/el-ide-server/src/api/build.rs +++ /dev/null @@ -1,158 +0,0 @@ -//! Build and run API — streams output via SSE. - -use std::convert::Infallible; - -use axum::{ - extract::State, - Json, - response::{ - sse::{Event, KeepAlive, Sse}, - IntoResponse, - }, -}; -use serde::Deserialize; -use tokio::io::AsyncBufReadExt; - -use crate::{sse::classify_line, AppState}; - -// ── Request types ───────────────────────────────────────────────────────────── - -#[derive(Debug, Deserialize)] -pub struct BuildRequest { - /// Target: "debug" | "release" | "prod" - #[serde(default = "default_target")] - pub target: String, - /// Optional specific file to build; otherwise builds whole project. - pub file: Option, -} - -#[derive(Debug, Deserialize)] -pub struct RunRequest { - pub file: String, -} - -fn default_target() -> String { - "debug".into() -} - -// ── Handlers ────────────────────────────────────────────────────────────────── - -/// POST /api/build — streams build output as SSE. -pub async fn build_handler( - State(state): State, - Json(req): Json, -) -> impl IntoResponse { - let project_path = state.config.project_path.clone(); - let stream = build_stream(project_path, req); - Sse::new(stream).keep_alive(KeepAlive::default()) -} - -/// POST /api/run — compiles and runs a file, streams output as SSE. -pub async fn run_handler( - State(state): State, - Json(req): Json, -) -> impl IntoResponse { - let project_path = state.config.project_path.clone(); - let stream = run_stream(project_path, req); - Sse::new(stream).keep_alive(KeepAlive::default()) -} - -// ── Stream builders ─────────────────────────────────────────────────────────── - -fn build_stream( - project_path: String, - req: BuildRequest, -) -> impl tokio_stream::Stream> { - async_stream::stream! { - let el_bin = el_binary(); - let mut cmd = tokio::process::Command::new(&el_bin); - - if let Some(ref file) = req.file { - let file_path = format!("{project_path}/{file}"); - cmd.arg("build").arg(&file_path).arg("--target").arg(&req.target); - } else { - let main = format!("{project_path}/src/main.el"); - cmd.arg("build").arg(&main).arg("--target").arg(&req.target); - } - - cmd.stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .current_dir(&project_path); - - yield Ok(Event::default().event("info").data(format!("Running: el build --target {}", req.target))); - - match cmd.spawn() { - Err(e) => { - yield Ok(Event::default().event("error").data(format!("Failed to start el: {e}"))); - yield Ok(Event::default().event("done").data("1")); - } - Ok(mut child) => { - if let Some(stdout) = child.stdout.take() { - let mut reader = tokio::io::BufReader::new(stdout).lines(); - while let Ok(Some(line)) = reader.next_line().await { - yield Ok(classify_line(&line)); - } - } - if let Some(stderr) = child.stderr.take() { - let mut reader = tokio::io::BufReader::new(stderr).lines(); - while let Ok(Some(line)) = reader.next_line().await { - yield Ok(classify_line(&line)); - } - } - let code = child.wait().await.map(|s| s.code().unwrap_or(0)).unwrap_or(1); - yield Ok(Event::default().event("done").data(code.to_string())); - } - } - } -} - -fn run_stream( - project_path: String, - req: RunRequest, -) -> impl tokio_stream::Stream> { - async_stream::stream! { - let el_bin = el_binary(); - let file_path = format!("{project_path}/{}", req.file); - - yield Ok(Event::default().event("info").data(format!("Running: el run {}", req.file))); - - let mut cmd = tokio::process::Command::new(&el_bin); - cmd.arg("run") - .arg(&file_path) - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .current_dir(&project_path); - - match cmd.spawn() { - Err(e) => { - yield Ok(Event::default().event("error").data(format!("Failed to start el: {e}"))); - yield Ok(Event::default().event("done").data("1")); - } - Ok(mut child) => { - if let Some(stdout) = child.stdout.take() { - let mut reader = tokio::io::BufReader::new(stdout).lines(); - while let Ok(Some(line)) = reader.next_line().await { - yield Ok(Event::default().event("output").data(line)); - } - } - if let Some(stderr) = child.stderr.take() { - let mut reader = tokio::io::BufReader::new(stderr).lines(); - while let Ok(Some(line)) = reader.next_line().await { - yield Ok(classify_line(&line)); - } - } - let code = child.wait().await.map(|s| s.code().unwrap_or(0)).unwrap_or(1); - yield Ok(Event::default().event("done").data(code.to_string())); - } - } - } -} - -// ── Helpers ─────────────────────────────────────────────────────────────────── - -fn el_binary() -> String { - if let Ok(path) = which::which("el") { - return path.to_string_lossy().to_string(); - } - "el".to_string() -} diff --git a/ide/vessels/el-ide-server/src/api/config.rs b/ide/vessels/el-ide-server/src/api/config.rs deleted file mode 100644 index 60567e7..0000000 --- a/ide/vessels/el-ide-server/src/api/config.rs +++ /dev/null @@ -1,29 +0,0 @@ -//! Config API — exposes project metadata to the frontend. - -use axum::{extract::State, Json}; -use serde::Serialize; -use std::path::Path; - -use crate::AppState; - -#[derive(Serialize)] -pub struct ConfigResponse { - pub project_name: String, - pub project_path: String, - pub engram_url: String, -} - -pub async fn get_config(State(state): State) -> Json { - let project_path = &state.config.project_path; - let project_name = Path::new(project_path) - .file_name() - .and_then(|n| n.to_str()) - .unwrap_or(project_path) - .to_string(); - - Json(ConfigResponse { - project_name, - project_path: project_path.clone(), - engram_url: state.config.engram_url.clone(), - }) -} diff --git a/ide/vessels/el-ide-server/src/api/files.rs b/ide/vessels/el-ide-server/src/api/files.rs deleted file mode 100644 index 70e52f6..0000000 --- a/ide/vessels/el-ide-server/src/api/files.rs +++ /dev/null @@ -1,255 +0,0 @@ -//! File system API — list, read, and write files within the project root. - -use std::path::{Path, PathBuf}; - -use axum::{ - extract::{Query, State}, - http::StatusCode, - Json, -}; -use serde::{Deserialize, Serialize}; - -use crate::AppState; - -// ── Types ───────────────────────────────────────────────────────────────────── - -#[derive(Debug, Deserialize)] -pub struct PathQuery { - pub path: Option, -} - -#[derive(Debug, Serialize)] -pub struct FileEntry { - pub name: String, - pub path: String, - pub is_dir: bool, - pub children: Option>, -} - -#[derive(Debug, Serialize)] -pub struct FileContent { - pub path: String, - pub content: String, -} - -#[derive(Debug, Deserialize)] -pub struct WriteRequest { - pub path: String, - pub content: String, -} - -#[derive(Debug, Serialize)] -pub struct WriteResponse { - pub ok: bool, -} - -type ApiResult = Result, (StatusCode, Json)>; - -fn api_err(code: StatusCode, msg: impl Into) -> (StatusCode, Json) { - (code, Json(serde_json::json!({ "error": msg.into() }))) -} - -// ── Handlers ────────────────────────────────────────────────────────────────── - -/// GET /api/files?path={dir} -/// -/// Returns a recursive directory listing for the given path -/// (relative to EL_IDE_PROJECT_PATH). -pub async fn list_files( - State(state): State, - Query(q): Query, -) -> ApiResult> { - let root = PathBuf::from(&state.config.project_path); - let rel = q.path.unwrap_or_else(|| ".".into()); - let target = root.join(&rel); - let target = target - .canonicalize() - .map_err(|e| api_err(StatusCode::BAD_REQUEST, format!("invalid path: {e}")))?; - - // Security: ensure the resolved path is within the project root - let root_canonical = root - .canonicalize() - .map_err(|e| api_err(StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?; - if !target.starts_with(&root_canonical) { - return Err(api_err(StatusCode::FORBIDDEN, "path escapes project root")); - } - - let entries = read_dir_recursive(&target, &root_canonical, 0) - .map_err(|e| api_err(StatusCode::INTERNAL_SERVER_ERROR, e))?; - - Ok(Json(entries)) -} - -fn read_dir_recursive( - dir: &Path, - root: &Path, - depth: usize, -) -> Result, String> { - if depth > 8 { - return Ok(vec![]); - } - let mut entries = Vec::new(); - let rd = std::fs::read_dir(dir).map_err(|e| e.to_string())?; - let mut items: Vec<_> = rd.filter_map(|e| e.ok()).collect(); - items.sort_by_key(|e| e.file_name()); - - for entry in items { - let path = entry.path(); - let name = entry.file_name().to_string_lossy().to_string(); - // Skip hidden files/dirs and build/vendor noise - if name.starts_with('.') { - continue; - } - // Skip common non-source directories that bloat the tree - if matches!(name.as_str(), "target" | "node_modules" | ".git" | "dist" | ".cargo") { - continue; - } - // Skip lock files and large generated files - if matches!(name.as_str(), "Cargo.lock" | "package-lock.json" | "yarn.lock" | "bun.lockb") { - continue; - } - let rel_path = path.strip_prefix(root).unwrap_or(&path).to_string_lossy().to_string(); - let is_dir = path.is_dir(); - - let children = if is_dir { - Some(read_dir_recursive(&path, root, depth + 1).unwrap_or_default()) - } else { - None - }; - - entries.push(FileEntry { name, path: rel_path, is_dir, children }); - } - Ok(entries) -} - -/// GET /api/file?path={file} -pub async fn read_file( - State(state): State, - Query(q): Query, -) -> ApiResult { - let rel = q.path.ok_or_else(|| api_err(StatusCode::BAD_REQUEST, "missing path parameter"))?; - let file_path = safe_path(&state.config.project_path, &rel) - .map_err(|e| api_err(StatusCode::FORBIDDEN, e))?; - - let content = std::fs::read_to_string(&file_path) - .map_err(|e| api_err(StatusCode::NOT_FOUND, format!("cannot read file: {e}")))?; - - Ok(Json(FileContent { path: rel, content })) -} - -/// POST /api/file — body: { path, content } -pub async fn write_file( - State(state): State, - Json(req): Json, -) -> ApiResult { - let file_path = safe_path(&state.config.project_path, &req.path) - .map_err(|e| api_err(StatusCode::FORBIDDEN, e))?; - - // Create parent dirs if needed - if let Some(parent) = file_path.parent() { - std::fs::create_dir_all(parent) - .map_err(|e| api_err(StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?; - } - - std::fs::write(&file_path, &req.content) - .map_err(|e| api_err(StatusCode::INTERNAL_SERVER_ERROR, format!("cannot write: {e}")))?; - - Ok(Json(WriteResponse { ok: true })) -} - -/// DELETE /api/file?path={file} -pub async fn delete_file( - State(state): State, - Query(q): Query, -) -> ApiResult { - let rel = q.path.ok_or_else(|| api_err(StatusCode::BAD_REQUEST, "missing path parameter"))?; - let file_path = safe_path(&state.config.project_path, &rel) - .map_err(|e| api_err(StatusCode::FORBIDDEN, e))?; - - if file_path.is_dir() { - std::fs::remove_dir_all(&file_path) - .map_err(|e| api_err(StatusCode::INTERNAL_SERVER_ERROR, format!("cannot delete directory: {e}")))?; - } else { - std::fs::remove_file(&file_path) - .map_err(|e| api_err(StatusCode::NOT_FOUND, format!("cannot delete file: {e}")))?; - } - - Ok(Json(WriteResponse { ok: true })) -} - -#[derive(Debug, Deserialize)] -pub struct MkdirRequest { - pub path: String, -} - -/// POST /api/files/mkdir — body: { path } -pub async fn mkdir( - State(state): State, - Json(req): Json, -) -> ApiResult { - let dir_path = safe_path(&state.config.project_path, &req.path) - .map_err(|e| api_err(StatusCode::FORBIDDEN, e))?; - - std::fs::create_dir_all(&dir_path) - .map_err(|e| api_err(StatusCode::INTERNAL_SERVER_ERROR, format!("cannot create directory: {e}")))?; - - Ok(Json(WriteResponse { ok: true })) -} - -#[derive(Debug, Deserialize)] -pub struct RenameRequest { - pub from: String, - pub to: String, -} - -/// POST /api/files/rename — body: { from, to } -pub async fn rename_file( - State(state): State, - Json(req): Json, -) -> ApiResult { - let from_path = safe_path(&state.config.project_path, &req.from) - .map_err(|e| api_err(StatusCode::FORBIDDEN, e))?; - let to_path = safe_path(&state.config.project_path, &req.to) - .map_err(|e| api_err(StatusCode::FORBIDDEN, e))?; - - // Ensure parent exists - if let Some(parent) = to_path.parent() { - std::fs::create_dir_all(parent) - .map_err(|e| api_err(StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?; - } - - std::fs::rename(&from_path, &to_path) - .map_err(|e| api_err(StatusCode::INTERNAL_SERVER_ERROR, format!("cannot rename: {e}")))?; - - Ok(Json(WriteResponse { ok: true })) -} - -// ── Helpers ─────────────────────────────────────────────────────────────────── - -fn safe_path(project_root: &str, rel: &str) -> Result { - let root = PathBuf::from(project_root) - .canonicalize() - .map_err(|e| format!("invalid project root: {e}"))?; - // Prevent path traversal - let joined = root.join(rel); - // We can't canonicalize non-existent files, so check manually - let normalized = normalize_path(&joined); - if !normalized.starts_with(&root) { - return Err(format!("path '{rel}' escapes project root")); - } - Ok(normalized) -} - -/// Normalize a path without requiring the file to exist. -fn normalize_path(path: &Path) -> PathBuf { - let mut out = PathBuf::new(); - for component in path.components() { - use std::path::Component; - match component { - Component::ParentDir => { out.pop(); } - Component::CurDir => {} - c => out.push(c), - } - } - out -} diff --git a/ide/vessels/el-ide-server/src/api/format.rs b/ide/vessels/el-ide-server/src/api/format.rs deleted file mode 100644 index 592e919..0000000 --- a/ide/vessels/el-ide-server/src/api/format.rs +++ /dev/null @@ -1,84 +0,0 @@ -//! Format API — run `el fmt` on source content. - -use axum::{ - extract::State, - http::StatusCode, - Json, -}; -use serde::{Deserialize, Serialize}; - -use crate::AppState; - -type ApiResult = Result, (StatusCode, Json)>; - -fn api_err(msg: impl std::fmt::Display) -> (StatusCode, Json) { - ( - StatusCode::INTERNAL_SERVER_ERROR, - Json(serde_json::json!({ "error": msg.to_string() })), - ) -} - -#[derive(Debug, Deserialize)] -pub struct FormatRequest { - pub content: String, - /// Optional filename hint for language detection - pub path: Option, -} - -#[derive(Debug, Serialize)] -pub struct FormatResponse { - pub content: String, - pub changed: bool, -} - -/// POST /api/format — format content via `el fmt`, falls back to identity. -pub async fn format( - State(state): State, - Json(req): Json, -) -> ApiResult { - let project_path = &state.config.project_path; - - // Write content to a temp file, run `el fmt`, read back - let tmp_path = format!("{project_path}/.el-ide-fmt-tmp.el"); - - tokio::fs::write(&tmp_path, &req.content) - .await - .map_err(|e| api_err(format!("write tmp: {e}")))?; - - // Try to find `el` binary - let el_bin = if let Ok(path) = which::which("el") { - path.to_string_lossy().to_string() - } else { - // el not installed — return unchanged - tokio::fs::remove_file(&tmp_path).await.ok(); - return Ok(Json(FormatResponse { - content: req.content.clone(), - changed: false, - })); - }; - - let output = tokio::process::Command::new(&el_bin) - .arg("fmt") - .arg(&tmp_path) - .current_dir(project_path) - .output() - .await; - - match output { - Ok(out) if out.status.success() => { - let formatted = tokio::fs::read_to_string(&tmp_path) - .await - .unwrap_or_else(|_| req.content.clone()); - tokio::fs::remove_file(&tmp_path).await.ok(); - let changed = formatted != req.content; - Ok(Json(FormatResponse { content: formatted, changed })) - } - _ => { - tokio::fs::remove_file(&tmp_path).await.ok(); - Ok(Json(FormatResponse { - content: req.content.clone(), - changed: false, - })) - } - } -} diff --git a/ide/vessels/el-ide-server/src/api/git.rs b/ide/vessels/el-ide-server/src/api/git.rs deleted file mode 100644 index 2660f5a..0000000 --- a/ide/vessels/el-ide-server/src/api/git.rs +++ /dev/null @@ -1,108 +0,0 @@ -//! Git API endpoints — status and diff. - -use axum::{ - extract::{Query, State}, - http::StatusCode, - Json, -}; -use serde::{Deserialize, Serialize}; - -use crate::AppState; - -type ApiResult = Result, (StatusCode, Json)>; - -fn api_err(msg: impl std::fmt::Display) -> (StatusCode, Json) { - ( - StatusCode::INTERNAL_SERVER_ERROR, - Json(serde_json::json!({ "error": msg.to_string() })), - ) -} - -// ── Types ───────────────────────────────────────────────────────────────────── - -#[derive(Debug, Serialize)] -pub struct GitFileStatus { - pub path: String, - pub status: String, // "M", "A", "D", "?", "R", etc. -} - -#[derive(Debug, Deserialize)] -pub struct DiffQuery { - pub path: Option, -} - -// ── Handlers ────────────────────────────────────────────────────────────────── - -/// GET /api/git/status — returns list of changed files. -pub async fn git_status( - State(state): State, -) -> ApiResult> { - let project_path = &state.config.project_path; - - let output = tokio::process::Command::new("git") - .args(["status", "--porcelain"]) - .current_dir(project_path) - .output() - .await - .map_err(|e| api_err(format!("git status failed: {e}")))?; - - let stdout = String::from_utf8_lossy(&output.stdout); - let mut files = Vec::new(); - - for line in stdout.lines() { - if line.len() < 4 { - continue; - } - let xy = &line[..2]; - let path = line[3..].trim(); - // Handle renames: "old -> new" - let file_path = if let Some(arrow) = path.find(" -> ") { - &path[arrow + 4..] - } else { - path - }; - - // Determine status badge: prefer index status (first char) - let status = if xy.starts_with('M') || xy.ends_with('M') { - "M" - } else if xy.starts_with('A') || xy.starts_with('?') { - "A" - } else if xy.starts_with('D') || xy.ends_with('D') { - "D" - } else if xy.starts_with('R') { - "R" - } else { - "M" - }; - - files.push(GitFileStatus { - path: file_path.to_string(), - status: status.to_string(), - }); - } - - Ok(Json(files)) -} - -/// GET /api/git/diff?path= — returns unified diff. -pub async fn git_diff( - State(state): State, - Query(q): Query, -) -> ApiResult { - let project_path = &state.config.project_path; - - let mut cmd = tokio::process::Command::new("git"); - cmd.arg("diff").current_dir(project_path); - - if let Some(ref path) = q.path { - cmd.arg("--").arg(path); - } - - let output = cmd - .output() - .await - .map_err(|e| api_err(format!("git diff failed: {e}")))?; - - let diff = String::from_utf8_lossy(&output.stdout).to_string(); - Ok(Json(diff)) -} diff --git a/ide/vessels/el-ide-server/src/api/lsp.rs b/ide/vessels/el-ide-server/src/api/lsp.rs deleted file mode 100644 index 218e30f..0000000 --- a/ide/vessels/el-ide-server/src/api/lsp.rs +++ /dev/null @@ -1,135 +0,0 @@ -//! LSP API endpoints — completions, hover, errors, activate-preview. - -use axum::{ - extract::{Query, State}, - http::StatusCode, - Json, -}; -use serde::{Deserialize, Serialize}; - -use el_lsp::{Completion, Diagnostic, HoverInfo, LanguageServer}; - -use crate::AppState; - -type ApiResult = Result, (StatusCode, Json)>; - -// ── Query types ─────────────────────────────────────────────────────────────── - -#[derive(Debug, Deserialize)] -pub struct SourceQuery { - pub source: String, - pub pos: Option, -} - -#[derive(Debug, Deserialize)] -pub struct ActivatePreviewQuery { - pub type_name: String, - pub query: String, - pub source: Option, -} - -#[derive(Debug, Serialize)] -pub struct ActivatePreviewResponse { - pub count: usize, - pub nodes: Vec, - pub connected: bool, -} - -#[derive(Debug, Serialize)] -pub struct ActivateNode { - pub id: String, - pub label: String, - pub score: f64, -} - -// ── Handlers ────────────────────────────────────────────────────────────────── - -/// GET /api/lsp/complete?source=...&pos=... -pub async fn complete( - Query(q): Query, -) -> ApiResult> { - let lsp = LanguageServer::new(); - let pos = q.pos.unwrap_or(0); - let completions = lsp.complete(&q.source, pos); - Ok(Json(completions)) -} - -/// GET /api/lsp/hover?source=...&pos=... -pub async fn hover( - Query(q): Query, -) -> ApiResult> { - let lsp = LanguageServer::new(); - let pos = q.pos.unwrap_or(0); - let info = lsp.hover(&q.source, pos); - Ok(Json(info)) -} - -/// GET /api/lsp/errors?source=... -pub async fn errors( - Query(q): Query, -) -> ApiResult> { - let lsp = LanguageServer::new(); - let diags = lsp.diagnostics(&q.source); - Ok(Json(diags)) -} - -/// GET /api/lsp/activate-preview?type_name=...&query=...&source=... -/// -/// Returns a live preview of what nodes would activate for the given -/// `activate TypeName where "query"` expression. -pub async fn activate_preview( - State(state): State, - Query(q): Query, -) -> ApiResult { - let engram_url = &state.config.engram_url; - - // Try to query the Engram DB for matching nodes - let client = reqwest::Client::new(); - let url = format!("{engram_url}/api/activate-preview"); - let body = serde_json::json!({ - "type_name": q.type_name, - "query": q.query, - "limit": 5, - }); - - match client - .post(&url) - .json(&body) - .timeout(std::time::Duration::from_secs(5)) - .send() - .await - { - Ok(resp) if resp.status().is_success() => { - let json: serde_json::Value = resp.json().await.unwrap_or_default(); - - let nodes: Vec = json["nodes"] - .as_array() - .map(|arr| { - arr.iter() - .map(|n| ActivateNode { - id: n["id"].as_str().unwrap_or("").to_string(), - label: n["label"].as_str().unwrap_or("").to_string(), - score: n["score"].as_f64().unwrap_or(0.0), - }) - .collect() - }) - .unwrap_or_default(); - - let count = json["count"].as_u64().unwrap_or(nodes.len() as u64) as usize; - - Ok(Json(ActivatePreviewResponse { - count, - nodes, - connected: true, - })) - } - _ => { - // Engram not connected — return stub indicating disconnected state - Ok(Json(ActivatePreviewResponse { - count: 0, - nodes: vec![], - connected: false, - })) - } - } -} diff --git a/ide/vessels/el-ide-server/src/api/mod.rs b/ide/vessels/el-ide-server/src/api/mod.rs deleted file mode 100644 index b717442..0000000 --- a/ide/vessels/el-ide-server/src/api/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -pub mod build; -pub mod config; -pub mod files; -pub mod format; -pub mod git; -pub mod lsp; -pub mod outline; -pub mod plugins; -pub mod reason; -pub mod references; -pub mod run_state; -pub mod search; -pub mod settings; -pub mod snippets; -pub mod status; -pub mod terminal; -pub mod themes; -pub mod type_graph; diff --git a/ide/vessels/el-ide-server/src/api/outline.rs b/ide/vessels/el-ide-server/src/api/outline.rs deleted file mode 100644 index 4d38134..0000000 --- a/ide/vessels/el-ide-server/src/api/outline.rs +++ /dev/null @@ -1,91 +0,0 @@ -//! Document outline API — returns functions, types, enums from AST. - -use axum::{ - extract::Query, - http::StatusCode, - Json, -}; -use serde::{Deserialize, Serialize}; - -type ApiResult = Result, (StatusCode, Json)>; - -#[derive(Debug, Deserialize)] -pub struct SourceQuery { - pub source: String, -} - -#[derive(Debug, Serialize)] -pub struct OutlineItem { - pub kind: String, // "fn" | "type" | "enum" | "protocol" | "impl" - pub name: String, - pub line: usize, -} - -/// GET /api/outline?source=... — extract document symbols. -pub async fn outline( - Query(q): Query, -) -> ApiResult> { - let items = extract_outline(&q.source); - Ok(Json(items)) -} - -fn extract_outline(source: &str) -> Vec { - let mut items = Vec::new(); - - // Simple regex-like line scan for top-level declarations. - // Pattern: keyword followed by an identifier. - for (i, line) in source.lines().enumerate() { - let trimmed = line.trim(); - let line_num = i + 1; - - // fn name( - if let Some(rest) = trimmed.strip_prefix("fn ") { - if let Some(name) = ident_from(rest) { - items.push(OutlineItem { kind: "fn".into(), name, line: line_num }); - } - continue; - } - // type Name { - if let Some(rest) = trimmed.strip_prefix("type ") { - if let Some(name) = ident_from(rest) { - items.push(OutlineItem { kind: "type".into(), name, line: line_num }); - } - continue; - } - // enum Name { - if let Some(rest) = trimmed.strip_prefix("enum ") { - if let Some(name) = ident_from(rest) { - items.push(OutlineItem { kind: "enum".into(), name, line: line_num }); - } - continue; - } - // protocol Name { - if let Some(rest) = trimmed.strip_prefix("protocol ") { - if let Some(name) = ident_from(rest) { - items.push(OutlineItem { kind: "protocol".into(), name, line: line_num }); - } - continue; - } - // impl Protocol for Type { - if let Some(rest) = trimmed.strip_prefix("impl ") { - // name is "Protocol for Type" → take until { - let name = rest.trim_end_matches(|c: char| c == '{').trim(); - if !name.is_empty() { - items.push(OutlineItem { kind: "impl".into(), name: name.to_string(), line: line_num }); - } - continue; - } - } - - items -} - -fn ident_from(s: &str) -> Option { - let s = s.trim_start(); - let end = s.find(|c: char| !c.is_alphanumeric() && c != '_').unwrap_or(s.len()); - if end == 0 { - None - } else { - Some(s[..end].to_string()) - } -} diff --git a/ide/vessels/el-ide-server/src/api/plugins.rs b/ide/vessels/el-ide-server/src/api/plugins.rs deleted file mode 100644 index 380f4f0..0000000 --- a/ide/vessels/el-ide-server/src/api/plugins.rs +++ /dev/null @@ -1,77 +0,0 @@ -//! Plugins API — list, install, remove, enable, disable. -//! -//! All mutation operations use POST with a JSON body containing `name` -//! to avoid path-parameter routing conflicts with Axum 0.7/matchit 0.7. - -use axum::{extract::State, http::StatusCode, Json}; -use serde::{Deserialize, Serialize}; - -use el_plugin_host::Plugin; - -use crate::AppState; - -type ApiResult = Result, (StatusCode, Json)>; - -fn api_err(code: StatusCode, msg: impl Into) -> (StatusCode, Json) { - (code, Json(serde_json::json!({ "error": msg.into() }))) -} - -#[derive(Debug, Deserialize)] -pub struct NameRequest { - pub name: String, -} - -#[derive(Debug, Serialize)] -pub struct OkResponse { - pub ok: bool, -} - -/// GET /api/plugins -pub async fn list_plugins(State(state): State) -> ApiResult> { - let host = state.plugins.lock().await; - Ok(Json(host.list())) -} - -/// POST /api/plugins/install — body: { name } -pub async fn install_plugin( - State(state): State, - Json(req): Json, -) -> ApiResult { - let mut host = state.plugins.lock().await; - host.install(&req.name) - .map(Json) - .map_err(|e| api_err(StatusCode::BAD_REQUEST, e.to_string())) -} - -/// POST /api/plugins/remove — body: { name } -pub async fn remove_plugin( - State(state): State, - Json(req): Json, -) -> ApiResult { - let mut host = state.plugins.lock().await; - host.remove(&req.name) - .map(|_| Json(OkResponse { ok: true })) - .map_err(|e| api_err(StatusCode::BAD_REQUEST, e.to_string())) -} - -/// POST /api/plugins/enable — body: { name } -pub async fn enable_plugin( - State(state): State, - Json(req): Json, -) -> ApiResult { - let mut host = state.plugins.lock().await; - host.enable(&req.name) - .map(|_| Json(OkResponse { ok: true })) - .map_err(|e| api_err(StatusCode::BAD_REQUEST, e.to_string())) -} - -/// POST /api/plugins/disable — body: { name } -pub async fn disable_plugin( - State(state): State, - Json(req): Json, -) -> ApiResult { - let mut host = state.plugins.lock().await; - host.disable(&req.name) - .map(|_| Json(OkResponse { ok: true })) - .map_err(|e| api_err(StatusCode::BAD_REQUEST, e.to_string())) -} diff --git a/ide/vessels/el-ide-server/src/api/reason.rs b/ide/vessels/el-ide-server/src/api/reason.rs deleted file mode 100644 index 6953cd9..0000000 --- a/ide/vessels/el-ide-server/src/api/reason.rs +++ /dev/null @@ -1,409 +0,0 @@ -//! Reasoning API — pair programming with Neuron + hypothesis evaluation. - -use axum::{ - extract::State, - http::StatusCode, - Json, -}; -use serde::{Deserialize, Serialize}; - -use crate::AppState; - -type ApiResult = Result, (StatusCode, Json)>; - -fn api_err(code: StatusCode, msg: impl Into) -> (StatusCode, Json) { - (code, Json(serde_json::json!({ "error": msg.into() }))) -} - -// ── Hypothesis evaluation (legacy) ─────────────────────────────────────────── - -#[derive(Debug, Deserialize)] -pub struct ReasonRequest { - pub hypothesis: Option, - pub context: Option, - // Pair programming fields - pub message: Option, - pub selection: Option, - pub conversation_history: Option>, - pub mode: Option, // "hypothesis" | "pair" | "knowledge-search" - pub query: Option, // for knowledge-search mode -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ConversationMessage { - pub role: String, - pub content: String, -} - -#[derive(Debug, Serialize)] -pub struct ReasonResponse { - pub verdict: Option, - pub confidence: Option, - pub evidence: Vec, - pub source: String, - // Pair programming fields - pub message: Option, - pub code_blocks: Vec, - pub suggestions: Vec, - // Knowledge search fields - pub nodes: Vec, -} - -#[derive(Debug, Serialize)] -pub struct EvidenceItem { - pub text: String, - pub weight: f64, -} - -#[derive(Debug, Serialize)] -pub struct CodeBlock { - pub language: String, - pub code: String, - pub description: Option, -} - -#[derive(Debug, Serialize)] -pub struct KnowledgeNode { - pub id: String, - pub label: String, - pub node_type: String, - pub score: f64, -} - -/// POST /api/reason — multi-mode endpoint: -/// - mode "hypothesis" (default): proxy to engram-server for hypothesis evaluation -/// - mode "pair": pair programming with Neuron (proxies to soma chat endpoint) -/// - mode "knowledge-search": search Engram knowledge graph -pub async fn reason( - State(state): State, - Json(req): Json, -) -> ApiResult { - let mode = req.mode.as_deref().unwrap_or("hypothesis"); - - match mode { - "pair" => handle_pair_programming(state, req).await, - "knowledge-search" => handle_knowledge_search(state, req).await, - _ => handle_hypothesis(state, req).await, - } -} - -// ── Hypothesis mode ─────────────────────────────────────────────────────────── - -async fn handle_hypothesis( - state: AppState, - req: ReasonRequest, -) -> ApiResult { - let hypothesis = req.hypothesis.clone().unwrap_or_default(); - let engram_url = &state.config.engram_url; - let url = format!("{engram_url}/api/reason"); - - let client = reqwest::Client::new(); - let body = serde_json::json!({ - "hypothesis": hypothesis, - "context": req.context, - }); - - match client.post(&url).json(&body).timeout(std::time::Duration::from_secs(10)).send().await { - Ok(resp) if resp.status().is_success() => { - let json: serde_json::Value = resp.json().await - .map_err(|e| api_err(StatusCode::BAD_GATEWAY, format!("invalid response: {e}")))?; - Ok(Json(ReasonResponse { - verdict: Some(json["verdict"].as_str().unwrap_or("unknown").to_string()), - confidence: Some(json["confidence"].as_f64().unwrap_or(0.0)), - evidence: json["evidence"].as_array().map(|arr| { - arr.iter().map(|e| EvidenceItem { - text: e["text"].as_str().unwrap_or("").to_string(), - weight: e["weight"].as_f64().unwrap_or(0.0), - }).collect() - }).unwrap_or_default(), - source: "engram-server".into(), - message: None, - code_blocks: vec![], - suggestions: vec![], - nodes: vec![], - })) - } - _ => { - Ok(Json(ReasonResponse { - verdict: Some("unresolved".into()), - confidence: Some(0.0), - evidence: vec![EvidenceItem { - text: "engram-server is not reachable; connect an Engram instance for live reasoning.".into(), - weight: 0.0, - }], - source: "stub".into(), - message: None, - code_blocks: vec![], - suggestions: vec![], - nodes: vec![], - })) - } - } -} - -// ── Pair programming mode ───────────────────────────────────────────────────── - -async fn handle_pair_programming( - state: AppState, - req: ReasonRequest, -) -> ApiResult { - let user_message = req.message.clone().unwrap_or_default(); - let context = req.context.clone().unwrap_or_default(); - let selection = req.selection.clone().unwrap_or_default(); - let history = req.conversation_history.clone().unwrap_or_default(); - - let engram_url = &state.config.engram_url; - - // Build system prompt - let system_prompt = build_pair_system_prompt(&context, &selection); - - // Try to proxy to soma/engram chat endpoint - let client = reqwest::Client::new(); - - // Build messages array for chat completions format - let mut messages: Vec = vec![ - serde_json::json!({ "role": "system", "content": system_prompt }), - ]; - - // Add conversation history - for msg in &history { - messages.push(serde_json::json!({ - "role": msg.role, - "content": msg.content, - })); - } - - // Add current user message - messages.push(serde_json::json!({ "role": "user", "content": user_message })); - - let chat_body = serde_json::json!({ - "model": "neuron", - "messages": messages, - "stream": false, - }); - - // Try soma chat endpoint - let soma_url = format!("{engram_url}/v1/chat/completions"); - let response_text = match client - .post(&soma_url) - .json(&chat_body) - .timeout(std::time::Duration::from_secs(30)) - .send() - .await - { - Ok(resp) if resp.status().is_success() => { - let json: serde_json::Value = resp.json().await - .map_err(|e| api_err(StatusCode::BAD_GATEWAY, format!("invalid response: {e}")))?; - json["choices"][0]["message"]["content"] - .as_str() - .unwrap_or("No response from Neuron.") - .to_string() - } - _ => { - // Fallback stub response when soma is unavailable - build_stub_pair_response(&user_message, &context, &selection) - } - }; - - // Extract code blocks from the response - let code_blocks = extract_code_blocks(&response_text); - - // Extract suggestions (lines starting with "- " or "• ") - let suggestions = extract_suggestions(&response_text); - - Ok(Json(ReasonResponse { - verdict: None, - confidence: None, - evidence: vec![], - source: "neuron".into(), - message: Some(response_text), - code_blocks, - suggestions, - nodes: vec![], - })) -} - -fn build_pair_system_prompt(context: &str, selection: &str) -> String { - let mut prompt = String::from( - "You are Neuron, an AI pair programmer for the Engram language. \ - You are deeply integrated into the IDE — you can see the current file, understand types, \ - and help write, debug, and reason about Engram programs.\n\n\ - The Engram language features:\n\ - - `activate TypeName where \"query\"` — spreading activation over the knowledge graph\n\ - - `sealed { ... }` — quantum-sealed sensitive blocks\n\ - - Types map to semantic nodes in the Engram knowledge graph\n\ - - Structural typing with protocols and impl blocks\n\n" - ); - - if !context.is_empty() { - let truncated = if context.len() > 3000 { - format!("{}...(truncated)", &context[..3000]) - } else { - context.to_string() - }; - prompt.push_str(&format!( - "Current file content:\n```engram\n{truncated}\n```\n\n" - )); - } - - if !selection.is_empty() { - prompt.push_str(&format!( - "User has selected this code:\n```engram\n{selection}\n```\n\n" - )); - } - - prompt.push_str( - "When suggesting code, wrap it in ```engram code blocks. \ - Be concise and practical. If you see opportunities to use spreading activation \ - (`activate X where \"...\"`), suggest them. \ - Focus on the semantic relationships between types and knowledge graph nodes." - ); - - prompt -} - -fn build_stub_pair_response(user_message: &str, context: &str, selection: &str) -> String { - let has_context = !context.is_empty(); - let has_selection = !selection.is_empty(); - let msg_lower = user_message.to_lowercase(); - - if msg_lower.contains("explain") && has_selection { - format!( - "I can see the selected code. To get a real AI analysis, \ - connect an Engram instance at the configured endpoint.\n\n\ - Based on the structure, this code appears to define types and functions \ - in the Engram type system.\n\n\ - Connect Neuron for semantic analysis of knowledge graph relationships." - ) - } else if msg_lower.contains("activate") || msg_lower.contains("semantic") { - "The `activate` keyword performs spreading activation over the Engram knowledge graph. \ - Example:\n\n\ - ```engram\nlet results: [User] = activate User where \"premium subscribers active this week\"\n```\n\n\ - This returns all User nodes semantically matching the query. \ - Connect an Engram instance for live knowledge graph queries.".to_string() - } else if has_context { - format!( - "I see your current file. Neuron pair programming is ready — \ - connect an Engram instance to enable live AI responses.\n\n\ - Your file has {} characters of Engram code. \ - Once connected, I can analyze types, suggest activations, and help debug.", - context.len() - ) - } else { - "Neuron pair programming panel is active. \ - Connect an Engram instance (set EL_ENGRAM_URL) to enable live AI responses. \ - I can help with:\n\ - - Explaining and debugging Engram code\n\ - - Suggesting `activate` queries for your data types\n\ - - Writing functions and type definitions\n\ - - Analyzing semantic relationships in your knowledge graph".to_string() - } -} - -fn extract_code_blocks(text: &str) -> Vec { - let mut blocks = Vec::new(); - let mut remaining = text; - - while let Some(start) = remaining.find("```") { - remaining = &remaining[start + 3..]; - // Find language (optional, on same line as ```) - let lang_end = remaining.find('\n').unwrap_or(remaining.len()); - let lang = remaining[..lang_end].trim().to_string(); - let lang = if lang.is_empty() { "engram".to_string() } else { lang }; - - remaining = &remaining[lang_end..]; - if remaining.starts_with('\n') { - remaining = &remaining[1..]; - } - - if let Some(end) = remaining.find("```") { - let code = remaining[..end].trim_end_matches('\n').to_string(); - remaining = &remaining[end + 3..]; - if !code.is_empty() { - blocks.push(CodeBlock { - language: lang, - code, - description: None, - }); - } - } else { - break; - } - } - - blocks -} - -fn extract_suggestions(text: &str) -> Vec { - text.lines() - .filter_map(|line| { - let trimmed = line.trim(); - if trimmed.starts_with("- ") || trimmed.starts_with("• ") || trimmed.starts_with("* ") { - Some(trimmed[2..].trim().to_string()) - } else { - None - } - }) - .filter(|s| !s.is_empty()) - .take(8) - .collect() -} - -// ── Knowledge search mode ───────────────────────────────────────────────────── - -async fn handle_knowledge_search( - state: AppState, - req: ReasonRequest, -) -> ApiResult { - let query = req.query.clone().unwrap_or_else(|| req.message.clone().unwrap_or_default()); - let engram_url = &state.config.engram_url; - - let client = reqwest::Client::new(); - let url = format!("{engram_url}/api/search"); - let body = serde_json::json!({ "query": query, "limit": 20 }); - - match client.post(&url).json(&body).timeout(std::time::Duration::from_secs(10)).send().await { - Ok(resp) if resp.status().is_success() => { - let json: serde_json::Value = resp.json().await - .map_err(|e| api_err(StatusCode::BAD_GATEWAY, format!("invalid response: {e}")))?; - - let nodes = json.as_array() - .map(|arr| { - arr.iter().map(|n| KnowledgeNode { - id: n["id"].as_str().unwrap_or("").to_string(), - label: n["label"].as_str().unwrap_or("").to_string(), - node_type: n["type"].as_str().unwrap_or("").to_string(), - score: n["score"].as_f64().unwrap_or(0.0), - }).collect() - }) - .unwrap_or_default(); - - Ok(Json(ReasonResponse { - verdict: None, - confidence: None, - evidence: vec![], - source: "engram-db".into(), - message: None, - code_blocks: vec![], - suggestions: vec![], - nodes, - })) - } - _ => { - // Stub: return empty nodes when engram is unavailable - Ok(Json(ReasonResponse { - verdict: None, - confidence: None, - evidence: vec![EvidenceItem { - text: "Engram DB not reachable — connect an Engram instance for knowledge graph search.".into(), - weight: 0.0, - }], - source: "stub".into(), - message: Some("Connect an Engram instance to search the knowledge graph.".into()), - code_blocks: vec![], - suggestions: vec![], - nodes: vec![], - })) - } - } -} diff --git a/ide/vessels/el-ide-server/src/api/references.rs b/ide/vessels/el-ide-server/src/api/references.rs deleted file mode 100644 index 4c4d077..0000000 --- a/ide/vessels/el-ide-server/src/api/references.rs +++ /dev/null @@ -1,119 +0,0 @@ -//! Definition and references API — find all uses of a symbol. - -use axum::{ - extract::Query, - http::StatusCode, - Json, -}; -use serde::{Deserialize, Serialize}; - -type ApiResult = Result, (StatusCode, Json)>; - -#[derive(Debug, Deserialize)] -pub struct SymbolQuery { - pub source: String, - pub pos: usize, -} - -#[derive(Debug, Serialize)] -pub struct SymbolLocation { - pub line: usize, - pub col: usize, - pub snippet: String, -} - -/// GET /api/definition?source=...&pos=... — find definition of symbol at pos. -pub async fn definition( - Query(q): Query, -) -> ApiResult> { - let loc = find_definition(&q.source, q.pos); - Ok(Json(loc)) -} - -/// GET /api/references?source=...&pos=... — find all references to symbol at pos. -pub async fn references( - Query(q): Query, -) -> ApiResult> { - let refs = find_references(&q.source, q.pos); - Ok(Json(refs)) -} - -// ── Implementation ──────────────────────────────────────────────────────────── - -fn word_at(source: &str, pos: usize) -> Option<&str> { - if pos > source.len() { - return None; - } - let bytes = source.as_bytes(); - let mut start = pos; - let mut end = pos; - while start > 0 && (bytes[start - 1].is_ascii_alphanumeric() || bytes[start - 1] == b'_') { - start -= 1; - } - while end < bytes.len() && (bytes[end].is_ascii_alphanumeric() || bytes[end] == b'_') { - end += 1; - } - if start == end { - None - } else { - Some(&source[start..end]) - } -} - -fn find_definition(source: &str, pos: usize) -> Option { - let word = word_at(source, pos)?; - if word.is_empty() { - return None; - } - - // Look for `fn word`, `type word`, `enum word`, `let word`, `protocol word` - let patterns = [ - format!("fn {word}"), - format!("type {word}"), - format!("enum {word}"), - format!("protocol {word}"), - ]; - - for (i, line) in source.lines().enumerate() { - for pat in &patterns { - if line.contains(pat.as_str()) { - let col = line.find(pat.as_str()).unwrap_or(0); - return Some(SymbolLocation { - line: i + 1, - col: col + 1, - snippet: line.trim().to_string(), - }); - } - } - } - None -} - -fn find_references(source: &str, pos: usize) -> Vec { - let word = match word_at(source, pos) { - Some(w) if !w.is_empty() => w, - _ => return vec![], - }; - - let mut refs = Vec::new(); - for (i, line) in source.lines().enumerate() { - let mut search = line; - let mut offset = 0; - while let Some(idx) = search.find(word) { - // Check word boundaries - let abs = offset + idx; - let before_ok = abs == 0 || !line.as_bytes()[abs - 1].is_ascii_alphanumeric() && line.as_bytes()[abs - 1] != b'_'; - let after_ok = abs + word.len() >= line.len() || !line.as_bytes()[abs + word.len()].is_ascii_alphanumeric() && line.as_bytes()[abs + word.len()] != b'_'; - if before_ok && after_ok { - refs.push(SymbolLocation { - line: i + 1, - col: abs + 1, - snippet: line.trim().to_string(), - }); - } - offset += idx + word.len(); - search = &search[idx + word.len()..]; - } - } - refs -} diff --git a/ide/vessels/el-ide-server/src/api/run_state.rs b/ide/vessels/el-ide-server/src/api/run_state.rs deleted file mode 100644 index 79368f4..0000000 --- a/ide/vessels/el-ide-server/src/api/run_state.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! Run state — tracks the currently running process so it can be killed. - -use std::sync::Arc; -use tokio::sync::Mutex; -use tokio::process::Child; - -/// Global run state shared across request handlers. -#[derive(Default)] -pub struct RunState { - pub current_child: Mutex>, -} - -impl RunState { - pub fn new() -> Arc { - Arc::new(Self { - current_child: Mutex::new(None), - }) - } -} diff --git a/ide/vessels/el-ide-server/src/api/search.rs b/ide/vessels/el-ide-server/src/api/search.rs deleted file mode 100644 index d5218a8..0000000 --- a/ide/vessels/el-ide-server/src/api/search.rs +++ /dev/null @@ -1,247 +0,0 @@ -//! Search API — grep-style text search across project files. -//! Supports case-sensitive, whole-word, and regex search modes. - -use std::path::{Path, PathBuf}; - -use axum::{ - extract::{Query, State}, - http::StatusCode, - Json, -}; -use serde::{Deserialize, Serialize}; - -use crate::AppState; - -type ApiResult = Result, (StatusCode, Json)>; - -fn api_err(code: StatusCode, msg: impl Into) -> (StatusCode, Json) { - (code, Json(serde_json::json!({ "error": msg.into() }))) -} - -#[derive(Debug, Deserialize)] -pub struct SearchQuery { - pub query: String, - pub path: Option, - /// If "1", match case (default: case-insensitive) - pub case_sensitive: Option, - /// If "1", match whole words only - pub whole_word: Option, - /// If "1", treat query as a regex - pub regex: Option, -} - -#[derive(Debug, Serialize)] -pub struct SearchResult { - pub path: String, - pub line: usize, - pub col: usize, - pub snippet: String, -} - -/// GET /api/search?query=&path=&case_sensitive=1&whole_word=1®ex=1 -pub async fn search( - State(state): State, - Query(q): Query, -) -> ApiResult> { - if q.query.is_empty() { - return Ok(Json(vec![])); - } - - let root = PathBuf::from(&state.config.project_path) - .canonicalize() - .map_err(|e| api_err(StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?; - - let search_root = if let Some(sub) = q.path.as_deref().filter(|s| !s.is_empty() && *s != ".") { - root.join(sub).canonicalize() - .map_err(|e| api_err(StatusCode::BAD_REQUEST, format!("invalid path: {e}")))? - } else { - root.clone() - }; - - if !search_root.starts_with(&root) { - return Err(api_err(StatusCode::FORBIDDEN, "path escapes project root")); - } - - let case_sensitive = q.case_sensitive.as_deref() == Some("1"); - let whole_word = q.whole_word.as_deref() == Some("1"); - let use_regex = q.regex.as_deref() == Some("1"); - - // Build a search function based on options - let opts = SearchOpts { case_sensitive, whole_word, use_regex, raw_query: q.query.clone() }; - let mut results: Vec = Vec::new(); - walk_and_search(&search_root, &root, &opts, &mut results); - results.truncate(200); - - Ok(Json(results)) -} - -struct SearchOpts { - case_sensitive: bool, - whole_word: bool, - use_regex: bool, - raw_query: String, -} - -impl SearchOpts { - /// Returns true and the byte offset of the match if the line matches. - fn find_in_line(&self, line: &str) -> Option { - if self.use_regex { - // Use a simple regex-like approach (we don't have the regex crate, - // so we do a basic fallback to literal search) - // For full regex, ship with regex crate — for now: literal search - let hay = if self.case_sensitive { line.to_string() } else { line.to_lowercase() }; - let needle = if self.case_sensitive { self.raw_query.clone() } else { self.raw_query.to_lowercase() }; - hay.find(&needle) - } else { - let hay = if self.case_sensitive { line.to_string() } else { line.to_lowercase() }; - let needle = if self.case_sensitive { self.raw_query.clone() } else { self.raw_query.to_lowercase() }; - if self.whole_word { - // Word-boundary check - let mut start = 0; - loop { - match hay[start..].find(&needle) { - None => return None, - Some(rel) => { - let abs = start + rel; - let before_ok = abs == 0 || !hay.as_bytes()[abs - 1].is_ascii_alphanumeric() && hay.as_bytes()[abs - 1] != b'_'; - let after = abs + needle.len(); - let after_ok = after >= hay.len() || !hay.as_bytes()[after].is_ascii_alphanumeric() && hay.as_bytes()[after] != b'_'; - if before_ok && after_ok { - return Some(abs); - } - start = abs + 1; - } - } - } - } else { - hay.find(&needle) - } - } - } -} - -/// Skip directories that are not useful to search. -fn should_skip_dir(name: &str) -> bool { - matches!(name, "target" | ".git" | "node_modules" | "dist" | ".cargo" | ".next" | ".turbo") -} - -/// Skip files that are likely binary or irrelevant. -fn should_skip_file(name: &str) -> bool { - // Skip lock files and common binary extensions - if matches!(name, "Cargo.lock" | "package-lock.json" | "yarn.lock" | "bun.lockb") { - return true; - } - let binary_exts = [ - ".png", ".jpg", ".jpeg", ".gif", ".ico", ".svg", - ".wasm", ".pdf", ".zip", ".tar", ".gz", ".exe", - ".so", ".dylib", ".a", ".rlib", ".rmeta", - ".parquet", ".db", ".sqlite", - ]; - for ext in &binary_exts { - if name.ends_with(ext) { - return true; - } - } - false -} - -fn walk_and_search(dir: &Path, root: &Path, opts: &SearchOpts, results: &mut Vec) { - if results.len() >= 200 { - return; - } - - let rd = match std::fs::read_dir(dir) { - Ok(r) => r, - Err(_) => return, - }; - - let mut entries: Vec<_> = rd.filter_map(|e| e.ok()).collect(); - entries.sort_by_key(|e| e.file_name()); - - for entry in entries { - if results.len() >= 200 { - break; - } - - let path = entry.path(); - let name = entry.file_name().to_string_lossy().to_string(); - - if name.starts_with('.') { - continue; - } - - if path.is_dir() { - if should_skip_dir(&name) { - continue; - } - walk_and_search(&path, root, opts, results); - } else { - if should_skip_file(&name) { - continue; - } - search_in_file(&path, root, opts, results); - } - } -} - -fn search_in_file(file: &Path, root: &Path, opts: &SearchOpts, results: &mut Vec) { - // Read file, skip if it looks binary - let content = match std::fs::read(file) { - Ok(b) => b, - Err(_) => return, - }; - - // Quick binary check: look for null bytes in first 8KB - let sample = &content[..content.len().min(8192)]; - if sample.contains(&0u8) { - return; - } - - let text = match std::str::from_utf8(&content) { - Ok(s) => s, - Err(_) => return, - }; - - let rel_path = file - .strip_prefix(root) - .unwrap_or(file) - .to_string_lossy() - .to_string(); - - let query_len = opts.raw_query.len(); - - for (line_idx, line) in text.lines().enumerate() { - if results.len() >= 200 { - break; - } - - if let Some(col_byte) = opts.find_in_line(line) { - // Convert byte offset to char col (1-based) - let col = line[..col_byte].chars().count() + 1; - - // Build snippet (cap at 120 chars) - let snippet = if line.len() > 120 { - // Try to center the match - let start = col_byte.saturating_sub(40); - let end = (col_byte + query_len + 40).min(line.len()); - let s = &line[start..end]; - if start > 0 { format!("…{s}") } else { s.to_string() } - } else { - line.to_string() - }; - - let snippet = if snippet.len() > 120 { - format!("{}…", &snippet[..117]) - } else { - snippet - }; - - results.push(SearchResult { - path: rel_path.clone(), - line: line_idx + 1, - col, - snippet, - }); - } - } -} diff --git a/ide/vessels/el-ide-server/src/api/settings.rs b/ide/vessels/el-ide-server/src/api/settings.rs deleted file mode 100644 index cdc4400..0000000 --- a/ide/vessels/el-ide-server/src/api/settings.rs +++ /dev/null @@ -1,110 +0,0 @@ -//! Settings API — persist and retrieve IDE settings to/from ~/.el-ide/settings.json - -use axum::{http::StatusCode, Json}; -use serde::{Deserialize, Serialize}; -use serde_json::Value; -use std::path::PathBuf; - -type ApiResult = Result, (StatusCode, Json)>; - -fn api_err(msg: impl std::fmt::Display) -> (StatusCode, Json) { - ( - StatusCode::INTERNAL_SERVER_ERROR, - Json(serde_json::json!({ "error": msg.to_string() })), - ) -} - -/// Default settings returned when no file exists. -fn default_settings() -> Value { - serde_json::json!({ - "theme": "dark", - "fontSize": 13, - "tabSize": 4, - "wordWrap": false, - "formatOnSave": false, - "vimMode": false, - "minimap": true, - "elBinaryPath": "el", - "engramUrl": "http://localhost:8742", - "stickyScroll": true, - "lineNumbers": true, - "bracketMatching": true - }) -} - -fn settings_path() -> PathBuf { - let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".into()); - PathBuf::from(home).join(".el-ide").join("settings.json") -} - -/// GET /api/settings — returns current settings. -pub async fn get_settings() -> ApiResult { - let path = settings_path(); - - if path.exists() { - let content = std::fs::read_to_string(&path) - .map_err(|e| api_err(format!("read settings: {e}")))?; - let val: Value = serde_json::from_str(&content) - .unwrap_or_else(|_| default_settings()); - // Merge with defaults to ensure all keys are present - let mut merged = default_settings(); - if let (Some(obj), Some(defaults)) = (val.as_object(), merged.as_object_mut()) { - for (k, v) in obj { - defaults.insert(k.clone(), v.clone()); - } - } - Ok(Json(merged)) - } else { - Ok(Json(default_settings())) - } -} - -#[derive(Debug, Deserialize)] -pub struct PatchSettings { - pub settings: Value, -} - -/// POST /api/settings — saves settings (merges with existing). -pub async fn save_settings( - Json(req): Json, -) -> ApiResult { - let path = settings_path(); - - // Ensure directory exists - if let Some(parent) = path.parent() { - std::fs::create_dir_all(parent) - .map_err(|e| api_err(format!("create settings dir: {e}")))?; - } - - // Load existing settings - let mut existing = if path.exists() { - let content = std::fs::read_to_string(&path).unwrap_or_default(); - serde_json::from_str::(&content).unwrap_or_else(|_| default_settings()) - } else { - default_settings() - }; - - // Merge incoming patches - if let (Some(existing_obj), Some(patch_obj)) = (existing.as_object_mut(), req.settings.as_object()) { - for (k, v) in patch_obj { - existing_obj.insert(k.clone(), v.clone()); - } - } - - let serialized = serde_json::to_string_pretty(&existing) - .map_err(|e| api_err(format!("serialize settings: {e}")))?; - - std::fs::write(&path, &serialized) - .map_err(|e| api_err(format!("write settings: {e}")))?; - - Ok(Json(existing)) -} - -/// DELETE /api/settings — reset to defaults. -pub async fn reset_settings() -> ApiResult { - let path = settings_path(); - if path.exists() { - std::fs::remove_file(&path).ok(); - } - Ok(Json(default_settings())) -} diff --git a/ide/vessels/el-ide-server/src/api/snippets.rs b/ide/vessels/el-ide-server/src/api/snippets.rs deleted file mode 100644 index 9928050..0000000 --- a/ide/vessels/el-ide-server/src/api/snippets.rs +++ /dev/null @@ -1,67 +0,0 @@ -//! Snippets API — returns el code templates. - -use axum::Json; -use serde::Serialize; - -#[derive(Debug, Serialize)] -pub struct Snippet { - pub label: String, - pub description: String, - pub body: String, -} - -/// GET /api/completions/snippet — return el code snippets. -pub async fn snippets() -> Json> { - Json(vec![ - Snippet { - label: "fn".into(), - description: "Function definition".into(), - body: "fn ${1:name}(${2:params}) -> ${3:ReturnType} {\n\t${4:body}\n}".into(), - }, - Snippet { - label: "type".into(), - description: "Struct type definition".into(), - body: "type ${1:Name} {\n\t${2:field}: ${3:Type},\n}".into(), - }, - Snippet { - label: "enum".into(), - description: "Enum definition".into(), - body: "enum ${1:Name} {\n\t${2:Variant},\n}".into(), - }, - Snippet { - label: "match".into(), - description: "Match expression".into(), - body: "match ${1:expr} {\n\t${2:pattern} => ${3:body},\n\t_ => ${4:default},\n}".into(), - }, - Snippet { - label: "let".into(), - description: "Let binding".into(), - body: "let ${1:name}: ${2:Type} = ${3:value};".into(), - }, - Snippet { - label: "protocol".into(), - description: "Protocol definition".into(), - body: "protocol ${1:Name} {\n\tfn ${2:method}(${3:self}) -> ${4:Ret};\n}".into(), - }, - Snippet { - label: "impl".into(), - description: "Implementation block".into(), - body: "impl ${1:Protocol} for ${2:Type} {\n\t${3:body}\n}".into(), - }, - Snippet { - label: "if".into(), - description: "If expression".into(), - body: "if ${1:cond} {\n\t${2:body}\n}".into(), - }, - Snippet { - label: "for".into(), - description: "For loop".into(), - body: "for ${1:item} in ${2:iter} {\n\t${3:body}\n}".into(), - }, - Snippet { - label: "activate".into(), - description: "Activate declaration".into(), - body: "activate ${1:Concept};".into(), - }, - ]) -} diff --git a/ide/vessels/el-ide-server/src/api/status.rs b/ide/vessels/el-ide-server/src/api/status.rs deleted file mode 100644 index b0ea869..0000000 --- a/ide/vessels/el-ide-server/src/api/status.rs +++ /dev/null @@ -1,94 +0,0 @@ -//! Status API — project metadata and server health. - -use std::path::{Path, PathBuf}; - -use axum::{extract::State, Json}; -use serde::Serialize; - -use crate::AppState; - -#[derive(Debug, Serialize)] -pub struct StatusResponse { - pub project_name: String, - pub project_path: String, - pub file_count: usize, - pub el_file_count: usize, - pub version: String, - pub el_version: Option, -} - -/// GET /api/status -pub async fn status(State(state): State) -> Json { - let project_path = state.config.project_path.clone(); - let root = PathBuf::from(&project_path); - - let project_name = root - .file_name() - .map(|n| n.to_string_lossy().to_string()) - .unwrap_or_else(|| project_path.clone()); - - let (file_count, el_file_count) = count_files(&root); - let el_version = get_el_version(&state.config.el_binary); - - Json(StatusResponse { - project_name, - project_path, - file_count, - el_file_count, - version: "0.1.0".into(), - el_version, - }) -} - -fn get_el_version(binary: &str) -> Option { - let out = std::process::Command::new(binary) - .arg("--version") - .output() - .ok()?; - let text = String::from_utf8_lossy(&out.stdout).to_string(); - let text = text.trim(); - if text.is_empty() { - let err = String::from_utf8_lossy(&out.stderr).to_string(); - let err = err.trim().to_string(); - if err.is_empty() { None } else { Some(err) } - } else { - Some(text.to_string()) - } -} - -fn should_skip_dir(name: &str) -> bool { - matches!(name, "target" | ".git" | "node_modules" | "dist" | ".cargo") -} - -fn count_files(root: &Path) -> (usize, usize) { - let mut total = 0usize; - let mut el_count = 0usize; - count_files_recursive(root, &mut total, &mut el_count); - (total, el_count) -} - -fn count_files_recursive(dir: &Path, total: &mut usize, el_count: &mut usize) { - let rd = match std::fs::read_dir(dir) { - Ok(r) => r, - Err(_) => return, - }; - - for entry in rd.filter_map(|e| e.ok()) { - let path = entry.path(); - let name = entry.file_name().to_string_lossy().to_string(); - if name.starts_with('.') { - continue; - } - if path.is_dir() { - if should_skip_dir(&name) { - continue; - } - count_files_recursive(&path, total, el_count); - } else { - *total += 1; - if name.ends_with(".el") { - *el_count += 1; - } - } - } -} diff --git a/ide/vessels/el-ide-server/src/api/terminal.rs b/ide/vessels/el-ide-server/src/api/terminal.rs deleted file mode 100644 index 95f2dd5..0000000 --- a/ide/vessels/el-ide-server/src/api/terminal.rs +++ /dev/null @@ -1,105 +0,0 @@ -//! Terminal WebSocket endpoint — spawns /bin/bash and bridges IO. - -use axum::{ - extract::{ - ws::{Message, WebSocket, WebSocketUpgrade}, - State, - }, - response::IntoResponse, -}; -use tokio::io::{AsyncBufReadExt, AsyncWriteExt}; -use tokio::process::Command; - -use crate::AppState; - -/// GET /api/terminal — upgrades to WebSocket, spawns a shell. -pub async fn terminal_ws( - ws: WebSocketUpgrade, - State(state): State, -) -> impl IntoResponse { - let project_path = state.config.project_path.clone(); - ws.on_upgrade(move |socket| handle_socket(socket, project_path)) -} - -async fn handle_socket(socket: WebSocket, project_path: String) { - use futures_util::{SinkExt, StreamExt}; - - let mut child = match Command::new("/bin/bash") - .current_dir(&project_path) - .stdin(std::process::Stdio::piped()) - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .spawn() - { - Ok(c) => c, - Err(e) => { - let (mut sink, _) = socket.split(); - let _ = sink.send(Message::Text(format!("Failed to spawn shell: {e}\r\n"))).await; - return; - } - }; - - let mut stdin = child.stdin.take().unwrap(); - let stdout = child.stdout.take().unwrap(); - let stderr = child.stderr.take().unwrap(); - - let (mut ws_sink, mut ws_stream) = socket.split(); - - // stdout → WS - let stdout_task = tokio::spawn(async move { - let mut reader = tokio::io::BufReader::new(stdout); - let mut line = String::new(); - loop { - line.clear(); - match reader.read_line(&mut line).await { - Ok(0) => break, - Ok(_) => { - if ws_sink.send(Message::Text(line.clone())).await.is_err() { - break; - } - } - Err(_) => break, - } - } - }); - - // stderr → WS (interleaved into same stream) - let stderr_task = tokio::spawn(async move { - let mut reader = tokio::io::BufReader::new(stderr); - let mut line = String::new(); - loop { - line.clear(); - match reader.read_line(&mut line).await { - Ok(0) => break, - Ok(_) => { - // We can't send to ws_sink here (it was moved), so just drain - // In practice stderr goes to stdout via /bin/bash behavior - } - Err(_) => break, - } - } - }); - - // WS → stdin - while let Some(Ok(msg)) = ws_stream.next().await { - match msg { - Message::Text(text) => { - if stdin.write_all(text.as_bytes()).await.is_err() { - break; - } - } - Message::Binary(bytes) => { - if stdin.write_all(&bytes).await.is_err() { - break; - } - } - Message::Close(_) => break, - _ => {} - } - } - - // Kill child process - let _ = child.kill().await; - stdout_task.abort(); - stderr_task.abort(); -} diff --git a/ide/vessels/el-ide-server/src/api/themes.rs b/ide/vessels/el-ide-server/src/api/themes.rs deleted file mode 100644 index 382984e..0000000 --- a/ide/vessels/el-ide-server/src/api/themes.rs +++ /dev/null @@ -1,68 +0,0 @@ -//! Themes API — list and switch IDE themes. - -use axum::{ - extract::State, - http::StatusCode, - Json, -}; -use serde::{Deserialize, Serialize}; - -use crate::AppState; - -type ApiResult = Result, (StatusCode, Json)>; - -fn api_err(code: StatusCode, msg: impl Into) -> (StatusCode, Json) { - (code, Json(serde_json::json!({ "error": msg.into() }))) -} - -#[derive(Debug, Serialize)] -pub struct ThemeInfo { - pub name: String, - pub label: String, - pub active: bool, -} - -#[derive(Debug, Deserialize)] -pub struct SetThemeRequest { - pub name: String, -} - -#[derive(Debug, Serialize)] -pub struct OkResponse { - pub ok: bool, - pub active: String, -} - -const AVAILABLE_THEMES: &[(&str, &str)] = &[ - ("dark", "Dark"), - ("light", "Light"), - ("neuron", "Neuron"), - ("high-contrast", "High Contrast"), -]; - -/// GET /api/themes — list available themes -pub async fn list_themes(State(state): State) -> ApiResult> { - let active = state.active_theme.read().await.clone(); - let themes = AVAILABLE_THEMES - .iter() - .map(|(name, label)| ThemeInfo { - name: name.to_string(), - label: label.to_string(), - active: *name == active, - }) - .collect(); - Ok(Json(themes)) -} - -/// POST /api/themes/active — body: { name } -pub async fn set_theme( - State(state): State, - Json(req): Json, -) -> ApiResult { - let valid = AVAILABLE_THEMES.iter().any(|(n, _)| *n == req.name); - if !valid { - return Err(api_err(StatusCode::BAD_REQUEST, format!("unknown theme: {}", req.name))); - } - *state.active_theme.write().await = req.name.clone(); - Ok(Json(OkResponse { ok: true, active: req.name })) -} diff --git a/ide/vessels/el-ide-server/src/api/type_graph.rs b/ide/vessels/el-ide-server/src/api/type_graph.rs deleted file mode 100644 index cf3a95d..0000000 --- a/ide/vessels/el-ide-server/src/api/type_graph.rs +++ /dev/null @@ -1,42 +0,0 @@ -//! Type graph API — returns nodes and edges for the current project. - -use axum::{ - extract::{Query, State}, - http::StatusCode, - Json, -}; -use serde::Deserialize; - -use el_lsp::{LanguageServer, TypeGraph}; - -use crate::AppState; - -type ApiResult = Result, (StatusCode, Json)>; - -#[derive(Debug, Deserialize)] -pub struct TypeGraphQuery { - /// Optional source to use directly (e.g. current editor content). - pub source: Option, - /// Or load from a file path within the project. - pub path: Option, -} - -/// GET /api/type-graph?source=... or ?path=... -/// -/// If neither is provided, reads src/main.el from the project root. -pub async fn type_graph( - State(state): State, - Query(q): Query, -) -> ApiResult { - let source = if let Some(src) = q.source { - src - } else { - let rel = q.path.unwrap_or_else(|| "src/main.el".into()); - let file_path = std::path::PathBuf::from(&state.config.project_path).join(&rel); - std::fs::read_to_string(&file_path).unwrap_or_default() - }; - - let lsp = LanguageServer::new(); - let graph = lsp.type_graph(&source); - Ok(Json(graph)) -} diff --git a/ide/vessels/el-ide-server/src/config.rs b/ide/vessels/el-ide-server/src/config.rs deleted file mode 100644 index 2aecf86..0000000 --- a/ide/vessels/el-ide-server/src/config.rs +++ /dev/null @@ -1,36 +0,0 @@ -//! Server configuration loaded from environment variables. - -#[derive(Debug, Clone)] -pub struct Config { - /// HTTP port (EL_IDE_PORT, default 7771) - pub port: u16, - /// Root path of the project to open (EL_IDE_PROJECT_PATH, default ".") - pub project_path: String, - /// Engram server URL for reasoning (EL_ENGRAM_URL, default http://localhost:8742) - pub engram_url: String, - /// El compiler binary path (EL_BINARY, default "el") - pub el_binary: String, -} - -impl Config { - pub fn from_env() -> Self { - Self { - port: std::env::var("EL_IDE_PORT") - .ok() - .and_then(|v| v.parse().ok()) - .unwrap_or(7771), - project_path: std::env::var("EL_IDE_PROJECT_PATH") - .unwrap_or_else(|_| ".".into()), - engram_url: std::env::var("EL_ENGRAM_URL") - .unwrap_or_else(|_| "http://localhost:8742".into()), - el_binary: std::env::var("EL_BINARY") - .unwrap_or_else(|_| "el".into()), - } - } -} - -impl Default for Config { - fn default() -> Self { - Self::from_env() - } -} diff --git a/ide/vessels/el-ide-server/src/embed.rs b/ide/vessels/el-ide-server/src/embed.rs deleted file mode 100644 index 75bf9f5..0000000 --- a/ide/vessels/el-ide-server/src/embed.rs +++ /dev/null @@ -1,49 +0,0 @@ -//! Embedded static assets via rust-embed. - -use axum::{ - http::{header, StatusCode}, - response::{IntoResponse, Response}, -}; -use rust_embed::RustEmbed; - -#[derive(RustEmbed)] -#[folder = "../../ide/"] -pub struct Assets; - -/// Serve `index.html` at the root path. -pub async fn serve_index() -> impl IntoResponse { - serve_file("index.html") -} - -/// Fallback handler — serves index.html for unknown paths (SPA routing). -pub async fn fallback() -> impl IntoResponse { - serve_file("index.html") -} - -fn serve_file(path: &str) -> Response { - match Assets::get(path) { - Some(content) => { - let mime = mime_guess::from_path(path) - .first_or_octet_stream() - .to_string(); - ( - StatusCode::OK, - [(header::CONTENT_TYPE, mime)], - content.data.to_vec(), - ) - .into_response() - } - None => { - // For SPA routing, fall back to index.html - match Assets::get("index.html") { - Some(content) => ( - StatusCode::OK, - [(header::CONTENT_TYPE, "text/html; charset=utf-8".to_string())], - content.data.to_vec(), - ) - .into_response(), - None => StatusCode::NOT_FOUND.into_response(), - } - } - } -} diff --git a/ide/vessels/el-ide-server/src/main.rs b/ide/vessels/el-ide-server/src/main.rs deleted file mode 100644 index 21df0b4..0000000 --- a/ide/vessels/el-ide-server/src/main.rs +++ /dev/null @@ -1,128 +0,0 @@ -//! el-ide-server — Axum HTTP server for the Engram Language IDE. -//! -//! Serves the IDE HTML at GET / and provides API endpoints for file operations, -//! build/run (SSE streaming), LSP, plugins, and type graph visualization. - -mod api; -mod config; -mod embed; -mod sse; - -#[cfg(test)] -mod tests; - -use std::sync::Arc; - -use axum::{Router, routing::{get, post, any}}; -use tokio::sync::{Mutex, RwLock}; -use tower_http::cors::{Any, CorsLayer}; -use tracing::info; -use tracing_subscriber::EnvFilter; - -use el_plugin_host::PluginHost; - -use crate::config::Config; - -// ── App state ───────────────────────────────────────────────────────────────── - -#[derive(Clone)] -pub struct AppState { - pub config: Arc, - pub plugins: Arc>, - pub active_theme: Arc>, -} - -// ── Entry point ─────────────────────────────────────────────────────────────── - -#[tokio::main] -async fn main() { - tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env().add_directive("el_ide=info".parse().unwrap())) - .init(); - - let config = Config::from_env(); - let port = config.port; - let state = AppState { - config: Arc::new(config), - plugins: Arc::new(Mutex::new(PluginHost::new())), - active_theme: Arc::new(RwLock::new("dark".into())), - }; - - let app = build_router(state); - let addr = format!("0.0.0.0:{port}"); - let listener = tokio::net::TcpListener::bind(&addr).await.unwrap(); - - info!("el-ide listening on http://{addr}"); - axum::serve(listener, app).await.unwrap(); -} - -pub fn build_router(state: AppState) -> Router { - let cors = CorsLayer::new() - .allow_origin(Any) - .allow_methods(Any) - .allow_headers(Any); - - Router::new() - // IDE HTML - .route("/", get(embed::serve_index)) - // Config - .route("/api/config", get(api::config::get_config)) - // Status - .route("/api/status", get(api::status::status)) - // File API - .route("/api/files", get(api::files::list_files)) - .route("/api/file", - get(api::files::read_file) - .post(api::files::write_file) - .delete(api::files::delete_file) - ) - .route("/api/files/mkdir", post(api::files::mkdir)) - .route("/api/files/rename", post(api::files::rename_file)) - // Search - .route("/api/search", get(api::search::search)) - // Build/run (SSE) - .route("/api/build", post(api::build::build_handler)) - .route("/api/run", post(api::build::run_handler)) - // LSP - .route("/api/lsp/complete", get(api::lsp::complete)) - .route("/api/lsp/hover", get(api::lsp::hover)) - .route("/api/lsp/errors", get(api::lsp::errors)) - .route("/api/lsp/activate-preview", get(api::lsp::activate_preview)) - // Type graph - .route("/api/type-graph", get(api::type_graph::type_graph)) - // Themes - .route("/api/themes", get(api::themes::list_themes)) - .route("/api/themes/active", post(api::themes::set_theme)) - // Plugins - .route("/api/plugins", get(api::plugins::list_plugins)) - .route("/api/plugins/install", post(api::plugins::install_plugin)) - .route("/api/plugins/remove", post(api::plugins::remove_plugin)) - .route("/api/plugins/enable", post(api::plugins::enable_plugin)) - .route("/api/plugins/disable", post(api::plugins::disable_plugin)) - // Format - .route("/api/format", post(api::format::format)) - // Outline - .route("/api/outline", get(api::outline::outline)) - // Definition and references - .route("/api/definition", get(api::references::definition)) - .route("/api/references", get(api::references::references)) - // Snippets - .route("/api/completions/snippet", get(api::snippets::snippets)) - // Git - .route("/api/git/status", get(api::git::git_status)) - .route("/api/git/diff", get(api::git::git_diff)) - // Terminal WebSocket - .route("/api/terminal", any(api::terminal::terminal_ws)) - // Reasoning (proxy to engram-server) - .route("/api/reason", post(api::reason::reason)) - // Settings - .route("/api/settings", - get(api::settings::get_settings) - .post(api::settings::save_settings) - .delete(api::settings::reset_settings) - ) - .layer(cors) - .with_state(state) - // Fallback for SPA routing — must come after with_state/layer - .fallback(embed::fallback) -} diff --git a/ide/vessels/el-ide-server/src/sse.rs b/ide/vessels/el-ide-server/src/sse.rs deleted file mode 100644 index b9d2bfa..0000000 --- a/ide/vessels/el-ide-server/src/sse.rs +++ /dev/null @@ -1,20 +0,0 @@ -//! SSE helpers for streaming build/run output. - -use axum::response::sse::Event; - -/// Build a line-output SSE event, classifying the line as error/warning/success/info. -pub fn classify_line(line: &str) -> Event { - let event_type = if line.to_lowercase().contains("error") { - "error" - } else if line.to_lowercase().contains("warning") || line.to_lowercase().contains("warn") { - "warning" - } else if line.to_lowercase().contains("compiled") - || line.to_lowercase().contains("ok") - || line.to_lowercase().contains("success") - { - "success" - } else { - "info" - }; - Event::default().event(event_type).data(line.to_string()) -} diff --git a/ide/vessels/el-ide-server/src/tests.rs b/ide/vessels/el-ide-server/src/tests.rs deleted file mode 100644 index e55fcbe..0000000 --- a/ide/vessels/el-ide-server/src/tests.rs +++ /dev/null @@ -1,236 +0,0 @@ -//! Integration tests for el-ide-server API endpoints. - -use std::sync::Arc; -use tokio::sync::{Mutex, RwLock}; - -use axum::{ - body::Body, - http::{Request, StatusCode}, -}; -use tower::ServiceExt; - -use el_plugin_host::PluginHost; - -use crate::{build_router, config::Config, AppState}; - -fn test_state(project_path: &str) -> AppState { - AppState { - config: Arc::new(Config { - port: 7771, - project_path: project_path.to_string(), - engram_url: "http://localhost:8742".into(), - }), - plugins: Arc::new(Mutex::new(PluginHost::new())), - active_theme: Arc::new(RwLock::new("dark".into())), - } -} - -fn test_project_path() -> String { - // Use the examples/hello-project as the test project. - // CARGO_MANIFEST_DIR = el-ide/crates/el-ide-server - let manifest = env!("CARGO_MANIFEST_DIR"); - // Normalize: go up three directories from the crate to workspace root, then into examples - let ws_root = std::path::Path::new(manifest) - .parent().unwrap() // crates/ - .parent().unwrap() // el-ide/ - .to_path_buf(); - ws_root.join("examples/hello-project") - .canonicalize() - .unwrap_or_else(|_| ws_root.join("examples/hello-project")) - .to_string_lossy() - .to_string() -} - -async fn get_json(app: axum::Router, uri: &str) -> (StatusCode, serde_json::Value) { - let resp = app - .oneshot(Request::get(uri).body(Body::empty()).unwrap()) - .await - .unwrap(); - let status = resp.status(); - let bytes = axum::body::to_bytes(resp.into_body(), 1024 * 1024).await.unwrap(); - let json: serde_json::Value = serde_json::from_slice(&bytes).unwrap_or(serde_json::Value::Null); - (status, json) -} - -// ── GET / ───────────────────────────────────────────────────────────────────── - -#[tokio::test] -async fn test_root_returns_html() { - let state = test_state(&test_project_path()); - let app = build_router(state); - - let resp = app - .oneshot(Request::get("/").body(Body::empty()).unwrap()) - .await - .unwrap(); - - // The embedded HTML should return 200 - assert_eq!(resp.status(), StatusCode::OK); -} - -// ── GET /api/files ──────────────────────────────────────────────────────────── - -#[tokio::test] -async fn test_list_files_returns_entries() { - let project = test_project_path(); - let state = test_state(&project); - let app = build_router(state); - - let (status, json) = get_json(app, "/api/files?path=.").await; - assert_eq!(status, StatusCode::OK, "body: {json}"); - assert!(json.is_array(), "expected array, got {json}"); - let arr = json.as_array().unwrap(); - assert!(!arr.is_empty(), "expected non-empty file listing"); -} - -#[tokio::test] -async fn test_list_files_contains_src_dir() { - let project = test_project_path(); - let state = test_state(&project); - let app = build_router(state); - - let (status, json) = get_json(app, "/api/files?path=.").await; - assert_eq!(status, StatusCode::OK); - let arr = json.as_array().unwrap(); - let has_src = arr.iter().any(|e| e["name"] == "src" || e["name"] == "manifest.el"); - assert!(has_src, "expected src or manifest.el in listing; got {arr:?}"); -} - -// ── GET /api/file ───────────────────────────────────────────────────────────── - -#[tokio::test] -async fn test_read_file_main_el() { - let project = test_project_path(); - let state = test_state(&project); - let app = build_router(state); - - let (status, json) = get_json(app, "/api/file?path=src/main.el").await; - assert_eq!(status, StatusCode::OK, "body: {json}"); - assert!(json["content"].is_string(), "expected content field"); - let content = json["content"].as_str().unwrap(); - assert!(content.contains("fn main"), "expected fn main in content"); -} - -#[tokio::test] -async fn test_read_missing_file_returns_404() { - let project = test_project_path(); - let state = test_state(&project); - let app = build_router(state); - - let (status, _) = get_json(app, "/api/file?path=nonexistent.el").await; - assert_eq!(status, StatusCode::NOT_FOUND); -} - -// ── GET /api/lsp/errors ─────────────────────────────────────────────────────── - -#[tokio::test] -async fn test_lsp_errors_clean_source() { - let state = test_state("."); - let app = build_router(state); - - let source = "fn main() -> Void { let x: Int = 42 }"; - let uri = format!("/api/lsp/errors?source={}", urlencoding::encode(source)); - - let (status, json) = get_json(app, &uri).await; - assert_eq!(status, StatusCode::OK, "body: {json}"); - assert!(json.is_array()); - let errors: Vec<_> = json.as_array().unwrap().iter() - .filter(|d| d["severity"] == "error") - .collect(); - assert!(errors.is_empty(), "unexpected errors: {errors:?}"); -} - -#[tokio::test] -async fn test_lsp_errors_bad_type() { - let state = test_state("."); - let app = build_router(state); - - let source = "let x: NonExistentType = 42"; - let uri = format!("/api/lsp/errors?source={}", urlencoding::encode(source)); - - let (status, json) = get_json(app, &uri).await; - assert_eq!(status, StatusCode::OK, "body: {json}"); - assert!(json.is_array()); - // Should have at least one diagnostic - assert!(!json.as_array().unwrap().is_empty(), "expected diagnostic for unknown type"); -} - -// ── GET /api/type-graph ─────────────────────────────────────────────────────── - -#[tokio::test] -async fn test_type_graph_returns_nodes_and_edges() { - let state = test_state("."); - let app = build_router(state); - - let source = "type Point { x: Float y: Float } type Circle { center: Point radius: Float }"; - let uri = format!("/api/type-graph?source={}", urlencoding::encode(source)); - - let (status, json) = get_json(app, &uri).await; - assert_eq!(status, StatusCode::OK, "body: {json}"); - assert!(json["nodes"].is_array()); - assert!(json["edges"].is_array()); - - let node_names: Vec<_> = json["nodes"].as_array().unwrap() - .iter().map(|n| n["name"].as_str().unwrap_or("")).collect(); - assert!(node_names.contains(&"Point"), "expected Point node"); - assert!(node_names.contains(&"Circle"), "expected Circle node"); -} - -#[tokio::test] -async fn test_type_graph_has_field_edge() { - let state = test_state("."); - let app = build_router(state); - - let source = "type Point { x: Float y: Float } type Circle { center: Point radius: Float }"; - let uri = format!("/api/type-graph?source={}", urlencoding::encode(source)); - - let (status, json) = get_json(app, &uri).await; - assert_eq!(status, StatusCode::OK); - - let edges = json["edges"].as_array().unwrap(); - let has_edge = edges.iter().any(|e| e["from"] == "Circle" && e["to"] == "Point"); - assert!(has_edge, "expected Circle->Point edge, edges: {edges:?}"); -} - -// ── GET /api/plugins ────────────────────────────────────────────────────────── - -#[tokio::test] -async fn test_list_plugins_returns_five() { - let state = test_state("."); - let app = build_router(state); - - let (status, json) = get_json(app, "/api/plugins").await; - assert_eq!(status, StatusCode::OK, "body: {json}"); - let plugins = json.as_array().unwrap(); - assert_eq!(plugins.len(), 5, "expected 5 first-party plugins"); -} - -#[tokio::test] -async fn test_dark_theme_installed() { - let state = test_state("."); - let app = build_router(state); - - let (status, json) = get_json(app, "/api/plugins").await; - assert_eq!(status, StatusCode::OK); - let plugins = json.as_array().unwrap(); - let dark = plugins.iter().find(|p| p["name"] == "el-theme-dark").unwrap(); - assert_eq!(dark["installed"], true); -} - -// ── GET /api/lsp/complete ───────────────────────────────────────────────────── - -#[tokio::test] -async fn test_completions_return_keywords() { - let state = test_state("."); - let app = build_router(state); - - let uri = "/api/lsp/complete?source=&pos=0"; - let (status, json) = get_json(app, uri).await; - assert_eq!(status, StatusCode::OK); - assert!(json.is_array()); - let labels: Vec<_> = json.as_array().unwrap().iter() - .map(|c| c["label"].as_str().unwrap_or("")) - .collect(); - assert!(labels.contains(&"let"), "expected 'let' in completions"); - assert!(labels.contains(&"fn"), "expected 'fn' in completions"); -} diff --git a/ide/vessels/el-lsp/Cargo.toml b/ide/vessels/el-lsp/Cargo.toml deleted file mode 100644 index 43150e6..0000000 --- a/ide/vessels/el-lsp/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "el-lsp" -version.workspace = true -edition.workspace = true -license.workspace = true - -[dependencies] -el-lexer = { workspace = true } -el-parser = { workspace = true } -el-types = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -thiserror = { workspace = true } - -[dev-dependencies] diff --git a/ide/vessels/el-lsp/src/completion.rs b/ide/vessels/el-lsp/src/completion.rs deleted file mode 100644 index 7d7ccef..0000000 --- a/ide/vessels/el-lsp/src/completion.rs +++ /dev/null @@ -1,292 +0,0 @@ -//! Completion engine — prefix-based + semantic scoring. - -use serde::{Deserialize, Serialize}; - -use el_types::{TypeDef, TypeEnv}; - -// ── Types ───────────────────────────────────────────────────────────────────── - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Completion { - pub label: String, - pub kind: CompletionKind, - pub detail: String, - pub documentation: Option, - /// Activation strength: higher = more relevant, completions sorted desc. - pub score: f32, -} - -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] -#[serde(rename_all = "lowercase")] -pub enum CompletionKind { - Variable, - Function, - Type, - Keyword, -} - -// ── Keywords ────────────────────────────────────────────────────────────────── - -const KEYWORDS: &[&str] = &[ - "let", "fn", "type", "enum", "match", "return", "activate", "where", - "sealed", "if", "else", "for", "in", "while", "true", "false", - "test", "seed", "assert", "target", "protocol", "impl", - "import", "from", "as", "with", "retry", "times", "fallback", - "reason", "parallel", "trace", "requires", "deploy", "to", "via", -]; - -// ── Builtin functions ───────────────────────────────────────────────────────── - -const BUILTIN_FUNCTIONS: &[(&str, &str)] = &[ - ("println", "fn(value: String) -> Void"), - ("print", "fn(value: String) -> Void"), - ("int_to_str", "fn(n: Int) -> String"), - ("str_to_int", "fn(s: String) -> Int"), - ("string_len", "fn(s: String) -> Int"), - ("str_slice", "fn(s: String, start: Int, end: Int) -> String"), - ("str_concat", "fn(a: String, b: String) -> String"), - ("str_contains", "fn(s: String, sub: String) -> Bool"), - ("str_starts_with", "fn(s: String, prefix: String) -> Bool"), - ("str_ends_with", "fn(s: String, suffix: String) -> Bool"), - ("str_to_upper", "fn(s: String) -> String"), - ("str_to_lower", "fn(s: String) -> String"), - ("str_split", "fn(s: String, sep: String) -> [String]"), - ("str_trim", "fn(s: String) -> String"), - ("str_replace", "fn(s: String, from: String, to: String) -> String"), - ("str_index_of", "fn(s: String, sub: String) -> Int"), - ("float_to_str", "fn(f: Float) -> String"), - ("str_to_float", "fn(s: String) -> Float"), - ("array_push", "fn(arr: [T], val: T) -> [T]"), - ("array_len", "fn(arr: [T]) -> Int"), - ("array_get", "fn(arr: [T], i: Int) -> T"), - ("list_len", "fn(list: [T]) -> Int"), - ("list_get", "fn(list: [T], i: Int) -> T"), - ("list_map", "fn(list: [T], f: fn(T) -> U) -> [U]"), - ("list_filter", "fn(list: [T], f: fn(T) -> Bool) -> [T]"), - ("list_reduce", "fn(list: [T], init: U, f: fn(U, T) -> U) -> U"), - ("map_create", "fn() -> Map"), - ("map_set", "fn(m: Map, key: String, val: T) -> Map"), - ("map_get", "fn(m: Map, key: String) -> T"), - ("map_has", "fn(m: Map, key: String) -> Bool"), - ("math_abs", "fn(n: Float) -> Float"), - ("math_sqrt", "fn(n: Float) -> Float"), - ("math_floor", "fn(n: Float) -> Int"), - ("math_ceil", "fn(n: Float) -> Int"), - ("math_round", "fn(n: Float) -> Int"), - ("math_min", "fn(a: Float, b: Float) -> Float"), - ("math_max", "fn(a: Float, b: Float) -> Float"), - ("math_pow", "fn(base: Float, exp: Float) -> Float"), - ("now_millis", "fn() -> Int"), - ("time_now_utc", "fn() -> String"), - ("time_to_parts", "fn(ts: String) -> Map"), - ("time_format", "fn(ts: String, fmt: String) -> String"), - ("llm_call", "fn(prompt: String) -> String"), - ("llm_parallel", "fn(prompts: [String]) -> [String]"), - ("random_int", "fn(min: Int, max: Int) -> Int"), - ("random_float", "fn() -> Float"), - ("parse_json", "fn(s: String) -> Map"), - ("to_json", "fn(v: T) -> String"), - ("http_get", "fn(url: String) -> String"), - ("http_post", "fn(url: String, body: String) -> String"), - ("read_file", "fn(path: String) -> String"), - ("write_file", "fn(path: String, content: String) -> Void"), - ("env_get", "fn(key: String) -> String"), - ("sleep_ms", "fn(ms: Int) -> Void"), - ("uuid_new", "fn() -> String"), - ("hash_sha256", "fn(s: String) -> String"), -]; - -const BUILTIN_TYPES: &[(&str, &str)] = &[ - ("Int", "64-bit signed integer"), - ("Float", "64-bit IEEE 754 double"), - ("String", "UTF-8 string"), - ("Bool", "Boolean value"), - ("Uuid", "RFC 4122 UUID"), - ("Void", "Unit type — no value"), -]; - -// ── Entry point ─────────────────────────────────────────────────────────────── - -/// Produce completions at `cursor_pos` in `source`. -/// -/// Extracts the identifier prefix before the cursor and returns all -/// completions whose label starts with that prefix, sorted by score -/// (prefix match score + semantic boost). -pub fn completions_at(env: &TypeEnv, source: &str, cursor_pos: usize) -> Vec { - let prefix = extract_prefix(source, cursor_pos); - let mut results: Vec = Vec::new(); - - // Keywords - for &kw in KEYWORDS { - if kw.starts_with(&prefix) { - let score = prefix_score(kw, &prefix) - + if matches!(kw, "activate" | "sealed") { 0.2 } else { 0.0 }; - results.push(Completion { - label: kw.to_string(), - kind: CompletionKind::Keyword, - detail: "keyword".into(), - documentation: keyword_doc(kw), - score, - }); - } - } - - // Built-in types - for &(name, desc) in BUILTIN_TYPES { - if name.to_lowercase().starts_with(&prefix.to_lowercase()) || prefix.is_empty() { - results.push(Completion { - label: name.to_string(), - kind: CompletionKind::Type, - detail: desc.into(), - documentation: Some(format!("Built-in type: {desc}")), - score: prefix_score(name, &prefix) + 0.1, - }); - } - } - - // User-defined types from env - for (type_name, def) in &env.types { - // Skip built-ins already listed above - if BUILTIN_TYPES.iter().any(|(n, _)| *n == type_name) { - continue; - } - if type_name.to_lowercase().starts_with(&prefix.to_lowercase()) || prefix.is_empty() { - let (detail, doc, extra_score) = match def { - TypeDef::Struct { fields, .. } => { - let field_list = fields - .iter() - .map(|(f, t)| format!("{f}: {t}")) - .collect::>() - .join(", "); - (format!("struct {{ {field_list} }}"), - Some(format!("User-defined struct with fields: {field_list}")), - 0.15) - } - TypeDef::Enum { variants, .. } => { - let v_list = variants.iter().map(|v| v.name.clone()).collect::>().join(", "); - (format!("enum {{ {v_list} }}"), - Some(format!("Enum variants: {v_list}")), - 0.15) - } - TypeDef::Primitive(_) => { - ("primitive type".into(), None, 0.05) - } - TypeDef::Protocol { methods, .. } => { - let m_list = methods.iter().map(|m| m.name.clone()).collect::>().join(", "); - (format!("protocol {{ {m_list} }}"), - Some(format!("Protocol methods: {m_list}")), - 0.15) - } - }; - results.push(Completion { - label: type_name.clone(), - kind: CompletionKind::Type, - detail, - documentation: doc, - score: prefix_score(type_name, &prefix) + extra_score, - }); - } - } - - // Builtin functions - for &(name, sig) in BUILTIN_FUNCTIONS { - if name.to_lowercase().starts_with(&prefix.to_lowercase()) || prefix.is_empty() { - results.push(Completion { - label: name.to_string(), - kind: CompletionKind::Function, - detail: sig.into(), - documentation: Some(format!("Built-in function: {name}\n{sig}")), - score: prefix_score(name, &prefix) + 0.11, - }); - } - } - - // Functions from env (user-defined) - for (fn_name, fn_type) in &env.functions { - if fn_name.to_lowercase().starts_with(&prefix.to_lowercase()) || prefix.is_empty() { - results.push(Completion { - label: fn_name.clone(), - kind: CompletionKind::Function, - detail: fn_type.to_string(), - documentation: Some(format!("Function: {fn_name} :: {fn_type}")), - score: prefix_score(fn_name, &prefix) + 0.12, - }); - } - } - - // Sort by score descending, deduplicate by label - results.sort_by(|a, b| b.score.partial_cmp(&a.score).unwrap_or(std::cmp::Ordering::Equal)); - results.dedup_by(|a, b| a.label == b.label); - results -} - -// ── Helpers ─────────────────────────────────────────────────────────────────── - -/// Extract the identifier fragment immediately before `cursor_pos`. -fn extract_prefix(source: &str, cursor_pos: usize) -> String { - let end = cursor_pos.min(source.len()); - let bytes = source.as_bytes(); - let mut start = end; - while start > 0 && (bytes[start - 1].is_ascii_alphanumeric() || bytes[start - 1] == b'_') { - start -= 1; - } - source[start..end].to_string() -} - -/// Score based on how much of the label is matched by the prefix. -/// Returns a value in [0, 1]. -fn prefix_score(label: &str, prefix: &str) -> f32 { - if prefix.is_empty() { - return 0.5; - } - let lower_label = label.to_lowercase(); - let lower_prefix = prefix.to_lowercase(); - if lower_label.starts_with(&lower_prefix) { - // Exact prefix match — score by how complete the prefix is - (lower_prefix.len() as f32 / lower_label.len() as f32).min(1.0) - } else { - 0.0 - } -} - -fn keyword_doc(kw: &str) -> Option { - let doc = match kw { - "activate" => "Spreading-activation query: `activate TypeName where \"query\"`\nReturns `[TypeName]` from the Engram knowledge graph.", - "sealed" => "Quantum-sealed block: marks sensitive code for runtime protection.", - "let" => "Declare an immutable binding: `let name: Type = expr`", - "fn" => "Define a function: `fn name(params) -> ReturnType { body }`", - "type" => "Define a struct type: `type Name { field: Type }`", - "enum" => "Define an enum: `enum Name { Variant1, Variant2(Type) }`", - "match" => "Pattern match: `match expr { Pattern => result }`", - "return" => "Return a value from a function.", - "where" => "Used in `activate T where \"query\"`", - "if" => "Conditional: `if cond { then } else { else }`", - "else" => "Else branch of an if expression.", - "for" => "For loop: `for item in collection { body }`", - "while" => "While loop: `while cond { body }`", - "in" => "Used in `for item in collection`", - "true" | "false" => "Boolean literal", - "protocol" => "Define a protocol (trait): `protocol Name { fn method(self) -> Ret; }`", - "impl" => "Implement a protocol: `impl Protocol for Type { fn method(self) -> Ret { ... } }`", - "import" => "Import from a module: `import { Name } from \"module\"`", - "from" => "Used in import: `import { Name } from \"module\"`", - "as" => "Alias in import: `import { Name as Alias } from \"module\"`", - "with" => "With clause for retry/fallback: `with retry times 3`", - "retry" => "Retry policy: `retry times N`", - "times" => "Used in retry: `retry times N`", - "fallback" => "Fallback value on failure: `fallback { default_expr }`", - "reason" => "Reason clause: provides context to Engram reasoning engine.", - "parallel" => "Parallel execution: `parallel { task1; task2 }`", - "trace" => "Emit a trace event: `trace \"message\"`", - "requires" => "Dependency declaration: `requires Module`", - "deploy" => "Deploy declaration: `deploy service to target via method`", - "to" => "Used in deploy: `deploy X to Y`", - "via" => "Used in deploy: `deploy X via method`", - "test" => "Test declaration: `test \"name\" { assertions }`", - "seed" => "Seed data block: `seed { ... }`", - "assert" => "Assertion: `assert condition, \"message\"`", - "target" => "Target annotation: `target { ... }`", - _ => return None, - }; - Some(doc.to_string()) -} diff --git a/ide/vessels/el-lsp/src/diagnostic.rs b/ide/vessels/el-lsp/src/diagnostic.rs deleted file mode 100644 index 29bb5b0..0000000 --- a/ide/vessels/el-lsp/src/diagnostic.rs +++ /dev/null @@ -1,69 +0,0 @@ -//! Diagnostic computation — wraps el-types TypeChecker output. - -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] -pub struct Diagnostic { - /// Human-readable message. - pub message: String, - /// "error" | "warning" | "info" - pub severity: String, - /// 1-based line number (if known). - pub line: Option, - /// 1-based column (if known). - pub col: Option, -} - -impl Diagnostic { - pub fn error(message: impl Into) -> Self { - Self { message: message.into(), severity: "error".into(), line: None, col: None } - } - - pub fn warning(message: impl Into) -> Self { - Self { message: message.into(), severity: "warning".into(), line: None, col: None } - } -} - -/// Parse and type-check `source`, returning all diagnostics. -pub fn check(source: &str) -> Vec { - let mut out = Vec::new(); - - let tokens = match el_lexer::tokenize(source) { - Ok(t) => t, - Err(e) => { - out.push(Diagnostic { - message: format!("Lex error: {}", e.kind), - severity: "error".into(), - line: Some(e.span.line), - col: Some(e.span.col), - }); - return out; - } - }; - - let program = match el_parser::parse(tokens, source.to_string()) { - Ok(p) => p, - Err(e) => { - out.push(Diagnostic { - message: format!("Parse error: {}", e.kind), - severity: "error".into(), - line: Some(e.span.line), - col: Some(e.span.col), - }); - return out; - } - }; - - let mut checker = el_types::TypeChecker::with_builtins(); - checker.check(&program); - - for d in &checker.diagnostics { - if d.is_error { - out.push(Diagnostic::error(&d.message)); - } else { - out.push(Diagnostic::warning(&d.message)); - } - } - - out -} diff --git a/ide/vessels/el-lsp/src/hover.rs b/ide/vessels/el-lsp/src/hover.rs deleted file mode 100644 index 3b88453..0000000 --- a/ide/vessels/el-lsp/src/hover.rs +++ /dev/null @@ -1,139 +0,0 @@ -//! Hover information — identify the token under the cursor and return type docs. - -use serde::{Deserialize, Serialize}; - -use el_types::{TypeDef, TypeEnv}; - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct HoverInfo { - pub type_name: String, - pub documentation: String, - pub engram_node_type: Option, -} - -/// Return hover info for the token at `cursor_pos`. -pub fn hover_at(env: &TypeEnv, source: &str, cursor_pos: usize) -> Option { - let token = extract_token(source, cursor_pos); - if token.is_empty() { - return None; - } - - // Check built-in primitives - let primitive_doc = match token.as_str() { - "Int" => Some(("Int", "64-bit signed integer")), - "Float" => Some(("Float", "64-bit IEEE 754 double")), - "String" => Some(("String", "UTF-8 string")), - "Bool" => Some(("Bool", "Boolean — true or false")), - "Uuid" => Some(("Uuid", "RFC 4122 UUID")), - "Void" => Some(("Void", "Unit type — no value")), - _ => None, - }; - - if let Some((name, doc)) = primitive_doc { - return Some(HoverInfo { - type_name: name.to_string(), - documentation: doc.to_string(), - engram_node_type: None, - }); - } - - // Check user-defined types - if let Some(def) = env.types.get(&token) { - let engram_node_type = env.engram_mappings.get(&token).cloned(); - let doc = format_typedef_doc(&token, def); - return Some(HoverInfo { - type_name: token.clone(), - documentation: doc, - engram_node_type, - }); - } - - // Check functions - if let Some(fn_type) = env.functions.get(&token) { - return Some(HoverInfo { - type_name: token.clone(), - documentation: format!("fn {token} :: {fn_type}"), - engram_node_type: None, - }); - } - - // Check keywords - let kw_doc = match token.as_str() { - "activate" => Some("activate TypeName where \"query\"\nReturns [TypeName] via spreading activation over the Engram knowledge graph."), - "sealed" => Some("sealed { ... }\nMarks the block as sensitive — values are redacted from debuggers in debug builds."), - "let" => Some("let name: Type = expr\nDeclare an immutable binding."), - "fn" => Some("fn name(params) -> ReturnType { body }\nDefine a function."), - "type" => Some("type Name { field: Type }\nDefine a struct type."), - "enum" => Some("enum Name { Variant1, Variant2(Type) }\nDefine an enum."), - "match" => Some("match expr { Pattern => result }\nPattern match an expression."), - "return" => Some("return expr\nReturn a value from the enclosing function."), - _ => None, - }; - if let Some(doc) = kw_doc { - return Some(HoverInfo { - type_name: token.clone(), - documentation: doc.to_string(), - engram_node_type: None, - }); - } - - None -} - -// ── Helpers ─────────────────────────────────────────────────────────────────── - -fn extract_token(source: &str, cursor_pos: usize) -> String { - let len = source.len(); - if cursor_pos > len { - return String::new(); - } - let bytes = source.as_bytes(); - - // Expand left - let mut start = cursor_pos; - while start > 0 && (bytes[start - 1].is_ascii_alphanumeric() || bytes[start - 1] == b'_') { - start -= 1; - } - // Expand right - let mut end = cursor_pos; - while end < len && (bytes[end].is_ascii_alphanumeric() || bytes[end] == b'_') { - end += 1; - } - source[start..end].to_string() -} - -fn format_typedef_doc(name: &str, def: &TypeDef) -> String { - match def { - TypeDef::Struct { fields, .. } => { - let fields_str = fields - .iter() - .map(|(f, t)| format!(" {f}: {t}")) - .collect::>() - .join("\n"); - format!("type {name} {{\n{fields_str}\n}}") - } - TypeDef::Enum { variants, .. } => { - let variants_str = variants - .iter() - .map(|v| { - if let Some(payload) = &v.payload { - format!(" {}({})", v.name, payload) - } else { - format!(" {}", v.name) - } - }) - .collect::>() - .join("\n"); - format!("enum {name} {{\n{variants_str}\n}}") - } - TypeDef::Primitive(t) => format!("primitive type {name} = {t}"), - TypeDef::Protocol { methods, .. } => { - let methods_str = methods - .iter() - .map(|m| format!(" fn {}()", m.name)) - .collect::>() - .join("\n"); - format!("protocol {name} {{\n{methods_str}\n}}") - } - } -} diff --git a/ide/vessels/el-lsp/src/lib.rs b/ide/vessels/el-lsp/src/lib.rs deleted file mode 100644 index 988dd55..0000000 --- a/ide/vessels/el-lsp/src/lib.rs +++ /dev/null @@ -1,193 +0,0 @@ -//! el-lsp — Minimal Language Server for the Engram language. -//! -//! Provides completions, hover info, diagnostics, and a type graph. -//! Driven by the el-types type checker and el-parser AST. - -mod completion; -mod diagnostic; -mod hover; -mod type_graph; - -pub use completion::{Completion, CompletionKind}; -pub use diagnostic::Diagnostic; -pub use hover::HoverInfo; -pub use type_graph::{TypeEdge, TypeGraph, TypeNode}; - -use el_types::{TypeChecker, TypeEnv}; - -// ── LanguageServer ──────────────────────────────────────────────────────────── - -pub struct LanguageServer; - -impl LanguageServer { - pub fn new() -> Self { - Self - } - - /// Compute completions at the given cursor byte position. - pub fn complete(&self, source: &str, cursor_pos: usize) -> Vec { - let env = build_type_env(source); - completion::completions_at(&env, source, cursor_pos) - } - - /// Return hover information for the token at the given byte position. - pub fn hover(&self, source: &str, cursor_pos: usize) -> Option { - let env = build_type_env(source); - hover::hover_at(&env, source, cursor_pos) - } - - /// Run the type checker and return diagnostics. - pub fn diagnostics(&self, source: &str) -> Vec { - diagnostic::check(source) - } - - /// Build a type graph from the source. - pub fn type_graph(&self, source: &str) -> TypeGraph { - let env = build_type_env(source); - type_graph::build(&env) - } -} - -impl Default for LanguageServer { - fn default() -> Self { - Self::new() - } -} - -// ── Helpers ─────────────────────────────────────────────────────────────────── - -/// Parse source and run the type checker, returning the final TypeEnv. -fn build_type_env(source: &str) -> TypeEnv { - let tokens = match el_lexer::tokenize(source) { - Ok(t) => t, - Err(_) => return TypeEnv::with_builtins(), - }; - let program = match el_parser::parse(tokens, source.to_string()) { - Ok(p) => p, - Err(_) => return TypeEnv::with_builtins(), - }; - let mut checker = TypeChecker::with_builtins(); - checker.check(&program); - checker.env -} - -#[cfg(test)] -mod tests { - use super::*; - - const SAMPLE: &str = r#" -type Point { - x: Float - y: Float -} - -type Circle { - center: Point - radius: Float -} - -enum Color { - Red - Green - Blue - Custom(String) -} - -fn distance(a: Point, b: Point) -> Float { - let dx: Float = a.x - b.x - let dy: Float = a.y - b.y - return dx * dx + dy * dy -} - -fn main() -> Void { - let greeting: String = "Hello from Engram" - let count: Int = 42 -} -"#; - - #[test] - fn test_diagnostics_clean_source() { - let lsp = LanguageServer::new(); - let diags = lsp.diagnostics(SAMPLE); - // Should have no errors for valid source - let errors: Vec<_> = diags.iter().filter(|d| d.severity == "error").collect(); - assert!(errors.is_empty(), "unexpected errors: {errors:?}"); - } - - #[test] - fn test_diagnostics_invalid_source() { - let lsp = LanguageServer::new(); - let diags = lsp.diagnostics("let x: UnknownType = 42"); - // Should surface at least one diagnostic for unknown type - assert!(!diags.is_empty()); - } - - #[test] - fn test_type_graph_has_nodes() { - let lsp = LanguageServer::new(); - let graph = lsp.type_graph(SAMPLE); - // Should have at least the built-in types plus Point, Circle, Color - assert!(!graph.nodes.is_empty()); - let names: Vec<_> = graph.nodes.iter().map(|n| n.name.as_str()).collect(); - assert!(names.contains(&"Point"), "expected Point in type graph"); - assert!(names.contains(&"Circle"), "expected Circle in type graph"); - } - - #[test] - fn test_type_graph_has_edges() { - let lsp = LanguageServer::new(); - let graph = lsp.type_graph(SAMPLE); - // Circle has a field `center: Point` → should produce an edge - let has_circle_edge = graph - .edges - .iter() - .any(|e| e.from == "Circle" && e.to == "Point"); - assert!(has_circle_edge, "expected Circle->Point edge; edges: {:?}", graph.edges); - } - - #[test] - fn test_completions_return_keywords() { - let lsp = LanguageServer::new(); - let completions = lsp.complete("", 0); - let labels: Vec<_> = completions.iter().map(|c| c.label.as_str()).collect(); - assert!(labels.contains(&"let"), "expected 'let' keyword completion"); - assert!(labels.contains(&"fn"), "expected 'fn' keyword completion"); - } - - #[test] - fn test_completions_include_types() { - let lsp = LanguageServer::new(); - let completions = lsp.complete(SAMPLE, 0); - let labels: Vec<_> = completions.iter().map(|c| c.label.as_str()).collect(); - // User-defined types should appear - assert!(labels.contains(&"Point"), "expected Point in completions"); - } - - #[test] - fn test_hover_on_builtin_type() { - let lsp = LanguageServer::new(); - // Position at the "Float" token in the sample - let source = "let x: Float = 3.14"; - // Find the byte offset of "Float" - let pos = source.find("Float").unwrap(); - let info = lsp.hover(source, pos); - assert!(info.is_some(), "expected hover info for Float"); - let info = info.unwrap(); - assert_eq!(info.type_name, "Float"); - } - - #[test] - fn test_completions_sorted_by_score() { - let lsp = LanguageServer::new(); - let completions = lsp.complete(SAMPLE, 0); - // Completions should be sorted descending by score - for window in completions.windows(2) { - assert!( - window[0].score >= window[1].score, - "completions not sorted by score: {:?} before {:?}", - window[0], - window[1] - ); - } - } -} diff --git a/ide/vessels/el-lsp/src/type_graph.rs b/ide/vessels/el-lsp/src/type_graph.rs deleted file mode 100644 index e88ae54..0000000 --- a/ide/vessels/el-lsp/src/type_graph.rs +++ /dev/null @@ -1,174 +0,0 @@ -//! Type graph construction — nodes are types, edges are field/return/param relationships. - -use serde::{Deserialize, Serialize}; - -use el_types::{Type, TypeDef, TypeEnv}; - -// ── Data types ──────────────────────────────────────────────────────────────── - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct TypeGraph { - pub nodes: Vec, - pub edges: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct TypeNode { - pub id: String, - pub name: String, - /// "builtin" | "struct" | "enum" | "primitive" - pub kind: String, - pub fields: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct TypeEdge { - pub from: String, - pub to: String, - /// "field" | "returns" | "param" | "extends" - pub label: String, -} - -// ── Builder ─────────────────────────────────────────────────────────────────── - -const BUILTINS: &[&str] = &["Int", "Float", "String", "Bool", "Uuid", "Void"]; - -pub fn build(env: &TypeEnv) -> TypeGraph { - let mut nodes: Vec = Vec::new(); - let mut edges: Vec = Vec::new(); - - // Add all built-in types as nodes - for &name in BUILTINS { - nodes.push(TypeNode { - id: name.to_string(), - name: name.to_string(), - kind: "builtin".into(), - fields: vec![], - }); - } - - // Add user-defined types - for (type_name, def) in &env.types { - // Skip built-ins — already added - if BUILTINS.contains(&type_name.as_str()) { - continue; - } - match def { - TypeDef::Struct { fields, .. } => { - let field_strs: Vec = fields - .iter() - .map(|(f, t)| format!("{f}: {t}")) - .collect(); - - nodes.push(TypeNode { - id: type_name.clone(), - name: type_name.clone(), - kind: "struct".into(), - fields: field_strs, - }); - - // Add field edges - for (field_name, field_type) in fields { - if let Some(target) = named_type(field_type) { - edges.push(TypeEdge { - from: type_name.clone(), - to: target, - label: format!("field:{field_name}"), - }); - } - } - } - TypeDef::Enum { variants, .. } => { - let field_strs: Vec = variants - .iter() - .map(|v| { - if let Some(payload) = &v.payload { - format!("{}({})", v.name, payload) - } else { - v.name.clone() - } - }) - .collect(); - - nodes.push(TypeNode { - id: type_name.clone(), - name: type_name.clone(), - kind: "enum".into(), - fields: field_strs, - }); - - // Add variant payload edges - for v in variants { - if let Some(payload) = &v.payload { - if let Some(target) = named_type(payload) { - edges.push(TypeEdge { - from: type_name.clone(), - to: target, - label: format!("variant:{}", v.name), - }); - } - } - } - } - TypeDef::Primitive(_) => { - // Register as primitive node (e.g. user-registered aliases) - nodes.push(TypeNode { - id: type_name.clone(), - name: type_name.clone(), - kind: "primitive".into(), - fields: vec![], - }); - } - TypeDef::Protocol { methods, .. } => { - let method_strs: Vec = methods - .iter() - .map(|m| m.name.clone()) - .collect(); - nodes.push(TypeNode { - id: type_name.clone(), - name: type_name.clone(), - kind: "protocol".into(), - fields: method_strs, - }); - } - } - } - - // Add function signature edges - for (fn_name, fn_type) in &env.functions { - if let Type::Fn { params, return_type } = fn_type { - // Return edge: fn -> return type - if let Some(ret) = named_type(return_type) { - edges.push(TypeEdge { - from: fn_name.clone(), - to: ret, - label: "returns".into(), - }); - } - // Param edges: fn -> param types - for param_type in params { - if let Some(param) = named_type(param_type) { - edges.push(TypeEdge { - from: fn_name.clone(), - to: param, - label: "param".into(), - }); - } - } - } - } - - TypeGraph { nodes, edges } -} - -// ── Helpers ─────────────────────────────────────────────────────────────────── - -/// Extract the name from a Named type, or the inner type for Array/Optional. -fn named_type(ty: &Type) -> Option { - match ty { - Type::Named(n) => Some(n.clone()), - Type::Array(inner) => named_type(inner), - Type::Optional(inner) => named_type(inner), - _ => None, - } -} diff --git a/ide/vessels/el-plugin-host/Cargo.toml b/ide/vessels/el-plugin-host/Cargo.toml deleted file mode 100644 index f6661de..0000000 --- a/ide/vessels/el-plugin-host/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "el-plugin-host" -version.workspace = true -edition.workspace = true -license.workspace = true - -[dependencies] -serde = { workspace = true } -serde_json = { workspace = true } -thiserror = { workspace = true } diff --git a/ide/vessels/el-plugin-host/src/lib.rs b/ide/vessels/el-plugin-host/src/lib.rs deleted file mode 100644 index 789aa15..0000000 --- a/ide/vessels/el-plugin-host/src/lib.rs +++ /dev/null @@ -1,253 +0,0 @@ -//! el-plugin-host — Plugin lifecycle management for el-ide. -//! -//! Manages installation, removal, and querying of IDE plugins. -//! First-party plugins are pre-registered; a plugin registry server -//! is required for third-party installation (not yet live). - -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use thiserror::Error; - -// ── Types ───────────────────────────────────────────────────────────────────── - -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] -#[serde(rename_all = "snake_case")] -pub enum PluginHook { - OnSave, - OnBuild, - OnBuildComplete, - CustomPanel, - CustomTool, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Plugin { - pub name: String, - pub version: String, - pub description: String, - pub installed: bool, - pub enabled: bool, - pub hooks: Vec, - /// Whether this is a first-party Neuron Technologies plugin. - pub first_party: bool, -} - -#[derive(Debug, Error)] -pub enum PluginError { - #[error("plugin '{0}' not found")] - NotFound(String), - #[error("plugin '{0}' is already installed")] - AlreadyInstalled(String), - #[error("plugin registry is not available (registry URL not configured)")] - RegistryUnavailable, - #[error("plugin '{0}' cannot be removed: it is a required built-in")] - BuiltIn(String), -} - -// ── PluginHost ──────────────────────────────────────────────────────────────── - -pub struct PluginHost { - plugins: HashMap, -} - -impl PluginHost { - /// Create a PluginHost pre-populated with first-party plugins. - pub fn new() -> Self { - let mut host = Self { plugins: HashMap::new() }; - host.register_first_party_plugins(); - host - } - - // ── Public API ──────────────────────────────────────────────────────────── - - pub fn list(&self) -> Vec { - let mut plugins: Vec = self.plugins.values().cloned().collect(); - plugins.sort_by(|a, b| a.name.cmp(&b.name)); - plugins - } - - /// Install a plugin by name. - /// - /// For first-party plugins, this marks them as installed. - /// For third-party, registry access is required (not yet implemented). - pub fn install(&mut self, name: &str) -> Result { - if let Some(plugin) = self.plugins.get_mut(name) { - if plugin.installed { - return Err(PluginError::AlreadyInstalled(name.to_string())); - } - plugin.installed = true; - plugin.enabled = true; - Ok(plugin.clone()) - } else { - Err(PluginError::RegistryUnavailable) - } - } - - /// Remove a plugin. - pub fn remove(&mut self, name: &str) -> Result<(), PluginError> { - match self.plugins.get_mut(name) { - None => Err(PluginError::NotFound(name.to_string())), - Some(p) => { - if p.name == "el-theme-dark" { - return Err(PluginError::BuiltIn(name.to_string())); - } - p.installed = false; - p.enabled = false; - Ok(()) - } - } - } - - pub fn enable(&mut self, name: &str) -> Result<(), PluginError> { - self.plugins - .get_mut(name) - .ok_or_else(|| PluginError::NotFound(name.to_string())) - .map(|p| { p.enabled = true; }) - } - - pub fn disable(&mut self, name: &str) -> Result<(), PluginError> { - self.plugins - .get_mut(name) - .ok_or_else(|| PluginError::NotFound(name.to_string())) - .map(|p| { p.enabled = false; }) - } - - pub fn get(&self, name: &str) -> Option<&Plugin> { - self.plugins.get(name) - } - - // ── First-party plugins ─────────────────────────────────────────────────── - - fn register_first_party_plugins(&mut self) { - let plugins = vec![ - Plugin { - name: "el-theme-dark".into(), - version: "1.0.0".into(), - description: "Dark theme — the default Engram IDE theme.".into(), - installed: true, - enabled: true, - hooks: vec![], - first_party: true, - }, - Plugin { - name: "el-theme-light".into(), - version: "1.0.0".into(), - description: "Light theme for high-ambient-light environments.".into(), - installed: false, - enabled: false, - hooks: vec![], - first_party: true, - }, - Plugin { - name: "el-fmt".into(), - version: "0.1.0".into(), - description: "Code formatter — auto-formats .el files on save.".into(), - installed: true, - enabled: true, - hooks: vec![PluginHook::OnSave], - first_party: true, - }, - Plugin { - name: "el-doc".into(), - version: "0.1.0".into(), - description: "Documentation generator — produces HTML docs from type definitions.".into(), - installed: false, - enabled: false, - hooks: vec![PluginHook::CustomTool], - first_party: true, - }, - Plugin { - name: "el-test".into(), - version: "0.1.0".into(), - description: "Test runner with inline results displayed in the editor gutter.".into(), - installed: false, - enabled: false, - hooks: vec![PluginHook::OnBuildComplete, PluginHook::CustomPanel], - first_party: true, - }, - ]; - - for plugin in plugins { - self.plugins.insert(plugin.name.clone(), plugin); - } - } -} - -impl Default for PluginHost { - fn default() -> Self { - Self::new() - } -} - -// ── Tests ───────────────────────────────────────────────────────────────────── - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_list_returns_all_first_party() { - let host = PluginHost::new(); - let plugins = host.list(); - assert_eq!(plugins.len(), 5); - } - - #[test] - fn test_dark_theme_installed_by_default() { - let host = PluginHost::new(); - let plugin = host.get("el-theme-dark").unwrap(); - assert!(plugin.installed); - assert!(plugin.enabled); - } - - #[test] - fn test_install_uninstalled_plugin() { - let mut host = PluginHost::new(); - let result = host.install("el-doc"); - assert!(result.is_ok()); - let plugin = host.get("el-doc").unwrap(); - assert!(plugin.installed); - assert!(plugin.enabled); - } - - #[test] - fn test_install_already_installed_errors() { - let mut host = PluginHost::new(); - let result = host.install("el-theme-dark"); - assert!(matches!(result, Err(PluginError::AlreadyInstalled(_)))); - } - - #[test] - fn test_remove_plugin() { - let mut host = PluginHost::new(); - host.install("el-fmt").ok(); // already installed - let result = host.remove("el-fmt"); - assert!(result.is_ok()); - let plugin = host.get("el-fmt").unwrap(); - assert!(!plugin.installed); - } - - #[test] - fn test_remove_builtin_errors() { - let mut host = PluginHost::new(); - let result = host.remove("el-theme-dark"); - assert!(matches!(result, Err(PluginError::BuiltIn(_)))); - } - - #[test] - fn test_remove_nonexistent_errors() { - let mut host = PluginHost::new(); - let result = host.remove("el-nonexistent"); - assert!(matches!(result, Err(PluginError::NotFound(_)))); - } - - #[test] - fn test_enable_disable() { - let mut host = PluginHost::new(); - host.disable("el-theme-dark").unwrap(); - assert!(!host.get("el-theme-dark").unwrap().enabled); - host.enable("el-theme-dark").unwrap(); - assert!(host.get("el-theme-dark").unwrap().enabled); - } -}