Documentation
¶
Overview ¶
Package triage sanitizes failures and coordinates bounded repair attempts.
Index ¶
- func BuildPrompt(context FailureContext) string
- func ExtractUnifiedDiff(rawLLMResponse string) (string, error)
- func LoadDotEnv(path string) error
- func NormalizeModelResponse(response, root string, targets []string) (string, error)
- func SanitizeLog(input string) string
- func ValidatePatch(diff string, allowTestChanges bool) error
- func WaitForRetryDelay(ctx context.Context, d time.Duration) error
- type ApprovalRequiredError
- type CircuitBreakerError
- type DockerSandbox
- type FailureContext
- type LLMConfig
- type Model
- type OpenAICompatModel
- type Patcher
- type PolicyCheck
- type Result
- type Sandbox
- type SourceLocation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPrompt ¶
func BuildPrompt(context FailureContext) string
BuildPrompt produces a bounded, explicit repair prompt with test-file restrictions.
func ExtractUnifiedDiff ¶
ExtractUnifiedDiff extracts standard unified diff sections, removing prose and markdown fences. Replies without hunks require NormalizeModelResponse.
func LoadDotEnv ¶
LoadDotEnv loads KEY=VALUE pairs without overwriting variables already set by the process. It intentionally supports a small, predictable .env subset.
func NormalizeModelResponse ¶
NormalizeModelResponse converts supported model response shapes to a canonical unified diff. Full-file replacements are accepted only for one explicitly identified target file within root.
func SanitizeLog ¶
SanitizeLog removes common unstable terminal output while preserving stack text.
func ValidatePatch ¶
ValidatePatch checks unified-diff structure, path traversal, and test-file edits.
Types ¶
type ApprovalRequiredError ¶
type ApprovalRequiredError struct{ Reason string }
ApprovalRequiredError stops autonomous retries when policy requires a human.
func (*ApprovalRequiredError) Error ¶
func (e *ApprovalRequiredError) Error() string
type CircuitBreakerError ¶
CircuitBreakerError reports bounded repair-loop exhaustion without implying that any rejected patch was applied to the caller's working tree.
func (*CircuitBreakerError) Error ¶
func (e *CircuitBreakerError) Error() string
func (*CircuitBreakerError) Unwrap ¶
func (e *CircuitBreakerError) Unwrap() error
type DockerSandbox ¶
type DockerSandbox = runner.DockerSandbox
DockerSandbox is kept as a source-compatible alias; its implementation lives with the execution runners in pkg/runner.
type FailureContext ¶
type FailureContext struct {
Impact astgraph.ImpactSet
SourceLocations []SourceLocation
SanitizedLog string
PreviousPatch string
PreviousError string
Attempt int
MaxAttempts int
AllowTestChanges bool
}
FailureContext contains the structural and sanitized data sent to a repair model.
type LLMConfig ¶
type LLMConfig struct{ Endpoint, APIKey, Model string }
LLMConfig contains resolved OpenAI-compatible endpoint credentials.
type OpenAICompatModel ¶
OpenAICompatModel calls a Chat Completions-compatible endpoint when configured.
func (OpenAICompatModel) ProposePatch ¶
type Patcher ¶
type Patcher struct {
Model Model
Sandbox Sandbox
// Root is the workspace root used to synthesize diffs from full-file model replies.
Root string
MaxAttempts int
AllowTestChanges bool
Policy PolicyCheck
}
Patcher coordinates a model, policy gate, and isolated test sandbox.
type PolicyCheck ¶
PolicyCheck enforces policy on a proposed patch before sandbox execution.
type SourceLocation ¶
SourceLocation identifies a non-test source definition in the impact graph.