Documentation
¶
Overview ¶
Package run provides run management and state persistence.
Index ¶
- func ListAllRepos(paths *config.Paths) ([]string, error)
- type EntryType
- type Manager
- type Manifest
- type Run
- type State
- type Transcript
- func (t *Transcript) Append(entry *TranscriptEntry) error
- func (t *Transcript) LogEnd(state State, totalDuration time.Duration) error
- func (t *Transcript) LogError(agent string, iteration int, err error) error
- func (t *Transcript) LogExecute(agent string, iteration int, prompt string) error
- func (t *Transcript) LogIteration(iteration int) error
- func (t *Transcript) LogResult(agent string, iteration int, result string, duration time.Duration) error
- func (t *Transcript) LogSignal(agent string, iteration int, signal string) error
- func (t *Transcript) LogStart(prompt string, metadata map[string]any) error
- func (t *Transcript) LogState(state State) error
- func (t *Transcript) Path() string
- func (t *Transcript) ReadAll() ([]*TranscriptEntry, error)
- type TranscriptEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EntryType ¶
type EntryType string
EntryType represents the type of transcript entry.
const ( EntryTypeStart EntryType = "start" EntryTypeIteration EntryType = "iteration" EntryTypeMessage EntryType = "message" EntryTypeExecute EntryType = "execute" EntryTypeResult EntryType = "result" EntryTypeSignal EntryType = "signal" EntryTypeState EntryType = "state" EntryTypeError EntryType = "error" EntryTypeEnd EntryType = "end" )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles run lifecycle and persistence.
func NewManager ¶
NewManager creates a new run manager.
func (*Manager) FindBySessionID ¶
FindBySessionID finds a run by agent session ID.
func (*Manager) ListActive ¶
ListActive returns all active (non-complete) runs.
type Manifest ¶
type Manifest struct {
// ID is the run identifier.
ID int `json:"id"`
// RepoPath is the path to the repository.
RepoPath string `json:"repo_path"`
// RepoID is the hashed repository identifier.
RepoID string `json:"repo_id"`
// Prompt is the initial task prompt.
Prompt string `json:"prompt"`
// State is the current run state.
State State `json:"state"`
// PrimaryAgent is the main worker agent.
PrimaryAgent string `json:"primary_agent"`
// ReviewMode is the review configuration.
ReviewMode string `json:"review_mode"`
// MaxIterations is the iteration limit.
MaxIterations int `json:"max_iterations"`
// CurrentIteration is the current iteration number.
CurrentIteration int `json:"current_iteration"`
// ClaudeSessionID is Claude's session ID for resume.
ClaudeSessionID string `json:"claude_session_id,omitempty"`
// CodexSessionID is Codex's session ID for resume.
CodexSessionID string `json:"codex_session_id,omitempty"`
// WorktreePath is the git worktree path if enabled.
WorktreePath string `json:"worktree_path,omitempty"`
// TmuxSession is the tmux session name if enabled.
TmuxSession string `json:"tmux_session,omitempty"`
// ProofCommand is the proof/verification command.
ProofCommand string `json:"proof_command,omitempty"`
// DoneSignal is the custom done signal.
DoneSignal string `json:"done_signal"`
// CreatedAt is when the run was created.
CreatedAt time.Time `json:"created_at"`
// UpdatedAt is when the run was last updated.
UpdatedAt time.Time `json:"updated_at"`
// CompletedAt is when the run completed.
CompletedAt *time.Time `json:"completed_at,omitempty"`
// Error contains any error message.
Error string `json:"error,omitempty"`
// Metadata contains additional key-value data.
Metadata map[string]any `json:"metadata,omitempty"`
}
Manifest contains metadata about a run.
func LoadManifest ¶
LoadManifest loads a manifest from a file.
func LoadManifestByPath ¶
LoadManifestByPath loads a manifest directly from a directory path.
func NewManifest ¶
NewManifest creates a new manifest with default values.
func (*Manifest) IncrementIteration ¶
func (m *Manifest) IncrementIteration()
IncrementIteration increments the iteration counter.
func (*Manifest) IsComplete ¶
IsComplete returns true if the run has finished.
func (*Manifest) IsSingleAgent ¶
IsSingleAgent returns true if running in single-agent mode.
type Run ¶
type Run struct {
Manifest *Manifest
Transcript *Transcript
Bridge *bridge.Bridge
// contains filtered or unexported fields
}
Run represents an active run with all its resources.
type Transcript ¶
type Transcript struct {
// contains filtered or unexported fields
}
Transcript manages the audit log for a run.
func NewTranscript ¶
func NewTranscript(path string, runID int) *Transcript
NewTranscript creates a new transcript for the given path.
func (*Transcript) Append ¶
func (t *Transcript) Append(entry *TranscriptEntry) error
Append adds an entry to the transcript.
func (*Transcript) LogEnd ¶
func (t *Transcript) LogEnd(state State, totalDuration time.Duration) error
LogEnd logs the end of a run.
func (*Transcript) LogError ¶
func (t *Transcript) LogError(agent string, iteration int, err error) error
LogError logs an error.
func (*Transcript) LogExecute ¶
func (t *Transcript) LogExecute(agent string, iteration int, prompt string) error
LogExecute logs an execution request to an agent.
func (*Transcript) LogIteration ¶
func (t *Transcript) LogIteration(iteration int) error
LogIteration logs the start of an iteration.
func (*Transcript) LogResult ¶
func (t *Transcript) LogResult(agent string, iteration int, result string, duration time.Duration) error
LogResult logs a result from an agent.
func (*Transcript) LogSignal ¶
func (t *Transcript) LogSignal(agent string, iteration int, signal string) error
LogSignal logs a signal (DONE, PASS, FAIL).
func (*Transcript) LogStart ¶
func (t *Transcript) LogStart(prompt string, metadata map[string]any) error
LogStart logs the start of a run.
func (*Transcript) LogState ¶
func (t *Transcript) LogState(state State) error
LogState logs a state transition.
func (*Transcript) ReadAll ¶
func (t *Transcript) ReadAll() ([]*TranscriptEntry, error)
ReadAll reads all entries from the transcript.
type TranscriptEntry ¶
type TranscriptEntry struct {
// Type categorizes the entry.
Type EntryType `json:"type"`
// Timestamp is when the entry was created.
Timestamp time.Time `json:"timestamp"`
// RunID is the run identifier.
RunID int `json:"run_id"`
// Iteration is the loop iteration number.
Iteration int `json:"iteration,omitempty"`
// Agent is the agent name (if applicable).
Agent string `json:"agent,omitempty"`
// State is the run state (for state entries).
State State `json:"state,omitempty"`
// Content is the main content (message, prompt, result, etc.).
Content string `json:"content,omitempty"`
// Signal is the signal value (DONE, PASS, FAIL).
Signal string `json:"signal,omitempty"`
// Error is the error message (for error entries).
Error string `json:"error,omitempty"`
// Duration is the elapsed time (for result entries).
Duration time.Duration `json:"duration,omitempty"`
// Metadata contains additional data.
Metadata map[string]any `json:"metadata,omitempty"`
}
TranscriptEntry represents a single entry in the audit log.