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
71
72
73
74
75
//! Agent Core
//!
//! A Rust Framework for building TUI Agents powered by large language models.
//!
//! This is a meta-crate that re-exports from:
//! - `agent-core-runtime` - Core runtime (always included)
//! - `agent-core-tui` - TUI frontend (optional, enabled by default)
//!
//! ## Features
//!
//! - `tui` (default) - Include the TUI frontend
//!
//! ## Quick Start (with TUI)
//!
//! ```ignore
//! use agent_core::agent::{AgentConfig, AgentCore};
//! use agent_core::tui::AgentCoreExt;
//!
//! struct MyConfig;
//! impl AgentConfig for MyConfig {
//! fn config_path(&self) -> &str { ".myagent/config.yaml" }
//! fn default_system_prompt(&self) -> &str { "You are helpful." }
//! fn log_prefix(&self) -> &str { "myagent" }
//! fn name(&self) -> &str { "MyAgent" }
//! }
//!
//! fn main() -> std::io::Result<()> {
//! let agent = AgentCore::new(&MyConfig)?;
//! agent.into_tui().run()
//! }
//! ```
//!
//! ## Headless Usage (without TUI)
//!
//! ```ignore
//! use agent_core::agent::{AgentConfig, AgentCore};
//!
//! struct MyConfig;
//! impl AgentConfig for MyConfig {
//! fn config_path(&self) -> &str { ".myagent/config.yaml" }
//! fn default_system_prompt(&self) -> &str { "You are helpful." }
//! fn log_prefix(&self) -> &str { "myagent" }
//! fn name(&self) -> &str { "MyAgent" }
//! }
//!
//! fn main() -> std::io::Result<()> {
//! let mut core = AgentCore::new(&MyConfig)?;
//! core.start_background_tasks();
//!
//! // Get channels for custom frontend integration
//! let tx = core.to_controller_tx();
//! let rx = core.take_from_controller_rx();
//!
//! // Create a session and interact programmatically
//! let (session_id, model, _) = core.create_initial_session()?;
//! // ... implement your own event loop
//!
//! core.shutdown();
//! Ok(())
//! }
//! ```
// Re-export everything from the runtime crate
pub use *;
// Re-export the TUI crate when the feature is enabled