turul-a2a 0.2.7

A2A Protocol v1.0 server framework
Documentation
//! A2A Protocol v1.0 server framework.
//!
//! `turul-a2a` provides the server side of the [A2A
//! Protocol](https://github.com/a2aproject/A2A): a typed
//! [`executor::AgentExecutor`] trait, HTTP + JSON-RPC transports, Server-Sent
//! Events streaming, and a storage abstraction with four backends
//! (in-memory, SQLite, PostgreSQL, DynamoDB) — all proto-normative per
//! `proto/a2a.proto`.
//!
//! # Quick start
//!
//! See the `examples/echo-agent` crate for a runnable end-to-end example.
//! A minimal executor implements [`executor::AgentExecutor`] and is passed to
//! [`A2aServer::builder()`]:
//!
//! ```text
//! let server = A2aServer::builder()
//!     .executor(MyExecutor)
//!     .bind(([0, 0, 0, 0], 3000))
//!     .build()?;
//! server.run().await?;
//! ```
//!
//! # Feature flags
//!
//! - `in-memory` (default) — volatile in-process storage
//! - `sqlite` — SQLx SQLite backend (atomic task+event writes)
//! - `postgres` — SQLx PostgreSQL backend
//! - `dynamodb` — AWS DynamoDB backend with TTL
//! - `compat-v03` — opt-in compatibility shim for a2a-sdk 0.3.x clients
//!   (method name normalization, root POST route, optional `A2A-Version`
//!   header). Canonical builds are v1.0 strict.
//!
//! # Durable event coordination
//!
//! Task state and streaming events are written atomically via
//! [`storage::A2aAtomicStore`]. The in-process event broker is a local
//! wake-up signal; the storage backend is the source of truth. Both
//! streaming RPCs open with the `Task` snapshot and then deliver only events
//! committed after it, across instances when the same backend is used
//! (e.g., shared DynamoDB or PostgreSQL). A client that loses its stream
//! subscribes again and receives a fresh snapshot. Subscribing to an already-terminal task returns
//! `UnsupportedOperationError` per A2A v1.0 §3.1.6 — use [`storage`] or
//! `GetTask` to retrieve the final state.
//!
//! # Multi-instance streaming
//!
//! The in-process [`streaming`] broker fans out to clients on the same
//! process only. Cross-instance streaming relies on the shared durable event
//! store. For horizontally scaled deployments, configure all
//! instances against the same backend.

mod capability;
pub mod card_builder;
#[cfg(feature = "compat-v03")]
pub mod compat_v03;
pub mod durable_executor;
pub mod error;
pub mod event_sink;
pub mod executor;
#[cfg(feature = "grpc")]
pub mod grpc;
pub mod jsonrpc;
pub mod middleware;
pub mod prelude;
#[doc(hidden)]
pub mod profile_dispatch;

/// Stable adopter-facing constants for A2A profile extensions
/// implemented in this crate. The underlying dispatcher lives in
/// `profile_dispatch` (kept doc-hidden because its parse/validate
/// helpers are internal plumbing for the router / JSON-RPC / gRPC
/// transports). Re-export new profile URIs and header names here as
/// further profiles are added.
pub mod profiles {
    pub use crate::profile_dispatch::{
        A2A_EXTENSIONS_HEADER, SKILL_ID_METADATA_KEY, SKILL_INVOCATION_PROFILE_V1,
        SKILL_PARAMS_METADATA_KEY,
    };
}
pub mod push;
pub mod router;
pub mod server;
pub mod storage;
pub mod streaming;

pub use server::{A2aServer, BoundA2aServer};