Skip to main content

okbot_peer/
lib.rs

1//! Peers and teams (ADR 0014): okbots that delegate work to each other.
2//!
3//! - [`key`]: each bot's Ed25519 key and the public keys of members and teams.
4//! - [`token`]: signed request and response tokens (`okp1`).
5//! - [`manifest`]: team manifests, their signatures and links.
6//! - [`a2a`]: the A2A subset spoken between members.
7//! - [`Node`]: a bot's peer side, the [`Peers`](okbot_core::Peers) port and one `peer:<team>`
8//!   channel per team that accepts tasks.
9
10pub mod a2a;
11mod channel;
12pub mod external;
13mod inbound;
14pub mod key;
15pub mod manifest;
16mod node;
17mod outbound;
18mod relay;
19pub mod seal;
20pub mod token;
21
22pub use external::{ExternalAgent, ExternalClient, ExternalConfig};
23pub use key::{PublicKey, SigningKey};
24pub use manifest::Manifest;
25pub use node::{ManifestSource, NodeConfig, SIGNATURE_HEADER, TeamConfig, socket_dir, socket_path};
26pub use outbound::Node;
27pub use seal::{BoxKey, BoxPublic};
28
29/// A peer failure.
30#[derive(Debug, thiserror::Error)]
31#[non_exhaustive]
32pub enum Error {
33    /// A key is missing or invalid.
34    #[error("key: {0}")]
35    Key(String),
36    /// A token is invalid.
37    #[error("token: {0}")]
38    Token(String),
39    /// A manifest is invalid, unsigned, expired or older than the one in use.
40    #[error("team manifest: {0}")]
41    Manifest(String),
42    /// A file could not be read or written.
43    #[error("{0}: {1}")]
44    Io(String, #[source] std::io::Error),
45}