Add initial VibeGuard browser extension

This commit is contained in:
Jordan Wages 2026-08-24 15:27:46 -05:00
commit 9c65a61ebb
43 changed files with 125275 additions and 2 deletions

22
src/inference/cache.ts Normal file
View file

@ -0,0 +1,22 @@
import { hashText, normalizeText } from "../shared/hash";
import type { InferenceResult } from "../shared/types";
export class ResultCache {
private readonly values = new Map<string, InferenceResult>();
get(text: string): InferenceResult | undefined {
return this.values.get(hashText(text));
}
set(text: string, result: InferenceResult): void {
this.values.set(hashText(normalizeText(text)), result);
}
clear(): void {
this.values.clear();
}
get size(): number {
return this.values.size;
}
}