Skip to main content

ralph/contracts/
mod.rs

1//! Contracts module for Ralph configuration and queue/task JSON structures.
2//!
3//! Responsibilities:
4//! - Own the canonical data models for config, queue, and task contracts.
5//! - Re-export the public contract types for crate-wide access.
6//!
7//! Not handled here:
8//! - Queue persistence and IO (see `crate::queue`).
9//! - CLI argument parsing or command behavior (see `crate::cli`).
10//!
11//! Invariants/assumptions:
12//! - Public contract types remain stable and are re-exported from this module.
13//! - Serde/schemars attributes define the wire contract and must not drift.
14
15#![allow(clippy::struct_excessive_bools)]
16
17mod blocking;
18mod cli_spec;
19mod config;
20mod machine;
21mod model;
22mod queue;
23mod runner;
24mod session;
25mod task;
26
27// Re-exports from config module (core config types)
28// All config types are now re-exported from config::mod.rs for backward compatibility
29pub use config::{
30    AgentConfig, CiGateConfig, Config, GitPublishMode, GitRevertMode, LoopConfig,
31    NotificationConfig, ParallelConfig, PhaseOverrideConfig, PhaseOverrides, PluginConfig,
32    PluginsConfig, ProjectType, QueueAgingThresholds, QueueConfig, RunnerRetryConfig,
33    ScanPromptVersion, WebhookConfig, WebhookEventSubscription, WebhookQueuePolicy,
34};
35pub(crate) use config::{builtin_profile, builtin_profile_names, is_reserved_profile_name};
36
37// Re-exports from blocking module (operator-facing stalled/waiting state)
38pub use blocking::{BlockingReason, BlockingState, BlockingStatus};
39
40// Re-exports from machine module (versioned app/CLI machine surfaces)
41pub use machine::{
42    MACHINE_CLI_SPEC_VERSION, MACHINE_CONFIG_RESOLVE_VERSION, MACHINE_DASHBOARD_READ_VERSION,
43    MACHINE_DECOMPOSE_VERSION, MACHINE_DOCTOR_REPORT_VERSION, MACHINE_GRAPH_READ_VERSION,
44    MACHINE_PARALLEL_STATUS_VERSION, MACHINE_QUEUE_READ_VERSION, MACHINE_QUEUE_REPAIR_VERSION,
45    MACHINE_QUEUE_UNDO_VERSION, MACHINE_QUEUE_VALIDATE_VERSION, MACHINE_RUN_EVENT_VERSION,
46    MACHINE_RUN_SUMMARY_VERSION, MACHINE_SYSTEM_INFO_VERSION, MACHINE_TASK_CREATE_VERSION,
47    MACHINE_TASK_MUTATION_VERSION, MachineCliSpecDocument, MachineConfigResolveDocument,
48    MachineConfigSafetySummary, MachineContinuationAction, MachineContinuationSummary,
49    MachineDashboardReadDocument, MachineDecomposeDocument, MachineDoctorReportDocument,
50    MachineGraphReadDocument, MachineParallelStatusDocument, MachineQueuePaths,
51    MachineQueueReadDocument, MachineQueueRepairDocument, MachineQueueUndoDocument,
52    MachineQueueValidateDocument, MachineResumeDecision, MachineRunEventEnvelope,
53    MachineRunEventKind, MachineRunSummaryDocument, MachineSystemInfoDocument,
54    MachineTaskCreateDocument, MachineTaskCreateRequest, MachineTaskMutationDocument,
55    MachineValidationWarning,
56};
57
58// Re-exports from cli_spec module (versioned; suitable for tooling consumption)
59pub use cli_spec::{ArgSpec, CLI_SPEC_VERSION, CliSpec, CommandSpec};
60
61// Re-exports from model module (model types)
62pub use model::{Model, ModelEffort, ReasoningEffort};
63
64// Re-exports from queue module
65pub use queue::QueueFile;
66
67// Re-exports from runner module (runner types)
68pub use runner::{
69    ClaudePermissionMode, Runner, RunnerApprovalMode, RunnerCliConfigRoot, RunnerCliOptionsPatch,
70    RunnerOutputFormat, RunnerPlanMode, RunnerSandboxMode, RunnerVerbosity,
71    UnsupportedOptionPolicy,
72};
73
74// Re-exports from session module
75pub use session::{PhaseSettingsSnapshot, SessionState};
76
77// Re-export SESSION_STATE_VERSION from constants for backward compatibility
78pub use crate::constants::versions::SESSION_STATE_VERSION;
79
80// Re-exports from task module
81pub use task::{Task, TaskAgent, TaskPriority, TaskStatus};