Merge pull request #619 from kinode-dao/hf/use-request-attach-all

m:terminal: use `Request::attach_all()` method
This commit is contained in:
nick.kino 2024-12-09 13:39:55 -08:00 committed by GitHub
commit 75dba1c2f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 92 additions and 53 deletions

82
Cargo.lock generated
View File

@ -84,7 +84,7 @@ name = "alias"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -1036,7 +1036,7 @@ dependencies = [
"alloy-sol-types",
"anyhow",
"bincode",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"process_macros",
"rand 0.8.5",
"serde",
@ -1419,7 +1419,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"url",
@ -1629,7 +1629,7 @@ name = "cat"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -1693,7 +1693,7 @@ dependencies = [
"alloy-sol-types",
"anyhow",
"bincode",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"process_macros",
"rand 0.8.5",
"serde",
@ -1712,7 +1712,7 @@ version = "0.2.1"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"pleco",
"serde",
"serde_json",
@ -1904,7 +1904,7 @@ checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6"
name = "contacts"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"process_macros",
"serde",
"serde_json",
@ -2502,7 +2502,7 @@ name = "download"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"process_macros",
"serde",
"serde_json",
@ -2514,7 +2514,7 @@ name = "downloads"
version = "0.5.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"process_macros",
"rand 0.8.5",
"serde",
@ -2551,7 +2551,7 @@ dependencies = [
name = "echo"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"wit-bindgen",
]
@ -2796,7 +2796,7 @@ version = "0.2.0"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"process_macros",
"rand 0.8.5",
"serde",
@ -2950,7 +2950,7 @@ dependencies = [
name = "get_block"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -3015,7 +3015,7 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
name = "globe"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"url",
@ -3152,7 +3152,7 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
name = "help"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"wit-bindgen",
]
@ -3181,7 +3181,7 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"
name = "hi"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -3214,7 +3214,7 @@ version = "0.1.1"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -3657,7 +3657,7 @@ name = "install"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"process_macros",
"serde",
"serde_json",
@ -3834,7 +3834,7 @@ name = "kfetch"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"serde_json",
@ -3846,7 +3846,7 @@ name = "kill"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -3962,6 +3962,28 @@ dependencies = [
"wit-bindgen",
]
[[package]]
name = "kinode_process_lib"
version = "0.10.0"
source = "git+https://github.com/kinode-dao/process_lib?rev=5d6e2af#5d6e2af88ef0716822cc1638be5b71a1ec9c4fb3"
dependencies = [
"alloy 0.1.4",
"alloy-primitives 0.7.7",
"alloy-sol-macro",
"alloy-sol-types",
"anyhow",
"bincode",
"http 1.1.0",
"mime_guess",
"rand 0.8.5",
"rmp-serde",
"serde",
"serde_json",
"thiserror",
"url",
"wit-bindgen",
]
[[package]]
name = "kit"
version = "0.8.0"
@ -4007,7 +4029,7 @@ dependencies = [
"alloy-sol-types",
"anyhow",
"hex",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"serde_json",
@ -4243,7 +4265,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"clap",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=5d6e2af)",
"regex",
"serde",
"serde_json",
@ -4422,7 +4444,7 @@ dependencies = [
name = "net-diagnostics"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"wit-bindgen",
@ -4759,7 +4781,7 @@ dependencies = [
name = "peer"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"wit-bindgen",
@ -4769,7 +4791,7 @@ dependencies = [
name = "peers"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"wit-bindgen",
@ -5809,7 +5831,7 @@ dependencies = [
"anyhow",
"base64 0.22.1",
"bincode",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"serde_json",
@ -6027,7 +6049,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
name = "state"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -6218,7 +6240,7 @@ version = "0.1.1"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rand 0.8.5",
"regex",
"serde",
@ -6232,7 +6254,7 @@ version = "0.1.1"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"process_macros",
"serde",
"serde_json",
@ -6488,7 +6510,7 @@ version = "0.2.0"
dependencies = [
"anyhow",
"clap",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -6821,7 +6843,7 @@ name = "uninstall"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib 0.10.0",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"process_macros",
"serde",
"serde_json",

View File

@ -31,7 +31,7 @@ name = "alias"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -834,7 +834,7 @@ name = "cat"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -1079,7 +1079,7 @@ dependencies = [
name = "echo"
version = "0.1.0"
dependencies = [
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"wit-bindgen",
]
@ -1381,7 +1381,7 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
name = "help"
version = "0.1.0"
dependencies = [
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"wit-bindgen",
]
@ -1410,7 +1410,7 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"
name = "hi"
version = "0.1.0"
dependencies = [
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -1639,7 +1639,7 @@ name = "kfetch"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"serde_json",
@ -1651,7 +1651,7 @@ name = "kill"
version = "0.1.0"
dependencies = [
"anyhow",
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",
@ -1679,6 +1679,28 @@ dependencies = [
"wit-bindgen",
]
[[package]]
name = "kinode_process_lib"
version = "0.10.0"
source = "git+https://github.com/kinode-dao/process_lib?rev=5d6e2af#5d6e2af88ef0716822cc1638be5b71a1ec9c4fb3"
dependencies = [
"alloy",
"alloy-primitives 0.7.7",
"alloy-sol-macro",
"alloy-sol-types",
"anyhow",
"bincode",
"http",
"mime_guess",
"rand",
"rmp-serde",
"serde",
"serde_json",
"thiserror",
"url",
"wit-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.5.0"
@ -1740,7 +1762,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"clap",
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=5d6e2af)",
"regex",
"serde",
"serde_json",
@ -1811,7 +1833,7 @@ dependencies = [
name = "net-diagnostics"
version = "0.1.0"
dependencies = [
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"wit-bindgen",
@ -1984,7 +2006,7 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
name = "peer"
version = "0.1.0"
dependencies = [
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"wit-bindgen",
@ -1994,7 +2016,7 @@ dependencies = [
name = "peers"
version = "0.1.0"
dependencies = [
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rmp-serde",
"serde",
"wit-bindgen",
@ -2747,7 +2769,7 @@ version = "0.1.1"
dependencies = [
"anyhow",
"bincode",
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"rand",
"regex",
"serde",
@ -2893,7 +2915,7 @@ version = "0.2.0"
dependencies = [
"anyhow",
"clap",
"kinode_process_lib",
"kinode_process_lib 0.10.0 (git+https://github.com/kinode-dao/process_lib?rev=1fe8612)",
"serde",
"serde_json",
"wit-bindgen",

View File

@ -9,7 +9,7 @@ simulation-mode = []
[dependencies]
anyhow = "1.0"
clap = "4.4"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "1fe8612" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "5d6e2af" }
regex = "1.10.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

View File

@ -1,5 +1,5 @@
use clap::{Arg, Command};
use kinode_process_lib::{our_capabilities, println, script, Address, Request, SendErrorKind};
use kinode_process_lib::{println, script, Address, Request, SendErrorKind};
use regex::Regex;
wit_bindgen::generate!({
@ -64,15 +64,10 @@ fn init(our: Address, args: String) -> String {
Address::new(our.node(), target.process)
};
let capabilities = our_capabilities()
.into_iter()
.filter(|cap| cap.issuer == target)
.collect();
let req = Request::new()
.target(target)
let req = Request::to(&target)
.body(body.as_bytes().to_vec())
.capabilities(capabilities);
.try_attach_all()
.unwrap();
match parsed.get_one::<u64>("await") {
Some(s) => {