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 ¶
- func Installed() string
- func Validate(action protocol.ExternalBrowserAction, arguments json.RawMessage) (map[string]any, error)
- type Browsers
- func (browsers *Browsers) Available() bool
- func (browsers *Browsers) Browser() (string, error)
- func (browsers *Browsers) Close(id protocol.SessionID)
- func (browsers *Browsers) Execute(ctx context.Context, call Call) (protocol.Output, error)
- func (browsers *Browsers) Profiles() []protocol.SessionID
- func (browsers *Browsers) Remove(id protocol.SessionID)
- func (browsers *Browsers) Sessions() []protocol.SessionID
- func (browsers *Browsers) Shutdown()
- type Call
- type Options
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 (*Browsers) Available ¶
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 ¶
Browser resolves the browser a session starts. Without an installed browser every call fails at once with the same fault.
func (*Browsers) Close ¶
Close ends the session's browser and waits for its process tree. The session's profile stays for its next browser.
func (*Browsers) Profiles ¶
Profiles lists the conversation sessions that have a browser profile on disk, whether or not a browser runs.
func (*Browsers) Remove ¶
Remove ends the browser of a deleted conversation and deletes its profile, which holds the cookies of the sites it signed in to.
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
}