anyclaw_sdk_service/lib.rs
1// LIMITATION: No std::env::var in service binaries
2// Config flows through the initialize handshake (ServiceInitializeParams.options),
3// not through environment variables. Service 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//! Service SDK for anyclaw.
10//!
11//! Provides the [`Service`] trait for building infrastructure service extensions
12//! and [`ServiceHarness`] for JSON-RPC stdio framing and method dispatch.
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/// Error types for service SDK operations.
21pub mod error;
22/// JSON-RPC stdio harness that drives a [`Service`] implementation.
23// D-03 boundary: initialize params/result contain service-defined options and installation data.
24#[allow(clippy::disallowed_types)]
25pub mod harness;
26// D-03 boundary: JSON-RPC wire types use serde_json::Value for extensible params/result/data.
27#[allow(clippy::disallowed_types)]
28mod jsonrpc;
29/// The [`Service`] trait that service authors implement.
30// D-03 boundary: handle_unknown params/return are Value — unknown methods have no schema
31#[allow(clippy::disallowed_types)]
32pub mod trait_def;
33/// Types for the service initialize handshake and health reporting.
34// D-03 boundary: options and installation values are service-defined, no fixed schema.
35#[allow(clippy::disallowed_types)]
36pub mod types;
37
38pub use error::ServiceSdkError;
39pub use harness::ServiceHarness;
40pub use trait_def::Service;
41pub use types::*;