ahp-types 0.5.2

Wire protocol types for the Agent Host Protocol (AHP).
Documentation

ahp-types

Wire protocol types for the Agent Host Protocol (AHP).

crates.io docs.rs

Rust types for every message, action, command, and state object defined by the AHP specification. All types implement Serialize + Deserialize and use the same JSON field names as the wire format.

Modules

Module Contents
state RootState, SessionState, tool-call lifecycle, terminal state
actions StateAction discriminated union and ActionEnvelope
commands Command params and result types
notifications Protocol notifications
messages JSON-RPC wire envelopes
errors AHP and JSON-RPC error codes
version Protocol version constants

Usage

[dependencies]
ahp-types = "0.1"
serde_json = "1"
use ahp_types::actions::{ActionEnvelope, StateAction};

let json = r#"{
  "channel": "ahp-session:/s1",
  "action": { "type": "session/titleChanged", "title": "Hi" },
  "serverSeq": 7,
  "origin": null
}"#;
let env: ActionEnvelope = serde_json::from_str(json).unwrap();
match env.action {
    StateAction::SessionTitleChanged(a) => println!("title: {}", a.title),
    _ => {}
}

See also