Skip to content

Commit 2030912

Browse files
committed
fix(forge): implement Default for GlobalConfig with proper values
- Fix GlobalConfig to use manual Default impl instead of derive - Ensures max_parallel defaults to 4, timeout_seconds to 600 - Add module exports for config, orchestrator, protocol in mod.rs - Add documentation for orchestration usage example
1 parent d9af33e commit 2030912

2 files changed

Lines changed: 50 additions & 1 deletion

File tree

src/cortex-agents/src/forge/config.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl Default for ForgeConfig {
299299
}
300300

301301
/// Global Forge settings.
302-
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
302+
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
303303
pub struct GlobalConfig {
304304
/// Maximum number of agents to run in parallel.
305305
#[serde(default = "default_max_parallel")]
@@ -318,6 +318,17 @@ pub struct GlobalConfig {
318318
pub output_format: OutputFormat,
319319
}
320320

321+
impl Default for GlobalConfig {
322+
fn default() -> Self {
323+
Self {
324+
max_parallel: default_max_parallel(),
325+
fail_fast: false,
326+
timeout_seconds: default_global_timeout(),
327+
output_format: OutputFormat::default(),
328+
}
329+
}
330+
}
331+
321332
fn default_max_parallel() -> usize {
322333
4
323334
}

src/cortex-agents/src/forge/mod.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
//! - **SecurityAgent**: Security-focused analysis (secrets, vulnerabilities, unsafe code)
1010
//! - **QualityAgent**: Code quality checks (TODOs, unwrap, documentation)
1111
//! - **AggregatorAgent**: Combines results from all agents into a final report
12+
//! - **ForgeOrchestrator**: DAG-based orchestration for agent execution
13+
//! - **ForgeConfig**: TOML-based configuration system
1214
//!
1315
//! # Example
1416
//!
@@ -33,8 +35,35 @@
3335
//! .with_previous_result(quality_result);
3436
//! let final_result = aggregator.validate(&ctx).await?;
3537
//! ```
38+
//!
39+
//! # Orchestration
40+
//!
41+
//! For complex workflows with dependencies:
42+
//!
43+
//! ```rust,ignore
44+
//! use cortex_agents::forge::{ForgeOrchestrator, ForgeConfig};
45+
//! use cortex_agents::forge::config::AgentConfig as OrchestratorAgentConfig;
46+
//! use cortex_agents::forge::protocol::ValidationResult as OrchestratorValidationResult;
47+
//!
48+
//! let mut config = ForgeConfig::new();
49+
//! config.add_agent(OrchestratorAgentConfig::new("lint").with_priority(10));
50+
//! config.add_agent(
51+
//! OrchestratorAgentConfig::new("security")
52+
//! .depends_on("lint")
53+
//! .with_priority(5)
54+
//! );
55+
//!
56+
//! let orchestrator = ForgeOrchestrator::new(config);
57+
//! let response = orchestrator.run(|agent_id, config| async move {
58+
//! // Execute agent logic
59+
//! Ok(OrchestratorValidationResult::pass(agent_id))
60+
//! }).await?;
61+
//! ```
3662
3763
pub mod agents;
64+
pub mod config;
65+
pub mod orchestrator;
66+
pub mod protocol;
3867

3968
// Re-export commonly used types at the forge module level
4069
pub use agents::{
@@ -44,3 +73,12 @@ pub use agents::{
4473

4574
// Re-export aggregator-specific types
4675
pub use agents::aggregator::{AgentSummary, ForgeRecommendation, ForgeResponse};
76+
77+
// Re-export config types for orchestration
78+
pub use config::{ConfigError, ConfigLoader, ConfigResult, ForgeConfig, GlobalConfig, OutputFormat};
79+
80+
// Re-export orchestrator types
81+
pub use orchestrator::{
82+
ForgeOrchestrator, OrchestratorBuilder, OrchestratorError, OrchestratorOptions,
83+
OrchestratorResult,
84+
};

0 commit comments

Comments
 (0)