Documentation
¶
Index ¶
- func NewSession(cfg *config.BrowserUseConfig) *browserSession
- type Deps
- type ExtensionBridge
- func (b *ExtensionBridge) Addr() string
- func (b *ExtensionBridge) Click(ctx context.Context, selector string) (browserdomain.BrowserToolResult, error)
- func (b *ExtensionBridge) ClickAt(_ context.Context, _, _ float64) (browserdomain.BrowserToolResult, error)
- func (b *ExtensionBridge) Close()
- func (b *ExtensionBridge) Navigate(ctx context.Context, url string) (browserdomain.BrowserToolResult, error)
- func (b *ExtensionBridge) Read(ctx context.Context, selector string) (browserdomain.BrowserToolResult, error)
- func (b *ExtensionBridge) Screenshot(ctx context.Context) (browserdomain.BrowserScreenshotResult, error)
- func (b *ExtensionBridge) Start() error
- func (b *ExtensionBridge) Tabs(ctx context.Context) ([]browserdomain.BrowserTab, error)
- func (b *ExtensionBridge) Type(ctx context.Context, selector, text string, pressEnter bool) (browserdomain.BrowserToolResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSession ¶
func NewSession(cfg *config.BrowserUseConfig) *browserSession
Types ¶
type Deps ¶ added in v0.218.0
type Deps struct {
Config *config.BrowserUseConfig
Notifier agentdomain.UINotifier
Conversations convdomain.ConversationRepository
Events agentdomain.EventBridge
Skills agentdomain.SkillsService
Tools agentdomain.ToolService
Approval agentdomain.ApprovalPolicy
Models convdomain.ModelService
Modes agentdomain.AgentModeState
Agent agentdomain.AgentService
History storage.ShellHistoryStorage
DefaultModel string
SessionID string
ArtifactsDir string
}
Deps are the collaborators the bridge and its panel units use. The container builds every one of them before the bridge, so nothing is wired late and no capability is optional.
type ExtensionBridge ¶
type ExtensionBridge struct {
// contains filtered or unexported fields
}
ExtensionBridge hosts the localhost WebSocket endpoint the opentask browser extension dials into. It owns the connection, implements browserdomain.BrowserDriver by forwarding the browser-use verbs to the extension, and routes every other frame to the panel unit that owns it.
func NewExtensionBridge ¶
func NewExtensionBridge(deps Deps) *ExtensionBridge
NewExtensionBridge builds the bridge and its panel units, one unit per frame family, so each unit holds only the dependencies it uses. artifactsDir, when non-empty, is served read-only at /artifacts/ so the panel can display generated images the agent saved locally.
func (*ExtensionBridge) Addr ¶
func (b *ExtensionBridge) Addr() string
Addr returns the actual listen address (useful with port 0 in tests).
func (*ExtensionBridge) Click ¶
func (b *ExtensionBridge) Click(ctx context.Context, selector string) (browserdomain.BrowserToolResult, error)
Click implements browserdomain.BrowserDriver.
func (*ExtensionBridge) ClickAt ¶
func (b *ExtensionBridge) ClickAt(_ context.Context, _, _ float64) (browserdomain.BrowserToolResult, error)
ClickAt implements browserdomain.BrowserDriver. The extension bridge drives clicks through chrome.scripting (untrusted synthetic events), which have no reliable viewport-coordinate form - that needs chrome.debugger/CDP. Fail clearly.
func (*ExtensionBridge) Close ¶
func (b *ExtensionBridge) Close()
Close implements browserdomain.BrowserDriver: shuts the server and any connection.
func (*ExtensionBridge) Navigate ¶
func (b *ExtensionBridge) Navigate(ctx context.Context, url string) (browserdomain.BrowserToolResult, error)
Navigate implements browserdomain.BrowserDriver.
func (*ExtensionBridge) Read ¶
func (b *ExtensionBridge) Read(ctx context.Context, selector string) (browserdomain.BrowserToolResult, error)
Read implements browserdomain.BrowserDriver.
func (*ExtensionBridge) Screenshot ¶
func (b *ExtensionBridge) Screenshot(ctx context.Context) (browserdomain.BrowserScreenshotResult, error)
Screenshot implements browserdomain.BrowserDriver via the extension's captureVisibleTab.
func (*ExtensionBridge) Start ¶
func (b *ExtensionBridge) Start() error
Start listens on 127.0.0.1:<port> and serves the /ws endpoint. Errors are also stored so later tool calls surface them instead of a silent no-op.
func (*ExtensionBridge) Tabs ¶
func (b *ExtensionBridge) Tabs(ctx context.Context) ([]browserdomain.BrowserTab, error)
Tabs implements browserdomain.BrowserDriver via the extension's chrome.tabs query.
func (*ExtensionBridge) Type ¶
func (b *ExtensionBridge) Type(ctx context.Context, selector, text string, pressEnter bool) (browserdomain.BrowserToolResult, error)
Type implements browserdomain.BrowserDriver.