Documentation
¶
Overview ¶
Package engine runs the Spackle pipeline for one target and writes the run's ledger, evidence folders and reports.
Index ¶
- Variables
- func FromLead(l seed.Lead, notRunReason string) finding.Finding
- func NewRunID(now time.Time) (string, error)
- func ResolveRun(stateDir, id string) (string, error)
- func RunsDir(stateDir string) string
- func WriteArtifacts(runDir string, run report.Run) error
- type DebugOptions
- type Estimate
- type Options
- type Result
- type VerifyOptions
- type VerifyOutcome
Constants ¶
This section is empty.
Variables ¶
var ErrRefused = errors.New("run refused")
ErrRefused marks a run that was refused before it started (bad target, missing authorization). The CLI maps it to the usage exit code.
Functions ¶
func FromLead ¶
FromLead turns a lead into a finding at the lowest confidence level. It is used when no model investigates the lead.
func ResolveRun ¶
ResolveRun finds a run directory by id, accepting a unique prefix or the word "latest".
Types ¶
type DebugOptions ¶
type DebugOptions struct {
// Target is a local directory. Git URLs and live URLs are refused.
Target string
// Test is the name of a failing test. Exactly one of Test and Issue is set.
Test string
// Issue is the text of an issue description. It is untrusted input.
Issue string
// Good is an optional known-good revision; it enables bisect.
Good string
Config config.Config
Progress io.Writer
// Clock and RunID make runs reproducible in tests.
Clock func() time.Time
RunID string
// Confirm is asked before any model call. Nil means proceed.
Confirm func(Estimate) bool
// ProviderFactory overrides how model providers are built, for tests.
ProviderFactory func(config.Model) (llm.Provider, error)
// DetectRuntime overrides container runtime detection, for tests.
DetectRuntime func(ctx context.Context, preferred string) (sandbox.Runtime, error)
}
DebugOptions configure one debug run.
type Estimate ¶
type Estimate struct {
Investigations int
Model string
USD float64
CostKnown bool
Local bool
CapUSD float64
CapTokens int
}
Estimate describes the expected cost of the agentic stages.
type Options ¶
type Options struct {
Target string
Config config.Config
// Progress receives one-line status messages. Nil discards them.
Progress io.Writer
// Seeders overrides the seeder set; nil means seed.All().
Seeders []seed.Seeder
// Clock and RunID make runs reproducible in tests.
Clock func() time.Time
RunID string
// Confirm is asked before a run that will call a model. It receives the
// estimate and returns whether to proceed. Nil means proceed without
// asking (the caller has already handled --yes).
Confirm func(Estimate) bool
// ProviderFactory overrides how model providers are built, for tests.
ProviderFactory func(config.Model) (llm.Provider, error)
// ScopeFile is the --authorize scope file for a live target.
ScopeFile string
// Yes is true for --yes and CI: never prompt for authorization.
Yes bool
// Interactive is true when Stdin is a terminal a person can answer on.
Interactive bool
// Stdin is read for the interactive scope confirmation.
Stdin io.Reader
// OpenPR overrides how a pull request is opened for --pr, for tests.
OpenPR func(ctx context.Context, req gitx.PRRequest) (string, error)
// DetectRuntime overrides container runtime detection, for tests.
DetectRuntime func(ctx context.Context, preferred string) (sandbox.Runtime, error)
}
Options configure one run.
type Result ¶
Result identifies a finished run.
func Debug ¶
func Debug(ctx context.Context, opts DebugOptions) (Result, error)
Debug starts from a failing test or an issue description, reproduces the failure in the sandbox, finds the root cause (bisecting when a good revision is given), writes a fix and verifies it. Nothing is executed outside the sandbox and the working tree is never modified.
type VerifyOptions ¶
type VerifyOptions struct {
Config config.Config
RunDir string
Progress io.Writer
Clock func() time.Time
// DetectRuntime overrides container runtime detection, for tests.
DetectRuntime func(ctx context.Context, preferred string) (sandbox.Runtime, error)
}
VerifyOptions configure a verify run.
type VerifyOutcome ¶
VerifyOutcome is the result of re-running one stored proof.
func Verify ¶
func Verify(ctx context.Context, opts VerifyOptions) ([]VerifyOutcome, error)
Verify re-runs every stored proof of concept of a run against the target as it is now, appends the outcomes to the run's ledger, and rewrites the reports. A proof that no longer succeeds marks its finding fixed. Nothing is executed outside the sandbox, so without a container runtime Verify refuses instead of guessing.