omegon-extension
Safe, versioned SDK for building Omegon extensions.
Extensions run as isolated processes communicating via JSON-RPC over stdin/stdout. An extension crash never crashes the host agent.
Usage
[dependencies]
omegon-extension = "0.15"
use omegon_extension::{Extension, serve};
use serde_json::{json, Value};
#[derive(Default)]
struct MyExtension;
#[async_trait::async_trait]
impl Extension for MyExtension {
fn name(&self) -> &str { "my-extension" }
fn version(&self) -> &str { env!("CARGO_PKG_VERSION") }
async fn handle_rpc(&self, method: &str, params: Value) -> omegon_extension::Result<Value> {
match method {
"get_tools" => Ok(json!([])),
_ => Err(omegon_extension::Error::method_not_found(method)),
}
}
}
#[tokio::main]
async fn main() {
serve(MyExtension::default()).await.unwrap();
}
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.