browser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package browser shares one Chrome between sessions: each session's tools reach it through Proxy, which shows the session only the tabs it opened, and atc can show the user exactly those tabs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LazyMCP

func LazyMCP(argv, env, key []string, config []byte, cache string, in io.Reader, out io.Writer) error

LazyMCP fronts the MCP server argv on stdio and starts it on the first request it can't answer itself: initialize and tools/list come from what the server said last time (cache, under key). A non-nil config is what the server takes secrets from: it stays out of argv, where any local user could read it, in a private file named by --config that lasts only until the server has answered.

Types

type Browser

type Browser struct {
	Endpoint string
	// contains filtered or unexported fields
}

func Open

func Open(endpoint, path string) (*Browser, error)

func (*Browser) Of

func (b *Browser) Of(sid string) []Tab

Of is the session's tabs as of the last look, never waiting on Chrome; a stale answer starts a new look in the background.

func (*Browser) Owner

func (b *Browser) Owner(target string) string

func (*Browser) Proxy

func (b *Browser) Proxy(w http.ResponseWriter, r *http.Request, sid string)

Proxy relays one CDP client to Chrome, as if the session's tabs were the only ones.

func (*Browser) Reap

func (b *Browser) Reap(live []string)

Reap closes the tabs of sessions that have been out of atc's list for an hour.

func (*Browser) Render

func (b *Browser) Render(ctx context.Context, html string, width int) ([]byte, error)

Render draws an HTML document in a tab of its own, closed again right after, and returns its body as a PNG at twice the size: width is the viewport, the body sets the crop.

func (*Browser) Shot

func (b *Browser) Shot(ctx context.Context, url string, width, maxHeight int) ([]byte, error)

Shot loads a URL the same way and returns the whole page, as tall as it is up to maxHeight.

func (*Browser) Tabs

func (b *Browser) Tabs(ctx context.Context) (map[string][]Tab, error)

func (*Browser) View

func (b *Browser) View(w http.ResponseWriter, r *http.Request, sid, tab string)

View streams one of the session's tabs to the user and takes their input back: frames from Page.startScreencast out, a short list of Input and Page calls in.

type Tab

type Tab struct {
	ID     string    `json:"id"`
	Title  string    `json:"title"`
	URL    string    `json:"url"`
	Opened time.Time `json:"opened"`
}

Jump to

Keyboard shortcuts

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