Skip to main content

ralph_core/
lib.rs

1//! # ralph-core
2//!
3//! Core orchestration functionality for the Ralph Orchestrator framework.
4//!
5//! This crate provides:
6//! - The main orchestration loop for coordinating multiple agents
7//! - Configuration loading and management
8//! - State management for agent sessions
9//! - Message routing between agents
10//! - Terminal capture for session recording
11//! - Benchmark task definitions and workspace isolation
12
13#[cfg(feature = "recording")]
14mod cli_capture;
15mod config;
16pub mod diagnostics;
17mod event_logger;
18mod event_loop;
19mod event_parser;
20mod event_reader;
21pub mod file_lock;
22mod git_ops;
23mod handoff;
24mod hat_registry;
25mod hatless_ralph;
26mod instructions;
27mod landing;
28pub mod loop_completion;
29pub mod loop_context;
30pub mod loop_history;
31pub mod loop_lock;
32mod loop_name;
33pub mod loop_registry;
34mod memory;
35pub mod memory_parser;
36mod memory_store;
37pub mod merge_queue;
38pub mod planning_session;
39pub mod preflight;
40#[cfg(feature = "recording")]
41mod session_player;
42#[cfg(feature = "recording")]
43mod session_recorder;
44pub mod skill;
45pub mod skill_registry;
46mod summary_writer;
47pub mod task;
48pub mod task_definition;
49pub mod task_store;
50pub mod testing;
51mod text;
52pub mod utils;
53pub mod workspace;
54pub mod worktree;
55
56#[cfg(feature = "recording")]
57pub use cli_capture::{CliCapture, CliCapturePair};
58pub use config::{
59    CliConfig, ConfigError, CoreConfig, EventLoopConfig, EventMetadata, FeaturesConfig, HatBackend,
60    HatConfig, InjectMode, MemoriesConfig, MemoriesFilter, RalphConfig, SkillOverride,
61    SkillsConfig,
62};
63// Re-export loop_name types (also available via FeaturesConfig.loop_naming)
64pub use diagnostics::DiagnosticsCollector;
65pub use event_logger::{EventHistory, EventLogger, EventRecord};
66pub use event_loop::{EventLoop, LoopState, TerminationReason, UserPrompt};
67pub use event_parser::EventParser;
68pub use event_reader::{Event, EventReader, MalformedLine, ParseResult};
69pub use file_lock::{FileLock, LockGuard as FileLockGuard, LockedFile};
70pub use git_ops::{
71    AutoCommitResult, GitOpsError, auto_commit_changes, clean_stashes, get_commit_summary,
72    get_current_branch, get_head_sha, get_recent_files, has_uncommitted_changes,
73    is_working_tree_clean, prune_remote_refs,
74};
75pub use handoff::{HandoffError, HandoffResult, HandoffWriter};
76pub use hat_registry::HatRegistry;
77pub use hatless_ralph::{HatInfo, HatTopology, HatlessRalph};
78pub use instructions::InstructionBuilder;
79pub use landing::{LandingConfig, LandingError, LandingHandler, LandingResult};
80pub use loop_completion::{CompletionAction, CompletionError, LoopCompletionHandler};
81pub use loop_context::LoopContext;
82pub use loop_history::{HistoryError, HistoryEvent, HistoryEventType, HistorySummary, LoopHistory};
83pub use loop_lock::{LockError, LockGuard, LockMetadata, LoopLock};
84pub use loop_name::{LoopNameGenerator, LoopNamingConfig};
85pub use loop_registry::{LoopEntry, LoopRegistry, RegistryError};
86pub use memory::{Memory, MemoryType};
87pub use memory_store::{
88    DEFAULT_MEMORIES_PATH, MarkdownMemoryStore, format_memories_as_markdown, truncate_to_budget,
89};
90pub use merge_queue::{
91    MergeButtonState, MergeEntry, MergeEvent, MergeEventType, MergeOption, MergeQueue,
92    MergeQueueError, MergeState, SteeringDecision, merge_button_state, merge_execution_summary,
93    merge_needs_steering, smart_merge_summary,
94};
95pub use planning_session::{
96    ConversationEntry, ConversationType, PlanningSession, PlanningSessionError, SessionMetadata,
97    SessionStatus,
98};
99pub use preflight::{
100    AcceptanceCriterion, CheckResult, CheckStatus, PreflightCheck, PreflightReport,
101    PreflightRunner, extract_acceptance_criteria, extract_all_criteria, extract_criteria_from_file,
102};
103#[cfg(feature = "recording")]
104pub use session_player::{PlayerConfig, ReplayMode, SessionPlayer, TimestampedRecord};
105#[cfg(feature = "recording")]
106pub use session_recorder::{Record, SessionRecorder};
107pub use skill::{SkillEntry, SkillFrontmatter, SkillSource, parse_frontmatter};
108pub use skill_registry::SkillRegistry;
109pub use summary_writer::SummaryWriter;
110pub use task::{Task, TaskStatus};
111pub use task_definition::{
112    TaskDefinition, TaskDefinitionError, TaskSetup, TaskSuite, Verification,
113};
114pub use task_store::TaskStore;
115pub use text::{floor_char_boundary, truncate_with_ellipsis};
116pub use workspace::{
117    CleanupPolicy, TaskWorkspace, VerificationResult, WorkspaceError, WorkspaceInfo,
118    WorkspaceManager,
119};
120pub use worktree::{
121    SyncStats, Worktree, WorktreeConfig, WorktreeError, create_worktree, ensure_gitignore,
122    list_ralph_worktrees, list_worktrees, remove_worktree, sync_working_directory_to_worktree,
123    worktree_exists,
124};