externalbrowser

package
v0.2.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 36 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 externalbrowser owns the managed Chromium sessions of one Node. Each conversation session drives one browser process tree with its own user data directory through chromedp. It never attaches to a browser the user runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Installed

func Installed() string

Installed finds a Chrome, Chromium or Edge installed on this host, or returns "". Nothing else is ever used as the browser and nothing is downloaded. It is only ever started with a session's own user data directory.

func Validate

func Validate(action protocol.ExternalBrowserAction, arguments json.RawMessage) (map[string]any, error)

Validate checks the arguments every action shares and returns them decoded.

Types

type Browsers

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

func New

func New(options Options) *Browsers

func (*Browsers) Available

func (browsers *Browsers) Available() bool

Available reports whether this Node owns browser sessions at all. A missing browser is reported by each call instead, so that its fault can be read.

func (*Browsers) Browser

func (browsers *Browsers) Browser() (string, error)

Browser resolves the browser a session starts. Without an installed browser every call fails at once with the same fault.

func (*Browsers) Close

func (browsers *Browsers) Close(id protocol.SessionID)

Close ends the session's browser and waits for its process tree. The session's profile stays for its next browser.

func (*Browsers) Execute

func (browsers *Browsers) Execute(ctx context.Context, call Call) (protocol.Output, error)

func (*Browsers) Profiles

func (browsers *Browsers) Profiles() []protocol.SessionID

Profiles lists the conversation sessions that have a browser profile on disk, whether or not a browser runs.

func (*Browsers) Remove

func (browsers *Browsers) Remove(id protocol.SessionID)

Remove ends the browser of a deleted conversation and deletes its profile, which holds the cookies of the sites it signed in to.

func (*Browsers) Sessions

func (browsers *Browsers) Sessions() []protocol.SessionID

Sessions lists the conversation sessions that own a running browser.

func (*Browsers) Shutdown

func (browsers *Browsers) Shutdown()

Shutdown interrupts every call and closes every browser. It is final. A browser that was idle is asked to exit, so its profile is flushed.

type Call

type Call struct {
	Request   protocol.RequestID
	Session   protocol.SessionID
	Root      string // worktree root that confines uploads and saved files
	Action    protocol.ExternalBrowserAction
	Arguments json.RawMessage
	// Check repeats the plugin authority decision around browser startup.
	Check func(context.Context) error
}

Call is one admitted use_external_browser operation.

type Options

type Options struct {
	// Profile is the Node profile directory. Browser profiles and temporary
	// files stay below it.
	Profile string
	Node    protocol.NodeID
	// Changed reports a worktree root that received a generated file.
	Changed func(root string)
	// Clock times idle browsers and plain waits. Nil is the real clock.
	Clock clockwork.Clock
}

Jump to

Keyboard shortcuts

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