ComputerUse
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
func (c *ComputerUse) A11y() *ComputerUseA11yA11y returns accessibility tree inspection and controls.
ComputerUse.Addons
func (c *ComputerUse) Addons() *ComputerUseAddonsAddons returns diagnostics and controls for the addon's individual processes.
ComputerUse.Displays
func (c *ComputerUse) Displays() *ComputerUseDisplaysDisplays returns desktop display and window information.
ComputerUse.Keyboard
func (c *ComputerUse) Keyboard() *ComputerUseKeyboardKeyboard returns desktop keyboard controls.
ComputerUse.Mouse
func (c *ComputerUse) Mouse() *ComputerUseMouseMouse returns desktop pointer controls.
ComputerUse.Recordings
func (c *ComputerUse) Recordings() *ComputerUseRecordingsRecordings returns desktop recording operations.
ComputerUse.Restart
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
func (c *ComputerUse) Screen() *ComputerUseScreenScreen returns screenshot capture.
ComputerUse.Start
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
func (c *ComputerUse) Status(ctx context.Context) (*ComputerUseStatus, error)Status observes desktop readiness, including the cause of a failed session.
ComputerUse.Stop
func (c *ComputerUse) Stop(ctx context.Context) (*ComputerUseLifecycleResult, error)Stop stops the desktop addon processes.
ComputerUseA11y
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
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
func (a *ComputerUseA11y) Focus(ctx context.Context, id string) errorFocus focuses the accessibility node identified by id. Sandbox errors are returned unchanged.
ComputerUseA11y.Invoke
func (a *ComputerUseA11y) Invoke(ctx context.Context, id string, opts *ComputerUseA11yInvokeOptions) errorInvoke performs a node's default action, or opts.Action when specified. Sandbox errors are returned unchanged.
ComputerUseA11y.SetValue
func (a *ComputerUseA11y) SetValue(ctx context.Context, id, value string) errorSetValue sets a node's value, including an empty value. Sandbox errors are returned unchanged.
ComputerUseA11y.Tree
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:
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
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
func (s *ComputerUseAddons) Errors(ctx context.Context, name string) (*ComputerUseProcessErrors, error)Errors reads a named addon process's error log.
ComputerUseAddons.Logs
func (s *ComputerUseAddons) Logs(ctx context.Context, name string) (*ComputerUseProcessLogs, error)Logs reads a named addon process's logs.
ComputerUseAddons.ProcessStatus
func (s *ComputerUseAddons) ProcessStatus(
ctx context.Context, name string,
) (*ComputerUseProcessRunningStatus, error)ProcessStatus returns one addon's running status. Invalid names return ErrBadRequest.
ComputerUseAddons.Restart
func (s *ComputerUseAddons) Restart(ctx context.Context, name string) (*ComputerUseProcessRestartResult, error)Restart restarts a named addon process. Invalid names return ErrBadRequest.
ComputerUseAddons.Status
func (s *ComputerUseAddons) Status(ctx context.Context) (map[string]ComputerUseProcessStatus, error)Status returns all addon processes (an unpaginated map).
ComputerUseDisplays
type ComputerUseDisplays struct {
// contains filtered or unexported fields
}ComputerUseDisplays reads desktop display and window information.
ComputerUseDisplays.Info
func (s *ComputerUseDisplays) Info(ctx context.Context) ([]ComputerUseDisplay, error)Info returns all connected displays. This list is not paginated.
ComputerUseDisplays.Windows
func (s *ComputerUseDisplays) Windows(ctx context.Context) ([]ComputerUseWindow, error)Windows returns all desktop windows. This list is not paginated.
ComputerUseKeyboard
type ComputerUseKeyboard struct {
// contains filtered or unexported fields
}ComputerUseKeyboard sends desktop keyboard input.
ComputerUseKeyboard.Hotkey
func (k *ComputerUseKeyboard) Hotkey(ctx context.Context, keys string) errorHotkey sends a platform hotkey expression, for example "ctrl+c".
ComputerUseKeyboard.Key
func (k *ComputerUseKeyboard) Key(ctx context.Context, key string, opts *ComputerUseKeyOptions) errorKey presses key with optional modifiers.
ComputerUseKeyboard.Type
func (k *ComputerUseKeyboard) Type(ctx context.Context, text string, opts *ComputerUseTypeOptions) errorType types text. Nil options use the server's default of no inter-key delay.
ComputerUseMouse
type ComputerUseMouse struct {
// contains filtered or unexported fields
}ComputerUseMouse controls the desktop pointer.
ComputerUseMouse.Click
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
func (m *ComputerUseMouse) Drag(
ctx context.Context, gesture ComputerUseDrag, opts *ComputerUseDragOptions,
) (*ComputerUsePoint, error)Drag holds a button while dragging between two points.
ComputerUseMouse.Move
func (m *ComputerUseMouse) Move(ctx context.Context, position ComputerUsePoint) (*ComputerUsePoint, error)Move moves the pointer to position and returns the resulting coordinates.
ComputerUseMouse.Position
func (m *ComputerUseMouse) Position(ctx context.Context) (*ComputerUsePoint, error)Position reads the pointer's current pixel coordinates.
ComputerUseMouse.Scroll
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
type ComputerUseRecordings struct {
// contains filtered or unexported fields
}ComputerUseRecordings manages desktop recordings.
ComputerUseRecordings.Delete
func (s *ComputerUseRecordings) Delete(ctx context.Context, id string) errorDelete removes a recording. Invalid path IDs return ErrBadRequest.
ComputerUseRecordings.Download
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:
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
func (s *ComputerUseRecordings) Get(ctx context.Context, id string) (*ComputerUseRecording, error)Get reads one recording. Invalid path IDs return ErrBadRequest.
ComputerUseRecordings.List
func (s *ComputerUseRecordings) List(ctx context.Context) ([]ComputerUseRecording, error)List returns every recording. The server does not paginate this list.
ComputerUseRecordings.Start
func (s *ComputerUseRecordings) Start(
ctx context.Context, opts *ComputerUseRecordingStartOptions,
) (*ComputerUseRecording, error)Start starts recording. Nil options leave the label unset.
ComputerUseRecordings.Stop
func (s *ComputerUseRecordings) Stop(ctx context.Context, id string) (*ComputerUseRecording, error)Stop stops the specified recording.
ComputerUseScreen
type ComputerUseScreen struct {
// contains filtered or unexported fields
}ComputerUseScreen captures the desktop screen.
ComputerUseScreen.Screenshot
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
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
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
type ComputerUseA11yInvokeOptions struct {
// Action selects an action; nil invokes the node's default action.
Action *string
}ComputerUseA11yInvokeOptions selects an accessibility action.
ComputerUseA11yNameMatch
type ComputerUseA11yNameMatch stringComputerUseA11yNameMatch selects how a node name is matched.
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
type ComputerUseA11yScope stringComputerUseA11yScope selects which applications to inspect.
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
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
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
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
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
type ComputerUseActivityStatus stringComputerUseActivityStatus is the desktop activity state.
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
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
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
type ComputerUseDesktopFailureCode stringComputerUseDesktopFailureCode identifies the reason a desktop session failed.
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
type ComputerUseDesktopState stringComputerUseDesktopState is the observed desktop session state.
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
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
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
type ComputerUseDragOptions struct {
// Button defaults to left.
Button ComputerUseMouseButton
}ComputerUseDragOptions selects the held button.
ComputerUseKeyOptions
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
type ComputerUseKeyboardModifier stringComputerUseKeyboardModifier is a held modifier key.
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
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
type ComputerUseMouseButton stringComputerUseMouseButton selects a pointer button.
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
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
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
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
type ComputerUseProcessRestartResult struct {
// Message is the server explanation.
Message string
// ProcessName identifies the restarted process.
ProcessName string
}ComputerUseProcessRestartResult reports a named process restart.
ComputerUseProcessRunningStatus
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
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
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
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
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
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
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
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
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
type ComputerUseScreenshotFormat stringComputerUseScreenshotFormat selects screenshot encoding.
const (
// ComputerUseScreenshotUnknown is an unrecognized format.
ComputerUseScreenshotUnknown ComputerUseScreenshotFormat = "unknown"
// ComputerUseScreenshotPNG selects PNG encoding.
ComputerUseScreenshotPNG ComputerUseScreenshotFormat = "png"
// ComputerUseScreenshotJPEG selects JPEG encoding.
ComputerUseScreenshotJPEG ComputerUseScreenshotFormat = "jpeg"
)ComputerUseScreenshotOptions
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
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
type ComputerUseScrollDirection stringComputerUseScrollDirection selects vertical scrolling.
const (
// ComputerUseScrollUnknown is an unrecognized direction.
ComputerUseScrollUnknown ComputerUseScrollDirection = "unknown"
// ComputerUseScrollUp scrolls upward.
ComputerUseScrollUp ComputerUseScrollDirection = "up"
// ComputerUseScrollDown scrolls downward.
ComputerUseScrollDown ComputerUseScrollDirection = "down"
)ComputerUseScrollOptions
type ComputerUseScrollOptions struct {
// Amount is the scroll amount; nil uses the server default.
Amount *int
}ComputerUseScrollOptions controls scroll distance.
ComputerUseScrollResult
type ComputerUseScrollResult struct {
// Success is the server-reported result.
Success bool
}ComputerUseScrollResult reports whether scrolling succeeded.
ComputerUseStartOptions
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
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
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
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.