browser

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package browser provides native chromedp-backed browser tools so bee agents can open, snapshot, click, and read the console of the page they are building. Drives an existing Chrome/Chromium install; never bundles a browser. Opt-in via browser config or --browser.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("browser: no Chrome/Chromium binary found")

ErrNotFound means no Chrome/Chromium binary could be located.

Functions

func DetectChrome

func DetectChrome(override string) (string, error)

DetectChrome returns a usable browser binary path. override wins when non-empty and existing; otherwise known install locations and $PATH are probed. Returns ErrNotFound if nothing is usable.

func New

func New(opt Options) []tools.Tool

New builds the browser tool set sharing one lazy session. screenshot is included only when VisionModel is set.

Types

type ConsoleMsg

type ConsoleMsg struct {
	Level string
	Text  string
}

ConsoleMsg is one captured console entry.

type Options

type Options struct {
	ChromePath     string
	Headless       bool
	VisionModel    string
	VisionEndpoint string
}

Options configures the tool set.

type Session

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

Session owns a single chromedp browser context, launched lazily on first use and reused across tool calls. Safe for sequential tool calls within a run (the engine drives tools one at a time).

func NewSession

func NewSession(chromePath string, headless bool) *Session

NewSession returns an unstarted session. Chrome launches on first ensure().

func (*Session) Close

func (s *Session) Close()

Close tears down the browser. Safe to call when never started.

type Tool

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

Tool is one browser tool bound to a shared session.

func (Tool) Run

func (t Tool) Run(ctx context.Context, in map[string]any) (tools.Result, error)

func (Tool) Run2

func (t Tool) Run2(ctx context.Context, in map[string]any) tools.Result

Run2 drops the always-nil error from Run for terser internal/test callers.

func (Tool) Spec

func (t Tool) Spec() llm.ToolSpec

Jump to

Keyboard shortcuts

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