1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! 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
//!
//! - [`BindingContext`] — identifies the inbound binding a tool
//! call originated from. Microapps read it from
//! `params._meta.nexo.binding`.
//! - [`InboundMessageMeta`] — per-turn metadata about the inbound
//! message that triggered the agent turn (sender id, msg id,
//! timestamp, …). Microapps read it from
//! `params._meta.nexo.inbound`.
//! - [`build_meta_value`] / [`parse_binding_from_meta`] /
//! [`parse_inbound_from_meta`] — the inverse trio around the
//! dual-write `_meta` payload.
//! - [`WebhookEnvelope`] — JSON envelope nexo publishes to NATS
//! after every accepted webhook request.
//! - [`format_webhook_source`] — Phase 72 turn-log marker
//! helper.
//!
//! # 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"));
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;