Documentation
¶
Index ¶
- Constants
- Variables
- func CuaDriverChildEnv(env *tools.Env) map[string]string
- func DelegatedChildOwnerMatcher(childSessionID string) func(owner string) bool
- func GetComputerUseSchema() *pyjson.Object
- func InstallCuaDriver(ctx context.Context, w io.Writer, showInstallerProgress bool) (bool, error)
- func IsSecretEnvName(name string) bool
- func PythonOnPath(ctx context.Context, env *tools.Env, needs string) (string, error)
- func RegisterKernelForTests(owner, cwd string) (registered, stopped func() bool, remove func())
- func ReleaseComputerUseSession(ctx context.Context, sessionID string) bool
- func ResetScreenshotDedup(ctx context.Context, sessionID string)
- func RuntimePython(ctx context.Context) (string, error)
- func ShutdownAllKernels()
- func ShutdownAllRemoteKernels()
- func ShutdownComputerUseBackends()
- func ShutdownKernelsForDelegatedChild(childSessionID string)
- func ShutdownKernelsForOwner(owner string)
- type ActionResult
- type AttributeError
- type BackendDefaults
- type BotDesktopInstallBusy
- type CaptureResult
- type ChildPipe
- type ChildResult
- type ChildRun
- type ClickArgs
- type ComputerUseArgs
- type ComputerUseBackend
- type ComputerUseCLI
- type ComputerUseCommand
- type ComputerUseProvider
- type CuaDriverBackend
- func (b *CuaDriverBackend) BringToFront(pid int, windowID *int) *ActionResult
- func (b *CuaDriverBackend) CallTool(name string, args *pyjson.Object, timeout float64) (*pyjson.Object, error)
- func (b *CuaDriverBackend) Capture(mode string, app *string, pid, windowID *int) (*CaptureResult, error)
- func (b *CuaDriverBackend) Click(a ClickArgs) (*ActionResult, error)
- func (b *CuaDriverBackend) Drag(a DragArgs) (*ActionResult, error)
- func (b *CuaDriverBackend) FocusApp(app string, raiseWindow bool) (*ActionResult, error)
- func (b *CuaDriverBackend) IsAvailable() (bool, error)
- func (b *CuaDriverBackend) Key(keys string, d DeliveryArgs) (*ActionResult, error)
- func (b *CuaDriverBackend) LaunchApp(a LaunchAppArgs) (any, error)
- func (b *CuaDriverBackend) ListApps() ([]any, error)
- func (b *CuaDriverBackend) ListWindows() ([]*pyjson.Object, error)
- func (b *CuaDriverBackend) Scroll(a ScrollArgs) (*ActionResult, error)
- func (b *CuaDriverBackend) SetAgentCursorEnabled(enabled bool, cursorID string) *ActionResult
- func (b *CuaDriverBackend) SetConfig(config *pyjson.Object) *ActionResult
- func (b *CuaDriverBackend) SetValue(value string, element *int) (*ActionResult, error)
- func (b *CuaDriverBackend) Start() error
- func (b *CuaDriverBackend) Stop() error
- func (b *CuaDriverBackend) TypeText(text string, d DeliveryArgs) (*ActionResult, error)
- type CuaDriverProvider
- type DeliveryArgs
- type DragArgs
- type LaunchAppArgs
- type ProviderDefaults
- type ScrollArgs
- type UIElement
Constants ¶
const BotDesktopInstallNoSudo = -2
Installer exit code of an unprivileged host without sudo, the root command streamed through onLine
Variables ¶
var ( BotDesktopEnv = botdesktop.DesktopEnv BotDesktopToolPlacement = botdesktop.ToolPlacement BotDesktopPlacementWhere = botDesktopPlacementWhere BotDesktopPublishedEnv = botdesktop.MustPublishedEnv BotDesktopSandboxEnv = botdesktop.TerminalEnvironment BotDesktopProfileName = botdesktop.ProfileName BotDesktopTouchActivity = botdesktop.TouchActivity BotDesktopCuaMCPInvocation = func(ctx context.Context, sandbox tools.Environment, profile string, published map[string]string, telemetryOptIn bool) (string, []string, error) { return botdesktop.CuaMCPInvocation(sandbox, profile, published, telemetryOptIn) } BotDesktopSandboxCommand = botdesktop.SandboxDisplayCommand // Admitted lease epoch, an error carrying the HumanHasControl text while a human holds the screen BotDesktopAssertAgentMayAct = botDesktopAssertAgentMayAct BotDesktopLeaseEpoch = func(env *tools.Env) int { return botdesktop.LeaseGet(botdesktop.ProfileKey(env)).EpochInt() } BotDesktopEnsureStartedForTool = botdesktop.EnsureStartedForTool // Desktop pane package installer of tools/bot_desktop/install.py answering the installer exit code BotDesktopInstallPackages = botDesktopInstallPackages )
Bot desktop runtime calls of the computer use tool, package vars so tests substitute them
var ComputerUseCommandPaths = []string{
"computer-use install", "computer-use status", "computer-use doctor",
"computer-use permissions status", "computer-use permissions grant",
"computer-use screen status", "computer-use screen start", "computer-use screen stop", "computer-use screen install",
}
Leaf command paths of the computer-use tree the CLI binds to the dispatcher
var SecretSubstrings = state.SecretSubstrings
SecretSubstrings are the name fragments that mark an environment variable as a credential
Functions ¶
func CuaDriverChildEnv ¶
Driver spawn env over the process environment with the bot desktop display, telemetry policy, no release check and Wayland opt in
func DelegatedChildOwnerMatcher ¶
DelegatedChildOwnerMatcher matches the kernel owners of one delegate_task child
func GetComputerUseSchema ¶
Generic function calling schema of the computer_use tool
func InstallCuaDriver ¶
Reconciles the pinned cua-driver and its host setup on the active home, progress lines written to w
func IsSecretEnvName ¶
Reports whether a variable name contains a credential fragment in any letter case
func PythonOnPath ¶
First Python 3.8 or newer on the session's PATH, an error naming what needed it when PATH holds none
func RegisterKernelForTests ¶
Seeds an unspawned project kernel of owner the way tests set a registry item, with its probes and removal
func ReleaseComputerUseSession ¶
Releases one session owned backend, true when one was released
func ResetScreenshotDedup ¶
Compaction boundary hook so the next capture of the session delivers pixels again
func RuntimePython ¶
Path of the Python interpreter execute_code runs, an error when PATH holds none
func ShutdownAllKernels ¶
func ShutdownAllKernels()
ShutdownAllKernels kills every session kernel, the process wiring calls it at exit
func ShutdownAllRemoteKernels ¶
func ShutdownAllRemoteKernels()
ShutdownAllRemoteKernels kills every remote session kernel, the process wiring calls it at exit
func ShutdownComputerUseBackends ¶
func ShutdownComputerUseBackends()
Stops every cached backend so no cua-driver outlives the process, never raising
func ShutdownKernelsForDelegatedChild ¶
func ShutdownKernelsForDelegatedChild(childSessionID string)
ShutdownKernelsForDelegatedChild disposes a finished child's local and remote kernels
func ShutdownKernelsForOwner ¶
func ShutdownKernelsForOwner(owner string)
ShutdownKernelsForOwner disposes every kernel a session owns when its approval state clears
Types ¶
type ActionResult ¶
type ActionResult struct {
OK bool
Action string
Message string
Capture *CaptureResult
Meta *pyjson.Object
Verified *bool
Effect *string
Escalation *pyjson.Object
Path *string
Degraded *bool
DeliveryMode *string
Code *string
}
ActionResult carries transport success plus the structured driver verdict of one action
type AttributeError ¶
type AttributeError struct {
// contains filtered or unexported fields
}
AttributeError is the Python exception a non string action raises, named so the dispatcher reports its class
func (*AttributeError) Error ¶
func (e *AttributeError) Error() string
type BackendDefaults ¶
type BackendDefaults struct{}
BackendDefaults supplies the non abstract list_windows and wait methods of the abstract backend
func (BackendDefaults) ListWindows ¶
func (BackendDefaults) ListWindows() ([]*pyjson.Object, error)
Reports no windows for backends that predate window discovery
func (BackendDefaults) Wait ¶
func (BackendDefaults) Wait(seconds float64) (*ActionResult, error)
Sleeps the requested seconds clamped to zero through thirty and reports the wait
type BotDesktopInstallBusy ¶
type BotDesktopInstallBusy struct{ Msg string }
BotDesktopInstallBusy is the InstallBusy another holder of the per profile install slot raises
func (*BotDesktopInstallBusy) Error ¶
func (e *BotDesktopInstallBusy) Error() string
type CaptureResult ¶
type CaptureResult struct {
Mode string
Width int
Height int
PNGB64 *string
Elements []UIElement
App string
WindowTitle string
PNGBytesLen int
ImageMimeType *string
Note string
AXMaxElements int
}
CaptureResult carries the screenshot, the element mapping or both depending on the capture mode
type ChildPipe ¶
ChildPipe names the descriptors a child reads replies from and writes requests to, Windows handles when Handles is set
type ChildResult ¶
ChildResult is the return code and text mode output of one child run
type ChildRun ¶
type ChildRun struct {
Python string
Args func(pipe ChildPipe) []string
Stdin string
Env map[string]string
Timeout time.Duration
Purpose string
Serve func(ctx context.Context, requests io.Reader, replies io.Writer)
}
ChildRun is one run of user code on an interpreter, its stdin fed and its pipe requests served by the caller
type ClickArgs ¶
type ClickArgs struct {
Element *int
X, Y *int
Button string
ClickCount int
Modifiers []string
DeliveryMode *string
BringToFront bool
}
ClickArgs are the keyword arguments of a click, Button and ClickCount carry the caller's values
type ComputerUseArgs ¶
type ComputerUseArgs struct {
Action string
PermsAction string
ScreenAction string
Include []string
Skip []string
JSON bool
Force bool
Yes bool
}
ComputerUseArgs is the argparse namespace the computer-use parser tree produces
func ParseComputerUseArgs ¶
func ParseComputerUseArgs(path string, flags *pflag.FlagSet) (ComputerUseArgs, error)
Namespace a command path and its parsed flags produce, each flag read only where the path declares it
type ComputerUseBackend ¶
type ComputerUseBackend interface {
Start() error
Stop() error
IsAvailable() (bool, error)
Capture(mode string, app *string, pid, windowID *int) (*CaptureResult, error)
Click(a ClickArgs) (*ActionResult, error)
Drag(a DragArgs) (*ActionResult, error)
Scroll(a ScrollArgs) (*ActionResult, error)
TypeText(text string, d DeliveryArgs) (*ActionResult, error)
Key(keys string, d DeliveryArgs) (*ActionResult, error)
ListApps() ([]any, error)
ListWindows() ([]*pyjson.Object, error)
FocusApp(app string, raiseWindow bool) (*ActionResult, error)
SetValue(value string, element *int) (*ActionResult, error)
Wait(seconds float64) (*ActionResult, error)
}
ComputerUseBackend is the synchronous driver surface every computer use implementation provides
type ComputerUseCLI ¶
type ComputerUseCLI struct {
Env *tools.Env
Console *cliui.Console
Stderr io.Writer
PrintHelp func(path string) error
}
ComputerUseCLI is the process one computer-use command runs in with its streams and help printer
type ComputerUseCommand ¶
type ComputerUseCommand func(ctx context.Context, cli *ComputerUseCLI, ns ComputerUseArgs) (int, error)
ComputerUseCommand is the set_defaults func of the computer-use parser answering the exit code
func BuildComputerUseParser ¶
func BuildComputerUseParser() ComputerUseCommand
Dispatcher of the computer-use tree, help for a missing action at the parser that lacks it
type ComputerUseProvider ¶
type ComputerUseProvider interface {
Name() string
DisplayName() string
GetSetupSchema() (map[string]any, error)
CreateBackend(permissionMode string) (ComputerUseBackend, error)
IsAvailable() (bool, error)
Doctor() (code int, ok bool, err error)
}
ComputerUseProvider is the factory a computer use provider plugin registers for one backend name
type CuaDriverBackend ¶
type CuaDriverBackend struct {
BackendDefaults
PermissionMode string
// contains filtered or unexported fields
}
CuaDriverBackend is the default computer use backend over the cua-driver MCP server
func (*CuaDriverBackend) BringToFront ¶
func (b *CuaDriverBackend) BringToFront(pid int, windowID *int) *ActionResult
Activates a window so later foreground input lands on it
func (*CuaDriverBackend) CallTool ¶
func (b *CuaDriverBackend) CallTool(name string, args *pyjson.Object, timeout float64) (*pyjson.Object, error)
Calls any cua-driver MCP tool by name with the session label defaulted in
func (*CuaDriverBackend) Capture ¶
func (b *CuaDriverBackend) Capture(mode string, app *string, pid, windowID *int) (*CaptureResult, error)
Captures the frontmost window or an exact known target in som, ax or vision mode
func (*CuaDriverBackend) Click ¶
func (b *CuaDriverBackend) Click(a ClickArgs) (*ActionResult, error)
Single or double click by element index or coordinates with the button through click's enum
func (*CuaDriverBackend) Drag ¶
func (b *CuaDriverBackend) Drag(a DragArgs) (*ActionResult, error)
Drag between two elements or two points
func (*CuaDriverBackend) FocusApp ¶
func (b *CuaDriverBackend) FocusApp(app string, raiseWindow bool) (*ActionResult, error)
Selects the app's window as the sticky target, raising it only through the approved bring_to_front tool
func (*CuaDriverBackend) IsAvailable ¶
func (b *CuaDriverBackend) IsAvailable() (bool, error)
Desktop platforms with a resolvable driver binary
func (*CuaDriverBackend) Key ¶
func (b *CuaDriverBackend) Key(keys string, d DeliveryArgs) (*ActionResult, error)
Presses a key or a modifier combination through hotkey
func (*CuaDriverBackend) LaunchApp ¶
func (b *CuaDriverBackend) LaunchApp(a LaunchAppArgs) (any, error)
Idempotent launch returning the driver's pid, bundle id, name and windows
func (*CuaDriverBackend) ListApps ¶
func (b *CuaDriverBackend) ListApps() ([]any, error)
Running apps from structuredContent, the compatibility envelopes, the windows payload, then the text listing
func (*CuaDriverBackend) ListWindows ¶
func (b *CuaDriverBackend) ListWindows() ([]*pyjson.Object, error)
Visible windows frontmost first, refetched over the CLI transport when MCP returns none
func (*CuaDriverBackend) Scroll ¶
func (b *CuaDriverBackend) Scroll(a ScrollArgs) (*ActionResult, error)
Scroll by wheel ticks clamped to 1 through 50, coordinates only when the driver advertises them
func (*CuaDriverBackend) SetAgentCursorEnabled ¶
func (b *CuaDriverBackend) SetAgentCursorEnabled(enabled bool, cursorID string) *ActionResult
Toggles the agent cursor overlay of this run
func (*CuaDriverBackend) SetConfig ¶
func (b *CuaDriverBackend) SetConfig(config *pyjson.Object) *ActionResult
Sets cua-driver config keys, unknown keys pass through for the driver to validate
func (*CuaDriverBackend) SetValue ¶
func (b *CuaDriverBackend) SetValue(value string, element *int) (*ActionResult, error)
Sets a value on an element, popup selects included
func (*CuaDriverBackend) Start ¶
func (b *CuaDriverBackend) Start() error
Checks the runtime contract, starts the private daemon and the session, then declares this run's identity
func (*CuaDriverBackend) Stop ¶
func (b *CuaDriverBackend) Stop() error
Ends the driver session, then tears down session, bridge and private daemon even when one step fails
func (*CuaDriverBackend) TypeText ¶
func (b *CuaDriverBackend) TypeText(text string, d DeliveryArgs) (*ActionResult, error)
Types text into the sticky target window
type CuaDriverProvider ¶
type CuaDriverProvider struct {
ProviderDefaults
// contains filtered or unexported fields
}
Built in cua provider driving cua-driver over MCP
func (*CuaDriverProvider) CreateBackend ¶
func (p *CuaDriverProvider) CreateBackend(permissionMode string) (ComputerUseBackend, error)
Fresh cua-driver backend in the requested permission mode
func (*CuaDriverProvider) IsAvailable ¶
func (p *CuaDriverProvider) IsAvailable() (bool, error)
Supported platform with a cua-driver binary, or a desktop placed inside the terminal backend
type DeliveryArgs ¶
DeliveryArgs are the delivery keyword arguments of type_text and key
type DragArgs ¶
type DragArgs struct {
FromElement *int
ToElement *int
FromXY *[2]int
ToXY *[2]int
Button string
Modifiers []string
DeliveryMode *string
BringToFront bool
}
DragArgs are the keyword arguments of a drag between two elements or two points
type LaunchAppArgs ¶
type LaunchAppArgs struct {
BundleID string
Name string
URLs []string
AdditionalArguments []string
CreatesNewApplicationInstance bool
}
LaunchAppArgs are the keyword arguments of launch_app
type ProviderDefaults ¶
ProviderDefaults supplies the identity, picker row, availability and doctor defaults of a provider
func (ProviderDefaults) DisplayName ¶
func (p ProviderDefaults) DisplayName() string
Human readable label, the name when no label is set
func (ProviderDefaults) Doctor ¶
func (ProviderDefaults) Doctor() (int, bool, error)
Backend ships no doctor by default
func (ProviderDefaults) GetSetupSchema ¶
func (p ProviderDefaults) GetSetupSchema() (map[string]any, error)
Picker row with the display name and no badge, tag or env vars
func (ProviderDefaults) IsAvailable ¶
func (ProviderDefaults) IsAvailable() (bool, error)
Usable on this host by default
func (ProviderDefaults) Name ¶
func (p ProviderDefaults) Name() string
Stable config key value of the provider
Source Files
¶
- child.go
- child_unix.go
- computer_use_backend.go
- computer_use_capture.go
- computer_use_cli.go
- computer_use_config_cua.go
- computer_use_dispatch.go
- computer_use_doctor.go
- computer_use_hooks.go
- computer_use_hosted.go
- computer_use_permissions.go
- computer_use_plugins.go
- computer_use_register.go
- computer_use_schema.go
- computer_use_screen_cli.go
- computer_use_tool.go
- cua_backend.go
- cua_backend_capture.go
- cua_backend_daemon.go
- cua_backend_driver.go
- cua_backend_input.go
- cua_backend_parse.go
- cua_backend_session.go
- cua_driver_backend.go
- cua_driver_install_export.go
- cua_proc_unix.go
- env.go
- execute.go
- gen.go
- kernel.go
- kernel_registry_export.go
- kernel_remote.go
- proc_unix.go
- remote.go
- rpc.go
- tool.go
- tools_config_bridge.go