run

package
v0.2.0-beta.4 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: 19 Imported by: 0

Documentation

Overview

Package run implements the execution roles of exploration mode: the Tester tool loop, the Pilot supervisor conversation, and the Navigator that brings the app to a usable screen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Navigator struct {
	Driver   device.Driver
	Observer explore.Observer
	Worker   explore.LLM
	Config   explore.Config
	// Experience optionally stores and serves "reach <key>" recipes.
	Experience explore.ExperienceStore

	// Sleep is injected by tests; nil means real sleeping.
	Sleep func(context.Context, time.Duration) error
	// contains filtered or unexported fields
}

Navigator prepares the app for exploration and steers it to named screens, replaying learned recipes before spending model turns.

func (n *Navigator) EnsureReady(ctx context.Context) (*explore.ScreenState, error)

EnsureReady relaunches the app from a stopped process, settles, and observes. One failed observation earns one kill-and-relaunch retry before giving up.

It kills before launching so the app starts from a stopped process rather than resuming a live one, and so a scenario does not inherit the process state the one before it left. On mmx36 that moved the exported flows from 1 of 4 replaying standalone to 4 of 4 -- one session's count, not a rate this promises to hold, because the paragraph below names what still breaks a replay.

What it does NOT do is put the app on a known screen, whatever this comment said before 2026-08-30. Measured on iOS 26.2: Reminders killed on a list-detail screen relaunches on that same screen, because the system restores it. A scenario, and a replayed export, can therefore still begin somewhere the run never started -- the symptom is a step 2 that cannot find an element the recording did. Only clearState defeats restoration, and it takes the data later scenarios need with it.

The kill does keep data: an app relaunched still holds whatever earlier scenarios created.

func (n *Navigator) Reach(
	ctx context.Context, key string,
) (*explore.ScreenState, []explore.StepRecord, error)

Reach brings the app to the screen named by key: a stored recipe is replayed first, then a small bounded tool loop on the worker model. A successful model-driven path is recorded back into the store.

type ReachError

type ReachError struct {
	Key    string
	Reason string
}

ReachError reports that the navigator could not bring the app to the requested screen.

func (*ReachError) Error

func (e *ReachError) Error() string

type Tester

type Tester struct {
	Driver   device.Driver
	Observer explore.Observer
	Models   explore.ModelSet
	Config   explore.Config
	// Sleep is injected by tests; nil means real sleeping.
	Sleep func(context.Context, time.Duration) error
}

Tester executes one scenario as a bounded tool loop on the worker model, optionally supervised by a pilot conversation on the manager model.

func (*Tester) RunScenario

func (t *Tester) RunScenario(ctx context.Context, scenario explore.Scenario, start *explore.ScreenState) (*explore.TestResult, error)

RunScenario drives the scenario until the model finishes, the pilot stops the run, the step budget runs out, or the context ends. A non-nil result is returned alongside any error so partial evidence is never lost.

Jump to

Keyboard shortcuts

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