sandboxdomain

package
v0.222.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ToolSandboxAccess = "SandboxAccess"

ToolSandboxAccess names the synthetic approval the agent raises when a tool is denied a path, so the user can grant it instead of failing the call.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access string

Access is what a rule lets a tool do with a path. Write implies read.

const (
	AccessRead  Access = "read"
	AccessWrite Access = "write"
)

func (Access) Allows

func (a Access) Allows(want Access) bool

Allows reports whether a holder of a may perform want.

func (Access) Valid

func (a Access) Valid() bool

Valid reports whether a is one of the two access levels.

type Allowed

type Allowed struct {
	Path   string `yaml:"path"`
	Access Access `yaml:"access,omitempty"`
}

Allowed opens Path to the tools with Access (write when unset). Path is an anchored directory or file (absolute, ~, . or ./) or a relative pattern matched at any depth (dir/, *.glob, name). In YAML it is a string or a map.

func Allow

func Allow(paths ...string) []Allowed

Allow opens each path for read and write.

func (Allowed) MarshalYAML

func (a Allowed) MarshalYAML() (any, error)

func (*Allowed) UnmarshalYAML

func (a *Allowed) UnmarshalYAML(node *yaml.Node) error

type Denied

type Denied struct {
	Path        string    `yaml:"path"`
	OnViolation Violation `yaml:"on_violation,omitempty"`
}

Denied closes Path whatever Allowed says. OnViolation decides whether a denied call fails or asks the user. In YAML it is a string or a map.

func Deny

func Deny(paths ...string) []Denied

Deny closes each path and blocks on violation.

func (Denied) MarshalYAML

func (d Denied) MarshalYAML() (any, error)

func (*Denied) UnmarshalYAML

func (d *Denied) UnmarshalYAML(node *yaml.Node) error

type DeniedError

type DeniedError struct {
	Path   string
	Access Access
	Rule   string
}

DeniedError is returned when a path is denied and the user may grant it. Rule names the denied entry, or is empty when the path is outside allowed.

func ParseDenial

func ParseDenial(msg string) (*DeniedError, bool)

ParseDenial recovers a DeniedError from a message that has been flattened into a tool-result error string.

func (*DeniedError) Error

func (e *DeniedError) Error() string

type Violation

type Violation string

Violation is what happens when a path is denied: fail the call, or ask the user to grant the access for the session.

const (
	ViolationBlock    Violation = "block"
	ViolationApproval Violation = "approval"
)

func (Violation) Valid

func (v Violation) Valid() bool

Valid reports whether v is a known violation behaviour. Empty means block.

Jump to

Keyboard shortcuts

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