Docs / Plugins Build
Creating a Plugin
Build your first extension: an observer plus a tool, wired into a custom ekos binary.
# Cargo.toml of your crate
[dependencies]
ekos = { path = "../EKOS/ekos/crates/cli" }
ekos-observation-sdk = { path = "../EKOS/ekos/crates/observation-sdk" }
async-trait = "0.1"
use async_trait::async_trait;
use ekos::extension::EkosExtension;
use ekos_compiler_core::EkosConfig;
use ekos_observation_sdk::Observer;
struct MyExt;
#[async_trait(?Send)]
impl EkosExtension for MyExt {
fn name(&self) -> &'static str { "my-extension" }
fn logic_version(&self) -> u32 { 1 } // bump when observer output changes
fn observers(&self, _config: &EkosConfig) -> Vec<Box<dyn Observer>> {
vec![Box::new(MyObserver)]
}
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// The public binary does exactly this with `Extensions::none()`.
ekos::app::main_with(ekos::extension::Extensions::new(vec![std::sync::Arc::new(MyExt)])).await
}
MyObserver implements Observer (Source Plugins). The signatures above are the source of truth in ekos/crates/cli/src/extension.rs and app.rs.
Checklist
- Implement the trait(s); keep observers and passes deterministic.
- Register any new
Customkinds inekos_kir::custom_kinds::REGISTRY. - Redact content you read.
- Write tests before implementation; run
cargo clippy -- -D warningsandcargo fmt --check. - If it is a substantial feature, write an RFC first.