Documentation
¶
Overview ¶
cua-driver, the program computer use drives the desktop through: where it is, whether it keeps the contract icebath needs, what readies it once it installs and the sessions of it a backend holds
Index ¶
- Constants
- func Supported() bool
- func Unknown(cfg *config.Config) error
- type Action
- type Autostart
- type Backend
- func (b *Backend) App() string
- func (b *Backend) Capture(ctx context.Context, mode, app string, pid, window *int) (*Capture, error)
- func (b *Backend) Click(ctx context.Context, c Click) *Action
- func (b *Backend) Drag(ctx context.Context, d Drag) *Action
- func (b *Backend) FocusApp(ctx context.Context, app string, raise bool) (*Action, error)
- func (b *Backend) Key(ctx context.Context, keys string, d Delivery) *Action
- func (b *Backend) ListApps(ctx context.Context) ([]any, error)
- func (b *Backend) ListWindows(ctx context.Context) ([]map[string]any, error)
- func (b *Backend) Scroll(ctx context.Context, s Scroll) *Action
- func (b *Backend) SetValue(ctx context.Context, value string, element *int) *Action
- func (b *Backend) Start(ctx context.Context) error
- func (b *Backend) Stop() error
- func (b *Backend) Target() (pid, window *int)
- func (b *Backend) Type(ctx context.Context, text string, d Delivery) *Action
- func (b *Backend) Wait(ctx context.Context, seconds float64) *Action
- type Capture
- type Checked
- type Click
- type Contract
- type Delivery
- type Drag
- type Driver
- func (d *Driver) Backend(cfg *config.Config, mode string) (*Backend, error)
- func (d *Driver) Command(cfg *config.Config, given string) (string, error)
- func (d *Driver) Contract(ctx context.Context, cfg *config.Config, binary string) (Contract, error)
- func (d *Driver) Display(cfg *config.Config) string
- func (d *Driver) Doctor(ctx context.Context, cfg *config.Config, say Say, out io.Writer, ...) (int, error)
- func (d *Driver) Env(cfg *config.Config) map[string]string
- func (d *Driver) GrantCommand(ctx context.Context, cfg *config.Config, say Say, out, errOut io.Writer) (int, error)
- func (d *Driver) Health(ctx context.Context, cfg *config.Config, include, skip []string) (map[string]any, map[string]any, error)
- func (d *Driver) Installed(cfg *config.Config) (bool, error)
- func (d *Driver) Linux(cfg *config.Config) bool
- func (d *Driver) Override(cfg *config.Config) string
- func (d *Driver) PermissionsCommand(ctx context.Context, cfg *config.Config, say Say, out io.Writer, asJSON bool) (int, error)
- func (d *Driver) Sandboxed(ctx context.Context, cfg *config.Config) ([]string, map[string]string, error)
- func (d *Driver) Settle(ctx context.Context, cfg *config.Config, binary string, r packages.Reporter) error
- func (d *Driver) Shown(cfg *config.Config, binary string) string
- func (d *Driver) Status(ctx context.Context, cfg *config.Config, given string) (*Status, error)
- func (d *Driver) StatusCommand(ctx context.Context, cfg *config.Config, say Say) (int, error)
- type Element
- type Printer
- type Probe
- type Say
- type Scroll
- type Status
- type Tone
- type Unhealthy
Constants ¶
const InstallHint = "cua-driver is not installed. Install it in /programs."
Guidance for a missing driver
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
OK bool
Action string
Message string
Meta map[string]any
Verified *bool
Effect *string
Escalation map[string]any
Path *string
Degraded *bool
Delivery *string
Code *string
}
What an action came to: whether the driver took it, and its verdict of what happened
type Autostart ¶
type Autostart struct {
// What it is and its name, as a person reads them
Kind, Name string
// File of a unit or entry, empty for the logon task
Path string
// A systemd user unit, stopped and disabled before its file goes
Systemd bool
}
One way the driver starts on its own that outlives icebath: a systemd user unit, an XDG autostart entry, or the Windows logon task
func Autostarts ¶
Every way the driver starts on its own whose program lies in one of the folders, such as those of icebath's package manager: the units and entries of the user's config folder, and the Windows logon task
type Backend ¶
type Backend struct {
Mode string
// contains filtered or unexported fields
}
A session of the driver one icebath session drives the desktop through, sticking to the window its last capture or focus picked
func (*Backend) Capture ¶
func (b *Backend) Capture(ctx context.Context, mode, app string, pid, window *int) (*Capture, error)
Captures the front window, the app's, or an exact window, in som, ax or vision mode, making it the target of input
func (*Backend) Click ¶
Click or double click by element index or by point, with the button checked against the driver's choices
func (*Backend) FocusApp ¶
Makes the app's window the target, raising it only through the separately approved bring_to_front
func (*Backend) ListApps ¶
Running apps: the structured list, the shapes older drivers reply in, those of the windows, then the text listing
func (*Backend) ListWindows ¶
Windows on screen, front first, fetched through the CLI when MCP gives none
func (*Backend) Scroll ¶
Scroll by wheel ticks, one to fifty, at an element or a point when the driver takes points
func (*Backend) Start ¶
Checks the contract, starts the private daemon and the session, then declares the run's label and applies the profile's settings
func (*Backend) Stop ¶
Ends the driver session, then closes it and stops the private daemon even when a step fails
type Capture ¶
type Capture struct {
Mode string
Width int
Height int
// Base64 screenshot and its type, empty when there is none
Image string
Mime string
// Bytes of the screenshot
Bytes int
Elements []Element
App string
Title string
Note string
// Cap of the accessibility walk, zero for none
AXMax int
}
A screenshot, the element map, or both, as the mode asked
type Checked ¶
type Checked struct {
Name, Status, Message, Hint string
}
One check of a health report as the doctor reads it: its name, pass, fail or skip, what it found and what to do
type Delivery ¶
How input is delivered: in the background, or with the window fronted, the persistent bring_to_front first when asked
type Driver ¶
type Driver struct {
// Each profile's own screen, which the driver acts on while it runs, from inside the terminal backend's sandbox when it lives there
Desktop *botdesktop.Desktop
// contains filtered or unexported fields
}
The driver of this machine, as each profile picks it: the managed driver is one per machine, and a profile may name its own program
func (*Driver) Backend ¶
Backend in the permission mode, with a daemon of its own outside the standard one
func (*Driver) Command ¶
Binary of the profile's driver: the program given or the profile's override, found on the search path of the driver's environment when it is a bare name, else the managed one; empty when there is none, never installing
func (*Driver) Contract ¶
Contract of the binary, the selected one when empty, kept thirty seconds while the binary stays the same file
func (*Driver) Display ¶
Display a driver started now acts on, which a kept backend must still match
func (*Driver) Doctor ¶
func (d *Driver) Doctor(ctx context.Context, cfg *config.Config, say Say, out io.Writer, include, skip []string, asJSON bool) (int, error)
`computer-use doctor`: the driver's health report, or one composed from probes, with the checks icebath adds; 0 when ok, 1 when degraded or failed, 2 when the driver is missing or can't be asked
func (*Driver) Env ¶
Variables of the driver's children: this machine's child environment for the profile with the display of its Bot Desktop while it runs, the driver's telemetry off unless the profile allows it, no update check of its own, and Wayland directly when asked for on a Wayland session
func (*Driver) GrantCommand ¶
func (d *Driver) GrantCommand(ctx context.Context, cfg *config.Config, say Say, out, errOut io.Writer) (int, error)
`computer-use permissions grant`: asks macOS for the grants, the dialog attributed to the driver, what the driver prints written to out and errOut as it is
func (*Driver) Health ¶
func (d *Driver) Health(ctx context.Context, cfg *config.Config, include, skip []string) (map[string]any, map[string]any, error)
The driver's health report, or one composed from probes where the driver denies its own, with the checks icebath adds, and what the program says of itself beside it: an *Unhealthy when computer use names no driver icebath has, the driver is missing, can't be started or gives no report
func (*Driver) Installed ¶
Whether a driver is there to run for the profile, its override or the managed one
func (*Driver) Linux ¶
Whether the driver acts on Linux: on this machine, or always inside the terminal backend's sandbox
func (*Driver) PermissionsCommand ¶
func (d *Driver) PermissionsCommand(ctx context.Context, cfg *config.Config, say Say, out io.Writer, asJSON bool) (int, error)
`computer-use permissions status`: the grants of the provider as JSON written to out, or said as a checklist
func (*Driver) Sandboxed ¶
func (d *Driver) Sandboxed(ctx context.Context, cfg *config.Config) ([]string, map[string]string, error)
Command of this machine that runs the driver's MCP server on the profile's screen inside the terminal backend's sandbox, the screen started first, and the variables of this machine it runs with, those of the profile the sandbox's client reads; nil for a screen on this machine
func (*Driver) Settle ¶
func (d *Driver) Settle(ctx context.Context, cfg *config.Config, binary string, r packages.Reporter) error
Readies the driver a person installed for this computer: it must keep the contract icebath needs, then gets what its platform needs, the logon task on Windows and the signed app registered with Launch Services on macOS; a failure says what is left to do
func (*Driver) Shown ¶
Binary of the driver as a person is told it: the profile's override as the settings write it when they name a variable in it and the binary is the one it names, so nothing told shows the variable's value; the binary itself else
type Element ¶
type Element struct {
Index int
Role string
Label string
Bounds [4]int
App string
PID int
WindowID int
// Capability the driver minted for the element in this snapshot, empty when it mints none
Token string
}
One interactable element of a capture, its bounds x, y, width and height in the screen's own pixels
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Where readying the driver tells the person what it does: notes and warnings, as lines of the install in their tones
type Probe ¶
type Probe struct {
Label string `json:"label"`
Status string `json:"status"`
Message string `json:"message"`
}
One probe of the driver's own doctor
type Say ¶
Where a command says what it found, line by line in the tone of each, the indent of a line kept before its mark
type Status ¶
type Status struct {
Platform string `json:"platform"`
PlatformSupported bool `json:"platform_supported"`
Installed bool `json:"installed"`
Version *string `json:"version"`
Ready *bool `json:"ready"`
CanGrant bool `json:"can_grant"`
Checks []Probe `json:"checks"`
Source any `json:"source"`
Error *string `json:"error"`
Accessibility *bool `json:"accessibility"`
ScreenRecording *bool `json:"screen_recording"`
ScreenRecordingCapturable *bool `json:"screen_recording_capturable"`
}
How ready computer use is on this machine, as the permissions command and the status show it