
FindMalek/guesswork on GitHub
- Stars
- 2
- Forks
- 1
- Language
- TypeScript
- License
- MIT
- Last push
- 23 Sep 2026
Read from GitHub on . Counts change daily.
How it uses Jev
/** Ranks `candidates` against `typed` via a real Jev request. Throws on timeout/network/API error -- the caller decides the fallback. */
export async function rankWithJev(typed: string, candidates: readonly Candidate[]): Promise<JevRankResult> {
const { state, questions } = buildRequest(typed, candidates);
const response = await getClient().systemOne({ state, questions });
const probabilities = response.answers.completion.probabilities;
const ranked = candidates
.map((c) => ({
command: c.command,
score: probabilities[c.id] ?? 0,
isPrefix: c.command.startsWith(typed),
}))
.sort((a, b) => b.score - a.score);
return { ranked, hasCompletion: response.answers.has_completion.noul };
