research

package
v0.2.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package research implements the Observer and Researcher exploration roles: capturing one settled screen of the app through the device driver and turning that capture into a validated UI map for planning and testing conversations.

Index

Constants

View Source
const DefaultSettleTimeout = 5 * time.Second

DefaultSettleTimeout bounds the settle wait when the caller sets none.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(screen explore.ScreenSignature) (*explore.UIMap, bool)
	Put(screen explore.ScreenSignature, m *explore.UIMap)
}

Cache stores researched UI maps by screen. Nil on the Researcher disables caching.

type Observer

type Observer struct {
	Driver device.Driver
	AppID  string
	// SettleTimeout bounds the static-screen wait; zero means
	// DefaultSettleTimeout.
	SettleTimeout time.Duration
	// Logf receives observation notes, such as an unsettled screen
	// being captured anyway. Nil is silent.
	Logf func(format string, args ...any)
	// Clock supplies capture timestamps; nil means wall time.
	Clock func() time.Time
}

Observer captures the current screen of one application. It settles the screen within a bound, reads the hierarchy scoped to the app, takes an uncompressed screenshot, and derives flattened elements plus the screen signature.

func (*Observer) Observe

func (o *Observer) Observe(ctx context.Context) (*explore.ScreenState, error)

Observe captures one full screen state. An unsettled screen is noted and captured anyway; a settle probe the platform cannot answer is treated the same way.

type Researcher

type Researcher struct {
	Models explore.ModelSet
	// Cache short-circuits research for screens already mapped.
	Cache Cache
	// Clock supplies map timestamps; nil means wall time.
	Clock func() time.Time
}

Researcher turns an observed screen into a validated UI map. One worker call proposes sections over the element table; unknown element indexes get exactly one correction round in the same conversation; locators are assigned deterministically from the flattened tree; an optional vision call adds per-element visual notes.

func (*Researcher) Research

func (r *Researcher) Research(ctx context.Context, state *explore.ScreenState) (*explore.UIMap, error)

Research maps one screen. The input state is never mutated.

Jump to

Keyboard shortcuts

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