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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ target/
wit/
**/target/
**/wit/
**/wit-*/
**/*.wasm
.vscode
.app-signing
Expand Down
73 changes: 9 additions & 64 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion kinode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ path = "src/main.rs"

[build-dependencies]
anyhow = "1.0.71"
kit = { git = "https://github.com/kinode-dao/kit", rev = "9ad80d2" }
kit = { git = "https://github.com/kinode-dao/kit", rev = "49093a0" }
rayon = "1.8.1"
sha2 = "0.10"
tokio = "1.28"
Expand Down
2 changes: 1 addition & 1 deletion kinode/packages/app_store/app_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ alloy-primitives = "0.7.0"
alloy-sol-types = "0.7.0"
anyhow = "1.0"
bincode = "1.3.3"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.2" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "7eb3a04" }
rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
8 changes: 7 additions & 1 deletion kinode/packages/app_store/app_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,12 @@ pub fn handle_install(
) -> anyhow::Result<()> {
let drive_path = format!("/{package_id}/pkg");
let manifest = fetch_package_manifest(package_id)?;
let metadata = state
.get_downloaded_package(package_id)
.ok_or_else(|| anyhow::anyhow!("package not found in manager"))?
.metadata
.ok_or_else(|| anyhow::anyhow!("package has no metadata"))?;

// always grant read/write to their drive, which we created for them
let Some(read_cap) = get_capability(
&Address::new(&our.node, ("vfs", "distro", "sys")),
Expand Down Expand Up @@ -1085,7 +1091,7 @@ pub fn handle_install(
.body(serde_json::to_vec(&kt::KernelCommand::InitializeProcess {
id: parsed_new_process_id.clone(),
wasm_bytes_handle: wasm_path,
wit_version: None,
wit_version: metadata.properties.wit_version,
on_exit: entry.on_exit.clone(),
initial_capabilities: HashSet::new(),
public: entry.public,
Expand Down
5 changes: 3 additions & 2 deletions kinode/packages/app_store/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
"image": "",
"properties": {
"package_name": "app_store",
"current_version": "0.3.1",
"publisher": "sys",
"current_version": "0.3.1",
"mirrors": [],
"code_hashes": {
"0.3.1": ""
},
"wit_version": 0,
"dependencies": []
},
"external_url": "https://kinode.org",
"animation_url": ""
}
}
5 changes: 2 additions & 3 deletions kinode/packages/terminal/terminal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ fn handle_run(our: &Address, process: &ProcessId, args: String) -> anyhow::Resul
.body(serde_json::to_vec(&kt::KernelCommand::InitializeProcess {
id: parsed_new_process_id.clone(),
wasm_bytes_handle: wasm_path.clone(),
wit_version: None,
wit_version: None, // update this with new versions if desired
on_exit: kt::OnExit::None,
initial_capabilities: HashSet::new(),
public: entry.public,
Expand Down Expand Up @@ -297,10 +297,9 @@ fn handle_run(our: &Address, process: &ProcessId, args: String) -> anyhow::Resul
print_to_terminal(
3,
&format!(
"{}: Process {{\n wasm_bytes_handle: {},\n wit_version: {},\n on_exit: {:?},\n public: {}\n capabilities: {}\n}}",
"{}: Process {{\n wasm_bytes_handle: {},\n on_exit: {:?},\n public: {}\n capabilities: {}\n}}",
parsed_new_process_id.clone(),
wasm_path.clone(),
"None",
kt::OnExit::None,
entry.public,
{
Expand Down
11 changes: 5 additions & 6 deletions kinode/src/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ use lib::types::core::{self as t, STATE_PROCESS_ID, VFS_PROCESS_ID};

/// Manipulate a single process.
pub mod process;
/// Implement the functions served to processes by `kinode.wit`.
/// Implement the functions served to processes by `wit-v0.7.0/kinode.wit`.
mod standard_host;
/// Implement the functions served to processes by `wit-v0.8.0/kinode.wit`.
mod standard_host_v0;

const PROCESS_CHANNEL_CAPACITY: usize = 100;

const DEFAULT_WIT_VERSION: u32 = 0;
pub const LATEST_WIT_VERSION: u32 = 0;

#[derive(Serialize, Deserialize)]
struct StartProcessMetadata {
Expand Down Expand Up @@ -606,10 +608,7 @@ async fn start_process(
process: id.clone(),
},
wasm_bytes_handle: process_metadata.persisted.wasm_bytes_handle.clone(),
wit_version: process_metadata
.persisted
.wit_version
.unwrap_or(DEFAULT_WIT_VERSION),
wit_version: process_metadata.persisted.wit_version,
on_exit: process_metadata.persisted.on_exit.clone(),
public: process_metadata.persisted.public,
};
Expand Down
Loading