infrastructure

package
v0.222.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BindingHandshake = agui.Handshake{Hello: frameBrowserHello, Ack: frameBrowserHelloAck}

BindingHandshake is the handshake the opentask extension and the other clients of its binding perform.

Functions

func AllowExtensionOrigin added in v0.219.0

func AllowExtensionOrigin(origin string) bool

AllowExtensionOrigin accepts the origins a browser extension connects from.

func NewSession

func NewSession(cfg *config.BrowserUseConfig) *browserSession

Types

type EnsureHost added in v0.219.0

type EnsureHost func(ctx context.Context, port int) error

EnsureHost makes something host the binding on port before the client dials, starting a host when none listens.

type ExtensionClient added in v0.219.0

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

ExtensionClient reaches the extension through the host of the binding. It dials the binding as a browser client and resolves each browser_command with the browser_result carrying the same id.

func NewExtensionClient added in v0.219.0

func NewExtensionClient(ext config.ExtensionConfig, notifier agentdomain.UINotifier, ensureHost EnsureHost) *ExtensionClient

NewExtensionClient builds the client over the binding's port and token. notifier drives the status bar's browser indicator, and ensureHost runs before each dial so the first Browser call finds a host.

func (*ExtensionClient) Attach added in v0.219.0

func (c *ExtensionClient) Attach(conn *agui.Conn)

Attach keeps the connection the dial produced.

func (*ExtensionClient) Detach added in v0.219.0

func (c *ExtensionClient) Detach(conn *agui.Conn)

Detach forgets a connection that died, so the next Request redials, and fails everything still waiting on it.

func (*ExtensionClient) Handle added in v0.219.0

func (c *ExtensionClient) Handle(_ *agui.Conn, frame []byte)

Handle resolves the pending Request whose id matches a browser_result.

func (*ExtensionClient) Request added in v0.219.0

func (c *ExtensionClient) Request(ctx context.Context, id string, frame json.RawMessage) (json.RawMessage, error)

Request sends one browser_command frame and waits for the browser_result carrying id, the ExtensionRequest seam the extension driver calls. A connection whose socket died is redialed on the next call.

type ExtensionDriver added in v0.219.0

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

ExtensionDriver implements browserdomain.BrowserDriver against the opentask extension. It builds browser_command frames, owns the per-action timeout and maps results to BrowserToolResult, leaving the transport behind the injected ExtensionRequest.

func NewExtensionDriver added in v0.219.0

func NewExtensionDriver(cfg *config.BrowserUseConfig, request ExtensionRequest) *ExtensionDriver

NewExtensionDriver builds the extension-backed driver from the browser_use configuration and the injected request seam.

func (*ExtensionDriver) Click added in v0.219.0

Click implements browserdomain.BrowserDriver.

func (*ExtensionDriver) ClickAt added in v0.219.0

ClickAt implements browserdomain.BrowserDriver. The extension drives clicks through chrome.scripting (untrusted synthetic events), which have no reliable viewport-coordinate form - that needs chrome.debugger/CDP. Fail clearly.

func (*ExtensionDriver) Close added in v0.219.0

func (d *ExtensionDriver) Close()

Close implements browserdomain.BrowserDriver. The driver owns nothing to shut down.

func (*ExtensionDriver) Navigate added in v0.219.0

Navigate implements browserdomain.BrowserDriver.

func (*ExtensionDriver) Read added in v0.219.0

Read implements browserdomain.BrowserDriver.

func (*ExtensionDriver) Screenshot added in v0.219.0

Screenshot implements browserdomain.BrowserDriver via the extension's captureVisibleTab.

func (*ExtensionDriver) Tabs added in v0.219.0

Tabs implements browserdomain.BrowserDriver via the extension's chrome.tabs query.

func (*ExtensionDriver) Type added in v0.219.0

func (d *ExtensionDriver) Type(ctx context.Context, selector, text string, pressEnter bool) (browserdomain.BrowserToolResult, error)

Type implements browserdomain.BrowserDriver.

type ExtensionRelay added in v0.219.0

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

ExtensionRelay is the host end of the browser RPC on a binding. It keeps the one extension connection and drives every browser_command through it, one at a time, answering each with the browser_result carrying its id.

func NewExtensionRelay added in v0.219.0

func NewExtensionRelay(ext config.ExtensionConfig, notifier agentdomain.UINotifier) *ExtensionRelay

NewExtensionRelay builds the relay for the binding on the extension's port. notifier, when set, learns whether an extension is attached.

func (*ExtensionRelay) Attach added in v0.219.0

func (r *ExtensionRelay) Attach(conn *agui.Conn)

Attach takes a connection over. A new extension replaces the previous one, since MV3 service workers restart at will, and every other client joins the ones the state frames go to, which learn the current state at once.

func (*ExtensionRelay) Detach added in v0.219.0

func (r *ExtensionRelay) Detach(conn *agui.Conn)

Detach fails the commands still waiting on an extension connection that died, and stops framing the state to the connection when it was a client.

func (*ExtensionRelay) Handle added in v0.219.0

func (r *ExtensionRelay) Handle(conn *agui.Conn, frame []byte) bool

Handle claims the browser frames: a browser_result resolves the command waiting on it, and a browser_command a client posted is driven through the extension and answered on the posting connection. It reports false for every other frame. The extension never posts commands, being the other end.

func (*ExtensionRelay) Relay added in v0.219.0

func (r *ExtensionRelay) Relay(ctx context.Context, frame []byte) []byte

Relay drives one browser_command through the extension and always answers with the browser_result carrying its id. A failure becomes the result's error, because the sender waits for the answer by id.

type ExtensionRequest added in v0.219.0

type ExtensionRequest func(ctx context.Context, id string, frame json.RawMessage) (json.RawMessage, error)

ExtensionRequest sends one browser_command frame and waits for the browser_result carrying id. The container injects the transport: the ExtensionClient's socket, or a serve worker's stdio relay.

Jump to

Keyboard shortcuts

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