Documentation
¶
Overview ¶
Package approval implements an isolated, tool-less action reviewer. Host policy remains authoritative.
Index ¶
Constants ¶
const MaxEvidence = 12000
const MaxOutputTokens = 4096
MaxOutputTokens leaves room for hidden reasoning, which thinking models (deepseek, gpt-5) count against max_tokens; truncated replies still fail closed. Timeout bounds the slow path.
const Timeout = 15 * time.Second
Variables ¶
This section is empty.
Functions ¶
func ReadOnlyUsable ¶
ReadOnlyUsable reports whether the read-only allowance may skip a prompt: not when a review of the call found anything at all.
func RuleStandsInForReview ¶
RuleStandsInForReview reports whether a remembered allow rule may skip the prompt the review in ctx asked for: only when the review urged caution and found nothing concrete. ruleAllows is whether a rule the user saved, not a mode or the read-only allowance, covers the call.
func RulesUsable ¶
RulesUsable reports whether a remembered allow rule may skip a prompt: not when a review of the call found something concrete, whatever the review mode.
Types ¶
type ActionReportKey ¶
type ActionReportKey struct{}
type Report ¶
type Report struct {
Risk string `json:"risk"`
Sandbox string `json:"sandbox"`
SensitiveData string `json:"sensitive_data"`
ModelBehavior string `json:"model_behavior"`
Injection string `json:"injection"`
Reason string `json:"reason"`
}
func (Report) CautionOnly ¶
CautionOnly reports a review that found nothing concrete: every dimension is low and only the overall risk is medium, the reviewer being careful about an action's effect. A rule the user saved may then stand in for asking again; injection, sensitive data, high or unknown findings still need a person.
func (Report) Description ¶
type ReviewedActionKey ¶
type ReviewedActionKey struct{}
type Reviewer ¶
type Reviewer struct {
// contains filtered or unexported fields
}
func NewWithFallback ¶
func NewWithFallback(_ context.Context, cfg *config.Config, provider, model, effort string) *Reviewer
NewWithFallback reviews with the configured aiApproval provider and model and, when that pair is unset or cannot be routed (a deleted provider or model), with the fallback pair: the session's own model, so auto review works without a separate reviewer setting. The fallback asks for effort, so a large session model classifies quickly instead of reasoning at full depth; the configured reviewer keeps its own default.
type RunReviewer ¶
type RunReviewer struct {
Mode string
// contains filtered or unexported fields
}
func (*RunReviewer) Hooks ¶
func (r *RunReviewer) Hooks(gate func(tools.GateRequest) (tools.GateDecision, string)) tools.ReviewHooks
func (*RunReviewer) RequiresManual ¶
func (r *RunReviewer) RequiresManual(ctx context.Context) bool