looprunner

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureGitDelta

func CaptureGitDelta(workDir, prevCommit string) (diffStat, changedFiles string, err error)

func RenderPrompt

func RenderPrompt(tmpl string, ctx TemplateContext) (string, error)

Types

type EventWriter

type EventWriter interface {
	Write(event events.Event) error
}

type LoopConfig

type LoopConfig struct {
	MaxIterations int     `json:"max_iterations"`
	Pre           []Phase `json:"pre"`
	Loop          []Phase `json:"loop"`
}

func LoadLoopConfig

func LoadLoopConfig(path string) (*LoopConfig, error)

func (*LoopConfig) InsertInitialPrompt

func (c *LoopConfig) InsertInitialPrompt(prompt string)

func (*LoopConfig) Validate

func (c *LoopConfig) Validate() error

type Phase

type Phase struct {
	Name               string `json:"name"`
	Prompt             string `json:"prompt"`
	ResumeFromPrevious bool   `json:"resume_from_previous,omitempty"`
}

type PhaseAttemptResult

type PhaseAttemptResult struct {
	ExitCode      int
	SessionID     string
	StopReason    string
	LoopDirective string
	LoopLabel     string
}

type RunOptions

type RunOptions struct {
	WorkDir      string
	RunID        string
	EventSink    EventWriter
	Config       *LoopConfig
	MaxRetries   int
	PhaseAttempt func(ctx context.Context, phase Phase, attemptNum int, iteration int, prevSessionID string) (PhaseAttemptResult, error)
}

type RunResult

type RunResult struct {
	ExitCode   int
	StopReason string
	SessionID  string
	Reason     string
}

func Run

func Run(ctx context.Context, opts RunOptions) (RunResult, error)

type TemplateContext

type TemplateContext struct {
	RunID           string
	Phase           string
	Iteration       int
	MaxIterations   int
	WorkDir         string
	PrevPhaseCommit string
	DiffStat        string
	ChangedFiles    string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL