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
//! Agent context module - Foundation layer extensions
//!
//! This module provides extensions to the kernel's CoreAgentContext.
//! Following microkernel architecture principles:
//!
//! - **Kernel Layer**: CoreAgentContext with basic primitives (K/V store, interrupt, event bus)
//! - **Foundation Layer**: Extended functionality through composition
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────┐
//! │ CoreAgentContext │
//! │ (mofa-kernel) │
//! │ - execution_id, session_id │
//! │ - generic K/V store │
//! │ - interrupt signal, event bus │
//! └───────────────────────────┬─────────────────────────────────┘
//! │
//! ┌───────────────────┼───────────────────┐
//! │ │ │
//! ▼ ▼ ▼
//! ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
//! │RichAgentCtx │ │PromptContext│ │ Custom Ext │
//! │ (metrics) │ │ (building) │ │ (via trait) │
//! └─────────────┘ └─────────────┘ └─────────────┘
//! ```
//!
//! # Modules
//!
//! - `rich`: RichAgentContext - adds metrics and output tracking
//! - `ext`: ContextExt trait - generic extension mechanism
//! - `prompt`: PromptContext - specialized prompt building
//!
//! # Usage
//!
//! ```rust,ignore
//! use mofa_foundation::agent::context::RichAgentContext;
//! use mofa_kernel::agent::context::CoreAgentContext;
//!
//! let core = CoreAgentContext::new("exec-123");
//! let rich = RichAgentContext::new(core);
//!
//! // Core functionality (delegated)
//! rich.set("key", "value").await;
//!
//! // Extended functionality
//! rich.record_output("llm", json!("response")).await;
//! ```
// Re-export rich context types (primary foundation extension)
pub use ;
// Re-export extension traits
pub use ContextExt;
// Re-export prompt context (specialized builder)
pub use ;