| Crates.io | posemesh-compute-node-runner-api |
| lib.rs | posemesh-compute-node-runner-api |
| version | 0.1.2 |
| created_at | 2025-10-17 04:57:24.821468+00 |
| updated_at | 2025-10-31 03:14:18.964781+00 |
| description | Runner trait + ports + shared types (no HTTP). |
| homepage | |
| repository | https://github.com/aukilabs/prompting |
| max_upload_size | |
| id | 1887131 |
| size | 40,086 |
posemesh-compute-node-runner-api defines the narrow contract between the compute node
engine and capability-specific runners. The crate is intentionally tiny: it
contains no HTTP clients or storage logic, just the traits and data models a
runner needs in order to receive work, download inputs, and upload artifacts.
types.rs — serde-friendly structs mirroring the DMS lease envelope and task
specification (LeaseEnvelope, TaskSpec).runner.rs — async traits that make up the runner interface:
Runner, TaskCtx, InputSource, ArtifactSink, ControlPlane, and
helpers like MaterializedInput.CRATE_NAME — a stable identifier used by workspace smoke tests to assert
that every crate was compiled and linked.Runner — implement capability() and run() to register your capability.TaskCtx — passed to run(), bundles the current lease, an input source,
an artifact sink, and a control-plane for cancellation/progress.InputSource — abstraction over fetching CIDs from domain storage; comes with
helpers to materialize CIDs to temp files.ArtifactSink — abstraction over uploading result artifacts; supports bytes,
files, and optional multipart streaming.ControlPlane — lets runners observe cancellation and push progress / log
events that will get relayed via heartbeats.use anyhow::Result;
use async_trait::async_trait;
use posemesh_compute_node_runner_api::{Runner, TaskCtx};
use serde_json::json;
struct HelloRunner;
#[async_trait]
impl Runner for HelloRunner {
fn capability(&self) -> &'static str {
"/examples/hello/v1"
}
async fn run(&self, ctx: TaskCtx<'_>) -> Result<()> {
let lease = ctx.lease;
ctx.ctrl.progress(json!({ "status": "started" })).await?;
let bytes = ctx.input.get_bytes_by_cid(&lease.task.inputs_cids[0]).await?;
ctx.output.put_bytes("outputs/hello.bin", &bytes).await?;
ctx.ctrl.progress(json!({ "status": "finished" })).await?;
Ok(())
}
}
cargo test -p posemesh-compute-node-runner-api exercises trait object safety and serde
round-trips of the contract types.no_std-out-of-scope by design; runner implementers are expected
to depend on Tokio and friends via their own crates.