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
//! Plugin runtime bridge layer.
//!
//! The rhai-pure plugin host (engine construction, discovery,
//! registry, `@data_deps` header parsing, error types) lives in
//! [`linesmith_plugin`] per ADR-0018 / ADR-0020 — consumers reach
//! those types from that crate directly, not through this module.
//! What lives here is the consumer-side bridge: the
//! [`RhaiSegment`] adapter that lets compiled plugins implement the
//! `Segment` trait, the [`build_ctx`] `DataContext` → `rhai::Map`
//! mirror, [`validate_return`] which decodes a plugin's `rhai::Map`
//! into a [`crate::segments::RenderedSegment`], and the
//! [`build_engine`] wrapper that installs a `LINESMITH_LOG`-respecting
//! warn emitter before delegating to [`linesmith_plugin::build_engine`].
pub use build_ctx;
pub use validate_return;
pub use RhaiSegment;
/// Build the rhai plugin engine with linesmith-core's logger wired
/// as the host's warn emitter, so plugin `log()` output respects
/// `LINESMITH_LOG`. Wraps [`linesmith_plugin::build_engine`].
///
/// Every entry point that builds a plugin engine via linesmith-core
/// (CLI driver, library `run` / `run_with_*` family, doctor,
/// `runtime::plugins::load_plugins`) installs the emitter before
/// the first render. Direct consumers of
/// [`linesmith_plugin::build_engine`] skip this bridge by design —
/// that's the documented entry point for embedders who don't want
/// linesmith-core's logger.
/// One-shot install that bridges plugin `log()` output through
/// `crate::logging::emit` so `LINESMITH_LOG` gates plugin
/// diagnostics. Called from [`build_engine`] so every entry point
/// that builds an engine via this crate picks up the bridge before
/// the first render.