weirdnet-backends-0.1.2 has been yanked.
weirdnet-backends
The Weirdnet model-node wrapper. A model node runs models and takes requests, like a llama.cpp or vLLM server (it can even be one: a stock server it only wraps). This crate starts and stops the engines and serves them to inference nodes; what to load is always the caller's decision.
EngineConfig/ModelLaunch: howllama-serverandvllm serveare launched (loopback only, random port, per-process API key in the environment) and probed.Wrapattaches to a stock OpenAI-compatible server on loopback without owning it.Supervisor: load and unload with draining, swap groups (loading one model of a group unloads the others), idle unload, crash restarts with exponential backoff and crash-loop detection,SupervisorEvents, per-model logs; chat, completion and embedding forwarding.ChunkDecoder/ToolCalls: OpenAI server-sent events decoded intoChunks (text, reasoning, tool-call fragments, finish reason and usage).ModelHost: aweirdnet-agent0.4InferHostserving raw infer/2 from the supervisor's models. Cancel aborts the engine request; assistant prefixes continue (resume); draining refuses new requests.
use Arc;
use ;
let chat = new;
let sup = new;
sup.load.await?;
let host = new; // serve with weirdnet_agent::remote::infer::v2::serve
The node feature: /weirdnet-backends/node/1
How inference nodes drive model nodes over weirdnet-net.
- Capability records, pushed to every subscriber: hardware and memory budget
(
weirdnet-modelhw), engines, every configured model (state, revision, quantization, context and slot limits, load-time estimate, measured prefill/decode speed and time to first token), load (queued, active, slots, in flight), warm prefix hashes, swap groups, draining, whether the node takes group jobs and its private links (NodeService::set_links,link::local_links: address, class, interface, nominal and declared speed; public and CGNAT addresses are never advertised). Each is signed by the node key, chained to the user by itsNodeCert, carries an increasing sequence number and expires after 90 s; it is refreshed every 15 s and on every change.Verifierchecks the signature, the signer, the expiry and the user's certificate, and withVerifier::with_rosterthat the node is still linked (a revoked node's record is refused even with its old certificate);Subscriptionalso rejects sequence numbers that go backwards. - Commands:
Load(withforcefor a crash loop),Unload,Drain(stop admissions and wait for requests under way, or resume),GroupUp/GroupDown,Health. Cross-machine swap groups (a Ray worker, anrpc-serveron a private link) are started by the application'sGroupWorkers; without one a node answersUnsupportedand advertisesgroup_jobs: false. NodeServer::startserves node/1 and raw inference on/weirdnet-backends/infer/1(RAW_INFER_PROTOCOL, the infer/2 framing) and, for 0.1.0 inference nodes, on/weirdnet-agent/infer/2;NodeServer::start_with(.., NodeServerOptions::default().with_legacy_infer2(false))leaves infer/2 free for a node that is also an inference node. Inference nodes wrap their model-node dialer inRawInferDialer, which tries the new id and falls back to infer/2. It announcesweirdnet-backends-nodewith the protocols served;NodeService::withdrawends subscriptions when the node leaves.NodeClientis the inference node's side, over anyweirdnet-agentDialer.- Who may drive a model node is an
Authorizehook;weirdnet_agent::serve::RosterAuthadmits the user's linked devices.
Platforms
| Linux | macOS | Windows | |
|---|---|---|---|
| llama.cpp | yes | yes | yes |
| vLLM | yes | no (vLLM is Linux-only) | no |
| Graceful stop (SIGTERM, then SIGKILL after a grace period) | yes | yes | no: killed outright |
| Engine in its own process group (children stopped too) | yes | yes | no |
| Engine dies with the node process | yes (PR_SET_PDEATHSIG) |
no | no |
node feature |
yes | yes | yes |
The Unix-only pieces are behind cfg(unix); the library builds everywhere.
Tests
The adapter tests run against a mock engine (the test binary re-executes itself as a fake
llama-server/vllm serve), never a real one. tests/node.rs runs node/1 and raw infer/2
between in-process weirdnet-net nodes on the memory transport.