approver

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package approver defines interfaces for approval checks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Approver

type Approver interface {
	// Name returns the approver identifier.
	Name() string
	// Approve returns a decision for the given request.
	Approve(ctx context.Context, req Request) (Decision, error)
}

Approver checks whether an action is allowed.

type Chain

type Chain struct {
	// Approvers is the ordered list to execute.
	Approvers []Approver
}

Chain runs approvers sequentially until a decision is made.

func (Chain) Approve

func (c Chain) Approve(ctx context.Context, req Request) (Decision, error)

Approve executes all approvers in order.

type Decision

type Decision struct {
	// Allowed indicates approval result.
	Allowed bool
	// Reason explains the decision.
	Reason string
	// Source identifies the approver.
	Source string
}

Decision represents the approver decision.

type Request

type Request struct {
	// ToolName is the tool being approved.
	ToolName string
	// Arguments are tool arguments.
	Arguments map[string]any
	// CorrelationID links related approvals.
	CorrelationID string
}

Request defines the input sent to approvers.

type Timeout

type Timeout struct {
	// Inner is the wrapped approver.
	Inner Approver
	// Timeout is the maximum duration for approval.
	Timeout time.Duration
}

Timeout wraps an approver with a context deadline.

func (Timeout) Approve

func (t Timeout) Approve(ctx context.Context, req Request) (Decision, error)

Approve executes the inner approver with timeout.

func (Timeout) Name

func (t Timeout) Name() string

Name returns the inner approver name.

Jump to

Keyboard shortcuts

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