# ComputerUse (/docs/go-sdk/computer-use)

> For AI agents: the complete documentation index is at https://www.daytona.com/llms.txt.

## ComputerUse [#computeruse]

```go
type ComputerUse struct {
	// contains filtered or unexported fields
}
```

ComputerUse controls the desktop addon. Obtain it from Sandbox.ComputerUse.
Operations can return ErrAddonUnavailable or ErrDesktopNotReady.

#### ComputerUse.A11y [#computerusea11y]

```go
func (c *ComputerUse) A11y() *ComputerUseA11y
```

A11y returns accessibility tree inspection and controls.

#### ComputerUse.Addons [#computeruseaddons]

```go
func (c *ComputerUse) Addons() *ComputerUseAddons
```

Addons returns diagnostics and controls for the addon's individual processes.

#### ComputerUse.Displays [#computerusedisplays]

```go
func (c *ComputerUse) Displays() *ComputerUseDisplays
```

Displays returns desktop display and window information.

#### ComputerUse.Keyboard [#computerusekeyboard]

```go
func (c *ComputerUse) Keyboard() *ComputerUseKeyboard
```

Keyboard returns desktop keyboard controls.

#### ComputerUse.Mouse [#computerusemouse]

```go
func (c *ComputerUse) Mouse() *ComputerUseMouse
```

Mouse returns desktop pointer controls.

#### ComputerUse.Recordings [#computeruserecordings]

```go
func (c *ComputerUse) Recordings() *ComputerUseRecordings
```

Recordings returns desktop recording operations.

#### ComputerUse.Restart [#computeruserestart]

```go
func (c *ComputerUse) Restart(
	ctx context.Context, opts *ComputerUseStartOptions,
) (*ComputerUseRestartResult, error)
```

Restart restarts the desktop at its current size, or the supplied resolution
(Linux only), and returns only after the desktop is ready.

#### ComputerUse.Screen [#computerusescreen]

```go
func (c *ComputerUse) Screen() *ComputerUseScreen
```

Screen returns screenshot capture.

#### ComputerUse.Start [#computerusestart]

```go
func (c *ComputerUse) Start(ctx context.Context, opts *ComputerUseStartOptions) (*ComputerUseLifecycleResult, error)
```

Start starts the desktop. Changing a running desktop's resolution returns
ErrConflict; use Restart instead. Nil options retain the previous resolution.

#### ComputerUse.Status [#computerusestatus]

```go
func (c *ComputerUse) Status(ctx context.Context) (*ComputerUseStatus, error)
```

Status observes desktop readiness, including the cause of a failed session.

#### ComputerUse.Stop [#computerusestop]

```go
func (c *ComputerUse) Stop(ctx context.Context) (*ComputerUseLifecycleResult, error)
```

Stop stops the desktop addon processes.

## ComputerUseA11y [#computerusea11y-1]

```go
type ComputerUseA11y struct {
	// contains filtered or unexported fields
}
```

ComputerUseA11y inspects accessibility trees and controls their nodes.
Obtain it through Sandbox.ComputerUse().A11y(); methods are concurrency-safe.

#### ComputerUseA11y.Find [#computerusea11yfind]

```go
func (a *ComputerUseA11y) Find(
	ctx context.Context, scope ComputerUseA11yScope, opts *ComputerUseA11yFindOptions,
) (*ComputerUseA11yFindResponse, error)
```

Find retrieves matching nodes. A malformed response or a match nested more
than 256 levels below its root returns ErrBadRequest.

#### ComputerUseA11y.Focus [#computerusea11yfocus]

```go
func (a *ComputerUseA11y) Focus(ctx context.Context, id string) error
```

Focus focuses the accessibility node identified by id.
Sandbox errors are returned unchanged.

#### ComputerUseA11y.Invoke [#computerusea11yinvoke]

```go
func (a *ComputerUseA11y) Invoke(ctx context.Context, id string, opts *ComputerUseA11yInvokeOptions) error
```

Invoke performs a node's default action, or opts.Action when specified.
Sandbox errors are returned unchanged.

#### ComputerUseA11y.SetValue [#computerusea11ysetvalue]

```go
func (a *ComputerUseA11y) SetValue(ctx context.Context, id, value string) error
```

SetValue sets a node's value, including an empty value.
Sandbox errors are returned unchanged.

#### ComputerUseA11y.Tree [#computerusea11ytree]

```go
func (a *ComputerUseA11y) Tree(
	ctx context.Context, scope ComputerUseA11yScope, opts *ComputerUseA11yTreeOptions,
) (*ComputerUseA11yTreeResponse, error)
```

Tree retrieves a tree, sending maxDepth=256 by default.
MaxDepth outside 0–256 or a malformed/deeper response returns ErrBadRequest.

**Example**:

```go
client, err := daytona.New()
if err != nil {
	fmt.Println(err)
	return
}
defer func() {
	if closeErr := client.Close(); closeErr != nil {
		fmt.Println(closeErr)
	}
}()
ctx := context.Background()
sandbox, err := client.Get(ctx, "sandbox-id", nil)
if err != nil {
	fmt.Println(err)
	return
}
tree, err := sandbox.ComputerUse().A11y().Tree(ctx, daytona.ComputerUseA11yScopeFocused, nil)
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println(tree.Root.Name, tree.Truncated)
```

## ComputerUseAddons [#computeruseaddons-1]

```go
type ComputerUseAddons struct {
	// contains filtered or unexported fields
}
```

ComputerUseAddons controls individual desktop addon processes.
It is distinct from the sandbox's general-purpose process engine.

#### ComputerUseAddons.Errors [#computeruseaddonserrors]

```go
func (s *ComputerUseAddons) Errors(ctx context.Context, name string) (*ComputerUseProcessErrors, error)
```

Errors reads a named addon process's error log.

#### ComputerUseAddons.Logs [#computeruseaddonslogs]

```go
func (s *ComputerUseAddons) Logs(ctx context.Context, name string) (*ComputerUseProcessLogs, error)
```

Logs reads a named addon process's logs.

#### ComputerUseAddons.ProcessStatus [#computeruseaddonsprocessstatus]

```go
func (s *ComputerUseAddons) ProcessStatus(
	ctx context.Context, name string,
) (*ComputerUseProcessRunningStatus, error)
```

ProcessStatus returns one addon's running status. Invalid names return ErrBadRequest.

#### ComputerUseAddons.Restart [#computeruseaddonsrestart]

```go
func (s *ComputerUseAddons) Restart(ctx context.Context, name string) (*ComputerUseProcessRestartResult, error)
```

Restart restarts a named addon process. Invalid names return ErrBadRequest.

#### ComputerUseAddons.Status [#computeruseaddonsstatus]

```go
func (s *ComputerUseAddons) Status(ctx context.Context) (map[string]ComputerUseProcessStatus, error)
```

Status returns all addon processes (an unpaginated map).

## ComputerUseDisplays [#computerusedisplays-1]

```go
type ComputerUseDisplays struct {
	// contains filtered or unexported fields
}
```

ComputerUseDisplays reads desktop display and window information.

#### ComputerUseDisplays.Info [#computerusedisplaysinfo]

```go
func (s *ComputerUseDisplays) Info(ctx context.Context) ([]ComputerUseDisplay, error)
```

Info returns all connected displays. This list is not paginated.

#### ComputerUseDisplays.Windows [#computerusedisplayswindows]

```go
func (s *ComputerUseDisplays) Windows(ctx context.Context) ([]ComputerUseWindow, error)
```

Windows returns all desktop windows. This list is not paginated.

## ComputerUseKeyboard [#computerusekeyboard-1]

```go
type ComputerUseKeyboard struct {
	// contains filtered or unexported fields
}
```

ComputerUseKeyboard sends desktop keyboard input.

#### ComputerUseKeyboard.Hotkey [#computerusekeyboardhotkey]

```go
func (k *ComputerUseKeyboard) Hotkey(ctx context.Context, keys string) error
```

Hotkey sends a platform hotkey expression, for example "ctrl+c".

#### ComputerUseKeyboard.Key [#computerusekeyboardkey]

```go
func (k *ComputerUseKeyboard) Key(ctx context.Context, key string, opts *ComputerUseKeyOptions) error
```

Key presses key with optional modifiers.

#### ComputerUseKeyboard.Type [#computerusekeyboardtype]

```go
func (k *ComputerUseKeyboard) Type(ctx context.Context, text string, opts *ComputerUseTypeOptions) error
```

Type types text. Nil options use the server's default of no inter-key delay.

## ComputerUseMouse [#computerusemouse-1]

```go
type ComputerUseMouse struct {
	// contains filtered or unexported fields
}
```

ComputerUseMouse controls the desktop pointer.

#### ComputerUseMouse.Click [#computerusemouseclick]

```go
func (m *ComputerUseMouse) Click(
	ctx context.Context, position ComputerUsePoint, opts *ComputerUseClickOptions,
) (*ComputerUsePoint, error)
```

Click clicks at position. Nil options select a single left click.

#### ComputerUseMouse.Drag [#computerusemousedrag]

```go
func (m *ComputerUseMouse) Drag(
	ctx context.Context, gesture ComputerUseDrag, opts *ComputerUseDragOptions,
) (*ComputerUsePoint, error)
```

Drag holds a button while dragging between two points.

#### ComputerUseMouse.Move [#computerusemousemove]

```go
func (m *ComputerUseMouse) Move(ctx context.Context, position ComputerUsePoint) (*ComputerUsePoint, error)
```

Move moves the pointer to position and returns the resulting coordinates.

#### ComputerUseMouse.Position [#computerusemouseposition]

```go
func (m *ComputerUseMouse) Position(ctx context.Context) (*ComputerUsePoint, error)
```

Position reads the pointer's current pixel coordinates.

#### ComputerUseMouse.Scroll [#computerusemousescroll]

```go
func (m *ComputerUseMouse) Scroll(
	ctx context.Context, gesture ComputerUseScroll, opts *ComputerUseScrollOptions,
) (*ComputerUseScrollResult, error)
```

Scroll scrolls at a point. Nil options use the server's default amount.

## ComputerUseRecordings [#computeruserecordings-1]

```go
type ComputerUseRecordings struct {
	// contains filtered or unexported fields
}
```

ComputerUseRecordings manages desktop recordings.

#### ComputerUseRecordings.Delete [#computeruserecordingsdelete]

```go
func (s *ComputerUseRecordings) Delete(ctx context.Context, id string) error
```

Delete removes a recording. Invalid path IDs return ErrBadRequest.

#### ComputerUseRecordings.Download [#computeruserecordingsdownload]

```go
func (s *ComputerUseRecordings) Download(
	ctx context.Context, id string, opts *ComputerUseRecordingDownloadOptions,
) ([]byte, error)
```

Download buffers a recording in memory. Transfers have no total deadline, but
the client's request timeout bounds idle gaps. The response cap is enforced
while reading; oversized bodies return ErrPayloadTooLarge.
Any error, including a response-body close failure, returns nil data.

**Example**:

```go
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
client, err := daytona.New()
if err != nil {
	log.Fatal(err)
}
defer func() {
	if closeErr := client.Close(); closeErr != nil {
		log.Print(closeErr)
	}
}()
sandbox, err := client.Get(ctx, "sandbox-id", nil)
if err != nil {
	log.Fatal(err)
}
recordings := sandbox.ComputerUse().Recordings()
recording, err := recordings.Start(ctx, nil)
if err != nil {
	log.Fatal(err)
}
if typeErr := sandbox.ComputerUse().Keyboard().Hotkey(ctx, "ctrl+l"); typeErr != nil {
	log.Fatal(typeErr)
}
if _, stopErr := recordings.Stop(ctx, recording.ID); stopErr != nil {
	log.Fatal(stopErr)
}
data, err := recordings.Download(ctx, recording.ID, &daytona.ComputerUseRecordingDownloadOptions{
	MaxResponseBytes: 16 << 20,
})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("Recording: %d bytes\n", len(data))
```

#### ComputerUseRecordings.Get [#computeruserecordingsget]

```go
func (s *ComputerUseRecordings) Get(ctx context.Context, id string) (*ComputerUseRecording, error)
```

Get reads one recording. Invalid path IDs return ErrBadRequest.

#### ComputerUseRecordings.List [#computeruserecordingslist]

```go
func (s *ComputerUseRecordings) List(ctx context.Context) ([]ComputerUseRecording, error)
```

List returns every recording. The server does not paginate this list.

#### ComputerUseRecordings.Start [#computeruserecordingsstart]

```go
func (s *ComputerUseRecordings) Start(
	ctx context.Context, opts *ComputerUseRecordingStartOptions,
) (*ComputerUseRecording, error)
```

Start starts recording. Nil options leave the label unset.

#### ComputerUseRecordings.Stop [#computeruserecordingsstop]

```go
func (s *ComputerUseRecordings) Stop(ctx context.Context, id string) (*ComputerUseRecording, error)
```

Stop stops the specified recording.

## ComputerUseScreen [#computerusescreen-1]

```go
type ComputerUseScreen struct {
	// contains filtered or unexported fields
}
```

ComputerUseScreen captures the desktop screen.

#### ComputerUseScreen.Screenshot [#computerusescreenscreenshot]

```go
func (s *ComputerUseScreen) Screenshot(
	ctx context.Context, opts *ComputerUseScreenshotOptions,
) (*ComputerUseScreenshot, error)
```

Screenshot captures the entire screen or a region. Setting Format, Quality or
Scale selects the compressed capture endpoint. The server validates encoding
options. Malformed base64 in a successful response returns ErrBadRequest.

## ComputerUseA11yFindOptions [#computerusea11yfindoptions]

```go
type ComputerUseA11yFindOptions struct {
	// PID selects a process when scope is ComputerUseA11yScopePID.
	PID *int `json:"pid,omitempty"`
	// Role restricts the accessibility role; nil omits it.
	Role *string `json:"role,omitempty"`
	// Name restricts the accessible name; nil omits it.
	Name *string `json:"name,omitempty"`
	// NameMatch selects name matching; empty uses the sandbox default.
	NameMatch ComputerUseA11yNameMatch `json:"nameMatch,omitempty"`
	// States restricts node states; nil omits it, an empty slice sends [].
	States []string `json:"states,omitempty"`
	// Limit bounds matches; nil uses the sandbox default.
	Limit *int `json:"limit,omitempty"`
}
```

ComputerUseA11yFindOptions filters accessibility nodes. Nil fields are omitted.
The sandbox validates filters and chooses omitted defaults.

## ComputerUseA11yFindResponse [#computerusea11yfindresponse]

```go
type ComputerUseA11yFindResponse struct {
	// Matches preserves server order.
	Matches []ComputerUseAccessibilityNode
	// Truncated reports that the sandbox limited the matches.
	Truncated bool
}
```

ComputerUseA11yFindResponse contains matching accessibility nodes.

## ComputerUseA11yInvokeOptions [#computerusea11yinvokeoptions]

```go
type ComputerUseA11yInvokeOptions struct {
	// Action selects an action; nil invokes the node's default action.
	Action *string
}
```

ComputerUseA11yInvokeOptions selects an accessibility action.

## ComputerUseA11yNameMatch [#computerusea11ynamematch]

```go
type ComputerUseA11yNameMatch string
```

ComputerUseA11yNameMatch selects how a node name is matched.

```go
const (
	// ComputerUseA11yNameMatchUnknown represents an unrecognized matching mode.
	ComputerUseA11yNameMatchUnknown ComputerUseA11yNameMatch = "unknown"
	// ComputerUseA11yNameMatchExact matches the complete name.
	ComputerUseA11yNameMatchExact ComputerUseA11yNameMatch = "exact"
	// ComputerUseA11yNameMatchSubstring matches part of the name.
	ComputerUseA11yNameMatchSubstring ComputerUseA11yNameMatch = "substring"
	// ComputerUseA11yNameMatchRegex matches a regular expression.
	ComputerUseA11yNameMatchRegex ComputerUseA11yNameMatch = "regex"
)
```

## ComputerUseA11yScope [#computerusea11yscope]

```go
type ComputerUseA11yScope string
```

ComputerUseA11yScope selects which applications to inspect.

```go
const (
	// ComputerUseA11yScopeUnknown represents an unrecognized scope.
	ComputerUseA11yScopeUnknown ComputerUseA11yScope = "unknown"
	// ComputerUseA11yScopeFocused inspects the focused application.
	ComputerUseA11yScopeFocused ComputerUseA11yScope = "focused"
	// ComputerUseA11yScopePID inspects the application selected by PID.
	ComputerUseA11yScopePID ComputerUseA11yScope = "pid"
	// ComputerUseA11yScopeAll inspects all applications.
	ComputerUseA11yScopeAll ComputerUseA11yScope = "all"
)
```

## ComputerUseA11yTreeOptions [#computerusea11ytreeoptions]

```go
type ComputerUseA11yTreeOptions struct {
	// PID selects a process when scope is ComputerUseA11yScopePID.
	PID *int
	// MaxDepth counts levels below the root, from 0 to 256; nil sends 256.
	MaxDepth *int
}
```

ComputerUseA11yTreeOptions configures accessibility tree retrieval.

## ComputerUseA11yTreeResponse [#computerusea11ytreeresponse]

```go
type ComputerUseA11yTreeResponse struct {
	// Root is the tree's root node.
	Root ComputerUseAccessibilityNode
	// Truncated reports that the sandbox limited the tree.
	Truncated bool
}
```

ComputerUseA11yTreeResponse contains an accessibility tree.

## ComputerUseAccessibilityBounds [#computeruseaccessibilitybounds]

```go
type ComputerUseAccessibilityBounds struct {
	// X is the horizontal coordinate in pixels.
	X int
	// Y is the vertical coordinate in pixels.
	Y int
	// Width is the width in pixels.
	Width int
	// Height is the height in pixels.
	Height int
}
```

ComputerUseAccessibilityBounds is an accessibility node's rectangle in pixels.
Coordinates and dimensions are parsed within the signed 32-bit wire range.

## ComputerUseAccessibilityNode [#computeruseaccessibilitynode]

```go
type ComputerUseAccessibilityNode struct {
	// ID identifies the node for subsequent actions.
	ID string
	// Role is the platform-defined accessibility role.
	Role string
	// Name is the accessible name.
	Name string
	// Description is nil when not reported.
	Description *string
	// Value is the current control value, never reported for password fields.
	Value *string
	// ValueTruncated reports a platform-truncated value; absent means false.
	ValueTruncated bool
	// Bounds is the control rectangle in pixels.
	Bounds ComputerUseAccessibilityBounds
	// States contains platform-defined accessibility states.
	States []string
	// Actions lists supported actions; nil means not reported.
	Actions []string
	// Children preserves server order; nil means not reported.
	Children []ComputerUseAccessibilityNode
}
```

ComputerUseAccessibilityNode describes one accessibility control.

## ComputerUseActivityStatus [#computeruseactivitystatus]

```go
type ComputerUseActivityStatus string
```

ComputerUseActivityStatus is the desktop activity state.

```go
const (
	// ComputerUseActivityUnknown denotes an unrecognized status/desktop pair.
	ComputerUseActivityUnknown ComputerUseActivityStatus = "unknown"
	// ComputerUseActivityActive means the desktop is ready.
	ComputerUseActivityActive ComputerUseActivityStatus = "active"
	// ComputerUseActivityInactive means the desktop is not ready.
	ComputerUseActivityInactive ComputerUseActivityStatus = "inactive"
)
```

## ComputerUseClickOptions [#computeruseclickoptions]

```go
type ComputerUseClickOptions struct {
	// Button defaults to left.
	Button ComputerUseMouseButton `json:"button,omitempty"`
	// Double performs a double click when true.
	Double bool `json:"double,omitempty"`
}
```

ComputerUseClickOptions selects a mouse button and click count.

## ComputerUseDesktopFailure [#computerusedesktopfailure]

```go
type ComputerUseDesktopFailure struct {
	// Code is the normalized failure code.
	Code ComputerUseDesktopFailureCode
	// RawCode is the server code verbatim.
	RawCode string
	// Message is the server explanation.
	Message string
	// ExtraFields preserves additional server fields.
	ExtraFields map[string]JSONValue
}
```

ComputerUseDesktopFailure describes a failed session.

## ComputerUseDesktopFailureCode [#computerusedesktopfailurecode]

```go
type ComputerUseDesktopFailureCode string
```

ComputerUseDesktopFailureCode identifies the reason a desktop session failed.

```go
const (
	// ComputerUseFailureUnknown preserves an unrecognized code in RawCode.
	ComputerUseFailureUnknown ComputerUseDesktopFailureCode = "unknown"
	// ComputerUseFailureDesktopExited means the desktop exited.
	ComputerUseFailureDesktopExited ComputerUseDesktopFailureCode = "desktop_exited"
	// ComputerUseFailureAddonCrashed means the addon crashed.
	ComputerUseFailureAddonCrashed ComputerUseDesktopFailureCode = "addon_crashed"
	// ComputerUseFailureStartFailed means startup failed.
	ComputerUseFailureStartFailed ComputerUseDesktopFailureCode = "start_failed"
	// ComputerUseFailureStartInterrupted means startup was interrupted.
	ComputerUseFailureStartInterrupted ComputerUseDesktopFailureCode = "start_interrupted"
	// ComputerUseFailureSessionEnded means the session ended.
	ComputerUseFailureSessionEnded ComputerUseDesktopFailureCode = "session_ended"
	// ComputerUseFailureSessionReplaced means another session replaced this one.
	ComputerUseFailureSessionReplaced ComputerUseDesktopFailureCode = "session_replaced"
	// ComputerUseFailureStateCorrupt means persisted session state is corrupt.
	ComputerUseFailureStateCorrupt ComputerUseDesktopFailureCode = "state_corrupt"
	// ComputerUseFailureStatePersistenceFailed means session state could not be saved.
	ComputerUseFailureStatePersistenceFailed ComputerUseDesktopFailureCode = "state_persistence_failed"
)
```

## ComputerUseDesktopState [#computerusedesktopstate]

```go
type ComputerUseDesktopState string
```

ComputerUseDesktopState is the observed desktop session state.

```go
const (
	// ComputerUseDesktopUnknown denotes an unrecognized status/desktop pair.
	ComputerUseDesktopUnknown ComputerUseDesktopState = "unknown"
	// ComputerUseDesktopNotStarted means no desktop has started.
	ComputerUseDesktopNotStarted ComputerUseDesktopState = "not_started"
	// ComputerUseDesktopStarting means startup is in progress.
	ComputerUseDesktopStarting ComputerUseDesktopState = "starting"
	// ComputerUseDesktopReady means the desktop can accept input.
	ComputerUseDesktopReady ComputerUseDesktopState = "ready"
	// ComputerUseDesktopFailed means the session failed; inspect Cause.
	ComputerUseDesktopFailed ComputerUseDesktopState = "failed"
)
```

## ComputerUseDisplay [#computerusedisplay]

```go
type ComputerUseDisplay struct {
	// ID identifies the display.
	ID int64
	// X is its horizontal pixel offset.
	X int
	// Y is its vertical pixel offset.
	Y int
	// Width is its pixel width.
	Width int
	// Height is its pixel height.
	Height int
	// IsActive reports whether it is active.
	IsActive bool
}
```

ComputerUseDisplay describes one connected display.

## ComputerUseDrag [#computerusedrag]

```go
type ComputerUseDrag struct {
	// Start is the initial pointer location.
	Start ComputerUsePoint
	// End is the destination.
	End ComputerUsePoint
}
```

ComputerUseDrag is a pointer movement between two desktop locations.

## ComputerUseDragOptions [#computerusedragoptions]

```go
type ComputerUseDragOptions struct {
	// Button defaults to left.
	Button ComputerUseMouseButton
}
```

ComputerUseDragOptions selects the held button.

## ComputerUseKeyOptions [#computerusekeyoptions]

```go
type ComputerUseKeyOptions struct {
	// Modifiers is omitted when nil; an empty non-nil slice sends an empty list.
	Modifiers []ComputerUseKeyboardModifier
}
```

ComputerUseKeyOptions selects held modifier keys.

## ComputerUseKeyboardModifier [#computerusekeyboardmodifier]

```go
type ComputerUseKeyboardModifier string
```

ComputerUseKeyboardModifier is a held modifier key.

```go
const (
	// ComputerUseModifierUnknown denotes an unrecognized modifier.
	ComputerUseModifierUnknown ComputerUseKeyboardModifier = "unknown"
	// ComputerUseModifierCtrl is Control.
	ComputerUseModifierCtrl ComputerUseKeyboardModifier = "ctrl"
	// ComputerUseModifierAlt is Alt.
	ComputerUseModifierAlt ComputerUseKeyboardModifier = "alt"
	// ComputerUseModifierShift is Shift.
	ComputerUseModifierShift ComputerUseKeyboardModifier = "shift"
	// ComputerUseModifierCmd is Command.
	ComputerUseModifierCmd ComputerUseKeyboardModifier = "cmd"
)
```

## ComputerUseLifecycleResult [#computeruselifecycleresult]

```go
type ComputerUseLifecycleResult struct {
	// Message is the server explanation.
	Message string
	// Status is keyed by addon process name.
	Status map[string]ComputerUseProcessStatus
}
```

ComputerUseLifecycleResult reports addon startup or shutdown.

## ComputerUseMouseButton [#computerusemousebutton]

```go
type ComputerUseMouseButton string
```

ComputerUseMouseButton selects a pointer button.

```go
const (
	// ComputerUseMouseButtonUnknown is an unrecognized button.
	ComputerUseMouseButtonUnknown ComputerUseMouseButton = "unknown"
	// ComputerUseMouseButtonLeft is the primary button.
	ComputerUseMouseButtonLeft ComputerUseMouseButton = "left"
	// ComputerUseMouseButtonRight is the secondary button.
	ComputerUseMouseButtonRight ComputerUseMouseButton = "right"
	// ComputerUseMouseButtonMiddle is the middle button.
	ComputerUseMouseButtonMiddle ComputerUseMouseButton = "middle"
)
```

## ComputerUsePoint [#computerusepoint]

```go
type ComputerUsePoint struct {
	// X is the horizontal position in pixels.
	X int `json:"x"`
	// Y is the vertical position in pixels.
	Y int `json:"y"`
}
```

ComputerUsePoint is a location in desktop pixels.

## ComputerUseProcessErrors [#computeruseprocesserrors]

```go
type ComputerUseProcessErrors struct {
	// ProcessName identifies the process.
	ProcessName string
	// Errors contains its error text.
	Errors string
}
```

ComputerUseProcessErrors contains a named process's error text.

## ComputerUseProcessLogs [#computeruseprocesslogs]

```go
type ComputerUseProcessLogs struct {
	// ProcessName identifies the process.
	ProcessName string
	// Logs contains its log text.
	Logs string
}
```

ComputerUseProcessLogs contains a named process's log text.

## ComputerUseProcessRestartResult [#computeruseprocessrestartresult]

```go
type ComputerUseProcessRestartResult struct {
	// Message is the server explanation.
	Message string
	// ProcessName identifies the restarted process.
	ProcessName string
}
```

ComputerUseProcessRestartResult reports a named process restart.

## ComputerUseProcessRunningStatus [#computeruseprocessrunningstatus]

```go
type ComputerUseProcessRunningStatus struct {
	// ProcessName identifies the process.
	ProcessName string
	// Running reports whether it is running.
	Running bool
}
```

ComputerUseProcessRunningStatus reports whether a named addon process is running.

## ComputerUseProcessStatus [#computeruseprocessstatus]

```go
type ComputerUseProcessStatus struct {
	// Running reports whether the process is running.
	Running bool
	// Priority is its startup priority.
	Priority int
	// AutoRestart reports whether the addon restarts it automatically.
	AutoRestart bool
	// PID is absent when no process ID was reported.
	PID *int
	// Failed reports whether the process failed.
	Failed bool
	// RestartAttempts counts attempted restarts.
	RestartAttempts int
	// RestartBackoff is the current restart delay.
	RestartBackoff time.Duration
	// Status is the server's open status string.
	Status string
	// ExtraFields preserves unknown fields, with leading initialisms lowercased.
	ExtraFields map[string]JSONValue
}
```

ComputerUseProcessStatus describes an addon-managed process.

## ComputerUseRecording [#computeruserecording]

```go
type ComputerUseRecording struct {
	// ID identifies the recording.
	ID string
	// FileName is its file name.
	FileName string
	// FilePath is its absolute path in the sandbox.
	FilePath string
	// StartTime is when recording started.
	StartTime time.Time
	// EndTime is zero until reported.
	EndTime time.Time
	// Status is the server's open recording status.
	Status string
	// Duration is absent until reported.
	Duration *time.Duration
	// SizeBytes is absent until reported.
	SizeBytes *int64
}
```

ComputerUseRecording describes a recording stored in the sandbox.

## ComputerUseRecordingDownloadOptions [#computeruserecordingdownloadoptions]

```go
type ComputerUseRecordingDownloadOptions struct {
	// MaxResponseBytes replaces the client's cap; zero keeps the client default,
	// NoLimit disables it. Other negative values return ErrBadRequest.
	MaxResponseBytes int64
}
```

ComputerUseRecordingDownloadOptions controls the in-memory recording limit.

## ComputerUseRecordingStartOptions [#computeruserecordingstartoptions]

```go
type ComputerUseRecordingStartOptions struct {
	// Label is omitted when nil; a pointer to "" sends an empty label.
	Label *string `json:"label,omitempty"`
}
```

ComputerUseRecordingStartOptions labels a recording.

## ComputerUseRegion [#computeruseregion]

```go
type ComputerUseRegion struct {
	// X is the left edge in pixels.
	X int
	// Y is the top edge in pixels.
	Y int
	// Width is the horizontal extent in pixels.
	Width int
	// Height is the vertical extent in pixels.
	Height int
}
```

ComputerUseRegion is a desktop rectangle in pixels.

## ComputerUseResolution [#computeruseresolution]

```go
type ComputerUseResolution struct {
	// Width is the horizontal pixel count.
	Width int `json:"width"`
	// Height is the vertical pixel count.
	Height int `json:"height"`
}
```

ComputerUseResolution is a desktop size in pixels (1024x768, 1280x720 or 1920x1080).

## ComputerUseRestartResult [#computeruserestartresult]

```go
type ComputerUseRestartResult struct {
	// Message is the server explanation.
	Message string
	// Status is active.
	Status ComputerUseActivityStatus
	// Desktop is ready.
	Desktop ComputerUseDesktopState
	// ExtraFields preserves additional server fields.
	ExtraFields map[string]JSONValue
}
```

ComputerUseRestartResult reports a successfully restarted desktop.

## ComputerUseScreenshot [#computerusescreenshot]

```go
type ComputerUseScreenshot struct {
	// Data is the decoded image, not base64 text.
	Data []byte
	// SizeBytes is the server's image size in bytes.
	SizeBytes int64
	// CursorPosition is absent when not reported.
	CursorPosition *ComputerUsePoint
}
```

ComputerUseScreenshot is a captured image with server-reported metadata.

## ComputerUseScreenshotFormat [#computerusescreenshotformat]

```go
type ComputerUseScreenshotFormat string
```

ComputerUseScreenshotFormat selects screenshot encoding.

```go
const (
	// ComputerUseScreenshotUnknown is an unrecognized format.
	ComputerUseScreenshotUnknown ComputerUseScreenshotFormat = "unknown"
	// ComputerUseScreenshotPNG selects PNG encoding.
	ComputerUseScreenshotPNG ComputerUseScreenshotFormat = "png"
	// ComputerUseScreenshotJPEG selects JPEG encoding.
	ComputerUseScreenshotJPEG ComputerUseScreenshotFormat = "jpeg"
)
```

## ComputerUseScreenshotOptions [#computerusescreenshotoptions]

```go
type ComputerUseScreenshotOptions struct {
	// Region defaults to the entire screen.
	Region *ComputerUseRegion
	// Format selects compression; empty leaves the server default.
	Format ComputerUseScreenshotFormat
	// Quality selects compression quality. Nil leaves the server default.
	Quality *int
	// Scale selects the image scale factor. Nil leaves the server default.
	Scale *float64
	// ShowCursor controls cursor rendering; nil leaves the server default.
	ShowCursor *bool
}
```

ComputerUseScreenshotOptions selects the captured region and encoding.

## ComputerUseScroll [#computerusescroll]

```go
type ComputerUseScroll struct {
	// Position is where to scroll.
	Position ComputerUsePoint
	// Direction is up or down.
	Direction ComputerUseScrollDirection
}
```

ComputerUseScroll is a scroll gesture at a desktop point.

## ComputerUseScrollDirection [#computerusescrolldirection]

```go
type ComputerUseScrollDirection string
```

ComputerUseScrollDirection selects vertical scrolling.

```go
const (
	// ComputerUseScrollUnknown is an unrecognized direction.
	ComputerUseScrollUnknown ComputerUseScrollDirection = "unknown"
	// ComputerUseScrollUp scrolls upward.
	ComputerUseScrollUp ComputerUseScrollDirection = "up"
	// ComputerUseScrollDown scrolls downward.
	ComputerUseScrollDown ComputerUseScrollDirection = "down"
)
```

## ComputerUseScrollOptions [#computerusescrolloptions]

```go
type ComputerUseScrollOptions struct {
	// Amount is the scroll amount; nil uses the server default.
	Amount *int
}
```

ComputerUseScrollOptions controls scroll distance.

## ComputerUseScrollResult [#computerusescrollresult]

```go
type ComputerUseScrollResult struct {
	// Success is the server-reported result.
	Success bool
}
```

ComputerUseScrollResult reports whether scrolling succeeded.

## ComputerUseStartOptions [#computerusestartoptions]

```go
type ComputerUseStartOptions struct {
	// Resolution defaults to the last started size, initially 1280x720.
	// The server validates supported sizes. Only Linux supports this option.
	Resolution *ComputerUseResolution `json:"resolution,omitempty"`
}
```

ComputerUseStartOptions selects the persistent desktop resolution.

## ComputerUseStatus [#computerusestatus-1]

```go
type ComputerUseStatus struct {
	// Status is the normalized activity.
	Status ComputerUseActivityStatus
	// Desktop is the normalized desktop state.
	Desktop ComputerUseDesktopState
	// RawStatus is the activity value verbatim.
	RawStatus string
	// RawDesktop is the desktop value verbatim.
	RawDesktop string
	// Cause is non-nil for failed sessions and may accompany unknown pairs.
	Cause *ComputerUseDesktopFailure
	// ExtraFields preserves additional server fields.
	ExtraFields map[string]JSONValue
}
```

ComputerUseStatus describes the last observed status/desktop pair.
Known pairs are inactive/not_started, inactive/starting, active/ready and
inactive/failed (the last requires Cause). Other pairs normalize both fields
to Unknown, retaining raw values and any attached cause.

## ComputerUseTypeOptions [#computerusetypeoptions]

```go
type ComputerUseTypeOptions struct {
	// Delay is the pause between key presses, rounded up to milliseconds.
	// Zero uses the server default (no delay); negative durations return ErrBadRequest.
	Delay time.Duration
}
```

ComputerUseTypeOptions controls typing cadence.

## ComputerUseWindow [#computerusewindow]

```go
type ComputerUseWindow struct {
	// ID identifies the window.
	ID int64
	// Title is the window title.
	Title string
	// X is its horizontal position in pixels.
	X int
	// Y is its vertical position in pixels.
	Y int
	// Width is its pixel width.
	Width int
	// Height is its pixel height.
	Height int
	// IsActive reports whether it is active.
	IsActive bool
}
```

ComputerUseWindow describes a desktop window.
