diff --git a/.gitignore b/.gitignore index f8b6c2db..b2c30b0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ -/target +**/target *.swp my_package/ src/new/includes.rs +src/new/templates/**/Cargo.lock +src/new/templates/**/*.wasm +src/new/templates/**/*.zip diff --git a/Cargo.lock b/Cargo.lock index 12043175..82276a76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" +checksum = "ccb3ead547f4532bc8af961649942f0b9c16ee9226e26caa3f38420651cc0bf4" dependencies = [ "alloy-rlp", "bytes", @@ -110,9 +110,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" +checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -121,13 +121,13 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8037e03c7f462a063f28daec9fda285a9a89da003c552f8637a80b9c8fd96241" +checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] @@ -160,23 +160,23 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" +checksum = "2b40397ddcdcc266f59f959770f601ce1280e699a91fc1862f29cef91707cd09" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" +checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -185,31 +185,31 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" +checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" dependencies = [ "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", "syn-solidity", ] [[package]] name = "alloy-sol-types" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" +checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" dependencies = [ "alloy-primitives", "alloy-sol-macro", @@ -236,9 +236,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -251,33 +251,33 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -419,6 +419,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "auto_impl" version = "1.2.0" @@ -427,7 +433,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] @@ -507,9 +513,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -534,9 +540,9 @@ dependencies = [ [[package]] name = "blst" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62dc83a094a71d43eeadd254b1ec2d24cb6a0bb6cadce00df51f0db594711a32" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" dependencies = [ "cc", "glob", @@ -564,9 +570,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" dependencies = [ "serde", ] @@ -608,13 +614,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.99" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" dependencies = [ "jobserver", "libc", - "once_cell", + "shlex", ] [[package]] @@ -635,18 +641,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.7" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.7" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", @@ -656,9 +662,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "color-eyre" @@ -689,9 +695,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "const-hex" @@ -736,15 +742,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] @@ -833,15 +839,15 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.17" +version = "0.99.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 1.0.109", + "syn 2.0.74", ] [[package]] @@ -886,22 +892,11 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "displaydoc" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "dunce" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "ecdsa" @@ -919,9 +914,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" @@ -1018,9 +1013,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" dependencies = [ "crc32fast", "miniz_oxide", @@ -1094,7 +1089,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] @@ -1163,7 +1158,7 @@ version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", "libgit2-sys", "log", @@ -1191,16 +1186,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.26" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", - "http 0.2.12", + "http", "indexmap", "slab", "tokio", @@ -1261,9 +1256,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1271,192 +1266,105 @@ dependencies = [ ] [[package]] -name = "http" -version = "1.1.0" +name = "http-body" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "fnv", - "itoa", + "http", ] [[package]] -name = "http-body" -version = "0.4.6" +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "http 0.2.12", + "futures-util", + "http", + "http-body", "pin-project-lite", ] [[package]] name = "httparse" -version = "1.9.2" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3935c160d00ac752e09787e6e6bfc26494c2183cc922f1bc678a60d4733bc2" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "hyper" -version = "0.14.29" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", - "http 0.2.12", + "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] -name = "hyper-tls" -version = "0.5.0" +name = "hyper-rustls" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ - "bytes", + "futures-util", + "http", "hyper", - "native-tls", + "hyper-util", + "rustls", + "rustls-pki-types", "tokio", - "tokio-native-tls", -] - -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" - -[[package]] -name = "icu_properties" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", + "tokio-rustls", + "tower-service", ] [[package]] -name = "icu_properties_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" - -[[package]] -name = "icu_provider" -version = "1.5.0" +name = "hyper-tls" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", ] [[package]] -name = "icu_provider_macros" -version = "1.5.0" +name = "hyper-util" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -1467,14 +1375,12 @@ checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" [[package]] name = "idna" -version = "1.0.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "icu_normalizer", - "icu_properties", - "smallvec", - "utf8_iter", + "unicode-bidi", + "unicode-normalization", ] [[package]] @@ -1505,9 +1411,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.2.6" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", "hashbrown", @@ -1531,9 +1437,9 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" @@ -1561,18 +1467,18 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -1592,9 +1498,9 @@ dependencies = [ [[package]] name = "keccak-asm" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" +checksum = "422fbc7ff2f2f5bdffeb07718e5a5324dca72b0c9293d50df4026652385e3314" dependencies = [ "digest 0.10.7", "sha3-asm", @@ -1611,7 +1517,7 @@ dependencies = [ "alloy-transport", "anyhow", "bincode", - "http 1.1.0", + "http", "mime_guess", "rand", "rmp-serde", @@ -1624,7 +1530,7 @@ dependencies = [ [[package]] name = "kit" -version = "0.6.10" +version = "0.6.11" dependencies = [ "anyhow", "base64 0.21.7", @@ -1655,9 +1561,9 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "leb128" @@ -1667,9 +1573,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.156" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "a5f43f184355eefb8d17fc948dbecf6c13be3c141f20d834ae842193a448c72a" [[package]] name = "libgit2-sys" @@ -1697,7 +1603,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", ] @@ -1717,9 +1623,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.18" +version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" +checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" dependencies = [ "cc", "libc", @@ -1733,17 +1639,11 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "litemap" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" - [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "matchers" @@ -1756,9 +1656,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -1768,9 +1668,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", @@ -1778,22 +1678,23 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.11" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1819,7 +1720,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "libc", ] @@ -1836,9 +1737,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", @@ -1896,11 +1797,11 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -1917,7 +1818,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] @@ -1928,9 +1829,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -2019,9 +1920,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.10" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" +checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" dependencies = [ "memchr", "thiserror", @@ -2045,7 +1946,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] @@ -2084,9 +1985,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "primitive-types" @@ -2134,22 +2038,22 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.5.0", + "bitflags 2.6.0", "lazy_static", "num-traits", "rand", @@ -2234,9 +2138,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -2278,20 +2182,23 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" -version = "0.11.27" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "bytes", "encoding_rs", "futures-core", "futures-util", "h2", - "http 0.2.12", + "http", "http-body", + "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", @@ -2326,6 +2233,21 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rlp" version = "0.5.2" @@ -2424,20 +2346,51 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.23.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" + +[[package]] +name = "rustls-webpki" +version = "0.102.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] @@ -2492,11 +2445,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -2505,9 +2458,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -2539,40 +2492,41 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.203" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -2613,9 +2567,9 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" +checksum = "57d79b758b7cb2085612b11a235055e485605a5103faccdd633f35bd7aee69dd" dependencies = [ "cc", "cfg-if", @@ -2630,6 +2584,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -2683,6 +2643,12 @@ dependencies = [ "smallvec", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "spki" version = "0.7.3" @@ -2693,12 +2659,6 @@ dependencies = [ "der", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "static_assertions" version = "1.1.0" @@ -2713,9 +2673,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -2730,9 +2690,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.66" +version = "2.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" dependencies = [ "proc-macro2", "quote", @@ -2741,32 +2701,21 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" +checksum = "c837dc8852cb7074e46b444afb81783140dab12c58867b49fb3898fbafedf7ea" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "system-configuration" @@ -2797,34 +2746,35 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] @@ -2887,42 +2837,46 @@ dependencies = [ ] [[package]] -name = "tinystr" -version = "0.7.6" +name = "tinyvec" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ - "displaydoc", - "zerovec", + "tinyvec_macros", ] +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" -version = "1.38.0" +version = "1.39.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] @@ -2935,6 +2889,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.11" @@ -2950,21 +2915,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.14" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.14", + "toml_edit 0.22.20", ] [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -2982,15 +2947,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.14" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.13", + "winnow 0.6.18", ] [[package]] @@ -3003,6 +2968,7 @@ dependencies = [ "futures-util", "pin-project", "pin-project-lite", + "tokio", "tower-layer", "tower-service", "tracing", @@ -3010,15 +2976,15 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -3052,7 +3018,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] @@ -3162,12 +3128,27 @@ dependencies = [ "version_check", ] +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.11.0" @@ -3180,29 +3161,23 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" version = "0.2.2" @@ -3223,9 +3198,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wait-timeout" @@ -3263,34 +3238,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -3300,9 +3276,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3310,22 +3286,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasm-encoder" @@ -3358,16 +3334,16 @@ version = "0.202.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6998515d3cf3f8b980ef7c11b29a9b1017d4cf86b99ae93b546992df9931413" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "indexmap", "semver 1.0.23", ] [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -3391,11 +3367,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3419,7 +3395,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -3439,18 +3424,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -3461,9 +3446,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -3473,9 +3458,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -3485,15 +3470,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -3503,9 +3488,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -3515,9 +3500,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -3527,9 +3512,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -3539,9 +3524,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" @@ -3554,18 +3539,18 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.13" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] [[package]] name = "winreg" -version = "0.50.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", "windows-sys 0.48.0", @@ -3597,7 +3582,7 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0780cf7046630ed70f689a098cd8d56c5c3b22f2a7379bbdb088879963ff96" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] @@ -3623,7 +3608,7 @@ dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.74", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -3635,7 +3620,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c836b1fd9932de0431c1758d8be08212071b6bba0151f7bac826dbc4312a2a9" dependencies = [ "anyhow", - "bitflags 2.5.0", + "bitflags 2.6.0", "indexmap", "log", "serde", @@ -3665,18 +3650,6 @@ dependencies = [ "wasmparser", ] -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" - [[package]] name = "wyz" version = "0.5.1" @@ -3687,48 +3660,24 @@ dependencies = [ ] [[package]] -name = "yoke" -version = "0.7.4" +name = "zerocopy" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", - "synstructure", -] - -[[package]] -name = "zerofrom" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" -dependencies = [ - "zerofrom-derive", + "byteorder", + "zerocopy-derive", ] [[package]] -name = "zerofrom-derive" -version = "0.1.4" +name = "zerocopy-derive" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", - "synstructure", + "syn 2.0.74", ] [[package]] @@ -3748,29 +3697,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", -] - -[[package]] -name = "zerovec" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", + "syn 2.0.74", ] [[package]] @@ -3814,9 +3741,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.10+zstd.1.5.6" +version = "2.0.13+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index c061eae5..dd830ccb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kit" -version = "0.6.10" +version = "0.6.11" edition = "2021" [build-dependencies] @@ -17,7 +17,7 @@ hex = "0.4" kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib.git", rev = "7eb3a04" } nix = { version = "0.27", features = ["process", "signal", "term"] } regex = "1" -reqwest = { version = "0.11", features = ["json"] } +reqwest = { version = "0.12", features = ["json"] } semver = "1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" @@ -39,6 +39,11 @@ walkdir = "2.4" wit-bindgen = "0.24.0" zip = "0.6" +[workspace] +members = [] +exclude = ["src/new/templates/*"] +resolver = "2" + [[bin]] name = "kit" path = "src/main.rs" diff --git a/build.rs b/build.rs index 7baf0ddc..901aa27f 100644 --- a/build.rs +++ b/build.rs @@ -2,35 +2,46 @@ use std::fs; use std::io::{self, Write}; use std::path::Path; -const NEW_DIR: &str = "src/new"; const TEMPLATES_DIR: &str = "src/new/templates"; +const TARGET_DIR: &str = "target"; +const INCLUDES: &str = "includes.rs"; fn visit_dirs(dir: &Path, output_buffer: &mut Vec) -> io::Result<()> { - if dir.is_dir() { - for entry in fs::read_dir(dir)? { - let entry = entry?; - let path = entry.path(); - if path.is_dir() { - visit_dirs(&path, output_buffer)?; - } else { - if path.extension().and_then(|s| s.to_str()) == Some("swp") { - continue; - } - - let relative_path = path.strip_prefix(TEMPLATES_DIR).unwrap(); - let path_str = relative_path.to_str().unwrap().replace("\\", "/"); - - let relative_path_from_includes = path.strip_prefix(NEW_DIR).unwrap(); - let path_str_from_includes = relative_path_from_includes - .to_str() - .unwrap() - .replace("\\", "/"); - writeln!( - output_buffer, - " (\"{}\", include_str!(\"{}\")),", - path_str, path_str_from_includes, - )?; + if !dir.is_dir() { + return Ok(()); + } + for entry in fs::read_dir(dir)? { + let entry = entry?; + let path = entry.path(); + if path.is_dir() { + let dir_name = path.file_name().and_then(|s| s.to_str()); + if dir_name == Some("home") || dir_name == Some("target") { + continue; + } + visit_dirs(&path, output_buffer)?; + } else { + let ext = path.extension().and_then(|s| s.to_str()); + if ext == Some("swp") || ext == Some("wasm") || ext == Some("zip") { + continue; + } + let file_name = path.file_name().and_then(|s| s.to_str()); + if file_name == Some("Cargo.lock") { + continue; } + + let relative_path = path.strip_prefix(TEMPLATES_DIR).unwrap(); + let path_str = relative_path.to_str().unwrap().replace("\\", "/"); + + let relative_path_from_includes = Path::new("..").join(path); + let path_str_from_includes = relative_path_from_includes + .to_str() + .unwrap() + .replace("\\", "/"); + writeln!( + output_buffer, + " (\"{}\", include_str!(\"{}\")),", + path_str, path_str_from_includes, + )?; } } Ok(()) @@ -67,15 +78,19 @@ fn main() -> anyhow::Result<()> { writeln!( output_buffer, " (\"{}\", include_str!(\"{}\")),", - "componentize.mjs", "componentize.mjs", + "componentize.mjs", "../src/new/componentize.mjs", )?; visit_dirs(Path::new(TEMPLATES_DIR), &mut output_buffer)?; writeln!(&mut output_buffer, "];")?; - let output_path = Path::new(NEW_DIR).join("includes.rs"); + let target_dir = Path::new(TARGET_DIR); + let output_path = target_dir.join(INCLUDES); // create includes.rs if it does not exist + if !target_dir.exists() { + fs::create_dir_all(target_dir)?; + } if !output_path.exists() { fs::write(&output_path, &output_buffer)?; } else { diff --git a/src/boot_fake_node/mod.rs b/src/boot_fake_node/mod.rs index f09ca0b8..3a1b5e2a 100644 --- a/src/boot_fake_node/mod.rs +++ b/src/boot_fake_node/mod.rs @@ -237,6 +237,10 @@ pub async fn get_from_github(owner: &str, repo: &str, endpoint: &str) -> Result< } } } + if s.contains("No server is currently available to service your request.") { + warn!("Couldn't reach GitHub"); + return Ok(vec![]); + } } fs::create_dir_all( cache_path diff --git a/src/build/mod.rs b/src/build/mod.rs index 7f855ffd..1bf308d3 100644 --- a/src/build/mod.rs +++ b/src/build/mod.rs @@ -94,8 +94,19 @@ fn is_only_empty_string(splitted: &Vec<&str>) -> bool { pub fn run_command(cmd: &mut Command, verbose: bool) -> Result> { if verbose { let mut child = cmd.spawn()?; - child.wait()?; - return Ok(None); + let result = child.wait()?; + if result.success() { + return Ok(None); + } else { + return Err(eyre!( + "Command `{} {:?}` failed with exit code {:?}", + cmd.get_program().to_str().unwrap(), + cmd.get_args() + .map(|a| a.to_str().unwrap()) + .collect::>(), + result.code(), + )); + } } let output = cmd.output()?; if output.status.success() { diff --git a/src/new/mod.rs b/src/new/mod.rs index abf59b2d..58b8ec26 100644 --- a/src/new/mod.rs +++ b/src/new/mod.rs @@ -7,7 +7,7 @@ use color_eyre::{eyre::eyre, Result}; use fs_err as fs; use tracing::instrument; -include!("includes.rs"); +include!("../../target/includes.rs"); #[derive(Clone)] pub enum Language { @@ -109,23 +109,31 @@ fn replace_dots(input: &str) -> (String, String) { } } -fn replace_vars(input: &str, package_name: &str, publisher: &str) -> String { +fn replace_vars( + input: &str, + template_package_name: &str, + package_name: &str, + publisher: &str, +) -> String { + let template_package_name_kebab = template_package_name.replace("_", "-"); + let template_package_name_upper_camel = snake_to_upper_camel_case(template_package_name); + let package_name_kebab = package_name.replace("_", "-"); - let (publisher_dotted_snake, publisher_dotted_kebab) = replace_dots(publisher); let package_name_upper_camel = snake_to_upper_camel_case(package_name); + + let (publisher_dotted_snake, publisher_dotted_kebab) = replace_dots(publisher); let publisher_dotted_upper_camel = snake_to_upper_camel_case(&publisher_dotted_snake); input - .replace("{package_name}", package_name) - .replace("{package_name_kebab}", &package_name_kebab) - .replace("{package_name_upper_camel}", &package_name_upper_camel) - .replace("{publisher}", publisher) - .replace("{publisher_dotted_snake}", &publisher_dotted_snake) - .replace("{publisher_dotted_kebab}", &publisher_dotted_kebab) + .replace(template_package_name, package_name) + .replace(&template_package_name_kebab, &package_name_kebab) .replace( - "{publisher_dotted_upper_camel}", - &publisher_dotted_upper_camel, + &template_package_name_upper_camel, + &package_name_upper_camel, ) - .replace("Cargo.toml_", "Cargo.toml") + .replace("template.os", publisher) + .replace("template_dot_os", &publisher_dotted_snake) + .replace("template-dot-os", &publisher_dotted_kebab) + .replace("TemplateDotOs", &publisher_dotted_upper_camel) .to_string() } @@ -217,15 +225,14 @@ pub fn execute( ui_infix, template.to_string(), ); - let ui_prefix = format!("{}/{}/", ui_infix, template.to_string(),); - let test_prefix = format!("test/{}/", template.to_string(),); + let ui_prefix = format!("{}/{}/", ui_infix, template.to_string()); + let test_prefix = format!("test/{}/", template.to_string()); let mut path_to_content: HashMap = PATH_TO_CONTENT .iter() .filter_map(|(path, content)| { path.strip_prefix(&template_prefix) .map(|p| p.to_string()) .or_else(|| path.strip_prefix(&ui_prefix).map(|p| p.to_string())) - .or_else(|| path.strip_prefix(&test_prefix).map(|p| format!("test/{p}"))) .or_else(|| { if path.starts_with(&test_prefix) { Some(path.to_string()) @@ -234,8 +241,10 @@ pub fn execute( } }) .and_then(|stripped| { - let modified_path = replace_vars(&stripped, &package_name, &publisher); - let modified_content = replace_vars(content, &package_name, &publisher); + let modified_path = + replace_vars(&stripped, &template.to_string(), &package_name, &publisher); + let modified_content = + replace_vars(content, &template.to_string(), &package_name, &publisher); Some((modified_path, modified_content)) }) }) @@ -269,7 +278,12 @@ pub fn execute( Language::Javascript => { path_to_content.insert( format!("{}/{}", package_name, PATH_TO_CONTENT[0].0), - replace_vars(PATH_TO_CONTENT[0].1, &package_name, &publisher), + replace_vars( + PATH_TO_CONTENT[0].1, + &template.to_string(), + &package_name, + &publisher, + ), ); } _ => {} diff --git a/src/new/templates/javascript/no-ui/chat/api/{package_name}:{publisher}-v0.wit b/src/new/templates/javascript/no-ui/chat/api/chat:template.os-v0.wit similarity index 76% rename from src/new/templates/javascript/no-ui/chat/api/{package_name}:{publisher}-v0.wit rename to src/new/templates/javascript/no-ui/chat/api/chat:template.os-v0.wit index 32cee559..9adc12ec 100644 --- a/src/new/templates/javascript/no-ui/chat/api/{package_name}:{publisher}-v0.wit +++ b/src/new/templates/javascript/no-ui/chat/api/chat:template.os-v0.wit @@ -1,4 +1,4 @@ -interface {package_name_kebab} { +interface chat { variant request { send(send-request), /// history of chat with given node @@ -21,7 +21,7 @@ interface {package_name_kebab} { } } -world {package_name_kebab}-{publisher_dotted_kebab}-v0 { - import {package_name_kebab}; +world chat-template-dot-os-v0 { + import chat; include process; } diff --git a/src/new/templates/javascript/no-ui/echo/{package_name}/package.json b/src/new/templates/javascript/no-ui/chat/chat/package.json similarity index 81% rename from src/new/templates/javascript/no-ui/echo/{package_name}/package.json rename to src/new/templates/javascript/no-ui/chat/chat/package.json index 6f723492..7c38cb64 100644 --- a/src/new/templates/javascript/no-ui/echo/{package_name}/package.json +++ b/src/new/templates/javascript/no-ui/chat/chat/package.json @@ -1,12 +1,12 @@ { - "name": "{package_name}", + "name": "chat", "version": "0.1.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "{publisher}", + "author": "template.os", "license": "MIT", "dependencies": { "@bytecodealliance/componentize-js": "0.5.0" diff --git a/src/new/templates/javascript/no-ui/chat/{package_name}/src/lib.js b/src/new/templates/javascript/no-ui/chat/chat/src/lib.js similarity index 90% rename from src/new/templates/javascript/no-ui/chat/{package_name}/src/lib.js rename to src/new/templates/javascript/no-ui/chat/chat/src/lib.js index fe9c171d..70b9846f 100644 --- a/src/new/templates/javascript/no-ui/chat/{package_name}/src/lib.js +++ b/src/new/templates/javascript/no-ui/chat/chat/src/lib.js @@ -47,7 +47,7 @@ function handleMessage(ourNode, messageArchive) { if (body.Send) { const { target, message: messageText } = body.Send; if (target === ourNode) { - printToTerminal(0, `{package_name}|${source.node}: ${messageText}`); + printToTerminal(0, `chat|${source.node}: ${messageText}`); messageArchive = addToArchive( source.node, source.node, @@ -59,9 +59,9 @@ function handleMessage(ourNode, messageArchive) { { node: target, process: { - processName: "{package_name}", - packageName: "{package_name}", - publisherNode: "{publisher}" + processName: "chat", + packageName: "chat", + publisherNode: "template.os" } }, { @@ -106,7 +106,7 @@ function handleMessage(ourNode, messageArchive) { } export function init(our) { - printToTerminal(0, `{package_name}: begin (javascript)`); + printToTerminal(0, `chat: begin (javascript)`); const { node: ourNode } = parseAddress(our); let messageArchive = {}; @@ -115,7 +115,7 @@ export function init(our) { try { messageArchive = handleMessage(ourNode, messageArchive); } catch (error) { - printToTerminal(0, `{package_name}: got error ${error}`); + printToTerminal(0, `chat: got error ${error}`); } } } diff --git a/src/new/templates/javascript/no-ui/chat/metadata.json b/src/new/templates/javascript/no-ui/chat/metadata.json index 944b2bb4..2a864fd5 100644 --- a/src/new/templates/javascript/no-ui/chat/metadata.json +++ b/src/new/templates/javascript/no-ui/chat/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "chat", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "chat", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/javascript/no-ui/chat/pkg/manifest.json b/src/new/templates/javascript/no-ui/chat/pkg/manifest.json index f71144aa..3da591df 100644 --- a/src/new/templates/javascript/no-ui/chat/pkg/manifest.json +++ b/src/new/templates/javascript/no-ui/chat/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "chat", + "process_wasm_path": "/chat.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/javascript/no-ui/chat/pkg/scripts.json b/src/new/templates/javascript/no-ui/chat/pkg/scripts.json index ba63df9e..e89b6733 100644 --- a/src/new/templates/javascript/no-ui/chat/pkg/scripts.json +++ b/src/new/templates/javascript/no-ui/chat/pkg/scripts.json @@ -4,10 +4,10 @@ "public": false, "request_networking": false, "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "chat:chat:template.os" ], "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "chat:chat:template.os" ] } } diff --git a/src/new/templates/javascript/no-ui/chat/send/Cargo.toml_ b/src/new/templates/javascript/no-ui/chat/send/Cargo.toml similarity index 95% rename from src/new/templates/javascript/no-ui/chat/send/Cargo.toml_ rename to src/new/templates/javascript/no-ui/chat/send/Cargo.toml index efa24945..5dcbe593 100644 --- a/src/new/templates/javascript/no-ui/chat/send/Cargo.toml_ +++ b/src/new/templates/javascript/no-ui/chat/send/Cargo.toml @@ -2,6 +2,7 @@ name = "send" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/javascript/no-ui/chat/send/src/lib.rs b/src/new/templates/javascript/no-ui/chat/send/src/lib.rs index 508f8b28..e819550a 100644 --- a/src/new/templates/javascript/no-ui/chat/send/src/lib.rs +++ b/src/new/templates/javascript/no-ui/chat/send/src/lib.rs @@ -1,11 +1,11 @@ -use crate::kinode::process::{package_name}::{Request as ChatRequest, Response as ChatResponse, SendRequest}; +use crate::kinode::process::chat::{Request as ChatRequest, Response as ChatResponse, SendRequest}; use kinode_process_lib::{ await_next_message_body, call_init, println, Address, Message, Request, }; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name}-{publisher_dotted_kebab}-v0", + world: "chat-template-dot-os-v0", generate_unused_types: true, additional_derives: [serde::Deserialize, serde::Serialize], }); @@ -20,12 +20,12 @@ fn init(our: Address) { let args = String::from_utf8(body).unwrap_or_default(); let Some((target, message)) = args.split_once(" ") else { - println!("usage:\nsend:{package_name}:{publisher} target message"); + println!("usage:\nsend:chat:template.os target message"); return; }; let Ok(Ok(Message::Response { body, .. })) = - Request::to((our.node(), ("{package_name}", "{package_name}", "{publisher}"))) + Request::to((our.node(), ("chat", "chat", "template.os"))) .body( serde_json::to_vec(&ChatRequest::Send(SendRequest { target: target.into(), @@ -35,12 +35,12 @@ fn init(our: Address) { ) .send_and_await_response(5) else { - println!("did not receive expected Response from {package_name}:{package_name}:{publisher}"); + println!("did not receive expected Response from chat:chat:template.os"); return; }; let Ok(ChatResponse::Send) = serde_json::from_slice(&body) else { - println!("did not receive expected Ack from {package_name}:{package_name}:{publisher}"); + println!("did not receive expected Ack from chat:chat:template.os"); return; }; } diff --git a/src/new/templates/rust/no-ui/blank/Cargo.toml_ b/src/new/templates/javascript/no-ui/chat/test/chat_test/Cargo.toml similarity index 82% rename from src/new/templates/rust/no-ui/blank/Cargo.toml_ rename to src/new/templates/javascript/no-ui/chat/test/chat_test/Cargo.toml index 31d65e6d..7021d14c 100644 --- a/src/new/templates/rust/no-ui/blank/Cargo.toml_ +++ b/src/new/templates/javascript/no-ui/chat/test/chat_test/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = [ - "{package_name}", + "chat_test", ] [profile.release] diff --git a/src/new/templates/javascript/no-ui/chat/test/chat_test/api/chat_test:template.os-v0.wit b/src/new/templates/javascript/no-ui/chat/test/chat_test/api/chat_test:template.os-v0.wit new file mode 100644 index 00000000..c87f01eb --- /dev/null +++ b/src/new/templates/javascript/no-ui/chat/test/chat_test/api/chat_test:template.os-v0.wit @@ -0,0 +1,5 @@ +world chat-test-template-dot-os-v0 { + import chat; + import tester; + include process-v0; +} diff --git a/src/new/templates/test/chat/{package_name}_test/{package_name}_test/Cargo.toml_ b/src/new/templates/javascript/no-ui/chat/test/chat_test/chat_test/Cargo.toml similarity index 93% rename from src/new/templates/test/chat/{package_name}_test/{package_name}_test/Cargo.toml_ rename to src/new/templates/javascript/no-ui/chat/test/chat_test/chat_test/Cargo.toml index c8717be6..7c5126db 100644 --- a/src/new/templates/test/chat/{package_name}_test/{package_name}_test/Cargo.toml_ +++ b/src/new/templates/javascript/no-ui/chat/test/chat_test/chat_test/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "{package_name}_test" +name = "chat_test" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/test/chat/{package_name}_test/{package_name}_test/src/lib.rs b/src/new/templates/javascript/no-ui/chat/test/chat_test/chat_test/src/lib.rs similarity index 75% rename from src/new/templates/test/chat/{package_name}_test/{package_name}_test/src/lib.rs rename to src/new/templates/javascript/no-ui/chat/test/chat_test/chat_test/src/lib.rs index c0637710..40e55a74 100644 --- a/src/new/templates/test/chat/{package_name}_test/{package_name}_test/src/lib.rs +++ b/src/new/templates/javascript/no-ui/chat/test/chat_test/chat_test/src/lib.rs @@ -1,4 +1,4 @@ -use crate::kinode::process::{package_name}::{ChatMessage, Request as ChatRequest, Response as ChatResponse, SendRequest}; +use crate::kinode::process::chat::{ChatMessage, Request as ChatRequest, Response as ChatResponse, SendRequest}; use crate::kinode::process::tester::{Request as TesterRequest, Response as TesterResponse, RunRequest, FailResponse}; use kinode_process_lib::{await_message, call_init, print_to_terminal, println, Address, ProcessId, Request, Response}; @@ -7,7 +7,7 @@ mod tester_lib; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-test-{publisher_dotted_kebab}-v0", + world: "chat-test-template-dot-os-v0", generate_unused_types: true, additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); @@ -29,7 +29,7 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { input_node_names: node_names, .. }) = message.body().try_into()?; - print_to_terminal(0, "{package_name}_test: a"); + print_to_terminal(0, "chat_test: a"); assert!(node_names.len() >= 2); if our.node != node_names[0] { // we are not master node: return @@ -44,15 +44,15 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { let our_chat_address = Address { node: our.node.clone(), - process: ProcessId::new(Some("{package_name}"), "{package_name}", "{publisher}"), + process: ProcessId::new(Some("chat"), "chat", "template.os"), }; let their_chat_address = Address { node: node_names[1].clone(), - process: ProcessId::new(Some("{package_name}"), "{package_name}", "{publisher}"), + process: ProcessId::new(Some("chat"), "chat", "template.os"), }; // Send - print_to_terminal(0, "{package_name}_test: b"); + print_to_terminal(0, "chat_test: b"); let message: String = "hello".into(); let _ = Request::new() .target(our_chat_address.clone()) @@ -63,14 +63,14 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { .send_and_await_response(15)?.unwrap(); // Get history from receiver & test - print_to_terminal(0, "{package_name}_test: c"); + print_to_terminal(0, "chat_test: c"); let response = Request::new() .target(their_chat_address.clone()) .body(ChatRequest::History(our.node.clone())) .send_and_await_response(15)?.unwrap(); - if response.is_request() { fail!("{package_name}_test"); }; + if response.is_request() { fail!("chat_test"); }; let ChatResponse::History(messages) = response.body().try_into()? else { - fail!("{package_name}_test"); + fail!("chat_test"); }; let expected_messages = vec![ChatMessage { author: our.node.clone(), @@ -79,7 +79,7 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { if messages != expected_messages { println!("{messages:?} != {expected_messages:?}"); - fail!("{package_name}_test"); + fail!("chat_test"); } Response::new() @@ -98,9 +98,9 @@ fn init(our: Address) { match handle_message(&our) { Ok(()) => {}, Err(e) => { - print_to_terminal(0, format!("{package_name}_test: error: {e:?}").as_str()); + print_to_terminal(0, format!("chat_test: error: {e:?}").as_str()); - fail!("{package_name}_test"); + fail!("chat_test"); }, }; } diff --git a/src/new/templates/test/chat/{package_name}_test/{package_name}_test/src/tester_lib.rs b/src/new/templates/javascript/no-ui/chat/test/chat_test/chat_test/src/tester_lib.rs similarity index 100% rename from src/new/templates/test/chat/{package_name}_test/{package_name}_test/src/tester_lib.rs rename to src/new/templates/javascript/no-ui/chat/test/chat_test/chat_test/src/tester_lib.rs diff --git a/src/new/templates/test/chat/{package_name}_test/metadata.json b/src/new/templates/javascript/no-ui/chat/test/chat_test/metadata.json similarity index 59% rename from src/new/templates/test/chat/{package_name}_test/metadata.json rename to src/new/templates/javascript/no-ui/chat/test/chat_test/metadata.json index 41269fed..8161d7d6 100644 --- a/src/new/templates/test/chat/{package_name}_test/metadata.json +++ b/src/new/templates/javascript/no-ui/chat/test/chat_test/metadata.json @@ -1,18 +1,18 @@ { - "name": "{package_name} Test", - "description": "A test for {package_name}.", + "name": "chat Test", + "description": "A test for chat.", "image": "", "properties": { - "package_name": "{package_name}_test", + "package_name": "chat_test", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" }, "wit_version": 0, "dependencies": [ - "{package_name}:{publisher}", + "chat:template.os", "tester:sys" ] }, diff --git a/src/new/templates/javascript/no-ui/chat/test/chat_test/pkg/manifest.json b/src/new/templates/javascript/no-ui/chat/test/chat_test/pkg/manifest.json new file mode 100644 index 00000000..b6c7f2ab --- /dev/null +++ b/src/new/templates/javascript/no-ui/chat/test/chat_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "chat_test", + "process_wasm_path": "/chat_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "chat:chat:template.os" + ], + "grant_capabilities": [ + "chat:chat:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/test/chat/tests.toml b/src/new/templates/javascript/no-ui/chat/test/tests.toml similarity index 91% rename from src/new/templates/test/chat/tests.toml rename to src/new/templates/javascript/no-ui/chat/test/tests.toml index c706fc49..36aa5241 100644 --- a/src/new/templates/test/chat/tests.toml +++ b/src/new/templates/javascript/no-ui/chat/test/tests.toml @@ -10,7 +10,7 @@ setup_packages = [ { path = "..", run = true } ] setup_scripts = [] -test_package_paths = ["{package_name}_test"] +test_package_paths = ["chat_test"] test_scripts = [] timeout_secs = 5 fakechain_router = 8545 diff --git a/src/new/templates/javascript/no-ui/chat/{package_name}/package.json b/src/new/templates/javascript/no-ui/echo/echo/package.json similarity index 81% rename from src/new/templates/javascript/no-ui/chat/{package_name}/package.json rename to src/new/templates/javascript/no-ui/echo/echo/package.json index 6f723492..ee1ed38c 100644 --- a/src/new/templates/javascript/no-ui/chat/{package_name}/package.json +++ b/src/new/templates/javascript/no-ui/echo/echo/package.json @@ -1,12 +1,12 @@ { - "name": "{package_name}", + "name": "echo", "version": "0.1.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "{publisher}", + "author": "template.os", "license": "MIT", "dependencies": { "@bytecodealliance/componentize-js": "0.5.0" diff --git a/src/new/templates/javascript/no-ui/echo/{package_name}/src/lib.js b/src/new/templates/javascript/no-ui/echo/echo/src/lib.js similarity index 88% rename from src/new/templates/javascript/no-ui/echo/{package_name}/src/lib.js rename to src/new/templates/javascript/no-ui/echo/echo/src/lib.js index 6c11d676..8a8bef76 100644 --- a/src/new/templates/javascript/no-ui/echo/{package_name}/src/lib.js +++ b/src/new/templates/javascript/no-ui/echo/echo/src/lib.js @@ -31,7 +31,7 @@ function handleMessage(ourNode, messageArchive) { const { bytes: bodyBytes, string: body0 } = inputBytesToString(message.val.body) const body = JSON.parse(body0); const encoder = new TextEncoder(); - printToTerminal(0, `{package_name}: got message ${JSON.stringify(body)}`); + printToTerminal(0, `echo: got message ${JSON.stringify(body)}`); sendResponse( { inherit: false, @@ -45,7 +45,7 @@ function handleMessage(ourNode, messageArchive) { } export function init(our) { - printToTerminal(0, `{package_name}: begin (javascript)`); + printToTerminal(0, `echo: begin (javascript)`); const { node: ourNode } = parseAddress(our); @@ -53,7 +53,7 @@ export function init(our) { try { handleMessage(ourNode); } catch (error) { - printToTerminal(0, `{package_name}: got error ${error}`); + printToTerminal(0, `echo: got error ${error}`); } } } diff --git a/src/new/templates/javascript/no-ui/echo/metadata.json b/src/new/templates/javascript/no-ui/echo/metadata.json index 944b2bb4..232e5343 100644 --- a/src/new/templates/javascript/no-ui/echo/metadata.json +++ b/src/new/templates/javascript/no-ui/echo/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "echo", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "echo", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/javascript/no-ui/echo/pkg/manifest.json b/src/new/templates/javascript/no-ui/echo/pkg/manifest.json index f71144aa..7fc7826e 100644 --- a/src/new/templates/javascript/no-ui/echo/pkg/manifest.json +++ b/src/new/templates/javascript/no-ui/echo/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "echo", + "process_wasm_path": "/echo.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/rust/no-ui/echo/Cargo.toml_ b/src/new/templates/javascript/no-ui/echo/test/echo_test/Cargo.toml similarity index 82% rename from src/new/templates/rust/no-ui/echo/Cargo.toml_ rename to src/new/templates/javascript/no-ui/echo/test/echo_test/Cargo.toml index 31d65e6d..08be60d0 100644 --- a/src/new/templates/rust/no-ui/echo/Cargo.toml_ +++ b/src/new/templates/javascript/no-ui/echo/test/echo_test/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = [ - "{package_name}", + "echo_test", ] [profile.release] diff --git a/src/new/templates/javascript/no-ui/echo/test/echo_test/api/echo_test:template.os-v0.wit b/src/new/templates/javascript/no-ui/echo/test/echo_test/api/echo_test:template.os-v0.wit new file mode 100644 index 00000000..c4b22457 --- /dev/null +++ b/src/new/templates/javascript/no-ui/echo/test/echo_test/api/echo_test:template.os-v0.wit @@ -0,0 +1,4 @@ +world echo-test-template-dot-os-v0 { + import tester; + include process-v0; +} diff --git a/src/new/templates/test/echo/{package_name}_test/{package_name}_test/Cargo.toml_ b/src/new/templates/javascript/no-ui/echo/test/echo_test/echo_test/Cargo.toml similarity index 93% rename from src/new/templates/test/echo/{package_name}_test/{package_name}_test/Cargo.toml_ rename to src/new/templates/javascript/no-ui/echo/test/echo_test/echo_test/Cargo.toml index c8717be6..f0207b23 100644 --- a/src/new/templates/test/echo/{package_name}_test/{package_name}_test/Cargo.toml_ +++ b/src/new/templates/javascript/no-ui/echo/test/echo_test/echo_test/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "{package_name}_test" +name = "echo_test" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/test/echo/{package_name}_test/{package_name}_test/src/lib.rs b/src/new/templates/javascript/no-ui/echo/test/echo_test/echo_test/src/lib.rs similarity index 78% rename from src/new/templates/test/echo/{package_name}_test/{package_name}_test/src/lib.rs rename to src/new/templates/javascript/no-ui/echo/test/echo_test/echo_test/src/lib.rs index bdd36456..e1362078 100644 --- a/src/new/templates/test/echo/{package_name}_test/{package_name}_test/src/lib.rs +++ b/src/new/templates/javascript/no-ui/echo/test/echo_test/echo_test/src/lib.rs @@ -10,7 +10,7 @@ mod tester_lib; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-test-{publisher_dotted_kebab}-v0", + world: "echo-test-template-dot-os-v0", generate_unused_types: true, additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); @@ -32,26 +32,26 @@ fn handle_message(our: &Address) -> anyhow::Result<()> { input_node_names: node_names, .. }) = message.body().try_into()?; - print_to_terminal(0, "{package_name}_test: a"); + print_to_terminal(0, "echo_test: a"); assert!(node_names.len() == 1); let our_echo_address = Address { node: our.node.clone(), - process: ProcessId::new(Some("{package_name}"), "{package_name}", "{publisher}"), + process: ProcessId::new(Some("echo"), "echo", "template.os"), }; // Send - print_to_terminal(0, "{package_name}_test: b"); + print_to_terminal(0, "echo_test: b"); let response = Request::new() .target(our_echo_address) .body(serde_json::to_vec("test")?) .send_and_await_response(15)? .unwrap(); if response.is_request() { - fail!("{package_name}_test"); + fail!("echo_test"); }; if serde_json::json!("Ack") != serde_json::from_slice::(response.body())? { - fail!("{package_name}_test"); + fail!("echo_test"); }; Response::new() @@ -70,9 +70,9 @@ fn init(our: Address) { match handle_message(&our) { Ok(()) => {} Err(e) => { - print_to_terminal(0, format!("{package_name}_test: error: {e:?}").as_str()); + print_to_terminal(0, format!("echo_test: error: {e:?}").as_str()); - fail!("{package_name}_test"); + fail!("echo_test"); } }; } diff --git a/src/new/templates/test/echo/{package_name}_test/{package_name}_test/src/tester_lib.rs b/src/new/templates/javascript/no-ui/echo/test/echo_test/echo_test/src/tester_lib.rs similarity index 100% rename from src/new/templates/test/echo/{package_name}_test/{package_name}_test/src/tester_lib.rs rename to src/new/templates/javascript/no-ui/echo/test/echo_test/echo_test/src/tester_lib.rs diff --git a/src/new/templates/test/echo/{package_name}_test/metadata.json b/src/new/templates/javascript/no-ui/echo/test/echo_test/metadata.json similarity index 64% rename from src/new/templates/test/echo/{package_name}_test/metadata.json rename to src/new/templates/javascript/no-ui/echo/test/echo_test/metadata.json index 52706c6d..11c67227 100644 --- a/src/new/templates/test/echo/{package_name}_test/metadata.json +++ b/src/new/templates/javascript/no-ui/echo/test/echo_test/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name} Test", - "description": "A test for {package_name}.", + "name": "echo Test", + "description": "A test for echo.", "image": "", "properties": { - "package_name": "{package_name}_test", + "package_name": "echo_test", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/javascript/no-ui/echo/test/echo_test/pkg/manifest.json b/src/new/templates/javascript/no-ui/echo/test/echo_test/pkg/manifest.json new file mode 100644 index 00000000..5448a0b4 --- /dev/null +++ b/src/new/templates/javascript/no-ui/echo/test/echo_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "echo_test", + "process_wasm_path": "/echo_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "echo:echo:template.os" + ], + "grant_capabilities": [ + "echo:echo:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/test/echo/tests.toml b/src/new/templates/javascript/no-ui/echo/test/tests.toml similarity index 89% rename from src/new/templates/test/echo/tests.toml rename to src/new/templates/javascript/no-ui/echo/test/tests.toml index 55423eab..f7b06e8f 100644 --- a/src/new/templates/test/echo/tests.toml +++ b/src/new/templates/javascript/no-ui/echo/test/tests.toml @@ -10,7 +10,7 @@ setup_packages = [ { path = "..", run = true } ] setup_scripts = [] -test_package_paths = ["{package_name}_test"] +test_package_paths = ["echo_test"] test_scripts = [] timeout_secs = 5 fakechain_router = 8545 diff --git a/src/new/templates/javascript/no-ui/fibonacci/{package_name}/package.json b/src/new/templates/javascript/no-ui/fibonacci/fibonacci/package.json similarity index 81% rename from src/new/templates/javascript/no-ui/fibonacci/{package_name}/package.json rename to src/new/templates/javascript/no-ui/fibonacci/fibonacci/package.json index 6f723492..1856b5b7 100644 --- a/src/new/templates/javascript/no-ui/fibonacci/{package_name}/package.json +++ b/src/new/templates/javascript/no-ui/fibonacci/fibonacci/package.json @@ -1,12 +1,12 @@ { - "name": "{package_name}", + "name": "fibonacci", "version": "0.1.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "{publisher}", + "author": "template.os", "license": "MIT", "dependencies": { "@bytecodealliance/componentize-js": "0.5.0" diff --git a/src/new/templates/javascript/no-ui/fibonacci/{package_name}/src/lib.js b/src/new/templates/javascript/no-ui/fibonacci/fibonacci/src/lib.js similarity index 89% rename from src/new/templates/javascript/no-ui/fibonacci/{package_name}/src/lib.js rename to src/new/templates/javascript/no-ui/fibonacci/fibonacci/src/lib.js index d7a4c386..084d7ab9 100644 --- a/src/new/templates/javascript/no-ui/fibonacci/{package_name}/src/lib.js +++ b/src/new/templates/javascript/no-ui/fibonacci/fibonacci/src/lib.js @@ -44,7 +44,7 @@ function handleMessage(ourNode) { const start = Date.now(); const result = fibonacci(number); const duration = (Date.now() - start) * 1000000; - printToTerminal(0, `{package_name}: fibonacci(${number}) = ${result}; ${duration}ns`); + printToTerminal(0, `fibonacci: fibonacci(${number}) = ${result}; ${duration}ns`); sendResponse( { inherit: false, @@ -70,7 +70,7 @@ function handleMessage(ourNode) { .reduce((sum, item) => sum + item, 0) / numberTrials; printToTerminal( 0, - `{package_name}: fibonacci(${number}) = ${result}; ${mean}±${absoluteDeviation}ns averaged over ${numberTrials} trials`, + `fibonacci: fibonacci(${number}) = ${result}; ${mean}±${absoluteDeviation}ns averaged over ${numberTrials} trials`, ); sendResponse( { @@ -88,7 +88,7 @@ function handleMessage(ourNode) { } export function init(our) { - printToTerminal(0, `{package_name}: begin (javascript)`); + printToTerminal(0, `fibonacci: begin (javascript)`); const { node: ourNode } = parseAddress(our); @@ -96,7 +96,7 @@ export function init(our) { try { handleMessage(ourNode); } catch (error) { - printToTerminal(0, `{package_name}: got error ${error}`); + printToTerminal(0, `fibonacci: got error ${error}`); } } } diff --git a/src/new/templates/javascript/no-ui/fibonacci/metadata.json b/src/new/templates/javascript/no-ui/fibonacci/metadata.json index 944b2bb4..b5157157 100644 --- a/src/new/templates/javascript/no-ui/fibonacci/metadata.json +++ b/src/new/templates/javascript/no-ui/fibonacci/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "fibonacci", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "fibonacci", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/javascript/no-ui/fibonacci/pkg/manifest.json b/src/new/templates/javascript/no-ui/fibonacci/pkg/manifest.json index f71144aa..b621d87d 100644 --- a/src/new/templates/javascript/no-ui/fibonacci/pkg/manifest.json +++ b/src/new/templates/javascript/no-ui/fibonacci/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "fibonacci", + "process_wasm_path": "/fibonacci.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/rust/ui/chat/Cargo.toml_ b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/Cargo.toml similarity index 82% rename from src/new/templates/rust/ui/chat/Cargo.toml_ rename to src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/Cargo.toml index 31d65e6d..a743c053 100644 --- a/src/new/templates/rust/ui/chat/Cargo.toml_ +++ b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = [ - "{package_name}", + "fibonacci_test", ] [profile.release] diff --git a/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/api/fibonacci_test:template.os-v0.wit b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/api/fibonacci_test:template.os-v0.wit new file mode 100644 index 00000000..bef06257 --- /dev/null +++ b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/api/fibonacci_test:template.os-v0.wit @@ -0,0 +1,5 @@ +world fibonacci-test-template-dot-os-v0 { + import fibonacci; + import tester; + include process-v0; +} diff --git a/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/Cargo.toml b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/Cargo.toml new file mode 100644 index 00000000..5485e2e1 --- /dev/null +++ b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "fibonacci_test" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1.0" +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" } +process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +wit-bindgen = "0.24.0" + +[lib] +crate-type = ["cdylib"] + +[package.metadata.component] +package = "kinode:process" diff --git a/src/new/templates/test/fibonacci/{package_name}_test/{package_name}_test/src/lib.rs b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/lib.rs similarity index 78% rename from src/new/templates/test/fibonacci/{package_name}_test/{package_name}_test/src/lib.rs rename to src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/lib.rs index 7e33be91..60fef67c 100644 --- a/src/new/templates/test/fibonacci/{package_name}_test/{package_name}_test/src/lib.rs +++ b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/lib.rs @@ -1,4 +1,4 @@ -use crate::kinode::process::{package_name}::{Request as FibRequest, Response as FibResponse}; +use crate::kinode::process::fibonacci::{Request as FibRequest, Response as FibResponse}; use crate::kinode::process::tester::{Request as TesterRequest, Response as TesterResponse, RunRequest, FailResponse}; use kinode_process_lib::{await_message, call_init, print_to_terminal, Address, ProcessId, Request, Response}; @@ -7,7 +7,7 @@ mod tester_lib; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-test-{publisher_dotted_kebab}-v0", + world: "fibonacci-test-template-dot-os-v0", generate_unused_types: true, additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); @@ -17,9 +17,9 @@ fn test_number(n: u32, address: &Address) -> anyhow::Result { .target(address) .body(FibRequest::Number(n)) .send_and_await_response(15)?.unwrap(); - if response.is_request() { fail!("{package_name}_test"); }; + if response.is_request() { fail!("fibonacci_test"); }; let FibResponse::Number(fib_number) = response.body().try_into()? else { - fail!("{package_name}_test"); + fail!("fibonacci_test"); }; Ok(fib_number) } @@ -29,9 +29,9 @@ fn test_numbers(n: u32, n_trials: u32, address: &Address) -> anyhow::Result .target(address) .body(FibRequest::Numbers((n, n_trials))) .send_and_await_response(15)?.unwrap(); - if response.is_request() { fail!("{package_name}_test"); }; + if response.is_request() { fail!("fibonacci_test"); }; let FibResponse::Numbers((fib_number, _)) = response.body().try_into()? else { - fail!("{package_name}_test"); + fail!("fibonacci_test"); }; Ok(fib_number) } @@ -53,12 +53,12 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { input_node_names: node_names, .. }) = message.body().try_into()?; - print_to_terminal(0, "{package_name}_test: a"); + print_to_terminal(0, "fibonacci_test: a"); assert!(node_names.len() == 1); let our_fib_address = Address { node: our.node.clone(), - process: ProcessId::new(Some("{package_name}"), "{package_name}", "{publisher}"), + process: ProcessId::new(Some("fibonacci"), "fibonacci", "template.os"), }; let numbers = vec![0, 1, 2, 5, 10, 20, 30, 47]; @@ -66,7 +66,7 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { for (number, expected) in numbers.iter().zip(expecteds.iter()) { let result = test_number(number.clone(), &our_fib_address)?; if &result != expected { - fail!("{package_name}_test"); + fail!("fibonacci_test"); } } @@ -75,7 +75,7 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { for (number, expected) in numbers.iter().zip(expecteds.iter()) { let result = test_numbers(number.clone(), 5, &our_fib_address)?; if &result != expected { - fail!("{package_name}_test"); + fail!("fibonacci_test"); } } @@ -95,9 +95,9 @@ fn init(our: Address) { match handle_message(&our) { Ok(()) => {}, Err(e) => { - print_to_terminal(0, format!("{package_name}_test: error: {e:?}").as_str()); + print_to_terminal(0, format!("fibonacci_test: error: {e:?}").as_str()); - fail!("{package_name}_test"); + fail!("fibonacci_test"); }, }; } diff --git a/src/new/templates/test/fibonacci/{package_name}_test/{package_name}_test/src/tester_lib.rs b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/tester_lib.rs similarity index 100% rename from src/new/templates/test/fibonacci/{package_name}_test/{package_name}_test/src/tester_lib.rs rename to src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/tester_lib.rs diff --git a/src/new/templates/test/fibonacci/{package_name}_test/metadata.json b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/metadata.json similarity index 59% rename from src/new/templates/test/fibonacci/{package_name}_test/metadata.json rename to src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/metadata.json index 41269fed..daeaff69 100644 --- a/src/new/templates/test/fibonacci/{package_name}_test/metadata.json +++ b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/metadata.json @@ -1,18 +1,18 @@ { - "name": "{package_name} Test", - "description": "A test for {package_name}.", + "name": "fibonacci Test", + "description": "A test for fibonacci.", "image": "", "properties": { - "package_name": "{package_name}_test", + "package_name": "fibonacci_test", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" }, "wit_version": 0, "dependencies": [ - "{package_name}:{publisher}", + "fibonacci:template.os", "tester:sys" ] }, diff --git a/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/pkg/manifest.json b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/pkg/manifest.json new file mode 100644 index 00000000..2e0253aa --- /dev/null +++ b/src/new/templates/javascript/no-ui/fibonacci/test/fibonacci_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "fibonacci_test", + "process_wasm_path": "/fibonacci_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "fibonacci:fibonacci:template.os" + ], + "grant_capabilities": [ + "fibonacci:fibonacci:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/test/fibonacci/tests.toml b/src/new/templates/javascript/no-ui/fibonacci/test/tests.toml similarity index 90% rename from src/new/templates/test/fibonacci/tests.toml rename to src/new/templates/javascript/no-ui/fibonacci/test/tests.toml index 29ba4576..b851fba3 100644 --- a/src/new/templates/test/fibonacci/tests.toml +++ b/src/new/templates/javascript/no-ui/fibonacci/test/tests.toml @@ -10,7 +10,7 @@ setup_packages = [ { path = "..", run = true } ] setup_scripts = [] -test_package_paths = ["{package_name}_test"] +test_package_paths = ["fibonacci_test"] test_scripts = [] timeout_secs = 5 fakechain_router = 8545 diff --git a/src/new/templates/python/no-ui/chat/api/{package_name}:{publisher}-v0.wit b/src/new/templates/python/no-ui/chat/api/chat:template.os-v0.wit similarity index 76% rename from src/new/templates/python/no-ui/chat/api/{package_name}:{publisher}-v0.wit rename to src/new/templates/python/no-ui/chat/api/chat:template.os-v0.wit index 32cee559..9adc12ec 100644 --- a/src/new/templates/python/no-ui/chat/api/{package_name}:{publisher}-v0.wit +++ b/src/new/templates/python/no-ui/chat/api/chat:template.os-v0.wit @@ -1,4 +1,4 @@ -interface {package_name_kebab} { +interface chat { variant request { send(send-request), /// history of chat with given node @@ -21,7 +21,7 @@ interface {package_name_kebab} { } } -world {package_name_kebab}-{publisher_dotted_kebab}-v0 { - import {package_name_kebab}; +world chat-template-dot-os-v0 { + import chat; include process; } diff --git a/src/new/templates/python/no-ui/chat/{package_name}/src/lib.py b/src/new/templates/python/no-ui/chat/chat/src/lib.py similarity index 84% rename from src/new/templates/python/no-ui/chat/{package_name}/src/lib.py rename to src/new/templates/python/no-ui/chat/chat/src/lib.py index 45beadbc..68b47104 100644 --- a/src/new/templates/python/no-ui/chat/{package_name}/src/lib.py +++ b/src/new/templates/python/no-ui/chat/chat/src/lib.py @@ -1,7 +1,7 @@ import json -import {package_name}_{publisher_dotted_snake}_v0 -from {package_name}_{publisher_dotted_snake}_v0.imports.standard import ( +import chat_template_dot_os_v0 +from chat_template_dot_os_v0.imports.standard import ( Address, MessageRequest, MessageResponse, @@ -13,7 +13,7 @@ send_and_await_response, send_response, ) -from {package_name}_{publisher_dotted_snake}_v0.types import Err +from chat_template_dot_os_v0.types import Err def parse_address(address_string): node, _, rest = address_string.partition("@") @@ -59,7 +59,7 @@ def handle_message(our_node, message_archive): send_and_await_response( Address( target, - ProcessId("{package_name}", "{package_name}", "{publisher}"), + ProcessId("chat", "chat", "template.os"), ), Request(False, 5, message.value.body, None, []), None, @@ -90,9 +90,9 @@ def handle_message(our_node, message_archive): return message_archive -class {package_name_upper_camel}{publisher_dotted_upper_camel}V0({package_name}_{publisher_dotted_snake}_v0.{package_name_upper_camel}{publisher_dotted_upper_camel}V0): +class ChatTemplateDotOsV0(chat_template_dot_os_v0.ChatTemplateDotOsV0): def init(self, our): - print_to_terminal(0, "{package_name}: begin (python)") + print_to_terminal(0, "chat: begin (python)") our_node, _, _, _ = parse_address(our) message_archive = {} @@ -101,4 +101,4 @@ def init(self, our): try: message_archive = handle_message(our_node, message_archive) except Exception as e: - print_to_terminal(0, f"{package_name}: error: {e}") + print_to_terminal(0, f"chat: error: {e}") diff --git a/src/new/templates/python/no-ui/chat/metadata.json b/src/new/templates/python/no-ui/chat/metadata.json index 944b2bb4..2a864fd5 100644 --- a/src/new/templates/python/no-ui/chat/metadata.json +++ b/src/new/templates/python/no-ui/chat/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "chat", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "chat", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/python/no-ui/chat/pkg/manifest.json b/src/new/templates/python/no-ui/chat/pkg/manifest.json index f71144aa..3da591df 100644 --- a/src/new/templates/python/no-ui/chat/pkg/manifest.json +++ b/src/new/templates/python/no-ui/chat/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "chat", + "process_wasm_path": "/chat.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/python/no-ui/chat/pkg/scripts.json b/src/new/templates/python/no-ui/chat/pkg/scripts.json index ba63df9e..e89b6733 100644 --- a/src/new/templates/python/no-ui/chat/pkg/scripts.json +++ b/src/new/templates/python/no-ui/chat/pkg/scripts.json @@ -4,10 +4,10 @@ "public": false, "request_networking": false, "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "chat:chat:template.os" ], "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "chat:chat:template.os" ] } } diff --git a/src/new/templates/python/no-ui/chat/send/src/lib.py b/src/new/templates/python/no-ui/chat/send/src/lib.py index d441f955..9e9a7ddb 100644 --- a/src/new/templates/python/no-ui/chat/send/src/lib.py +++ b/src/new/templates/python/no-ui/chat/send/src/lib.py @@ -1,7 +1,7 @@ import json -import {package_name}_{publisher_dotted_snake}_v0 -from {package_name}_{publisher_dotted_snake}_v0.imports.standard import ( +import chat_template_dot_os_v0 +from chat_template_dot_os_v0.imports.standard import ( Address, MessageRequest, MessageResponse, @@ -10,7 +10,7 @@ receive, send_and_await_response, ) -from {package_name}_{publisher_dotted_snake}_v0.types import Err +from chat_template_dot_os_v0.types import Err def parse_address(address_string): node, _, rest = address_string.partition("@") @@ -20,7 +20,7 @@ def parse_address(address_string): return node, process, package, publisher -class {package_name_upper_camel}{publisher_dotted_upper_camel}V0({package_name}_{publisher_dotted_snake}_v0.{package_name_upper_camel}{publisher_dotted_upper_camel}V0): +class ChatTemplateDotOsV0(chat_template_dot_os_v0.ChatTemplateDotOsV0): def init(self, our): our_node, _, _, _ = parse_address(our) result = receive() @@ -44,7 +44,7 @@ def init(self, our): response = send_and_await_response( Address( our_node, - ProcessId("{package_name}", "{package_name}", "{publisher}"), + ProcessId("chat", "chat", "template.os"), ), Request(False, 5, json.dumps(request).encode("utf-8"), None, []), None, diff --git a/src/new/templates/test/chat/{package_name}_test/Cargo.toml_ b/src/new/templates/python/no-ui/chat/test/chat_test/Cargo.toml similarity index 79% rename from src/new/templates/test/chat/{package_name}_test/Cargo.toml_ rename to src/new/templates/python/no-ui/chat/test/chat_test/Cargo.toml index 6c797c34..7021d14c 100644 --- a/src/new/templates/test/chat/{package_name}_test/Cargo.toml_ +++ b/src/new/templates/python/no-ui/chat/test/chat_test/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = [ - "{package_name}_test", + "chat_test", ] [profile.release] diff --git a/src/new/templates/python/no-ui/chat/test/chat_test/api/chat_test:template.os-v0.wit b/src/new/templates/python/no-ui/chat/test/chat_test/api/chat_test:template.os-v0.wit new file mode 100644 index 00000000..c87f01eb --- /dev/null +++ b/src/new/templates/python/no-ui/chat/test/chat_test/api/chat_test:template.os-v0.wit @@ -0,0 +1,5 @@ +world chat-test-template-dot-os-v0 { + import chat; + import tester; + include process-v0; +} diff --git a/src/new/templates/test/fibonacci/{package_name}_test/{package_name}_test/Cargo.toml_ b/src/new/templates/python/no-ui/chat/test/chat_test/chat_test/Cargo.toml similarity index 93% rename from src/new/templates/test/fibonacci/{package_name}_test/{package_name}_test/Cargo.toml_ rename to src/new/templates/python/no-ui/chat/test/chat_test/chat_test/Cargo.toml index c8717be6..7c5126db 100644 --- a/src/new/templates/test/fibonacci/{package_name}_test/{package_name}_test/Cargo.toml_ +++ b/src/new/templates/python/no-ui/chat/test/chat_test/chat_test/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "{package_name}_test" +name = "chat_test" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/python/no-ui/chat/test/chat_test/chat_test/src/lib.rs b/src/new/templates/python/no-ui/chat/test/chat_test/chat_test/src/lib.rs new file mode 100644 index 00000000..40e55a74 --- /dev/null +++ b/src/new/templates/python/no-ui/chat/test/chat_test/chat_test/src/lib.rs @@ -0,0 +1,107 @@ +use crate::kinode::process::chat::{ChatMessage, Request as ChatRequest, Response as ChatResponse, SendRequest}; +use crate::kinode::process::tester::{Request as TesterRequest, Response as TesterResponse, RunRequest, FailResponse}; + +use kinode_process_lib::{await_message, call_init, print_to_terminal, println, Address, ProcessId, Request, Response}; + +mod tester_lib; + +wit_bindgen::generate!({ + path: "target/wit", + world: "chat-test-template-dot-os-v0", + generate_unused_types: true, + additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], +}); + +fn handle_message (our: &Address) -> anyhow::Result<()> { + let message = await_message().unwrap(); + + if !message.is_request() { + unimplemented!(); + } + let source = message.source(); + if our.node != source.node { + return Err(anyhow::anyhow!( + "rejecting foreign Message from {:?}", + source, + )); + } + let TesterRequest::Run(RunRequest { + input_node_names: node_names, + .. + }) = message.body().try_into()?; + print_to_terminal(0, "chat_test: a"); + assert!(node_names.len() >= 2); + if our.node != node_names[0] { + // we are not master node: return + Response::new() + .body(TesterResponse::Run(Ok(()))) + .send() + .unwrap(); + return Ok(()); + } + + // we are master node + + let our_chat_address = Address { + node: our.node.clone(), + process: ProcessId::new(Some("chat"), "chat", "template.os"), + }; + let their_chat_address = Address { + node: node_names[1].clone(), + process: ProcessId::new(Some("chat"), "chat", "template.os"), + }; + + // Send + print_to_terminal(0, "chat_test: b"); + let message: String = "hello".into(); + let _ = Request::new() + .target(our_chat_address.clone()) + .body(ChatRequest::Send(SendRequest { + target: node_names[1].clone(), + message: message.clone(), + })) + .send_and_await_response(15)?.unwrap(); + + // Get history from receiver & test + print_to_terminal(0, "chat_test: c"); + let response = Request::new() + .target(their_chat_address.clone()) + .body(ChatRequest::History(our.node.clone())) + .send_and_await_response(15)?.unwrap(); + if response.is_request() { fail!("chat_test"); }; + let ChatResponse::History(messages) = response.body().try_into()? else { + fail!("chat_test"); + }; + let expected_messages = vec![ChatMessage { + author: our.node.clone(), + content: message, + }]; + + if messages != expected_messages { + println!("{messages:?} != {expected_messages:?}"); + fail!("chat_test"); + } + + Response::new() + .body(TesterResponse::Run(Ok(()))) + .send() + .unwrap(); + + Ok(()) +} + +call_init!(init); +fn init(our: Address) { + print_to_terminal(0, "begin"); + + loop { + match handle_message(&our) { + Ok(()) => {}, + Err(e) => { + print_to_terminal(0, format!("chat_test: error: {e:?}").as_str()); + + fail!("chat_test"); + }, + }; + } +} diff --git a/src/new/templates/test/file_transfer/{package_name}_test/{package_name}_test/src/tester_lib.rs b/src/new/templates/python/no-ui/chat/test/chat_test/chat_test/src/tester_lib.rs similarity index 100% rename from src/new/templates/test/file_transfer/{package_name}_test/{package_name}_test/src/tester_lib.rs rename to src/new/templates/python/no-ui/chat/test/chat_test/chat_test/src/tester_lib.rs diff --git a/src/new/templates/python/no-ui/chat/test/chat_test/metadata.json b/src/new/templates/python/no-ui/chat/test/chat_test/metadata.json new file mode 100644 index 00000000..8161d7d6 --- /dev/null +++ b/src/new/templates/python/no-ui/chat/test/chat_test/metadata.json @@ -0,0 +1,21 @@ +{ + "name": "chat Test", + "description": "A test for chat.", + "image": "", + "properties": { + "package_name": "chat_test", + "current_version": "0.1.0", + "publisher": "template.os", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + }, + "wit_version": 0, + "dependencies": [ + "chat:template.os", + "tester:sys" + ] + }, + "external_url": "", + "animation_url": "" +} diff --git a/src/new/templates/python/no-ui/chat/test/chat_test/pkg/manifest.json b/src/new/templates/python/no-ui/chat/test/chat_test/pkg/manifest.json new file mode 100644 index 00000000..b6c7f2ab --- /dev/null +++ b/src/new/templates/python/no-ui/chat/test/chat_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "chat_test", + "process_wasm_path": "/chat_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "chat:chat:template.os" + ], + "grant_capabilities": [ + "chat:chat:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/python/no-ui/chat/test/tests.toml b/src/new/templates/python/no-ui/chat/test/tests.toml new file mode 100644 index 00000000..36aa5241 --- /dev/null +++ b/src/new/templates/python/no-ui/chat/test/tests.toml @@ -0,0 +1,28 @@ +runtime = { FetchVersion = "latest" } +# runtime = { RepoPath = "~/git/kinode" } +persist_home = false +runtime_build_release = false + + +[[tests]] +dependency_package_paths = [".."] +setup_packages = [ + { path = "..", run = true } +] +setup_scripts = [] +test_package_paths = ["chat_test"] +test_scripts = [] +timeout_secs = 5 +fakechain_router = 8545 + +[[tests.nodes]] +port = 8080 +home = "home/first" +fake_node_name = "first.dev" +runtime_verbosity = 2 + +[[tests.nodes]] +port = 8081 +home = "home/second" +fake_node_name = "second.dev" +runtime_verbosity = 2 diff --git a/src/new/templates/python/no-ui/echo/{package_name}/src/lib.py b/src/new/templates/python/no-ui/echo/echo/src/lib.py similarity index 86% rename from src/new/templates/python/no-ui/echo/{package_name}/src/lib.py rename to src/new/templates/python/no-ui/echo/echo/src/lib.py index c1743d79..c0ea98d2 100644 --- a/src/new/templates/python/no-ui/echo/{package_name}/src/lib.py +++ b/src/new/templates/python/no-ui/echo/echo/src/lib.py @@ -31,7 +31,7 @@ def handle_message(our_node): raise Exception(f"unexpected Response: {message}") case MessageRequest(): body = json.loads(message.value.body.decode("utf-8")) - print_to_terminal(0, f"{package_name}: got message {body}") + print_to_terminal(0, f"echo: got message {body}") send_response( Response( False, @@ -44,7 +44,7 @@ def handle_message(our_node): class Process(process.Process): def init(self, our): - print_to_terminal(0, "{package_name}: begin (python)") + print_to_terminal(0, "echo: begin (python)") our_node, _, _, _ = parse_address(our) @@ -52,4 +52,4 @@ def init(self, our): try: handle_message(our_node) except Exception as e: - print_to_terminal(0, f"{package_name}: error: {e}") + print_to_terminal(0, f"echo: error: {e}") diff --git a/src/new/templates/python/no-ui/echo/metadata.json b/src/new/templates/python/no-ui/echo/metadata.json index 944b2bb4..232e5343 100644 --- a/src/new/templates/python/no-ui/echo/metadata.json +++ b/src/new/templates/python/no-ui/echo/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "echo", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "echo", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/python/no-ui/echo/pkg/manifest.json b/src/new/templates/python/no-ui/echo/pkg/manifest.json index f71144aa..7fc7826e 100644 --- a/src/new/templates/python/no-ui/echo/pkg/manifest.json +++ b/src/new/templates/python/no-ui/echo/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "echo", + "process_wasm_path": "/echo.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/python/no-ui/echo/test/echo_test/Cargo.toml b/src/new/templates/python/no-ui/echo/test/echo_test/Cargo.toml new file mode 100644 index 00000000..08be60d0 --- /dev/null +++ b/src/new/templates/python/no-ui/echo/test/echo_test/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "echo_test", +] + +[profile.release] +panic = "abort" +opt-level = "s" +lto = true diff --git a/src/new/templates/python/no-ui/echo/test/echo_test/api/echo_test:template.os-v0.wit b/src/new/templates/python/no-ui/echo/test/echo_test/api/echo_test:template.os-v0.wit new file mode 100644 index 00000000..c4b22457 --- /dev/null +++ b/src/new/templates/python/no-ui/echo/test/echo_test/api/echo_test:template.os-v0.wit @@ -0,0 +1,4 @@ +world echo-test-template-dot-os-v0 { + import tester; + include process-v0; +} diff --git a/src/new/templates/test/file_transfer/{package_name}_test/{package_name}_test/Cargo.toml_ b/src/new/templates/python/no-ui/echo/test/echo_test/echo_test/Cargo.toml similarity index 93% rename from src/new/templates/test/file_transfer/{package_name}_test/{package_name}_test/Cargo.toml_ rename to src/new/templates/python/no-ui/echo/test/echo_test/echo_test/Cargo.toml index c8717be6..f0207b23 100644 --- a/src/new/templates/test/file_transfer/{package_name}_test/{package_name}_test/Cargo.toml_ +++ b/src/new/templates/python/no-ui/echo/test/echo_test/echo_test/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "{package_name}_test" +name = "echo_test" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/python/no-ui/echo/test/echo_test/echo_test/src/lib.rs b/src/new/templates/python/no-ui/echo/test/echo_test/echo_test/src/lib.rs new file mode 100644 index 00000000..e1362078 --- /dev/null +++ b/src/new/templates/python/no-ui/echo/test/echo_test/echo_test/src/lib.rs @@ -0,0 +1,79 @@ +use crate::kinode::process::tester::{ + FailResponse, Request as TesterRequest, Response as TesterResponse, RunRequest, +}; + +use kinode_process_lib::{ + await_message, call_init, print_to_terminal, Address, ProcessId, Request, Response, +}; + +mod tester_lib; + +wit_bindgen::generate!({ + path: "target/wit", + world: "echo-test-template-dot-os-v0", + generate_unused_types: true, + additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], +}); + +fn handle_message(our: &Address) -> anyhow::Result<()> { + let message = await_message().unwrap(); + + if !message.is_request() { + unimplemented!(); + } + let source = message.source(); + if our.node != source.node { + return Err(anyhow::anyhow!( + "rejecting foreign Message from {:?}", + source, + )); + } + let TesterRequest::Run(RunRequest { + input_node_names: node_names, + .. + }) = message.body().try_into()?; + print_to_terminal(0, "echo_test: a"); + assert!(node_names.len() == 1); + + let our_echo_address = Address { + node: our.node.clone(), + process: ProcessId::new(Some("echo"), "echo", "template.os"), + }; + + // Send + print_to_terminal(0, "echo_test: b"); + let response = Request::new() + .target(our_echo_address) + .body(serde_json::to_vec("test")?) + .send_and_await_response(15)? + .unwrap(); + if response.is_request() { + fail!("echo_test"); + }; + if serde_json::json!("Ack") != serde_json::from_slice::(response.body())? { + fail!("echo_test"); + }; + + Response::new() + .body(TesterResponse::Run(Ok(()))) + .send() + .unwrap(); + + Ok(()) +} + +call_init!(init); +fn init(our: Address) { + print_to_terminal(0, "begin"); + + loop { + match handle_message(&our) { + Ok(()) => {} + Err(e) => { + print_to_terminal(0, format!("echo_test: error: {e:?}").as_str()); + + fail!("echo_test"); + } + }; + } +} diff --git a/src/new/templates/python/no-ui/echo/test/echo_test/echo_test/src/tester_lib.rs b/src/new/templates/python/no-ui/echo/test/echo_test/echo_test/src/tester_lib.rs new file mode 100644 index 00000000..8fb7ae19 --- /dev/null +++ b/src/new/templates/python/no-ui/echo/test/echo_test/echo_test/src/tester_lib.rs @@ -0,0 +1,30 @@ +#[allow(unused_imports)] +use crate::kinode::process::tester::{FailResponse, Response as TesterResponse}; + +#[macro_export] +macro_rules! fail { + ($test:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: file!().into(), + line: line!(), + column: column!(), + }))) + .send() + .unwrap(); + panic!("") + }; + ($test:expr, $file:expr, $line:expr, $column:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: $file.into(), + line: $line, + column: $column, + }))) + .send() + .unwrap(); + panic!("") + }; +} diff --git a/src/new/templates/python/no-ui/echo/test/echo_test/metadata.json b/src/new/templates/python/no-ui/echo/test/echo_test/metadata.json new file mode 100644 index 00000000..11c67227 --- /dev/null +++ b/src/new/templates/python/no-ui/echo/test/echo_test/metadata.json @@ -0,0 +1,20 @@ +{ + "name": "echo Test", + "description": "A test for echo.", + "image": "", + "properties": { + "package_name": "echo_test", + "current_version": "0.1.0", + "publisher": "template.os", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + }, + "wit_version": 0, + "dependencies": [ + "tester:sys" + ] + }, + "external_url": "", + "animation_url": "" +} diff --git a/src/new/templates/python/no-ui/echo/test/echo_test/pkg/manifest.json b/src/new/templates/python/no-ui/echo/test/echo_test/pkg/manifest.json new file mode 100644 index 00000000..5448a0b4 --- /dev/null +++ b/src/new/templates/python/no-ui/echo/test/echo_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "echo_test", + "process_wasm_path": "/echo_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "echo:echo:template.os" + ], + "grant_capabilities": [ + "echo:echo:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/python/no-ui/echo/test/tests.toml b/src/new/templates/python/no-ui/echo/test/tests.toml new file mode 100644 index 00000000..f7b06e8f --- /dev/null +++ b/src/new/templates/python/no-ui/echo/test/tests.toml @@ -0,0 +1,22 @@ +runtime = { FetchVersion = "latest" } +# runtime = { RepoPath = "~/git/kinode" } +persist_home = false +runtime_build_release = false + + +[[tests]] +dependency_package_paths = [] +setup_packages = [ + { path = "..", run = true } +] +setup_scripts = [] +test_package_paths = ["echo_test"] +test_scripts = [] +timeout_secs = 5 +fakechain_router = 8545 + +[[tests.nodes]] +port = 8080 +home = "home/first" +fake_node_name = "first.dev" +runtime_verbosity = 2 diff --git a/src/new/templates/python/no-ui/fibonacci/{package_name}/src/lib.py b/src/new/templates/python/no-ui/fibonacci/fibonacci/src/lib.py similarity index 88% rename from src/new/templates/python/no-ui/fibonacci/{package_name}/src/lib.py rename to src/new/templates/python/no-ui/fibonacci/fibonacci/src/lib.py index 16932a54..257fc4f3 100644 --- a/src/new/templates/python/no-ui/fibonacci/{package_name}/src/lib.py +++ b/src/new/templates/python/no-ui/fibonacci/fibonacci/src/lib.py @@ -48,7 +48,7 @@ def handle_message(our_node): duration = time.perf_counter_ns() - start print_to_terminal( 0, - f"{package_name}: fibonacci({number}) = {result}; {duration}ns", + f"fibonacci: fibonacci({number}) = {result}; {duration}ns", ) send_response( Response(False, json.dumps({"Number": result}).encode("utf-8"), None, []), @@ -66,7 +66,7 @@ def handle_message(our_node): absolute_deviation = sum(abs(item - mean) for item in durations) / number_trials print_to_terminal( 0, - f"{package_name}: fibonacci({number}) = {result}; {duration}±{absolute_deviation}ns averaged over {number_trials} trials", + f"fibonacci: fibonacci({number}) = {result}; {duration}±{absolute_deviation}ns averaged over {number_trials} trials", ) send_response( Response( @@ -82,7 +82,7 @@ def handle_message(our_node): class Process(process.Process): def init(self, our): - print_to_terminal(0, "{package_name}: begin (python)") + print_to_terminal(0, "fibonacci: begin (python)") our_node, _, _, _ = parse_address(our) @@ -90,4 +90,4 @@ def init(self, our): try: handle_message(our_node) except Exception as e: - print_to_terminal(0, f"{package_name}: error: {e}") + print_to_terminal(0, f"fibonacci: error: {e}") diff --git a/src/new/templates/python/no-ui/fibonacci/metadata.json b/src/new/templates/python/no-ui/fibonacci/metadata.json index 944b2bb4..b5157157 100644 --- a/src/new/templates/python/no-ui/fibonacci/metadata.json +++ b/src/new/templates/python/no-ui/fibonacci/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "fibonacci", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "fibonacci", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/python/no-ui/fibonacci/pkg/manifest.json b/src/new/templates/python/no-ui/fibonacci/pkg/manifest.json index f71144aa..b621d87d 100644 --- a/src/new/templates/python/no-ui/fibonacci/pkg/manifest.json +++ b/src/new/templates/python/no-ui/fibonacci/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "fibonacci", + "process_wasm_path": "/fibonacci.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/Cargo.toml b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/Cargo.toml new file mode 100644 index 00000000..a743c053 --- /dev/null +++ b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "fibonacci_test", +] + +[profile.release] +panic = "abort" +opt-level = "s" +lto = true diff --git a/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/api/fibonacci_test:template.os-v0.wit b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/api/fibonacci_test:template.os-v0.wit new file mode 100644 index 00000000..bef06257 --- /dev/null +++ b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/api/fibonacci_test:template.os-v0.wit @@ -0,0 +1,5 @@ +world fibonacci-test-template-dot-os-v0 { + import fibonacci; + import tester; + include process-v0; +} diff --git a/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/Cargo.toml b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/Cargo.toml new file mode 100644 index 00000000..5485e2e1 --- /dev/null +++ b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "fibonacci_test" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1.0" +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" } +process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +wit-bindgen = "0.24.0" + +[lib] +crate-type = ["cdylib"] + +[package.metadata.component] +package = "kinode:process" diff --git a/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/lib.rs b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/lib.rs new file mode 100644 index 00000000..60fef67c --- /dev/null +++ b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/lib.rs @@ -0,0 +1,104 @@ +use crate::kinode::process::fibonacci::{Request as FibRequest, Response as FibResponse}; +use crate::kinode::process::tester::{Request as TesterRequest, Response as TesterResponse, RunRequest, FailResponse}; + +use kinode_process_lib::{await_message, call_init, print_to_terminal, Address, ProcessId, Request, Response}; + +mod tester_lib; + +wit_bindgen::generate!({ + path: "target/wit", + world: "fibonacci-test-template-dot-os-v0", + generate_unused_types: true, + additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], +}); + +fn test_number(n: u32, address: &Address) -> anyhow::Result { + let response = Request::new() + .target(address) + .body(FibRequest::Number(n)) + .send_and_await_response(15)?.unwrap(); + if response.is_request() { fail!("fibonacci_test"); }; + let FibResponse::Number(fib_number) = response.body().try_into()? else { + fail!("fibonacci_test"); + }; + Ok(fib_number) +} + +fn test_numbers(n: u32, n_trials: u32, address: &Address) -> anyhow::Result { + let response = Request::new() + .target(address) + .body(FibRequest::Numbers((n, n_trials))) + .send_and_await_response(15)?.unwrap(); + if response.is_request() { fail!("fibonacci_test"); }; + let FibResponse::Numbers((fib_number, _)) = response.body().try_into()? else { + fail!("fibonacci_test"); + }; + Ok(fib_number) +} + +fn handle_message (our: &Address) -> anyhow::Result<()> { + let message = await_message().unwrap(); + + if !message.is_request() { + unimplemented!(); + } + let source = message.source(); + if our.node != source.node { + return Err(anyhow::anyhow!( + "rejecting foreign Message from {:?}", + source, + )); + } + let TesterRequest::Run(RunRequest { + input_node_names: node_names, + .. + }) = message.body().try_into()?; + print_to_terminal(0, "fibonacci_test: a"); + assert!(node_names.len() == 1); + + let our_fib_address = Address { + node: our.node.clone(), + process: ProcessId::new(Some("fibonacci"), "fibonacci", "template.os"), + }; + + let numbers = vec![0, 1, 2, 5, 10, 20, 30, 47]; + let expecteds = vec![0, 1, 1, 5, 55, 6_765, 832_040, 2_971_215_073]; + for (number, expected) in numbers.iter().zip(expecteds.iter()) { + let result = test_number(number.clone(), &our_fib_address)?; + if &result != expected { + fail!("fibonacci_test"); + } + } + + let numbers = vec![0, 1, 2, 5, 10, 20, 30, 47]; + let expecteds = vec![0, 1, 1, 5, 55, 6_765, 832_040, 2_971_215_073]; + for (number, expected) in numbers.iter().zip(expecteds.iter()) { + let result = test_numbers(number.clone(), 5, &our_fib_address)?; + if &result != expected { + fail!("fibonacci_test"); + } + } + + Response::new() + .body(TesterResponse::Run(Ok(()))) + .send() + .unwrap(); + + Ok(()) +} + +call_init!(init); +fn init(our: Address) { + print_to_terminal(0, "begin"); + + loop { + match handle_message(&our) { + Ok(()) => {}, + Err(e) => { + print_to_terminal(0, format!("fibonacci_test: error: {e:?}").as_str()); + + fail!("fibonacci_test"); + }, + }; + } +} diff --git a/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/tester_lib.rs b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/tester_lib.rs new file mode 100644 index 00000000..8fb7ae19 --- /dev/null +++ b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/tester_lib.rs @@ -0,0 +1,30 @@ +#[allow(unused_imports)] +use crate::kinode::process::tester::{FailResponse, Response as TesterResponse}; + +#[macro_export] +macro_rules! fail { + ($test:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: file!().into(), + line: line!(), + column: column!(), + }))) + .send() + .unwrap(); + panic!("") + }; + ($test:expr, $file:expr, $line:expr, $column:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: $file.into(), + line: $line, + column: $column, + }))) + .send() + .unwrap(); + panic!("") + }; +} diff --git a/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/metadata.json b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/metadata.json new file mode 100644 index 00000000..daeaff69 --- /dev/null +++ b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/metadata.json @@ -0,0 +1,21 @@ +{ + "name": "fibonacci Test", + "description": "A test for fibonacci.", + "image": "", + "properties": { + "package_name": "fibonacci_test", + "current_version": "0.1.0", + "publisher": "template.os", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + }, + "wit_version": 0, + "dependencies": [ + "fibonacci:template.os", + "tester:sys" + ] + }, + "external_url": "", + "animation_url": "" +} diff --git a/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/pkg/manifest.json b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/pkg/manifest.json new file mode 100644 index 00000000..2e0253aa --- /dev/null +++ b/src/new/templates/python/no-ui/fibonacci/test/fibonacci_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "fibonacci_test", + "process_wasm_path": "/fibonacci_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "fibonacci:fibonacci:template.os" + ], + "grant_capabilities": [ + "fibonacci:fibonacci:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/python/no-ui/fibonacci/test/tests.toml b/src/new/templates/python/no-ui/fibonacci/test/tests.toml new file mode 100644 index 00000000..b851fba3 --- /dev/null +++ b/src/new/templates/python/no-ui/fibonacci/test/tests.toml @@ -0,0 +1,22 @@ +runtime = { FetchVersion = "latest" } +# runtime = { RepoPath = "~/git/kinode" } +persist_home = false +runtime_build_release = false + + +[[tests]] +dependency_package_paths = [".."] +setup_packages = [ + { path = "..", run = true } +] +setup_scripts = [] +test_package_paths = ["fibonacci_test"] +test_scripts = [] +timeout_secs = 5 +fakechain_router = 8545 + +[[tests.nodes]] +port = 8080 +home = "home/first" +fake_node_name = "first.dev" +runtime_verbosity = 2 diff --git a/src/new/templates/rust/no-ui/blank/Cargo.toml b/src/new/templates/rust/no-ui/blank/Cargo.toml new file mode 100644 index 00000000..a90ed6c7 --- /dev/null +++ b/src/new/templates/rust/no-ui/blank/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "blank", +] + +[profile.release] +panic = "abort" +opt-level = "s" +lto = true diff --git a/src/new/templates/rust/no-ui/blank/{package_name}/Cargo.toml_ b/src/new/templates/rust/no-ui/blank/blank/Cargo.toml similarity index 89% rename from src/new/templates/rust/no-ui/blank/{package_name}/Cargo.toml_ rename to src/new/templates/rust/no-ui/blank/blank/Cargo.toml index 1ad787f6..503b41ec 100644 --- a/src/new/templates/rust/no-ui/blank/{package_name}/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/blank/blank/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "{package_name}" +name = "blank" version = "0.1.0" edition = "2021" +publish = false [dependencies] kinode_process_lib = "0.8.5" diff --git a/src/new/templates/rust/no-ui/blank/{package_name}/src/lib.rs b/src/new/templates/rust/no-ui/blank/blank/src/lib.rs similarity index 100% rename from src/new/templates/rust/no-ui/blank/{package_name}/src/lib.rs rename to src/new/templates/rust/no-ui/blank/blank/src/lib.rs diff --git a/src/new/templates/rust/no-ui/blank/metadata.json b/src/new/templates/rust/no-ui/blank/metadata.json index 940b56a7..013b3109 100644 --- a/src/new/templates/rust/no-ui/blank/metadata.json +++ b/src/new/templates/rust/no-ui/blank/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "blank", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "blank", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/rust/no-ui/blank/pkg/manifest.json b/src/new/templates/rust/no-ui/blank/pkg/manifest.json index bf0b8a3c..15deded5 100644 --- a/src/new/templates/rust/no-ui/blank/pkg/manifest.json +++ b/src/new/templates/rust/no-ui/blank/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "blank", + "process_wasm_path": "/blank.wasm", "on_exit": "Restart", "request_networking": false, "request_capabilities": [], diff --git a/src/new/templates/rust/no-ui/chat/Cargo.toml_ b/src/new/templates/rust/no-ui/chat/Cargo.toml similarity index 83% rename from src/new/templates/rust/no-ui/chat/Cargo.toml_ rename to src/new/templates/rust/no-ui/chat/Cargo.toml index b1993b8b..ba357d04 100644 --- a/src/new/templates/rust/no-ui/chat/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/chat/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = [ - "{package_name}", + "chat", "send", ] diff --git a/src/new/templates/rust/no-ui/chat/api/{package_name}:{publisher}-v0.wit b/src/new/templates/rust/no-ui/chat/api/chat:template.os-v0.wit similarity index 76% rename from src/new/templates/rust/no-ui/chat/api/{package_name}:{publisher}-v0.wit rename to src/new/templates/rust/no-ui/chat/api/chat:template.os-v0.wit index c6eb7c36..d883229b 100644 --- a/src/new/templates/rust/no-ui/chat/api/{package_name}:{publisher}-v0.wit +++ b/src/new/templates/rust/no-ui/chat/api/chat:template.os-v0.wit @@ -1,4 +1,4 @@ -interface {package_name_kebab} { +interface chat { variant request { send(send-request), /// history of chat with given node @@ -21,7 +21,7 @@ interface {package_name_kebab} { } } -world {package_name_kebab}-{publisher_dotted_kebab}-v0 { - import {package_name_kebab}; +world chat-template-dot-os-v0 { + import chat; include process-v0; } diff --git a/src/new/templates/rust/no-ui/file_transfer/{package_name}/Cargo.toml_ b/src/new/templates/rust/no-ui/chat/chat/Cargo.toml similarity index 93% rename from src/new/templates/rust/no-ui/file_transfer/{package_name}/Cargo.toml_ rename to src/new/templates/rust/no-ui/chat/chat/Cargo.toml index eff3bb6a..7c684d8c 100644 --- a/src/new/templates/rust/no-ui/file_transfer/{package_name}/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/chat/chat/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "{package_name}" +name = "chat" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/chat/{package_name}/src/lib.rs b/src/new/templates/rust/no-ui/chat/chat/src/lib.rs similarity index 91% rename from src/new/templates/rust/no-ui/chat/{package_name}/src/lib.rs rename to src/new/templates/rust/no-ui/chat/chat/src/lib.rs index 6b64b14f..493dae2a 100644 --- a/src/new/templates/rust/no-ui/chat/{package_name}/src/lib.rs +++ b/src/new/templates/rust/no-ui/chat/chat/src/lib.rs @@ -1,11 +1,11 @@ use std::collections::HashMap; -use crate::kinode::process::{package_name}::{ChatMessage, Request as ChatRequest, Response as ChatResponse, SendRequest}; +use crate::kinode::process::chat::{ChatMessage, Request as ChatRequest, Response as ChatResponse, SendRequest}; use kinode_process_lib::{await_message, call_init, println, Address, Message, Request, Response}; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-{publisher_dotted_kebab}-v0", + world: "chat-template-dot-os-v0", generate_unused_types: true, additional_derives: [serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); @@ -42,7 +42,7 @@ fn handle_message( let _ = Request::new() .target(Address { node: target.clone(), - process: "{package_name}:{package_name}:{publisher}".parse()?, + process: "chat:chat:template.os".parse()?, }) .body(body) .send_and_await_response(5)? diff --git a/src/new/templates/rust/no-ui/chat/metadata.json b/src/new/templates/rust/no-ui/chat/metadata.json index 940b56a7..267211d6 100644 --- a/src/new/templates/rust/no-ui/chat/metadata.json +++ b/src/new/templates/rust/no-ui/chat/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "chat", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "chat", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/rust/no-ui/chat/pkg/manifest.json b/src/new/templates/rust/no-ui/chat/pkg/manifest.json index f71144aa..3da591df 100644 --- a/src/new/templates/rust/no-ui/chat/pkg/manifest.json +++ b/src/new/templates/rust/no-ui/chat/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "chat", + "process_wasm_path": "/chat.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/rust/no-ui/chat/pkg/scripts.json b/src/new/templates/rust/no-ui/chat/pkg/scripts.json index ba63df9e..e89b6733 100644 --- a/src/new/templates/rust/no-ui/chat/pkg/scripts.json +++ b/src/new/templates/rust/no-ui/chat/pkg/scripts.json @@ -4,10 +4,10 @@ "public": false, "request_networking": false, "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "chat:chat:template.os" ], "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "chat:chat:template.os" ] } } diff --git a/src/new/templates/rust/no-ui/chat/send/Cargo.toml_ b/src/new/templates/rust/no-ui/chat/send/Cargo.toml similarity index 95% rename from src/new/templates/rust/no-ui/chat/send/Cargo.toml_ rename to src/new/templates/rust/no-ui/chat/send/Cargo.toml index c208c510..9ed24313 100644 --- a/src/new/templates/rust/no-ui/chat/send/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/chat/send/Cargo.toml @@ -2,6 +2,7 @@ name = "send" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/chat/send/src/lib.rs b/src/new/templates/rust/no-ui/chat/send/src/lib.rs index 0496bf49..e819550a 100644 --- a/src/new/templates/rust/no-ui/chat/send/src/lib.rs +++ b/src/new/templates/rust/no-ui/chat/send/src/lib.rs @@ -1,11 +1,11 @@ -use crate::kinode::process::{package_name}::{Request as ChatRequest, Response as ChatResponse, SendRequest}; +use crate::kinode::process::chat::{Request as ChatRequest, Response as ChatResponse, SendRequest}; use kinode_process_lib::{ await_next_message_body, call_init, println, Address, Message, Request, }; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-{publisher_dotted_kebab}-v0", + world: "chat-template-dot-os-v0", generate_unused_types: true, additional_derives: [serde::Deserialize, serde::Serialize], }); @@ -20,12 +20,12 @@ fn init(our: Address) { let args = String::from_utf8(body).unwrap_or_default(); let Some((target, message)) = args.split_once(" ") else { - println!("usage:\nsend:{package_name}:{publisher} target message"); + println!("usage:\nsend:chat:template.os target message"); return; }; let Ok(Ok(Message::Response { body, .. })) = - Request::to((our.node(), ("{package_name}", "{package_name}", "{publisher}"))) + Request::to((our.node(), ("chat", "chat", "template.os"))) .body( serde_json::to_vec(&ChatRequest::Send(SendRequest { target: target.into(), @@ -35,12 +35,12 @@ fn init(our: Address) { ) .send_and_await_response(5) else { - println!("did not receive expected Response from {package_name}:{package_name}:{publisher}"); + println!("did not receive expected Response from chat:chat:template.os"); return; }; let Ok(ChatResponse::Send) = serde_json::from_slice(&body) else { - println!("did not receive expected Ack from {package_name}:{package_name}:{publisher}"); + println!("did not receive expected Ack from chat:chat:template.os"); return; }; } diff --git a/src/new/templates/rust/no-ui/chat/test/chat_test/Cargo.toml b/src/new/templates/rust/no-ui/chat/test/chat_test/Cargo.toml new file mode 100644 index 00000000..7021d14c --- /dev/null +++ b/src/new/templates/rust/no-ui/chat/test/chat_test/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "chat_test", +] + +[profile.release] +panic = "abort" +opt-level = "s" +lto = true diff --git a/src/new/templates/rust/no-ui/chat/test/chat_test/api/chat_test:template.os-v0.wit b/src/new/templates/rust/no-ui/chat/test/chat_test/api/chat_test:template.os-v0.wit new file mode 100644 index 00000000..c87f01eb --- /dev/null +++ b/src/new/templates/rust/no-ui/chat/test/chat_test/api/chat_test:template.os-v0.wit @@ -0,0 +1,5 @@ +world chat-test-template-dot-os-v0 { + import chat; + import tester; + include process-v0; +} diff --git a/src/new/templates/rust/no-ui/chat/test/chat_test/chat_test/Cargo.toml b/src/new/templates/rust/no-ui/chat/test/chat_test/chat_test/Cargo.toml new file mode 100644 index 00000000..7c5126db --- /dev/null +++ b/src/new/templates/rust/no-ui/chat/test/chat_test/chat_test/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "chat_test" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1.0" +bincode = "1.3" +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" } +process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" } +rmp-serde = "1.1" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +thiserror = "1.0" +wit-bindgen = "0.24.0" + +[lib] +crate-type = ["cdylib"] + +[package.metadata.component] +package = "kinode:process" diff --git a/src/new/templates/rust/no-ui/chat/test/chat_test/chat_test/src/lib.rs b/src/new/templates/rust/no-ui/chat/test/chat_test/chat_test/src/lib.rs new file mode 100644 index 00000000..40e55a74 --- /dev/null +++ b/src/new/templates/rust/no-ui/chat/test/chat_test/chat_test/src/lib.rs @@ -0,0 +1,107 @@ +use crate::kinode::process::chat::{ChatMessage, Request as ChatRequest, Response as ChatResponse, SendRequest}; +use crate::kinode::process::tester::{Request as TesterRequest, Response as TesterResponse, RunRequest, FailResponse}; + +use kinode_process_lib::{await_message, call_init, print_to_terminal, println, Address, ProcessId, Request, Response}; + +mod tester_lib; + +wit_bindgen::generate!({ + path: "target/wit", + world: "chat-test-template-dot-os-v0", + generate_unused_types: true, + additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], +}); + +fn handle_message (our: &Address) -> anyhow::Result<()> { + let message = await_message().unwrap(); + + if !message.is_request() { + unimplemented!(); + } + let source = message.source(); + if our.node != source.node { + return Err(anyhow::anyhow!( + "rejecting foreign Message from {:?}", + source, + )); + } + let TesterRequest::Run(RunRequest { + input_node_names: node_names, + .. + }) = message.body().try_into()?; + print_to_terminal(0, "chat_test: a"); + assert!(node_names.len() >= 2); + if our.node != node_names[0] { + // we are not master node: return + Response::new() + .body(TesterResponse::Run(Ok(()))) + .send() + .unwrap(); + return Ok(()); + } + + // we are master node + + let our_chat_address = Address { + node: our.node.clone(), + process: ProcessId::new(Some("chat"), "chat", "template.os"), + }; + let their_chat_address = Address { + node: node_names[1].clone(), + process: ProcessId::new(Some("chat"), "chat", "template.os"), + }; + + // Send + print_to_terminal(0, "chat_test: b"); + let message: String = "hello".into(); + let _ = Request::new() + .target(our_chat_address.clone()) + .body(ChatRequest::Send(SendRequest { + target: node_names[1].clone(), + message: message.clone(), + })) + .send_and_await_response(15)?.unwrap(); + + // Get history from receiver & test + print_to_terminal(0, "chat_test: c"); + let response = Request::new() + .target(their_chat_address.clone()) + .body(ChatRequest::History(our.node.clone())) + .send_and_await_response(15)?.unwrap(); + if response.is_request() { fail!("chat_test"); }; + let ChatResponse::History(messages) = response.body().try_into()? else { + fail!("chat_test"); + }; + let expected_messages = vec![ChatMessage { + author: our.node.clone(), + content: message, + }]; + + if messages != expected_messages { + println!("{messages:?} != {expected_messages:?}"); + fail!("chat_test"); + } + + Response::new() + .body(TesterResponse::Run(Ok(()))) + .send() + .unwrap(); + + Ok(()) +} + +call_init!(init); +fn init(our: Address) { + print_to_terminal(0, "begin"); + + loop { + match handle_message(&our) { + Ok(()) => {}, + Err(e) => { + print_to_terminal(0, format!("chat_test: error: {e:?}").as_str()); + + fail!("chat_test"); + }, + }; + } +} diff --git a/src/new/templates/rust/no-ui/chat/test/chat_test/chat_test/src/tester_lib.rs b/src/new/templates/rust/no-ui/chat/test/chat_test/chat_test/src/tester_lib.rs new file mode 100644 index 00000000..8fb7ae19 --- /dev/null +++ b/src/new/templates/rust/no-ui/chat/test/chat_test/chat_test/src/tester_lib.rs @@ -0,0 +1,30 @@ +#[allow(unused_imports)] +use crate::kinode::process::tester::{FailResponse, Response as TesterResponse}; + +#[macro_export] +macro_rules! fail { + ($test:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: file!().into(), + line: line!(), + column: column!(), + }))) + .send() + .unwrap(); + panic!("") + }; + ($test:expr, $file:expr, $line:expr, $column:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: $file.into(), + line: $line, + column: $column, + }))) + .send() + .unwrap(); + panic!("") + }; +} diff --git a/src/new/templates/rust/no-ui/chat/test/chat_test/metadata.json b/src/new/templates/rust/no-ui/chat/test/chat_test/metadata.json new file mode 100644 index 00000000..8161d7d6 --- /dev/null +++ b/src/new/templates/rust/no-ui/chat/test/chat_test/metadata.json @@ -0,0 +1,21 @@ +{ + "name": "chat Test", + "description": "A test for chat.", + "image": "", + "properties": { + "package_name": "chat_test", + "current_version": "0.1.0", + "publisher": "template.os", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + }, + "wit_version": 0, + "dependencies": [ + "chat:template.os", + "tester:sys" + ] + }, + "external_url": "", + "animation_url": "" +} diff --git a/src/new/templates/rust/no-ui/chat/test/chat_test/pkg/manifest.json b/src/new/templates/rust/no-ui/chat/test/chat_test/pkg/manifest.json new file mode 100644 index 00000000..b6c7f2ab --- /dev/null +++ b/src/new/templates/rust/no-ui/chat/test/chat_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "chat_test", + "process_wasm_path": "/chat_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "chat:chat:template.os" + ], + "grant_capabilities": [ + "chat:chat:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/rust/no-ui/chat/test/tests.toml b/src/new/templates/rust/no-ui/chat/test/tests.toml new file mode 100644 index 00000000..36aa5241 --- /dev/null +++ b/src/new/templates/rust/no-ui/chat/test/tests.toml @@ -0,0 +1,28 @@ +runtime = { FetchVersion = "latest" } +# runtime = { RepoPath = "~/git/kinode" } +persist_home = false +runtime_build_release = false + + +[[tests]] +dependency_package_paths = [".."] +setup_packages = [ + { path = "..", run = true } +] +setup_scripts = [] +test_package_paths = ["chat_test"] +test_scripts = [] +timeout_secs = 5 +fakechain_router = 8545 + +[[tests.nodes]] +port = 8080 +home = "home/first" +fake_node_name = "first.dev" +runtime_verbosity = 2 + +[[tests.nodes]] +port = 8081 +home = "home/second" +fake_node_name = "second.dev" +runtime_verbosity = 2 diff --git a/src/new/templates/rust/no-ui/echo/Cargo.toml b/src/new/templates/rust/no-ui/echo/Cargo.toml new file mode 100644 index 00000000..c645c207 --- /dev/null +++ b/src/new/templates/rust/no-ui/echo/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "echo", +] + +[profile.release] +panic = "abort" +opt-level = "s" +lto = true diff --git a/src/new/templates/rust/no-ui/fibonacci/{package_name}/Cargo.toml_ b/src/new/templates/rust/no-ui/echo/echo/Cargo.toml similarity index 93% rename from src/new/templates/rust/no-ui/fibonacci/{package_name}/Cargo.toml_ rename to src/new/templates/rust/no-ui/echo/echo/Cargo.toml index e4c3c320..887c131f 100644 --- a/src/new/templates/rust/no-ui/fibonacci/{package_name}/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/echo/echo/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "{package_name}" +name = "echo" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/echo/{package_name}/src/lib.rs b/src/new/templates/rust/no-ui/echo/echo/src/lib.rs similarity index 100% rename from src/new/templates/rust/no-ui/echo/{package_name}/src/lib.rs rename to src/new/templates/rust/no-ui/echo/echo/src/lib.rs diff --git a/src/new/templates/rust/no-ui/echo/metadata.json b/src/new/templates/rust/no-ui/echo/metadata.json index 940b56a7..1c6395fe 100644 --- a/src/new/templates/rust/no-ui/echo/metadata.json +++ b/src/new/templates/rust/no-ui/echo/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "echo", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "echo", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/rust/no-ui/echo/pkg/manifest.json b/src/new/templates/rust/no-ui/echo/pkg/manifest.json index f71144aa..7fc7826e 100644 --- a/src/new/templates/rust/no-ui/echo/pkg/manifest.json +++ b/src/new/templates/rust/no-ui/echo/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "echo", + "process_wasm_path": "/echo.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/rust/no-ui/echo/test/echo_test/Cargo.toml b/src/new/templates/rust/no-ui/echo/test/echo_test/Cargo.toml new file mode 100644 index 00000000..08be60d0 --- /dev/null +++ b/src/new/templates/rust/no-ui/echo/test/echo_test/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "echo_test", +] + +[profile.release] +panic = "abort" +opt-level = "s" +lto = true diff --git a/src/new/templates/rust/no-ui/echo/test/echo_test/api/echo_test:template.os-v0.wit b/src/new/templates/rust/no-ui/echo/test/echo_test/api/echo_test:template.os-v0.wit new file mode 100644 index 00000000..c4b22457 --- /dev/null +++ b/src/new/templates/rust/no-ui/echo/test/echo_test/api/echo_test:template.os-v0.wit @@ -0,0 +1,4 @@ +world echo-test-template-dot-os-v0 { + import tester; + include process-v0; +} diff --git a/src/new/templates/rust/no-ui/echo/test/echo_test/echo_test/Cargo.toml b/src/new/templates/rust/no-ui/echo/test/echo_test/echo_test/Cargo.toml new file mode 100644 index 00000000..f0207b23 --- /dev/null +++ b/src/new/templates/rust/no-ui/echo/test/echo_test/echo_test/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "echo_test" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1.0" +bincode = "1.3" +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" } +process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" } +rmp-serde = "1.1" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +thiserror = "1.0" +wit-bindgen = "0.24.0" + +[lib] +crate-type = ["cdylib"] + +[package.metadata.component] +package = "kinode:process" diff --git a/src/new/templates/rust/no-ui/echo/test/echo_test/echo_test/src/lib.rs b/src/new/templates/rust/no-ui/echo/test/echo_test/echo_test/src/lib.rs new file mode 100644 index 00000000..e1362078 --- /dev/null +++ b/src/new/templates/rust/no-ui/echo/test/echo_test/echo_test/src/lib.rs @@ -0,0 +1,79 @@ +use crate::kinode::process::tester::{ + FailResponse, Request as TesterRequest, Response as TesterResponse, RunRequest, +}; + +use kinode_process_lib::{ + await_message, call_init, print_to_terminal, Address, ProcessId, Request, Response, +}; + +mod tester_lib; + +wit_bindgen::generate!({ + path: "target/wit", + world: "echo-test-template-dot-os-v0", + generate_unused_types: true, + additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], +}); + +fn handle_message(our: &Address) -> anyhow::Result<()> { + let message = await_message().unwrap(); + + if !message.is_request() { + unimplemented!(); + } + let source = message.source(); + if our.node != source.node { + return Err(anyhow::anyhow!( + "rejecting foreign Message from {:?}", + source, + )); + } + let TesterRequest::Run(RunRequest { + input_node_names: node_names, + .. + }) = message.body().try_into()?; + print_to_terminal(0, "echo_test: a"); + assert!(node_names.len() == 1); + + let our_echo_address = Address { + node: our.node.clone(), + process: ProcessId::new(Some("echo"), "echo", "template.os"), + }; + + // Send + print_to_terminal(0, "echo_test: b"); + let response = Request::new() + .target(our_echo_address) + .body(serde_json::to_vec("test")?) + .send_and_await_response(15)? + .unwrap(); + if response.is_request() { + fail!("echo_test"); + }; + if serde_json::json!("Ack") != serde_json::from_slice::(response.body())? { + fail!("echo_test"); + }; + + Response::new() + .body(TesterResponse::Run(Ok(()))) + .send() + .unwrap(); + + Ok(()) +} + +call_init!(init); +fn init(our: Address) { + print_to_terminal(0, "begin"); + + loop { + match handle_message(&our) { + Ok(()) => {} + Err(e) => { + print_to_terminal(0, format!("echo_test: error: {e:?}").as_str()); + + fail!("echo_test"); + } + }; + } +} diff --git a/src/new/templates/rust/no-ui/echo/test/echo_test/echo_test/src/tester_lib.rs b/src/new/templates/rust/no-ui/echo/test/echo_test/echo_test/src/tester_lib.rs new file mode 100644 index 00000000..8fb7ae19 --- /dev/null +++ b/src/new/templates/rust/no-ui/echo/test/echo_test/echo_test/src/tester_lib.rs @@ -0,0 +1,30 @@ +#[allow(unused_imports)] +use crate::kinode::process::tester::{FailResponse, Response as TesterResponse}; + +#[macro_export] +macro_rules! fail { + ($test:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: file!().into(), + line: line!(), + column: column!(), + }))) + .send() + .unwrap(); + panic!("") + }; + ($test:expr, $file:expr, $line:expr, $column:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: $file.into(), + line: $line, + column: $column, + }))) + .send() + .unwrap(); + panic!("") + }; +} diff --git a/src/new/templates/rust/no-ui/echo/test/echo_test/metadata.json b/src/new/templates/rust/no-ui/echo/test/echo_test/metadata.json new file mode 100644 index 00000000..11c67227 --- /dev/null +++ b/src/new/templates/rust/no-ui/echo/test/echo_test/metadata.json @@ -0,0 +1,20 @@ +{ + "name": "echo Test", + "description": "A test for echo.", + "image": "", + "properties": { + "package_name": "echo_test", + "current_version": "0.1.0", + "publisher": "template.os", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + }, + "wit_version": 0, + "dependencies": [ + "tester:sys" + ] + }, + "external_url": "", + "animation_url": "" +} diff --git a/src/new/templates/rust/no-ui/echo/test/echo_test/pkg/manifest.json b/src/new/templates/rust/no-ui/echo/test/echo_test/pkg/manifest.json new file mode 100644 index 00000000..5448a0b4 --- /dev/null +++ b/src/new/templates/rust/no-ui/echo/test/echo_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "echo_test", + "process_wasm_path": "/echo_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "echo:echo:template.os" + ], + "grant_capabilities": [ + "echo:echo:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/rust/no-ui/echo/test/tests.toml b/src/new/templates/rust/no-ui/echo/test/tests.toml new file mode 100644 index 00000000..f7b06e8f --- /dev/null +++ b/src/new/templates/rust/no-ui/echo/test/tests.toml @@ -0,0 +1,22 @@ +runtime = { FetchVersion = "latest" } +# runtime = { RepoPath = "~/git/kinode" } +persist_home = false +runtime_build_release = false + + +[[tests]] +dependency_package_paths = [] +setup_packages = [ + { path = "..", run = true } +] +setup_scripts = [] +test_package_paths = ["echo_test"] +test_scripts = [] +timeout_secs = 5 +fakechain_router = 8545 + +[[tests.nodes]] +port = 8080 +home = "home/first" +fake_node_name = "first.dev" +runtime_verbosity = 2 diff --git a/src/new/templates/rust/no-ui/fibonacci/Cargo.toml_ b/src/new/templates/rust/no-ui/fibonacci/Cargo.toml similarity index 84% rename from src/new/templates/rust/no-ui/fibonacci/Cargo.toml_ rename to src/new/templates/rust/no-ui/fibonacci/Cargo.toml index ff34e3e1..0302299b 100644 --- a/src/new/templates/rust/no-ui/fibonacci/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/fibonacci/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = [ - "{package_name}", + "fibonacci", "number", ] diff --git a/src/new/templates/rust/no-ui/fibonacci/api/{package_name}:{publisher}-v0.wit b/src/new/templates/rust/no-ui/fibonacci/api/fibonacci:template.os-v0.wit similarity index 61% rename from src/new/templates/rust/no-ui/fibonacci/api/{package_name}:{publisher}-v0.wit rename to src/new/templates/rust/no-ui/fibonacci/api/fibonacci:template.os-v0.wit index 73615f3f..c1bf5012 100644 --- a/src/new/templates/rust/no-ui/fibonacci/api/{package_name}:{publisher}-v0.wit +++ b/src/new/templates/rust/no-ui/fibonacci/api/fibonacci:template.os-v0.wit @@ -1,4 +1,4 @@ -interface {package_name_kebab} { +interface fibonacci { variant request { number(u32), numbers(tuple), @@ -10,7 +10,7 @@ interface {package_name_kebab} { } } -world {package_name_kebab}-{publisher_dotted_kebab}-v0 { - import {package_name_kebab}; +world fibonacci-template-dot-os-v0 { + import fibonacci; include process-v0; } diff --git a/src/new/templates/rust/no-ui/echo/{package_name}/Cargo.toml_ b/src/new/templates/rust/no-ui/fibonacci/fibonacci/Cargo.toml similarity index 92% rename from src/new/templates/rust/no-ui/echo/{package_name}/Cargo.toml_ rename to src/new/templates/rust/no-ui/fibonacci/fibonacci/Cargo.toml index e4c3c320..c1cbf336 100644 --- a/src/new/templates/rust/no-ui/echo/{package_name}/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/fibonacci/fibonacci/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "{package_name}" +name = "fibonacci" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/fibonacci/{package_name}/src/lib.rs b/src/new/templates/rust/no-ui/fibonacci/fibonacci/src/lib.rs similarity index 94% rename from src/new/templates/rust/no-ui/fibonacci/{package_name}/src/lib.rs rename to src/new/templates/rust/no-ui/fibonacci/fibonacci/src/lib.rs index 17cd1cac..80f84091 100644 --- a/src/new/templates/rust/no-ui/fibonacci/{package_name}/src/lib.rs +++ b/src/new/templates/rust/no-ui/fibonacci/fibonacci/src/lib.rs @@ -1,9 +1,9 @@ -use crate::kinode::process::{package_name}::{Request as FibonacciRequest, Response as FibonacciResponse}; +use crate::kinode::process::fibonacci::{Request as FibonacciRequest, Response as FibonacciResponse}; use kinode_process_lib::{await_message, call_init, println, Address, Message, Response}; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-{publisher_dotted_kebab}-v0", + world: "fibonacci-template-dot-os-v0", generate_unused_types: true, additional_derives: [serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); diff --git a/src/new/templates/rust/no-ui/fibonacci/metadata.json b/src/new/templates/rust/no-ui/fibonacci/metadata.json index 940b56a7..7f1b5264 100644 --- a/src/new/templates/rust/no-ui/fibonacci/metadata.json +++ b/src/new/templates/rust/no-ui/fibonacci/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "fibonacci", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "fibonacci", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/rust/no-ui/fibonacci/number/Cargo.toml_ b/src/new/templates/rust/no-ui/fibonacci/number/Cargo.toml similarity index 95% rename from src/new/templates/rust/no-ui/fibonacci/number/Cargo.toml_ rename to src/new/templates/rust/no-ui/fibonacci/number/Cargo.toml index a7313dd9..e51908c2 100644 --- a/src/new/templates/rust/no-ui/fibonacci/number/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/fibonacci/number/Cargo.toml @@ -2,6 +2,7 @@ name = "number" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/fibonacci/number/src/lib.rs b/src/new/templates/rust/no-ui/fibonacci/number/src/lib.rs index 324f5cdf..b5ea141f 100644 --- a/src/new/templates/rust/no-ui/fibonacci/number/src/lib.rs +++ b/src/new/templates/rust/no-ui/fibonacci/number/src/lib.rs @@ -1,11 +1,11 @@ -use crate::kinode::process::{package_name}::{Request as FibonacciRequest, Response as FibonacciResponse}; +use crate::kinode::process::fibonacci::{Request as FibonacciRequest, Response as FibonacciResponse}; use kinode_process_lib::{ await_next_message_body, call_init, println, Address, Message, Request, }; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-{publisher_dotted_kebab}-v0", + world: "fibonacci-template-dot-os-v0", generate_unused_types: true, additional_derives: [serde::Deserialize, serde::Serialize], }); @@ -23,16 +23,16 @@ fn init(our: Address) { .unwrap_or_default(); let Ok(Ok(Message::Response { body, .. })) = - Request::to((our.node(), ("{package_name}", "{package_name}", "{publisher}"))) + Request::to((our.node(), ("fibonacci", "fibonacci", "template.os"))) .body(serde_json::to_vec(&FibonacciRequest::Number(number)).unwrap()) .send_and_await_response(5) else { - println!("did not receive expected Response from {package_name}:{package_name}:{publisher}"); + println!("did not receive expected Response from fibonacci:fibonacci:template.os"); return; }; let Ok(FibonacciResponse::Number(_number)) = serde_json::from_slice(&body) else { - println!("did not receive expected Ack from {package_name}:{package_name}:{publisher}"); + println!("did not receive expected Ack from fibonacci:fibonacci:template.os"); return; }; diff --git a/src/new/templates/rust/no-ui/fibonacci/pkg/manifest.json b/src/new/templates/rust/no-ui/fibonacci/pkg/manifest.json index f71144aa..b621d87d 100644 --- a/src/new/templates/rust/no-ui/fibonacci/pkg/manifest.json +++ b/src/new/templates/rust/no-ui/fibonacci/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "fibonacci", + "process_wasm_path": "/fibonacci.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/rust/no-ui/fibonacci/pkg/scripts.json b/src/new/templates/rust/no-ui/fibonacci/pkg/scripts.json index 7ecc1275..521fcac8 100644 --- a/src/new/templates/rust/no-ui/fibonacci/pkg/scripts.json +++ b/src/new/templates/rust/no-ui/fibonacci/pkg/scripts.json @@ -4,10 +4,10 @@ "public": false, "request_networking": false, "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "fibonacci:fibonacci:template.os" ], "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "fibonacci:fibonacci:template.os" ] } } diff --git a/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/Cargo.toml b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/Cargo.toml new file mode 100644 index 00000000..a743c053 --- /dev/null +++ b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "fibonacci_test", +] + +[profile.release] +panic = "abort" +opt-level = "s" +lto = true diff --git a/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/api/fibonacci_test:template.os-v0.wit b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/api/fibonacci_test:template.os-v0.wit new file mode 100644 index 00000000..bef06257 --- /dev/null +++ b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/api/fibonacci_test:template.os-v0.wit @@ -0,0 +1,5 @@ +world fibonacci-test-template-dot-os-v0 { + import fibonacci; + import tester; + include process-v0; +} diff --git a/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/Cargo.toml b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/Cargo.toml new file mode 100644 index 00000000..5485e2e1 --- /dev/null +++ b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "fibonacci_test" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1.0" +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" } +process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +wit-bindgen = "0.24.0" + +[lib] +crate-type = ["cdylib"] + +[package.metadata.component] +package = "kinode:process" diff --git a/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/lib.rs b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/lib.rs new file mode 100644 index 00000000..60fef67c --- /dev/null +++ b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/lib.rs @@ -0,0 +1,104 @@ +use crate::kinode::process::fibonacci::{Request as FibRequest, Response as FibResponse}; +use crate::kinode::process::tester::{Request as TesterRequest, Response as TesterResponse, RunRequest, FailResponse}; + +use kinode_process_lib::{await_message, call_init, print_to_terminal, Address, ProcessId, Request, Response}; + +mod tester_lib; + +wit_bindgen::generate!({ + path: "target/wit", + world: "fibonacci-test-template-dot-os-v0", + generate_unused_types: true, + additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], +}); + +fn test_number(n: u32, address: &Address) -> anyhow::Result { + let response = Request::new() + .target(address) + .body(FibRequest::Number(n)) + .send_and_await_response(15)?.unwrap(); + if response.is_request() { fail!("fibonacci_test"); }; + let FibResponse::Number(fib_number) = response.body().try_into()? else { + fail!("fibonacci_test"); + }; + Ok(fib_number) +} + +fn test_numbers(n: u32, n_trials: u32, address: &Address) -> anyhow::Result { + let response = Request::new() + .target(address) + .body(FibRequest::Numbers((n, n_trials))) + .send_and_await_response(15)?.unwrap(); + if response.is_request() { fail!("fibonacci_test"); }; + let FibResponse::Numbers((fib_number, _)) = response.body().try_into()? else { + fail!("fibonacci_test"); + }; + Ok(fib_number) +} + +fn handle_message (our: &Address) -> anyhow::Result<()> { + let message = await_message().unwrap(); + + if !message.is_request() { + unimplemented!(); + } + let source = message.source(); + if our.node != source.node { + return Err(anyhow::anyhow!( + "rejecting foreign Message from {:?}", + source, + )); + } + let TesterRequest::Run(RunRequest { + input_node_names: node_names, + .. + }) = message.body().try_into()?; + print_to_terminal(0, "fibonacci_test: a"); + assert!(node_names.len() == 1); + + let our_fib_address = Address { + node: our.node.clone(), + process: ProcessId::new(Some("fibonacci"), "fibonacci", "template.os"), + }; + + let numbers = vec![0, 1, 2, 5, 10, 20, 30, 47]; + let expecteds = vec![0, 1, 1, 5, 55, 6_765, 832_040, 2_971_215_073]; + for (number, expected) in numbers.iter().zip(expecteds.iter()) { + let result = test_number(number.clone(), &our_fib_address)?; + if &result != expected { + fail!("fibonacci_test"); + } + } + + let numbers = vec![0, 1, 2, 5, 10, 20, 30, 47]; + let expecteds = vec![0, 1, 1, 5, 55, 6_765, 832_040, 2_971_215_073]; + for (number, expected) in numbers.iter().zip(expecteds.iter()) { + let result = test_numbers(number.clone(), 5, &our_fib_address)?; + if &result != expected { + fail!("fibonacci_test"); + } + } + + Response::new() + .body(TesterResponse::Run(Ok(()))) + .send() + .unwrap(); + + Ok(()) +} + +call_init!(init); +fn init(our: Address) { + print_to_terminal(0, "begin"); + + loop { + match handle_message(&our) { + Ok(()) => {}, + Err(e) => { + print_to_terminal(0, format!("fibonacci_test: error: {e:?}").as_str()); + + fail!("fibonacci_test"); + }, + }; + } +} diff --git a/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/tester_lib.rs b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/tester_lib.rs new file mode 100644 index 00000000..8fb7ae19 --- /dev/null +++ b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/fibonacci_test/src/tester_lib.rs @@ -0,0 +1,30 @@ +#[allow(unused_imports)] +use crate::kinode::process::tester::{FailResponse, Response as TesterResponse}; + +#[macro_export] +macro_rules! fail { + ($test:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: file!().into(), + line: line!(), + column: column!(), + }))) + .send() + .unwrap(); + panic!("") + }; + ($test:expr, $file:expr, $line:expr, $column:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: $file.into(), + line: $line, + column: $column, + }))) + .send() + .unwrap(); + panic!("") + }; +} diff --git a/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/metadata.json b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/metadata.json new file mode 100644 index 00000000..daeaff69 --- /dev/null +++ b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/metadata.json @@ -0,0 +1,21 @@ +{ + "name": "fibonacci Test", + "description": "A test for fibonacci.", + "image": "", + "properties": { + "package_name": "fibonacci_test", + "current_version": "0.1.0", + "publisher": "template.os", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + }, + "wit_version": 0, + "dependencies": [ + "fibonacci:template.os", + "tester:sys" + ] + }, + "external_url": "", + "animation_url": "" +} diff --git a/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/pkg/manifest.json b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/pkg/manifest.json new file mode 100644 index 00000000..2e0253aa --- /dev/null +++ b/src/new/templates/rust/no-ui/fibonacci/test/fibonacci_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "fibonacci_test", + "process_wasm_path": "/fibonacci_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "fibonacci:fibonacci:template.os" + ], + "grant_capabilities": [ + "fibonacci:fibonacci:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/rust/no-ui/fibonacci/test/tests.toml b/src/new/templates/rust/no-ui/fibonacci/test/tests.toml new file mode 100644 index 00000000..b851fba3 --- /dev/null +++ b/src/new/templates/rust/no-ui/fibonacci/test/tests.toml @@ -0,0 +1,22 @@ +runtime = { FetchVersion = "latest" } +# runtime = { RepoPath = "~/git/kinode" } +persist_home = false +runtime_build_release = false + + +[[tests]] +dependency_package_paths = [".."] +setup_packages = [ + { path = "..", run = true } +] +setup_scripts = [] +test_package_paths = ["fibonacci_test"] +test_scripts = [] +timeout_secs = 5 +fakechain_router = 8545 + +[[tests.nodes]] +port = 8080 +home = "home/first" +fake_node_name = "first.dev" +runtime_verbosity = 2 diff --git a/src/new/templates/rust/no-ui/file_transfer/Cargo.toml_ b/src/new/templates/rust/no-ui/file_transfer/Cargo.toml similarity index 89% rename from src/new/templates/rust/no-ui/file_transfer/Cargo.toml_ rename to src/new/templates/rust/no-ui/file_transfer/Cargo.toml index 0a734fee..918afe14 100644 --- a/src/new/templates/rust/no-ui/file_transfer/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/file_transfer/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = [ - "{package_name}", + "file_transfer", "file_transfer_worker_api", "file_transfer_worker", "download", diff --git a/src/new/templates/rust/no-ui/file_transfer/api/{package_name}:{publisher}-v0.wit b/src/new/templates/rust/no-ui/file_transfer/api/file_transfer:template.os-v0.wit similarity index 93% rename from src/new/templates/rust/no-ui/file_transfer/api/{package_name}:{publisher}-v0.wit rename to src/new/templates/rust/no-ui/file_transfer/api/file_transfer:template.os-v0.wit index e0e1a9d1..3f5a3ed2 100644 --- a/src/new/templates/rust/no-ui/file_transfer/api/{package_name}:{publisher}-v0.wit +++ b/src/new/templates/rust/no-ui/file_transfer/api/file_transfer:template.os-v0.wit @@ -1,4 +1,4 @@ -interface {package_name_kebab} { +interface file-transfer { variant request { list-files, } @@ -72,8 +72,8 @@ world file-transfer-worker-api-v0 { export file-transfer-worker; } -world {package_name_kebab}-{publisher_dotted_kebab}-v0 { - import {package_name_kebab}; +world file-transfer-template-dot-os-v0 { + import file-transfer; import file-transfer-worker; include process-v0; } diff --git a/src/new/templates/rust/no-ui/file_transfer/download/Cargo.toml_ b/src/new/templates/rust/no-ui/file_transfer/download/Cargo.toml similarity index 96% rename from src/new/templates/rust/no-ui/file_transfer/download/Cargo.toml_ rename to src/new/templates/rust/no-ui/file_transfer/download/Cargo.toml index 32567295..f542889a 100644 --- a/src/new/templates/rust/no-ui/file_transfer/download/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/file_transfer/download/Cargo.toml @@ -2,6 +2,7 @@ name = "download" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/file_transfer/download/src/lib.rs b/src/new/templates/rust/no-ui/file_transfer/download/src/lib.rs index b728e452..5ce579d4 100644 --- a/src/new/templates/rust/no-ui/file_transfer/download/src/lib.rs +++ b/src/new/templates/rust/no-ui/file_transfer/download/src/lib.rs @@ -6,7 +6,7 @@ use kinode_process_lib::{ wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-{publisher_dotted_kebab}-v0", + world: "file-transfer-template-dot-os-v0", generate_unused_types: true, additional_derives: [serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); @@ -39,14 +39,14 @@ fn init(our: Address) { let args = String::from_utf8(body).unwrap_or_default(); let Some((name, who)) = args.split_once(" ") else { - println!("usage: download:{package_name}:{publisher} file_name who"); + println!("usage: download:file_transfer:template.os file_name who"); return; }; - let our: Address = format!("{}@{package_name}:{package_name}:{publisher}", our.node()) + let our: Address = format!("{}@file_transfer:file_transfer:template.os", our.node()) .parse() .unwrap(); - let target: Address = format!("{}@{package_name}:{package_name}:{publisher}", who) + let target: Address = format!("{}@file_transfer:file_transfer:template.os", who) .parse() .unwrap(); diff --git a/src/new/templates/rust/no-ui/chat/{package_name}/Cargo.toml_ b/src/new/templates/rust/no-ui/file_transfer/file_transfer/Cargo.toml similarity index 91% rename from src/new/templates/rust/no-ui/chat/{package_name}/Cargo.toml_ rename to src/new/templates/rust/no-ui/file_transfer/file_transfer/Cargo.toml index eff3bb6a..745330e6 100644 --- a/src/new/templates/rust/no-ui/chat/{package_name}/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/file_transfer/file_transfer/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "{package_name}" +name = "file_transfer" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/file_transfer/{package_name}/src/lib.rs b/src/new/templates/rust/no-ui/file_transfer/file_transfer/src/lib.rs similarity index 96% rename from src/new/templates/rust/no-ui/file_transfer/{package_name}/src/lib.rs rename to src/new/templates/rust/no-ui/file_transfer/file_transfer/src/lib.rs index 1f3c7879..155dfcbb 100644 --- a/src/new/templates/rust/no-ui/file_transfer/{package_name}/src/lib.rs +++ b/src/new/templates/rust/no-ui/file_transfer/file_transfer/src/lib.rs @@ -1,6 +1,6 @@ use crate::kinode::process::standard::{Address as WitAddress, ProcessId as WitProcessId}; use crate::kinode::process::file_transfer_worker::{start_download, Request as WorkerRequest, Response as WorkerResponse, DownloadRequest, ProgressRequest}; -use crate::kinode::process::{package_name}::{Request as TransferRequest, Response as TransferResponse, FileInfo}; +use crate::kinode::process::file_transfer::{Request as TransferRequest, Response as TransferResponse, FileInfo}; use kinode_process_lib::{ await_message, call_init, println, vfs::{create_drive, metadata, open_dir, Directory, FileType}, @@ -9,7 +9,7 @@ use kinode_process_lib::{ wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-{publisher_dotted_kebab}-v0", + world: "file-transfer-template-dot-os-v0", generate_unused_types: true, additional_derives: [serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); diff --git a/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/Cargo.toml_ b/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/Cargo.toml similarity index 96% rename from src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/Cargo.toml_ rename to src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/Cargo.toml index ec9836f6..3df989c0 100644 --- a/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/Cargo.toml @@ -2,6 +2,7 @@ name = "file_transfer_worker" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/src/lib.rs b/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/src/lib.rs index f5dc1ed9..9a918630 100644 --- a/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/src/lib.rs +++ b/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker/src/lib.rs @@ -11,7 +11,7 @@ use kinode_process_lib::{ wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-{publisher_dotted_kebab}-v0", + world: "file-transfer-template-dot-os-v0", generate_unused_types: true, additional_derives: [serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); diff --git a/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker_api/Cargo.toml_ b/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker_api/Cargo.toml similarity index 96% rename from src/new/templates/rust/no-ui/file_transfer/file_transfer_worker_api/Cargo.toml_ rename to src/new/templates/rust/no-ui/file_transfer/file_transfer_worker_api/Cargo.toml index 2e75c860..86d3aee3 100644 --- a/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker_api/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/file_transfer/file_transfer_worker_api/Cargo.toml @@ -2,6 +2,7 @@ name = "file_transfer_worker_api" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/file_transfer/list_files/Cargo.toml_ b/src/new/templates/rust/no-ui/file_transfer/list_files/Cargo.toml similarity index 96% rename from src/new/templates/rust/no-ui/file_transfer/list_files/Cargo.toml_ rename to src/new/templates/rust/no-ui/file_transfer/list_files/Cargo.toml index 6c6ca8fb..2f5f70c0 100644 --- a/src/new/templates/rust/no-ui/file_transfer/list_files/Cargo.toml_ +++ b/src/new/templates/rust/no-ui/file_transfer/list_files/Cargo.toml @@ -2,6 +2,7 @@ name = "list_files" version = "0.1.0" edition = "2021" +publish = false [dependencies] anyhow = "1.0" diff --git a/src/new/templates/rust/no-ui/file_transfer/list_files/src/lib.rs b/src/new/templates/rust/no-ui/file_transfer/list_files/src/lib.rs index 81ce611e..6f14cbc5 100644 --- a/src/new/templates/rust/no-ui/file_transfer/list_files/src/lib.rs +++ b/src/new/templates/rust/no-ui/file_transfer/list_files/src/lib.rs @@ -1,11 +1,11 @@ -use crate::kinode::process::{package_name}::{Request as TransferRequest, Response as TransferResponse}; +use crate::kinode::process::file_transfer::{Request as TransferRequest, Response as TransferResponse}; use kinode_process_lib::{ await_next_message_body, call_init, println, Address, Message, Request, }; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-{publisher_dotted_kebab}-v0", + world: "file-transfer-template-dot-os-v0", generate_unused_types: true, additional_derives: [serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); @@ -19,11 +19,11 @@ fn init(_our: Address) { let who = String::from_utf8(body).unwrap_or_default(); if who.is_empty() { - println!("usage: list_files:{package_name}:{publisher} who"); + println!("usage: list_files:file_transfer:template.os who"); return; } - let target: Address = format!("{}@{package_name}:{package_name}:{publisher}", who) + let target: Address = format!("{}@file_transfer:file_transfer:template.os", who) .parse() .unwrap(); diff --git a/src/new/templates/rust/no-ui/file_transfer/metadata.json b/src/new/templates/rust/no-ui/file_transfer/metadata.json index 259d2a1e..ce2ffac6 100644 --- a/src/new/templates/rust/no-ui/file_transfer/metadata.json +++ b/src/new/templates/rust/no-ui/file_transfer/metadata.json @@ -1,18 +1,18 @@ { - "name": "{package_name}", + "name": "file_transfer", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "file_transfer", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" }, "wit_version": 0, "dependencies": [ - "{package_name}:{publisher}" + "file_transfer:template.os" ] }, "external_url": "", diff --git a/src/new/templates/rust/no-ui/file_transfer/pkg/manifest.json b/src/new/templates/rust/no-ui/file_transfer/pkg/manifest.json index 44c7d1e8..c6a3c81a 100644 --- a/src/new/templates/rust/no-ui/file_transfer/pkg/manifest.json +++ b/src/new/templates/rust/no-ui/file_transfer/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "file_transfer", + "process_wasm_path": "/file_transfer.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/rust/no-ui/file_transfer/pkg/scripts.json b/src/new/templates/rust/no-ui/file_transfer/pkg/scripts.json index 5b67bc76..381b699e 100644 --- a/src/new/templates/rust/no-ui/file_transfer/pkg/scripts.json +++ b/src/new/templates/rust/no-ui/file_transfer/pkg/scripts.json @@ -4,10 +4,10 @@ "public": false, "request_networking": false, "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "file_transfer:file_transfer:template.os" ], "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "file_transfer:file_transfer:template.os" ], "wit_version": 0 }, @@ -16,10 +16,10 @@ "public": false, "request_networking": true, "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "file_transfer:file_transfer:template.os" ], "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" + "file_transfer:file_transfer:template.os" ], "wit_version": 0 } diff --git a/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/Cargo.toml b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/Cargo.toml new file mode 100644 index 00000000..b2063929 --- /dev/null +++ b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "file_transfer_test", +] + +[profile.release] +panic = "abort" +opt-level = "s" +lto = true diff --git a/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/api/file_transfer_test:template.os-v0.wit b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/api/file_transfer_test:template.os-v0.wit new file mode 100644 index 00000000..99b62ce1 --- /dev/null +++ b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/api/file_transfer_test:template.os-v0.wit @@ -0,0 +1,5 @@ +world file-transfer-test-template-dot-os-v0 { + import file-transfer; + import tester; + include process-v0; +} diff --git a/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/file_transfer_test/Cargo.toml b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/file_transfer_test/Cargo.toml new file mode 100644 index 00000000..ba4cc936 --- /dev/null +++ b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/file_transfer_test/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "file_transfer_test" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1.0" +bincode = "1.3" +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" } +process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" } +rmp-serde = "1.1" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +thiserror = "1.0" +wit-bindgen = "0.24.0" + +[lib] +crate-type = ["cdylib"] + +[package.metadata.component] +package = "kinode:process" diff --git a/src/new/templates/test/file_transfer/{package_name}_test/{package_name}_test/src/lib.rs b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/file_transfer_test/src/lib.rs similarity index 75% rename from src/new/templates/test/file_transfer/{package_name}_test/{package_name}_test/src/lib.rs rename to src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/file_transfer_test/src/lib.rs index c8672e78..a8f8c302 100644 --- a/src/new/templates/test/file_transfer/{package_name}_test/{package_name}_test/src/lib.rs +++ b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/file_transfer_test/src/lib.rs @@ -1,5 +1,5 @@ use crate::kinode::process::standard::{ProcessId as WitProcessId}; -use crate::kinode::process::{package_name}::{Address as WitAddress, Request as TransferRequest, Response as TransferResponse, WorkerRequest, DownloadRequest, ProgressRequest, FileInfo, InitializeRequest}; +use crate::kinode::process::file_transfer::{Address as WitAddress, Request as TransferRequest, Response as TransferResponse, WorkerRequest, DownloadRequest, ProgressRequest, FileInfo, InitializeRequest}; use crate::kinode::process::tester::{Request as TesterRequest, Response as TesterResponse, RunRequest, FailResponse}; use kinode_process_lib::{await_message, call_init, print_to_terminal, println, Address, ProcessId, Request, Response}; @@ -8,7 +8,7 @@ mod tester_lib; wit_bindgen::generate!({ path: "target/wit", - world: "{package_name_kebab}-test-{publisher_dotted_kebab}-v0", + world: "file-transfer-test-template-dot-os-v0", generate_unused_types: true, additional_derives: [PartialEq, serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto], }); @@ -18,9 +18,9 @@ fn test_list_files(address: &Address) -> anyhow::Result> { .target(address) .body(TransferRequest::ListFiles) .send_and_await_response(15)?.unwrap(); - if response.is_request() { fail!("{package_name}_test"); }; + if response.is_request() { fail!("file_transfer_test"); }; let TransferResponse::ListFiles(files) = response.body().try_into()? else { - fail!("{package_name}_test"); + fail!("file_transfer_test"); }; Ok(files) } @@ -33,9 +33,9 @@ fn test_download(name: String, our: &Address, address: &Address) -> anyhow::Resu target: address, })) .send_and_await_response(15)?.unwrap(); - if response.is_request() { fail!("{package_name}_test"); }; + if response.is_request() { fail!("file_transfer_test"); }; let TransferResponse::Download = response.body().try_into()? else { - fail!("{package_name}_test"); + fail!("file_transfer_test"); }; Ok(()) } @@ -57,7 +57,7 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { input_node_names: node_names, .. }) = message.body().try_into()?; - print_to_terminal(0, "{package_name}_test: a"); + print_to_terminal(0, "file_transfer_test: a"); assert!(node_names.len() >= 2); if our.node != node_names[0] { // we are not master node: return @@ -72,15 +72,15 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { let our_ft_address = Address { node: our.node.clone(), - process: ProcessId::new(Some("{package_name}"), "{package_name}", "{publisher}"), + process: ProcessId::new(Some("file_transfer"), "file_transfer", "template.os"), }; let their_ft_address = Address { node: node_names[1].clone(), - process: ProcessId::new(Some("{package_name}"), "{package_name}", "{publisher}"), + process: ProcessId::new(Some("file_transfer"), "file_transfer", "template.os"), }; // Send - print_to_terminal(0, "{package_name}_test: b"); + print_to_terminal(0, "file_transfer_test: b"); let message: String = "hello".into(); let _ = Request::new() .target(our_ft_address.clone()) @@ -91,14 +91,14 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { .send_and_await_response(15)?.unwrap(); // Get history from receiver & test - print_to_terminal(0, "{package_name}_test: c"); + print_to_terminal(0, "file_transfer_test: c"); let response = Request::new() .target(their_ft_address.clone()) .body(ChatRequest::History(our.node.clone())) .send_and_await_response(15)?.unwrap(); - if response.is_request() { fail!("{package_name}_test"); }; + if response.is_request() { fail!("file_transfer_test"); }; let ChatResponse::History(messages) = response.body().try_into()? else { - fail!("{package_name}_test"); + fail!("file_transfer_test"); }; let expected_messages = vec![ChatMessage { author: our.node.clone(), @@ -107,7 +107,7 @@ fn handle_message (our: &Address) -> anyhow::Result<()> { if messages != expected_messages { println!("{messages:?} != {expected_messages:?}"); - fail!("{package_name}_test"); + fail!("file_transfer_test"); } Response::new() @@ -126,9 +126,9 @@ fn init(our: Address) { match handle_message(&our) { Ok(()) => {}, Err(e) => { - print_to_terminal(0, format!("{package_name}_test: error: {e:?}").as_str()); + print_to_terminal(0, format!("file_transfer_test: error: {e:?}").as_str()); - fail!("{package_name}_test"); + fail!("file_transfer_test"); }, }; } diff --git a/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/file_transfer_test/src/tester_lib.rs b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/file_transfer_test/src/tester_lib.rs new file mode 100644 index 00000000..8fb7ae19 --- /dev/null +++ b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/file_transfer_test/src/tester_lib.rs @@ -0,0 +1,30 @@ +#[allow(unused_imports)] +use crate::kinode::process::tester::{FailResponse, Response as TesterResponse}; + +#[macro_export] +macro_rules! fail { + ($test:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: file!().into(), + line: line!(), + column: column!(), + }))) + .send() + .unwrap(); + panic!("") + }; + ($test:expr, $file:expr, $line:expr, $column:expr) => { + Response::new() + .body(TesterResponse::Run(Err(FailResponse { + test: $test.into(), + file: $file.into(), + line: $line, + column: $column, + }))) + .send() + .unwrap(); + panic!("") + }; +} diff --git a/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/metadata.json b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/metadata.json new file mode 100644 index 00000000..79571af1 --- /dev/null +++ b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/metadata.json @@ -0,0 +1,21 @@ +{ + "name": "file_transfer Test", + "description": "A test for file_transfer.", + "image": "", + "properties": { + "package_name": "file_transfer_test", + "current_version": "0.1.0", + "publisher": "template.os", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + }, + "wit_version": 0, + "dependencies": [ + "file_transfer:template.os", + "tester:sys" + ] + }, + "external_url": "", + "animation_url": "" +} diff --git a/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/pkg/manifest.json b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/pkg/manifest.json new file mode 100644 index 00000000..7b732b23 --- /dev/null +++ b/src/new/templates/rust/no-ui/file_transfer/test/file_transfer_test/pkg/manifest.json @@ -0,0 +1,15 @@ +[ + { + "process_name": "file_transfer_test", + "process_wasm_path": "/file_transfer_test.wasm", + "on_exit": "Restart", + "request_networking": false, + "request_capabilities": [ + "file_transfer:file_transfer:template.os" + ], + "grant_capabilities": [ + "file_transfer:file_transfer:template.os" + ], + "public": true + } +] diff --git a/src/new/templates/test/file_transfer/tests.toml b/src/new/templates/rust/no-ui/file_transfer/test/tests.toml similarity index 91% rename from src/new/templates/test/file_transfer/tests.toml rename to src/new/templates/rust/no-ui/file_transfer/test/tests.toml index 5b1ee6d6..3343f18b 100644 --- a/src/new/templates/test/file_transfer/tests.toml +++ b/src/new/templates/rust/no-ui/file_transfer/test/tests.toml @@ -9,7 +9,7 @@ setup_packages = [ { path = "..", run = true } ] setup_scripts = [] -test_package_paths = ["{package_name}_test"] +test_package_paths = ["file_transfer_test"] test_scripts = [] timeout_secs = 5 fakechain_router = 8545 diff --git a/src/new/templates/rust/ui/chat/Cargo.toml b/src/new/templates/rust/ui/chat/Cargo.toml new file mode 100644 index 00000000..ffd3e3f2 --- /dev/null +++ b/src/new/templates/rust/ui/chat/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +resolver = "2" +members = [ + "chat", +] + +[profile.release] +panic = "abort" +opt-level = "s" +lto = true diff --git a/src/new/templates/rust/ui/chat/{package_name}/Cargo.toml_ b/src/new/templates/rust/ui/chat/chat/Cargo.toml similarity index 93% rename from src/new/templates/rust/ui/chat/{package_name}/Cargo.toml_ rename to src/new/templates/rust/ui/chat/chat/Cargo.toml index c73909b5..42cb0fee 100644 --- a/src/new/templates/rust/ui/chat/{package_name}/Cargo.toml_ +++ b/src/new/templates/rust/ui/chat/chat/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "{package_name}" +name = "chat" version = "0.1.0" edition = "2021" diff --git a/src/new/templates/rust/ui/chat/{package_name}/src/lib.rs b/src/new/templates/rust/ui/chat/chat/src/lib.rs similarity index 98% rename from src/new/templates/rust/ui/chat/{package_name}/src/lib.rs rename to src/new/templates/rust/ui/chat/chat/src/lib.rs index 5522ece5..687b0520 100644 --- a/src/new/templates/rust/ui/chat/{package_name}/src/lib.rs +++ b/src/new/templates/rust/ui/chat/chat/src/lib.rs @@ -152,7 +152,7 @@ fn handle_chat_request( Request::new() .target(Address { node: target.clone(), - process: ProcessId::from_str("{package_name}:{package_name}:{publisher}")?, + process: ProcessId::from_str("chat:chat:template.os")?, }) .body(body) .send_and_await_response(5)??; diff --git a/src/new/templates/rust/ui/chat/metadata.json b/src/new/templates/rust/ui/chat/metadata.json index 940b56a7..267211d6 100644 --- a/src/new/templates/rust/ui/chat/metadata.json +++ b/src/new/templates/rust/ui/chat/metadata.json @@ -1,11 +1,11 @@ { - "name": "{package_name}", + "name": "chat", "description": "", "image": "", "properties": { - "package_name": "{package_name}", + "package_name": "chat", "current_version": "0.1.0", - "publisher": "{publisher}", + "publisher": "template.os", "mirrors": [], "code_hashes": { "0.1.0": "" diff --git a/src/new/templates/rust/ui/chat/pkg/manifest.json b/src/new/templates/rust/ui/chat/pkg/manifest.json index 44c7d1e8..0e55daa8 100644 --- a/src/new/templates/rust/ui/chat/pkg/manifest.json +++ b/src/new/templates/rust/ui/chat/pkg/manifest.json @@ -1,7 +1,7 @@ [ { - "process_name": "{package_name}", - "process_wasm_path": "/{package_name}.wasm", + "process_name": "chat", + "process_wasm_path": "/chat.wasm", "on_exit": "Restart", "request_networking": true, "request_capabilities": [ diff --git a/src/new/templates/test/chat/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit b/src/new/templates/test/chat/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit deleted file mode 100644 index 79c71980..00000000 --- a/src/new/templates/test/chat/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit +++ /dev/null @@ -1,5 +0,0 @@ -world {package_name_kebab}-test-{publisher_dotted_kebab}-v0 { - import {package_name_kebab}; - import tester; - include process-v0; -} diff --git a/src/new/templates/test/chat/{package_name}_test/pkg/manifest.json b/src/new/templates/test/chat/{package_name}_test/pkg/manifest.json deleted file mode 100644 index d3a222a9..00000000 --- a/src/new/templates/test/chat/{package_name}_test/pkg/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "process_name": "{package_name}_test", - "process_wasm_path": "/{package_name}_test.wasm", - "on_exit": "Restart", - "request_networking": false, - "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" - ], - "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" - ], - "public": true - } -] diff --git a/src/new/templates/test/echo/{package_name}_test/Cargo.toml_ b/src/new/templates/test/echo/{package_name}_test/Cargo.toml_ deleted file mode 100644 index 6c797c34..00000000 --- a/src/new/templates/test/echo/{package_name}_test/Cargo.toml_ +++ /dev/null @@ -1,10 +0,0 @@ -[workspace] -resolver = "2" -members = [ - "{package_name}_test", -] - -[profile.release] -panic = "abort" -opt-level = "s" -lto = true diff --git a/src/new/templates/test/echo/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit b/src/new/templates/test/echo/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit deleted file mode 100644 index 34ab50b7..00000000 --- a/src/new/templates/test/echo/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit +++ /dev/null @@ -1,4 +0,0 @@ -world {package_name_kebab}-test-{publisher_dotted_kebab}-v0 { - import tester; - include process-v0; -} diff --git a/src/new/templates/test/echo/{package_name}_test/pkg/manifest.json b/src/new/templates/test/echo/{package_name}_test/pkg/manifest.json deleted file mode 100644 index d3a222a9..00000000 --- a/src/new/templates/test/echo/{package_name}_test/pkg/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "process_name": "{package_name}_test", - "process_wasm_path": "/{package_name}_test.wasm", - "on_exit": "Restart", - "request_networking": false, - "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" - ], - "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" - ], - "public": true - } -] diff --git a/src/new/templates/test/fibonacci/{package_name}_test/Cargo.toml_ b/src/new/templates/test/fibonacci/{package_name}_test/Cargo.toml_ deleted file mode 100644 index 6c797c34..00000000 --- a/src/new/templates/test/fibonacci/{package_name}_test/Cargo.toml_ +++ /dev/null @@ -1,10 +0,0 @@ -[workspace] -resolver = "2" -members = [ - "{package_name}_test", -] - -[profile.release] -panic = "abort" -opt-level = "s" -lto = true diff --git a/src/new/templates/test/fibonacci/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit b/src/new/templates/test/fibonacci/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit deleted file mode 100644 index 79c71980..00000000 --- a/src/new/templates/test/fibonacci/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit +++ /dev/null @@ -1,5 +0,0 @@ -world {package_name_kebab}-test-{publisher_dotted_kebab}-v0 { - import {package_name_kebab}; - import tester; - include process-v0; -} diff --git a/src/new/templates/test/fibonacci/{package_name}_test/pkg/manifest.json b/src/new/templates/test/fibonacci/{package_name}_test/pkg/manifest.json deleted file mode 100644 index d3a222a9..00000000 --- a/src/new/templates/test/fibonacci/{package_name}_test/pkg/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "process_name": "{package_name}_test", - "process_wasm_path": "/{package_name}_test.wasm", - "on_exit": "Restart", - "request_networking": false, - "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" - ], - "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" - ], - "public": true - } -] diff --git a/src/new/templates/test/file_transfer/{package_name}_test/Cargo.toml_ b/src/new/templates/test/file_transfer/{package_name}_test/Cargo.toml_ deleted file mode 100644 index 6c797c34..00000000 --- a/src/new/templates/test/file_transfer/{package_name}_test/Cargo.toml_ +++ /dev/null @@ -1,10 +0,0 @@ -[workspace] -resolver = "2" -members = [ - "{package_name}_test", -] - -[profile.release] -panic = "abort" -opt-level = "s" -lto = true diff --git a/src/new/templates/test/file_transfer/{package_name}_test/api/tester:sys-v0.wit b/src/new/templates/test/file_transfer/{package_name}_test/api/tester:sys-v0.wit deleted file mode 100644 index 7fe0574b..00000000 --- a/src/new/templates/test/file_transfer/{package_name}_test/api/tester:sys-v0.wit +++ /dev/null @@ -1,27 +0,0 @@ -interface tester { - variant request { - run(run-request), - } - - variant response { - run(result<_, fail-response>) - } - - record run-request { - input-node-names: list, - test-names: list, - test-timeout: u64, - } - - record fail-response { - test: string, - file: string, - line: u32, - column: u32, - } -} - -world tester-sys-v0 { - import tester; - include process-v0; -} diff --git a/src/new/templates/test/file_transfer/{package_name}_test/api/{package_name}:{publisher}-v0.wit b/src/new/templates/test/file_transfer/{package_name}_test/api/{package_name}:{publisher}-v0.wit deleted file mode 100644 index 3ae9a97c..00000000 --- a/src/new/templates/test/file_transfer/{package_name}_test/api/{package_name}:{publisher}-v0.wit +++ /dev/null @@ -1,53 +0,0 @@ -interface {package_name_kebab} { - use standard.{address}; - - variant request { - list-files, - download(download-request), - progress(progress-request), - } - - variant response { - list-files(list), - download, - done, - started, - } - - variant worker-request { - initialize(initialize-request), - chunk(chunk-request), - size(u64), - } - - record download-request { - name: string, - target: address, - } - - record progress-request { - name: string, - progress: u64, - } - - record file-info { - name: string, - size: u64, - } - - record initialize-request { - name: string, - target-worker: option
, - } - - record chunk-request { - name: string, - offset: u64, - length: u64, - } -} - -world {package_name_kebab}-{publisher_dotted_kebab}-v0 { - import {package_name_kebab}; - include process-v0; -} diff --git a/src/new/templates/test/file_transfer/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit b/src/new/templates/test/file_transfer/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit deleted file mode 100644 index 79c71980..00000000 --- a/src/new/templates/test/file_transfer/{package_name}_test/api/{package_name}_test:{publisher}-v0.wit +++ /dev/null @@ -1,5 +0,0 @@ -world {package_name_kebab}-test-{publisher_dotted_kebab}-v0 { - import {package_name_kebab}; - import tester; - include process-v0; -} diff --git a/src/new/templates/test/file_transfer/{package_name}_test/metadata.json b/src/new/templates/test/file_transfer/{package_name}_test/metadata.json deleted file mode 100644 index cea44761..00000000 --- a/src/new/templates/test/file_transfer/{package_name}_test/metadata.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "{package_name} Test", - "description": "A test for {package_name}.", - "image": "", - "properties": { - "package_name": "{package_name}_test", - "current_version": "0.1.0", - "publisher": "{publisher}", - "mirrors": [], - "code_hashes": { - "0.1.0": "" - }, - "wit_version": 0 - }, - "external_url": "", - "animation_url": "" -} diff --git a/src/new/templates/test/file_transfer/{package_name}_test/pkg/manifest.json b/src/new/templates/test/file_transfer/{package_name}_test/pkg/manifest.json deleted file mode 100644 index d3a222a9..00000000 --- a/src/new/templates/test/file_transfer/{package_name}_test/pkg/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "process_name": "{package_name}_test", - "process_wasm_path": "/{package_name}_test.wasm", - "on_exit": "Restart", - "request_networking": false, - "request_capabilities": [ - "{package_name}:{package_name}:{publisher}" - ], - "grant_capabilities": [ - "{package_name}:{package_name}:{publisher}" - ], - "public": true - } -]