computer

package
v0.107.12 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ProtocolVersion = "k-brain-computer/1"

Variables

View Source
var ErrJSFromAppleEvents = errors.New("chrome's 'Allow JavaScript from Apple Events' is off — enable it in Chrome: View → Developer → Allow JavaScript from Apple Events")
View Source
var ErrUnsupportedPlatform = errors.New("computer-use driver is unavailable on this platform")

Functions

func Available

func Available() bool

func ChromeActivateTab

func ChromeActivateTab(window, index int) error

func ChromeActive

func ChromeActive() (url, title string, err error)

func ChromeBack

func ChromeBack() error

func ChromeCloseTab

func ChromeCloseTab(window, index int) error

func ChromeGoto

func ChromeGoto(url string) error

func ChromeJS

func ChromeJS(js string) (string, error)

func ChromeNewTab

func ChromeNewTab(url string) error

func ChromeReload

func ChromeReload() error

func ChromeState

func ChromeState() (string, error)

func ResetShared

func ResetShared()

func Tell

func Tell(app string, commands ...string) (string, error)

Types

type AXElement

type AXElement struct {
	Index    int       `json:"index"`
	Role     string    `json:"role"`
	Subrole  string    `json:"subrole,omitempty"`
	Title    string    `json:"title,omitempty"`
	Value    string    `json:"value,omitempty"`
	Desc     string    `json:"desc,omitempty"`
	RoleDesc string    `json:"roleDescription,omitempty"`
	Position []float64 `json:"position,omitempty"`
	Size     []float64 `json:"size,omitempty"`
	Actions  []string  `json:"actions,omitempty"`
	Focused  bool      `json:"focused"`
	Enabled  bool      `json:"enabled"`
}

type AppState

type AppState struct {
	Generation int         `json:"generation"`
	App        string      `json:"app"`
	Elements   []AXElement `json:"elements"`
	Screenshot *Screenshot `json:"screenshot,omitempty"`
}

type ApprovalNeeded

type ApprovalNeeded struct{ App string }

func (*ApprovalNeeded) Error

func (e *ApprovalNeeded) Error() string

type ChromeTab

type ChromeTab struct {
	Window int    `json:"window"`
	Index  int    `json:"index"`
	Title  string `json:"title"`
	URL    string `json:"url"`
}

func ChromeFindTab

func ChromeFindTab(urlPart string) (*ChromeTab, error)

func ChromeTabs

func ChromeTabs() ([]ChromeTab, error)

type Helper

type Helper struct {
	// contains filtered or unexported fields
}

func Shared

func Shared() (*Helper, error)

func (*Helper) Call

func (h *Helper) Call(ctx context.Context, method string, params map[string]any, out any) error

type Policy

type Policy struct {
	DefaultDeny bool
	// contains filtered or unexported fields
}

func NewPolicy

func NewPolicy(allow, deny []string, defaultDeny bool) *Policy

func (*Policy) Approve

func (p *Policy) Approve(app string)

func (*Policy) Check

func (p *Policy) Check(app string) error

func (*Policy) Deny

func (p *Policy) Deny(app string)

func (*Policy) Summary

func (p *Policy) Summary() string

type RunningApp

type RunningApp struct {
	Name     string `json:"name"`
	BundleID string `json:"bundleId"`
	PID      int    `json:"pid"`
	Active   bool   `json:"active"`
}

type Screenshot

type Screenshot struct {
	JPEGBase64 string `json:"jpegBase64,omitempty"`
	Bytes      int    `json:"bytes,omitempty"`
	Err        string `json:"error,omitempty"`
}

func (*Screenshot) Decode

func (s *Screenshot) Decode() ([]byte, error)

type StaleError

type StaleError struct{ Msg string }

func (*StaleError) Error

func (e *StaleError) Error() string

type TCCStatus

type TCCStatus struct {
	Accessibility   bool   `json:"accessibility"`
	ScreenRecording bool   `json:"screenRecording"`
	Pending         bool   `json:"pending,omitempty"`
	Hint            string `json:"hint,omitempty"`
}

Directories

Path Synopsis
Package cua connects K-brain to Cua Driver's native MCP interface.
Package cua connects K-brain to Cua Driver's native MCP interface.

Jump to

Keyboard shortcuts

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