Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kit"
version = "0.7.4"
version = "0.7.5"
edition = "2021"

[build-dependencies]
Expand Down Expand Up @@ -40,7 +40,6 @@ kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib.git", re
nix = { version = "0.27", features = ["process", "signal", "term"] }
regex = "1"
reqwest = { version = "0.12", features = ["json"] }
# rmp-serde = "1.1.2"
rpassword = "7"
semver = "1.0"
serde = { version = "1.0", features = ["derive"] }
Expand Down
8 changes: 7 additions & 1 deletion src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,13 @@ fn find_crate_versions(
dependency.req.clone()
} else {
if let Some(ref source) = dependency.source {
parse_version_from_url(source)?
match parse_version_from_url(source) {
Ok(v) => v,
Err(e) => {
warn!("Error parsing import version: {e}");
continue;
}
}
} else {
semver::VersionReq::default()
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ fn init_tracing(log_path: PathBuf) -> tracing_appender::non_blocking::WorkerGuar
.ok()
.and_then(|l| Level::from_str(&l).ok())
.unwrap_or_else(|| STDOUT_LOG_LEVEL_DEFAULT);
let allowed_levels: Vec<Level> = vec![Level::INFO, Level::WARN]
let allowed_levels: std::collections::HashSet<Level> = vec![Level::INFO, Level::WARN]
.into_iter()
.filter(|&l| l <= level)
.collect();
let stdout_filter = filter::filter_fn(move |metadata: &tracing::Metadata<'_>| {
allowed_levels.iter().any(|l| metadata.level() == l)
allowed_levels.contains(metadata.level())
});

let stderr_filter = EnvFilter::try_from_default_env()
Expand Down
1 change: 1 addition & 0 deletions src/new/templates/rust/no-ui/blank/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*/target/
/target
pkg/*.wasm
pkg/*.zip
*.swp
*.swo
*/wasi_snapshot_preview1.wasm
Expand Down
2 changes: 1 addition & 1 deletion src/new/templates/rust/no-ui/blank/blank/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
publish = false

[dependencies]
kinode_process_lib = "0.8.5"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "fbbbd7c" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
wit-bindgen = "0.24.0"
Expand Down
1 change: 1 addition & 0 deletions src/new/templates/rust/no-ui/chat/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*/target/
/target
pkg/*.wasm
pkg/*.zip
*.swp
*.swo
*/wasi_snapshot_preview1.wasm
Expand Down
2 changes: 1 addition & 1 deletion src/new/templates/rust/no-ui/chat/chat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

[dependencies]
anyhow = "1.0"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "fbbbd7c", features = ["logging"] }
process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
21 changes: 11 additions & 10 deletions src/new/templates/rust/no-ui/chat/chat/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use std::collections::HashMap;

use crate::kinode::process::chat::{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::logging::{error, info, init_logging, Level};
use kinode_process_lib::{await_message, call_init, println, Address, Message, Request, Response};

wit_bindgen::generate!({
Expand Down Expand Up @@ -56,18 +59,15 @@ fn handle_message(
.and_modify(|e| e.push(message.clone()))
.or_insert(vec![message]);
}
Response::new()
.body(ChatResponse::Send)
.send()
.unwrap();
Response::new().body(ChatResponse::Send).send().unwrap();
}
ChatRequest::History(ref node) => {
Response::new()
.body(ChatResponse::History(
message_archive
.get(node)
.map(|msgs| msgs.clone())
.unwrap_or_default()
.unwrap_or_default(),
))
.send()
.unwrap();
Expand All @@ -78,17 +78,18 @@ fn handle_message(

call_init!(init);
fn init(our: Address) {
println!("begin");
init_logging(&our, Level::DEBUG, Level::INFO, None).unwrap();
info!("begin");

let mut message_archive = HashMap::new();

loop {
match await_message() {
Err(send_error) => println!("got SendError: {send_error}"),
Err(send_error) => error!("got SendError: {send_error}"),
Ok(ref message) => match handle_message(&our, message, &mut message_archive) {
Ok(_) => {}
Err(e) => println!("got error while handling message: {e:?}"),
}
Err(e) => error!("got error while handling message: {e:?}"),
},
}
}
}
3 changes: 2 additions & 1 deletion src/new/templates/rust/no-ui/chat/pkg/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"on_exit": "Restart",
"request_networking": true,
"request_capabilities": [
"http_server:distro:sys"
"http_server:distro:sys",
"vfs:distro:sys"
],
"grant_capabilities": [],
"public": true
Expand Down
2 changes: 1 addition & 1 deletion src/new/templates/rust/no-ui/chat/send/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

[dependencies]
anyhow = "1.0"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "fbbbd7c" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
wit-bindgen = "0.24.0"
Expand Down
4 changes: 1 addition & 3 deletions src/new/templates/rust/no-ui/chat/send/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
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,
};
use kinode_process_lib::{await_next_message_body, call_init, println, Address, Message, Request};

wit_bindgen::generate!({
path: "target/wit",
Expand Down
1 change: 1 addition & 0 deletions src/new/templates/rust/no-ui/echo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*/target/
/target
pkg/*.wasm
pkg/*.zip
*.swp
*.swo
*/wasi_snapshot_preview1.wasm
Expand Down
2 changes: 1 addition & 1 deletion src/new/templates/rust/no-ui/echo/echo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
[dependencies]
anyhow = "1.0"
bincode = "1.3.3"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "fbbbd7c", features = ["logging"] }
process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
10 changes: 6 additions & 4 deletions src/new/templates/rust/no-ui/echo/echo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use kinode_process_lib::logging::{error, info, init_logging, Level};
use kinode_process_lib::{await_message, call_init, println, Address, Message, Response};

wit_bindgen::generate!({
Expand All @@ -20,15 +21,16 @@ fn handle_message(message: &Message) -> anyhow::Result<()> {
}

call_init!(init);
fn init(_our: Address) {
println!("begin");
fn init(our: Address) {
init_logging(&our, Level::DEBUG, Level::INFO, None).unwrap();
info!("begin");

loop {
match await_message() {
Err(send_error) => println!("got SendError: {send_error}"),
Err(send_error) => error!("got SendError: {send_error}"),
Ok(ref message) => match handle_message(message) {
Ok(_) => {}
Err(e) => println!("got error while handling message: {e:?}"),
Err(e) => error!("got error while handling message: {e:?}"),
},
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/new/templates/rust/no-ui/echo/pkg/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"on_exit": "Restart",
"request_networking": true,
"request_capabilities": [
"http_server:distro:sys"
"http_server:distro:sys",
"vfs:distro:sys"
],
"grant_capabilities": [],
"public": true
Expand Down
2 changes: 2 additions & 0 deletions src/new/templates/rust/no-ui/fibonacci/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*/target/
/target
pkg/*.wasm
pkg/*.zip
*.swp
*.swo
*/wasi_snapshot_preview1.wasm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
[dependencies]
anyhow = "1.0"
bincode = "1.3.3"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "fbbbd7c", features = ["logging"] }
process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
22 changes: 13 additions & 9 deletions src/new/templates/rust/no-ui/fibonacci/fibonacci/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::kinode::process::fibonacci::{Request as FibonacciRequest, Response as FibonacciResponse};
use kinode_process_lib::{await_message, call_init, println, Address, Message, Response};
use crate::kinode::process::fibonacci::{
Request as FibonacciRequest, Response as FibonacciResponse,
};
use kinode_process_lib::logging::{error, info, init_logging, Level};
use kinode_process_lib::{await_message, call_init, Address, Message, Response};

wit_bindgen::generate!({
path: "target/wit",
Expand Down Expand Up @@ -36,7 +39,7 @@ fn handle_message(message: &Message) -> anyhow::Result<()> {
let start = std::time::Instant::now();
let result = fibonacci(number);
let duration = start.elapsed();
println!(
info!(
"fibonacci({}) = {}; {}ns",
number,
result,
Expand Down Expand Up @@ -66,7 +69,7 @@ fn handle_message(message: &Message) -> anyhow::Result<()> {
trial - mean
}
}) / number_trials as u128;
println!(
info!(
"fibonacci({}) = {}; {}±{}ns averaged over {} trials",
number, result, mean, absolute_deviation, number_trials,
);
Expand All @@ -80,16 +83,17 @@ fn handle_message(message: &Message) -> anyhow::Result<()> {
}

call_init!(init);
fn init(_our: Address) {
println!("begin");
fn init(our: Address) {
init_logging(&our, Level::DEBUG, Level::INFO, None).unwrap();
info!("begin");

loop {
match await_message() {
Err(send_error) => println!("got SendError: {send_error}"),
Err(send_error) => error!("got SendError: {send_error}"),
Ok(ref message) => match handle_message(message) {
Ok(_) => {}
Err(e) => println!("got error while handling message: {e:?}"),
}
Err(e) => error!("got error while handling message: {e:?}"),
},
}
}
}
2 changes: 1 addition & 1 deletion src/new/templates/rust/no-ui/fibonacci/number/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

[dependencies]
anyhow = "1.0"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "fbbbd7c" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
wit-bindgen = "0.24.0"
Expand Down
3 changes: 2 additions & 1 deletion src/new/templates/rust/no-ui/fibonacci/pkg/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"on_exit": "Restart",
"request_networking": true,
"request_capabilities": [
"http_server:distro:sys"
"http_server:distro:sys",
"vfs:distro:sys"
],
"grant_capabilities": [],
"public": true
Expand Down
3 changes: 2 additions & 1 deletion src/new/templates/rust/no-ui/file_transfer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
target
*/target/
pkg/*.wasm
pkg/*.zip
pkg/ui
*.swp
*.swo
Expand All @@ -9,4 +10,4 @@ pkg/ui
*/process_env
ui/dist
ui/node_modules
node_modules
node_modules
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

[dependencies]
anyhow = "1.0"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "fbbbd7c" }
process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

[dependencies]
anyhow = "1.0"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.3" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "fbbbd7c", features = ["logging"] }
process_macros = { git = "https://github.com/kinode-dao/process_macros", rev = "626e501" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
Loading