anyclaw_sdk_channel/lib.rs
1// LIMITATION: No std::env::var in channel/tool binaries
2// Config flows through the initialize handshake (ChannelInitializeParams.options),
3// not through environment variables. Channel and tool binaries must NOT read config
4// from std::env::var because: (1) the supervisor controls the subprocess environment,
5// (2) env vars set on the subprocess are visible in /proc/<pid>/environ, and
6// (3) the initialize handshake provides a typed, validated config path.
7// See also: AGENTS.md §Anti-Patterns
8
9//! Channel SDK for anyclaw.
10//!
11//! Provides the [`Channel`] trait for building messaging integrations and
12//! [`ChannelHarness`] for JSON-RPC stdio framing, handshake, and message routing.
13//!
14//! # Stability
15//!
16//! This crate is **unstable** — APIs may change between releases.
17//! Enums marked `#[non_exhaustive]` will have new variants added; match arms must include `_`.
18#![warn(missing_docs)]
19
20/// Permission request/response oneshot management.
21pub mod broker;
22/// Extract displayable text from agent content values.
23// D-03 boundary: DeliverMessage.content is Value — agent content shape is agent-defined
24#[allow(clippy::disallowed_types)]
25pub mod content;
26/// Error types for channel SDK operations.
27pub mod error;
28/// JSON-RPC stdio harness that drives a [`Channel`] implementation.
29pub mod harness;
30/// Minimal JSON-RPC 2.0 types for the harness (private, avoids internal crate dep).
31// D-03 boundary: params/result/error.data are Value — schemas vary per method
32#[allow(clippy::disallowed_types)]
33mod jsonrpc;
34/// Test wrapper for unit-testing [`Channel`] implementations without JSON-RPC framing.
35pub mod testing;
36/// The [`Channel`] trait that channel authors implement.
37// D-03 boundary: handle_unknown params/return are Value — unknown methods have no schema
38#[allow(clippy::disallowed_types)]
39pub mod trait_def;
40
41pub use anyclaw_sdk_types::{
42 ChannelAckConfig, ChannelCapabilities, ChannelSendMessage, DeliverMessage, PeerInfo,
43};
44pub use broker::PermissionBroker;
45pub use content::content_to_string;
46pub use error::ChannelSdkError;
47pub use harness::ChannelHarness;
48pub use trait_def::Channel;