Documentation
¶
Overview ¶
Package browser provides browser automation tools for omniagent.
Index ¶
- type Config
- type Dialog
- type Tool
- func (t *Tool) AcceptDialog(ctx context.Context, response string) error
- func (t *Tool) ClearDialogs()
- func (t *Tool) Close() error
- func (t *Tool) Description() string
- func (t *Tool) DismissDialogWithCancel(ctx context.Context) error
- func (t *Tool) Execute(ctx context.Context, args json.RawMessage) (string, error)
- func (t *Tool) GetObservedDialogs() []Dialog
- func (t *Tool) Name() string
- func (t *Tool) Parameters() map[string]interface{}
- func (t *Tool) SetDialogCallback(callback func(Dialog))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Headless bool
UserData string
Logger *slog.Logger
// EvaluateTimeout is the default timeout for JavaScript evaluation.
// Zero means use the action timeout.
EvaluateTimeout time.Duration
// DialogCallback is called when a dialog is observed.
DialogCallback func(Dialog)
}
Config configures the browser tool.
type Dialog ¶ added in v0.9.0
type Dialog struct {
// Type is the dialog type: "alert", "confirm", "prompt", "beforeunload".
Type string
// Message is the dialog message text.
Message string
// DefaultValue is the default value for prompt dialogs.
DefaultValue string
// URL is the page URL where the dialog appeared.
URL string
// Timestamp is when the dialog was observed.
Timestamp time.Time
// Handled indicates if the dialog was automatically handled.
Handled bool
// Response is the response given (for confirm: "true"/"false", for prompt: input text).
Response string
}
Dialog represents a browser dialog (alert, confirm, prompt).
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool provides browser automation capabilities.
func (*Tool) AcceptDialog ¶ added in v0.9.0
AcceptDialog accepts a dialog with an optional response.
func (*Tool) ClearDialogs ¶ added in v0.9.0
func (t *Tool) ClearDialogs()
ClearDialogs clears the dialog history.
func (*Tool) Description ¶
Description returns the tool description.
func (*Tool) DismissDialogWithCancel ¶ added in v0.9.0
DismissDialogWithCancel dismisses a dialog by clicking cancel.
func (*Tool) GetObservedDialogs ¶ added in v0.9.0
GetObservedDialogs returns the list of observed dialogs.
func (*Tool) Parameters ¶
Parameters returns the JSON schema for tool parameters.
func (*Tool) SetDialogCallback ¶ added in v0.9.0
SetDialogCallback sets a callback for dialog events.
Click to show internal directories.
Click to hide internal directories.