outcome

package
v0.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package outcome provides structured task outcome parsing and verdict extraction

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractSummary

func ExtractSummary(output string, maxLines int) string

ExtractSummary extracts a summary from output

func FormatOutcome

func FormatOutcome(outcome *Outcome) string

FormatOutcome formats an outcome for display

Types

type ChangeInfo

type ChangeInfo struct {
	FilesModified int    `json:"files_modified"`
	LinesAdded    int    `json:"lines_added"`
	LinesDeleted  int    `json:"lines_deleted"`
	CommitHash    string `json:"commit_hash,omitempty"`
}

ChangeInfo represents information about code changes made

type Outcome

type Outcome struct {
	Verdict     Verdict           `json:"verdict"`
	Reason      string            `json:"reason,omitempty"`
	Summary     string            `json:"summary,omitempty"`
	Details     string            `json:"details,omitempty"`
	Timestamp   time.Time         `json:"timestamp"`
	Metadata    map[string]string `json:"metadata,omitempty"`
	Blockers    []string          `json:"blockers,omitempty"` // Blocked-by task IDs
	ExitCode    int               `json:"exit_code,omitempty"`
	Changes     *ChangeInfo       `json:"changes,omitempty"`
	TestResults *TestResults      `json:"test_results,omitempty"` // Automated test results
}

Outcome represents the complete structured outcome of a task execution

func MergeOutcomes

func MergeOutcomes(outcomes []*Outcome) *Outcome

MergeOutcomes combines multiple outcomes into a single verdict Pass only if all pass, fail if any fail, blocked if any blocked

func ParseOutput

func ParseOutput(output string) *Outcome

ParseOutput parses output assuming success (exit code 0)

func ParseWithExitCode

func ParseWithExitCode(output string, exitCode int) *Outcome

ParseWithExitCode is a convenience function that parses output with an exit code

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser parses agent output to extract structured outcomes

func NewParser

func NewParser() *Parser

NewParser creates a new outcome parser with default patterns

func (*Parser) ParseOutput

func (p *Parser) ParseOutput(output string, exitCode int) *Outcome

ParseOutput parses agent output and extracts a structured outcome

type TestResults

type TestResults struct {
	Passed    int       `json:"passed"`
	Failed    int       `json:"failed"`
	Skipped   int       `json:"skipped"`
	Total     int       `json:"total"`
	Duration  int64     `json:"duration_ms"`
	Output    string    `json:"output,omitempty"`
	Error     string    `json:"error,omitempty"`
	RunTests  bool      `json:"run_tests"` // Whether tests were actually run
	Timestamp time.Time `json:"timestamp"`
}

TestResults represents the outcome of automated test execution

type Verdict

type Verdict string

Verdict represents the structured outcome of a task execution

const (
	// VerdictPass indicates the task completed successfully
	VerdictPass Verdict = "pass"
	// VerdictFail indicates the task failed
	VerdictFail Verdict = "fail"
	// VerdictBlocked indicates the task is blocked by dependencies
	VerdictBlocked Verdict = "blocked"
	// VerdictUnknown indicates the verdict could not be determined
	VerdictUnknown Verdict = "unknown"
)

func DetermineVerdict

func DetermineVerdict(output string, exitCode int) Verdict

DetermineVerdict quickly determines a verdict from output

func (Verdict) Icon

func (v Verdict) Icon() string

Icon returns an emoji icon for the verdict

func (Verdict) IsValid

func (v Verdict) IsValid() bool

IsValid returns true if the verdict is a known value

func (Verdict) String

func (v Verdict) String() string

String returns the string representation of the verdict

Jump to

Keyboard shortcuts

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