diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5ed4a6950..fe91be7d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -92,7 +92,7 @@ Note that the output is truncated at 100KB. This can be adjusted for the purpose When running Zellij with the `--debug` flag, Zellij will dump a copy of all bytes received over the pty for each pane in: `/$temp_dir/zellij-/zellij-log/zellij-.log`. These might be useful when troubleshooting terminal issues. ## Testing plugins -Zellij allows the use of the [Singlepass](https://crates.io/crates/wasmer-compiler-singlepass) compiler for wasmer. This can enable great gains in compilation time of plugins in detriment of stability, notably on Arm64 architectures. +Zellij allows the use of the singlepass [Winch](https://crates.io/crates/wasmtime-winch) compiler for wasmtime. This can enable great gains in compilation time of plugins at the cost of slower execution and less supported architectures. To enable the singlepass compiler, use the `singlepass` flag. E.g.: ```sh @@ -113,7 +113,7 @@ If you are new contributor to `Zellij` going through [Discord server][discord-invite-link], we would be happy to help finding something interesting to work on and guide through. -[discord-invite-link]: https://discord.gg/feHDHahHCz +[discord-invite-link]: https://discord.gg/feHDHahHCz [good-first-issue]: https://github.com/zellij-org/zellij/labels/good%20first%20issue diff --git a/Cargo.lock b/Cargo.lock index f32923172..2803fb4cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,16 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "gimli", + "gimli 0.26.1", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli 0.28.1", ] [[package]] @@ -73,13 +82,14 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "getrandom 0.2.10", + "cfg-if", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -100,6 +110,21 @@ dependencies = [ "memchr", ] +[[package]] +name = "ambient-authority" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "ansi_term" version = "0.12.1" @@ -118,6 +143,12 @@ dependencies = [ "backtrace", ] +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + [[package]] name = "arc-swap" version = "1.5.0" @@ -194,7 +225,7 @@ checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock", "autocfg", - "cfg-if 1.0.0", + "cfg-if", "concurrent-queue 2.2.0", "futures-lite", "log", @@ -202,7 +233,7 @@ dependencies = [ "polling", "rustix 0.37.7", "slab", - "socket2", + "socket2 0.4.9", "waker-fn", ] @@ -223,7 +254,7 @@ checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c" dependencies = [ "async-io", "blocking", - "cfg-if 1.0.0", + "cfg-if", "event-listener", "futures-lite", "libc", @@ -269,13 +300,13 @@ checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" [[package]] name = "async-trait" -version = "0.1.56" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 1.0.96", + "syn 2.0.64", ] [[package]] @@ -313,12 +344,12 @@ version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" dependencies = [ - "addr2line", + "addr2line 0.17.0", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.28.4", "rustc-demangle", ] @@ -441,9 +472,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.10.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byte-tools" @@ -451,27 +482,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" -[[package]] -name = "bytecheck" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d11cac2c12b5adc6570dad2ee1b87eff4955dac476fe12d81e5fdd352e52406f" -dependencies = [ - "bytecheck_derive", - "ptr_meta", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e576ebe98e605500b3c8041bb888e966653577172df6dd97398714eb30b9bf" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.96", -] - [[package]] name = "byteorder" version = "1.4.3" @@ -486,9 +496,9 @@ checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "bytes" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cache-padded" @@ -496,6 +506,83 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" +[[package]] +name = "cap-fs-ext" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc2d2954524be4866aaa720f008fba9995de54784957a1b0e0119992d6d5e52" +dependencies = [ + "cap-primitives", + "cap-std", + "io-lifetimes 2.0.3", + "windows-sys 0.52.0", +] + +[[package]] +name = "cap-net-ext" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799c81d79ea9c71a1438efd417c788214bc9e7986046d3710b6bbe60da4d8275" +dependencies = [ + "cap-primitives", + "cap-std", + "rustix 0.38.34", + "smallvec", +] + +[[package]] +name = "cap-primitives" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00172660727e2d7f808e7cc2bfffd093fdb3ea2ff2ef819289418a3c3ffab5ac" +dependencies = [ + "ambient-authority", + "fs-set-times", + "io-extras", + "io-lifetimes 2.0.3", + "ipnet", + "maybe-owned", + "rustix 0.38.34", + "windows-sys 0.52.0", + "winx", +] + +[[package]] +name = "cap-rand" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "270f1d341a2afc62604f8f688bee4e444d052b7a74c1458dd3aa7efb47d4077f" +dependencies = [ + "ambient-authority", + "rand 0.8.5", +] + +[[package]] +name = "cap-std" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cd9187bb3f7478a4c135ea10473a41a5f029d2ac800c1adf64f35ec7d4c8603" +dependencies = [ + "cap-primitives", + "io-extras", + "io-lifetimes 2.0.3", + "rustix 0.38.34", +] + +[[package]] +name = "cap-time-ext" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91666f31e30c85b1d2ee8432c90987f752c45f5821f5638027b41e73e16a395b" +dependencies = [ + "ambient-authority", + "cap-primitives", + "iana-time-zone", + "once_cell", + "rustix 0.38.34", + "winx", +] + [[package]] name = "cassowary" version = "0.3.0" @@ -508,15 +595,10 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ + "jobserver", "libc", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -561,7 +643,7 @@ dependencies = [ "bitflags 1.3.2", "clap_derive", "clap_lex", - "indexmap", + "indexmap 1.8.2", "once_cell", "strsim", "termcolor", @@ -605,10 +687,16 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bc416f33de9d59e79e57560f450d21ff8393adcf1cdfc3e6d8fb93d5f88a2ed" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", ] +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + [[package]] name = "colored" version = "2.0.0" @@ -706,16 +794,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] -name = "corosensei" -version = "0.1.3" +name = "cpp_demangle" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9847f90f32a50b0dcbd68bc23ff242798b13080b97b0569f6ed96a45ce4cf2cd" +checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "libc", - "scopeguard", - "windows-sys 0.33.0", + "cfg-if", ] [[package]] @@ -735,57 +819,74 @@ checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" [[package]] name = "cranelift-bforest" -version = "0.86.1" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "529ffacce2249ac60edba2941672dfedf3d96558b415d0d8083cd007456e0f55" +checksum = "29daf137addc15da6bab6eae2c4a11e274b1d270bf2759508e62f6145e863ef6" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.86.1" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427d105f617efc8cb55f8d036a7fded2e227892d8780b4985e5551f8d27c4a92" +checksum = "de619867d5de4c644b7fd9904d6e3295269c93d8a71013df796ab338681222d4" dependencies = [ + "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", + "cranelift-control", "cranelift-entity", "cranelift-isle", - "gimli", + "gimli 0.28.1", + "hashbrown 0.14.5", "log", "regalloc2", + "rustc-hash", "smallvec", "target-lexicon", ] [[package]] name = "cranelift-codegen-meta" -version = "0.86.1" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551674bed85b838d45358e3eab4f0ffaa6790c70dc08184204b9a54b41cdb7d1" +checksum = "29f5cf277490037d8dae9513d35e0ee8134670ae4a964a5ed5b198d4249d7c10" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.86.1" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b3a63ae57498c3eb495360944a33571754241e15e47e3bcae6082f40fec5866" +checksum = "8c3e22ecad1123343a3c09ac6ecc532bb5c184b6fcb7888df0ea953727f79924" + +[[package]] +name = "cranelift-control" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53ca3ec6d30bce84ccf59c81fead4d16381a3ef0ef75e8403bc1e7385980da09" +dependencies = [ + "arbitrary", +] [[package]] name = "cranelift-entity" -version = "0.86.1" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11aa8aa624c72cc1c94ea3d0739fa61248260b5b14d3646f51593a88d67f3e6e" +checksum = "7eabb8d36b0ca8906bec93c78ea516741cac2d7e6b266fa7b0ffddcc09004990" +dependencies = [ + "serde", + "serde_derive", +] [[package]] name = "cranelift-frontend" -version = "0.86.1" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "544ee8f4d1c9559c9aa6d46e7aaeac4a13856d620561094f35527356c7d21bd0" +checksum = "44b42630229e49a8cfcae90bdc43c8c4c08f7a7aa4618b67f79265cd2f996dd2" dependencies = [ "cranelift-codegen", "log", @@ -795,9 +896,45 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.86.1" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed16b14363d929b8c37e3c557d0a7396791b383ecc302141643c054343170aad" +checksum = "918d1e36361805dfe0b6cdfd5a5ffdb5d03fa796170c5717d2727cbe623b93a0" + +[[package]] +name = "cranelift-native" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75aea85a0d7e1800b14ce9d3f53adf8ad4d1ee8a9e23b0269bdc50285e93b9b3" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac491fd3473944781f0cf9528c90cc899d18ad438da21961a839a3a44d57dfb" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools 0.12.1", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +dependencies = [ + "cfg-if", +] [[package]] name = "crossbeam" @@ -805,7 +942,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-channel", "crossbeam-deque", "crossbeam-epoch", @@ -819,7 +956,7 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -829,7 +966,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] @@ -841,7 +978,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", "lazy_static", "memoffset 0.6.5", @@ -854,7 +991,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -864,7 +1001,7 @@ version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -927,7 +1064,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "socket2", + "socket2 0.4.9", "winapi", ] @@ -957,37 +1094,12 @@ dependencies = [ ] [[package]] -name = "darling" -version = "0.13.4" +name = "debugid" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "syn 1.0.96", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn 1.0.96", + "uuid", ] [[package]] @@ -1062,6 +1174,16 @@ dependencies = [ "dirs-sys 0.4.1", ] +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + [[package]] name = "dirs" version = "4.0.0" @@ -1094,6 +1216,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "discard" version = "1.0.4" @@ -1106,38 +1239,18 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "210ec60ae7d710bed8683e333e9d2855a8a56a3e9892b38bad3bb0d4d29b0d5e" -[[package]] -name = "dynasm" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add9a102807b524ec050363f09e06f1504214b0e1c7797f64261c891022dce8b" -dependencies = [ - "bitflags 1.3.2", - "byteorder", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.96", -] - -[[package]] -name = "dynasmrt" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64fba5a42bd76a17cad4bfa00de168ee1cbfa06a5e8ce992ae880218c05641a9" -dependencies = [ - "byteorder", - "dynasm", - "memmap2", -] - [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + [[package]] name = "encode_unicode" version = "0.3.6" @@ -1145,45 +1258,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] -name = "enum-iterator" -version = "0.7.0" +name = "encoding_rs" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ - "enum-iterator-derive", + "cfg-if", ] [[package]] -name = "enum-iterator-derive" -version = "0.7.0" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.96", -] - -[[package]] -name = "enumset" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea83a3fbdc1d999ccfbcbee717eab36f8edf2d71693a23ce0d7cca19e085304c" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 1.0.96", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" @@ -1237,9 +1324,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fallible-iterator" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fancy-regex" @@ -1266,6 +1353,17 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +[[package]] +name = "fd-lock" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e5768da2206272c81ef0b5e951a41862938a6070da63bcea197899942d3b947" +dependencies = [ + "cfg-if", + "rustix 0.38.34", + "windows-sys 0.52.0", +] + [[package]] name = "file-id" version = "0.1.0" @@ -1292,7 +1390,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall 0.2.13", "windows-sys 0.48.0", @@ -1338,14 +1436,24 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "matches", "percent-encoding", ] +[[package]] +name = "fs-set-times" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "033b337d725b97690d86893f9de22b67b80dcc4e9ad815f348254c38119db8fb" +dependencies = [ + "io-lifetimes 2.0.3", + "rustix 0.38.34", + "windows-sys 0.52.0", +] + [[package]] name = "fsevent-sys" version = "4.1.0" @@ -1426,7 +1534,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.64", ] [[package]] @@ -1478,12 +1586,16 @@ dependencies = [ ] [[package]] -name = "generational-arena" -version = "0.2.8" +name = "fxprof-processed-profile" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d3b771574f62d0548cee0ad9057857e9fc25d7a3335f140c84f6acd0bf601" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" dependencies = [ - "cfg-if 0.1.10", + "bitflags 2.5.0", + "debugid", + "fxhash", + "serde", + "serde_json", ] [[package]] @@ -1520,7 +1632,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] @@ -1531,7 +1643,7 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] @@ -1562,9 +1674,15 @@ name = "gimli" version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ "fallible-iterator", - "indexmap", + "indexmap 2.2.6", "stable_deref_trait", ] @@ -1601,9 +1719,18 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", ] @@ -1676,7 +1803,7 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ - "bytes 1.4.0", + "bytes 1.6.0", "fnv", "itoa", ] @@ -1689,7 +1816,7 @@ checksum = "1947510dc91e2bf586ea5ffb412caad7673264e14bb39fb9078da114a94ce1a5" dependencies = [ "async-std", "async-trait", - "cfg-if 1.0.0", + "cfg-if", "http-types", "isahc", "log", @@ -1723,25 +1850,41 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "id-arena" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" -version = "0.2.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "matches", "unicode-bidi", "unicode-normalization", ] @@ -1792,6 +1935,17 @@ dependencies = [ "hashbrown 0.11.2", ] +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] + [[package]] name = "infer" version = "0.2.3" @@ -1838,7 +1992,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1848,7 +2002,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81f2533f3be42fffe3b5e63b71aeca416c1c3bc33e4e27be018521e76b1f38fb" dependencies = [ "blocking", - "cfg-if 1.0.0", + "cfg-if", "futures-core", "futures-io", "intmap", @@ -1877,6 +2031,16 @@ dependencies = [ "ghost", ] +[[package]] +name = "io-extras" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9f046b9af244f13b3bd939f55d16830ac3a201e8a9ba9661bfcb03e2be72b9b" +dependencies = [ + "io-lifetimes 2.0.3", + "windows-sys 0.52.0", +] + [[package]] name = "io-lifetimes" version = "1.0.10" @@ -1888,6 +2052,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "io-lifetimes" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c" + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + [[package]] name = "is-terminal" version = "0.4.7" @@ -1895,7 +2071,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", - "io-lifetimes", + "io-lifetimes 1.0.10", "rustix 0.37.7", "windows-sys 0.48.0", ] @@ -1938,12 +2114,50 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +[[package]] +name = "ittapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" +dependencies = [ + "cc", +] + +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.64" @@ -2023,6 +2237,12 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "libnghttp2-sys" version = "0.1.8+1.55.1" @@ -2093,7 +2313,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "serde", "value-bag", ] @@ -2141,10 +2361,10 @@ dependencies = [ ] [[package]] -name = "mach" -version = "0.3.2" +name = "mach2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" dependencies = [ "libc", ] @@ -2156,10 +2376,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] -name = "matches" -version = "0.1.9" +name = "maybe-owned" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" [[package]] name = "memchr" @@ -2168,12 +2388,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] -name = "memmap2" -version = "0.5.7" +name = "memfd" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "libc", + "rustix 0.38.34", ] [[package]] @@ -2238,7 +2458,7 @@ checksum = "4c65c625186a9bcce6699394bee511e1b1aec689aa7e3be1bf4e996e75834153" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.64", ] [[package]] @@ -2287,14 +2507,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2306,12 +2526,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "more-asserts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" - [[package]] name = "multimap" version = "0.8.3" @@ -2335,7 +2549,7 @@ checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" dependencies = [ "bitflags 1.3.2", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset 0.6.5", ] @@ -2347,7 +2561,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset 0.7.1", "pin-utils", @@ -2360,7 +2574,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ "bitflags 2.5.0", - "cfg-if 1.0.0", + "cfg-if", "cfg_aliases", "libc", "memoffset 0.9.1", @@ -2389,7 +2603,7 @@ dependencies = [ "inotify", "kqueue", "libc", - "mio 0.8.6", + "mio 0.8.11", "walkdir", "windows-sys 0.45.0", ] @@ -2465,6 +2679,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "object" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8dd6c0cdf9429bce006e1362bfce61fa1bfd8c898a643ed8d2b471934701d3d" +dependencies = [ + "crc32fast", + "hashbrown 0.14.5", + "indexmap 2.2.6", + "memchr", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -2589,7 +2815,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall 0.2.13", @@ -2603,7 +2829,7 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall 0.4.1", "smallvec", @@ -2618,9 +2844,9 @@ checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" @@ -2672,7 +2898,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 1.8.2", ] [[package]] @@ -2744,14 +2970,14 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.64", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -2771,7 +2997,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-ffi", @@ -2789,6 +3015,17 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "postcard" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +dependencies = [ + "cobs", + "embedded-io", + "serde", +] + [[package]] name = "ppv-lite86" version = "0.2.16" @@ -2847,9 +3084,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -2860,7 +3097,7 @@ version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ - "bytes 1.4.0", + "bytes 1.6.0", "prost-derive", ] @@ -2870,9 +3107,9 @@ version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ - "bytes 1.4.0", + "bytes 1.6.0", "heck 0.4.0", - "itertools", + "itertools 0.10.5", "lazy_static", "log", "multimap", @@ -2893,7 +3130,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "syn 1.0.96", @@ -2909,41 +3146,19 @@ dependencies = [ ] [[package]] -name = "ptr_meta" -version = "0.1.4" +name = "psm" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.96", -] - -[[package]] -name = "pulldown-cmark" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" -dependencies = [ - "bitflags 1.3.2", - "memchr", - "unicase", + "cc", ] [[package]] name = "quote" -version = "1.0.27" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -3074,12 +3289,13 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.3.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43a209257d978ef079f3d446331d0f1794f5e0fc19b306a199983857833a779" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" dependencies = [ - "fxhash", + "hashbrown 0.13.2", "log", + "rustc-hash", "slice-group-by", "smallvec", ] @@ -3101,53 +3317,6 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" -[[package]] -name = "region" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" -dependencies = [ - "bitflags 1.3.2", - "libc", - "mach", - "winapi", -] - -[[package]] -name = "rend" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79af64b4b6362ffba04eef3a4e10829718a4896dac19daa741851c86781edf95" -dependencies = [ - "bytecheck", -] - -[[package]] -name = "rkyv" -version = "0.7.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15" -dependencies = [ - "bytecheck", - "hashbrown 0.12.3", - "indexmap", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eaedadc88b53e36dd32d940ed21ae4d850d5916f2581526921f553a72ac34c4" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.96", -] - [[package]] name = "rmp" version = "0.8.11" @@ -3176,6 +3345,12 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" @@ -3202,7 +3377,7 @@ checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" dependencies = [ "bitflags 1.3.2", "errno", - "io-lifetimes", + "io-lifetimes 1.0.10", "libc", "linux-raw-sys 0.3.7", "windows-sys 0.45.0", @@ -3216,8 +3391,10 @@ checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", + "itoa", "libc", "linux-raw-sys 0.4.13", + "once_cell", "windows-sys 0.52.0", ] @@ -3251,12 +3428,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "semver" version = "0.9.0" @@ -3298,9 +3469,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.137" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] @@ -3315,26 +3486,15 @@ dependencies = [ "serde", ] -[[package]] -name = "serde-wasm-bindgen" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn 1.0.96", + "syn 2.0.64", ] [[package]] @@ -3359,6 +3519,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3377,7 +3546,7 @@ version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" dependencies = [ - "indexmap", + "indexmap 1.8.2", "ryu", "serde", "yaml-rust", @@ -3430,7 +3599,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", @@ -3442,7 +3611,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.7", ] @@ -3453,6 +3622,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +[[package]] +name = "shellexpand" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" +dependencies = [ + "dirs", +] + [[package]] name = "shellexpand" version = "3.0.0" @@ -3537,9 +3715,12 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.8.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] [[package]] name = "smawk" @@ -3557,6 +3738,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "spinning" version = "0.1.0" @@ -3575,6 +3766,12 @@ dependencies = [ "lock_api", ] +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + [[package]] name = "ssh2" version = "0.9.3" @@ -3768,7 +3965,7 @@ checksum = "718b1ae6b50351982dedff021db0def601677f2120938b070eadb10ba4038dd7" dependencies = [ "async-std", "async-trait", - "cfg-if 1.0.0", + "cfg-if", "futures-util", "getrandom 0.2.10", "http-client", @@ -3794,9 +3991,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f" dependencies = [ "proc-macro2", "quote", @@ -3809,7 +4006,7 @@ version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f1bfab07306a27332451a662ca9c8156e3a9986f82660ba9c8e744fe8455d43" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "core-foundation-sys", "libc", "ntapi", @@ -3818,6 +4015,22 @@ dependencies = [ "winapi", ] +[[package]] +name = "system-interface" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b858526d22750088a9b3cf2e3c2aacebd5377f13adeec02860c30d09113010a6" +dependencies = [ + "bitflags 2.5.0", + "cap-fs-ext", + "cap-std", + "fd-lock", + "io-lifetimes 2.0.3", + "rustix 0.38.34", + "windows-sys 0.52.0", + "winx", +] + [[package]] name = "tab-bar" version = "0.1.0" @@ -3831,9 +4044,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.5" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tempfile" @@ -3841,7 +4054,7 @@ version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand 2.1.0", "rustix 0.38.34", "windows-sys 0.52.0", @@ -3945,22 +4158,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.64", ] [[package]] @@ -3980,7 +4193,7 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -4054,6 +4267,22 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7c4ceeeca15c8384bbc3e011dbd8fccb7f068a440b752b7d9b32ceb0ca0e2e8" +[[package]] +name = "tokio" +version = "1.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +dependencies = [ + "backtrace", + "bytes 1.6.0", + "libc", + "mio 0.8.11", + "num_cpus", + "pin-project-lite", + "socket2 0.5.7", + "windows-sys 0.48.0", +] + [[package]] name = "toml" version = "0.5.10" @@ -4063,13 +4292,47 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +dependencies = [ + "indexmap 2.2.6", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tracing" version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -4162,9 +4425,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -4183,9 +4446,9 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -4229,13 +4492,12 @@ dependencies = [ [[package]] name = "url" -version = "2.2.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", - "matches", "percent-encoding", "serde", ] @@ -4359,7 +4621,7 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -4374,40 +4636,17 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.64", "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-downcast" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dac026d43bcca6e7ce1c0956ba68f59edf6403e8e930a5d891be72c31a44340" -dependencies = [ - "js-sys", - "once_cell", - "wasm-bindgen", - "wasm-bindgen-downcast-macros", -] - -[[package]] -name = "wasm-bindgen-downcast-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5020cfa87c7cecefef118055d44e3c1fc122c7ec25701d528ee458a0b45f38f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.96", -] - [[package]] name = "wasm-bindgen-futures" version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -4431,7 +4670,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.64", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4444,318 +4683,337 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-encoder" -version = "0.13.0" +version = "0.207.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f0c17267a5ffd6ae3d897589460e21db1673c84fb7016b909c9691369a75ea" +checksum = "d996306fb3aeaee0d9157adbe2f670df0236caf19f6728b221e92d0f27b3fe17" dependencies = [ "leb128", ] -[[package]] -name = "wasmer" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "840af6d21701220cb805dc7201af301cb99e9b4f646f48a41befbc1d949f0f90" -dependencies = [ - "bytes 1.4.0", - "cfg-if 1.0.0", - "indexmap", - "js-sys", - "more-asserts", - "serde", - "serde-wasm-bindgen", - "target-lexicon", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-downcast", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-compiler-singlepass", - "wasmer-derive", - "wasmer-types", - "wasmer-vm", - "wat", - "winapi", -] - -[[package]] -name = "wasmer-compiler" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b86fab98beaaace77380cb04e681773739473860d1b8499ea6b14f920923e0c5" -dependencies = [ - "backtrace", - "cfg-if 1.0.0", - "enum-iterator", - "enumset", - "lazy_static", - "leb128", - "memmap2", - "more-asserts", - "region", - "rustc-demangle", - "smallvec", - "thiserror", - "wasmer-types", - "wasmer-vm", - "wasmparser", - "winapi", -] - -[[package]] -name = "wasmer-compiler-cranelift" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015eef629fc84889540dc1686bd7fa524b93da9fd2d275b16c49dbe96268e58f" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "gimli", - "more-asserts", - "rayon", - "smallvec", - "target-lexicon", - "tracing", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-compiler-singlepass" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e235ccc192d5f39147e8a430f48040dcfeebc1f1b0d979d2232ec1618d255c" -dependencies = [ - "byteorder", - "dynasm", - "dynasmrt", - "enumset", - "gimli", - "lazy_static", - "more-asserts", - "rayon", - "smallvec", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-derive" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff577b7c1cfcd3d7c5b3a09fe1a499b73f7c17084845ff71225c8250a6a63a9" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.96", -] - -[[package]] -name = "wasmer-types" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9600f9da966abae3be0b0a4560e7d1f2c88415a2d01ce362ac06063cb1c473" -dependencies = [ - "enum-iterator", - "enumset", - "indexmap", - "more-asserts", - "rkyv", - "target-lexicon", - "thiserror", -] - -[[package]] -name = "wasmer-vbus" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b42f76b9f09c68084de3a35fdf4907609f4b5005ecf3767fa1839a669dcbdb" -dependencies = [ - "thiserror", - "wasmer-vfs", -] - -[[package]] -name = "wasmer-vfs" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34bfbd243503d64aed4fc8a194657a561cae6c2d782dbcf649211d7f4db9e413" -dependencies = [ - "libc", - "thiserror", - "tracing", -] - -[[package]] -name = "wasmer-vm" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc68a7f0a003e6cb63845b7510065097d289553201d64afb9a5e1744da3c6a0" -dependencies = [ - "backtrace", - "cc", - "cfg-if 1.0.0", - "corosensei", - "enum-iterator", - "indexmap", - "lazy_static", - "libc", - "mach", - "memoffset 0.6.5", - "more-asserts", - "region", - "scopeguard", - "thiserror", - "wasmer-types", - "winapi", -] - -[[package]] -name = "wasmer-vnet" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bc4fe3b48ccc620901bdcdfac98d8a76ef3487412c221752814750c2e7db4c1" -dependencies = [ - "bytes 1.4.0", - "thiserror", - "wasmer-vfs", -] - -[[package]] -name = "wasmer-wasi" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e893ecd57c63db83b17dacfaee90f660e1d7f5b26d2f9d88ea6aa2e8c4bc301d" -dependencies = [ - "bytes 1.4.0", - "cfg-if 1.0.0", - "derivative", - "generational-arena", - "getrandom 0.2.10", - "libc", - "thiserror", - "tracing", - "wasm-bindgen", - "wasmer", - "wasmer-vbus", - "wasmer-vfs", - "wasmer-vnet", - "wasmer-wasi-local-networking", - "wasmer-wasi-types", - "winapi", -] - -[[package]] -name = "wasmer-wasi-local-networking" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd65882d8cee793848776f26e979b7ff3e139d927947d87304c940c89527a730" -dependencies = [ - "bytes 1.4.0", - "tracing", - "wasmer-vfs", - "wasmer-vnet", -] - -[[package]] -name = "wasmer-wasi-types" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1afdec83c62d22bf7110b83d662a08f708332fd728a213399919a045a1061d4" -dependencies = [ - "byteorder", - "time 0.2.27", - "wasmer", - "wasmer-derive", - "wasmer-types", - "wasmer-wit-bindgen-gen-core", - "wasmer-wit-bindgen-gen-rust-wasm", - "wasmer-wit-bindgen-rust", - "wasmer-wit-parser", -] - -[[package]] -name = "wasmer-wit-bindgen-gen-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff8aa5be5ae5d61f5e151dc2c0e603093fe28395d2083b65ef7a3547844054fe" -dependencies = [ - "anyhow", - "wasmer-wit-parser", -] - -[[package]] -name = "wasmer-wit-bindgen-gen-rust" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "438bce7c4589842bf100cc9b312443a9b5fc6440e58ab0b8c114e460219c3c3b" -dependencies = [ - "heck 0.3.3", - "wasmer-wit-bindgen-gen-core", -] - -[[package]] -name = "wasmer-wit-bindgen-gen-rust-wasm" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "505f5168cfee591840e13e158a5c5e2f95d6df1df710839021564f36bee7bafc" -dependencies = [ - "heck 0.3.3", - "wasmer-wit-bindgen-gen-core", - "wasmer-wit-bindgen-gen-rust", -] - -[[package]] -name = "wasmer-wit-bindgen-rust" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968747f1271f74aab9b70d9c5d4921db9bd13b4ec3ba5506506e6e7dc58c918c" -dependencies = [ - "async-trait", - "bitflags 1.3.2", - "wasmer-wit-bindgen-rust-impl", -] - -[[package]] -name = "wasmer-wit-bindgen-rust-impl" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd26fe00d08bd2119870b017d13413dfbd51e7750b6634d649fc7a7bbc057b85" -dependencies = [ - "proc-macro2", - "syn 1.0.96", - "wasmer-wit-bindgen-gen-core", - "wasmer-wit-bindgen-gen-rust-wasm", -] - -[[package]] -name = "wasmer-wit-parser" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46c9a15086be8a2eb3790613902b9d3a9a687833b17cd021de263a20378585a" -dependencies = [ - "anyhow", - "id-arena", - "pulldown-cmark", - "unicode-normalization", - "unicode-xid", -] - [[package]] name = "wasmparser" -version = "0.83.0" +version = "0.207.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" +checksum = "e19bb9f8ab07616da582ef8adb24c54f1424c7ec876720b7da9db8ec0626c92c" +dependencies = [ + "ahash", + "bitflags 2.5.0", + "hashbrown 0.14.5", + "indexmap 2.2.6", + "semver 1.0.17", +] + +[[package]] +name = "wasmprinter" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2d8a7b4dabb460208e6b4334d9db5766e84505038b2529e69c3d07ac619115" +dependencies = [ + "anyhow", + "wasmparser", +] + +[[package]] +name = "wasmtime" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92a1370c66a0022e6d92dcc277e2c84f5dece19569670b8ce7db8162560d8b6" +dependencies = [ + "addr2line 0.21.0", + "anyhow", + "async-trait", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "gimli 0.28.1", + "hashbrown 0.14.5", + "indexmap 2.2.6", + "ittapi", + "libc", + "libm", + "log", + "mach2", + "memfd", + "memoffset 0.9.1", + "object 0.33.0", + "once_cell", + "paste", + "postcard", + "psm", + "rayon", + "rustix 0.38.34", + "semver 1.0.17", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "sptr", + "target-lexicon", + "wasm-encoder", + "wasmparser", + "wasmtime-asm-macros", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "wasmtime-winch", + "wat", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dee8679c974a7f258c03d60d3c747c426ed219945b6d08cbc77fd2eab15b2d1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00103ffaf7ee980f4e750fe272b6ada79d9901659892e457c7ca316b16df9ec" +dependencies = [ + "anyhow", + "base64 0.21.0", + "directories-next", + "log", + "postcard", + "rustix 0.38.34", + "serde", + "serde_derive", + "sha2 0.10.8", + "toml 0.8.13", + "windows-sys 0.52.0", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cae30035f1cf97dcc6657c979cf39f99ce6be93583675eddf4aeaa5548509c" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 2.0.64", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7ae611f08cea620c67330925be28a96115bf01f8f393a6cbdf4856a86087134" + +[[package]] +name = "wasmtime-cranelift" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2909406a6007e28be964067167890bca4574bd48a9ff18f1fa9f4856d89ea40" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli 0.28.1", + "log", + "object 0.33.0", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40e227f9ed2f5421473723d6c0352b5986e6e6044fde5410a274a394d726108f" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-entity", + "gimli 0.28.1", + "indexmap 2.2.6", + "log", + "object 0.33.0", + "postcard", + "rustc-demangle", + "serde", + "serde_derive", + "target-lexicon", + "wasm-encoder", + "wasmparser", + "wasmprinter", + "wasmtime-component-util", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-fiber" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42edb392586d07038c1638e854382db916b6ca7845a2e6a7f8dc49e08907acdd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "rustix 0.38.34", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b26ef7914af0c0e3ca811bdc32f5f66fbba0fd21e1f8563350e8a7951e3598" +dependencies = [ + "object 0.33.0", + "once_cell", + "rustix 0.38.34", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afe088f9b56bb353adaf837bf7e10f1c2e1676719dd5be4cac8e37f2ba1ee5bc" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-slab" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ff75cafffe47b04b036385ce3710f209153525b0ed19d57b0cf44a22d446460" + +[[package]] +name = "wasmtime-types" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f2fa462bfea3220711c84e2b549f147e4df89eeb49b8a2a3d89148f6cc4a8b1" +dependencies = [ + "cranelift-entity", + "serde", + "serde_derive", + "smallvec", + "wasmparser", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4cedc5bfef3db2a85522ee38564b47ef3b7fc7c92e94cacbce99808e63cdd47" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.64", +] + +[[package]] +name = "wasmtime-wasi" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdbbe94245904d4c96c7c5f7b55bad896cc27908644efd9442063c0748b631fc" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 2.5.0", + "bytes 1.6.0", + "cap-fs-ext", + "cap-net-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "futures", + "io-extras", + "io-lifetimes 2.0.3", + "once_cell", + "rustix 0.38.34", + "system-interface", + "thiserror", + "tokio", + "tracing", + "url", + "wasmtime", + "wiggle", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-winch" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b27054fed6be4f3800aba5766f7ef435d4220ce290788f021a08d4fa573108" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli 0.28.1", + "object 0.33.0", + "target-lexicon", + "wasmparser", + "wasmtime-cranelift", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c936a52ce69c28de2aa3b5fb4f2dbbb2966df304f04cccb7aca4ba56d915fda0" +dependencies = [ + "anyhow", + "heck 0.4.0", + "indexmap 2.2.6", + "wit-parser", +] [[package]] name = "wast" -version = "42.0.0" +version = "35.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "badcb03f976f983ff0daf294da9697be659442f61e6b0942bb37a2b6cbfe9dd4" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" dependencies = [ "leb128", +] + +[[package]] +name = "wast" +version = "207.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e40be9fd494bfa501309487d2dc0b3f229be6842464ecbdc54eac2679c84c93" +dependencies = [ + "bumpalo", + "leb128", "memchr", "unicode-width", "wasm-encoder", @@ -4763,11 +5021,11 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.44" +version = "1.207.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b92f20b742ac527066c8414bc0637352661b68cab07ef42586cefaba71c965cf" +checksum = "8eb2b15e2d5f300f5e1209e7dc237f2549edbd4203655b6c6cab5cf180561ee7" dependencies = [ - "wast", + "wast 207.0.0", ] [[package]] @@ -4885,6 +5143,48 @@ dependencies = [ "libc", ] +[[package]] +name = "wiggle" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89ea6f74ece6d1cfbd089783006b8eb69a0219ca83cad22068f0d9fa9df3f91" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 2.5.0", + "thiserror", + "tracing", + "wasmtime", + "wiggle-macro", +] + +[[package]] +name = "wiggle-generate" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36beda94813296ecaf0d91b7ada9da073fd41865ba339bdd3b7764e2e785b8e9" +dependencies = [ + "anyhow", + "heck 0.4.0", + "proc-macro2", + "quote", + "shellexpand 2.1.2", + "syn 2.0.64", + "witx", +] + +[[package]] +name = "wiggle-macro" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b47d2b4442ce93106dba5d1a9c59d5f85b5732878bb3d0598d3c93c0d01b16b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.64", + "wiggle-generate", +] + [[package]] name = "winapi" version = "0.3.9" @@ -4917,16 +5217,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-sys" -version = "0.33.0" +name = "winch-codegen" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" +checksum = "1dc69899ccb2da7daa4df31426dcfd284b104d1a85e1dae35806df0c46187f87" dependencies = [ - "windows_aarch64_msvc 0.33.0", - "windows_i686_gnu 0.33.0", - "windows_i686_msvc 0.33.0", - "windows_x86_64_gnu 0.33.0", - "windows_x86_64_msvc 0.33.0", + "anyhow", + "cranelift-codegen", + "gimli 0.28.1", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser", + "wasmtime-cranelift", + "wasmtime-environ", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.5", ] [[package]] @@ -5020,12 +5333,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" -[[package]] -name = "windows_aarch64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -5044,12 +5351,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" -[[package]] -name = "windows_i686_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" - [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -5074,12 +5375,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" -[[package]] -name = "windows_i686_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" - [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -5098,12 +5393,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" -[[package]] -name = "windows_x86_64_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -5140,12 +5429,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" -[[package]] -name = "windows_x86_64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -5164,6 +5447,55 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +[[package]] +name = "winnow" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +dependencies = [ + "memchr", +] + +[[package]] +name = "winx" +version = "0.36.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346" +dependencies = [ + "bitflags 2.5.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "wit-parser" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c83dab33a9618d86cfe3563cc864deffd08c17efc5db31a3b7cd1edeffe6e1" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.2.6", + "log", + "semver 1.0.17", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "witx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" +dependencies = [ + "anyhow", + "log", + "thiserror", + "wast 35.0.2", +] + [[package]] name = "xflags" version = "0.3.1" @@ -5201,7 +5533,7 @@ dependencies = [ "anyhow", "lazy_static", "prost-build", - "toml", + "toml 0.5.10", "which", "xflags", "xshell", @@ -5257,6 +5589,7 @@ dependencies = [ "async-trait", "base64 0.13.0", "byteorder", + "bytes 1.6.0", "cassowary", "chrono", "close_fds", @@ -5274,8 +5607,8 @@ dependencies = [ "unicode-width", "url", "uuid", - "wasmer", - "wasmer-wasi", + "wasmtime", + "wasmtime-wasi", "zellij-utils", ] @@ -5337,7 +5670,7 @@ dependencies = [ "rmp-serde", "serde", "serde_json", - "shellexpand", + "shellexpand 3.0.0", "signal-hook", "strip-ansi-escapes", "strum", @@ -5352,8 +5685,56 @@ dependencies = [ "vte 0.11.0", ] +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.64", +] + [[package]] name = "zeroize" version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94693807d016b2f2d2e14420eb3bfcca689311ff775dcf113d74ea624b7cdf07" + +[[package]] +name = "zstd" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.10+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/src/tests/e2e/remote_runner.rs b/src/tests/e2e/remote_runner.rs index 09f239915..b3c61fa48 100644 --- a/src/tests/e2e/remote_runner.rs +++ b/src/tests/e2e/remote_runner.rs @@ -84,7 +84,7 @@ fn start_zellij(channel: &mut ssh2::Channel) { ) .unwrap(); channel.flush().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(1)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN + std::thread::sleep(std::time::Duration::from_secs(3)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN } fn start_zellij_mirrored_session(channel: &mut ssh2::Channel) { @@ -99,7 +99,7 @@ fn start_zellij_mirrored_session(channel: &mut ssh2::Channel) { ) .unwrap(); channel.flush().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(1)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN + std::thread::sleep(std::time::Duration::from_secs(3)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN } fn start_zellij_mirrored_session_with_layout(channel: &mut ssh2::Channel, layout_file_name: &str) { @@ -118,7 +118,7 @@ fn start_zellij_mirrored_session_with_layout(channel: &mut ssh2::Channel, layout ) .unwrap(); channel.flush().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(1)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN + std::thread::sleep(std::time::Duration::from_secs(3)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN } fn start_zellij_mirrored_session_with_layout_and_viewport_serialization( @@ -140,7 +140,7 @@ fn start_zellij_mirrored_session_with_layout_and_viewport_serialization( ) .unwrap(); channel.flush().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(1)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN + std::thread::sleep(std::time::Duration::from_secs(3)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN } fn start_zellij_in_session(channel: &mut ssh2::Channel, session_name: &str, mirrored: bool) { @@ -159,7 +159,7 @@ fn start_zellij_in_session(channel: &mut ssh2::Channel, session_name: &str, mirr ) .unwrap(); channel.flush().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(1)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN + std::thread::sleep(std::time::Duration::from_secs(3)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN } fn attach_to_existing_session(channel: &mut ssh2::Channel, session_name: &str) { @@ -173,7 +173,7 @@ fn attach_to_existing_session(channel: &mut ssh2::Channel, session_name: &str) { ) .unwrap(); channel.flush().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(1)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN + std::thread::sleep(std::time::Duration::from_secs(3)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN } fn start_zellij_without_frames(channel: &mut ssh2::Channel) { @@ -188,7 +188,7 @@ fn start_zellij_without_frames(channel: &mut ssh2::Channel) { ) .unwrap(); channel.flush().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(1)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN + std::thread::sleep(std::time::Duration::from_secs(3)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN } fn start_zellij_with_config(channel: &mut ssh2::Channel, config_path: &str) { @@ -207,7 +207,7 @@ fn start_zellij_with_config(channel: &mut ssh2::Channel, config_path: &str) { ) .unwrap(); channel.flush().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(1)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN + std::thread::sleep(std::time::Duration::from_secs(3)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN } fn read_from_channel( diff --git a/zellij-server/Cargo.toml b/zellij-server/Cargo.toml index da6c4048c..1a0f2f7dc 100644 --- a/zellij-server/Cargo.toml +++ b/zellij-server/Cargo.toml @@ -14,12 +14,12 @@ ansi_term = "0.12.1" async-trait = "0.1.50" base64 = "0.13.0" byteorder = "1.4.3" +bytes = "1.6.0" daemonize = "0.5" serde_json = "1.0" unicode-width = "0.1.8" url = "2.2.2" -wasmer = "3.1.1" -wasmer-wasi = "3.1.1" +wasmtime-wasi = "21.0.1" # Keep in sync with wasmtime cassowary = "0.3.0" zellij-utils = { path = "../zellij-utils/", version = "0.41.0" } log = "0.4.17" @@ -33,10 +33,26 @@ arrayvec = "0.7.2" uuid = { version = "1.4.1", features = ["serde", "v4"] } semver = "0.11.0" +[dependencies.wasmtime] +version = "21.0.1" # Keep in sync with wasmtime-wasi +default-features = false +features = [ + 'async', + 'cache', + 'parallel-compilation', + 'cranelift', + 'demangle', + 'addr2line', + 'debug-builtins', + 'runtime', + 'component-model', + 'std', +] + [dev-dependencies] insta = "1.6.0" tempfile = "3.2.0" -wasmer = { version = "3.1.1", features = ["singlepass"] } +wasmtime = { version = "21.0.1", features = ["winch"] } # Keep in sync with the other wasmtime dep [features] -singlepass = ["wasmer/singlepass"] +singlepass = ["wasmtime/winch"] diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 8a264dc8b..aaedabd7d 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -28,7 +28,7 @@ use zellij_utils::envs; use zellij_utils::nix::sys::stat::{umask, Mode}; use zellij_utils::pane_size::Size; -use wasmer::Store; +use wasmtime::{Config, Engine, Strategy}; use crate::{ os_input_output::ServerOsApi, @@ -1069,7 +1069,7 @@ fn init_session( Some(&to_background_jobs), None, ); - let store = get_store(); + let engine = get_engine(); let layout = layout.clone(); let client_attributes = client_attributes.clone(); @@ -1079,7 +1079,7 @@ fn init_session( move || { plugin_thread_main( plugin_bus, - store, + engine, data_dir, layout, layout_dir, @@ -1162,22 +1162,13 @@ fn init_session( } #[cfg(not(feature = "singlepass"))] -fn get_store() -> Store { - use wasmer::{BaseTunables, Cranelift, Engine, Pages, Target}; +fn get_engine() -> Engine { log::info!("Compiling plugins using Cranelift"); - - // workaround for https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-ff4p-7xrq-q5r8 - let mut tunables = BaseTunables::for_target(&Target::default()); - tunables.static_memory_bound = Pages(0); - let compiler = Cranelift::default(); - let mut engine: Engine = compiler.into(); - engine.set_tunables(tunables); - - Store::new(engine) + Engine::new(Config::new().strategy(Strategy::Cranelift)).unwrap() } #[cfg(feature = "singlepass")] -fn get_store() -> Store { +fn get_engine() -> Engine { log::info!("Compiling plugins using Singlepass"); - Store::new(wasmer::Singlepass::default()) + Engine::new(Config::new().strategy(Strategy::Winch)).unwrap() } diff --git a/zellij-server/src/logging_pipe.rs b/zellij-server/src/logging_pipe.rs index 4f35db4fb..48c051908 100644 --- a/zellij-server/src/logging_pipe.rs +++ b/zellij-server/src/logging_pipe.rs @@ -1,11 +1,7 @@ -use std::{ - collections::VecDeque, - io::{Read, Seek, Write}, -}; +use std::{collections::VecDeque, io::Write}; use crate::plugins::PluginId; use log::{debug, error}; -use wasmer_wasi::{WasiFile, WasiFsError}; use zellij_utils::{errors::prelude::*, serde}; use chrono::prelude::*; @@ -41,15 +37,6 @@ impl LoggingPipe { } } -impl Read for LoggingPipe { - fn read(&mut self, _: &mut [u8]) -> std::io::Result { - Err(std::io::Error::new( - std::io::ErrorKind::Other, - "Can not reed from a LoggingPipe", - )) - } -} - impl Write for LoggingPipe { fn write(&mut self, buf: &[u8]) -> std::io::Result { if self.buffer.len() + buf.len() > ZELLIJ_MAX_PIPE_BUFFER_SIZE { @@ -106,40 +93,6 @@ impl Write for LoggingPipe { } } -impl Seek for LoggingPipe { - fn seek(&mut self, _pos: std::io::SeekFrom) -> std::io::Result { - Err(std::io::Error::new( - std::io::ErrorKind::Other, - "can not seek in a pipe", - )) - } -} - -impl WasiFile for LoggingPipe { - fn last_accessed(&self) -> u64 { - 0 - } - fn last_modified(&self) -> u64 { - 0 - } - fn created_time(&self) -> u64 { - 0 - } - fn size(&self) -> u64 { - self.buffer.len() as u64 - } - fn set_len(&mut self, len: u64) -> Result<(), WasiFsError> { - self.buffer.resize(len as usize, 0); - Ok(()) - } - fn unlink(&mut self) -> Result<(), WasiFsError> { - Ok(()) - } - fn bytes_available(&self) -> Result { - Ok(self.buffer.len()) - } -} - // Unit tests #[cfg(test)] mod logging_pipe_test { diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index 6beec9c6a..7b9f75502 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -10,10 +10,9 @@ use std::{ collections::{BTreeMap, HashMap, HashSet}, fs, path::PathBuf, - sync::{Arc, Mutex}, time::Duration, }; -use wasmer::Store; +use wasmtime::Engine; use crate::panes::PaneId; use crate::screen::ScreenInstruction; @@ -189,7 +188,7 @@ impl From<&PluginInstruction> for PluginContext { pub(crate) fn plugin_thread_main( bus: Bus, - store: Store, + engine: Engine, data_dir: PathBuf, mut layout: Box, layout_dir: Option, @@ -204,7 +203,6 @@ pub(crate) fn plugin_thread_main( let plugin_dir = data_dir.join("plugins/"); let plugin_global_data_dir = plugin_dir.join("data"); layout.populate_plugin_aliases_in_layout(&plugin_aliases); - let store = Arc::new(Mutex::new(store)); // use this channel to ensure that tasks spawned from this thread terminate before exiting // https://tokio.rs/tokio/topics/shutdown#waiting-for-things-to-finish-shutting-down @@ -212,7 +210,7 @@ pub(crate) fn plugin_thread_main( let mut wasm_bridge = WasmBridge::new( bus.senders.clone(), - store, + engine, plugin_dir, path_to_default_shell, zellij_cwd, diff --git a/zellij-server/src/plugins/pipes.rs b/zellij-server/src/plugins/pipes.rs index ba3fe99b6..36cee46ea 100644 --- a/zellij-server/src/plugins/pipes.rs +++ b/zellij-server/src/plugins/pipes.rs @@ -3,7 +3,6 @@ use crate::plugins::plugin_map::RunningPlugin; use crate::plugins::wasm_bridge::PluginRenderAsset; use crate::plugins::zellij_exports::{wasi_read_string, wasi_write_object}; use std::collections::{HashMap, HashSet}; -use wasmer::Value; use zellij_utils::data::{PipeMessage, PipeSource}; use zellij_utils::plugin_api::pipe_message::ProtobufPipeMessage; @@ -147,7 +146,6 @@ pub fn apply_pipe_message_to_plugin( senders: &ThreadSenders, ) -> Result<()> { let instance = &running_plugin.instance; - let plugin_env = &running_plugin.plugin_env; let rows = running_plugin.rows; let columns = running_plugin.columns; @@ -156,31 +154,24 @@ pub fn apply_pipe_message_to_plugin( .clone() .try_into() .map_err(|e| anyhow!("Failed to convert to protobuf: {:?}", e))?; - match instance.exports.get_function("pipe") { + match instance.get_typed_func::<(), i32>(&mut running_plugin.store, "pipe") { Ok(pipe) => { - wasi_write_object(&plugin_env.wasi_env, &protobuf_pipe_message.encode_to_vec()) + wasi_write_object( + running_plugin.store.data(), + &protobuf_pipe_message.encode_to_vec(), + ) + .with_context(err_context)?; + let should_render = pipe + .call(&mut running_plugin.store, ()) .with_context(err_context)?; - let pipe_return = pipe - .call(&mut running_plugin.store, &[]) - .with_context(err_context)?; - let should_render = match pipe_return.get(0) { - Some(Value::I32(n)) => *n == 1, - _ => false, - }; + let should_render = should_render == 1; if rows > 0 && columns > 0 && should_render { let rendered_bytes = instance - .exports - .get_function("render") - .map_err(anyError::new) + .get_typed_func::<(i32, i32), ()>(&mut running_plugin.store, "render") .and_then(|render| { - render - .call( - &mut running_plugin.store, - &[Value::I32(rows as i32), Value::I32(columns as i32)], - ) - .map_err(anyError::new) + render.call(&mut running_plugin.store, (rows as i32, columns as i32)) }) - .and_then(|_| wasi_read_string(&plugin_env.wasi_env)) + .and_then(|_| wasi_read_string(running_plugin.store.data())) .with_context(err_context)?; let pipes_to_block_or_unblock = pipes_to_block_or_unblock(running_plugin, Some(&pipe_message.source)); @@ -230,14 +221,16 @@ pub fn pipes_to_block_or_unblock( ) -> HashMap { let mut pipe_state_changes = HashMap::new(); let mut input_pipes_to_unblock: HashSet = running_plugin - .plugin_env + .store + .data() .input_pipes_to_unblock .lock() .unwrap() .drain() .collect(); let mut input_pipes_to_block: HashSet = running_plugin - .plugin_env + .store + .data() .input_pipes_to_block .lock() .unwrap() diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs index fafeeb22c..0a839b65d 100644 --- a/zellij-server/src/plugins/plugin_loader.rs +++ b/zellij-server/src/plugins/plugin_loader.rs @@ -1,19 +1,20 @@ -use crate::get_store; -use crate::plugins::plugin_map::{PluginEnv, PluginMap, RunningPlugin, Subscriptions}; +use crate::plugins::plugin_map::{ + PluginEnv, PluginMap, RunningPlugin, VecDequeInputStream, WriteOutputStream, +}; use crate::plugins::plugin_worker::{plugin_worker, RunningWorker}; use crate::plugins::zellij_exports::{wasi_write_object, zellij_exports}; use crate::plugins::PluginId; use highway::{HighwayHash, PortableHash}; use log::info; use std::{ - collections::{HashMap, HashSet}, + collections::{HashMap, HashSet, VecDeque}, fs, path::PathBuf, sync::{Arc, Mutex}, }; use url::Url; -use wasmer::{AsStoreRef, Instance, Module, Store}; -use wasmer_wasi::{Pipe, WasiState}; +use wasmtime::{Engine, Instance, Linker, Module, Store}; +use wasmtime_wasi::{DirPerms, FilePerms, WasiCtxBuilder}; use zellij_utils::consts::ZELLIJ_PLUGIN_ARTIFACT_DIR; use zellij_utils::prost::Message; @@ -53,7 +54,7 @@ pub struct PluginLoader<'a> { senders: ThreadSenders, plugin_id: PluginId, client_id: ClientId, - store: Arc>, + engine: Engine, plugin: PluginConfig, plugin_dir: &'a PathBuf, tab_index: Option, @@ -75,7 +76,7 @@ impl<'a> PluginLoader<'a> { plugin_dir: PathBuf, plugin_cache: Arc>>, senders: ThreadSenders, - store: Arc>, + engine: Engine, plugin_map: Arc>, connected_clients: Arc>>, loading_indication: &mut LoadingIndication, @@ -102,7 +103,7 @@ impl<'a> PluginLoader<'a> { &senders, plugin_id, first_client_id, - store, + engine, &plugin_dir, path_to_default_shell, zellij_cwd, @@ -115,14 +116,8 @@ impl<'a> PluginLoader<'a> { plugin_loader .load_module_from_memory() .and_then(|module| plugin_loader.create_plugin_environment(module)) - .and_then(|(store, instance, plugin_env, subscriptions)| { - plugin_loader.load_plugin_instance( - store, - &instance, - &plugin_env, - &plugin_map, - &subscriptions, - ) + .and_then(|(store, instance)| { + plugin_loader.load_plugin_instance(store, &instance, &plugin_map) }) .and_then(|_| { plugin_loader.clone_instance_for_other_clients(&connected_clients, &plugin_map) @@ -140,7 +135,7 @@ impl<'a> PluginLoader<'a> { plugin_dir: PathBuf, plugin_cache: Arc>>, senders: ThreadSenders, - store: Arc>, + engine: Engine, plugin_map: Arc>, size: Size, connected_clients: Arc>>, @@ -161,7 +156,7 @@ impl<'a> PluginLoader<'a> { &senders, plugin_id, client_id, - store.clone(), + engine, plugin.clone(), &plugin_dir, tab_index, @@ -178,14 +173,8 @@ impl<'a> PluginLoader<'a> { plugin_loader .compile_module() .and_then(|module| plugin_loader.create_plugin_environment(module)) - .and_then(|(store, instance, plugin_env, subscriptions)| { - plugin_loader.load_plugin_instance( - store, - &instance, - &plugin_env, - &plugin_map, - &subscriptions, - ) + .and_then(|(store, instance)| { + plugin_loader.load_plugin_instance(store, &instance, &plugin_map) }) .and_then(|_| { plugin_loader.clone_instance_for_other_clients( @@ -200,14 +189,8 @@ impl<'a> PluginLoader<'a> { .or_else(|_e| plugin_loader.load_module_from_hd_cache()) .or_else(|_e| plugin_loader.compile_module()) .and_then(|module| plugin_loader.create_plugin_environment(module)) - .and_then(|(store, instance, plugin_env, subscriptions)| { - plugin_loader.load_plugin_instance( - store, - &instance, - &plugin_env, - &plugin_map, - &subscriptions, - ) + .and_then(|(store, instance)| { + plugin_loader.load_plugin_instance(store, &instance, &plugin_map) }) .and_then(|_| { plugin_loader.clone_instance_for_other_clients( @@ -226,7 +209,7 @@ impl<'a> PluginLoader<'a> { plugin_dir: PathBuf, plugin_cache: Arc>>, senders: ThreadSenders, - store: Arc>, + engine: Engine, plugin_map: Arc>, connected_clients: Arc>>, loading_indication: &mut LoadingIndication, @@ -250,7 +233,7 @@ impl<'a> PluginLoader<'a> { &senders, plugin_id, existing_client_id, - store.clone(), + engine.clone(), &plugin_dir, path_to_default_shell.clone(), zellij_cwd.clone(), @@ -263,14 +246,8 @@ impl<'a> PluginLoader<'a> { plugin_loader .load_module_from_memory() .and_then(|module| plugin_loader.create_plugin_environment(module)) - .and_then(|(store, instance, plugin_env, subscriptions)| { - plugin_loader.load_plugin_instance( - store, - &instance, - &plugin_env, - &plugin_map, - &subscriptions, - ) + .and_then(|(store, instance)| { + plugin_loader.load_plugin_instance(store, &instance, &plugin_map) })? } connected_clients.lock().unwrap().push(client_id); @@ -282,7 +259,7 @@ impl<'a> PluginLoader<'a> { plugin_dir: PathBuf, plugin_cache: Arc>>, senders: ThreadSenders, - store: Arc>, + engine: Engine, plugin_map: Arc>, connected_clients: Arc>>, loading_indication: &mut LoadingIndication, @@ -310,7 +287,7 @@ impl<'a> PluginLoader<'a> { &senders, plugin_id, first_client_id, - store.clone(), + engine, &plugin_dir, path_to_default_shell, zellij_cwd, @@ -323,14 +300,8 @@ impl<'a> PluginLoader<'a> { plugin_loader .compile_module() .and_then(|module| plugin_loader.create_plugin_environment(module)) - .and_then(|(store, instance, plugin_env, subscriptions)| { - plugin_loader.load_plugin_instance( - store, - &instance, - &plugin_env, - &plugin_map, - &subscriptions, - ) + .and_then(|(store, instance)| { + plugin_loader.load_plugin_instance(store, &instance, &plugin_map) }) .and_then(|_| { plugin_loader.clone_instance_for_other_clients(&connected_clients, &plugin_map) @@ -345,7 +316,7 @@ impl<'a> PluginLoader<'a> { senders: &ThreadSenders, plugin_id: PluginId, client_id: ClientId, - store: Arc>, + engine: Engine, plugin: PluginConfig, plugin_dir: &'a PathBuf, tab_index: Option, @@ -370,7 +341,7 @@ impl<'a> PluginLoader<'a> { senders: senders.clone(), plugin_id, client_id, - store: store.clone(), + engine, plugin, plugin_dir, tab_index, @@ -393,7 +364,7 @@ impl<'a> PluginLoader<'a> { senders: &ThreadSenders, plugin_id: PluginId, client_id: ClientId, - store: Arc>, + engine: Engine, plugin_dir: &'a PathBuf, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, @@ -411,20 +382,20 @@ impl<'a> PluginLoader<'a> { .with_context(err_context)? }; let running_plugin = running_plugin.lock().unwrap(); - let tab_index = running_plugin.plugin_env.tab_index; + let tab_index = running_plugin.store.data().tab_index; let size = Size { rows: running_plugin.rows, cols: running_plugin.columns, }; - let plugin_config = running_plugin.plugin_env.plugin.clone(); - loading_indication.set_name(running_plugin.plugin_env.name()); + let plugin_config = running_plugin.store.data().plugin.clone(); + loading_indication.set_name(running_plugin.store.data().name()); PluginLoader::new( plugin_cache, loading_indication, senders, plugin_id, client_id, - store, + engine, plugin_config, plugin_dir, tab_index, @@ -445,7 +416,7 @@ impl<'a> PluginLoader<'a> { senders: &ThreadSenders, plugin_id: PluginId, client_id: ClientId, - store: Arc>, + engine: Engine, plugin_dir: &'a PathBuf, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, @@ -464,20 +435,20 @@ impl<'a> PluginLoader<'a> { .clone() }; let running_plugin = running_plugin.lock().unwrap(); - let tab_index = running_plugin.plugin_env.tab_index; + let tab_index = running_plugin.store.data().tab_index; let size = Size { rows: running_plugin.rows, cols: running_plugin.columns, }; - let plugin_config = running_plugin.plugin_env.plugin.clone(); - loading_indication.set_name(running_plugin.plugin_env.name()); + let plugin_config = running_plugin.store.data().plugin.clone(); + loading_indication.set_name(running_plugin.store.data().name()); PluginLoader::new( plugin_cache, loading_indication, senders, plugin_id, client_id, - store.clone(), + engine, plugin_config, plugin_dir, tab_index, @@ -527,9 +498,7 @@ impl<'a> PluginLoader<'a> { ); let (_wasm_bytes, cached_path) = self.plugin_bytes_and_cache_path()?; let timer = std::time::Instant::now(); - let module = unsafe { - Module::deserialize_from_file(&self.store.lock().unwrap().as_store_ref(), &cached_path)? - }; + let module = unsafe { Module::deserialize_file(&self.engine, &cached_path)? }; log::info!( "Loaded plugin '{}' from cache folder at '{}' in {:?}", self.plugin_path.display(), @@ -565,12 +534,11 @@ impl<'a> PluginLoader<'a> { .map_err(anyError::new) .and_then(|_| { // compile module - Module::new(&self.store.lock().unwrap().as_store_ref(), &wasm_bytes) - .map_err(anyError::new) + Module::new(&self.engine, &wasm_bytes) }) .and_then(|m| { // serialize module to HD cache for faster loading in the future - m.serialize_to_file(&cached_path).map_err(anyError::new)?; + fs::write(&cached_path, m.serialize()?).map_err(anyError::new)?; log::info!( "Compiled plugin '{}' in {:?}", self.plugin_path.display(), @@ -584,20 +552,19 @@ impl<'a> PluginLoader<'a> { pub fn create_plugin_environment( &mut self, module: Module, - ) -> Result<(Store, Instance, PluginEnv, Arc>)> { - let (store, instance, plugin_env, subscriptions) = - self.create_plugin_instance_env_and_subscriptions(&module)?; + ) -> Result<(Store, Instance)> { + let (store, instance) = self.create_plugin_instance_env(&module)?; // Only do an insert when everything went well! let cloned_plugin = self.plugin.clone(); self.plugin_cache .lock() .unwrap() .insert(cloned_plugin.path, module); - Ok((store, instance, plugin_env, subscriptions)) + Ok((store, instance)) } pub fn create_plugin_instance_and_wasi_env_for_worker( &mut self, - ) -> Result<(Store, Instance, PluginEnv)> { + ) -> Result<(Store, Instance)> { let err_context = || { format!( "Failed to create instance and plugin env for worker {}", @@ -611,21 +578,17 @@ impl<'a> PluginLoader<'a> { .get(&self.plugin.path) .with_context(err_context)? .clone(); - let (store, instance, plugin_env, _subscriptions) = - self.create_plugin_instance_env_and_subscriptions(&module)?; - Ok((store, instance, plugin_env)) + let (store, instance) = self.create_plugin_instance_env(&module)?; + Ok((store, instance)) } pub fn load_plugin_instance( &mut self, - store: Store, + mut store: Store, instance: &Instance, - plugin_env: &PluginEnv, plugin_map: &Arc>, - subscriptions: &Arc>, ) -> Result<()> { let err_context = || format!("failed to load plugin from instance {instance:#?}"); let main_user_instance = instance.clone(); - let main_user_env = plugin_env.clone(); display_loading_stage!( indicate_starting_plugin, self.loading_indication, @@ -633,39 +596,38 @@ impl<'a> PluginLoader<'a> { self.plugin_id ); let start_function = instance - .exports - .get_function("_start") + .get_typed_func::<(), ()>(&mut store, "_start") .with_context(err_context)?; let load_function = instance - .exports - .get_function("load") + .get_typed_func::<(), ()>(&mut store, "load") .with_context(err_context)?; let mut workers = HashMap::new(); - for (function_name, _exported_function) in instance.exports.iter().functions() { + for function_name in instance + .exports(&mut store) + .filter_map(|export| export.clone().into_func().map(|_| export.name())) + { if function_name.ends_with("_worker") { let plugin_config = self.plugin.clone(); - let (mut store, instance, plugin_env) = + let (mut store, instance) = self.create_plugin_instance_and_wasi_env_for_worker()?; let start_function_for_worker = instance - .exports - .get_function("_start") + .get_typed_func::<(), ()>(&mut store, "_start") .with_context(err_context)?; start_function_for_worker - .call(&mut store, &[]) + .call(&mut store, ()) .with_context(err_context)?; - let worker = - RunningWorker::new(store, instance, &function_name, plugin_config, plugin_env); + let worker = RunningWorker::new(store, instance, &function_name, plugin_config); let worker_sender = plugin_worker(worker); workers.insert(function_name.into(), worker_sender); } } + let subscriptions = store.data().subscriptions.clone(); let plugin = Arc::new(Mutex::new(RunningPlugin::new( store, main_user_instance, - main_user_env, self.size.rows, self.size.cols, ))); @@ -673,12 +635,12 @@ impl<'a> PluginLoader<'a> { self.plugin_id, self.client_id, plugin.clone(), - subscriptions.clone(), + subscriptions, workers, ); start_function - .call(&mut plugin.lock().unwrap().store, &[]) + .call(&mut plugin.lock().unwrap().store, ()) .with_context(err_context)?; let protobuf_plugin_configuration: ProtobufPluginConfiguration = self @@ -689,13 +651,13 @@ impl<'a> PluginLoader<'a> { .map_err(|e| anyhow!("Failed to serialize user configuration: {:?}", e))?; let protobuf_bytes = protobuf_plugin_configuration.encode_to_vec(); wasi_write_object( - &plugin_env.wasi_env, + plugin.lock().unwrap().store.data(), &protobuf_bytes, // &self.plugin.userspace_configuration.inner(), ) .with_context(err_context)?; load_function - .call(&mut plugin.lock().unwrap().store, &[]) + .call(&mut plugin.lock().unwrap().store, ()) .with_context(err_context)?; display_loading_stage!( @@ -744,7 +706,7 @@ impl<'a> PluginLoader<'a> { &self.senders.clone(), self.plugin_id, *client_id, - self.store.clone(), + self.engine.clone(), &self.plugin_dir, self.path_to_default_shell.clone(), self.zellij_cwd.clone(), @@ -757,14 +719,8 @@ impl<'a> PluginLoader<'a> { plugin_loader_for_client .load_module_from_memory() .and_then(|module| plugin_loader_for_client.create_plugin_environment(module)) - .and_then(|(store, instance, plugin_env, subscriptions)| { - plugin_loader_for_client.load_plugin_instance( - store, - &instance, - &plugin_env, - plugin_map, - &subscriptions, - ) + .and_then(|(store, instance)| { + plugin_loader_for_client.load_plugin_instance(store, &instance, plugin_map) })? } display_loading_stage!( @@ -799,18 +755,13 @@ impl<'a> PluginLoader<'a> { }, } } - fn create_plugin_instance_env_and_subscriptions( - &self, - module: &Module, - ) -> Result<(Store, Instance, PluginEnv, Arc>)> { + fn create_plugin_instance_env(&self, module: &Module) -> Result<(Store, Instance)> { let err_context = || { format!( "Failed to create instance, plugin env and subscriptions for plugin {}", self.plugin_id ) }; - let mut store = get_store(); - let store_mut = &mut store; let dirs = vec![ ("/host".to_owned(), self.zellij_cwd.clone()), ("/data".to_owned(), self.plugin_own_data_dir.clone()), @@ -824,22 +775,23 @@ impl<'a> PluginLoader<'a> { // there's no built-in solution dir.try_exists().ok().unwrap_or(false) }); - let mut wasi_env = WasiState::new("Zellij") - .env("CLICOLOR_FORCE", "1") - .map_dirs(dirs) - .and_then(|wasi| { - wasi.stdin(Box::new(Pipe::new())) - .stdout(Box::new(Pipe::new())) - .stderr(Box::new(LoggingPipe::new( - &self.plugin.location.to_string(), - self.plugin_id, - ))) - .finalize(store_mut) - }) - .with_context(err_context)?; - let wasi = wasi_env - .import_object(store_mut, &module) - .with_context(err_context)?; + let mut wasi_ctx_builder = WasiCtxBuilder::new(); + wasi_ctx_builder.env("CLICOLOR_FORCE", "1"); + for (guest_path, host_path) in dirs { + wasi_ctx_builder + .preopened_dir(host_path, guest_path, DirPerms::all(), FilePerms::all()) + .with_context(err_context)?; + } + let stdin_pipe = Arc::new(Mutex::new(VecDeque::new())); + let stdout_pipe = Arc::new(Mutex::new(VecDeque::new())); + wasi_ctx_builder + .stdin(VecDequeInputStream(stdin_pipe.clone())) + .stdout(WriteOutputStream(stdout_pipe.clone())) + .stderr(WriteOutputStream(Arc::new(Mutex::new(LoggingPipe::new( + &self.plugin.location.to_string(), + self.plugin_id, + ))))); + let wasi_ctx = wasi_ctx_builder.build_p1(); let mut mut_plugin = self.plugin.clone(); if let Some(tab_index) = self.tab_index { mut_plugin.set_tab_index(tab_index); @@ -850,7 +802,7 @@ impl<'a> PluginLoader<'a> { plugin: mut_plugin, permissions: Arc::new(Mutex::new(None)), senders: self.senders.clone(), - wasi_env: wasi_env.data_mut(store_mut).clone(), + wasi_ctx, plugin_own_data_dir: self.plugin_own_data_dir.clone(), tab_index: self.tab_index, path_to_default_shell: self.path_to_default_shell.clone(), @@ -862,18 +814,28 @@ impl<'a> PluginLoader<'a> { input_pipes_to_unblock: Arc::new(Mutex::new(HashSet::new())), input_pipes_to_block: Arc::new(Mutex::new(HashSet::new())), layout_dir: self.layout_dir.clone(), + subscriptions: Arc::new(Mutex::new(HashSet::new())), + stdin_pipe, + stdout_pipe, }; + let mut store = Store::new(&self.engine, plugin_env); - let subscriptions = Arc::new(Mutex::new(HashSet::new())); + let mut linker = Linker::new(&self.engine); + wasmtime_wasi::preview1::add_to_linker_sync(&mut linker, |plugin_env: &mut PluginEnv| { + &mut plugin_env.wasi_ctx + }) + .unwrap(); + zellij_exports(&mut linker); - let mut zellij = zellij_exports(store_mut, &plugin_env, &subscriptions); - zellij.extend(&wasi); + let instance = linker + .instantiate(&mut store, module) + .with_context(err_context)?; - let instance = Instance::new(store_mut, &module, &zellij).with_context(err_context)?; + if let Some(func) = instance.get_func(&mut store, "_initialize") { + func.typed::<(), ()>(&store)?.call(&mut store, ())?; + } - wasi_env.initialize(store_mut, &instance)?; - - Ok((store, instance, plugin_env, subscriptions)) + Ok((store, instance)) } } diff --git a/zellij-server/src/plugins/plugin_map.rs b/zellij-server/src/plugins/plugin_map.rs index 1d400288a..fb41c89e3 100644 --- a/zellij-server/src/plugins/plugin_map.rs +++ b/zellij-server/src/plugins/plugin_map.rs @@ -1,12 +1,18 @@ use crate::plugins::plugin_worker::MessageToWorker; use crate::plugins::PluginId; +use bytes::Bytes; +use std::io::Write; use std::{ - collections::{HashMap, HashSet}, + collections::{HashMap, HashSet, VecDeque}, path::PathBuf, sync::{Arc, Mutex}, }; -use wasmer::{Instance, Store}; -use wasmer_wasi::WasiEnv; +use wasmtime::{Instance, Store}; +use wasmtime_wasi::preview1::WasiP1Ctx; +use wasmtime_wasi::{ + HostInputStream, HostOutputStream, StdinStream, StdoutStream, StreamError, StreamResult, + Subscribe, +}; use crate::{thread_bus::ThreadSenders, ClientId}; @@ -165,9 +171,9 @@ impl PluginMap { .iter() .filter(|(_, (running_plugin, _subscriptions, _workers))| { let running_plugin = running_plugin.lock().unwrap(); - let running_plugin_location = &running_plugin.plugin_env.plugin.location; - let running_plugin_configuration = - &running_plugin.plugin_env.plugin.userspace_configuration; + let plugin_config = &running_plugin.store.data().plugin; + let running_plugin_location = &plugin_config.location; + let running_plugin_configuration = &plugin_config.userspace_configuration; running_plugin_location == plugin_location && running_plugin_configuration == plugin_configuration }) @@ -188,9 +194,9 @@ impl PluginMap { > = HashMap::new(); for ((plugin_id, client_id), (running_plugin, _, _)) in self.plugin_assets.iter() { let running_plugin = running_plugin.lock().unwrap(); - let running_plugin_location = &running_plugin.plugin_env.plugin.location; - let running_plugin_configuration = - &running_plugin.plugin_env.plugin.userspace_configuration; + let plugin_config = &running_plugin.store.data().plugin; + let running_plugin_location = &plugin_config.location; + let running_plugin_configuration = &plugin_config.userspace_configuration; match cloned_plugin_assets.get_mut(running_plugin_location) { Some(location_map) => match location_map.get_mut(running_plugin_configuration) { Some(plugin_instances_info) => { @@ -240,13 +246,10 @@ impl PluginMap { .find_map(|((p_id, _), (running_plugin, _, _))| { if *p_id == plugin_id { let running_plugin = running_plugin.lock().unwrap(); - let run_plugin_location = running_plugin.plugin_env.plugin.location.clone(); - let run_plugin_configuration = running_plugin - .plugin_env - .plugin - .userspace_configuration - .clone(); - let initial_cwd = running_plugin.plugin_env.plugin.initial_cwd.clone(); + let plugin_config = &running_plugin.store.data().plugin; + let run_plugin_location = plugin_config.location.clone(); + let run_plugin_configuration = plugin_config.userspace_configuration.clone(); + let initial_cwd = plugin_config.initial_cwd.clone(); Some(RunPlugin { _allow_exec_host_cmd: false, location: run_plugin_location, @@ -262,13 +265,12 @@ impl PluginMap { pub type Subscriptions = HashSet; -#[derive(Clone)] pub struct PluginEnv { pub plugin_id: PluginId, pub plugin: PluginConfig, pub permissions: Arc>>>, pub senders: ThreadSenders, - pub wasi_env: WasiEnv, + pub wasi_ctx: WasiP1Ctx, pub tab_index: Option, pub client_id: ClientId, #[allow(dead_code)] @@ -282,6 +284,80 @@ pub struct PluginEnv { pub plugin_cwd: PathBuf, pub input_pipes_to_unblock: Arc>>, pub input_pipes_to_block: Arc>>, + pub subscriptions: Arc>, + pub stdin_pipe: Arc>>, + pub stdout_pipe: Arc>>, +} + +#[derive(Clone)] +pub struct VecDequeInputStream(pub Arc>>); + +impl StdinStream for VecDequeInputStream { + fn stream(&self) -> Box { + Box::new(self.clone()) + } + + fn isatty(&self) -> bool { + false + } +} + +impl HostInputStream for VecDequeInputStream { + fn read(&mut self, size: usize) -> StreamResult { + let mut inner = self.0.lock().unwrap(); + let len = std::cmp::min(size, inner.len()); + Ok(Bytes::from_iter(inner.drain(0..len))) + } +} + +#[async_trait::async_trait] +impl Subscribe for VecDequeInputStream { + async fn ready(&mut self) {} +} + +pub struct WriteOutputStream(pub Arc>); + +impl Clone for WriteOutputStream { + fn clone(&self) -> Self { + Self(self.0.clone()) + } +} + +impl StdoutStream for WriteOutputStream { + fn stream(&self) -> Box { + Box::new((*self).clone()) + } + + fn isatty(&self) -> bool { + false + } +} + +impl HostOutputStream for WriteOutputStream { + fn write(&mut self, bytes: Bytes) -> StreamResult<()> { + self.0 + .lock() + .unwrap() + .write_all(&*bytes) + .map_err(|e| StreamError::LastOperationFailed(e.into())) + } + + fn flush(&mut self) -> StreamResult<()> { + self.0 + .lock() + .unwrap() + .flush() + .map_err(|e| StreamError::LastOperationFailed(e.into())) + } + + fn check_write(&mut self) -> StreamResult { + Ok(usize::MAX) + } +} + +#[async_trait::async_trait] +impl Subscribe for WriteOutputStream { + async fn ready(&mut self) {} } impl PluginEnv { @@ -305,9 +381,8 @@ pub enum AtomicEvent { } pub struct RunningPlugin { - pub store: Store, + pub store: Store, pub instance: Instance, - pub plugin_env: PluginEnv, pub rows: usize, pub columns: usize, next_event_ids: HashMap, @@ -315,17 +390,10 @@ pub struct RunningPlugin { } impl RunningPlugin { - pub fn new( - store: Store, - instance: Instance, - plugin_env: PluginEnv, - rows: usize, - columns: usize, - ) -> Self { + pub fn new(store: Store, instance: Instance, rows: usize, columns: usize) -> Self { RunningPlugin { store, instance, - plugin_env, rows, columns, next_event_ids: HashMap::new(), diff --git a/zellij-server/src/plugins/plugin_worker.rs b/zellij-server/src/plugins/plugin_worker.rs index ec577102c..3b6307066 100644 --- a/zellij-server/src/plugins/plugin_worker.rs +++ b/zellij-server/src/plugins/plugin_worker.rs @@ -1,6 +1,6 @@ use crate::plugins::plugin_map::PluginEnv; use crate::plugins::zellij_exports::wasi_write_object; -use wasmer::{Instance, Store}; +use wasmtime::{Instance, Store}; use zellij_utils::async_channel::{unbounded, Receiver, Sender}; use zellij_utils::async_std::task; @@ -13,24 +13,21 @@ pub struct RunningWorker { pub instance: Instance, pub name: String, pub plugin_config: PluginConfig, - pub plugin_env: PluginEnv, - store: Store, + pub store: Store, } impl RunningWorker { pub fn new( - store: Store, + store: Store, instance: Instance, name: &str, plugin_config: PluginConfig, - plugin_env: PluginEnv, ) -> Self { RunningWorker { store, instance, name: name.into(), plugin_config, - plugin_env, } } pub fn send_message(&mut self, message: String, payload: String) -> Result<()> { @@ -43,12 +40,11 @@ impl RunningWorker { let protobuf_bytes = protobuf_message.encode_to_vec(); let work_function = self .instance - .exports - .get_function(&self.name) + .get_typed_func::<(), ()>(&mut self.store, &self.name) .with_context(err_context)?; - wasi_write_object(&self.plugin_env.wasi_env, &protobuf_bytes).with_context(err_context)?; + wasi_write_object(self.store.data(), &protobuf_bytes).with_context(err_context)?; work_function - .call(&mut self.store, &[]) + .call(&mut self.store, ()) .with_context(err_context)?; Ok(()) } diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs index b644fe2f8..6743d5e70 100644 --- a/zellij-server/src/plugins/unit/plugin_tests.rs +++ b/zellij-server/src/plugins/unit/plugin_tests.rs @@ -5,7 +5,7 @@ use insta::assert_snapshot; use std::collections::BTreeMap; use std::path::PathBuf; use tempfile::tempdir; -use wasmer::Store; +use wasmtime::Engine; use zellij_utils::data::{ BareKey, Event, KeyWithModifier, PermissionStatus, PermissionType, PluginCapabilities, }; @@ -247,7 +247,7 @@ fn create_plugin_thread( None, ) .should_silently_fail(); - let store = Store::new(wasmer::Singlepass::default()); + let engine = Engine::new(wasmtime::Config::new().strategy(wasmtime::Strategy::Winch)).unwrap(); let data_dir = PathBuf::from(tempdir().unwrap().path()); let default_shell = PathBuf::from("."); let plugin_capabilities = PluginCapabilities::default(); @@ -270,7 +270,7 @@ fn create_plugin_thread( set_var("ZELLIJ_SESSION_NAME", "zellij-test"); plugin_thread_main( plugin_bus, - store, + engine, data_dir, Box::new(Layout::default()), None, @@ -337,7 +337,7 @@ fn create_plugin_thread_with_server_receiver( None, ) .should_silently_fail(); - let store = Store::new(wasmer::Singlepass::default()); + let engine = Engine::new(wasmtime::Config::new().strategy(wasmtime::Strategy::Winch)).unwrap(); let data_dir = PathBuf::from(tempdir().unwrap().path()); let default_shell = PathBuf::from("."); let plugin_capabilities = PluginCapabilities::default(); @@ -349,7 +349,7 @@ fn create_plugin_thread_with_server_receiver( set_var("ZELLIJ_SESSION_NAME", "zellij-test"); plugin_thread_main( plugin_bus, - store, + engine, data_dir, Box::new(Layout::default()), None, @@ -422,7 +422,7 @@ fn create_plugin_thread_with_pty_receiver( None, ) .should_silently_fail(); - let store = Store::new(wasmer::Singlepass::default()); + let engine = Engine::new(wasmtime::Config::new().strategy(wasmtime::Strategy::Winch)).unwrap(); let data_dir = PathBuf::from(tempdir().unwrap().path()); let default_shell = PathBuf::from("."); let plugin_capabilities = PluginCapabilities::default(); @@ -434,7 +434,7 @@ fn create_plugin_thread_with_pty_receiver( set_var("ZELLIJ_SESSION_NAME", "zellij-test"); plugin_thread_main( plugin_bus, - store, + engine, data_dir, Box::new(Layout::default()), None, @@ -502,7 +502,7 @@ fn create_plugin_thread_with_background_jobs_receiver( None, ) .should_silently_fail(); - let store = Store::new(wasmer::Singlepass::default()); + let engine = Engine::new(wasmtime::Config::new().strategy(wasmtime::Strategy::Winch)).unwrap(); let data_dir = PathBuf::from(tempdir().unwrap().path()); let default_shell = PathBuf::from("."); let plugin_capabilities = PluginCapabilities::default(); @@ -514,7 +514,7 @@ fn create_plugin_thread_with_background_jobs_receiver( set_var("ZELLIJ_SESSION_NAME", "zellij-test"); plugin_thread_main( plugin_bus, - store, + engine, data_dir, Box::new(Layout::default()), None, diff --git a/zellij-server/src/plugins/wasm_bridge.rs b/zellij-server/src/plugins/wasm_bridge.rs index a9ba489c5..764b757dc 100644 --- a/zellij-server/src/plugins/wasm_bridge.rs +++ b/zellij-server/src/plugins/wasm_bridge.rs @@ -15,7 +15,7 @@ use std::{ str::FromStr, sync::{Arc, Mutex}, }; -use wasmer::{Module, Store, Value}; +use wasmtime::{Engine, Module}; use zellij_utils::async_channel::Sender; use zellij_utils::async_std::task::{self, JoinHandle}; use zellij_utils::consts::ZELLIJ_CACHE_DIR; @@ -77,7 +77,7 @@ impl PluginRenderAsset { pub struct WasmBridge { connected_clients: Arc>>, senders: ThreadSenders, - store: Arc>, + engine: Engine, plugin_dir: PathBuf, plugin_cache: Arc>>, plugin_map: Arc>, @@ -107,7 +107,7 @@ pub struct WasmBridge { impl WasmBridge { pub fn new( senders: ThreadSenders, - store: Arc>, + engine: Engine, plugin_dir: PathBuf, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, @@ -125,7 +125,7 @@ impl WasmBridge { WasmBridge { connected_clients, senders, - store, + engine, plugin_dir, plugin_cache, plugin_map, @@ -192,7 +192,7 @@ impl WasmBridge { let plugin_dir = self.plugin_dir.clone(); let plugin_cache = self.plugin_cache.clone(); let senders = self.senders.clone(); - let store = self.store.clone(); + let engine = self.engine.clone(); let plugin_map = self.plugin_map.clone(); let connected_clients = self.connected_clients.clone(); let path_to_default_shell = self.path_to_default_shell.clone(); @@ -236,7 +236,7 @@ impl WasmBridge { plugin_dir, plugin_cache, senders.clone(), - store, + engine, plugin_map, size, connected_clients.clone(), @@ -291,7 +291,7 @@ impl WasmBridge { drop(worker_sender.send(MessageToWorker::Exit)); } let running_plugin = running_plugin.lock().unwrap(); - let cache_dir = running_plugin.plugin_env.plugin_own_data_dir.clone(); + let cache_dir = running_plugin.store.data().plugin_own_data_dir.clone(); if let Err(e) = std::fs::remove_dir_all(cache_dir) { log::error!("Failed to remove cache dir for plugin: {:?}", e); } @@ -330,7 +330,7 @@ impl WasmBridge { let plugin_dir = self.plugin_dir.clone(); let plugin_cache = self.plugin_cache.clone(); let senders = self.senders.clone(); - let store = self.store.clone(); + let engine = self.engine.clone(); let plugin_map = self.plugin_map.clone(); let connected_clients = self.connected_clients.clone(); let path_to_default_shell = self.path_to_default_shell.clone(); @@ -346,7 +346,7 @@ impl WasmBridge { plugin_dir.clone(), plugin_cache.clone(), senders.clone(), - store.clone(), + engine.clone(), plugin_map.clone(), connected_clients.clone(), &mut loading_indication, @@ -371,7 +371,7 @@ impl WasmBridge { plugin_dir.clone(), plugin_cache.clone(), senders.clone(), - store.clone(), + engine.clone(), plugin_map.clone(), connected_clients.clone(), &mut loading_indication, @@ -423,7 +423,7 @@ impl WasmBridge { self.plugin_dir.clone(), self.plugin_cache.clone(), self.senders.clone(), - self.store.clone(), + self.engine.clone(), self.plugin_map.clone(), self.connected_clients.clone(), &mut loading_indication, @@ -491,23 +491,17 @@ impl WasmBridge { let rendered_bytes = running_plugin .instance .clone() - .exports - .get_function("render") - .map_err(anyError::new) + .get_typed_func::<(i32, i32), ()>( + &mut running_plugin.store, + "render", + ) .and_then(|render| { - render - .call( - &mut running_plugin.store, - &[ - Value::I32(new_rows as i32), - Value::I32(new_columns as i32), - ], - ) - .map_err(anyError::new) - }) - .and_then(|_| { - wasi_read_string(&running_plugin.plugin_env.wasi_env) + render.call( + &mut running_plugin.store, + (new_rows as i32, new_columns as i32), + ) }) + .and_then(|_| wasi_read_string(running_plugin.store.data())) .with_context(err_context); match rendered_bytes { Ok(rendered_bytes) => { @@ -1078,12 +1072,13 @@ impl WasmBridge { }; running_plugin - .plugin_env + .store + .data_mut() .set_permissions(HashSet::from_iter(permissions.clone())); let mut permission_cache = PermissionCache::from_path_or_default(cache_path); permission_cache.cache( - running_plugin.plugin_env.plugin.location.to_string(), + running_plugin.store.data().plugin.location.to_string(), permissions, ); @@ -1278,30 +1273,25 @@ pub fn apply_event_to_plugin( senders: ThreadSenders, ) -> Result<()> { let instance = &running_plugin.instance; - let plugin_env = &running_plugin.plugin_env; let rows = running_plugin.rows; let columns = running_plugin.columns; let err_context = || format!("Failed to apply event to plugin {plugin_id}"); - match check_event_permission(plugin_env, event) { + match check_event_permission(running_plugin.store.data(), event) { (PermissionStatus::Granted, _) => { let protobuf_event: ProtobufEvent = event .clone() .try_into() .map_err(|e| anyhow!("Failed to convert to protobuf: {:?}", e))?; let update = instance - .exports - .get_function("update") + .get_typed_func::<(), i32>(&mut running_plugin.store, "update") .with_context(err_context)?; - wasi_write_object(&plugin_env.wasi_env, &protobuf_event.encode_to_vec()) + wasi_write_object(running_plugin.store.data(), &protobuf_event.encode_to_vec()) .with_context(err_context)?; - let update_return = update - .call(&mut running_plugin.store, &[]) + let should_render = update + .call(&mut running_plugin.store, ()) .with_context(err_context)?; - let mut should_render = match update_return.get(0) { - Some(Value::I32(n)) => *n == 1, - _ => false, - }; + let mut should_render = should_render == 1; if let Event::PermissionRequestResult(..) = event { // we always render in this case, otherwise the request permission screen stays on // screen @@ -1309,18 +1299,11 @@ pub fn apply_event_to_plugin( } if rows > 0 && columns > 0 && should_render { let rendered_bytes = instance - .exports - .get_function("render") - .map_err(anyError::new) + .get_typed_func::<(i32, i32), ()>(&mut running_plugin.store, "render") .and_then(|render| { - render - .call( - &mut running_plugin.store, - &[Value::I32(rows as i32), Value::I32(columns as i32)], - ) - .map_err(anyError::new) + render.call(&mut running_plugin.store, (rows as i32, columns as i32)) }) - .and_then(|_| wasi_read_string(&plugin_env.wasi_env)) + .and_then(|_| wasi_read_string(running_plugin.store.data())) .with_context(err_context)?; let pipes_to_block_or_unblock = pipes_to_block_or_unblock(running_plugin, None); let plugin_render_asset = PluginRenderAsset::new( diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs index 52ba0953c..04569238a 100644 --- a/zellij-server/src/plugins/zellij_exports.rs +++ b/zellij-server/src/plugins/zellij_exports.rs @@ -1,6 +1,6 @@ use super::PluginInstruction; use crate::background_jobs::BackgroundJob; -use crate::plugins::plugin_map::{PluginEnv, Subscriptions}; +use crate::plugins::plugin_map::PluginEnv; use crate::plugins::wasm_bridge::handle_plugin_crash; use crate::route::route_action; use crate::ServerInstruction; @@ -8,15 +8,14 @@ use log::{debug, warn}; use serde::Serialize; use std::{ collections::{BTreeMap, HashSet}, + io::{Read, Write}, path::PathBuf, process, str::FromStr, - sync::{Arc, Mutex}, thread, time::{Duration, Instant}, }; -use wasmer::{imports, AsStoreMut, Function, FunctionEnv, FunctionEnvMut, Imports}; -use wasmer_wasi::WasiEnv; +use wasmtime::{Caller, Linker}; use zellij_utils::data::{ CommandType, ConnectToSession, FloatingPaneCoordinates, HttpVerb, LayoutInfo, MessageToPlugin, PermissionStatus, PermissionType, PluginPermission, @@ -54,13 +53,13 @@ macro_rules! apply_action { ($action:ident, $error_message:ident, $env: ident) => { if let Err(e) = route_action( $action, - $env.plugin_env.client_id, - Some(PaneId::Plugin($env.plugin_env.plugin_id)), - $env.plugin_env.senders.clone(), - $env.plugin_env.capabilities.clone(), - $env.plugin_env.client_attributes.clone(), - $env.plugin_env.default_shell.clone(), - $env.plugin_env.default_layout.clone(), + $env.client_id, + Some(PaneId::Plugin($env.plugin_id)), + $env.senders.clone(), + $env.capabilities.clone(), + $env.client_attributes.clone(), + $env.default_shell.clone(), + $env.default_layout.clone(), None, ) { log::error!("{}: {:?}", $error_message(), e); @@ -68,46 +67,22 @@ macro_rules! apply_action { }; } -pub fn zellij_exports( - store: &mut impl AsStoreMut, - plugin_env: &PluginEnv, - subscriptions: &Arc>, -) -> Imports { - let function_env = FunctionEnv::new(store, ForeignFunctionEnv::new(plugin_env, subscriptions)); - imports! { - "zellij" => { - "host_run_plugin_command" => { - Function::new_typed_with_env(store, &function_env, host_run_plugin_command) - } - } - } +pub fn zellij_exports(linker: &mut Linker) { + linker + .func_wrap("zellij", "host_run_plugin_command", host_run_plugin_command) + .unwrap(); } -#[derive(Clone)] -pub struct ForeignFunctionEnv { - pub plugin_env: PluginEnv, - pub subscriptions: Arc>, -} - -impl ForeignFunctionEnv { - pub fn new(plugin_env: &PluginEnv, subscriptions: &Arc>) -> Self { - ForeignFunctionEnv { - plugin_env: plugin_env.clone(), - subscriptions: subscriptions.clone(), - } - } -} - -fn host_run_plugin_command(env: FunctionEnvMut) { - let env = env.data(); - let err_context = || format!("failed to run plugin command {}", env.plugin_env.name()); - wasi_read_bytes(&env.plugin_env.wasi_env) +fn host_run_plugin_command(caller: Caller<'_, PluginEnv>) { + let env = caller.data(); + let err_context = || format!("failed to run plugin command {}", env.name()); + wasi_read_bytes(env) .and_then(|bytes| { let command: ProtobufPluginCommand = ProtobufPluginCommand::decode(bytes.as_slice())?; let command: PluginCommand = command .try_into() .map_err(|e| anyhow!("failed to convert serialized command: {}", e))?; - match check_command_permission(&env.plugin_env, &command) { + match check_command_permission(&env, &command) { (PermissionStatus::Granted, _) => match command { PluginCommand::Subscribe(event_list) => subscribe(env, event_list)?, PluginCommand::Unsubscribe(event_list) => unsubscribe(env, event_list)?, @@ -273,7 +248,7 @@ fn host_run_plugin_command(env: FunctionEnvMut) { (PermissionStatus::Denied, permission) => { log::error!( "Plugin '{}' permission '{}' denied - Command '{:?}' denied", - env.plugin_env.name(), + env.name(), permission .map(|p| p.to_string()) .unwrap_or("UNKNOWN".to_owned()), @@ -283,64 +258,50 @@ fn host_run_plugin_command(env: FunctionEnvMut) { }; Ok(()) }) - .with_context(|| format!("failed to run plugin command {}", env.plugin_env.name())) + .with_context(|| format!("failed to run plugin command {}", env.name())) .non_fatal(); } -fn subscribe(env: &ForeignFunctionEnv, event_list: HashSet) -> Result<()> { +fn subscribe(env: &PluginEnv, event_list: HashSet) -> Result<()> { env.subscriptions .lock() .to_anyhow()? .extend(event_list.clone()); - env.plugin_env - .senders + env.senders .send_to_plugin(PluginInstruction::PluginSubscribedToEvents( - env.plugin_env.plugin_id, - env.plugin_env.client_id, + env.plugin_id, + env.client_id, event_list, )) } -fn unblock_cli_pipe_input(env: &ForeignFunctionEnv, pipe_name: String) { - env.plugin_env - .input_pipes_to_unblock - .lock() - .unwrap() - .insert(pipe_name); +fn unblock_cli_pipe_input(env: &PluginEnv, pipe_name: String) { + env.input_pipes_to_unblock.lock().unwrap().insert(pipe_name); } -fn block_cli_pipe_input(env: &ForeignFunctionEnv, pipe_name: String) { - env.plugin_env - .input_pipes_to_block - .lock() - .unwrap() - .insert(pipe_name); +fn block_cli_pipe_input(env: &PluginEnv, pipe_name: String) { + env.input_pipes_to_block.lock().unwrap().insert(pipe_name); } -fn cli_pipe_output(env: &ForeignFunctionEnv, pipe_name: String, output: String) -> Result<()> { - env.plugin_env - .senders +fn cli_pipe_output(env: &PluginEnv, pipe_name: String, output: String) -> Result<()> { + env.senders .send_to_server(ServerInstruction::CliPipeOutput(pipe_name, output)) .context("failed to send pipe output") } -fn message_to_plugin( - env: &ForeignFunctionEnv, - mut message_to_plugin: MessageToPlugin, -) -> Result<()> { +fn message_to_plugin(env: &PluginEnv, mut message_to_plugin: MessageToPlugin) -> Result<()> { if message_to_plugin.plugin_url.as_ref().map(|s| s.as_str()) == Some("zellij:OWN_URL") { - message_to_plugin.plugin_url = Some(env.plugin_env.plugin.location.display()); + message_to_plugin.plugin_url = Some(env.plugin.location.display()); } - env.plugin_env - .senders + env.senders .send_to_plugin(PluginInstruction::MessageFromPlugin { - source_plugin_id: env.plugin_env.plugin_id, + source_plugin_id: env.plugin_id, message: message_to_plugin, }) .context("failed to send message to plugin") } -fn unsubscribe(env: &ForeignFunctionEnv, event_list: HashSet) -> Result<()> { +fn unsubscribe(env: &PluginEnv, event_list: HashSet) -> Result<()> { env.subscriptions .lock() .to_anyhow()? @@ -348,14 +309,13 @@ fn unsubscribe(env: &ForeignFunctionEnv, event_list: HashSet) -> Resu Ok(()) } -fn set_selectable(env: &ForeignFunctionEnv, selectable: bool) { - match env.plugin_env.plugin.run { +fn set_selectable(env: &PluginEnv, selectable: bool) { + match env.plugin.run { PluginType::Pane(Some(tab_index)) => { // let selectable = selectable != 0; - env.plugin_env - .senders + env.senders .send_to_screen(ScreenInstruction::SetSelectable( - PaneId::Plugin(env.plugin_env.plugin_id), + PaneId::Plugin(env.plugin_id), selectable, tab_index, )) @@ -363,7 +323,7 @@ fn set_selectable(env: &ForeignFunctionEnv, selectable: bool) { format!( "failed to set plugin {} selectable from plugin {}", selectable, - env.plugin_env.name() + env.name() ) }) .non_fatal(); @@ -371,22 +331,21 @@ fn set_selectable(env: &ForeignFunctionEnv, selectable: bool) { _ => { debug!( "{} - Calling method 'set_selectable' does nothing for headless plugins", - env.plugin_env.plugin.location + env.plugin.location ) }, } } -fn request_permission(env: &ForeignFunctionEnv, permissions: Vec) -> Result<()> { +fn request_permission(env: &PluginEnv, permissions: Vec) -> Result<()> { if PermissionCache::from_path_or_default(None) - .check_permissions(env.plugin_env.plugin.location.to_string(), &permissions) + .check_permissions(env.plugin.location.to_string(), &permissions) { return env - .plugin_env .senders .send_to_plugin(PluginInstruction::PermissionRequestResult( - env.plugin_env.plugin_id, - Some(env.plugin_env.client_id), + env.plugin_id, + Some(env.client_id), permissions.to_vec(), PermissionStatus::Granted, None, @@ -396,67 +355,62 @@ fn request_permission(env: &ForeignFunctionEnv, permissions: Vec // we do this so that messages that have arrived while the user is seeing the permission screen // will be cached and reapplied once the permission is granted let _ = env - .plugin_env .senders .send_to_plugin(PluginInstruction::CachePluginEvents { - plugin_id: env.plugin_env.plugin_id, + plugin_id: env.plugin_id, }); - env.plugin_env - .senders + env.senders .send_to_screen(ScreenInstruction::RequestPluginPermissions( - env.plugin_env.plugin_id, - PluginPermission::new(env.plugin_env.plugin.location.to_string(), permissions), + env.plugin_id, + PluginPermission::new(env.plugin.location.to_string(), permissions), )) } -fn get_plugin_ids(env: &ForeignFunctionEnv) { +fn get_plugin_ids(env: &PluginEnv) { let ids = PluginIds { - plugin_id: env.plugin_env.plugin_id, + plugin_id: env.plugin_id, zellij_pid: process::id(), - initial_cwd: env.plugin_env.plugin_cwd.clone(), + initial_cwd: env.plugin_cwd.clone(), }; ProtobufPluginIds::try_from(ids) .map_err(|e| anyhow!("Failed to serialized plugin ids: {}", e)) .and_then(|serialized| { - wasi_write_object(&env.plugin_env.wasi_env, &serialized.encode_to_vec())?; + wasi_write_object(env, &serialized.encode_to_vec())?; Ok(()) }) .with_context(|| { format!( "failed to query plugin IDs from host for plugin {}", - env.plugin_env.name() + env.name() ) }) .non_fatal(); } -fn get_zellij_version(env: &ForeignFunctionEnv) { +fn get_zellij_version(env: &PluginEnv) { let protobuf_zellij_version = ProtobufZellijVersion { version: VERSION.to_owned(), }; - wasi_write_object( - &env.plugin_env.wasi_env, - &protobuf_zellij_version.encode_to_vec(), - ) - .with_context(|| { - format!( - "failed to request zellij version from host for plugin {}", - env.plugin_env.name() - ) - }) - .non_fatal(); + wasi_write_object(env, &protobuf_zellij_version.encode_to_vec()) + .with_context(|| { + format!( + "failed to request zellij version from host for plugin {}", + env.name() + ) + }) + .non_fatal(); } -fn open_file(env: &ForeignFunctionEnv, file_to_open: FileToOpen) { - let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name()); +fn open_file(env: &PluginEnv, file_to_open: FileToOpen) { + let error_msg = || format!("failed to open file in plugin {}", env.name()); let floating = false; let in_place = false; - let path = env.plugin_env.plugin_cwd.join(file_to_open.path); + let path = env.plugin_cwd.join(file_to_open.path); let cwd = file_to_open .cwd - .map(|cwd| env.plugin_env.plugin_cwd.join(cwd)) - .or_else(|| Some(env.plugin_env.plugin_cwd.clone())); + .map(|cwd| env.plugin_cwd.join(cwd)) + .or_else(|| Some(env.plugin_cwd.clone())); let action = Action::EditFile( path, file_to_open.line_number, @@ -470,18 +424,18 @@ fn open_file(env: &ForeignFunctionEnv, file_to_open: FileToOpen) { } fn open_file_floating( - env: &ForeignFunctionEnv, + env: &PluginEnv, file_to_open: FileToOpen, floating_pane_coordinates: Option, ) { - let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name()); + let error_msg = || format!("failed to open file in plugin {}", env.name()); let floating = true; let in_place = false; - let path = env.plugin_env.plugin_cwd.join(file_to_open.path); + let path = env.plugin_cwd.join(file_to_open.path); let cwd = file_to_open .cwd - .map(|cwd| env.plugin_env.plugin_cwd.join(cwd)) - .or_else(|| Some(env.plugin_env.plugin_cwd.clone())); + .map(|cwd| env.plugin_cwd.join(cwd)) + .or_else(|| Some(env.plugin_cwd.clone())); let action = Action::EditFile( path, file_to_open.line_number, @@ -494,15 +448,15 @@ fn open_file_floating( apply_action!(action, error_msg, env); } -fn open_file_in_place(env: &ForeignFunctionEnv, file_to_open: FileToOpen) { - let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name()); +fn open_file_in_place(env: &PluginEnv, file_to_open: FileToOpen) { + let error_msg = || format!("failed to open file in plugin {}", env.name()); let floating = false; let in_place = true; - let path = env.plugin_env.plugin_cwd.join(file_to_open.path); + let path = env.plugin_cwd.join(file_to_open.path); let cwd = file_to_open .cwd - .map(|cwd| env.plugin_env.plugin_cwd.join(cwd)) - .or_else(|| Some(env.plugin_env.plugin_cwd.clone())); + .map(|cwd| env.plugin_cwd.join(cwd)) + .or_else(|| Some(env.plugin_cwd.clone())); let action = Action::EditFile( path, @@ -516,12 +470,12 @@ fn open_file_in_place(env: &ForeignFunctionEnv, file_to_open: FileToOpen) { apply_action!(action, error_msg, env); } -fn open_terminal(env: &ForeignFunctionEnv, cwd: PathBuf) { - let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name()); - let cwd = env.plugin_env.plugin_cwd.join(cwd); - let mut default_shell = env.plugin_env.default_shell.clone().unwrap_or_else(|| { +fn open_terminal(env: &PluginEnv, cwd: PathBuf) { + let error_msg = || format!("failed to open file in plugin {}", env.name()); + let cwd = env.plugin_cwd.join(cwd); + let mut default_shell = env.default_shell.clone().unwrap_or_else(|| { TerminalAction::RunCommand(RunCommand { - command: env.plugin_env.path_to_default_shell.clone(), + command: env.path_to_default_shell.clone(), ..Default::default() }) }); @@ -535,15 +489,15 @@ fn open_terminal(env: &ForeignFunctionEnv, cwd: PathBuf) { } fn open_terminal_floating( - env: &ForeignFunctionEnv, + env: &PluginEnv, cwd: PathBuf, floating_pane_coordinates: Option, ) { - let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name()); - let cwd = env.plugin_env.plugin_cwd.join(cwd); - let mut default_shell = env.plugin_env.default_shell.clone().unwrap_or_else(|| { + let error_msg = || format!("failed to open file in plugin {}", env.name()); + let cwd = env.plugin_cwd.join(cwd); + let mut default_shell = env.default_shell.clone().unwrap_or_else(|| { TerminalAction::RunCommand(RunCommand { - command: env.plugin_env.path_to_default_shell.clone(), + command: env.path_to_default_shell.clone(), ..Default::default() }) }); @@ -556,12 +510,12 @@ fn open_terminal_floating( apply_action!(action, error_msg, env); } -fn open_terminal_in_place(env: &ForeignFunctionEnv, cwd: PathBuf) { - let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name()); - let cwd = env.plugin_env.plugin_cwd.join(cwd); - let mut default_shell = env.plugin_env.default_shell.clone().unwrap_or_else(|| { +fn open_terminal_in_place(env: &PluginEnv, cwd: PathBuf) { + let error_msg = || format!("failed to open file in plugin {}", env.name()); + let cwd = env.plugin_cwd.join(cwd); + let mut default_shell = env.default_shell.clone().unwrap_or_else(|| { TerminalAction::RunCommand(RunCommand { - command: env.plugin_env.path_to_default_shell.clone(), + command: env.path_to_default_shell.clone(), ..Default::default() }) }); @@ -574,12 +528,10 @@ fn open_terminal_in_place(env: &ForeignFunctionEnv, cwd: PathBuf) { apply_action!(action, error_msg, env); } -fn open_command_pane(env: &ForeignFunctionEnv, command_to_run: CommandToRun) { - let error_msg = || format!("failed to open command in plugin {}", env.plugin_env.name()); +fn open_command_pane(env: &PluginEnv, command_to_run: CommandToRun) { + let error_msg = || format!("failed to open command in plugin {}", env.name()); let command = command_to_run.path; - let cwd = command_to_run - .cwd - .map(|cwd| env.plugin_env.plugin_cwd.join(cwd)); + let cwd = command_to_run.cwd.map(|cwd| env.plugin_cwd.join(cwd)); let args = command_to_run.args; let direction = None; let hold_on_close = true; @@ -598,15 +550,13 @@ fn open_command_pane(env: &ForeignFunctionEnv, command_to_run: CommandToRun) { } fn open_command_pane_floating( - env: &ForeignFunctionEnv, + env: &PluginEnv, command_to_run: CommandToRun, floating_pane_coordinates: Option, ) { - let error_msg = || format!("failed to open command in plugin {}", env.plugin_env.name()); + let error_msg = || format!("failed to open command in plugin {}", env.name()); let command = command_to_run.path; - let cwd = command_to_run - .cwd - .map(|cwd| env.plugin_env.plugin_cwd.join(cwd)); + let cwd = command_to_run.cwd.map(|cwd| env.plugin_cwd.join(cwd)); let args = command_to_run.args; let direction = None; let hold_on_close = true; @@ -624,12 +574,10 @@ fn open_command_pane_floating( apply_action!(action, error_msg, env); } -fn open_command_pane_in_place(env: &ForeignFunctionEnv, command_to_run: CommandToRun) { - let error_msg = || format!("failed to open command in plugin {}", env.plugin_env.name()); +fn open_command_pane_in_place(env: &PluginEnv, command_to_run: CommandToRun) { + let error_msg = || format!("failed to open command in plugin {}", env.name()); let command = command_to_run.path; - let cwd = command_to_run - .cwd - .map(|cwd| env.plugin_env.plugin_cwd.join(cwd)); + let cwd = command_to_run.cwd.map(|cwd| env.plugin_cwd.join(cwd)); let args = command_to_run.args; let direction = None; let hold_on_close = true; @@ -647,23 +595,19 @@ fn open_command_pane_in_place(env: &ForeignFunctionEnv, command_to_run: CommandT apply_action!(action, error_msg, env); } -fn switch_tab_to(env: &ForeignFunctionEnv, tab_idx: u32) { - env.plugin_env - .senders - .send_to_screen(ScreenInstruction::GoToTab( - tab_idx, - Some(env.plugin_env.client_id), - )) +fn switch_tab_to(env: &PluginEnv, tab_idx: u32) { + env.senders + .send_to_screen(ScreenInstruction::GoToTab(tab_idx, Some(env.client_id))) .with_context(|| { format!( "failed to switch to tab {tab_idx} from plugin {}", - env.plugin_env.name() + env.name() ) }) .non_fatal(); } -fn set_timeout(env: &ForeignFunctionEnv, secs: f64) { +fn set_timeout(env: &PluginEnv, secs: f64) { // There is a fancy, high-performance way to do this with zero additional threads: // If the plugin thread keeps a BinaryHeap of timer structs, it can manage multiple and easily `.peek()` at the // next time to trigger in O(1) time. Once the wake-up time is known, the `wasm` thread can use `recv_timeout()` @@ -673,10 +617,10 @@ fn set_timeout(env: &ForeignFunctionEnv, secs: f64) { // timers as we'd like. // // But that's a lot of code, and this is a few lines: - let send_plugin_instructions = env.plugin_env.senders.to_plugin.clone(); - let update_target = Some(env.plugin_env.plugin_id); - let client_id = env.plugin_env.client_id; - let plugin_name = env.plugin_env.name(); + let send_plugin_instructions = env.senders.to_plugin.clone(); + let update_target = Some(env.plugin_id); + let client_id = env.client_id; + let plugin_name = env.name(); // TODO: we should really use an async task for this thread::spawn(move || { let start_time = Instant::now(); @@ -706,18 +650,18 @@ fn set_timeout(env: &ForeignFunctionEnv, secs: f64) { }); } -fn exec_cmd(env: &ForeignFunctionEnv, mut command_line: Vec) { +fn exec_cmd(env: &PluginEnv, mut command_line: Vec) { log::warn!("The ExecCmd plugin command is deprecated and will be removed in a future version. Please use RunCmd instead (it has all the things and can even show you STDOUT/STDERR and an exit code!)"); let err_context = || { format!( "failed to execute command on host for plugin '{}'", - env.plugin_env.name() + env.name() ) }; let command = command_line.remove(0); // Bail out if we're forbidden to run command - if !env.plugin_env.plugin._allow_exec_host_cmd { + if !env.plugin._allow_exec_host_cmd { warn!("This plugin isn't allow to run command in host side, skip running this command: '{cmd} {args}'.", cmd = command, args = command_line.join(" ")); return; @@ -732,7 +676,7 @@ fn exec_cmd(env: &ForeignFunctionEnv, mut command_line: Vec) { } fn run_command( - env: &ForeignFunctionEnv, + env: &PluginEnv, mut command_line: Vec, env_variables: BTreeMap, cwd: PathBuf, @@ -742,13 +686,12 @@ fn run_command( log::error!("Command cannot be empty"); } else { let command = command_line.remove(0); - let cwd = env.plugin_env.plugin_cwd.join(cwd); + let cwd = env.plugin_cwd.join(cwd); let _ = env - .plugin_env .senders .send_to_background_jobs(BackgroundJob::RunCommand( - env.plugin_env.plugin_id, - env.plugin_env.client_id, + env.plugin_id, + env.client_id, command, command_line, env_variables, @@ -759,7 +702,7 @@ fn run_command( } fn web_request( - env: &ForeignFunctionEnv, + env: &PluginEnv, url: String, verb: HttpVerb, headers: BTreeMap, @@ -767,11 +710,10 @@ fn web_request( context: BTreeMap, ) { let _ = env - .plugin_env .senders .send_to_background_jobs(BackgroundJob::WebRequest( - env.plugin_env.plugin_id, - env.plugin_env.client_id, + env.plugin_id, + env.client_id, url, verb, headers, @@ -780,95 +722,84 @@ fn web_request( )); } -fn post_message_to(env: &ForeignFunctionEnv, plugin_message: PluginMessage) -> Result<()> { +fn post_message_to(env: &PluginEnv, plugin_message: PluginMessage) -> Result<()> { let worker_name = plugin_message .worker_name .ok_or(anyhow!("Worker name not specified in message to worker"))?; - env.plugin_env - .senders + env.senders .send_to_plugin(PluginInstruction::PostMessagesToPluginWorker( - env.plugin_env.plugin_id, - env.plugin_env.client_id, + env.plugin_id, + env.client_id, worker_name, vec![(plugin_message.name, plugin_message.payload)], )) } -fn post_message_to_plugin(env: &ForeignFunctionEnv, plugin_message: PluginMessage) -> Result<()> { +fn post_message_to_plugin(env: &PluginEnv, plugin_message: PluginMessage) -> Result<()> { if let Some(worker_name) = plugin_message.worker_name { return Err(anyhow!( "Worker name (\"{}\") should not be specified in message to plugin", worker_name )); } - env.plugin_env - .senders + env.senders .send_to_plugin(PluginInstruction::PostMessageToPlugin( - env.plugin_env.plugin_id, - env.plugin_env.client_id, + env.plugin_id, + env.client_id, plugin_message.name, plugin_message.payload, )) } -fn hide_self(env: &ForeignFunctionEnv) -> Result<()> { - env.plugin_env - .senders +fn hide_self(env: &PluginEnv) -> Result<()> { + env.senders .send_to_screen(ScreenInstruction::SuppressPane( - PaneId::Plugin(env.plugin_env.plugin_id), - env.plugin_env.client_id, + PaneId::Plugin(env.plugin_id), + env.client_id, )) .with_context(|| format!("failed to hide self")) } -fn show_self(env: &ForeignFunctionEnv, should_float_if_hidden: bool) { - let action = Action::FocusPluginPaneWithId(env.plugin_env.plugin_id, should_float_if_hidden); +fn show_self(env: &PluginEnv, should_float_if_hidden: bool) { + let action = Action::FocusPluginPaneWithId(env.plugin_id, should_float_if_hidden); let error_msg = || format!("Failed to show self for plugin"); apply_action!(action, error_msg, env); } -fn close_self(env: &ForeignFunctionEnv) { - env.plugin_env - .senders +fn close_self(env: &PluginEnv) { + env.senders .send_to_screen(ScreenInstruction::ClosePane( - PaneId::Plugin(env.plugin_env.plugin_id), + PaneId::Plugin(env.plugin_id), None, )) .with_context(|| format!("failed to close self")) .non_fatal(); - env.plugin_env - .senders - .send_to_plugin(PluginInstruction::Unload(env.plugin_env.plugin_id)) + env.senders + .send_to_plugin(PluginInstruction::Unload(env.plugin_id)) .with_context(|| format!("failed to close self")) .non_fatal(); } -fn rebind_keys(env: &ForeignFunctionEnv, new_keybinds: String) -> Result<()> { +fn rebind_keys(env: &PluginEnv, new_keybinds: String) -> Result<()> { let err_context = || "Failed to rebind keys"; - let client_id = env.plugin_env.client_id; - env.plugin_env - .senders + let client_id = env.client_id; + env.senders .send_to_server(ServerInstruction::RebindKeys(client_id, new_keybinds)) .with_context(err_context)?; Ok(()) } -fn switch_to_mode(env: &ForeignFunctionEnv, input_mode: InputMode) { +fn switch_to_mode(env: &PluginEnv, input_mode: InputMode) { let action = Action::SwitchToMode(input_mode); - let error_msg = || { - format!( - "failed to switch to mode in plugin {}", - env.plugin_env.name() - ) - }; + let error_msg = || format!("failed to switch to mode in plugin {}", env.name()); apply_action!(action, error_msg, env); } -fn new_tabs_with_layout(env: &ForeignFunctionEnv, raw_layout: &str) -> Result<()> { +fn new_tabs_with_layout(env: &PluginEnv, raw_layout: &str) -> Result<()> { // TODO: cwd let layout = Layout::from_str( &raw_layout, - format!("Layout from plugin: {}", env.plugin_env.name()), + format!("Layout from plugin: {}", env.name()), None, None, ) @@ -877,15 +808,15 @@ fn new_tabs_with_layout(env: &ForeignFunctionEnv, raw_layout: &str) -> Result<() Ok(()) } -fn new_tabs_with_layout_info(env: &ForeignFunctionEnv, layout_info: LayoutInfo) -> Result<()> { +fn new_tabs_with_layout_info(env: &PluginEnv, layout_info: LayoutInfo) -> Result<()> { // TODO: cwd - let layout = Layout::from_layout_info(&env.plugin_env.layout_dir, layout_info) + let layout = Layout::from_layout_info(&env.layout_dir, layout_info) .map_err(|e| anyhow!("Failed to parse layout: {:?}", e))?; apply_layout(env, layout); Ok(()) } -fn apply_layout(env: &ForeignFunctionEnv, layout: Layout) { +fn apply_layout(env: &PluginEnv, layout: Layout) { let mut tabs_to_open = vec![]; let tabs = layout.tabs(); if tabs.is_empty() { @@ -919,68 +850,68 @@ fn apply_layout(env: &ForeignFunctionEnv, layout: Layout) { } } -fn new_tab(env: &ForeignFunctionEnv) { +fn new_tab(env: &PluginEnv) { let action = Action::NewTab(None, vec![], None, None, None); let error_msg = || format!("Failed to open new tab"); apply_action!(action, error_msg, env); } -fn go_to_next_tab(env: &ForeignFunctionEnv) { +fn go_to_next_tab(env: &PluginEnv) { let action = Action::GoToNextTab; let error_msg = || format!("Failed to go to next tab"); apply_action!(action, error_msg, env); } -fn go_to_previous_tab(env: &ForeignFunctionEnv) { +fn go_to_previous_tab(env: &PluginEnv) { let action = Action::GoToPreviousTab; let error_msg = || format!("Failed to go to previous tab"); apply_action!(action, error_msg, env); } -fn resize(env: &ForeignFunctionEnv, resize: Resize) { - let error_msg = || format!("failed to resize in plugin {}", env.plugin_env.name()); +fn resize(env: &PluginEnv, resize: Resize) { + let error_msg = || format!("failed to resize in plugin {}", env.name()); let action = Action::Resize(resize, None); apply_action!(action, error_msg, env); } -fn resize_with_direction(env: &ForeignFunctionEnv, resize: ResizeStrategy) { - let error_msg = || format!("failed to resize in plugin {}", env.plugin_env.name()); +fn resize_with_direction(env: &PluginEnv, resize: ResizeStrategy) { + let error_msg = || format!("failed to resize in plugin {}", env.name()); let action = Action::Resize(resize.resize, resize.direction); apply_action!(action, error_msg, env); } -fn focus_next_pane(env: &ForeignFunctionEnv) { +fn focus_next_pane(env: &PluginEnv) { let action = Action::FocusNextPane; let error_msg = || format!("Failed to focus next pane"); apply_action!(action, error_msg, env); } -fn focus_previous_pane(env: &ForeignFunctionEnv) { +fn focus_previous_pane(env: &PluginEnv) { let action = Action::FocusPreviousPane; let error_msg = || format!("Failed to focus previous pane"); apply_action!(action, error_msg, env); } -fn move_focus(env: &ForeignFunctionEnv, direction: Direction) { - let error_msg = || format!("failed to move focus in plugin {}", env.plugin_env.name()); +fn move_focus(env: &PluginEnv, direction: Direction) { + let error_msg = || format!("failed to move focus in plugin {}", env.name()); let action = Action::MoveFocus(direction); apply_action!(action, error_msg, env); } -fn move_focus_or_tab(env: &ForeignFunctionEnv, direction: Direction) { - let error_msg = || format!("failed to move focus in plugin {}", env.plugin_env.name()); +fn move_focus_or_tab(env: &PluginEnv, direction: Direction) { + let error_msg = || format!("failed to move focus in plugin {}", env.name()); let action = Action::MoveFocusOrTab(direction); apply_action!(action, error_msg, env); } -fn detach(env: &ForeignFunctionEnv) { +fn detach(env: &PluginEnv) { let action = Action::Detach; let error_msg = || format!("Failed to detach"); apply_action!(action, error_msg, env); } fn switch_session( - env: &ForeignFunctionEnv, + env: &PluginEnv, session_name: Option, tab_position: Option, pane_id: Option<(u32, bool)>, @@ -989,7 +920,7 @@ fn switch_session( ) -> Result<()> { // pane_id is (id, is_plugin) let err_context = || format!("Failed to switch session"); - let client_id = env.plugin_env.client_id; + let client_id = env.client_id; let tab_position = tab_position.map(|p| p + 1); // ¯\_()_/¯ let connect_to_session = ConnectToSession { name: session_name, @@ -998,8 +929,7 @@ fn switch_session( layout, cwd, }; - env.plugin_env - .senders + env.senders .send_to_server(ServerInstruction::SwitchSession( connect_to_session, client_id, @@ -1054,236 +984,176 @@ fn delete_all_dead_sessions() -> Result<()> { Ok(()) } -fn edit_scrollback(env: &ForeignFunctionEnv) { +fn edit_scrollback(env: &PluginEnv) { let action = Action::EditScrollback; let error_msg = || format!("Failed to edit scrollback"); apply_action!(action, error_msg, env); } -fn write(env: &ForeignFunctionEnv, bytes: Vec) { - let error_msg = || format!("failed to write in plugin {}", env.plugin_env.name()); +fn write(env: &PluginEnv, bytes: Vec) { + let error_msg = || format!("failed to write in plugin {}", env.name()); let action = Action::Write(None, bytes, false); apply_action!(action, error_msg, env); } -fn write_chars(env: &ForeignFunctionEnv, chars_to_write: String) { - let error_msg = || format!("failed to write in plugin {}", env.plugin_env.name()); +fn write_chars(env: &PluginEnv, chars_to_write: String) { + let error_msg = || format!("failed to write in plugin {}", env.name()); let action = Action::WriteChars(chars_to_write); apply_action!(action, error_msg, env); } -fn toggle_tab(env: &ForeignFunctionEnv) { +fn toggle_tab(env: &PluginEnv) { let error_msg = || format!("Failed to toggle tab"); let action = Action::ToggleTab; apply_action!(action, error_msg, env); } -fn move_pane(env: &ForeignFunctionEnv) { - let error_msg = || format!("failed to move pane in plugin {}", env.plugin_env.name()); +fn move_pane(env: &PluginEnv) { + let error_msg = || format!("failed to move pane in plugin {}", env.name()); let action = Action::MovePane(None); apply_action!(action, error_msg, env); } -fn move_pane_with_direction(env: &ForeignFunctionEnv, direction: Direction) { - let error_msg = || format!("failed to move pane in plugin {}", env.plugin_env.name()); +fn move_pane_with_direction(env: &PluginEnv, direction: Direction) { + let error_msg = || format!("failed to move pane in plugin {}", env.name()); let action = Action::MovePane(Some(direction)); apply_action!(action, error_msg, env); } -fn clear_screen(env: &ForeignFunctionEnv) { - let error_msg = || format!("failed to clear screen in plugin {}", env.plugin_env.name()); +fn clear_screen(env: &PluginEnv) { + let error_msg = || format!("failed to clear screen in plugin {}", env.name()); let action = Action::ClearScreen; apply_action!(action, error_msg, env); } -fn scroll_up(env: &ForeignFunctionEnv) { - let error_msg = || format!("failed to scroll up in plugin {}", env.plugin_env.name()); +fn scroll_up(env: &PluginEnv) { + let error_msg = || format!("failed to scroll up in plugin {}", env.name()); let action = Action::ScrollUp; apply_action!(action, error_msg, env); } -fn scroll_down(env: &ForeignFunctionEnv) { - let error_msg = || format!("failed to scroll down in plugin {}", env.plugin_env.name()); +fn scroll_down(env: &PluginEnv) { + let error_msg = || format!("failed to scroll down in plugin {}", env.name()); let action = Action::ScrollDown; apply_action!(action, error_msg, env); } -fn scroll_to_top(env: &ForeignFunctionEnv) { - let error_msg = || format!("failed to scroll in plugin {}", env.plugin_env.name()); +fn scroll_to_top(env: &PluginEnv) { + let error_msg = || format!("failed to scroll in plugin {}", env.name()); let action = Action::ScrollToTop; apply_action!(action, error_msg, env); } -fn scroll_to_bottom(env: &ForeignFunctionEnv) { - let error_msg = || format!("failed to scroll in plugin {}", env.plugin_env.name()); +fn scroll_to_bottom(env: &PluginEnv) { + let error_msg = || format!("failed to scroll in plugin {}", env.name()); let action = Action::ScrollToBottom; apply_action!(action, error_msg, env); } -fn page_scroll_up(env: &ForeignFunctionEnv) { - let error_msg = || format!("failed to scroll in plugin {}", env.plugin_env.name()); +fn page_scroll_up(env: &PluginEnv) { + let error_msg = || format!("failed to scroll in plugin {}", env.name()); let action = Action::PageScrollUp; apply_action!(action, error_msg, env); } -fn page_scroll_down(env: &ForeignFunctionEnv) { - let error_msg = || format!("failed to scroll in plugin {}", env.plugin_env.name()); +fn page_scroll_down(env: &PluginEnv) { + let error_msg = || format!("failed to scroll in plugin {}", env.name()); let action = Action::PageScrollDown; apply_action!(action, error_msg, env); } -fn toggle_focus_fullscreen(env: &ForeignFunctionEnv) { - let error_msg = || { - format!( - "failed to toggle full screen in plugin {}", - env.plugin_env.name() - ) - }; +fn toggle_focus_fullscreen(env: &PluginEnv) { + let error_msg = || format!("failed to toggle full screen in plugin {}", env.name()); let action = Action::ToggleFocusFullscreen; apply_action!(action, error_msg, env); } -fn toggle_pane_frames(env: &ForeignFunctionEnv) { - let error_msg = || { - format!( - "failed to toggle full screen in plugin {}", - env.plugin_env.name() - ) - }; +fn toggle_pane_frames(env: &PluginEnv) { + let error_msg = || format!("failed to toggle full screen in plugin {}", env.name()); let action = Action::TogglePaneFrames; apply_action!(action, error_msg, env); } -fn toggle_pane_embed_or_eject(env: &ForeignFunctionEnv) { +fn toggle_pane_embed_or_eject(env: &PluginEnv) { let error_msg = || { format!( "failed to toggle pane embed or eject in plugin {}", - env.plugin_env.name() + env.name() ) }; let action = Action::TogglePaneEmbedOrFloating; apply_action!(action, error_msg, env); } -fn undo_rename_pane(env: &ForeignFunctionEnv) { - let error_msg = || { - format!( - "failed to undo rename pane in plugin {}", - env.plugin_env.name() - ) - }; +fn undo_rename_pane(env: &PluginEnv) { + let error_msg = || format!("failed to undo rename pane in plugin {}", env.name()); let action = Action::UndoRenamePane; apply_action!(action, error_msg, env); } -fn close_focus(env: &ForeignFunctionEnv) { - let error_msg = || { - format!( - "failed to close focused pane in plugin {}", - env.plugin_env.name() - ) - }; +fn close_focus(env: &PluginEnv) { + let error_msg = || format!("failed to close focused pane in plugin {}", env.name()); let action = Action::CloseFocus; apply_action!(action, error_msg, env); } -fn toggle_active_tab_sync(env: &ForeignFunctionEnv) { - let error_msg = || { - format!( - "failed to toggle active tab sync in plugin {}", - env.plugin_env.name() - ) - }; +fn toggle_active_tab_sync(env: &PluginEnv) { + let error_msg = || format!("failed to toggle active tab sync in plugin {}", env.name()); let action = Action::ToggleActiveSyncTab; apply_action!(action, error_msg, env); } -fn close_focused_tab(env: &ForeignFunctionEnv) { - let error_msg = || { - format!( - "failed to close active tab in plugin {}", - env.plugin_env.name() - ) - }; +fn close_focused_tab(env: &PluginEnv) { + let error_msg = || format!("failed to close active tab in plugin {}", env.name()); let action = Action::CloseTab; apply_action!(action, error_msg, env); } -fn undo_rename_tab(env: &ForeignFunctionEnv) { - let error_msg = || { - format!( - "failed to undo rename tab in plugin {}", - env.plugin_env.name() - ) - }; +fn undo_rename_tab(env: &PluginEnv) { + let error_msg = || format!("failed to undo rename tab in plugin {}", env.name()); let action = Action::UndoRenameTab; apply_action!(action, error_msg, env); } -fn quit_zellij(env: &ForeignFunctionEnv) { - let error_msg = || format!("failed to quit zellij in plugin {}", env.plugin_env.name()); +fn quit_zellij(env: &PluginEnv) { + let error_msg = || format!("failed to quit zellij in plugin {}", env.name()); let action = Action::Quit; apply_action!(action, error_msg, env); } -fn previous_swap_layout(env: &ForeignFunctionEnv) { - let error_msg = || { - format!( - "failed to switch swap layout in plugin {}", - env.plugin_env.name() - ) - }; +fn previous_swap_layout(env: &PluginEnv) { + let error_msg = || format!("failed to switch swap layout in plugin {}", env.name()); let action = Action::PreviousSwapLayout; apply_action!(action, error_msg, env); } -fn next_swap_layout(env: &ForeignFunctionEnv) { - let error_msg = || { - format!( - "failed to switch swap layout in plugin {}", - env.plugin_env.name() - ) - }; +fn next_swap_layout(env: &PluginEnv) { + let error_msg = || format!("failed to switch swap layout in plugin {}", env.name()); let action = Action::NextSwapLayout; apply_action!(action, error_msg, env); } -fn go_to_tab_name(env: &ForeignFunctionEnv, tab_name: String) { - let error_msg = || format!("failed to change tab in plugin {}", env.plugin_env.name()); +fn go_to_tab_name(env: &PluginEnv, tab_name: String) { + let error_msg = || format!("failed to change tab in plugin {}", env.name()); let create = false; let action = Action::GoToTabName(tab_name, create); apply_action!(action, error_msg, env); } -fn focus_or_create_tab(env: &ForeignFunctionEnv, tab_name: String) { - let error_msg = || { - format!( - "failed to change or create tab in plugin {}", - env.plugin_env.name() - ) - }; +fn focus_or_create_tab(env: &PluginEnv, tab_name: String) { + let error_msg = || format!("failed to change or create tab in plugin {}", env.name()); let create = true; let action = Action::GoToTabName(tab_name, create); apply_action!(action, error_msg, env); } -fn go_to_tab(env: &ForeignFunctionEnv, tab_index: u32) { - let error_msg = || { - format!( - "failed to change tab focus in plugin {}", - env.plugin_env.name() - ) - }; +fn go_to_tab(env: &PluginEnv, tab_index: u32) { + let error_msg = || format!("failed to change tab focus in plugin {}", env.name()); let action = Action::GoToTab(tab_index + 1); apply_action!(action, error_msg, env); } -fn start_or_reload_plugin(env: &ForeignFunctionEnv, url: &str) -> Result<()> { - let error_msg = || { - format!( - "failed to start or reload plugin in plugin {}", - env.plugin_env.name() - ) - }; +fn start_or_reload_plugin(env: &PluginEnv, url: &str) -> Result<()> { + let error_msg = || format!("failed to start or reload plugin in plugin {}", env.name()); let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")); let run_plugin_or_alias = RunPluginOrAlias::from_url(url, &None, None, Some(cwd)) .map_err(|e| anyhow!("Failed to parse plugin location: {}", e))?; @@ -1292,81 +1162,59 @@ fn start_or_reload_plugin(env: &ForeignFunctionEnv, url: &str) -> Result<()> { Ok(()) } -fn close_terminal_pane(env: &ForeignFunctionEnv, terminal_pane_id: u32) { - let error_msg = || { - format!( - "failed to change tab focus in plugin {}", - env.plugin_env.name() - ) - }; +fn close_terminal_pane(env: &PluginEnv, terminal_pane_id: u32) { + let error_msg = || format!("failed to change tab focus in plugin {}", env.name()); let action = Action::CloseTerminalPane(terminal_pane_id); apply_action!(action, error_msg, env); } -fn close_plugin_pane(env: &ForeignFunctionEnv, plugin_pane_id: u32) { - let error_msg = || { - format!( - "failed to change tab focus in plugin {}", - env.plugin_env.name() - ) - }; +fn close_plugin_pane(env: &PluginEnv, plugin_pane_id: u32) { + let error_msg = || format!("failed to change tab focus in plugin {}", env.name()); let action = Action::ClosePluginPane(plugin_pane_id); apply_action!(action, error_msg, env); } -fn focus_terminal_pane( - env: &ForeignFunctionEnv, - terminal_pane_id: u32, - should_float_if_hidden: bool, -) { +fn focus_terminal_pane(env: &PluginEnv, terminal_pane_id: u32, should_float_if_hidden: bool) { let action = Action::FocusTerminalPaneWithId(terminal_pane_id, should_float_if_hidden); let error_msg = || format!("Failed to focus terminal pane"); apply_action!(action, error_msg, env); } -fn focus_plugin_pane(env: &ForeignFunctionEnv, plugin_pane_id: u32, should_float_if_hidden: bool) { +fn focus_plugin_pane(env: &PluginEnv, plugin_pane_id: u32, should_float_if_hidden: bool) { let action = Action::FocusPluginPaneWithId(plugin_pane_id, should_float_if_hidden); let error_msg = || format!("Failed to focus plugin pane"); apply_action!(action, error_msg, env); } -fn rename_terminal_pane(env: &ForeignFunctionEnv, terminal_pane_id: u32, new_name: &str) { +fn rename_terminal_pane(env: &PluginEnv, terminal_pane_id: u32, new_name: &str) { let error_msg = || format!("Failed to rename terminal pane"); let rename_pane_action = Action::RenameTerminalPane(terminal_pane_id, new_name.as_bytes().to_vec()); apply_action!(rename_pane_action, error_msg, env); } -fn rename_plugin_pane(env: &ForeignFunctionEnv, plugin_pane_id: u32, new_name: &str) { +fn rename_plugin_pane(env: &PluginEnv, plugin_pane_id: u32, new_name: &str) { let error_msg = || format!("Failed to rename plugin pane"); let rename_pane_action = Action::RenamePluginPane(plugin_pane_id, new_name.as_bytes().to_vec()); apply_action!(rename_pane_action, error_msg, env); } -fn rename_tab(env: &ForeignFunctionEnv, tab_index: u32, new_name: &str) { +fn rename_tab(env: &PluginEnv, tab_index: u32, new_name: &str) { let error_msg = || format!("Failed to rename tab"); let rename_tab_action = Action::RenameTab(tab_index, new_name.as_bytes().to_vec()); apply_action!(rename_tab_action, error_msg, env); } -fn rename_session(env: &ForeignFunctionEnv, new_session_name: String) { - let error_msg = || { - format!( - "failed to rename session in plugin {}", - env.plugin_env.name() - ) - }; +fn rename_session(env: &PluginEnv, new_session_name: String) { + let error_msg = || format!("failed to rename session in plugin {}", env.name()); let action = Action::RenameSession(new_session_name); apply_action!(action, error_msg, env); } -fn disconnect_other_clients(env: &ForeignFunctionEnv) { +fn disconnect_other_clients(env: &PluginEnv) { let _ = env - .plugin_env .senders - .send_to_server(ServerInstruction::DisconnectAllClientsExcept( - env.plugin_env.client_id, - )) + .send_to_server(ServerInstruction::DisconnectAllClientsExcept(env.client_id)) .context("failed to send disconnect other clients instruction"); } @@ -1384,24 +1232,23 @@ fn kill_sessions(session_names: Vec) { } } -fn watch_filesystem(env: &ForeignFunctionEnv) { +fn watch_filesystem(env: &PluginEnv) { let _ = env - .plugin_env .senders .to_plugin .as_ref() .map(|sender| sender.send(PluginInstruction::WatchFilesystem)); } -fn dump_session_layout(env: &ForeignFunctionEnv) { - let _ = env.plugin_env.senders.to_screen.as_ref().map(|sender| { - sender.send(ScreenInstruction::DumpLayoutToPlugin( - env.plugin_env.plugin_id, - )) - }); +fn dump_session_layout(env: &PluginEnv) { + let _ = env + .senders + .to_screen + .as_ref() + .map(|sender| sender.send(ScreenInstruction::DumpLayoutToPlugin(env.plugin_id))); } -fn scan_host_folder(env: &ForeignFunctionEnv, folder_to_scan: PathBuf) { +fn scan_host_folder(env: &PluginEnv, folder_to_scan: PathBuf) { if !folder_to_scan.starts_with("/host") { log::error!( "Can only scan files in the /host filesystem, found: {}", @@ -1409,7 +1256,7 @@ fn scan_host_folder(env: &ForeignFunctionEnv, folder_to_scan: PathBuf) { ); return; } - let plugin_host_folder = env.plugin_env.plugin_cwd.clone(); + let plugin_host_folder = env.plugin_cwd.clone(); let folder_to_scan = plugin_host_folder.join(folder_to_scan.strip_prefix("/host").unwrap()); match folder_to_scan.canonicalize() { Ok(folder_to_scan) => { @@ -1424,9 +1271,9 @@ fn scan_host_folder(env: &ForeignFunctionEnv, folder_to_scan: PathBuf) { let reading_folder = std::fs::read_dir(&folder_to_scan); match reading_folder { Ok(reading_folder) => { - let send_plugin_instructions = env.plugin_env.senders.to_plugin.clone(); - let update_target = Some(env.plugin_env.plugin_id); - let client_id = env.plugin_env.client_id; + let send_plugin_instructions = env.senders.to_plugin.clone(); + let update_target = Some(env.plugin_id); + let client_id = env.client_id; thread::spawn({ move || { let mut paths_in_folder = vec![]; @@ -1473,27 +1320,23 @@ fn scan_host_folder(env: &ForeignFunctionEnv, folder_to_scan: PathBuf) { // This is called when a panic occurs in a plugin. Since most panics will likely originate in the // code trying to deserialize an `Event` upon a plugin state update, we read some panic message, // formatted as string from the plugin. -fn report_panic(env: &ForeignFunctionEnv, msg: &str) { +fn report_panic(env: &PluginEnv, msg: &str) { log::error!("PANIC IN PLUGIN!\n\r{}", msg); - handle_plugin_crash( - env.plugin_env.plugin_id, - msg.to_owned(), - env.plugin_env.senders.clone(), - ); + handle_plugin_crash(env.plugin_id, msg.to_owned(), env.senders.clone()); } // Helper Functions --------------------------------------------------------------------------------------------------- -pub fn wasi_read_string(wasi_env: &WasiEnv) -> Result { - let err_context = || format!("failed to read string from WASI env '{wasi_env:?}'"); +pub fn wasi_read_string(plugin_env: &PluginEnv) -> Result { + let err_context = || format!("failed to read string from WASI env"); let mut buf = vec![]; - wasi_env - .state() - .stdout() + plugin_env + .stdout_pipe + .lock() + .unwrap() + .read_to_end(&mut buf) .map_err(anyError::new) - .and_then(|stdout| stdout.ok_or(anyhow!("failed to get mutable reference to stdout"))) - .and_then(|mut wasi_file| wasi_file.read_to_end(&mut buf).map_err(anyError::new)) .with_context(err_context)?; let buf = String::from_utf8_lossy(&buf); @@ -1501,27 +1344,24 @@ pub fn wasi_read_string(wasi_env: &WasiEnv) -> Result { Ok(buf.replace("\n", "\n\r")) } -pub fn wasi_write_string(wasi_env: &WasiEnv, buf: &str) -> Result<()> { - wasi_env - .state() - .stdin() +pub fn wasi_write_string(plugin_env: &PluginEnv, buf: &str) -> Result<()> { + let mut stdin = plugin_env.stdin_pipe.lock().unwrap(); + writeln!(stdin, "{}\r", buf) .map_err(anyError::new) - .and_then(|stdin| stdin.ok_or(anyhow!("failed to get mutable reference to stdin"))) - .and_then(|mut stdin| writeln!(stdin, "{}\r", buf).map_err(anyError::new)) - .with_context(|| format!("failed to write string to WASI env '{wasi_env:?}'")) + .with_context(|| format!("failed to write string to WASI env")) } -pub fn wasi_write_object(wasi_env: &WasiEnv, object: &(impl Serialize + ?Sized)) -> Result<()> { +pub fn wasi_write_object(plugin_env: &PluginEnv, object: &(impl Serialize + ?Sized)) -> Result<()> { serde_json::to_string(&object) .map_err(anyError::new) - .and_then(|string| wasi_write_string(wasi_env, &string)) - .with_context(|| format!("failed to serialize object for WASI env '{wasi_env:?}'")) + .and_then(|string| wasi_write_string(plugin_env, &string)) + .with_context(|| format!("failed to serialize object for WASI env")) } -pub fn wasi_read_bytes(wasi_env: &WasiEnv) -> Result> { - wasi_read_string(wasi_env) +pub fn wasi_read_bytes(plugin_env: &PluginEnv) -> Result> { + wasi_read_string(plugin_env) .and_then(|string| serde_json::from_str(&string).map_err(anyError::new)) - .with_context(|| format!("failed to deserialize object from WASI env '{wasi_env:?}'")) + .with_context(|| format!("failed to deserialize object from WASI env")) } // TODO: move to permissions? diff --git a/zellij-utils/src/logging.rs b/zellij-utils/src/logging.rs index fb068a645..4580483c6 100644 --- a/zellij-utils/src/logging.rs +++ b/zellij-utils/src/logging.rs @@ -68,15 +68,15 @@ pub fn configure_logger() { .unwrap(); // Set the default logging level to "info" and log it to zellij.log file - // Decrease verbosity for `wasmer_compiler_cranelift` module because it has a lot of useless info logs + // Decrease verbosity for `wasmtime_wasi` module because it has a lot of useless info logs // For `zellij_server::logging_pipe`, we use custom format as we use logging macros to forward stderr output from plugins let config = Config::builder() .appender(Appender::builder().build("logFile", Box::new(log_file))) .appender(Appender::builder().build("logPlugin", Box::new(log_plugin))) .logger( Logger::builder() - .appender("logFile") - .build("wasmer_compiler_cranelift", LevelFilter::Warn), + .appender("logPlugin") + .build("wasmtime_wasi", LevelFilter::Warn), ) .logger( Logger::builder()