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::{
36    builtin_profile, builtin_profile_names, is_reserved_profile_name,
37    validate_webhook_destination_url, validate_webhook_settings,
38};
39
40// Re-exports from blocking module (operator-facing stalled/waiting state)
41pub use blocking::{BlockingReason, BlockingState, BlockingStatus};
42
43// Re-exports from machine module (versioned app/CLI machine surfaces)
44pub use machine::{
45    MACHINE_CLI_SPEC_VERSION, MACHINE_CONFIG_RESOLVE_VERSION, MACHINE_DASHBOARD_READ_VERSION,
46    MACHINE_DECOMPOSE_VERSION, MACHINE_DOCTOR_REPORT_VERSION, MACHINE_ERROR_VERSION,
47    MACHINE_GRAPH_READ_VERSION, MACHINE_PARALLEL_STATUS_VERSION, MACHINE_QUEUE_READ_VERSION,
48    MACHINE_QUEUE_REPAIR_VERSION, MACHINE_QUEUE_UNDO_VERSION, MACHINE_QUEUE_UNLOCK_INSPECT_VERSION,
49    MACHINE_QUEUE_VALIDATE_VERSION, MACHINE_RUN_EVENT_VERSION, MACHINE_RUN_SUMMARY_VERSION,
50    MACHINE_SYSTEM_INFO_VERSION, MACHINE_TASK_CREATE_VERSION, MACHINE_TASK_MUTATION_VERSION,
51    MACHINE_WORKSPACE_OVERVIEW_VERSION, MachineCliSpecDocument, MachineConfigResolveDocument,
52    MachineConfigSafetySummary, MachineContinuationAction, MachineContinuationSummary,
53    MachineDashboardReadDocument, MachineDecomposeDocument, MachineDoctorReportDocument,
54    MachineErrorCode, MachineErrorDocument, MachineGraphReadDocument,
55    MachineParallelLifecycleCounts, MachineParallelStatusDocument, MachineQueuePaths,
56    MachineQueueReadDocument, MachineQueueRepairDocument, MachineQueueUndoDocument,
57    MachineQueueUnlockCondition, MachineQueueUnlockInspectDocument, MachineQueueValidateDocument,
58    MachineResumeDecision, MachineRunEventEnvelope, MachineRunEventKind, MachineRunSummaryDocument,
59    MachineSystemInfoDocument, MachineTaskCreateDocument, MachineTaskCreateRequest,
60    MachineTaskMutationDocument, MachineValidationWarning, MachineWorkspaceOverviewDocument,
61};
62
63// Re-exports from cli_spec module (versioned; suitable for tooling consumption)
64pub use cli_spec::{ArgSpec, CLI_SPEC_VERSION, CliSpec, CommandSpec};
65
66// Re-exports from model module (model types)
67pub use model::{Model, ModelEffort, ReasoningEffort};
68
69// Re-exports from queue module
70pub use queue::QueueFile;
71
72// Re-exports from runner module (runner types)
73pub use runner::{
74    ClaudePermissionMode, Runner, RunnerApprovalMode, RunnerCliConfigRoot, RunnerCliOptionsPatch,
75    RunnerOutputFormat, RunnerPlanMode, RunnerSandboxMode, RunnerVerbosity,
76    UnsupportedOptionPolicy,
77};
78
79// Re-exports from session module
80pub use session::{PhaseSettingsSnapshot, SessionState};
81
82// Re-export SESSION_STATE_VERSION from constants for backward compatibility
83pub use crate::constants::versions::SESSION_STATE_VERSION;
84
85// Re-exports from task module
86pub use task::{Task, TaskAgent, TaskPriority, TaskStatus};