Help us shape the future of Go! Take the 2026 Go Developer Survey

analysis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const NoEvidence = "No evidence-backed explanation."
View Source
const NotInRecord = "Not in the session record."

Variables

This section is empty.

Functions

func QuoteIn

func QuoteIn(quote, text string) bool

QuoteIn reports whether quote appears in text, ignoring differences in whitespace.

func Verify

func Verify(claim string, claimStep model.Step, d *store.SessionData) bool

Verify checks the checkable assertions of an agent claim against the record. v1 checks only claims about test results and about touched files. A claim with no checkable assertion is never verified.

Types

type Analyzer

type Analyzer struct {
	LLM      *llm.Client
	Redact   func(string) string
	SendCode bool
	// LongSessionChars is the size above which steps are summarized first.
	LongSessionChars int
	Now              func() time.Time
}

func (*Analyzer) Run

func (a *Analyzer) Run(ctx context.Context, in Input) (*Output, error)

Run executes all tasks. A failed task adds a warning; the deterministic results stay in place.

type Citations

type Citations struct {
	Steps []string
	Hunks []string
}

func Validate

func Validate(text string, stepID, hunkID func(string) string, keepNotInRecord bool) (string, Citations)

Validate keeps only sentences with at least one valid citation, removes invalid citations, and maps alias IDs to real IDs. The map functions return "" for an unknown alias. A sentence that says the answer is not in the record is kept without a citation when keepNotInRecord is true.

type Input

type Input struct {
	Change     model.Change
	Hunks      []model.Hunk
	Provenance map[string][]model.HunkProvenance
	Sessions   []*store.SessionData
	Units      []model.ReviewUnit
}

type Output

type Output struct {
	Intent           []model.IntentItem
	Units            []model.ReviewUnit
	HunkUnit         map[string]string
	GroupingFallback bool
	Rationales       []model.Rationale
	HunkIntent       []model.HunkIntent
	StepSummaries    map[string]string
	Model            string
	Warnings         []string
}

type Pack

type Pack struct {
	Summaries map[string]string
	// contains filtered or unexported fields
}

Pack renders the session as delimited blocks with short aliases (s1, h1, i1) and maps the aliases back to real IDs. Every rendered string passes through the redactor again before it can reach a provider.

func NewPack

func NewPack(in Input, redact func(string) string, sendCode bool) *Pack

func (*Pack) ClaimSteps

func (p *Pack) ClaimSteps(hunkID string, n int) map[string]bool

ClaimSteps returns the agent text steps that may hold a claim about a hunk: assistant, reasoning and plan steps of the same agent actor among each provenance step and the n steps before it. Human edits have none.

func (*Pack) ContextSteps

func (p *Pack) ContextSteps(hunkID string, before int) []string

ContextSteps returns the provenance steps of a hunk and the 3 steps before each of them, in order.

func (*Pack) HunkAlias

func (p *Pack) HunkAlias(id string) string

func (*Pack) HunkBlock

func (p *Pack) HunkBlock(id string, withPatch bool) string

func (*Pack) HunkID

func (p *Pack) HunkID(alias string) string

func (*Pack) IntentBlock

func (p *Pack) IntentBlock() string

func (*Pack) IntentID

func (p *Pack) IntentID(alias string) string

func (*Pack) SetIntent

func (p *Pack) SetIntent(items []model.IntentItem)

func (*Pack) Step

func (p *Pack) Step(id string) (model.Step, bool)

func (*Pack) StepAlias

func (p *Pack) StepAlias(id string) string

func (*Pack) StepBlock

func (p *Pack) StepBlock(id string, summary bool) string

StepBlock renders one step. With summary true and a summary present, the block holds the summary in place of the full text.

func (*Pack) StepID

func (p *Pack) StepID(alias string) string

func (*Pack) Steps

func (p *Pack) Steps() []model.Step

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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