car-a2a 0.7.0

Bridge between Common Agent Runtime and the Linux Foundation Agent2Agent (A2A) v1.0 protocol
Documentation
//! A2A bridge for the Common Agent Runtime.
//!
//! Exposes a CAR runtime to the Linux Foundation Agent2Agent (A2A) v1.0
//! protocol so peer agents — built on any A2A-compliant SDK (Python,
//! JS, Java, Go, .NET, Rust) — can discover the runtime via an Agent
//! Card and submit work as A2A Tasks.
//!
//! ## Mapping
//!
//! | A2A | CAR |
//! |-----|-----|
//! | Agent Card | Manifest of registered tools, plus host metadata |
//! | Task | One-shot wrapper around an `ActionProposal` |
//! | Message (parts) | Free-form input from the peer; structured parts become proposal `context` |
//! | Artifact | One per `ActionResult` returned by the runtime |
//! | TaskState SUBMITTED/WORKING/COMPLETED/FAILED | Lifecycle of the proposal execution |
//!
//! ## What this crate is
//!
//! A *bridge* — not a full A2A SDK. It implements:
//!
//! - JSON-RPC 2.0 dispatch for 9 of the 11 spec methods.
//! - SSE streaming via `GET /a2a/stream/:task_id` (in lieu of
//!   `message/stream` and `tasks/resubscribe`).
//! - Push-notification webhook delivery on every state transition.
//! - Cancellation via `tokio::task::JoinHandle::abort()`.
//! - An Axum [`serve`] helper plus [`build_router`] for embedders
//!   that already run their own HTTP server.
//!
//! gRPC and the REST binding are out of scope for this drop.
//!
//! ## What this crate is not
//!
//! - Not a client. CAR speaks A2A *as a remote agent*, not as a caller.
//!   For outbound calls, use one of the upstream Rust crates
//!   (`a2a-protocol-client`, `a2a-client`).
//! - Not authenticated. The default listener has no auth — fine
//!   behind a reverse proxy, not for direct internet exposure.

pub mod auth;
pub mod bridge;
pub mod card;
pub mod client;
pub mod events;
pub mod http;
pub mod push;
pub mod server;
pub mod signing;
pub mod store;
pub mod types;

pub use auth::{ApiKeyHeaderAuth, AuthError, AuthValidator, BearerKeyAuth, NoAuth};
pub use bridge::{
    a2a_state_for, a2ui_envelopes_from_artifact, action_results_to_artifacts, message_to_proposal,
    short_id, ProposalBuildError,
};
pub use card::{build_default_agent_card, AgentCardConfig};
pub use client::{A2aClient, ClientAuth, ClientError};
pub use events::{EventBus, StreamEvent, TaskArtifactUpdateEvent, TaskStatusUpdateEvent};
pub use http::{build_router, build_router_with_auth, serve, serve_with_auth};
pub use push::PushDispatcher;
pub use server::{A2aDispatcher, A2aRpcError, AgentCardSource};
pub use signing::{sign_agent_card, verify_agent_card, CardSigner, SigningError};
pub use store::{AbortRegistry, InMemoryTaskStore, TaskRecord, TaskStore};
pub use types::{
    AgentCapabilities, AgentCard, AgentInterface, AgentProvider, AgentSkill, Artifact, FilePart,
    GetTaskParams, ListTasksParams, ListTasksResult, Message, MessageRole, Part,
    PushNotificationConfig, PushNotificationConfigParams, SecurityRequirement, SecurityScheme,
    SendMessageParams, SendMessageResult, StringList, Task, TaskState, TextPart, TransportProtocol,
};