Skip to content

Commit

Permalink
Merge pull request #230 from kinode-dao/develop
Browse files Browse the repository at this point in the history
develop
  • Loading branch information
nick1udwig authored Jul 9, 2024
2 parents 2137206 + a0c328e commit 43dab11
Show file tree
Hide file tree
Showing 87 changed files with 18,214 additions and 892 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/mdbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
cargo install --version ${MDBOOK_VERSION} mdbook
cargo install mdbook-linkcheck
cargo install mdbook-webinclude
cargo install mdbook-webinclude
cargo install --git https://github.com/nick1udwig/mdbook-hide-feature --locked
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ book/*
*/**/.DS_Store
*/**/node_modules

src/code/*/target
src/code/*/*/target
src/code/*/*/wasi_snapshot_preview1.wasm
src/code/**/target
src/code/**/*.wasm
src/code/**/*.zip
src/code/**/wasi_snapshot_preview1.wasm
**/home
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@

## To build:

```sh
Get deps:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install mdbook
cargo install mdbook-linkcheck
cargo install mdbook-webinclude
cargo install --git https://github.com/nick1udwig/mdbook-hide-feature --locked

Build and serve book:
```bash
mdbook serve
```

Expand Down
2 changes: 2 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ level = 1
[output.linkcheck]

[preprocessor.webinclude]

[preprocessor.hide-feature]
8 changes: 4 additions & 4 deletions src/apis/http_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The action must be serialized to JSON and sent in the `body` of a request.
`HttpClientAction` is an `enum` type that includes both HTTP and websocket actions.

```rust
/// Request type that can be shared over WASM boundary to apps.
/// Request type that can be shared over Wasm boundary to apps.
/// This is the one you send to the `http_client:distro:sys` service.
#[derive(Debug, Serialize, Deserialize)]
pub enum HttpClientAction {
Expand All @@ -37,7 +37,7 @@ Two or more connections can have the same `channel_id` if they are from differen
`OutgoingHttpRequest` is used to send an HTTP request.

```rust
/// HTTP Request type that can be shared over WASM boundary to apps.
/// HTTP Request type that can be shared over Wasm boundary to apps.
/// This is the one you send to the `http_client:distro:sys` service.
#[derive(Debug, Serialize, Deserialize)]
pub struct OutgoingHttpRequest {
Expand All @@ -56,7 +56,7 @@ An HTTP request will have an `HttpResponse` defined in the [`http_server`](./htt
A websocket request (open, push, close) will simply respond with a `HttpClientResponse::WebSocketAck`.

```rust
/// HTTP Client Response type that can be shared over WASM boundary to apps.
/// HTTP Client Response type that can be shared over Wasm boundary to apps.
/// This is the one you receive from the `http_client:distro:sys` service.
#[derive(Debug, Serialize, Deserialize)]
pub enum HttpClientResponse {
Expand Down Expand Up @@ -95,7 +95,7 @@ These incoming websocket messages are processed and sent as `HttpClientRequest`
The message itself is accessible with `get_blob()`.

```rust
/// WebSocket Client Request type that can be shared over WASM boundary to apps.
/// WebSocket Client Request type that can be shared over Wasm boundary to apps.
/// This comes from an open websocket client connection in the `http_client:distro:sys` service.
#[derive(Debug, Serialize, Deserialize)]
pub enum HttpClientRequest {
Expand Down
4 changes: 2 additions & 2 deletions src/apis/http_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Note that the HTTP server module will persist bindings until the node itself is

The incoming request, whether the binding is for HTTP or WebSocket, will look like this:
```rust
/// HTTP Request type that can be shared over WASM boundary to apps.
/// HTTP Request type that can be shared over Wasm boundary to apps.
/// This is the one you receive from the `http_server:distro:sys` service.
#[derive(Debug, Serialize, Deserialize)]
pub enum HttpServerRequest {
Expand Down Expand Up @@ -190,7 +190,7 @@ Processes that use the HTTP server should expect to field this request type, ser
The process must issue a response with this structure in the body, serialized to JSON:

```rust
/// HTTP Response type that can be shared over WASM boundary to apps.
/// HTTP Response type that can be shared over Wasm boundary to apps.
/// Respond to [`IncomingHttpRequest`] with this type.
#[derive(Debug, Serialize, Deserialize)]
pub struct HttpResponse {
Expand Down
21 changes: 13 additions & 8 deletions src/apis/vfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ Every request takes a path and a corresponding action.

## Drives

VFS paths are normal relative paths within the directory `your_node_home/vfs/`, but to be valid they need to be within a drive.
A drive is just a directory within your VFS, consisting of 2 parts: `package_id/drive_name/`.
A drive is a directory within a package's VFS directory, e.g., `app_store:sys/pkg/` or `your_package:publisher.os/my_drive/`.
Drives are owned by packages.
Packages can share access to drives they own via [capabilities](../process/capabilities.md).
Each package is spawned with two drives: [`pkg/`](#pkg-drive) and [`tmp/`](#tmp-drive).
All processes in a package have caps to those drives.
Processes can also create additional drives.

For example: `your_package:publisher.os/pkg/`.
This directory is usually filled with files put into the `pkg/` directory when installing with `app_store`.
[Capabilities](../process/capabilities.md) are checked on the drive part of the path.
When calling `create_drive()` you'll be given "read" and "write" caps that you can share with other processes.
### `pkg/` drive

Other processes within your package will have access by default.
They can open and modify files and directories within their own package_id.
The `pkg/` drive contains metadata about the package that Kinode requires to run that package, `.wasm` binaries, and optionally the API of the package and the UI.
When creating packages, the `pkg/` drive is populated by [`kit build`](../kit/build.md) and loaded into the Kinode using [`kit start-package`](../kit/start-package.md).

### `tmp/` drive

The `tmp/` drive can be written to directly by the owning package using standard filesystem functionality (i.e. `std::fs` in Rust) via WASI in addition to the Kinode VFS.

### Imports

Expand Down
8 changes: 8 additions & 0 deletions src/code/mfa_data_demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*/target/
/target
pkg/*.wasm
*.swp
*.swo
*/wasi_snapshot_preview1.wasm
*/wit/
*/process_env
Loading

0 comments on commit 43dab11

Please sign in to comment.