linesmith_plugin/lib.rs
1//! linesmith-plugin: rhai plugin host for the linesmith status line.
2//!
3//! Construction (`build_engine`) and load-time machinery (discovery,
4//! script compilation, `@data_deps` header parsing, id-collision
5//! detection) live here. The bridge that adapts a [`CompiledPlugin`]
6//! to linesmith-core's `Segment` trait — and the `DataContext` →
7//! `rhai::Map` mirror — lives in `linesmith-core::plugins` so this
8//! crate's public surface stays free of linesmith-domain types.
9//!
10//! Surface contract per ADR-0018: declared deps cross this boundary
11//! as `Vec<String>` (raw header tokens, validated against the
12//! plugin-accessible name set defined by `header::KNOWN_DEPS` per
13//! `docs/specs/plugin-api.md`); the consumer maps strings back to
14//! its own dep enum. `pub use rhai;` lets consumers reach
15//! `rhai::Map` / `Engine` / `Dynamic` via `linesmith_plugin::rhai::*`
16//! without adding rhai as a direct dep — workspace alignment is
17//! still the source of truth for which rhai version compiles together.
18//!
19//! Workspace-internal in v0.1; public surface is free to refactor
20//! without SemVer cost until a publish decision lands.
21
22pub mod discovery;
23pub mod engine;
24pub mod errors;
25pub mod header;
26pub mod registry;
27
28pub use discovery::scan_plugin_dirs;
29pub use engine::build_engine;
30pub use errors::{CollisionWinner, PluginError, ResourceLimit};
31pub use header::{parse_data_deps_header, HeaderError};
32pub use registry::{CompiledPlugin, CompiledPluginParts, PluginRegistry};
33
34/// Re-export rhai so consumers can name `rhai::Map` / `Engine` /
35/// `Dynamic` via `linesmith_plugin::rhai::*` without adding rhai as
36/// a direct dep. Workspace alignment, not this re-export, is the
37/// version pin.
38pub use rhai;