Documentation
¶
Overview ¶
Package loop provides the main orchestration for agent-to-agent pair programming.
Error Handling ¶
This package distinguishes between critical and non-critical errors:
Critical errors cause the loop to fail and return immediately:
- Agent execution failures (primary or secondary agent cannot execute)
- Message draining failures (cannot retrieve messages from bridge)
- MCP server startup failures
- Agent startup failures
Non-critical errors are logged as warnings but allow the loop to continue:
- Transcript logging failures (recording events to transcript.jsonl)
- Run save failures (persisting manifest state)
- State transition failures (updating internal state machine)
- Signal logging failures (recording done/review signals)
This design ensures the core orchestration continues even if auxiliary persistence or logging operations fail, while stopping immediately on errors that would prevent meaningful progress.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InvalidTransitionError ¶
InvalidTransitionError is returned for invalid state transitions.
func (*InvalidTransitionError) Error ¶
func (e *InvalidTransitionError) Error() string
type Loop ¶
type Loop struct {
// contains filtered or unexported fields
}
Loop orchestrates paired agent execution.
func (*Loop) MCPServerAddr ¶
MCPServerAddr returns the MCP server address for agents to connect to.
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
Machine manages state transitions.
func NewMachine ¶
func NewMachine() *Machine
NewMachine creates a new state machine starting in init state.
func (*Machine) IsTerminal ¶
IsTerminal returns true if in a terminal state.
func (*Machine) Transition ¶
Transition moves to a new state.
type SingleLoop ¶
type SingleLoop struct {
// contains filtered or unexported fields
}
SingleLoop orchestrates a single agent execution.
func (*SingleLoop) MCPServerAddr ¶
func (l *SingleLoop) MCPServerAddr() string
MCPServerAddr returns the MCP server address for the agent to connect to.
func (*SingleLoop) Resume ¶
func (l *SingleLoop) Resume(ctx context.Context) error
Resume continues a single-agent run from its current state.
func (*SingleLoop) Run ¶
func (l *SingleLoop) Run(ctx context.Context) error
Run executes the single-agent loop until completion.
func (*SingleLoop) Status ¶
func (l *SingleLoop) Status() *Status
Status returns the current loop status.
type State ¶
type State string
State represents the loop state machine.
func FromRunState ¶
FromRunState converts run state to loop state.
func (State) ToRunState ¶
ToRunState converts loop state to run state.