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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! 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`] — 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"));
//! ```
/// 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.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// TypeScript bindings codegen: types tagged
// `#[cfg_attr(feature = "ts-export", derive(ts_rs::TS), ts(export))]`
// auto-generate one test per type via the `ts_rs::TS` derive macro.
// Running `cargo test --features=ts-export -p nexo-tool-meta` triggers
// every test, which writes per-type `.ts` files into the directory
// pointed at by `TS_RS_EXPORT_DIR` (or `./bindings` by default). The
// wrapper script `proyecto/scripts/regen-ts-types.sh` sets the env
// var to point at agent-creator-microapp's frontend api/ directory
// and concatenates the per-type files into a single `types.gen.ts`
// with a banner header.
//
// Production builds (no `ts-export` feature) skip the derive
// entirely — zero runtime impact.