/** Per-note usefulness tally. `lastMarked` is an ISO-8601 timestamp (or "" if a * loaded legacy/partial entry lacked one). */ export interface FeedbackEntry { useful: number; notUseful: number; lastMarked: string; } /** Upper bound on distinct marked notes the store will hold. Far beyond any real * vault's useful-marked set; bounds disk growth from a misbehaving client that * marks unbounded fake paths over a long `serve-http` session (a mild fill-DoS). * At the cap, EXISTING entries still update; NEW paths are ignored. */ export declare const MAX_FEEDBACK_ENTRIES = 100000; /** v3.11.0-rc.24 (Goose FIND-2) — upper bound on the sidecar file size read at `open()`. * At MAX_FEEDBACK_ENTRIES × ~200 B/entry the legitimate file is ~20 MB; 64 MB is generous * and bounds a corrupt/hostile file before readFile+JSON.parse (defense-in-depth — the * sidecar is operator-controlled, not bearer-reachable). */ export declare const MAX_FEEDBACK_FILE_BYTES: number; /** * Cache-dir location of the per-vault feedback sidecar. MIRRORS `defaultIndexFile` * (fts5.ts): same `enquire` cache dir (honoring `$XDG_CACHE_HOME`) under the same * first-12-hex sha1(vaultRoot) hash, so the file sits beside the other per-vault * artifacts and `prune`'s `ENQUIRE_CACHE_ARTIFACT` pattern erases it. The dir+hash * parity with `defaultIndexFile` is pinned by `tests/feedback.test.ts`. * * @param vaultRoot Absolute path to the vault root. * @returns Absolute path to `/.feedback.json`. */ export declare function defaultFeedbackFile(vaultRoot: string): string; /** * A note's feedback score in [0, 1): `useful / (useful + notUseful + 1)`. The +1 * Laplace term keeps a single positive mark modest (0.5) and an unmarked note at * 0, so the search boost is gentle and monotonically increasing in NET * usefulness (more useful marks raise it; not-useful marks lower it). */ export declare function feedbackScore(e: FeedbackEntry): number; /** * Per-vault feedback store. Holds the tally in memory (so a `mark_useful` during * a `serve` session immediately influences the next `obsidian_search` boost — the * closed loop) and persists each change atomically (tmp + rename). * * Concurrency: `record` mutates the in-memory map synchronously (no `await` * between read and write of a given entry), so concurrent marks never interleave * the tally; the on-disk write is last-write-wins, which is acceptable for a * soft ranking signal. */ export declare class FeedbackStore { readonly file: string; private data; private constructor(); /** * Open (or initialize) the store. FAIL-SOFT: a missing / unreadable / malformed * sidecar yields an EMPTY store (the boost simply has no signal) — never throws, * so a corrupt file can't break `serve` boot. Loaded entries are sanitized * (non-finite / negative counts → 0; non-string `lastMarked` → ""). */ static open(file: string, vaultRoot?: string): Promise; /** * Record a usefulness mark for each DISTINCT relative note path. Updates the * in-memory tally (so the same-session search boost sees it immediately) and * atomically persists. `nowIso` is injected so the module is Date-free and the * write is deterministic under test. * * @returns the count of distinct paths recorded (paths skipped at the entry cap * are still counted if they refer to an EXISTING entry). */ record(paths: readonly string[], useful: boolean, nowIso: string): Promise; /** * Live snapshot: relPath → score in (0, 1). Recomputed per search call (the map * is small — one entry per marked note). Notes with a net-zero or negative score * are omitted; the boost treats an absent path as score 0. */ scores(): Map; /** Number of notes with any recorded feedback (for the tool response). */ size(): number; /** * Serializes persists behind a per-store promise chain. The store is a SINGLE * instance shared across all serve-http sessions and the MCP SDK dispatches tool * calls concurrently, so two `record()` calls can both reach `persist()` before * either finishes. Without serialization both `writeOnce()` calls would stream * into the SAME `.tmp` and `fs.rename` would promote a torn file — which, * if invalid JSON, the fail-soft `open()` silently discards on next boot (losing * ALL feedback). Chaining makes every write atomic AND sequential. */ private persistChain; private persist; private writeOnce; } //# sourceMappingURL=feedback.d.ts.map