app

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 43 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 app is the browser core behind `sweef gui`: it owns the engine tabs (one privileged chrome tab plus one tab per page), the state model, the stores, the compositor and the input router, and talks to a native window only through shell.Window.

Threading: a single UI loop goroutine owns all mutable app state and runs every handler. Each engine tab has a worker goroutine that executes its (blocking) engine calls in order; results come back to the loop through App.post. The compositor and the model are internally synchronised.

How the pieces plug together (see also the package comment in app.go and the message list in protocol.go):

win, _ := auto.Open(shell.Config{Title: "Sweef", Width: 1280, Height: 800}) // internal/shell/auto
a, err := app.New(app.Config{
    Shell:    win,
    ChromeFS: ui.FS,                 // chrome/index.html, chrome/overlay.html, newtab/index.html, ...
    Agent:    myAgentHost,           // an app.AgentHost adapting internal/agent (optional)
    ProfileDir: "",                  // "" = per-OS default
})
err = a.Run(ctx)                     // returns when the window closes

internal/app never imports internal/ui, internal/agent or a native shell; the caller hands them in. cmd/sweef/gui.go does that wiring through three tiny hook files (gui_ui.go, gui_shell.go, gui_agent.go).

Packages:

state       windows, tabs, history, closed-tab stack; snapshot + merge patches
store       history, bookmarks, downloads, settings, session, site rules, usage
omnibox     classify input, ranked suggestions, search engines
privacy     tracker blocklist, HTTPS upgrade, GPC, referrer trimming, cookie policy
compositor  chrome + page texture + overlay -> one RGBA frame, damage, scrolling
headless    a shell.Window without a display (tests, screenshots)

Index

Constants

This section is empty.

Variables

View Source
var DevToolsOpener func(a *App, tabID string)

DevToolsOpener is the hook the "Inspect" context-menu item calls. The developer tools implementation replaces it (assign in an init function or at start-up); the default tells the person they are not built into this binary.

View Source
var ErrNeedsApproval = errors.New("app: this site needs the user's approval before the agent can see it")

ErrNeedsApproval is returned for origins whose visibility is "ask".

View Source
var ErrNoShell = errors.New("app: no native window available (shell/auto is not linked into this build); use --headless")

ErrNoShell means no native window implementation was registered.

View Source
var ErrOriginBlocked = errors.New("app: the user blocked the agent from this site")

ErrOriginBlocked is returned when the agent asks for a blocked origin.

View Source
var PanicHook func(any)

PanicHook, when set, is told about panics recovered on tab workers (tests fail on them; the CLI logs them).

Functions

func HasShell

func HasShell() bool

HasShell reports whether a factory is registered.

func OpenShell

func OpenShell(cfg shell.Config) (shell.Window, error)

OpenShell opens a window through the registered factory.

func ParseColor

func ParseColor(s string) (color.RGBA, error)

ParseColor parses "#rrggbb".

func ParseSize

func ParseSize(s string) (int, int, bool)

ParseSize parses "1280x800".

func PlaceholderFS

func PlaceholderFS() fs.FS

PlaceholderFS returns an fs.FS laid out like ui.FS (chrome/index.html, newtab/index.html) with minimal placeholder pages. Tests and previews use it; production passes ui.FS instead.

func RegisterShell

func RegisterShell(open func(shell.Config) (shell.Window, error))

RegisterShell installs the native window factory. A tiny file in cmd/sweef calls it with shell/auto's Open once that package exists, so this package compiles without any native code.

func RunScript

func RunScript(a *App, win *headless.Window, s *Script, outDir string) error

RunScript replays s against a running app through the headless window, writing screenshots into outDir.

Types

type AgentAttacher

type AgentAttacher interface{ AttachApp(a *App) }

AgentAttacher is implemented by an AgentHost that needs the App (to build a Backend over the live tabs). New calls AttachApp once, after the engine exists and before the chrome starts loading.

type AgentChat

type AgentChat struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	When  string `json:"when,omitempty"`
}

AgentChat is one entry of the chat list.

type AgentChats

type AgentChats interface {
	NewChat()
	// OpenChat returns the chat's title and messages ({role, text}).
	OpenChat(id string) (title string, messages []map[string]any, ok bool)
}

AgentChats manages conversations.

type AgentConfirmer

type AgentConfirmer interface {
	Confirm(runID, id string, approved bool)
}

AgentConfirmer answers a `confirm` event.

type AgentData

type AgentData struct {
	Bytes          int64  // attributed transfer bytes of the tabs the agent used
	SavedMeasured  int64  // cache hits and aborted responses (0 when unknown)
	SavedEstimated int64  // ESTIMATE; always shown as one
	Skipped        int    // requests skipped by policy
	Lite           bool   // the run loaded pages in agent mode
	Available      bool   // false when the engine does not count (Bytes is then meaningless)
	Text           string // "Research used 412 KB"
}

AgentData is what a research run cost, from the agent tabs' own counters.

type AgentEvent

type AgentEvent struct {
	RunID string         `json:"runId"`
	Kind  string         `json:"kind"`
	Text  string         `json:"text,omitempty"`
	Data  map[string]any `json:"data,omitempty"`
}

AgentEvent is one streamed item from the agent. Kind is one of "text", "thought", "action", "status", "done", "error", "confirm" (and "sources"). The app forwards it to the chrome page as `agent.event` with Data merged into the top level, which is the shape the sidebar reads:

text {text, full?}  thought {text, done?}  action {id,label,detail,status,ms}
status {state,text}  confirm {id,title,risk,action}  sources {items}
done {ttft,tps,ms,sources}  error {code,message,retryAfter}

func (AgentEvent) MarshalJSON

func (e AgentEvent) MarshalJSON() ([]byte, error)

MarshalJSON flattens Data into the event object. Data cannot overwrite runId or kind.

type AgentHost

type AgentHost interface {
	// Send starts a run. The channel is closed when the run ends.
	Send(text, mode string, page PageContext) <-chan AgentEvent
	Stop()
	TakeControl()
	SetKey(string)
}

AgentHost is what internal/app needs from an agent implementation. The PM connects internal/agent to it later; this package never imports it.

type AgentInfo

type AgentInfo struct {
	HasKey bool        `json:"hasKey"`
	Model  string      `json:"model,omitempty"`
	Chats  []AgentChat `json:"chats,omitempty"`
	Title  string      `json:"title,omitempty"` // current chat
}

AgentInfo is what the settings page and sidebar show about the agent.

type AgentInfoer

type AgentInfoer interface{ Info() AgentInfo }

AgentInfoer reports key/model/chat state for the UI.

type AgentKeyClearer

type AgentKeyClearer interface{ ClearKey() }

AgentKeyClearer forgets the stored API key.

type AgentKeySetter

type AgentKeySetter interface{ StoreKey(key string) error }

AgentKeySetter is an optional AgentHost capability: StoreKey saves the API key and reports whether it was accepted (agent.keyResult carries the answer).

type AgentResumer

type AgentResumer interface{ Resume() }

AgentResumer continues after the user handed control back.

type AgentSidebarWatcher

type AgentSidebarWatcher interface{ SidebarOpened() }

AgentSidebarWatcher is an optional AgentHost capability: SidebarOpened is called on the UI loop whenever the sidebar opens (it must not block).

type AgentTab

type AgentTab struct {
	ID      string
	URL     string
	Title   string
	Active  bool
	Private bool // an incognito tab (or any tab of an incognito window)
	Loading bool
}

AgentTab is the agent host's view of one tab. The visibility and incognito decision is the host's; this only reports facts.

type App

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

App is the browser.

func New

func New(cfg Config) (*App, error)

New builds the app. The window must already exist. Engine start-up and the chrome page load happen asynchronously on worker goroutines; Run drives the UI loop and draws the first frame as soon as the chrome is painted.

func (*App) ActivePageEval

func (a *App) ActivePageEval(js string, out any) error

ActivePageEval evaluates js in the visible page tab (tests, diagnostics).

func (*App) AgentActivateTab

func (a *App) AgentActivateTab(ctx context.Context, id string) error

AgentActivateTab brings a tab to the front.

func (*App) AgentCloseTab

func (a *App) AgentCloseTab(ctx context.Context, id string) error

AgentCloseTab closes a tab.

func (*App) AgentCursor

func (a *App) AgentCursor(show bool, x, y float64, label string, pressed bool)

AgentCursor shows the agent's cursor over the page at viewport-relative logical px (x,y) with a label, or hides it (show=false). The overlay only draws it while its state is "acting".

func (*App) AgentDataBegin

func (a *App) AgentDataBegin()

AgentDataBegin marks the start of a run. Tabs the agent touches from now on are measured from their numbers at that moment.

It queues the work and returns at once, so the host can call it from the UI loop (Send runs there); the agent's first navigation is queued after it.

func (*App) AgentDataEnd

func (a *App) AgentDataEnd() AgentData

AgentDataEnd closes the run's measurement and returns it. The tabs go back to the person's own policy for whatever they load next.

func (*App) AgentEngineID

func (a *App) AgentEngineID(tabID string) string

AgentEngineID maps a state tab id to the engine's tab id ("" if unknown).

func (*App) AgentNavigate

func (a *App) AgentNavigate(ctx context.Context, tabID, raw string) error

AgentNavigate loads raw in the tab through the app's own navigation path (HTTPS upgrade, tracker shield, history, security state) and returns when the load finished. A failed load renders the usual error page and returns its error.

func (*App) AgentOpenTab

func (a *App) AgentOpenTab(ctx context.Context, raw string) (string, error)

AgentOpenTab opens and activates a new tab and waits for its load.

func (*App) AgentOverlayState

func (a *App) AgentOverlayState() (state string, cursor map[string]any)

AgentOverlayState reports the overlay state (off, acting, control, done, stopped) and the agent cursor, read on the UI loop (tests, diagnostics).

func (*App) AgentPageZoom

func (a *App) AgentPageZoom() float64

AgentPageZoom is the page zoom factor (cursor coordinates are in layout px).

func (*App) AgentRefresh

func (a *App) AgentRefresh()

AgentRefresh asks for a fresh state push (key presence, chats, model).

func (*App) AgentReveal

func (a *App) AgentReveal(tabID string, cssY int)

AgentReveal scrolls the visible page so that document position cssY (CSS px) is in the upper third of the viewport, with the usual easing. It is a no-op for tabs that are not on screen.

func (*App) AgentRunOnTab

func (a *App) AgentRunOnTab(tabID string, f func(t *engine.Tab) error) error

AgentRunOnTab runs f on the worker of the page tab with state id tabID, then forwards the page's bindings and repaints it if it is the visible tab, so the user watches each step land. f gets the engine tab; it must not keep it. The returned error is f's, or "tab closed" / a timeout.

func (*App) AgentRunState

func (a *App) AgentRunState(s string)

AgentRunState lets the host mirror the run into state.agent.state (idle, working, waiting, paused, error) and the overlay when the app did not see an event for it (e.g. a confirm answered).

func (*App) AgentScrollY

func (a *App) AgentScrollY(tabID string) int

AgentScrollY is the current scroll offset (CSS px) of a tab.

func (*App) AgentSetSiteRule

func (a *App) AgentSetSiteRule(origin string, v store.Visibility)

AgentSetSiteRule records the user's answer for an origin. It does the same as the sidebar's "allow / block this site" buttons (state is refreshed).

func (*App) AgentSiteRule

func (a *App) AgentSiteRule(urlOrOrigin string) store.Visibility

AgentSiteRule is the user's per-origin agent visibility for a URL or origin.

func (*App) AgentSync

func (a *App) AgentSync(ctx context.Context, tabID string) error

AgentSync waits until everything queued for the tab so far has run (navigation, paints), and the UI loop has processed its results.

func (*App) AgentTab

func (a *App) AgentTab(id string) (AgentTab, bool)

AgentTab returns one tab by state id.

func (*App) AgentTabs

func (a *App) AgentTabs() []AgentTab

AgentTabs lists the window's tabs in visual order.

func (*App) AgentToast

func (a *App) AgentToast(text, kind string)

AgentToast shows a toast in the chrome.

func (*App) AgentTraverse

func (a *App) AgentTraverse(ctx context.Context, tabID string, delta int) error

AgentTraverse goes back (-1) or forward (+1) in the tab's own history.

func (*App) AgentViewport

func (a *App) AgentViewport() (w, h float64)

AgentViewport is the page viewport in logical px (what the user sees).

func (*App) AgentWindowPrivate

func (a *App) AgentWindowPrivate() bool

AgentWindowPrivate reports whether the whole window is incognito.

func (*App) Badges

func (a *App) Badges() map[string]engine.Badge

Badges returns the app badges sites have set (origin to badge), for shells that can show them.

func (*App) ChromeEval

func (a *App) ChromeEval(js string, out any) error

ChromeEval evaluates js in the chrome page on its worker and decodes the JSON result into out (nil to ignore). It exists for tests and diagnostics.

func (*App) Close

func (a *App) Close()

Close stops the app and releases the engine and profile. It is safe to call from any goroutine, more than once.

func (*App) Compositor

func (a *App) Compositor() *compositor.Compositor

Compositor returns the compositor (stats, tests).

func (*App) Engine

func (a *App) Engine() *engine.Engine

Engine returns the engine.

func (*App) FirstFrameAfter

func (a *App) FirstFrameAfter() time.Duration

FirstFrameAfter returns the time from New to the first presented frame (0 until it happens).

func (*App) Idle

func (a *App) Idle() bool

Idle reports whether nothing is queued, loading or animating.

func (*App) MediaOrigins

func (a *App) MediaOrigins() []string

MediaOrigins lists the origins with stored capture decisions (settings page, tests).

func (*App) Model

func (a *App) Model() *state.Model

Model exposes the state model (read-mostly; tests and the PM use it).

func (*App) Profile

func (a *App) Profile() *store.Profile

Profile returns the active profile.

func (*App) Run

func (a *App) Run(ctx context.Context) error

Run drives the UI loop until the window closes, ctx is cancelled or Close is called.

func (*App) SetOnline

func (a *App) SetOnline(on bool)

SetOnline tells the background features whether the network is reachable (pending background syncs fire on reconnecting; pages get online and offline events).

func (*App) SetStoragePersistPrompt

func (a *App) SetStoragePersistPrompt(f func(origin string) bool)

SetStoragePersistPrompt installs the prompt shown when a page asks for persistent storage and no automatic rule has decided. It runs on the page's script thread, so it should answer promptly; it must not call back into the page. Passing nil removes it (the default: such requests are denied).

func (*App) Stats

func (a *App) Stats() Stats

Stats returns the current numbers (safe from any goroutine).

func (*App) WaitIdle

func (a *App) WaitIdle(quiet, timeout time.Duration) bool

WaitIdle blocks until the app has been Idle continuously for quiet, or timeout passes.

func (*App) WindowID

func (a *App) WindowID() int

WindowID is the id of the single window.

type Backend

type Backend struct{ A *App }

Backend is the adapter the PM connects to internal/agent's Backend interface (method names are intentionally close to the engine's). Every method enforces the per-origin visibility rule: a tab on a blocked or not-yet-approved origin can be listed (id only) but not read or driven.

func (Backend) Click

func (b Backend) Click(tabID, selector string) error

Click clicks a selector in an allowed tab.

func (Backend) Fill

func (b Backend) Fill(tabID, selector, value string) error

Fill sets a form field value in an allowed tab.

func (Backend) Navigate

func (b Backend) Navigate(tabID, url string) error

Navigate loads url in an allowed tab.

func (Backend) ReadPage

func (b Backend) ReadPage(tabID string) (string, error)

ReadPage returns the visible text of an allowed tab.

func (Backend) Tabs

func (b Backend) Tabs() []TabInfo

Tabs lists tabs, hiding everything but the id for non-allowed origins.

type Config

type Config struct {
	// Shell is the native (or headless) window. Required.
	Shell shell.Window
	// ChromeFS holds the chrome UI assets: "chrome/index.html", internal
	// pages such as "newtab/index.html", "settings/index.html". Pass ui.FS.
	// When nil, a tiny built-in placeholder chrome is used.
	ChromeFS fs.FS
	// ChromeEntry is the chrome page inside ChromeFS (default chrome/index.html).
	ChromeEntry string
	// OverlayEntry is the optional transparent overlay chrome page.
	OverlayEntry string
	// Profile is a ready profile. Otherwise ProfileDir is opened (default
	// per-OS dir), or an in-memory profile when Incognito is set.
	Profile    *store.Profile
	ProfileDir string
	Incognito  bool
	// Agent is the agent host (nil = the sidebar reports "not configured").
	Agent AgentHost
	// InitialURLs are opened instead of restoring the session.
	InitialURLs []string
	// NoRestore skips session restore.
	NoRestore bool
	// Engine lets a caller share an engine; the app closes it only if it made it.
	Engine *engine.Engine
	// UserAgent overrides the default UA.
	UserAgent string
	// DownloadsDir overrides the downloads location.
	DownloadsDir string
	// Version is shown on the About page (state.version).
	Version string
	// NoSmoothScroll turns off wheel easing.
	NoSmoothScroll bool
	// Logf receives diagnostics (default: discard).
	Logf func(format string, args ...any)
	// DataEngine is the engine's Data Saver API (counters, policies). Nil uses
	// the default adapter (see dataengine_stub.go / dataengine_real.go).
	DataEngine DataEngine
	// Now overrides the clock the data budget uses (tests).
	Now func() time.Time
	// NotifySink replaces the desktop notification service (tests pass a notify.Recorder). Nil: the platform's
	// service, opened when the first notification is shown, and an in-window toast where there is none.
	NotifySink notify.Sink
	// PushService overrides the push.service setting and SWEEF_PUSH_SERVICE (tests).
	PushService string
}

Config configures New.

type DataEngine

type DataEngine interface {
	// Available reports whether the engine counts and saves data. When false
	// the UI says so instead of showing zeros that look like measurements.
	Available() bool
	// SetContextPolicy sets the policy of a whole context (level: off,
	// standard or strict).
	SetContextPolicy(ctx *engine.BrowserContext, level string)
	// SetTabPolicy overrides one tab's policy; level "" inherits the context's.
	SetTabPolicy(t *engine.Tab, level string)
	// SetBackground marks a tab as hidden (no timers or requests when the
	// policy suspends background tabs).
	SetBackground(t *engine.Tab, bg bool)
	// ContextStats and TabStats read the counters (any goroutine).
	ContextStats(ctx *engine.BrowserContext) DataSnap
	TabStats(t *engine.Tab) DataSnap
	// LoadSkipped fetches and swaps one tap-to-load resource (nodeID is the
	// placeholder element's backend node id).
	LoadSkipped(t *engine.Tab, nodeID int64) error
	// LoadSkippedImages loads every withheld image on the page and returns how
	// many it loaded ("Load images on this page").
	LoadSkippedImages(t *engine.Tab) (int, error)
	// LoadFully reloads the current page once without any saving; the engine
	// forgets the exception at the tab's next navigation.
	LoadFully(t *engine.Tab) error
	// FullyLoaded reports whether LoadFully is in effect for the current page.
	FullyLoaded(t *engine.Tab) bool
	// IsDataEvent reports whether a bus event is a throttled "data" event.
	IsDataEvent(ev engine.Event) bool
}

DataEngine is everything the app needs from the engine's Data Saver API (docs/data-saver.md, "Engine API"). The real adapter is dataengine_real.go; tests use a fake with deterministic byte counts (Config.DataEngine).

type DataSnap

type DataSnap struct {
	WireIn, WireOut int64            // exact socket totals since the context was created
	ByKind          map[string]int64 // transfer bytes by kind (approximate attribution)
	ByOrigin        map[string]int64 // approximate
	CacheHitBytes   int64            // measured
	AbortedBytes    int64            // measured
	SkippedKnown    int64            // measured: size of skipped requests learned from the cache or a Content-Length
	Skipped         map[string]int   // request counts skipped by policy
	SkippedEstimate int64            // ESTIMATED bytes avoided
}

DataSnap is the engine's DataStats in app terms (kinds are plain strings).

func (DataSnap) Attributed

func (s DataSnap) Attributed() int64

Attributed is the bytes attributed to kinds (what a tab "used").

func (DataSnap) MeasuredSaved

func (s DataSnap) MeasuredSaved() int64

MeasuredSaved is everything provably not downloaded.

func (DataSnap) SkippedCount

func (s DataSnap) SkippedCount() int

SkippedCount is the total number of requests skipped by policy.

func (DataSnap) Wire

func (s DataSnap) Wire() int64

Wire is the measured socket total.

type Expect

type Expect struct {
	Title    string `json:"title,omitempty"`    // active tab title contains
	URL      string `json:"url,omitempty"`      // active tab URL contains
	Tabs     *int   `json:"tabs,omitempty"`     // number of tabs
	Pixel    []any  `json:"pixel,omitempty"`    // [x, y, "#rrggbb"] on the screen (device px)
	NotPixel []any  `json:"notPixel,omitempty"` // same, must differ
}

Expect asserts on app state; a failure aborts the script.

type FakeAgent

type FakeAgent struct {
	Script []AgentEvent
	Delay  time.Duration
	Calls  []FakeCall
	Stops  int
	Takes  int
	Key    string
	// contains filtered or unexported fields
}

FakeAgent is a scripted AgentHost for tests and UI previews.

func NewFakeAgent

func NewFakeAgent() *FakeAgent

NewFakeAgent returns an agent that streams a short canned answer that echoes what it was allowed to see.

func (*FakeAgent) Info

func (f *FakeAgent) Info() AgentInfo

func (*FakeAgent) LastCall

func (f *FakeAgent) LastCall() (FakeCall, bool)

LastCall returns the most recent Send.

func (*FakeAgent) Send

func (f *FakeAgent) Send(text, mode string, pc PageContext) <-chan AgentEvent

func (*FakeAgent) SetKey

func (f *FakeAgent) SetKey(k string)

func (*FakeAgent) Stop

func (f *FakeAgent) Stop()

func (*FakeAgent) TakeControl

func (f *FakeAgent) TakeControl()

type FakeCall

type FakeCall struct {
	Text, Mode string
	Page       PageContext
}

FakeCall records one Send.

type Gate

type Gate struct {
	Inner AgentHost
	Vis   func(originOrURL string) store.Visibility
}

Gate wraps an AgentHost and enforces the per-origin visibility rule at the boundary, even if a caller builds a PageContext by hand: content for a blocked origin is replaced by the Blocked stub before the inner host sees it, and "ask" origins are treated as blocked until approved.

func (*Gate) Send

func (g *Gate) Send(text, mode string, pc PageContext) <-chan AgentEvent

func (*Gate) SetKey

func (g *Gate) SetKey(k string)

func (*Gate) Stop

func (g *Gate) Stop()

func (*Gate) TakeControl

func (g *Gate) TakeControl()

type PageContext

type PageContext struct {
	TabID   string `json:"tabId,omitempty"`
	URL     string `json:"url,omitempty"`
	Title   string `json:"title,omitempty"`
	Origin  string `json:"origin,omitempty"`
	Text    string `json:"text,omitempty"`
	Blocked bool   `json:"blocked,omitempty"`
}

PageContext is what the agent may know about the page the user is on. When Blocked is true every other field is empty: the agent is never handed content (or even the URL) of an origin the user blocked.

type Script

type Script struct {
	Size  string `json:"size,omitempty"`
	Steps []Step `json:"steps"`
}

Script is a headless test script (`sweef gui --headless --script f.json`).

{"size":"1280x800","steps":[
  {"wait":"idle"}, {"key":"ctrl+l"}, {"type":"example.com"}, {"key":"Enter"},
  {"click":[100,20]}, {"wheel":[0,300],"at":[400,400]}, {"shot":"home.png"},
  {"expect":{"title":"Example","pixel":[10,10,"#1c2030"]}} ]}

func LoadScript

func LoadScript(path string) (*Script, error)

LoadScript reads a script file.

type Stats

type Stats struct {
	Compositor   compositor.Stats
	InputLatency compositor.Percentiles
	Suggest      compositor.Percentiles
	Presents     int
	DamageAvgPx  int64
	StatePushes  int
	Usage        store.UsageSnapshot
	FirstFrame   time.Duration
	BlockedTotal int64
}

Stats is a snapshot of timing and resource numbers.

func (Stats) Format

func (s Stats) Format() string

Format renders stats for the terminal.

type Step

type Step struct {
	Wait   string    `json:"wait,omitempty"`  // "idle" | "load" | duration
	Sleep  string    `json:"sleep,omitempty"` // duration
	Key    string    `json:"key,omitempty"`   // chord, e.g. "ctrl+t", "Enter"
	Type   string    `json:"type,omitempty"`  // committed text
	Click  []float64 `json:"click,omitempty"` // x,y logical
	Right  []float64 `json:"rightclick,omitempty"`
	Move   []float64 `json:"move,omitempty"`
	Wheel  []float64 `json:"wheel,omitempty"` // dx,dy; position from At (default viewport centre)
	At     []float64 `json:"at,omitempty"`
	Resize []int     `json:"resize,omitempty"` // w,h logical
	Nav    string    `json:"nav,omitempty"`    // navigate the active tab (as if typed)
	NewTab string    `json:"newtab,omitempty"` // open a tab
	Shot   string    `json:"shot,omitempty"`   // file name inside the out dir
	Expect *Expect   `json:"expect,omitempty"`
	Print  string    `json:"print,omitempty"` // "stats"
}

Step is one script action; exactly one action field is set.

type TabInfo

type TabInfo struct {
	ID      string `json:"id"`
	URL     string `json:"url,omitempty"`
	Title   string `json:"title,omitempty"`
	Active  bool   `json:"active"`
	Blocked bool   `json:"blocked,omitempty"`
}

TabInfo is the agent's view of a tab. Blocked tabs expose only their id.

Directories

Path Synopsis
cmd
appbench command
Command appbench measures the GUI stack and writes internal/app/BENCH.md.
Command appbench measures the GUI stack and writes internal/app/BENCH.md.
Package compositor stitches the chrome layer, the page texture and an optional alpha overlay into one RGBA frame.
Package compositor stitches the chrome layer, the page texture and an optional alpha overlay into one RGBA frame.
Package headless is a shell.Window that has no display: it applies each Present(frame, damage) to an in-memory "screen", records timing, and replays scripted input events.
Package headless is a shell.Window that has no display: it applies each Present(frame, damage) to an in-memory "screen", records timing, and replays scripted input events.
Package omnibox classifies address-bar input and produces ranked suggestions from history, bookmarks, open tabs and search templates.
Package omnibox classifies address-bar input and produces ranked suggestions from history, bookmarks, open tabs and search templates.
Package privacy implements Sweef's built-in tracker/ad blocking policy: a compact domain blocklist, first-party/third-party classification, HTTPS upgrade, referrer trimming, GPC/DNT headers and third-party cookie filtering.
Package privacy implements Sweef's built-in tracker/ad blocking policy: a compact domain blocklist, first-party/third-party classification, HTTPS upgrade, referrer trimming, GPC/DNT headers and third-party cookie filtering.
Package state is the browser's in-memory model: windows, tabs, per-window active tab, ordering, the closed-tab stack and per-tab navigation history.
Package state is the browser's in-memory model: windows, tabs, per-window active tab, ordering, the closed-tab stack and per-tab navigation history.
Package store holds every persistent (or deliberately non-persistent) piece of browser data: history, bookmarks, downloads, settings, session, site permissions, top sites and usage stats.
Package store holds every persistent (or deliberately non-persistent) piece of browser data: history, bookmarks, downloads, settings, session, site permissions, top sites and usage stats.

Jump to

Keyboard shortcuts

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