Documentation
¶
Overview ¶
Package engine owns the deterministic host execution foundation.
Index ¶
- Constants
- Variables
- func CanWarnWhenOptional(err error) bool
- func IsCommandSkipped(err error) bool
- func IsRetryable(err error) bool
- func Validate(ctx context.Context, program *Program) error
- type AIPredictionEngine
- type AIResult
- type ArtifactSink
- type ArtifactWriteRequest
- type ArtifactWriteResult
- type AssertionError
- type Clock
- type CommandMetadata
- type CommandResult
- func (r CommandResult) Artifacts() []device.Artifact
- func (r CommandResult) Command() model.Command
- func (r CommandResult) Depth() int
- func (r CommandResult) Duration() time.Duration
- func (r CommandResult) FinishedAt() time.Time
- func (r CommandResult) Metadata() CommandMetadata
- func (r CommandResult) Outcome() Outcome
- func (r CommandResult) ProductError() error
- func (r CommandResult) RootRunID() string
- func (r CommandResult) Sequence() uint64
- func (r CommandResult) StartedAt() time.Time
- type CommandSkippedError
- type CommandSpan
- func (s *CommandSpan) CommandReset(previous CommandResult) (Event, error)
- func (s *CommandSpan) Finish(outcome Outcome, productError error, metadata CommandMetadata) (CommandResult, Event, error)
- func (s *CommandSpan) FinishWithArtifacts(outcome Outcome, productError error, metadata CommandMetadata, ...) (CommandResult, Event, error)
- func (s *CommandSpan) MetadataUpdated(metadata CommandMetadata) (Event, error)
- type ConfigurationError
- type Controller
- type ControllerFunc
- type ControllerResult
- type Dependencies
- type DeviceConnectionError
- type ElementLookup
- func (lookup *ElementLookup) AdjustedTimeout(options LookupOptions) time.Duration
- func (lookup *ElementLookup) Find(ctx context.Context, selector model.ElementSelector, options LookupOptions) (*hierarchy.Element, error)
- func (lookup *ElementLookup) ForgetDeviceInfo()
- func (lookup *ElementLookup) RecordInteraction(at time.Time)
- func (lookup *ElementLookup) SetActiveApp(appID string) string
- func (lookup *ElementLookup) WaitForElementStability(ctx context.Context, previous *hierarchy.Element) (ElementStabilityResult, error)
- func (lookup *ElementLookup) WaitForHierarchySettle(ctx context.Context, request device.SettleRequest) (*device.ViewHierarchy, error)
- func (lookup *ElementLookup) WaitUntilNotVisible(ctx context.Context, selector model.ElementSelector, timeout time.Duration) error
- func (lookup *ElementLookup) WaitUntilVisible(ctx context.Context, selector model.ElementSelector, optional bool) (*hierarchy.Element, error)
- type ElementStabilityResult
- type Event
- func (e Event) Artifacts() []device.Artifact
- func (e Event) At() time.Time
- func (e Event) Command() (model.Command, bool)
- func (e Event) Depth() int
- func (e Event) FlowPath() string
- func (e Event) Kind() EventKind
- func (e Event) Metadata() CommandMetadata
- func (e Event) Outcome() Outcome
- func (e Event) ProductError() error
- func (e Event) RootRunID() string
- func (e Event) Sequence() uint64
- type EventKind
- type FailureDecision
- type FailureResolver
- type FailureResolverFunc
- type FlowResult
- func (r FlowResult) Commands() []CommandResult
- func (r FlowResult) Depth() int
- func (r FlowResult) Duration() time.Duration
- func (r FlowResult) FinishedAt() time.Time
- func (r FlowResult) Name() string
- func (r FlowResult) Outcome() Outcome
- func (r FlowResult) Path() string
- func (r FlowResult) ProductError() error
- func (r FlowResult) RootRunID() string
- func (r FlowResult) StartedAt() time.Time
- type FlowSpan
- type ImageCheckRequest
- type ImageChecker
- type InputGenerator
- type InputKind
- type InputRequest
- type Listener
- type ListenerDispatchResult
- type ListenerFailure
- type ListenerFunc
- type LookupOptions
- type NoopController
- type OperationError
- type Outcome
- type Program
- type RealClock
- type RecordingController
- type RecordingStartRequest
- type ResourceReadRequest
- type ResourceReadResult
- type ResourceReader
- type Timeline
- type Timer
Constants ¶
const ( ScreenshotDiffThreshold = 0.005 AnimationTimeout = 15 * time.Second ElementStabilityTimeout = 3 * time.Second ElementStabilityPollInterval = 100 * time.Millisecond HierarchySettlePollInterval = 200 * time.Millisecond IOSScreenSettleTimeout = 3 * time.Second AndroidWindowUpdateTimeout = 750 * time.Millisecond AndroidIMECommitSettleDelay = 250 * time.Millisecond DriverServerLaunchTimeout = 15 * time.Second LookupTimeout = 17 * time.Second OptionalLookupTimeout = 7 * time.Second NotVisiblePollInterval = 500 * time.Millisecond WaitUntilVisiblePollInterval = time.Second RepeatDelay = 100 * time.Millisecond DefaultSwipeDuration = 400 * time.Millisecond MaximumSettleTimeout = 30 * time.Second AndroidReachabilityPollInterval = 100 * time.Millisecond IOSStatusReachabilityPollInterval = 500 * time.Millisecond HierarchySettleAttempts = 10 WaitUntilVisibleAttempts = 10 TapAttempts = 1 TapAttemptsWithRetry = 2 RetryCommandMaxRetries = 3 )
const ( EffectNone effectClass = iota EffectObserved EffectDeviceMutation EffectHostMutation EffectComposite EffectArtifact )
Variables ¶
var ErrCloudAPIKeyNotAvailable = errors.New("cloud API key is not available for AI execution")
ErrCloudAPIKeyNotAvailable marks an AI command reached execution without a configured AIPredictionEngine (missing engine or API key). It is wrapped in a OperationError so the failure stays retryable and, under the AI commands' default optional=true, is warned rather than fatal.
Functions ¶
func CanWarnWhenOptional ¶
CanWarnWhenOptional reports whether an optional command may convert the failure into a warned outcome.
func IsCommandSkipped ¶
IsCommandSkipped reports whether the error represents intentional control flow rather than a failed command.
func IsRetryable ¶
IsRetryable reports whether retry command semantics may retry the failure.
func Validate ¶
Validate compiles a prepared Program without running it, so a caller can learn what Execute would refuse before anything reaches a device. compileProgram runs "before any runtime or device dependency is constructed", which is what lets a syntax check use it: parse and capability preflight see a command's SHAPE and its support, never its VALUES, so `repeat: -1` and a 100% coordinate pass both and fail on the device instead.
Compilation is interpolation aware -- `${POINT}` compiles and defers to evaluation -- so this refuses literals only and never a value the flow gets from its environment.
Types ¶
type AIPredictionEngine ¶
type AIPredictionEngine interface {
FindDefects(ctx context.Context, screenshotPNG []byte) (AIResult, error)
PerformAssertion(ctx context.Context, screenshotPNG []byte, assertion string) (AIResult, error)
ExtractText(ctx context.Context, screenshotPNG []byte, query string) (AIResult, error)
}
AIPredictionEngine is the injectable, screenshot-based AI boundary declared in specs/01-core-engine.md. Every call receives an uncompressed PNG screenshot of the current screen. A nil engine on Dependencies fails closed with ErrCloudAPIKeyNotAvailable when the provider key is unavailable.
type AIResult ¶
AIResult is the owned outcome of one AIPredictionEngine call. Not every field is meaningful for every method: Pass and Reasoning describe an assertion, Defects lists findDefects results, and Text carries extracted text.
type ArtifactSink ¶
type ArtifactSink interface {
Write(context.Context, ArtifactWriteRequest) (ArtifactWriteResult, error)
}
ArtifactSink owns artifact naming, storage, and finalization.
type ArtifactWriteRequest ¶
type ArtifactWriteRequest struct {
Owner string
Kind string
SuggestedName string
Data []byte
Metadata map[string]string
}
ArtifactWriteRequest describes content whose final path is owned by the injected sink rather than by a command handler.
type ArtifactWriteResult ¶
ArtifactWriteResult identifies the finalized artifact owned by the sink.
type AssertionError ¶
type AssertionError struct {
// contains filtered or unexported fields
}
AssertionError identifies a failed product assertion. Assertions share the operation retry and optional-warning classification but remain separately inspectable.
func NewAssertionError ¶
func NewAssertionError(message string, cause error) *AssertionError
type Clock ¶
Clock is the minimal time source required by deterministic engine logic. enginetest.FakeClock and RealClock both satisfy it structurally.
type CommandMetadata ¶
type CommandMetadata struct {
// contains filtered or unexported fields
}
CommandMetadata is an immutable snapshot of execution metadata.
func NewCommandMetadata ¶
func (CommandMetadata) AIReasoning ¶
func (m CommandMetadata) AIReasoning() string
func (CommandMetadata) EvaluatedCommand ¶
func (m CommandMetadata) EvaluatedCommand() (model.Command, bool)
func (CommandMetadata) HasNumberOfRuns ¶
func (m CommandMetadata) HasNumberOfRuns() bool
HasNumberOfRuns reports whether NumberOfRuns was explicitly populated. The zero-value CommandMetadata is absent, while NewCommandMetadata makes every supplied value present, including zero.
func (CommandMetadata) Insight ¶
func (m CommandMetadata) Insight() string
func (CommandMetadata) LogMessages ¶
func (m CommandMetadata) LogMessages() []string
func (CommandMetadata) NumberOfRuns ¶
func (m CommandMetadata) NumberOfRuns() int
type CommandResult ¶
type CommandResult struct {
// contains filtered or unexported fields
}
CommandResult is an immutable terminal command record.
func (CommandResult) Artifacts ¶
func (r CommandResult) Artifacts() []device.Artifact
func (CommandResult) Command ¶
func (r CommandResult) Command() model.Command
func (CommandResult) Depth ¶
func (r CommandResult) Depth() int
func (CommandResult) Duration ¶
func (r CommandResult) Duration() time.Duration
func (CommandResult) FinishedAt ¶
func (r CommandResult) FinishedAt() time.Time
func (CommandResult) Metadata ¶
func (r CommandResult) Metadata() CommandMetadata
func (CommandResult) Outcome ¶
func (r CommandResult) Outcome() Outcome
func (CommandResult) ProductError ¶
func (r CommandResult) ProductError() error
func (CommandResult) RootRunID ¶
func (r CommandResult) RootRunID() string
func (CommandResult) Sequence ¶
func (r CommandResult) Sequence() uint64
func (CommandResult) StartedAt ¶
func (r CommandResult) StartedAt() time.Time
type CommandSkippedError ¶
type CommandSkippedError struct {
// contains filtered or unexported fields
}
CommandSkippedError is control flow for a command that intentionally did not execute.
func NewCommandSkippedError ¶
func NewCommandSkippedError(message string, cause error) *CommandSkippedError
type CommandSpan ¶
type CommandSpan struct {
// contains filtered or unexported fields
}
CommandSpan is a single-use command timing scope.
func (*CommandSpan) CommandReset ¶
func (s *CommandSpan) CommandReset(previous CommandResult) (Event, error)
CommandReset captures an immutable reset event for a previously executed immediate child. The child's identity is reused and no sequence is allocated.
func (*CommandSpan) Finish ¶
func (s *CommandSpan) Finish(outcome Outcome, productError error, metadata CommandMetadata) (CommandResult, Event, error)
func (*CommandSpan) FinishWithArtifacts ¶
func (s *CommandSpan) FinishWithArtifacts( outcome Outcome, productError error, metadata CommandMetadata, artifacts []device.Artifact, ) (CommandResult, Event, error)
FinishWithArtifacts completes the command with finalized host-owned artifacts while preserving immutable result and listener snapshots.
func (*CommandSpan) MetadataUpdated ¶
func (s *CommandSpan) MetadataUpdated(metadata CommandMetadata) (Event, error)
MetadataUpdated captures an immutable metadata event for this active parent without completing the span or allocating another command sequence.
type ConfigurationError ¶
type ConfigurationError struct {
// contains filtered or unexported fields
}
ConfigurationError identifies invalid engine input or configuration.
func NewConfigurationError ¶
func NewConfigurationError(message string, cause error) *ConfigurationError
type Controller ¶
Controller is the pause/resume boundary consulted before command dispatch.
type ControllerFunc ¶
func (ControllerFunc) WaitIfPaused ¶
func (f ControllerFunc) WaitIfPaused(ctx context.Context) error
type ControllerResult ¶
type ControllerResult struct {
// contains filtered or unexported fields
}
ControllerResult preserves a pre-existing product error while separately exposing controller failure. Without a product error, controller failure is the effective execution error.
func WaitForController ¶
func WaitForController(ctx context.Context, controller Controller, productError error) ControllerResult
WaitForController safely invokes a controller without allowing a callback panic or error to overwrite an existing product failure.
func (ControllerResult) ControllerFailure ¶
func (r ControllerResult) ControllerFailure() error
func (ControllerResult) EffectiveError ¶
func (r ControllerResult) EffectiveError() error
func (ControllerResult) ProductError ¶
func (r ControllerResult) ProductError() error
type Dependencies ¶
type Dependencies struct {
// ExecutionID is a caller-owned deterministic identity for one public
// Execute invocation. Root-run correlation is derived from it.
ExecutionID string
// ExternalEnvironment is a caller-owned environment input. Execute takes
// one sanitized snapshot and applies it only at each selected root scope.
ExternalEnvironment map[string]string
// ReservedEnvironment carries the variables only the host may set —
// FLOWBATON_SHARD_ID, FLOWBATON_SHARD_INDEX, FLOWBATON_DEVICE_UDID. It is a
// separate field because ExternalEnvironment is sanitized: those names are
// stripped from the operator's map precisely so they can arrive only here.
// Every key must carry the FLOWBATON_ prefix, and these win over both a
// flow's own env and the operator's.
ReservedEnvironment map[string]string
// SequencedRoots is how many of the plan's LEADING roots
// executionOrder.flowsOrder named. Those flows were declared to depend on
// each other, so a failure among them ends the run unless
// ContinueOnFailure says otherwise. Every remaining root is parallel-eligible
// and always runs, as specified by specs/03-cli-tooling.md:30.
SequencedRoots int
// ContinueOnFailure carries the ordered sequence past a failed flow.
ContinueOnFailure bool
Driver device.Driver
Clock Clock
JSFactory js.Factory
Controller Controller
// FailureResolver is optional. Nil and invalid resolvers fail closed.
FailureResolver FailureResolver
Listeners []Listener
ArtifactSink ArtifactSink
RecordingController RecordingController
ResourceReader ResourceReader
InputGenerator InputGenerator
ImageChecker ImageChecker
// AIEngine is optional. A nil engine fails AI commands closed with
// ErrCloudAPIKeyNotAvailable (specs/01-core-engine.md).
AIEngine AIPredictionEngine
}
Dependencies contains the required engine core and optional command-family services. Optional services are validated only by the handler that uses them.
type DeviceConnectionError ¶
type DeviceConnectionError struct {
// contains filtered or unexported fields
}
DeviceConnectionError identifies a transport or device-session loss that must propagate rather than be retried or downgraded to an optional warning.
func NewDeviceConnectionError ¶
func NewDeviceConnectionError(message string, cause error) *DeviceConnectionError
type ElementLookup ¶
type ElementLookup struct {
// contains filtered or unexported fields
}
ElementLookup owns host-side hierarchy acquisition and selector lookup. Device information is cached after the first successful read because the viewport is stable for the lifetime of a driver session.
func NewElementLookup ¶
func NewElementLookup(driver device.Driver, clock Clock) *ElementLookup
NewElementLookup constructs deterministic host-side lookup primitives.
func (*ElementLookup) AdjustedTimeout ¶
func (lookup *ElementLookup) AdjustedTimeout(options LookupOptions) time.Duration
AdjustedTimeout returns an explicit timeout unchanged (apart from flooring negatives at zero), or the required/optional default minus elapsed time since the latest interaction. The result is always non-negative.
func (*ElementLookup) Find ¶
func (lookup *ElementLookup) Find(ctx context.Context, selector model.ElementSelector, options LookupOptions) (*hierarchy.Element, error)
Find polls normalized visible hierarchies until the selector matches or the adjusted deadline is reached. Matching delegates to the frozen exact matching package without altering selector semantics.
func (*ElementLookup) ForgetDeviceInfo ¶
func (lookup *ElementLookup) ForgetDeviceInfo()
ForgetDeviceInfo drops the cached device grid so the next read measures the screen as it is now. DeviceInfo is cached because a lookup polls and the iOS runner answers the route by taking a screenshot, but the grid is the one field that changes under a running session, and visibleHierarchy prunes with it: after a rotation an element plainly on a landscape screen falls outside the remembered portrait width and reads as missing.
The engine calls this when IT rotates the device. A rotation the app performs on its own is a known gap: nothing tells the session, and the cached grid stays wrong until the flow rotates or the session ends.
func (*ElementLookup) RecordInteraction ¶
func (lookup *ElementLookup) RecordInteraction(at time.Time)
RecordInteraction records the latest accepted interaction instant. Timestamps before the watermark cannot move it backwards.
func (*ElementLookup) SetActiveApp ¶
func (lookup *ElementLookup) SetActiveApp(appID string) string
SetActiveApp names the app whose hierarchy lookups should read, and returns what was set before so a caller can restore it.
Drivers use the active app ID to scope hierarchy requests. Returning the previous value rather than exposing a stack keeps ownership with the flow scope that already pushes and pops the environment: one place that knows a flow was entered also knows it was left.
func (*ElementLookup) WaitForElementStability ¶
func (lookup *ElementLookup) WaitForElementStability(ctx context.Context, previous *hierarchy.Element) (ElementStabilityResult, error)
WaitForElementStability refreshes the element by attributes (excluding bounds) every 100ms. Transient absence or ambiguity keeps the last-known element; driver and hierarchy failures still propagate.
func (*ElementLookup) WaitForHierarchySettle ¶
func (lookup *ElementLookup) WaitForHierarchySettle(ctx context.Context, request device.SettleRequest) (*device.ViewHierarchy, error)
WaitForHierarchySettle confirms settling only after two equal, non-loading hierarchy samples. Nil samples are inconclusive and never count as settled. An explicit timeout governs deadline polling; an omitted timeout performs exactly ten possible 200ms polls.
func (*ElementLookup) WaitUntilNotVisible ¶
func (lookup *ElementLookup) WaitUntilNotVisible(ctx context.Context, selector model.ElementSelector, timeout time.Duration) error
WaitUntilNotVisible checks immediately, then polls at the exact 500ms condition cadence through the deadline. A still-visible element at the deadline is a retryable OperationError.
func (*ElementLookup) WaitUntilVisible ¶
func (lookup *ElementLookup) WaitUntilVisible(ctx context.Context, selector model.ElementSelector, optional bool) (*hierarchy.Element, error)
WaitUntilVisible performs exactly ten possible one-second waits followed by one hierarchy lookup per attempt. Optional exhaustion is a nil element and nil error; required exhaustion is a retryable OperationError.
type ElementStabilityResult ¶
ElementStabilityResult preserves the latest refreshable element and bounds even when the stability deadline expires. Stable is true only when equal consecutive bounds are observed before that deadline.
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event is an immutable listener-facing lifecycle snapshot.
func (Event) Metadata ¶
func (e Event) Metadata() CommandMetadata
func (Event) ProductError ¶
type EventKind ¶
type EventKind string
EventKind identifies an immutable engine lifecycle event.
const ( EventFlowStarted EventKind = "FlowStarted" EventFlowFinished EventKind = "FlowFinished" EventCommandStarted EventKind = "CommandStarted" EventCommandFinished EventKind = "CommandFinished" EventCommandReset EventKind = "CommandReset" EventCommandMetadataUpdated EventKind = "CommandMetadataUpdated" )
type FailureDecision ¶
type FailureDecision string
FailureDecision is the stable root-command failure action returned by a FailureResolver. CONTINUE is the only value that permits later root work.
const ( FailureDecisionFail FailureDecision = "FAIL" FailureDecisionContinue FailureDecision = "CONTINUE" )
type FailureResolver ¶
type FailureResolver interface {
ResolveFailure(context.Context, CommandResult) FailureDecision
}
FailureResolver decides whether root-owned execution may continue after a finalized failed command. Child and nested execution never consults it.
type FailureResolverFunc ¶
type FailureResolverFunc func(context.Context, CommandResult) FailureDecision
func (FailureResolverFunc) ResolveFailure ¶
func (resolver FailureResolverFunc) ResolveFailure(ctx context.Context, result CommandResult) FailureDecision
type FlowResult ¶
type FlowResult struct {
// contains filtered or unexported fields
}
FlowResult is an immutable terminal flow record.
func Execute ¶
func Execute(ctx context.Context, program *Program, dependencies Dependencies) (results []FlowResult, err error)
Execute compiles the complete prepared Program before creating a runtime or touching the driver, then executes selected roots in plan order. Duplicate root selections intentionally produce independent execution sessions.
func (FlowResult) Commands ¶
func (r FlowResult) Commands() []CommandResult
func (FlowResult) Depth ¶
func (r FlowResult) Depth() int
func (FlowResult) Duration ¶
func (r FlowResult) Duration() time.Duration
func (FlowResult) FinishedAt ¶
func (r FlowResult) FinishedAt() time.Time
func (FlowResult) Name ¶
func (r FlowResult) Name() string
Name is the flow's authored `name:`, blank when it has none.
func (FlowResult) Outcome ¶
func (r FlowResult) Outcome() Outcome
func (FlowResult) Path ¶
func (r FlowResult) Path() string
func (FlowResult) ProductError ¶
func (r FlowResult) ProductError() error
func (FlowResult) RootRunID ¶
func (r FlowResult) RootRunID() string
func (FlowResult) StartedAt ¶
func (r FlowResult) StartedAt() time.Time
type FlowSpan ¶
type FlowSpan struct {
// contains filtered or unexported fields
}
FlowSpan is a single-use flow timing scope.
func (*FlowSpan) Finish ¶
func (s *FlowSpan) Finish(outcome Outcome, productError error, commands []CommandResult) (FlowResult, Event, error)
type ImageCheckRequest ¶
ImageCheckRequest contains encoded images and an optional shared crop.
type ImageChecker ¶
type ImageChecker interface {
Check(context.Context, ImageCheckRequest) (imagecheck.Result, error)
}
ImageChecker is the injectable host boundary around imagecheck.Result.
type InputGenerator ¶
type InputGenerator interface {
Generate(context.Context, InputRequest) (string, error)
}
InputGenerator supplies deterministic host-generated input.
type InputKind ¶
type InputKind string
InputKind is the stable input-generation category used by random-input command handlers.
type InputRequest ¶
InputRequest asks the injected generator for one typed value.
type Listener ¶
Listener observes immutable engine events. Listener failures are diagnostic only and never replace the product execution error.
type ListenerDispatchResult ¶
type ListenerDispatchResult struct {
// contains filtered or unexported fields
}
ListenerDispatchResult keeps product and observer failures in separate channels so observer code cannot change execution semantics.
func DispatchListeners ¶
func DispatchListeners(ctx context.Context, event Event, productError error, listeners ...Listener) ListenerDispatchResult
DispatchListeners invokes every listener in declaration order while isolating returned errors and panics.
func (ListenerDispatchResult) EffectiveError ¶
func (r ListenerDispatchResult) EffectiveError() error
func (ListenerDispatchResult) ListenerFailures ¶
func (r ListenerDispatchResult) ListenerFailures() []ListenerFailure
func (ListenerDispatchResult) ProductError ¶
func (r ListenerDispatchResult) ProductError() error
type ListenerFailure ¶
type ListenerFailure struct {
// contains filtered or unexported fields
}
ListenerFailure records one isolated listener error or panic.
func (ListenerFailure) Err ¶
func (f ListenerFailure) Err() error
func (ListenerFailure) Index ¶
func (f ListenerFailure) Index() int
type ListenerFunc ¶
type LookupOptions ¶
LookupOptions controls a selector lookup. A nil Timeout uses the adjusted required or optional default. Optional absence is represented explicitly as a nil element and nil error; required absence is a OperationError.
type NoopController ¶
type NoopController struct{}
NoopController never pauses or fails.
func (NoopController) WaitIfPaused ¶
func (NoopController) WaitIfPaused(context.Context) error
type OperationError ¶
type OperationError struct {
// contains filtered or unexported fields
}
OperationError identifies a product operation failure eligible for command retry and optional-warning handling.
func NewOperationError ¶
func NewOperationError(message string, cause error) *OperationError
type Outcome ¶
type Outcome string
Outcome is the stable terminal status for a command or flow.
func ClassifyOutcome ¶
ClassifyOutcome applies the engine's skipped, cancelled, and optional-warning taxonomy to a product error.
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is the immutable-by-API set of flows validated by capability preflight.
func Prepare ¶
func Prepare(ctx context.Context, plan model.ExecutionPlan, loader capability.FlowLoader) (*Program, error)
Prepare runs capability preflight through a recording cache and retains the validated parsed flows. Executing a Program never reloads source files.
func PrepareForPlatform ¶
func PrepareForPlatform( ctx context.Context, plan model.ExecutionPlan, loader capability.FlowLoader, platform capability.ExecutionPlatform, ) (*Program, error)
PrepareForPlatform performs the same immutable preparation while rejecting features whose registry Platforms do not include the selected driver. It is intended for executable paths before Driver.Open; syntax-only callers may continue to use Prepare.
func (*Program) Graph ¶
func (p *Program) Graph() capability.Report
Graph returns the selected-root capability proof retained by the Program.
type RecordingController ¶
type RecordingController interface {
Start(context.Context, RecordingStartRequest) error
Stop(context.Context) ([]device.Artifact, error)
}
RecordingController completes the start/stop lifecycle outside frozen device.Driver v0 and returns only finalized artifacts from Stop.
type RecordingStartRequest ¶
RecordingStartRequest describes one host-managed recording session.
type ResourceReadRequest ¶
type ResourceReadRequest struct {
Path string
}
ResourceReadRequest names one independently resolved host resource.
type ResourceReadResult ¶
ResourceReadResult is an owned snapshot of resource bytes and metadata.
type ResourceReader ¶
type ResourceReader interface {
Read(context.Context, ResourceReadRequest) (ResourceReadResult, error)
}
ResourceReader resolves command resources without direct filesystem access in handlers.
type Timeline ¶
type Timeline struct {
// contains filtered or unexported fields
}
Timeline is the shared monotonic command-sequence and time source for one execution run.
func NewTimeline ¶
func (*Timeline) BeginCommand ¶
BeginCommand allocates the next sequence number and captures an immutable start event.
func (*Timeline) BeginFlow ¶
BeginFlow captures a flow start without allocating a command sequence.
name is the flow's authored `name:`, blank when it has none. It is carried because this is the only point where the compiled config and the result being built are both in scope: a consumer holding a FlowResult has just a path, and a path cannot be turned back into an authored name.
func (*Timeline) Checkpoint ¶
Checkpoint returns the highest command sequence allocated so far, including commands whose spans have not finished yet.
Source Files
¶
- ai_engine.go
- ai_handlers.go
- assert_screenshot_handler.go
- assertion_wait_handlers.go
- callbacks.go
- clock.go
- clone.go
- compiled_program.go
- condition.go
- decoder.go
- device_state_handlers.go
- dispatcher.go
- errors.go
- execution.go
- executor_core.go
- failure_policy.go
- flow_executor.go
- interaction_action_alias_handlers.go
- interaction_action_handlers.go
- interaction_clipboard_handlers.go
- interaction_gesture_handlers.go
- interaction_random_handlers.go
- interaction_scroll_handler.go
- interaction_text_handlers.go
- lifecycle_handlers.go
- lookup.go
- media_handlers.go
- navigation_handlers.go
- program.go
- registry.go
- repeat_handler.go
- reserved_environment.go
- result_ledger.go
- results.go
- retry_handler.go
- run_flow_handler.go
- screenshot_names.go
- script_handlers.go
- selector_snapshot.go
- services.go
- session.go
- settle.go
- stability.go
- swipe_handler.go
- tap_handlers.go
- travel_handler.go
- wait.go
- walking_skeleton_handlers.go