domain

package
v0.263.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 6 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

Index

Constants

This section is empty.

Variables

View Source
var ErrScreenNotHeld = errors.New("the screen is not held")

ErrScreenNotHeld refuses an input for a screen nobody holds, so a stale tab cannot drive what it handed back.

Functions

func IsInputAction added in v0.245.0

func IsInputAction(kind ActionKind) bool

IsInputAction reports whether the agent executes the kind by driving the pointer, keyboard or clipboard, so it waits while the person holds the screen. Observations capture or read and never wait.

Types

type Action

type Action struct {
	Kind      ActionKind
	Target    *Target
	Text      string
	Label     string
	Scope     string
	Combo     string
	Button    string
	Direction string
	Amount    int
}

Action is one computer-use request. Text is what to type, Label an exact accessibility label, Scope frontmost, dock, menubar, app:<name> or pid:<n>, Combo a key combo, Button left, right or middle, and Direction and Amount the scroll axis and wheel clicks, negative to reverse.

type ActionKind

type ActionKind string

ActionKind enumerates what the Computer tool can do.

const (
	ActionScreenshot    ActionKind = "screenshot"
	ActionAccessibility ActionKind = "accessibility"
	ActionCursor        ActionKind = "cursor"
	ActionMove          ActionKind = "move"
	ActionClick         ActionKind = "click"
	ActionDoubleClick   ActionKind = "double_click"
	ActionTripleClick   ActionKind = "triple_click"
	ActionScroll        ActionKind = "scroll"
	ActionType          ActionKind = "type"
	ActionKey           ActionKind = "key"
	ActionPress         ActionKind = "press"
	ActionMouseDown     ActionKind = "mouse_down"
	ActionMouseUp       ActionKind = "mouse_up"
)

type HeldButtons added in v0.253.0

type HeldButtons map[string]struct{}

HeldButtons are the pointer buttons a person pressed and has not let go of, so a hold that ends mid-drag can release them.

func (HeldButtons) Names added in v0.253.0

func (h HeldButtons) Names() []string

Names lists the held buttons in a stable order.

func (HeldButtons) Track added in v0.253.0

func (h HeldButtons) Track(a Action)

Track follows one performed action: a mouse_down holds its button and a mouse_up lets it go. Every other action leaves the buttons as they are.

type Image

type Image struct {
	Data     string `json:"-"`
	MimeType string
	Path     string
}

Image is a captured frame. Data is base64 and kept in memory only, while Path is the on-disk copy ImageDecode reads for non-vision models.

type Observation

type Observation struct {
	Message  string
	CursorX  int
	CursorY  int
	Width    int
	Height   int
	Image    *Image
	Elements []UIElement
}

Observation is what the computer reports back after an action: an LLM-facing Message, the cursor, the frame-space size, and the Image of a screenshot or the Elements of an accessibility observation.

type Region

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

Region is a rectangle in the frame coordinate space.

type ScreenControl added in v0.245.0

type ScreenControl interface {
	// TakeOver claims the screen for the person. It fails while the person
	// already holds it, from another tab of the same session or another one.
	TakeOver() error
	// HandBack releases the screen to the agent and reports whether it was
	// held. Releasing an unheld screen is a no-op.
	HandBack() bool
	// Held reports whether the person currently drives the screen.
	Held() bool
	// WaitRelease blocks while the person drives the screen and returns when
	// the agent may act again, or the context's error when its turn ends.
	WaitRelease(ctx context.Context) error
	// Drive performs one person input on the held screen in frame space,
	// and refuses with ErrScreenNotHeld when nobody holds it.
	Drive(ctx context.Context, input ScreenInput) error
	// Follow names who keeps the streamed screen current during a hold,
	// replacing the follower before it.
	Follow(follower ScreenFollower)
}

ScreenControl owns the take-over invariant: exactly one actor, the person at the keyboard or the agent, drives a screen at a time. TakeOver claims it for the person, HandBack hands it to the agent and WaitRelease blocks one agent input action until the person lets go.

type ScreenFollower added in v0.253.0

type ScreenFollower interface {
	HoldChanged(held bool)
	InputLanded()
}

ScreenFollower keeps the streamed screen current for the person who holds it. It is told when a hold starts or ends and when an input has landed.

type ScreenInput added in v0.245.0

type ScreenInput struct {
	Kind      ActionKind `json:"kind"`
	X         int        `json:"x,omitempty"`
	Y         int        `json:"y,omitempty"`
	Text      string     `json:"text,omitempty"`
	Combo     string     `json:"combo,omitempty"`
	Button    string     `json:"button,omitempty"`
	Direction string     `json:"direction,omitempty"`
	Amount    int        `json:"amount,omitempty"`
}

ScreenInput is one person-driven input on the session's screen, in the frame space the Screen view's image uses. Kind is move, click, double_click, mouse_down, mouse_up, scroll, type or key, and the other fields mean what they mean on Action.

func (ScreenInput) Action added in v0.245.0

func (s ScreenInput) Action() (Action, error)

Action builds the action this input drives the screen with, so the display dispatch stays one code path with the Computer tool's and validates both.

type Target

type Target struct {
	X      int
	Y      int
	Region *Region
}

Target locates an action in frame space, the space screenshots and their annotations use. Region limits a screenshot to that rectangle.

type UIElement added in v0.179.0

type UIElement struct {
	Role  string `json:"role"`
	Label string `json:"label"`
	State string `json:"state"`
	BBox  [4]int `json:"bbox"`
}

UIElement is one compact accessibility-tree observation. BBox is [left, top, right, bottom] in the same frame coordinate space as Computer screenshots and pointer actions.

Jump to

Keyboard shortcuts

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