This commit is contained in:
dr-frmr 2024-01-15 19:51:07 -03:00
parent 693d75d9e2
commit 270d805602
No known key found for this signature in database
31 changed files with 150 additions and 135 deletions

124
Cargo.lock generated
View File

@ -2701,6 +2701,68 @@ dependencies = [
"cpufeatures",
]
[[package]]
name = "kinode"
version = "0.5.0"
dependencies = [
"aes-gcm 0.10.2",
"anyhow",
"async-trait",
"base64 0.13.1",
"bincode",
"blake3",
"bytes",
"cap-std",
"chacha20poly1305 0.10.1",
"chrono",
"clap",
"crossterm",
"dashmap",
"digest",
"elliptic-curve",
"ethers",
"ethers-providers",
"flate2",
"futures",
"generic-array",
"getrandom",
"hex",
"hkdf",
"hmac",
"http",
"jwt",
"lazy_static",
"log",
"nohash-hasher",
"num-traits",
"open",
"public-ip",
"rand",
"reqwest",
"ring",
"rmp-serde",
"rocksdb",
"route-recognizer",
"rusqlite",
"serde",
"serde_json",
"serde_urlencoded",
"sha2",
"snow",
"static_dir",
"thiserror",
"tokio",
"tokio-stream",
"tokio-tungstenite 0.20.1",
"url",
"uuid 1.4.1",
"walkdir",
"warp",
"wasmtime",
"wasmtime-wasi",
"zip",
]
[[package]]
name = "lalrpop"
version = "0.20.0"
@ -2978,68 +3040,6 @@ dependencies = [
"tempfile",
]
[[package]]
name = "nectar"
version = "0.5.0"
dependencies = [
"aes-gcm 0.10.2",
"anyhow",
"async-trait",
"base64 0.13.1",
"bincode",
"blake3",
"bytes",
"cap-std",
"chacha20poly1305 0.10.1",
"chrono",
"clap",
"crossterm",
"dashmap",
"digest",
"elliptic-curve",
"ethers",
"ethers-providers",
"flate2",
"futures",
"generic-array",
"getrandom",
"hex",
"hkdf",
"hmac",
"http",
"jwt",
"lazy_static",
"log",
"nohash-hasher",
"num-traits",
"open",
"public-ip",
"rand",
"reqwest",
"ring",
"rmp-serde",
"rocksdb",
"route-recognizer",
"rusqlite",
"serde",
"serde_json",
"serde_urlencoded",
"sha2",
"snow",
"static_dir",
"thiserror",
"tokio",
"tokio-stream",
"tokio-tungstenite 0.20.1",
"url",
"uuid 1.4.1",
"walkdir",
"warp",
"wasmtime",
"wasmtime-wasi",
"zip",
]
[[package]]
name = "new_debug_unreachable"
version = "1.0.4"

View File

@ -1,5 +1,5 @@
[package]
name = "nectar"
name = "kinode"
authors = ["UqbarDAO"]
version = "0.5.0"
edition = "2021"

View File

@ -5,7 +5,7 @@
```bash
# Clone the repo.
git clone git@github.com:uqbar-dao/nectar.git
git clone git@github.com:uqbar-dao/kinode.git
# Configure dependency retrieval from GitHub
mkdir .cargo
@ -13,7 +13,7 @@ echo "net.git-fetch-with-cli = true" > .cargo/config
# Get some stuff so we can build Wasm.
cd nectar
cd kinode
cargo install wasm-tools
rustup install nightly
rustup target add wasm32-wasi

View File

@ -11,13 +11,13 @@ def build_and_move(feature, tmp_dir):
if feature:
subprocess.run(["cargo", "+nightly", "build", "--release", "--features", feature], check=True)
binary_name = f"nectar-{feature}"
binary_name = f"kinode-{feature}"
else:
subprocess.run(["cargo", "+nightly", "build", "--release"], check=True)
binary_name = "nectar"
binary_name = "kinode"
# Move and rename the binary
source_path = "target/release/nectar"
source_path = "target/release/kinode"
dest_path = os.path.join(tmp_dir, binary_name)
shutil.move(source_path, dest_path)
@ -26,7 +26,7 @@ def main():
features = ["", "simulation-mode"] # Add more features as needed
# Ensure the tmp directory is clean
tmp_dir = "/tmp/nectar-release"
tmp_dir = "/tmp/kinode-release"
if os.path.exists(tmp_dir):
shutil.rmtree(tmp_dir)
os.makedirs(tmp_dir)

View File

@ -138,13 +138,13 @@ fn main() {
// Pull wit from git repo
let wit_dir = pwd.join("wit");
fs::create_dir_all(&wit_dir).unwrap();
let wit_file = wit_dir.join("nectar.wit");
let wit_file = wit_dir.join("kinode.wit");
if !wit_file.exists() {
// TODO: cache in better way
let mut wit_file = std::fs::File::create(&wit_file).unwrap();
let nectar_wit_url =
"https://raw.githubusercontent.com/uqbar-dao/nectar-wit/master/nectar.wit";
let mut response = reqwest::blocking::get(nectar_wit_url).unwrap();
let kinode_wit_url =
"https://raw.githubusercontent.com/uqbar-dao/kinode-wit/master/kinode.wit";
let mut response = reqwest::blocking::get(kinode_wit_url).unwrap();
io::copy(&mut response, &mut wit_file).unwrap();
}

View File

@ -15,11 +15,11 @@ rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.10.8"
nectar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
kinode_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "nectar:process"
package = "kinode:process"

View File

@ -1,6 +1,6 @@
use nectar_process_lib::kernel_types as kt;
use nectar_process_lib::*;
use nectar_process_lib::{call_init, println};
use kinode_process_lib::kernel_types as kt;
use kinode_process_lib::*;
use kinode_process_lib::{call_init, println};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use sha2::Digest;

View File

@ -16,11 +16,11 @@ bincode = "1.3.3"
rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
nectar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
kinode_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "nectar:process"
package = "kinode:process"

View File

@ -1,4 +1,4 @@
use nectar_process_lib::*;
use kinode_process_lib::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]

View File

@ -1,5 +1,5 @@
use nectar_process_lib::println;
use nectar_process_lib::*;
use kinode_process_lib::println;
use kinode_process_lib::*;
use serde::{Deserialize, Serialize};
mod ft_worker_lib;

View File

@ -16,11 +16,11 @@ pleco = "0.5"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
url = "*"
nectar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
kinode_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "nectar:process"
package = "kinode:process"

View File

@ -1,5 +1,5 @@
#![feature(let_chains)]
use nectar_process_lib::{
use kinode_process_lib::{
await_message, call_init, get_blob, get_typed_state, http, println, set_state, Address,
LazyLoadBlob, Message, NodeId, Request, Response,
};

View File

@ -15,11 +15,11 @@ anyhow = "1.0"
bincode = "1.3.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
nectar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
kinode_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "nectar:process"
package = "kinode:process"

View File

@ -1,5 +1,5 @@
#![feature(let_chains)]
use nectar_process_lib::{
use kinode_process_lib::{
await_message, http::bind_http_static_path, http::HttpServerError, println, Address, Message,
};

View File

@ -20,11 +20,11 @@ hex = "0.4.3"
rmp-serde = "1.1.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
nectar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha", features = ["eth"] }
kinode_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha", features = ["eth"] }
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "nectar:process"
package = "kinode:process"

View File

@ -1,7 +1,7 @@
use alloy_rpc_types::Log;
use alloy_sol_types::{sol, SolEvent};
use nectar_process_lib::eth::{EthAddress, EthSubEvent, SubscribeLogsRequest};
use nectar_process_lib::{
use kinode_process_lib::eth::{EthAddress, EthSubEvent, SubscribeLogsRequest};
use kinode_process_lib::{
await_message, get_typed_state, http, print_to_terminal, println, set_state, Address,
LazyLoadBlob, Message, Request, Response,
};

View File

@ -15,11 +15,11 @@ anyhow = "1.0"
bincode = "1.3.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
nectar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
kinode_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", tag = "v0.5.1-alpha" }
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "nectar:process"
package = "kinode:process"

View File

@ -1,7 +1,7 @@
use anyhow::anyhow;
use nectar_process_lib::kernel_types::{KernelCommand, KernelPrint};
use nectar_process_lib::nectar::process::standard as wit;
use nectar_process_lib::{println, Address, ProcessId, Request};
use kinode_process_lib::kernel_types::{KernelCommand, KernelPrint};
use kinode_process_lib::kinode::process::standard as wit;
use kinode_process_lib::{println, Address, ProcessId, Request};
wit_bindgen::generate!({
path: "../../../wit",

View File

@ -16,11 +16,11 @@ bincode = "1.3.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
nectar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "dee786a" }
kinode_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "dee786a" }
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "nectar:process"
package = "kinode:process"

View File

@ -1,6 +1,6 @@
use std::str::FromStr;
use nectar_process_lib::{
use kinode_process_lib::{
await_message, our_capabilities, println, spawn, vfs, Address, Message, OnExit, ProcessId,
Request, Response,
};

View File

@ -17,11 +17,11 @@ indexmap = "2.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
nectar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "dee786a" }
kinode_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "dee786a" }
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "nectar:process"
package = "kinode:process"

View File

@ -1,7 +1,7 @@
use indexmap::map::IndexMap;
use nectar_process_lib::kernel_types as kt;
use nectar_process_lib::{
use kinode_process_lib::kernel_types as kt;
use kinode_process_lib::{
await_message, call_init, our_capabilities, println, spawn, vfs, Address, Message, OnExit,
ProcessId, Request, Response,
};

View File

@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use nectar_process_lib::kernel_types as kt;
use nectar_process_lib::{Address, Response};
// use nectar_process_lib::nectar::process::standard as wit;
use kinode_process_lib::kernel_types as kt;
use kinode_process_lib::{Address, Response};
// use kinode_process_lib::kinode::process::standard as wit;
type Rsvp = Option<Address>;

View File

@ -241,7 +241,7 @@ async fn login_handler(
)
.into_response();
match HeaderValue::from_str(&format!("nectar-auth_{}={};", our.as_ref(), &token)) {
match HeaderValue::from_str(&format!("kinode-auth_{}={};", our.as_ref(), &token)) {
Ok(v) => {
response.headers_mut().append(http::header::SET_COOKIE, v);
Ok(response)

View File

@ -43,7 +43,7 @@ pub fn auth_cookie_valid(our_node: &str, cookie: &str, jwt_secret: &[u8]) -> boo
for cookie_part in cookie_parts {
let cookie_part_parts: Vec<&str> = cookie_part.split('=').collect();
if cookie_part_parts.len() == 2
&& cookie_part_parts[0] == format!("nectar-auth_{}", our_node)
&& cookie_part_parts[0] == format!("kinode-auth_{}", our_node)
{
auth_token = Some(cookie_part_parts[1].to_string());
break;

View File

@ -12,7 +12,7 @@ use wasmtime::{Config, Engine, WasmBacktraceDetails};
/// Manipulate a single process.
pub mod process;
/// Implement the functions served to processes by `nectar.wit`.
/// Implement the functions served to processes by `kinode.wit`.
mod standard_host;
const PROCESS_CHANNEL_CAPACITY: usize = 100;

View File

@ -2,8 +2,8 @@ use crate::kernel::{ProcessMessageReceiver, ProcessMessageSender};
use crate::types as t;
use crate::KERNEL_PROCESS_ID;
use anyhow::Result;
pub use nectar::process::standard as wit;
pub use nectar::process::standard::Host as StandardHost;
pub use kinode::process::standard as wit;
pub use kinode::process::standard::Host as StandardHost;
use ring::signature::{self, KeyPair};
use std::collections::{HashMap, VecDeque};
use std::sync::Arc;

View File

@ -1,5 +1,5 @@
use crate::kernel::process;
use crate::kernel::process::nectar::process::standard as wit;
use crate::kernel::process::kinode::process::standard as wit;
use crate::kernel::process::StandardHost;
use crate::types as t;
use crate::types::STATE_PROCESS_ID;

View File

@ -92,7 +92,7 @@ async fn serve_register_fe(
#[tokio::main]
async fn main() {
let app = Command::new("nectar")
let app = Command::new("kinode")
.version(VERSION)
.author("Uqbar DAO: https://github.com/uqbar-dao")
.about("A General Purpose Sovereign Cloud Computing Platform")

View File

@ -544,7 +544,7 @@ async fn success_response(
let headers = response.headers_mut();
match HeaderValue::from_str(&format!("nectar-auth_{}={};", &our.name, &token)) {
match HeaderValue::from_str(&format!("kinode-auth_{}={};", &our.name, &token)) {
Ok(v) => {
headers.append(SET_COOKIE, v);
}

View File

@ -45,16 +45,16 @@ pub async fn terminal(
format_args!(
r#"
888
888
88888bo od88bo od8888b 88888888 8888bo 888d888
888 "88b d8P Y8b d88P" 888 "88b 888P"
888 888 88888888 888 888 .d888888 888
888 888 Y8b. Y88b. Y88b. 888 888 888
888 888 "Y8888 "Y8888P "Y888 "Y888888 888
888 d8P d8b 888
888 d8P Y8P 888
888 d8P 888
888d88K 888 88888b. .d88b. .d88888 .d88b.
8888888b 888 888 "88b d88""88b d88" 888 d8P Y8b
888 Y88b 888 888 888 888 888 888 888 88888888
888 Y88b 888 888 888 Y88..88P Y88b 888 Y8b.
888 Y88b 888 888 888 "Y88P" "Y88888 "Y8888
{}
{} ({})
version {}
a general purpose sovereign cloud computer
@ -63,7 +63,14 @@ pub async fn terminal(
networking public key: {}
"#,
our.name, version, our.networking_key,
our.name,
if our.ws_routing.is_some() {
"direct"
} else {
"indirect"
},
version,
our.networking_key,
)
);
} else {
@ -71,20 +78,28 @@ pub async fn terminal(
"\x1b[38;5;128m{}\x1b[0m",
format_args!(
r#"
888
888
88888bo od88bo od8888b 8888888 8888bo 888d888
888 "88b d8P Y8b d88P" 888 "88b 888P"
888 888 88888888 888 888 .d888888 888
888 888 Y8b. Y88b. Y88b. 888 888 888
888 888 "Y8888 "Y8888P "Y888 "Y888888 888
888 d8P d8b 888
888 d8P Y8P 888
888 d8P 888
888d88K 888 88888b. .d88b. .d88888 .d88b.
8888888b 888 888 "88b d88""88b d88" 888 d8P Y8b
888 Y88b 888 888 888 888 888 888 888 88888888
888 Y88b 888 888 888 Y88..88P Y88b 888 Y8b.
888 Y88b 888 888 888 "Y88P" "Y88888 "Y8888
{}
{} ({})
version {}
a general purpose sovereign cloud computer
net pubkey: {}
"#,
our.name, version, our.networking_key,
our.name,
if our.ws_routing.is_some() {
"direct"
} else {
"indirect"
},
version,
our.networking_key,
)
);
}