accessibility

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package accessibility provides bounded, read-only native accessibility discovery without exposing platform object references outside the process.

Index

Constants

View Source
const (
	BackendATSPI2             = "at-spi2"
	BackendMacOSAccessibility = "macos-accessibility"
	BackendWindowsAutomation  = "windows-ui-automation"
)

Variables

View Source
var (
	ErrUnsupported      = errors.New("accessibility: unsupported")
	ErrUnavailable      = errors.New("accessibility: unavailable")
	ErrPermissionDenied = errors.New("accessibility: permission denied")
	ErrStaleTarget      = errors.New("accessibility: stale target")
	ErrInvalidTree      = errors.New("accessibility: invalid tree")
)

Functions

This section is empty.

Types

type ActionRequest

type ActionRequest struct {
	Target          Target
	Reference       []byte
	Expected        ElementExpectation
	Action          string
	Value           []byte
	Postcondition   *ElementCondition
	BeforeFinalGate func(context.Context) error
	BeforeDispatch  func(context.Context) error
}

ActionRequest binds one retained opaque reference to its exact top-level target and expected live semantic identity.

type ActionResult

type ActionResult struct {
	Dispatched       bool
	AlreadySatisfied bool
	CleanupComplete  bool
}

ActionResult identifies the irreversible native dispatch boundary and whether an idempotent final gate proved that dispatch was unnecessary.

func Act

func Act(ctx context.Context, request ActionRequest) (ActionResult, error)

Act re-resolves and revalidates one retained element before performing one native semantic action. It never uses pointer or keyboard fallback.

type Bounds

type Bounds struct {
	X      int
	Y      int
	Width  int
	Height int
}

Bounds is one global logical accessibility rectangle.

type Capability

type Capability struct {
	Available        bool
	Backend          string
	Reason           string
	Notes            string
	PermissionDenied bool
}

Capability is a sanitized, non-prompting native-backend probe result.

func Probe

func Probe(ctx context.Context) Capability

Probe checks native availability without opening an OS consent dialog.

type ConditionResult

type ConditionResult struct {
	Satisfied       bool
	CleanupComplete bool
}

ConditionResult is one read-only check of an observation-bound element.

func Check

func Check(ctx context.Context, request ActionRequest) (ConditionResult, error)

Check re-resolves one retained element and evaluates its postcondition without performing an action or using a fallback backend.

type ElementCondition

type ElementCondition struct {
	Kind  ElementConditionKind
	State string
}

ElementCondition contains no native reference and no private action value.

type ElementConditionKind

type ElementConditionKind string

ElementConditionKind identifies one privacy-preserving, element-relative postcondition. ValueEqualsActionValue compares against ActionRequest.Value; the condition itself never carries a value.

const (
	ElementConditionStatePresent           ElementConditionKind = "state-present"
	ElementConditionStateAbsent            ElementConditionKind = "state-absent"
	ElementConditionFocused                ElementConditionKind = "focused"
	ElementConditionNotFocused             ElementConditionKind = "not-focused"
	ElementConditionValueEqualsActionValue ElementConditionKind = "value-equals-action-value"
)

type ElementExpectation

type ElementExpectation struct {
	Role      string
	Name      string
	Sensitive bool
	States    []string
	Bounds    *Bounds
	Actions   []string
}

ElementExpectation contains only the semantic facts authorized at the agent boundary and re-read immediately before native dispatch.

type Limits

type Limits struct {
	MaxElements            uint32
	MaxDepth               uint32
	MaxStringBytes         uint32
	MaxReferenceBytes      uint32
	MaxTotalReferenceBytes uint32
	AllowedRoles           map[string]bool
	ReadName               bool
	ReadDescription        bool
	ReadValue              bool
	ReadStates             bool
	ReadBounds             bool
	ReadFocus              bool
	ReadActions            bool
}

Limits bounds both native queries and the returned snapshot.

type Node

type Node struct {
	Reference   []byte
	Parent      int
	Depth       uint32
	Role        string
	Name        string
	Description string
	Value       string
	Sensitive   bool
	Hidden      bool
	Offscreen   bool
	States      []string
	Bounds      *Bounds
	Focused     bool
	Actions     []string
}

Node is a bounded platform-neutral projection. Reference remains private to the agent session and must be zeroed when its observation is released.

type Snapshot

type Snapshot struct {
	Backend           string
	Nodes             []Node
	Truncated         bool
	IdentityTruncated bool
}

Snapshot is one bounded accessibility tree rooted at the exact target.

func Inspect

func Inspect(ctx context.Context, target Target, limits Limits) (Snapshot, error)

Inspect returns one bounded native semantic tree.

type Target

type Target struct {
	ProcessID          int
	NativeWindowHandle int
	ExpectedTitle      string
}

Target identifies one process or native window and one exact top-level accessible title. Platform backends accept only target forms they can bind to and revalidate without widening the observation scope.

Jump to

Keyboard shortcuts

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