agent

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package agent provides autonomous agent functionality for iterative plan generation and execution.

Package agent provides autonomous agent functionality for iterative plan generation and execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPrompt

func BuildPrompt(input PlanInput) (string, string, error)

func CollectChangedFiles

func CollectChangedFiles(repoRoot string) ([]string, error)

func ComputePlanHash

func ComputePlanHash(planBytes []byte) string

func NextIterationNumber

func NextIterationNumber(repoRoot string) (int, error)

func SanitizePlan

func SanitizePlan(rawOutput string) ([]byte, error)

func SavePlan

func SavePlan(repoRoot string, iterNum int, planBytes []byte) string

func WriteIterationLog

func WriteIterationLog(repoRoot string, log *IterationLog) (string, error)

Types

type DiffStat

type DiffStat struct {
	Files      int `json:"files"`
	Insertions int `json:"insertions"`
	Deletions  int `json:"deletions"`
}

func CollectDiffStat

func CollectDiffStat(repoRoot string) (DiffStat, error)

type IterationLog

type IterationLog struct {
	Iteration        int      `json:"iteration"`
	Goal             string   `json:"goal"`
	PlanHash         string   `json:"plan_hash"`
	Status           string   `json:"status"`
	ChangedFiles     []string `json:"changed_files"`
	DiffStat         DiffStat `json:"diff_stat"`
	Artifacts        []string `json:"artifacts"`
	Provider         string   `json:"provider,omitempty"`
	Model            string   `json:"model,omitempty"`
	ValidationError  string   `json:"validation_error,omitempty"`
	ExecutionError   string   `json:"execution_error,omitempty"`
	AssertionsFailed int      `json:"assertions_failed,omitempty"`
}

func Run

func Run(opts RunOptions) (*IterationLog, error)

type IterationSummary

type IterationSummary struct {
	Iteration    int
	PlanHash     string
	Status       string
	ChangedFiles []string
	ErrorMessage string
}

type LoopResult

type LoopResult struct {
	Iterations []IterationLog
	StopReason StopReason
	FinalLog   *IterationLog
}

func RunLoop

func RunLoop(opts RunOptions) (*LoopResult, error)

type PlanInput

type PlanInput struct {
	Goal          string
	Snapshot      []byte
	LastIteration *IterationSummary
}

type RunOptions

type RunOptions struct {
	Goal          string
	PlanPath      string
	UseStdin      bool
	RepoRoot      string
	Provider      string
	Model         string
	MaxIterations int
}

type Snapshot

type Snapshot struct {
	Branch       string   `json:"branch"`
	Head         string   `json:"head"`
	Clean        bool     `json:"clean"`
	TopLevelDirs []string `json:"top_level_dirs"`
	Actions      []string `json:"actions"`
}

type StopReason

type StopReason string
const (
	StopSuccess    StopReason = "success"
	StopNoProgress StopReason = "no_progress"
	StopNoChange   StopReason = "no_change"
	StopFailed     StopReason = "failed"
	StopMaxReached StopReason = "max_iterations"
)

Jump to

Keyboard shortcuts

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