Documentation
¶
Overview ¶
Package externalbrowser owns the external Chromium/Chrome browser sessions of one Node. When a local Chrome/Edge/Brave/Arc exposes CDP remote debugging it attaches directly without disturbing the user's browser process; otherwise it launches a visible local browser with a shared persistent profile.
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 supported Chromium-based browser installed on this host, preferring Google Chrome, or returns "". Nothing is ever downloaded.
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 uses: either an installed browser binary or a running local browser exposing CDP remote debugging. Without either, 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
// Headless forces headless mode when launching a managed browser. When
// false, desktop hosts launch a visible window.
Headless bool
// DisableAttach skips probing running local browsers for CDP remote
// debugging endpoints.
DisableAttach bool
}