executor

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedAction = errors.New("unsupported computer-use executor action")

Functions

func IsUnsupportedAction

func IsUnsupportedAction(err error) bool

func SafeExternalHTTPClient

func SafeExternalHTTPClient(resolver NetIPResolver, timeout time.Duration) *http.Client

SafeExternalHTTPClient returns an HTTP client that rejects redirects and DNS rebinding.

func ValidateExternalBaseURL

func ValidateExternalBaseURL(ctx context.Context, raw string, resolver NetIPResolver) (*url.URL, error)

ValidateExternalBaseURL validates the external executor base URL.

func ValidatePublicHTTPSURL

func ValidatePublicHTTPSURL(ctx context.Context, raw string, resolver NetIPResolver) (*url.URL, error)

ValidatePublicHTTPSURL rejects non-public or credential-bearing HTTPS URLs.

func ValidatePublicHost

func ValidatePublicHost(ctx context.Context, host string, resolver NetIPResolver) error

ValidatePublicHost rejects localhost, private, link-local, metadata, and reserved hosts.

Types

type CommandRunner

type CommandRunner interface {
	Start(context.Context, CommandSpec) (Process, error)
}

CommandRunner starts subprocesses for launch-scoped executors.

type CommandSpec

type CommandSpec struct {
	Path   string
	Args   []string
	Env    []string
	Dir    string
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

CommandSpec describes one subprocess launch without inheriting stdio by default.

type DockerBrowser

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

DockerBrowser launches an isolated browser inside a Docker container.

func NewDockerBrowser

func NewDockerBrowser(ctx context.Context, opts DockerBrowserOptions) (*DockerBrowser, error)

func (*DockerBrowser) Check

func (executor *DockerBrowser) Check(ctx context.Context) error

func (*DockerBrowser) Close

func (executor *DockerBrowser) Close() error

func (*DockerBrowser) CommandSpec

func (executor *DockerBrowser) CommandSpec() CommandSpec

func (*DockerBrowser) ContainerName

func (executor *DockerBrowser) ContainerName() string

func (*DockerBrowser) DebugURL

func (executor *DockerBrowser) DebugURL() string

func (*DockerBrowser) Execute

func (executor *DockerBrowser) Execute(ctx context.Context, action cua.Action) (cua.Observation, error)

func (*DockerBrowser) Name

func (executor *DockerBrowser) Name() string

type DockerBrowserOptions

type DockerBrowserOptions struct {
	Runner         CommandRunner
	HTTPClient     *http.Client
	DockerPath     string
	Image          string
	BrowserBinary  string
	HostDebugPort  int
	LaunchID       string
	StartupURL     string
	CommandEnvBase []string
}

DockerBrowserOptions configures a launch-scoped Docker browser executor.

type ExternalHTTP

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

ExternalHTTP forwards validated actions to a named external HTTPS executor.

func NewExternalHTTP

func NewExternalHTTP(ctx context.Context, name string, opts ExternalOptions) (*ExternalHTTP, error)

func (*ExternalHTTP) BaseURL

func (executor *ExternalHTTP) BaseURL() string

func (*ExternalHTTP) Check

func (executor *ExternalHTTP) Check(ctx context.Context) error

func (*ExternalHTTP) Close

func (executor *ExternalHTTP) Close() error

func (*ExternalHTTP) Execute

func (executor *ExternalHTTP) Execute(ctx context.Context, action cua.Action) (cua.Observation, error)

func (*ExternalHTTP) Name

func (executor *ExternalHTTP) Name() string

type ExternalOptions

type ExternalOptions struct {
	BaseURL     string
	BearerToken string
	Resolver    NetIPResolver
}

ExternalOptions configures an external public-HTTPS CUA executor.

type LocalBrowser

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

LocalBrowser launches a local browser with an isolated temporary profile.

func NewLocalBrowser

func NewLocalBrowser(ctx context.Context, opts LocalBrowserOptions) (*LocalBrowser, error)

func (*LocalBrowser) Check

func (executor *LocalBrowser) Check(ctx context.Context) error

func (*LocalBrowser) Close

func (executor *LocalBrowser) Close() error

func (*LocalBrowser) CommandSpec

func (executor *LocalBrowser) CommandSpec() CommandSpec

func (*LocalBrowser) DebugURL

func (executor *LocalBrowser) DebugURL() string

func (*LocalBrowser) Execute

func (executor *LocalBrowser) Execute(ctx context.Context, action cua.Action) (cua.Observation, error)

func (*LocalBrowser) Name

func (executor *LocalBrowser) Name() string

func (*LocalBrowser) ProfileDir

func (executor *LocalBrowser) ProfileDir() string

type LocalBrowserOptions

type LocalBrowserOptions struct {
	Runner         CommandRunner
	HTTPClient     *http.Client
	BrowserPath    string
	HostDebugPort  int
	ProfileRoot    string
	StartupURL     string
	CommandEnvBase []string
}

LocalBrowserOptions configures a launch-scoped local browser executor.

type MacOSPreview

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

MacOSPreview owns one ccr-cua-macos helper process for one CCR launch.

func NewMacOSPreview

func NewMacOSPreview(ctx context.Context, opts MacOSPreviewOptions) (*MacOSPreview, error)

NewMacOSPreview starts ccr-cua-macos, validates ready/start JSONL IPC, and returns a launch-scoped executor. It is only supported on darwin.

func (*MacOSPreview) Check

func (executor *MacOSPreview) Check(ctx context.Context) error

func (*MacOSPreview) Close

func (executor *MacOSPreview) Close() error

func (*MacOSPreview) CommandSpec

func (executor *MacOSPreview) CommandSpec() CommandSpec

func (*MacOSPreview) Execute

func (executor *MacOSPreview) Execute(ctx context.Context, action cua.Action) (cua.Observation, error)

func (*MacOSPreview) Name

func (executor *MacOSPreview) Name() string

func (*MacOSPreview) Shutdown

func (executor *MacOSPreview) Shutdown(ctx context.Context) error

type MacOSPreviewOptions

type MacOSPreviewOptions struct {
	Runner          CommandRunner
	HelperPath      string
	Args            []string
	Dir             string
	CommandEnvBase  []string
	StartupTimeout  time.Duration
	ShutdownTimeout time.Duration
}

MacOSPreviewOptions configures the launch-scoped unsigned macOS preview helper. The helper token is learned from ready IPC and is never accepted in options, command arguments, or environment.

type NetIPResolver

type NetIPResolver interface {
	LookupNetIP(context.Context, string, string) ([]netip.Addr, error)
}

NetIPResolver resolves hostnames to IP addresses.

type OSCommandRunner

type OSCommandRunner struct{}

OSCommandRunner starts real operating-system processes.

func (OSCommandRunner) Start

type Process

type Process interface {
	PID() int
	Wait() error
	Kill() error
}

Process is the owned child process returned by a CommandRunner.

type Target

type Target struct {
	Kind         cua.ExecutorKind
	ExternalName string
}

Target is the parsed launch-scoped executor selector.

func ParseTarget

func ParseTarget(value string) (Target, error)

ParseTarget parses the managed CUA executor selector.

type UnsupportedActionError

type UnsupportedActionError struct {
	Executor string
	Action   cua.ActionKind
	Reason   string
}

UnsupportedActionError reports a CUA action the executor cannot perform.

func (*UnsupportedActionError) Error

func (err *UnsupportedActionError) Error() string

func (*UnsupportedActionError) Unwrap

func (err *UnsupportedActionError) Unwrap() error

Jump to

Keyboard shortcuts

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