miyabi_a2a/lib.rs
1//! Miyabi A2A - Agent-to-Agent Task Storage and Communication
2//!
3//! This crate provides task storage and communication infrastructure
4//! for agent-to-agent (A2A) collaboration in the Miyabi framework.
5
6#![allow(clippy::result_large_err)]
7//!
8//! # Overview
9//!
10//! A2A enables multiple agents to coordinate work by sharing tasks through
11//! a persistent storage backend. The primary implementation uses GitHub Issues
12//! as the storage layer, providing:
13//!
14//! - Natural task visualization (github.com UI)
15//! - Built-in authentication and access control
16//! - Webhook integration for real-time updates
17//! - No additional infrastructure required
18//!
19//! # Examples
20//!
21//! ```no_run
22//! use miyabi_a2a::{GitHubTaskStorage, TaskStorage, A2ATask, TaskStatus, TaskType};
23//! use chrono::Utc;
24//!
25//! #[tokio::main]
26//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
27//! // Create storage backend
28//! let storage = GitHubTaskStorage::new(
29//! std::env::var("GITHUB_TOKEN")?,
30//! "owner".to_string(),
31//! "repo".to_string(),
32//! )?;
33//!
34//! // Create a new task
35//! let task = A2ATask {
36//! id: 0, // Will be assigned by storage
37//! title: "Implement feature X".to_string(),
38//! description: "Details...".to_string(),
39//! status: TaskStatus::Submitted,
40//! task_type: TaskType::CodeGeneration,
41//! agent: None,
42//! context_id: Some("project-123".to_string()),
43//! priority: 3,
44//! retry_count: 0,
45//! created_at: Utc::now(),
46//! updated_at: Utc::now(),
47//! issue_url: String::new(),
48//! };
49//!
50//! // Save task
51//! let task_id = storage.save_task(task).await?;
52//! println!("Created task #{}", task_id);
53//!
54//! // Retrieve task
55//! if let Some(task) = storage.get_task(task_id).await? {
56//! println!("Task: {}", task.title);
57//! }
58//!
59//! Ok(())
60//! }
61//! ```
62
63pub mod error;
64pub mod storage;
65pub mod task;
66pub mod types;
67
68// RPC modules for push notification configuration
69pub mod rpc;
70
71// gRPC server and protocol buffers (Phase 3) - optional
72#[cfg(feature = "grpc")]
73pub mod grpc;
74
75// Authentication and authorization (Phase 3)
76pub mod auth;
77
78// HTTP REST API server for dashboard (optional)
79#[cfg(feature = "http")]
80pub mod http;
81
82// Re-export main types
83pub use error::{A2AError, A2AResult};
84pub use storage::{
85 cursor::{CursorError, Direction, PaginatedResult, PaginationCursor},
86 github::GitHubTaskStorage,
87 StorageError, TaskFilter, TaskStorage, TaskUpdate,
88};
89pub use task::{A2ATask, TaskStatus, TaskType};
90
91// Re-export RPC types (Issue #274, #276, #277)
92pub use rpc::push_notification::{
93 generate_webhook_signature, send_push_notification, PushNotificationPayload, WebhookConfig,
94};
95pub use rpc::push_notification_config::{
96 ConfigStorage, MemoryConfigStorage, PushNotificationConfig,
97};