AppIndex

Precomputed, query-efficient index over the installed apps. Built once per app list (not per query), it replaces the old per-query full scans + double Levenshtein in CommandRouter. Two jobs:

  • resolve — map a model-chosen app name to a real installed app, with a confidence flag, through ordered tiers (exact → compact → acronym → prefix → token-prefix → substring → subsequence → fuzzy). Only the fuzzy tier is "not confident", so the UI knows when to ask.

  • candidates — top-K apps for a free-text query, used to ground the LLM prompt so the model picks a real installed app instead of hallucinating a name. This is where device-discovered entries (app shortcuts, deep-link targets) would also be folded in later — same ranking, richer corpus.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Resolution(val app: AppEntry?, val confident: Boolean, val candidates: List<AppEntry>, val score: Float = 0.0f)

The result of resolving a name to an installed app:

Functions

Link copied to clipboard
fun candidates(query: String, k: Int): List<AppEntry>

Top-K installed apps most relevant to query, for grounding the prompt.

Link copied to clipboard
fun lookup(name: String, config: ResolverConfig = ResolverConfig.DEFAULT): AppIndex.Resolution

Deterministic app resolver — the launcher's job, not the LLM's. Progressive tiers (exact → alias → acronym → prefix → substring → subsequence → fuzzy) each yield a numeric Resolution.score; the confidence decision (execute / confirm / present candidates / no-match) is derived from the centralized, tunable ResolverConfig thresholds (SoT §15) rather than hard-coded per tier.