1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Federation channel — stub for connecting multiple agentic-assistant instances.
//!
//! ## Wire Protocol Design (not yet implemented)
//!
//! Federation allows multiple agentic-assistant instances to discover each
//! other's agents and relay messages between them. The protocol works as follows:
//!
//! ### Discovery
//! - Peers discover each other's agents via `GET /api/federation/agents`
//! - Response: `[{ "name": "Atlas", "personality": "...", "model": "..." }, ...]`
//! - Remote agents appear as delegation targets in the local instance
//!
//! ### Message Relay
//! - Messages forwarded via `POST /api/federation/relay`
//! - Request body:
//! ```json
//! {
//! "agent": "Atlas",
//! "message": "What is the weather?",
//! "namespace": "federation:<peer>:<session_id>",
//! "source_peer": "peer-name",
//! "source_agent": "CodeBot"
//! }
//! ```
//! - Response: the agent's reply, streamed or buffered
//!
//! ### Authentication
//! - Shared secret: `Authorization: Bearer <shared_secret>`
//! - Per-peer API keys for fine-grained access control
//! - Mutual TLS optional for high-security deployments
//!
//! ### Agent Visibility
//! - Each peer exposes its agent list so remote agents appear as delegation targets
//! - The `DelegateToAgentTool` can be extended to support `peer:agent` syntax
//! - Federation config controls which local agents are visible to peers
/// Stub for the federation channel. Will be implemented in a future release.
///
/// When implemented, `FederationChannel` will:
/// - Connect to peer instances via HTTP/WebSocket
/// - Expose local agents to remote peers
/// - Route delegated tasks to remote agents
/// - Maintain heartbeats and peer health tracking