{"id":21130609,"url":"https://github.com/golemcloud/wasm-rpc","last_synced_at":"2025-07-09T01:33:33.389Z","repository":{"id":221542597,"uuid":"754684151","full_name":"golemcloud/wasm-rpc","owner":"golemcloud","description":null,"archived":true,"fork":false,"pushed_at":"2024-12-11T08:03:37.000Z","size":1238,"stargazers_count":8,"open_issues_count":1,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-02-28T09:15:47.018Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/golemcloud.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":"2024-02-08T15:15:01.000Z","updated_at":"2024-12-11T08:03:48.000Z","dependencies_parsed_at":"2024-04-15T12:59:55.826Z","dependency_job_id":"5f961c46-804f-43e4-9d8f-ef9f362134df","html_url":"https://github.com/golemcloud/wasm-rpc","commit_stats":null,"previous_names":["golemcloud/wasm-rpc"],"tags_count":62,"template":false,"template_full_name":null,"purl":"pkg:github/golemcloud/wasm-rpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemcloud%2Fwasm-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemcloud%2Fwasm-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemcloud%2Fwasm-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemcloud%2Fwasm-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/golemcloud","download_url":"https://codeload.github.com/golemcloud/wasm-rpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemcloud%2Fwasm-rpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264375579,"owners_count":23598404,"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":[],"created_at":"2024-11-20T05:35:38.099Z","updated_at":"2025-07-09T01:33:33.355Z","avatar_url":"https://github.com/golemcloud.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"**MERGED TO THE https://github.com/golemcloud/golem/ REPOSITORY**\n\n# wasm-rpc\n\n## golem-wasm-rpc\n\nDefines data types for [Golem](https://golem.cloud)'s remote function invocation and conversions between them.\n\n- `WitValue` is the WIT-defined generic data type capable of representing an arbitrary value, generated by `wit-bindgen`\n- A builder and an extractor API for `WitValue`\n- `Value` is a recursive Rust type which is more convenient to work with than `WitValue`. Conversion between `WitValue`\n  and `Value` is implemented in both directions.\n- Protobuf message types for describing values and types, and a protobuf version of `WitValue` itself and conversion\n  from and to `Value` and `WitValue`\n- JSON representation of WIT values, as defined in [the Golem docs](https://learn.golem.cloud/docs/template-interface).\n- Conversion of `Value` to and from `wasmtime` values\n\nThe JSON representation requires additional type information which can be extracted using\nthe [golem-wasm-ast](https://crates.io/crates/golem-wasm-ast) crate.\n\n## Host and stub mode\n\nThe `golem-wasm-rpc` crate can be both used in host and guest environments:\n\nTo compile the host version:\n\n```shell\ncargo build -p wasm-rpc --no-default-features --features host\n```\n\nTo compile the guest version, has minimal dependencies and feature set to be used in generated stubs:\n\n```shell\ncargo component build -p wasm-rpc --no-default-features --features stub\n```\n\n## Feature flags\n\n- `arbitrary` adds an `Arbitrary` instance for `Value`\n- `json` adds conversion functions for mapping of a WIT value and type definition to/from JSON\n- `protobuf` adds the protobuf message types\n- `wasmtime` adds conversion to `wasmtime` `Val` values\n- `host` enables all features: `arbitrary`, `json`, `protobuf`, `typeinfo`, and `wasmtime`\n- `stub` is to be used in generated WASM stubs and disables all features, and generates guest bindings instead of host\n  bindings\n\n## golem-wasm-rpc-stubgen\n\nThe `golem-wasm-rpc-stubgen` is a CLI tool to generate the RPC stubs from a component's WIT definition.\n\n## Generate\n\n```shell\nUsage: wasm-rpc-stubgen generate [OPTIONS] --source-wit-root \u003cSOURCE_WIT_ROOT\u003e --dest-crate-root \u003cDEST_CRATE_ROOT\u003e\n\nOptions:\n  -s, --source-wit-root \u003cSOURCE_WIT_ROOT\u003e                \n  -d, --dest-crate-root \u003cDEST_CRATE_ROOT\u003e                \n  -w, --world \u003cWORLD\u003e                                    \n      --stub-crate-version \u003cSTUB_CRATE_VERSION\u003e          [default: 0.0.1]\n      --wasm-rpc-path-override \u003cWASM_RPC_PATH_OVERRIDE\u003e  \n  -h, --help                                             Print help\n  -V, --version                                          Print version\n```\n\n- `source-wit-root`: The root directory of the component's WIT definition to be called via RPC\n- `dest-crate-root`: The target path to generate a new stub crate to\n- `world`: The world name to be used in the generated stub crate. If there is only a single world in the source root\n  package, no need to specify.\n- `stub-crate-version`: The crate version of the generated stub crate\n- `wasm-rpc-path-override`: The path to the `wasm-rpc` crate to be used in the generated stub crate. If not specified,\n  the latest version of `wasm-rpc` will be used.\n\nThe command creates a new Rust crate that is ready to be compiled with\n\n```shell\ncargo component build --release\n```\n\nThe resulting WASM component implements the **stub interface** corresponding to the source interface, found in the\ntarget directory's\n`wit/stub.wit` file. This WASM component is to be composed together with another component that calls the original\ninterface via WASM RPC.\n\n## Build\n\n```\nUsage: wasm-rpc-stubgen build [OPTIONS] --source-wit-root \u003cSOURCE_WIT_ROOT\u003e --dest-wasm \u003cDEST_WASM\u003e --dest-wit-root \u003cDEST_WIT_ROOT\u003e\n\nOptions:\n  -s, --source-wit-root \u003cSOURCE_WIT_ROOT\u003e                \n      --dest-wasm \u003cDEST_WASM\u003e                            \n      --dest-wit-root \u003cDEST_WIT_ROOT\u003e                    \n  -w, --world \u003cWORLD\u003e                                    \n      --stub-crate-version \u003cSTUB_CRATE_VERSION\u003e          [default: 0.0.1]\n      --wasm-rpc-path-override \u003cWASM_RPC_PATH_OVERRIDE\u003e  \n  -h, --help                                             Print help\n  -V, --version                                          Print version\n```\n\n- `source-wit-root`: The root directory of the component's WIT definition to be called via RPC\n- `dest-wasm`: The name of the stub WASM file to be generated\n- `dest-wit-root`: The directory name where the generated WIT files should be placed\n- `world`: The world name to be used in the generated stub crate. If there is only a single world in the source root\n  package, no need to specify.\n- `stub-crate-version`: The crate version of the generated stub crate\n- `wasm-rpc-path-override`: The path to the `wasm-rpc` crate to be used in the generated stub crate. If not specified,\n  the latest version of `wasm-rpc` will be used. It needs to be an **absolute path**.\n\n## Add stub WIT dependency\n\n```shell\nUsage: wasm-rpc-stubgen add-stub-dependency [OPTIONS] --stub-wit-root \u003cSTUB_WIT_ROOT\u003e --dest-wit-root \u003cDEST_WIT_ROOT\u003e\n\nOptions:\n  -s, --stub-wit-root \u003cSTUB_WIT_ROOT\u003e  \n  -d, --dest-wit-root \u003cDEST_WIT_ROOT\u003e  \n  -o, --overwrite                      \n  -u, --update-cargo-toml                \n  -h, --help                           Print help\n  -V, --version                        Print version\n```\n\nThe command merges a generated RPC stub as a WIT dependency into an other component's WIT root.\n\n- `stub-wit-root`: The WIT root generated by either `generate` or `build` command\n- `dest-wit-root`: The WIT root of the component where the stub should be added as a dependency\n- `overwrite`: This command would not do anything if it detects that it would change an existing WIT file's contents at\n  the destination. With this flag, it can be forced to overwrite those files.\n- `update-cargo-toml`: Enables updating the Cargo.toml file in the parent directory of `dest-wit-root` with the copied\n  dependencies.\n\n## Compose the stub with the caller component\n\n```shell\nUsage: wasm-rpc-stubgen compose --source-wasm \u003cSOURCE_WASM\u003e --stub-wasm \u003cSTUB_WASM\u003e --dest-wasm \u003cDEST_WASM\u003e\n\nOptions:\n      --source-wasm \u003cSOURCE_WASM\u003e  \n      --stub-wasm \u003cSTUB_WASM\u003e      \n      --dest-wasm \u003cDEST_WASM\u003e      \n  -h, --help                       Print help\n  -V, --version                    Print version\n```\n\nThe command composes a caller component's WASM (which uses the generated stub to call a remote worker) with the\ngenerated stub WASM, writing out a composed WASM which no longer depends on the stub interface, ready to use.\n\n- `source-wasm`: The WASM file of the caller component\n- `stub-wasm`: The WASM file of the generated stub. Multiple stubs can be listed.\n- `dest-wasm`: The name of the composed WASM file to be generated\n\n## Initialize cargo make tasks for a workspace\n\n```shell\nUsage: wasm-rpc-stubgen initialize-workspace [OPTIONS] --targets \u003cTARGETS\u003e --callers \u003cCALLERS\u003e\n\nOptions:\n      --targets \u003cTARGETS\u003e\n          List of subprojects to be called via RPC\n      --callers \u003cCALLERS\u003e\n          List of subprojects using the generated stubs for calling remote workers\n      --wasm-rpc-path-override \u003cWASM_RPC_PATH_OVERRIDE\u003e\n```\n\nWhen both the target and the caller components are in the same Cargo workspace, this command can initialize a `cargo-make` file with dependent tasks\nperforming the stub generation, WIT merging and WASM composition.\n\nOnce the workspace is initialized, the following two commands become available:\n\n```shell\ncargo make build-flow\ncargo make release-build-flow\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemcloud%2Fwasm-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolemcloud%2Fwasm-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemcloud%2Fwasm-rpc/lists"}