Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2306424
add `dependencies` field to Erc721Properties
nick1udwig May 2, 2024
c31617e
app_store: fetch apis when published
nick1udwig May 2, 2024
4865e63
app_store: add ListApis and GetApi LocalRequests
nick1udwig May 3, 2024
1a187d8
app_store: add NewPackaged packages to apis
nick1udwig May 3, 2024
477d02a
app_store: dont save the zip file
nick1udwig May 3, 2024
8837a22
packages: update to use wit apis
nick1udwig May 6, 2024
8f7ad64
Format Rust code using rustfmt
github-actions[bot] May 6, 2024
8a35e7a
get node booting
nick1udwig May 6, 2024
e33876f
app_store: add core package apis
nick1udwig May 7, 2024
8c80cfd
move `wit/` dir into `target/`
nick1udwig May 7, 2024
cbf4bab
move apis
nick1udwig May 8, 2024
5ea9d9a
use new build args
nick1udwig May 8, 2024
f309883
set version
nick1udwig May 8, 2024
0d5cfd3
Format Rust code using rustfmt
github-actions[bot] May 8, 2024
2576b07
Merge branch 'develop' into hf/wit-apis
nick1udwig May 13, 2024
7da4cfb
finish merge
nick1udwig May 13, 2024
e80679e
Format Rust code using rustfmt
github-actions[bot] May 13, 2024
c032092
Merge branch 'develop' into hf/wit-apis
dr-frmr May 14, 2024
91717f1
remove development comments
nick1udwig May 14, 2024
3194b03
change dependencies to optional metadata field
nick1udwig May 14, 2024
2c2f52d
change convention to: interface <-> process; world <-> package
nick1udwig May 16, 2024
2817bb8
Format Rust code using rustfmt
github-actions[bot] May 16, 2024
6efcf98
remove homepage package-lock.json
nick1udwig May 16, 2024
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: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ wit/
*.swo
*.zip
/home
packages/**/pkg/*.wasm
packages/**/wit
*/**/node_modules
.env
kinode/src/bootstrapped_processes.rs
Expand Down
41 changes: 32 additions & 9 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 = "25b474a" }
kit = { git = "https://github.com/kinode-dao/kit", rev = "9ad80d2" }
rayon = "1.8.1"
sha2 = "0.10"
tokio = "1.28"
Expand Down
2 changes: 1 addition & 1 deletion kinode/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn build_and_zip_package(
) -> anyhow::Result<(String, String, Vec<u8>)> {
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(async {
kit::build::execute(&entry_path, true, false, true, features)
kit::build::execute(&entry_path, true, false, true, features, None, None) // TODO
.await
.map_err(|e| anyhow::anyhow!("{:?}", e))?;

Expand Down
21 changes: 21 additions & 0 deletions kinode/packages/app_store/app_store/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ pub enum RemoteRequest {
package_id: PackageId,
desired_version_hash: Option<String>,
},
/// Request a package API from another node who we expect to
/// be mirroring it. If the remote node is mirroring the package,
/// they must respond with RemoteResponse::DownloadApproved,
/// at which point requester can expect an FTWorkerRequest::Receive.
DownloadApi {
package_id: PackageId,
desired_version_hash: String,
},
}

/// The response expected from sending a [`RemoteRequest`].
Expand Down Expand Up @@ -45,6 +53,7 @@ pub enum LocalRequest {
/// This is used for locally installing a package.
NewPackage {
package: PackageId,
metadata: kernel_types::Erc721Metadata,
/// Sets whether we will mirror this package for others
mirror: bool,
},
Expand Down Expand Up @@ -93,6 +102,10 @@ pub enum LocalRequest {
/// This is an expensive operation! Throw away our state and rebuild from scratch.
/// Re-index the locally downloaded/installed packages AND the onchain data.
RebuildIndex,
/// List all apps we have APIs for.
ListApis,
/// Return the given API, if we have it.
GetApi(PackageId),
}

/// Local responses take this form.
Expand All @@ -107,6 +120,8 @@ pub enum LocalResponse {
MirrorResponse(MirrorResponse),
AutoUpdateResponse(AutoUpdateResponse),
RebuiltIndex,
ListApisResponse { apis: Vec<PackageId> },
GetApiResponse(GetApiResponse), // API in blob (or None)
}

// TODO for all: expand these to elucidate why something failed
Expand Down Expand Up @@ -147,3 +162,9 @@ pub enum AutoUpdateResponse {
Success,
Failure,
}

#[derive(Debug, Serialize, Deserialize)]
pub enum GetApiResponse {
Success,
Failure,
}
13 changes: 11 additions & 2 deletions kinode/packages/app_store/app_store/src/http_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@ pub fn handle_http_request(
our: &Address,
state: &mut State,
eth_provider: &eth::Provider,
requested_apis: &mut HashMap<PackageId, RequestedPackage>,
requested_packages: &mut HashMap<PackageId, RequestedPackage>,
req: &IncomingHttpRequest,
) -> anyhow::Result<()> {
match serve_paths(our, state, eth_provider, requested_packages, req) {
match serve_paths(
our,
state,
eth_provider,
requested_apis,
requested_packages,
req,
) {
Ok((status_code, _headers, body)) => send_response(
status_code,
Some(HashMap::from([(
Expand Down Expand Up @@ -102,6 +110,7 @@ fn serve_paths(
our: &Address,
state: &mut State,
eth_provider: &eth::Provider,
requested_apis: &mut HashMap<PackageId, RequestedPackage>,
requested_packages: &mut HashMap<PackageId, RequestedPackage>,
req: &IncomingHttpRequest,
) -> anyhow::Result<(StatusCode, Option<HashMap<String, String>>, Vec<u8>)> {
Expand Down Expand Up @@ -432,7 +441,7 @@ fn serve_paths(
format!("Invalid method {method} for {bound_path}").into_bytes(),
));
}
crate::rebuild_index(our, state, eth_provider);
crate::rebuild_index(our, state, eth_provider, requested_apis);
Ok((StatusCode::OK, None, vec![]))
}
_ => Ok((
Expand Down
Loading