Documentation
¶
Index ¶
- Constants
- Variables
- func IsTrustedBaseURL(raw string, cfg ModelConfig) bool
- func Markdown(decision Decision) string
- func ParseBlockMode(value string) bool
- func WriteDecision(path string, decision Decision) error
- func WriteMarkdown(path string, decision Decision) error
- type ChangedSummary
- type Client
- type CommandInput
- type Decision
- type ErrorInput
- type ExampleInput
- type FactScope
- type Finding
- type InputView
- type Message
- type ModelConfig
- type OutputInput
- type Policy
- type PublicContentInput
- type Review
- type RolloutGroup
- type RuleSummaryItem
- type ScopeSelector
- type SkillInput
- type SkillQualityInput
- type SystemWarning
- type Waiver
- type Waivers
Constants ¶
View Source
const ( ReviewActionMustFix = "must_fix" ReviewActionConfirm = "confirm" ReviewActionObserve = "observe" )
Variables ¶
View Source
var ( ErrReviewerConfiguration = errors.New("semantic reviewer configuration is invalid") )
View Source
var ErrReviewerRequestTooLarge = errors.New("semantic review request too large")
Functions ¶
func IsTrustedBaseURL ¶
func IsTrustedBaseURL(raw string, cfg ModelConfig) bool
func ParseBlockMode ¶
func WriteDecision ¶
func WriteMarkdown ¶
Types ¶
type ChangedSummary ¶
type ChangedSummary struct {
Commands int `json:"commands,omitempty"`
Skills int `json:"skills,omitempty"`
SkillQuality int `json:"skill_quality,omitempty"`
Errors int `json:"errors,omitempty"`
Outputs int `json:"outputs,omitempty"`
Examples int `json:"examples,omitempty"`
PublicContent int `json:"public_content,omitempty"`
Domains []string `json:"domains,omitempty"`
Sources []string `json:"sources,omitempty"`
}
type Client ¶
type Client struct {
BaseURL string
APIKey string
Model string
Timeout time.Duration
MaxTokens int
MaxRequestBytes int
AllowedModels map[string]bool
HTTPClient *http.Client
}
func FromEnvWithConfig ¶
func FromEnvWithConfig(cfg ModelConfig) (Client, bool, error)
type CommandInput ¶
type CommandInput struct {
FactRef string `json:"fact_ref"`
facts.CommandFact
}
type Decision ¶
type Decision struct {
BlockMode bool `json:"block_mode"`
Skipped bool `json:"skipped,omitempty"`
Degraded bool `json:"degraded,omitempty"`
InfrastructureFailure bool `json:"infrastructure_failure,omitempty"`
Blockers []Finding `json:"blockers,omitempty"`
Warnings []Finding `json:"warnings,omitempty"`
SystemWarnings []SystemWarning `json:"system_warnings,omitempty"`
}
func DecideWithWaivers ¶
func DegradedDecision ¶
func SkippedDecision ¶
type ErrorInput ¶
type ExampleInput ¶
type ExampleInput struct {
FactRef string `json:"fact_ref"`
facts.CommandExample
}
type Finding ¶
type Finding struct {
Category string `json:"category"`
Severity string `json:"severity"`
Evidence []string `json:"evidence"`
Message string `json:"message"`
SuggestedAction string `json:"suggested_action"`
ReviewAction string `json:"review_action,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
RolloutGroups []string `json:"rollout_groups,omitempty"`
WaiverID string `json:"waiver_id,omitempty"`
WaiverKeys []string `json:"waiver_keys,omitempty"`
}
type InputView ¶
type InputView struct {
SchemaVersion int `json:"schema_version"`
ChangedSummary ChangedSummary `json:"changed_summary"`
RuleSummary []RuleSummaryItem `json:"rule_summary,omitempty"`
Commands []CommandInput `json:"commands,omitempty"`
Skills []SkillInput `json:"skills,omitempty"`
SkillQuality []SkillQualityInput `json:"skill_quality,omitempty"`
Errors []ErrorInput `json:"errors,omitempty"`
Outputs []OutputInput `json:"outputs,omitempty"`
Examples []ExampleInput `json:"examples,omitempty"`
PublicContentLeakage []PublicContentInput `json:"public_content_leakage,omitempty"`
Diagnostics []facts.DiagnosticFact `json:"diagnostics,omitempty"`
}
func BuildInputView ¶
func (InputView) HasReviewableFacts ¶ added in v1.0.58
type Message ¶
func BuildPrompt ¶
type ModelConfig ¶
type ModelConfig struct {
Default string `json:"default"`
Allowed []string `json:"allowed"`
AllowedBaseURLs []string `json:"allowed_base_urls"`
}
func LoadModelConfig ¶
func LoadModelConfig(repo string) (ModelConfig, error)
func (ModelConfig) AllowsModel ¶
func (cfg ModelConfig) AllowsModel(model string) bool
type OutputInput ¶
type OutputInput struct {
FactRef string `json:"fact_ref"`
Command string `json:"command"`
Domain string `json:"domain,omitempty"`
Changed bool `json:"changed,omitempty"`
Source string `json:"source,omitempty"`
IsList bool `json:"is_list"`
HasDefaultLimit bool `json:"has_default_limit"`
HasDecisionField bool `json:"has_decision_field"`
}
type Policy ¶
type Policy struct {
SchemaVersion int `json:"schema_version"`
DefaultEnforcement string `json:"default_enforcement"`
BlockCategories []string `json:"block_categories"`
RolloutGroups []RolloutGroup `json:"rollout_groups,omitempty"`
}
func DefaultPolicy ¶
func DefaultPolicy() Policy
func LoadPolicy ¶
type PublicContentInput ¶ added in v1.0.58
type PublicContentInput struct {
FactRef string `json:"fact_ref"`
facts.PublicContentFact
}
type Review ¶
func DecodeModelReview ¶
Model responses are normalized through modelReview for compatibility; the local gatekeeper still recomputes blocking evidence from facts.
func LoadOrReviewWithConfig ¶
type RolloutGroup ¶
type RuleSummaryItem ¶
type ScopeSelector ¶
type SkillInput ¶
type SkillQualityInput ¶
type SkillQualityInput struct {
FactRef string `json:"fact_ref"`
facts.SkillQualityFact
}
type SystemWarning ¶
type Waivers ¶
type Waivers struct {
Items []Waiver
}
func LoadWaivers ¶
func LoadWaiversFile ¶
func ParseWaivers ¶
Click to show internal directories.
Click to hide internal directories.