MissionRunner class

Orchestrates a MissionMessage end-to-end: walks steps in order, finds targets, dispatches to the right executor, verifies side effects, retries on failure, emits protocol events for both lifecycle (status) and outcome (verification).

Constructors

MissionRunner({required SnapshotFactory captureSnapshot, ScrollerResolver? scrollerResolver, HighlightCallback? highlightCallback, StepHighlightCallback? onStepHighlight, BackHandler? onBack, NavStack? navStack, Explorer explorer = const Explorer(), StepVerifier verifier = const Verifier(), MissionStatusListener? onStatus, MissionPhaseListener? onPhase, MissionVerificationListener? onVerification, MissionInfoQueryListener? onInfoQuery, MissionFindCandidatesListener? onFindCandidates, MissionOutcomeListener? onMissionTelemetry, StepOutcomeListener? onStepTelemetry, NearMissListener? onNearMiss, double nearMissFloor = 0.65, RollbackCallback? onRollback, void afterStep()?, Duration stepTimeout = const Duration(seconds: 30), Duration missionTimeout = const Duration(minutes: 3), int retriesPerStep = 2, Duration retryDelay = const Duration(milliseconds: 450), Duration postExecuteSettle = const Duration(milliseconds: 400), DateTime clock()?, Duration blindStepWait = const Duration(seconds: 2), Duration blindStepPollInterval = const Duration(milliseconds: 200), Duration stepTimeoutBackstop = const Duration(seconds: 2), Duration baselineGap = const Duration(milliseconds: 200), Duration secondLookDelay = const Duration(milliseconds: 1500)})

Properties

afterStep → void Function()?
Fires unconditionally after each attempt's settle + verification — success or failure.
final
baselineGap → Duration
Tap-family steps capture a BASELINE snapshot this long before the "before" capture: whatever changes between the two (a countdown, a clock) is self-changing and never counts as evidence that the tap worked. Zero disables the baseline.
final
blindStepPollInterval → Duration
Re-capture cadence for blindStepWait.
final
blindStepWait → Duration
Chains (backend _build_mission_chain) send later steps BLIND, after a settle wait: when such a step's first find misses, the next screen may simply still be loading. The runner re-polls for the target up to this long (cancellable) before accepting target_not_found as terminal.
final
captureSnapshot → SnapshotFactory
final
clock → DateTime Function()?
Mission-timeout clock (injectable for tests). Defaults to DateTime.now.
final
explorer → Explorer
final
hashCode → int
The hash code for this object.
no setterinherited
highlightCallback → HighlightCallback?
final
missionTimeout → Duration
final
SDK-managed tab-swap history.
final
nearMissFloor → double
Threshold above which runnerUpRatio triggers a near-miss event (and below ambiguityRatio, where ambiguity reporting takes over).
final
onBack → BackHandler?
Host-supplied back-navigation handler.
final
onFindCandidates → MissionFindCandidatesListener?
Fires after a successful find_candidates step.
final
onInfoQuery → MissionInfoQueryListener?
Fires after a successful read_field step.
final
onMissionTelemetry → MissionOutcomeListener?
Fires once per mission at terminal status.
final
onNearMiss → NearMissListener?
Fires when the matcher's text rung had a runner-up close to the winner but below the ambiguity threshold.
final
onPhase → MissionPhaseListener?
Fires three times per step attempt — once on each StepPhase.
final
onRollback → RollbackCallback?
final
onStatus → MissionStatusListener?
final
onStepHighlight → StepHighlightCallback?
See StepHighlightCallback; wins over highlightCallback when set.
final
onStepTelemetry → StepOutcomeListener?
Fires once per step with a StepOutcome: action, match_source, exec_strategy, evidence, attempts, duration, success, failure_reason.
final
onVerification → MissionVerificationListener?
final
postExecuteSettle → Duration
How long to wait after an executor's dispatch before capturing the "after" snapshot.
final
retriesPerStep → int
final
retryDelay → Duration
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollerResolver → ScrollerResolver?
final
secondLookDelay → Duration
When a DISPATCHED tap / navigate / back cannot be confirmed (verifier verdict unknown), the runner looks once more after this long — a fresh capture and a re-run of the verifier ONLY. The action is NEVER dispatched again: a late effect (a network-driven screen update) turns into a verified success, anything else is still reported as the original failure. Zero disables the second look.
final
stepTimeout → Duration
final
stepTimeoutBackstop → Duration
Safety margin on top of stepTimeout for the hard .timeout around an attempt. The step deadline itself is enforced by racing the attempt against its cancel signal; this only catches a wedged attempt that never reaches a checkpoint.
final
verifier → StepVerifier
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run(MissionMessage mission, {MissionCancelToken? cancel}) → Future<MissionRunResult>
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

pickAutoScrollableStableId(MissionStep step, UiSnapshot snap) → String?
Pure picker for the SDK auto-detect scroll fallback.
readDurationForTest(Object? raw) → Duration?
Test seam for the wait-duration clamp below.