{"id":14967139,"url":"https://github.com/golemfactory/ya-runtime-wasi","last_synced_at":"2025-10-19T09:31:38.282Z","repository":{"id":45079642,"uuid":"256155074","full_name":"golemfactory/ya-runtime-wasi","owner":"golemfactory","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-19T15:22:31.000Z","size":206,"stargazers_count":4,"open_issues_count":2,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-01T04:29:20.697Z","etag":null,"topics":["golem","ya-runtime"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/golemfactory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-16T08:29:27.000Z","updated_at":"2023-09-08T18:06:02.000Z","dependencies_parsed_at":"2024-09-14T03:49:43.526Z","dependency_job_id":"bdb0e3ff-4991-4da4-b40f-7c3e70c032d6","html_url":"https://github.com/golemfactory/ya-runtime-wasi","commit_stats":{"total_commits":78,"total_committers":13,"mean_commits":6.0,"dds":0.6666666666666667,"last_synced_commit":"a0f877714932913b1101e9a2dff14164a8b72983"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemfactory%2Fya-runtime-wasi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemfactory%2Fya-runtime-wasi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemfactory%2Fya-runtime-wasi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemfactory%2Fya-runtime-wasi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/golemfactory","download_url":"https://codeload.github.com/golemfactory/ya-runtime-wasi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219869245,"owners_count":16555571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golem","ya-runtime"],"created_at":"2024-09-24T13:37:30.786Z","updated_at":"2025-10-19T09:31:37.946Z","avatar_url":"https://github.com/golemfactory.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yagna WASI runtime\n![Continuous integration](https://github.com/golemfactory/ya-runtime-wasi/workflows/Continuous%20integration/badge.svg)\n\n`ya-runtime-wasi` is a [`Yagna`] plugin that allows the provider to execute WASI modules\nin a safe, sandboxed way. Typically, you will use this crate as part of your Yagna provider\ninstallation. However, it is also possible to use the integration standalone to execute\nzipped WASI modules according to some included manifest file.\n\n[`Yagna`]: https://github.com/golemfactory/yagna\n\n## Building\n\nBuilding the plugin is very straightforward:\n\n```\ncargo build\n```\n\nIf you decide to make some tweaks to the [API] and would like to test if everything still behaves\nas expected, you can trigger included end-to-end integration tests. Make sure you have\n`wasm32-wasi` target installed (`rustup target add wasm32-wasi`) and then run:\n\n[API]: crates/api\n\n```\ncargo test --all --features ya-runtime-wasi/integration-tests\n```\n\nNote that running the end-to-end tests requires you to have `wasm32-wasi` target installed.\n\n## Running\n\n### As part of Yagna\n\nThis step is explained in [Yagna's general tutorial].\n\n[Yagna's general tutorial]: https://github.com/golemfactory/yagna/tree/master/agent/provider\n\n### Standalone\n\nRunning standalone is pretty simple. For this, you'll want to use a Wasm module which performs\nsome input from the host, does some computations, and outputs the results to a file on the host.\nTo keep everything simple, we'll assume you use [`rust-wasi-tutorial`]. Clone the repo, and\nbuild the project:\n\n```\ngit clone https://github.com/kubkon/rust-wasi-tutorial.git\ncd rust-wasi-tutorial\ncargo build --release --target wasm32-wasi\n```\n\n[`rust-wasi-tutorial`]: https://github.com/kubkon/rust-wasi-tutorial\n\nThis will automatically cross-compile your project to `wasm32-wasi` target.\n\nNext, we'll need to create a Yagna package. Go ahead and create new dir called `package`\nsomewhere in your home directory, and copy `rust-wasi-tutorial.wasm` module into it:\n\n```\nmkdir package\ncp rust-wasi-tutorial/target/wasm32-wasi/release/main.wasm package/rust-wasi-tutorial.wasm\n```\n\nNext, we'll need to create a manifest for the package called `manifest.json`:\n\n```json\n{\n    \"id\": \"rust-wasi-tutorial\",\n    \"name\": \"rust-wasi-tutorial\",\n    \"entry-points\": [\n        {\n            \"id\": \"rust-wasi-tutorial\",\n            \"wasm-path\": \"rust-wasi-tutorial.wasm\"\n        }\n    ],\n    \"mount-points\": [\n        { \"rw\": \"input\" },\n        { \"rw\": \"output\" }\n    ]\n}\n```\n\nHere, of interest are `entry-points` and `mount-points` entries. The former tell the runtime\nwhat modules to load up when we specify some entrypoint (e.g., `rust-wasi-tutorial` will load\nup the `rust-wasi-tutorial.wasm` module), whereas the latter instruct the runtime which directories\nto preopen and map into our container so that we can make use of it. In this case, we'll map a\nrelative dir `input` as `/input` inside the container and similarly `output` as `/output`.\n\nOK, now we can create the package by zipping the `package` folder:\n\n```\nzip -r rust-wasi-tutorial.zip package/\n```\n\nFinally, we'll create a `workspace` dir where we'll mount our package using the runtime:\n\n```\nmkdir workspace\n```\n\nWe're now ready to deploy the package:\n\n```\n./target/debug/ya-runtime-wasi --task-package rust-wasi-tutorial.zip --workdir workspace deploy\n```\n\nDeployment created the mount points on the host for us inside `workspace`. Namely, you should find\nthere `workspace/input` and `workspace/output` among other things. Next, go ahead and create some\ndummy text file `in` with `Hello WASI!` and put it in `workspace/input/in`. It will then automatically\nget mapped into `/input/in` for use by our Wasm module.\n\nNext, we need to start the module:\n\n```\n./target/debug/ya-runtime-wasi --task-package rust-wasi-tutorial.zip --workdir workspace start\n```\n\nFinally, we can run it:\n\n```\n./target/debug/ya-runtime-wasi --task-package rust-wasi-tutorial.zip --workdir workspace run --entrypoint rust-wasi-tutorial /input/in /output/out\n```\n\nIf everything went according to plan, you should now find `out` text file with `Hello WASI!` text in it\ninside `workspace/output/out`.\n\n\n## License\n\nLicensed under [GPLv3](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemfactory%2Fya-runtime-wasi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolemfactory%2Fya-runtime-wasi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemfactory%2Fya-runtime-wasi/lists"}