What it brings
The one wire contract between any Weirdnet extension host and its extensions, weirdnet.ext.v1, with tonic
client and server stubs. App-specific services (such as Morph's morph.ext.v1) ride inside it as bytes, so the
contract is the same for every app. protoc is bundled; nothing to install.
What it is
The wire contract for Weirdnet extensions: lifecycle, handshake, capabilities, logging and health. App-specific services travel inside it as prost-encoded bytes. It lives in the weirdnet-ext repository.
How it works
The host serves Host on the private socket it made for the extension:
Handshake: the one-time token, the extension id and the API version.Events(a server stream): stop, grant changes, pings and app events.Call: an app service and method with a prost-encoded payload, checked against the grants.LogandHealth.
Constants: API_VERSION (1), the environment variables the host sets (WEIRDNET_EXT_SOCKET,
WEIRDNET_EXT_FD, WEIRDNET_EXT_TOKEN, WEIRDNET_EXT_ID) and the
x-weirdnet-session header. The schema is proto/weirdnet/ext/v1/ext.proto. Hosts use
weirdnet-ext; extensions use weirdnet-ext-sdk.
Key types and modules
v1: the generated messages and theHostservice (client and server).API_VERSION,ENV_SOCKET,ENV_FD,ENV_TOKEN,ENV_ID,SESSION_HEADER.
Feature flags
None: everything is on by default.
Usage
In Cargo.toml:
[dependencies]
weirdnet-ext-proto = "0.1.1"Then (built and run against the published crate when this page was made):
// The contract's constants: how a host hands an extension its socket and one-time token.
use weirdnet_ext_proto::{API_VERSION, ENV_SOCKET, ENV_TOKEN, v1};
fn main() {
println!("weirdnet.ext.v1, API {API_VERSION}: socket in ${ENV_SOCKET}, token in ${ENV_TOKEN}");
let cap = v1::Capability { name: "storage".into(), patterns: vec![] };
println!("{cap:?}");
}
Where it fits
- Used by weirdnet-ext, weirdnet-ext-sdk.
- License: BSD-3-Clause.