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
//! Authoring SDK for `hm` plugins.
//!
//! Plugins build to `cdylib` and target `wasm32-wasip1`. The canonical
//! plugin entry point is the [`register_plugin!`] macro, which wires
//! every capability the plugin implements to the right Extism export.
//!
//! ```ignore
//! use hm_plugin_sdk::*;
//! use hm_plugin_protocol::*;
//!
//! struct MyExec;
//! impl StepExecutor for MyExec {
//! fn run(&self, input: ExecutorInput) -> Result<StepResult, PluginError> {
//! host::log(Level::Info, &format!("running {}", input.step.key));
//! Ok(StepResult { exit_code: 0, committed_snapshot: None, artifacts: vec![] })
//! }
//! }
//!
//! register_plugin!(
//! manifest = PluginManifest {
//! api_version: HM_PLUGIN_API_VERSION,
//! name: "my-exec".into(),
//! version: semver::Version::parse("0.1.0").unwrap(),
//! description: "demo".into(),
//! capabilities: vec![Capability::StepExecutor(StepExecutorSpec {
//! runner: "demo".into(), default: false, step_schema: None,
//! })],
//! required_host_fns: vec!["hm_log".into()],
//! config_schema: None,
//! allowed_hosts: vec![],
//! },
//! executor = MyExec,
//! );
//! ```
// The SDK calls into `extern "ExtismHost"` host functions declared via
// `extism-pdk`'s `host_fn!` macro. Those imports are inherently unsafe FFI,
// so this crate cannot use `#![forbid(unsafe_code)]` the way `hm-plugin-protocol`
// does — the only unsafe blocks live in `host.rs`, gated by an explicit
// module-level allow.
//
// schemars 0.8 pulls older indexmap and wit-bindgen via its transitive tree
// (inherited through hm-plugin-protocol). Keep the same crate-level allows as
// the protocol crate so noisy cargo-group lints don't drown out real issues.
pub use StepExecutor;
pub use *;
pub use LifecycleHook;
pub use OutputFormatter;
pub use ;
// Re-export the PDK so plugin authors don't need to add it as a
// separate dep.
pub use extism_pdk;