Skip to main content

hm_plugin_protocol/
lib.rs

1//! Wire-level types shared between the `hm` binary and `hm` plugins.
2//!
3//! This crate is pure data: serde structs, enums, and the
4//! [`HM_PLUGIN_API_VERSION`] constant. It has no runtime — no async,
5//! no Extism, no Tokio. Bumping `HM_PLUGIN_API_VERSION` is the explicit
6//! signal that the wire format changed and plugins must be rebuilt.
7
8#![forbid(unsafe_code)]
9// schemars 0.8 pulls older indexmap and wit-bindgen via its transitive tree.
10// We can't fix that without bumping schemars itself; allow at crate scope so
11// the noisy cargo-group lints don't drown out real issues.
12#![allow(clippy::multiple_crate_versions, clippy::cargo_common_metadata)]
13
14pub mod error;
15pub mod events;
16pub mod executor;
17pub mod hook;
18pub mod host_abi;
19pub mod ir;
20pub mod manifest;
21pub mod subcommand;
22
23pub use error::{ExitInfo, PluginError};
24pub use events::{BuildEvent, PlanSummary, StdStream};
25pub use executor::{ArchiveId, ArtifactRef, CacheDecision, ExecutorInput, SnapshotRef, StepResult};
26pub use hook::{HookEvent, HookEventKind, HookOutcome, HookPhase};
27pub use host_abi::{
28    ArchiveReadArgs, CallbackData, DockerCommitArgs, DockerExecArgs, DockerExtractArgs,
29    DockerStartArgs, KeyringArgs, KeyringSetArgs, KvScope, Level, LoopbackHandle, LoopbackRecvArgs,
30    SocketHandle, SocketReadArgs, SocketWriteArgs, TtyConfirmArgs, TtyPromptArgs,
31};
32pub use ir::{Cache, CommandStep, Pipeline, Step, WaitStep};
33pub use manifest::{
34    Capability, ClapJson, JsonSchema, LifecycleHookSpec, OutputFormatterSpec, PluginManifest,
35    StepExecutorSpec, SubcommandSpec,
36};
37pub use subcommand::SubcommandInput;
38
39/// Wire-format version. Plugins whose manifest reports a different
40/// version are rejected at load time. Bump when adding *any* new
41/// required field to any wire-level struct.
42pub const HM_PLUGIN_API_VERSION: u32 = 1;