phi_ext/lib.rs
1//! Rust author SDK for [Phi] PXB extensions — a faithful port of the Go SDK
2//! under `ext/go`.
3//!
4//! Two layers, mirroring the Go module:
5//!
6//! - [`pxb`]: the binary wire protocol (frames, tagged fields, message codecs)
7//! - [`phi`]: the author-facing API ([`phi::Extension`]) that speaks PXB over
8//! stdin/stdout
9//!
10//! The only external dependencies are `serde`/`serde_json` at the JSON edges
11//! (tool schemas, confirm payloads) plus `tokio` (`rt` feature) to drive async
12//! tool handlers; the wire format itself needs no reflection, so the PXB
13//! codecs stay hand-rolled and lean.
14//!
15//! # Example
16//!
17//! ```no_run
18//! use phi_ext::{phi, pxb};
19//!
20//! fn main() -> Result<(), phi::Error> {
21//! let mut m = phi::Extension::new("hello", "0.1.0");
22//! m.register_command(
23//! "hello",
24//! phi::Command::new("Say hi", |_args, ctx| {
25//! ctx.notify("info", "Hello!");
26//! Ok(())
27//! }),
28//! );
29//! m.subscribe(pxb::Event::SessionStart, |_ev| {});
30//! m.run()
31//! }
32//! ```
33//!
34//! [Phi]: https://github.com/pulseaiclub/phi
35
36pub mod phi;
37pub mod pxb;