Skip to main content

ralph_workflow/reducer/event/
constructors.rs

1// NOTE: split from reducer/event.rs to keep the facade small.
2// Constructors are further split by event category to keep files under 500 lines.
3use super::{
4    AgentErrorKind, AgentEvent, AgentRole, CheckpointTrigger, CommitEvent, DevelopmentEvent,
5    DevelopmentStatus, LifecycleEvent, MaterializedPromptInput, PathBuf, PipelineEvent,
6    PipelinePhase, PlanningEvent, PromptInputEvent, PromptInputKind, RebaseEvent, RebasePhase,
7    ReviewEvent, TimeoutOutputKind,
8};
9use crate::agents::AgentDrain;
10use crate::executor::ChildProcessInfo;
11
12// Include constructor implementations split by category
13include!("constructors_lifecycle.rs");
14include!("constructors_prompt_input.rs");
15include!("constructors_development.rs");
16include!("constructors_review.rs");
17include!("constructors_agent.rs");
18include!("constructors_commit.rs");
19
20// ============================================================================
21// Miscellaneous event constructors
22// ============================================================================
23
24impl PipelineEvent {
25    /// Construct a `LoopRecoveryTriggered` event.
26    #[must_use]
27    pub const fn loop_recovery_triggered(detected_loop: String, loop_count: u32) -> Self {
28        Self::LoopRecoveryTriggered {
29            detected_loop,
30            loop_count,
31        }
32    }
33
34    /// Create a `GitignoreEntriesEnsured` event.
35    #[must_use]
36    pub const fn gitignore_entries_ensured(
37        entries_added: Vec<String>,
38        already_present: Vec<String>,
39        file_created: bool,
40    ) -> Self {
41        Self::Lifecycle(LifecycleEvent::GitignoreEntriesEnsured {
42            added: entries_added,
43            existing: already_present,
44            created: file_created,
45        })
46    }
47}