Documentation
¶
Overview ¶
Package pipeline orchestrates review pipeline phases without owning command IO.
Index ¶
- Variables
- func HasLLMTaskMetadata(artifactDir string) (bool, error)
- type ArtifactPaths
- func (p ArtifactPaths) AgentLog(agentID string) (string, error)
- func (p ArtifactPaths) LLMTaskDir(taskID string) (string, error)
- func (p ArtifactPaths) LLMTaskMetadata(taskID string) (string, error)
- func (p ArtifactPaths) LLMTaskRawAttempt(taskID, attempt string) (string, error)
- func (p ArtifactPaths) LLMTaskValidatedOutput(taskID string) (string, error)
- func (p ArtifactPaths) SlicePatch(agentID, filePath string) (string, error)
- type ContextBudget
- type FilePatch
- type NamedSessionStore
- type Options
- type ParsedDiff
- type ReadProvider
- type Request
- type Result
- type ReviewerFailure
- type SelectionRequest
- type SelectionResult
- type SelectionSession
- type Store
Constants ¶
This section is empty.
Variables ¶
var ErrStructuredOutputInvalidAfterRetry = llm.ErrStructuredOutputInvalidAfterRetry
ErrStructuredOutputInvalidAfterRetry marks a selector or rollup response that stayed invalid after the LLM retry path.
Functions ¶
func HasLLMTaskMetadata ¶ added in v0.9.176
HasLLMTaskMetadata reports whether an artifact directory contains at least one completed task metadata file. Metadata is written last, so its presence is the durable boundary for safe task resume.
Types ¶
type ArtifactPaths ¶
type ArtifactPaths struct {
Dir string `json:"dir"`
DiffPatch string `json:"diff_patch"`
SlicesDir string `json:"slices_dir"`
FindingsJSON string `json:"findings_json"`
RollupMarkdown string `json:"rollup_markdown"`
AgentSourcesJSON string `json:"agent_sources_json"`
AgentLogsDir string `json:"agent_logs_dir"`
LLMTasksDir string `json:"llm_tasks_dir"`
}
ArtifactPaths contains per-run artifact paths.
func ArtifactPathsForRun ¶
func ArtifactPathsForRun(layout statepaths.Layout, ref gitprovider.PRRef, pr gitprovider.PR, profile, postingIdentity, runID string) (ArtifactPaths, error)
ArtifactPathsForRun returns the artifact paths for a generated run ID.
func ArtifactPathsFromDir ¶
func ArtifactPathsFromDir(dir string) ArtifactPaths
ArtifactPathsFromDir returns the artifact path set rooted at dir.
func (ArtifactPaths) AgentLog ¶
func (p ArtifactPaths) AgentLog(agentID string) (string, error)
AgentLog returns the tailable LLM log path for an agent.
func (ArtifactPaths) LLMTaskDir ¶ added in v0.9.176
func (p ArtifactPaths) LLMTaskDir(taskID string) (string, error)
LLMTaskDir returns the artifact directory for one durable LLM task.
func (ArtifactPaths) LLMTaskMetadata ¶ added in v0.9.176
func (p ArtifactPaths) LLMTaskMetadata(taskID string) (string, error)
LLMTaskMetadata returns the metadata artifact path for one durable LLM task.
func (ArtifactPaths) LLMTaskRawAttempt ¶ added in v0.9.176
func (p ArtifactPaths) LLMTaskRawAttempt(taskID, attempt string) (string, error)
LLMTaskRawAttempt returns the raw structured output path for a failed attempt.
func (ArtifactPaths) LLMTaskValidatedOutput ¶ added in v0.9.176
func (p ArtifactPaths) LLMTaskValidatedOutput(taskID string) (string, error)
LLMTaskValidatedOutput returns the validated structured output path for one task.
func (ArtifactPaths) SlicePatch ¶
func (p ArtifactPaths) SlicePatch(agentID, filePath string) (string, error)
SlicePatch returns the artifact path for an agent/file diff slice.
type ContextBudget ¶
type ContextBudget struct {
MaxPromptBytes int
}
ContextBudget limits prompt size. A negative MaxPromptBytes disables checks.
type FilePatch ¶
type FilePatch struct {
OldPath string
Path string
Patch string
Binary bool
Deleted bool
Hunks []reviewplan.DiffHunk
}
FilePatch is one whole-file diff slice.
type NamedSessionStore ¶
type NamedSessionStore interface {
GetNamedSession(context.Context, string) (ledger.NamedSession, error)
}
NamedSessionStore reads cross-run named LLM sessions.
type Options ¶
type Options struct {
Provider ReadProvider
Adapter llm.Adapter
Store Store
NamedSessions NamedSessionStore
Layout statepaths.Layout
Warnings io.Writer
Now func() time.Time
NewRunID func() string
NewSessionRowID func() string
NewFindingID func() (review.FindingID, error)
NewActionID func(reviewplan.ActionKind) (string, error)
Budget ContextBudget
MaxAgents int
MaxConcurrency int
Retention datalifecycle.RetentionPolicy
RetentionManualOnly bool
}
Options contains dry-run pipeline dependencies.
type ParsedDiff ¶
type ParsedDiff struct {
PlanDiff reviewplan.Diff
Patches []FilePatch
}
ParsedDiff contains planner metadata plus whole-file patches.
type ReadProvider ¶
type ReadProvider interface {
GetPR(context.Context, gitprovider.PRRef) (gitprovider.PR, error)
GetDiff(context.Context, gitprovider.PRRef) (gitprovider.UnifiedDiff, error)
GetFileAtRef(context.Context, gitprovider.PRRef, string, string) ([]byte, error)
ListTreeAtRef(context.Context, gitprovider.PRRef, string, string) ([]gitprovider.TreeEntry, error)
ListInlineThreads(context.Context, gitprovider.PRRef) ([]gitprovider.InlineThread, error)
Capabilities() gitprovider.ProviderCaps
}
ReadProvider is the PR read boundary needed by dry-run review.
type Request ¶
type Request struct {
PRRef gitprovider.PRRef
PRURL string
ProfileName string
SessionName string
Profile config.Profile
PostingIdentity gitprovider.Identity
AgentDirs []string
SelectionModelOverride string
SelectionEffortOverride string
SelectionPromptInstructions string
ReviewerModelOverride string
ReviewerModelTierOverride string
ReviewerEffortOverride string
ReviewBaseSHA string
ReviewHeadSHA string
FailOn *review.Severity
IncludeNits bool
AllowSelfReview bool
AllowSelfApprove bool
NoResolveThreads bool
MajorRequestChanges bool
// ToolVersion is the raw cr version string rendered in the rollup
// footer (e.g. "0.3.63").
ToolVersion string
}
Request identifies one dry-run review.
type Result ¶
type Result struct {
Run ledger.Run
PR gitprovider.PR
PRKey string
Artifacts ArtifactPaths
Quota llm.Quota
QuotaSupported bool
QuotaLow bool
Catalog agents.Catalog
Selection llm.Selection
Findings []review.Finding
Rollup review.Rollup
Plan reviewplan.Plan
Sessions []ledger.Session
PlannedActions []ledger.PlannedAction
NamedSessionCandidate *ledger.NamedSession
FailOnTriggered bool
EffectiveCaps reviewplan.ProviderCaps
AgentDefsChanged bool
CurrentBaseSHA string
CurrentHeadSHA string
ReviewBaseSHA string
ReviewHeadSHA string
ReviewerFailures []ReviewerFailure
}
Result is the completed dry-run pipeline output.
type ReviewerFailure ¶ added in v0.9.176
type ReviewerFailure struct {
TaskID string `json:"task_id"`
AgentID string `json:"agent_id"`
Error string `json:"error"`
}
ReviewerFailure records an isolated reviewer LLM task failure that should not abort the whole run.
type SelectionRequest ¶ added in v0.3.67
type SelectionRequest struct {
PRRef gitprovider.PRRef
ProfileName string
Profile config.Profile
AgentDirs []string
ArtifactDir string
ReviewBaseSHA string
ReviewHeadSHA string
SelectionModelOverride string
SelectionEffortOverride string
SelectionPromptInstructions string
}
SelectionRequest runs only the selection phase without review persistence or posting.
type SelectionResult ¶ added in v0.3.67
type SelectionResult struct {
PR gitprovider.PR
PRKey string
Artifacts ArtifactPaths
Quota llm.Quota
QuotaSupported bool
QuotaLow bool
Catalog agents.Catalog
ParsedDiff ParsedDiff
ChangedFiles []string
Threads []gitprovider.InlineThread
Selection llm.Selection
SelectionSession SelectionSession
EffectiveCaps reviewplan.ProviderCaps
AgentDefsChanged bool
CurrentBaseSHA string
CurrentHeadSHA string
ReviewBaseSHA string
ReviewHeadSHA string
}
SelectionResult is the selection-only pipeline output.
func SelectionOnly ¶ added in v0.3.67
func SelectionOnly(ctx context.Context, opts Options, req SelectionRequest) (SelectionResult, error)
SelectionOnly executes only the selection phase using caller-owned artifacts.
type SelectionSession ¶ added in v0.3.67
type SelectionSession struct {
ProviderReportedSessionID string
ProviderSessionID string
Adapter string
Model string
Effort string
StartedAt time.Time
CompletedAt time.Time
Response llm.Response
}
SelectionSession describes the single LLM turn used for selection-only execution.
type Store ¶
type Store interface {
ListRuns(context.Context) ([]ledger.Run, error)
DeleteRun(context.Context, string) error
AllocateRun(context.Context, ledger.AllocateRunParams) (ledger.Run, error)
InsertSession(context.Context, ledger.Session) error
GetSession(context.Context, string) (ledger.Session, error)
InsertFinding(context.Context, ledger.Finding) error
InsertPlannedAction(context.Context, ledger.PlannedAction) error
CompleteRun(context.Context, string, ledger.Outcome, time.Time) error
}
Store is the ledger behavior required by the dry-run pipeline.