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
//! TaskAgent - Autonomous agent that executes a task in a loop using AI + tools
//!
//! Each `TaskAgent` owns its conversation history and calls the AI provider
//! repeatedly, executing tool requests and running validation before it
//! signals completion.
//!
//! ## Usage
//!
//! ```rust,ignore
//! use std::sync::Arc;
//! use brainwires_agents::{AgentContext, TaskAgent, TaskAgentConfig, TaskAgentResult};
//! use brainwires_core::Task;
//!
//! let context = Arc::new(AgentContext::new(
//! "/my/project",
//! Arc::new(my_executor),
//! Arc::clone(&hub),
//! Arc::clone(&lock_manager),
//! ));
//!
//! let agent = Arc::new(TaskAgent::new(
//! "agent-1".to_string(),
//! Task::new("task-1", "Refactor src/lib.rs"),
//! Arc::clone(&provider),
//! Arc::clone(&context),
//! TaskAgentConfig::default(),
//! ));
//!
//! let result: TaskAgentResult = agent.execute().await?;
//! ```
// ── Billing hook newtype (Debug-safe Arc<dyn BillingHook>) ───────────────────
/// A `Debug`-safe wrapper around `Arc<dyn BillingHook>`.
///
/// `dyn BillingHook` doesn't implement `Debug`, so we can't derive it on
/// `TaskAgentConfig` directly. This newtype provides a no-op `Debug` impl
/// so the rest of the config can keep `#[derive(Debug)]`.
;
// ── Public re-exports ────────────────────────────────────────────────────────
pub use TaskAgent;
pub use spawn_task_agent;
pub use ;