nexo-microapp-sdk
Reusable runtime helpers for Phase 11 stdio microapps consuming the Nexo daemon.
Replaces the ~200 LOC of boilerplate every microapp would
otherwise rewrite (JSON-RPC line loop, dispatch table,
_meta.nexo.binding parsing, hook outcome serialisation,
tracing setup).
Install
[]
= "0.1"
Optional features:
outbound— opt-inctx.outbound()accessor fornexo/dispatchcalls (requires daemon ≥ Phase 82.3.b; v0 ships a stub that returnsDispatchError::Transport).test-harness—MicroappTestHarnessfor#[cfg(test)]consumption.webhook— reserved for futureWebhookEnvelopeparsing on NATS subjects.
Quick start
use ;
use json;
async
async
What's inside
Microapp— chained builder (with_tool,with_hook,on_initialize,on_shutdown,run_stdio).ToolCtx— handler context withbinding()accessor parsed from_meta.nexo.binding(provider-agnostic; works for whatsapp / telegram / email / event-subscriber inbounds).ToolReply— typed wire shape (ok(text),ok_json(value),empty()).ToolError— typed error enum mapped to JSON-RPC error codes (-32601, -32602, -32000).HookOutcome—Continue/Abort { reason }forbefore_message/before_tool_call/ etc. hooks.init_logging_from_env(crate_name)— env-var-driventracing-subscribersetup.
Testing
With the test-harness feature:
License
Licensed under either Apache-2.0 or MIT at your option.