Documentation
¶
Index ¶
- Constants
- func InterpolateEnv(s string, workflowEnv map[string]string) string
- func ParseTimeout(s string) time.Duration
- type Action
- type ActionResult
- type ClickStep
- type DownloadStep
- type ElementInfo
- type Executor
- func (e *Executor) Close()
- func (e *Executor) IsHeaded() bool
- func (e *Executor) KeyPress(key input.Key) error
- func (e *Executor) NavigateTo(url string) error
- func (e *Executor) Page() *rod.Page
- func (e *Executor) RunAction(name string) *ActionResult
- func (e *Executor) SetEnv(key, value string)
- func (e *Executor) Start() error
- type FillStep
- type InspectResult
- type Option
- type SleepStep
- type Step
- type UploadStep
- type WaitStep
- type WaitURLStep
- type Workflow
Constants ¶
const InspectJS = `` /* 2995-byte string literal not displayed */
inspectJS extracts interactive elements from the DOM. Returns a JSON array of element descriptors. Designed to be compact and useful for LLM agents writing workflow YAML. InspectJS is the JavaScript that extracts interactive elements from the DOM. Exported so the CLI can call it via page.Eval().
Variables ¶
This section is empty.
Functions ¶
func InterpolateEnv ¶
InterpolateEnv replaces ${VAR_NAME} patterns with environment variable values. Checks the workflow's env map first, then os.Getenv.
func ParseTimeout ¶
ParseTimeout converts a timeout string like "30s" or "2m" to a Duration. Defaults to 30s if empty or unparseable.
Types ¶
type ActionResult ¶
type ActionResult struct {
OK bool `json:"ok"`
Action string `json:"action"`
Steps int `json:"steps"`
DurationMs int64 `json:"duration_ms"`
Download string `json:"download,omitempty"`
DownloadSize int64 `json:"download_size,omitempty"`
Error string `json:"error,omitempty"`
FailedStep int `json:"failed_step,omitempty"`
StepType string `json:"step_type,omitempty"`
Screenshot string `json:"screenshot,omitempty"`
}
ActionResult is the structured output of running a workflow action. Designed for machine consumption — LLM agents parse this as JSON.
type DownloadStep ¶
type ElementInfo ¶
type ElementInfo struct {
Selector string `json:"selector"`
Tag string `json:"tag"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Text string `json:"text,omitempty"`
Href string `json:"href,omitempty"`
Value string `json:"value,omitempty"`
Role string `json:"role,omitempty"`
Hidden bool `json:"hidden,omitempty"`
}
ElementInfo describes a single interactive DOM element.
type Executor ¶
type Executor struct {
// LastDownload holds the path to the most recently downloaded file.
LastDownload string
// LastResult holds the string result of the most recent action (e.g. downloaded CSV content).
LastResult string
// contains filtered or unexported fields
}
Executor runs workflow actions against a real browser.
func NewExecutor ¶
NewExecutor creates an executor with browser configuration. Use functional options: WithHeaded(true), WithDebug(true), WithProfileDir("...").
func (*Executor) NavigateTo ¶
NavigateTo creates a new page, injects stealth, and navigates to the given URL. Used by one-shot commands (inspect, screenshot, eval) that don't need a workflow.
func (*Executor) RunAction ¶
func (e *Executor) RunAction(name string) *ActionResult
RunAction executes a named action from the workflow. Returns a structured ActionResult suitable for JSON serialization.
type InspectResult ¶
type InspectResult struct {
OK bool `json:"ok"`
URL string `json:"url"`
Title string `json:"title"`
Elements []ElementInfo `json:"elements"`
Total int `json:"total"`
Truncated bool `json:"truncated,omitempty"`
DurationMs int64 `json:"duration_ms"`
Error string `json:"error,omitempty"`
}
InspectResult is the structured output of inspecting a page's interactive elements.
type Option ¶
type Option func(*Executor)
Option configures an Executor.
func WithHeaded ¶
WithHeaded shows the browser window (useful for CAPTCHAs or debugging).
func WithProfileDir ¶
WithProfileDir sets the Chrome profile directory for session persistence.
type Step ¶
type Step struct {
Navigate string `yaml:"navigate,omitempty"`
// Interactions
Click *ClickStep `yaml:"click,omitempty"`
Fill *FillStep `yaml:"fill,omitempty"`
Upload *UploadStep `yaml:"upload,omitempty"`
Download *DownloadStep `yaml:"download,omitempty"`
// Waits
WaitVisible *WaitStep `yaml:"wait_visible,omitempty"`
WaitText *WaitStep `yaml:"wait_text,omitempty"`
WaitURL *WaitURLStep `yaml:"wait_url,omitempty"`
// Utilities
Screenshot string `yaml:"screenshot,omitempty"`
Sleep *SleepStep `yaml:"sleep,omitempty"`
Eval string `yaml:"eval,omitempty"`
// Control flow
Label string `yaml:"label,omitempty"` // human-readable step description for logging
}
Step is a single browser operation. Exactly one field should be set.