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 ¶
- func LazyMCP(argv, env, key []string, config []byte, cache string, in io.Reader, ...) error
- type Browser
- func (b *Browser) Of(sid string) []Tab
- func (b *Browser) Owner(target string) string
- func (b *Browser) Proxy(w http.ResponseWriter, r *http.Request, sid string)
- func (b *Browser) Reap(live []string)
- func (b *Browser) Render(ctx context.Context, html string, width int) ([]byte, error)
- func (b *Browser) Shot(ctx context.Context, url string, width, maxHeight int) ([]byte, error)
- func (b *Browser) Tabs(ctx context.Context) (map[string][]Tab, error)
- func (b *Browser) View(w http.ResponseWriter, r *http.Request, sid, tab string)
- type Tab
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 (*Browser) Of ¶
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) Proxy ¶
Proxy relays one CDP client to Chrome, as if the session's tabs were the only ones.
func (*Browser) Reap ¶
Reap closes the tabs of sessions that have been out of atc's list for an hour.
func (*Browser) Render ¶
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.