Skip to main content

Crate nexo_tool_meta

Crate nexo_tool_meta 

Source
Expand description

Wire-shape types shared between the Nexo agent runtime and any third-party microapp that consumes its events.

Provider-agnostic by construction: no transport layer (no axum, no tokio), no broker, no agent runtime. Pulling this crate in is a four-dependency, sub-second compile and exposes only the data shapes a downstream consumer needs to read what the daemon emits.

§What lives here

§Round-trip example

use nexo_tool_meta::{build_meta_value, parse_binding_from_meta, BindingContext};
use uuid::Uuid;

// Daemon side: build the `_meta` payload for a tool call.
let mut binding = BindingContext::agent_only("ana");
binding.channel = Some("whatsapp".into());
binding.account_id = Some("personal".into());
binding.binding_id = Some("whatsapp:personal".into());
let meta = build_meta_value("ana", Some(Uuid::nil()), Some(&binding), None);

// Microapp side: extract the binding back.
let parsed = parse_binding_from_meta(&meta).unwrap();
assert_eq!(parsed.channel.as_deref(), Some("whatsapp"));
assert_eq!(parsed.binding_id.as_deref(), Some("whatsapp:personal"));

Re-exports§

pub use admin::audit::AdminAuditResult;
pub use admin::audit::AdminAuditRow;
pub use admin::audit::AuditTailFilter;
pub use admin::audit::AuditTailPage;
pub use binding::binding_id_render;
pub use binding::BindingContext;
pub use event_source::format_dispatch_source;
pub use event_source::format_event_subscriber_source;
pub use event_source::format_rate_limit_hit;
pub use event_source::EventSourceMeta;
pub use inbound::InboundKind;
pub use inbound::InboundMessageMeta;
pub use locale::LangCode;
pub use locale::Locale;
pub use locale::LocaleParseError;
pub use locale::RegionCode;
pub use meta::build_meta_value;
pub use meta::parse_binding_from_meta;
pub use meta::parse_inbound_from_meta;
pub use meta::BINDING_KEY;
pub use meta::INBOUND_KEY;
pub use meta::META_KEY;
pub use meta::NEXO_NAMESPACE;
pub use microapp_error::MicroappError;
pub use microapp_error::MicroappErrorKind;
pub use microapp_error::MICROAPP_ERROR_NOTIFY_METHOD;
pub use template::render_template;
pub use template::MISSING_PLACEHOLDER;
pub use webhook::format_webhook_source;
pub use webhook::WebhookEnvelope;
pub use webhook::ENVELOPE_SCHEMA_VERSION;

Modules§

admin
Admin RPC wire-shape types.
binding
BindingContext — the (channel, account_id, agent_id, session_id, binding_id) tuple stamped on every tool call so a downstream microapp knows which inbound binding the call originated from.
event_source
EventSourceMeta — typed metadata describing the NATS subject + envelope that triggered an agent turn via the event-subscriber pipeline.
http_server
HTTP server capability wire shapes.
inbound
InboundMessageMeta — per-turn metadata about the inbound message that triggered an agent turn. Stamped under _meta.nexo.inbound (peer of _meta.nexo.binding).
locale
Locale validation. Lives here (rather than in nexo-microapp-sdk) so nexo-config can consume the closed-enum validator at YAML deserialise time. SDK still re-exports for back-compat. BCP-47 locale subset for agent language configuration.
marketing
marketing wire types for the nexo-rs-extension-marketing extension + agent-creator microapp.
meta
Helpers around the _meta payload nexo emits on every tool call. The wire shape is dual-write:
microapp_error
nexo/notify/microapp_error wire shape.
reply_kind
OutboundReplyKind — channel-agnostic shape for what the agent is about to send back on the wire.
template
Minimal mustache-lite template renderer.
voice_addenda
Per-locale system-prompt addenda + voice picker tables.
webhook
WebhookEnvelope — the JSON payload nexo publishes to NATS after a webhook source verifies and parses an inbound HTTP request.