Phase 5 adds a compatibility traversal model to packages/api/pkg/sikuli/finder.go without removing the existing Go value/slice API.
Finder now supports two additive traversal-preparation methods:
Iterate(pattern *Pattern) errorIterateAll(pattern *Pattern) errorThese methods:
ErrFindFailed on a missHasNext() as the presence check, matching the SikuliX mental modelThe traversal methods operate over the same last-result cache used by:
HasNext() boolNext() (Match, bool)Reset()Destroy()LastMatches() []MatchThe Go port intentionally keeps both models:
Find(pattern) returns ErrFindFailed on a missFindAll(pattern) returns []MatchIterate(pattern) prepares a one-match traversal without raising ErrFindFailed on a missIterateAll(pattern) prepares an all-match traversal without requiring callers to consume a slice immediatelyHasNext() and Next() advance through the prepared resultsLastMatches() continues returning the full most-recent match set even after Next() advances the iterator.
This is a deliberate Go-compatibility choice:
HasNext() and Next()Destroy() clears both the traversal cursor and the last-match cache. Reset() rewinds traversal over the current last-match cache.
This phase does not change the runtime architecture or move traversal semantics into gRPC. The compatibility iterator is an additive pkg/sikuli layer on top of the existing search implementation.