Help us shape the future of Go! Take the 2026 Go Developer Survey

approval

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package approval implements app-control approval tracking for computer-use sessions, including session and persistent approvals plus explicit deny, cancel, and persistence-failed outcomes.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBundleIDRequired reports a missing bundle ID.
	ErrBundleIDRequired = errors.New("bundle id required")

	// ErrApprovalDenied reports an explicit denial.
	ErrApprovalDenied = errors.New("approval denied")

	// ErrApprovalCanceled reports a canceled approval request.
	ErrApprovalCanceled = errors.New("approval canceled")

	// ErrApprovalPersistenceFailed reports that approval succeeded for the
	// current session but could not be persisted.
	ErrApprovalPersistenceFailed = errors.New("approval persistence failed")
)

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store keeps approval state in memory and can persist it to disk.

func New

func New() (*Store, error)

New returns a store backed by the default application-support path.

func NewMemory

func NewMemory() *Store

NewMemory returns a store that keeps all approvals in memory.

func NewStore

func NewStore(path ...string) (*Store, error)

NewStore returns a store backed by the default application-support path. If path is provided, it overrides the default location. An empty path disables persistence.

func Open

func Open(path string) (*Store, error)

Open returns a store backed by path. An empty path disables persistence.

func (*Store) Approve

func (s *Store) Approve(bundleID string, persistent bool) (computeruse.ApprovalState, error)

Approve records approval for bundleID. Persistent approval is saved when the store has a configured backing file.

func (*Store) Path

func (s *Store) Path() string

Path reports the configured persistence path. It is empty for memory-only stores.

func (*Store) Resolve

func (s *Store) Resolve(bundleID string, decision computeruse.ApprovalDecision) (computeruse.ApprovalState, error)

Resolve reports or records approval for bundleID according to decision.

func (*Store) Status

func (s *Store) Status(bundleID string) computeruse.ApprovalState

Status reports the current approval state for bundleID.

Jump to

Keyboard shortcuts

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