Documentation
¶
Overview ¶
Package processor provides the main orchestration loop for ralphex execution.
Index ¶
- Constants
- Variables
- func IsCodexDone(signal string) bool
- func IsPlanReady(signal string) bool
- func IsReviewDone(signal string) bool
- func IsTerminalSignal(signal string) bool
- type Config
- type Executor
- type InputCollector
- type Logger
- type Mode
- type Phase
- type QuestionPayload
- type Runner
- type Section
- func NewClaudeEvalSection() Section
- func NewClaudeReviewSection(iteration int, suffix string) Section
- func NewCodexIterationSection(iteration int) Section
- func NewGenericSection(label string) Section
- func NewPlanIterationSection(iteration int) Section
- func NewTaskIterationSection(iteration int) Section
- type SectionType
Constants ¶
const ( SignalCompleted = "<<<RALPHEX:ALL_TASKS_DONE>>>" SignalFailed = "<<<RALPHEX:TASK_FAILED>>>" SignalReviewDone = "<<<RALPHEX:REVIEW_DONE>>>" SignalCodexDone = "<<<RALPHEX:CODEX_REVIEW_DONE>>>" SignalQuestion = "<<<RALPHEX:QUESTION>>>" SignalPlanReady = "<<<RALPHEX:PLAN_READY>>>" )
Signal constants for execution control. using <<<RALPHEX:...>>> format for clear detection.
const DefaultIterationDelay = 2 * time.Second
DefaultIterationDelay is the pause between iterations to allow system to settle.
Variables ¶
var ErrNoQuestionSignal = errors.New("no question signal found")
ErrNoQuestionSignal indicates no question signal was found in output
Functions ¶
func IsCodexDone ¶
IsCodexDone returns true if signal indicates codex phase is complete.
func IsPlanReady ¶ added in v0.4.0
IsPlanReady returns true if signal indicates plan creation is complete.
func IsReviewDone ¶
IsReviewDone returns true if signal indicates review phase is complete.
func IsTerminalSignal ¶
IsTerminalSignal returns true if signal indicates execution should stop.
Types ¶
type Config ¶
type Config struct {
PlanFile string // path to plan file (required for full mode)
PlanDescription string // plan description for interactive plan creation mode
ProgressPath string // path to progress file
Mode Mode // execution mode
MaxIterations int // maximum iterations for task phase
Debug bool // enable debug output
NoColor bool // disable color output
IterationDelayMs int // delay between iterations in milliseconds
TaskRetryCount int // number of times to retry failed tasks
CodexEnabled bool // whether codex review is enabled
AppConfig *config.Config // full application config (for executors and prompts)
}
Config holds runner configuration.
type InputCollector ¶ added in v0.4.0
type InputCollector interface {
AskQuestion(ctx context.Context, question string, options []string) (string, error)
}
InputCollector provides interactive input collection for plan creation.
type Logger ¶
type Logger interface {
SetPhase(phase Phase)
Print(format string, args ...any)
PrintRaw(format string, args ...any)
PrintSection(section Section)
PrintAligned(text string)
LogQuestion(question string, options []string)
LogAnswer(answer string)
Path() string
}
Logger provides logging functionality.
type Phase ¶ added in v0.4.0
type Phase string
Phase represents execution phase for color coding.
const ( PhaseTask Phase = "task" // execution phase (green) PhaseReview Phase = "review" // code review phase (cyan) PhaseCodex Phase = "codex" // codex analysis phase (magenta) PhaseClaudeEval Phase = "claude-eval" // claude evaluating codex (bright cyan) PhasePlan Phase = "plan" // plan creation phase (info color) )
Phase constants for execution stages.
type QuestionPayload ¶ added in v0.4.0
type QuestionPayload struct {
Question string `json:"question"`
Options []string `json:"options"`
Context string `json:"context,omitempty"`
}
QuestionPayload represents a question signal from Claude during plan creation
func ParseQuestionPayload ¶ added in v0.4.0
func ParseQuestionPayload(output string) (*QuestionPayload, error)
ParseQuestionPayload extracts a QuestionPayload from output containing QUESTION signal. returns ErrNoQuestionSignal if no question signal is found. returns other error if signal is found but JSON is malformed.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner orchestrates the execution loop.
func New ¶
New creates a new Runner with the given configuration. If codex is enabled but the binary is not found in PATH, it is automatically disabled with a warning.
func NewWithExecutors ¶
NewWithExecutors creates a new Runner with custom executors (for testing).
func (*Runner) SetInputCollector ¶ added in v0.4.0
func (r *Runner) SetInputCollector(c InputCollector)
SetInputCollector sets the input collector for plan creation mode.
type Section ¶ added in v0.4.0
type Section struct {
Type SectionType
Iteration int // 0 for non-iterated sections
Label string // human-readable display text
}
Section carries structured information about a section header. instead of parsing section names with regex, consumers can access the Type and Iteration fields directly.
use the provided constructors (NewTaskIterationSection, etc.) to create sections with proper Type/Iteration/Label consistency.
func NewClaudeEvalSection ¶ added in v0.4.0
func NewClaudeEvalSection() Section
NewClaudeEvalSection creates a section for Claude evaluating codex findings.
func NewClaudeReviewSection ¶ added in v0.4.0
NewClaudeReviewSection creates a section for Claude review iteration. suffix is appended after the iteration number (e.g., ": critical/major").
func NewCodexIterationSection ¶ added in v0.4.0
NewCodexIterationSection creates a section for Codex review iteration.
func NewGenericSection ¶ added in v0.4.0
NewGenericSection creates a static section header with no iteration.
func NewPlanIterationSection ¶ added in v0.4.0
NewPlanIterationSection creates a section for plan creation iteration.
func NewTaskIterationSection ¶ added in v0.4.0
NewTaskIterationSection creates a section for task execution iteration.
type SectionType ¶ added in v0.4.0
type SectionType int
SectionType represents the semantic type of a section header. the web layer uses these types to emit appropriate boundary events:
- SectionTaskIteration: emits task_start/task_end events
- SectionClaudeReview, SectionCodexIteration: emits iteration_start events
- SectionGeneric, SectionClaudeEval: no boundary events, just section headers
invariants:
- Iteration > 0 for SectionTaskIteration, SectionClaudeReview, SectionCodexIteration
- Iteration == 0 for SectionGeneric, SectionClaudeEval
prefer using the constructor functions (NewTaskIterationSection, etc.) to ensure these invariants are maintained.
const ( // SectionGeneric is a static section header with no iteration. SectionGeneric SectionType = iota // SectionTaskIteration represents a task execution iteration. SectionTaskIteration // SectionClaudeReview represents a Claude review iteration. SectionClaudeReview // SectionCodexIteration represents a Codex review iteration. SectionCodexIteration // SectionClaudeEval represents Claude evaluating codex findings. SectionClaudeEval // SectionPlanIteration represents a plan creation iteration. SectionPlanIteration )