Skip to main content

zeroclaw_runtime/agent/
mod.rs

1#[allow(clippy::module_inception)]
2pub mod agent;
3pub mod classifier;
4pub mod context_analyzer;
5pub mod context_compressor;
6pub mod cost;
7pub mod dispatcher;
8pub mod eval;
9pub mod history;
10pub mod history_pruner;
11pub mod loop_;
12pub mod loop_detector;
13pub mod memory_loader;
14pub mod memory_strategy;
15pub mod personality;
16pub mod personality_templates;
17pub mod prompt;
18pub mod system_prompt;
19pub mod thinking;
20pub mod tool_execution;
21pub mod tool_receipts;
22
23pub(crate) fn is_runtime_approved_arg_tool(tool_name: &str) -> bool {
24    matches!(
25        tool_name,
26        "shell" | "schedule" | "cron_add" | "cron_update" | "cron_run"
27    )
28}
29
30pub(crate) fn set_runtime_approved_arg(
31    tool_name: &str,
32    args: &mut serde_json::Value,
33    approved: bool,
34) {
35    if is_runtime_approved_arg_tool(tool_name)
36        && let Some(args) = args.as_object_mut()
37    {
38        args.insert("approved".to_string(), serde_json::Value::Bool(approved));
39    }
40}
41
42/// Borrow-only Attributable holding an agent alias.
43/// Used by entry points (loop_::run, process_message, cron dispatch)
44/// that don't construct a full `Agent` but still need to open an
45/// `attribution_span!` carrying the agent's role + alias.
46pub struct AgentAttribution<'a>(pub &'a str);
47
48impl ::zeroclaw_api::attribution::Attributable for AgentAttribution<'_> {
49    fn role(&self) -> ::zeroclaw_api::attribution::Role {
50        ::zeroclaw_api::attribution::Role::Agent
51    }
52    fn alias(&self) -> &str {
53        self.0
54    }
55}
56
57#[cfg(test)]
58mod tests;
59
60#[allow(unused_imports)]
61pub use agent::{Agent, AgentBuilder, TurnEvent};
62#[allow(unused_imports)]
63pub use loop_::{process_message, run};