Problem
findBestMatchesByLocator, parseFindArgs, matchText, normalizeText, and matchRole/normalizeRole are internal to the daemon handler layer but are needed by downstream consumers that operate on snapshot nodes independently.
What to export
From a new agent-device/finders entrypoint (or add to agent-device/contracts):
findBestMatchesByLocator(nodes, locator, query, requireRect?)
parseFindArgs(args) — locator/query/action parser
normalizeText(value) — trim + lowercase + collapse whitespace
normalizeRole(value) — strip XCUIElementType and android.widget. prefixes
These are pure functions with no platform dependencies. Currently in src/utils/finders.ts and src/daemon/handlers/find.ts.
Why
Consumers that receive snapshot nodes and need to run find/match logic currently have to copy the algorithm. Exporting it keeps scoring consistent across local and remote paths and avoids drift (e.g., missing iOS role normalization in copies).
Problem
findBestMatchesByLocator,parseFindArgs,matchText,normalizeText, andmatchRole/normalizeRoleare internal to the daemon handler layer but are needed by downstream consumers that operate on snapshot nodes independently.What to export
From a new
agent-device/findersentrypoint (or add toagent-device/contracts):findBestMatchesByLocator(nodes, locator, query, requireRect?)parseFindArgs(args)— locator/query/action parsernormalizeText(value)— trim + lowercase + collapse whitespacenormalizeRole(value)— stripXCUIElementTypeandandroid.widget.prefixesThese are pure functions with no platform dependencies. Currently in
src/utils/finders.tsandsrc/daemon/handlers/find.ts.Why
Consumers that receive snapshot nodes and need to run find/match logic currently have to copy the algorithm. Exporting it keeps scoring consistent across local and remote paths and avoids drift (e.g., missing iOS role normalization in copies).