/** * Library — search ranking (structural + keyword; Phase 1). * * Phase 2 adds the embedding/cosine path; the seam (LibraryDeps.embedder) is * already in place but left unused here. When no embedder is configured OR * structureOnly is set, search degrades to keyword + structural ranking. * * Refs: docs/rfc-library-reuse.md §5.2 (blend), §5.2.1 (structScore), * §5.2.2 (staleness), §5.3 (why/reuseHint templates). */ import { getFlow } from "../store.ts"; import type { Taskflow } from "../schema.ts"; import type { FlowMeta } from "./types.ts"; import type { LibraryDeps, ResolvedCandidate, SearchInput, SearchResponse } from "./types.ts"; /** Standard Levenshtein edit distance (insert/delete/replace cost 1). * O(m·n) DP; signature strings are short (<50 chars) so cost is negligible. */ export declare function levenshtein(a: string, b: string): number; /** Resolve a saved flow + its sidecar into a candidate whose structural fields * are ALWAYS freshly derived from the current def, and whose embedding is only * trusted when the sidecar's phaseSignature matches the fresh one. */ export declare function resolveCandidate(def: Taskflow, scope: "user" | "project", name: string, sidecar: FlowMeta | undefined): ResolvedCandidate; /** Search the library. Returns ranked top-N. Degrades to structural/keyword * when no embedder is configured or structureOnly is requested. */ export declare function searchLibrary(deps: LibraryDeps, input: SearchInput): Promise; /** Pure cosine similarity. Zero-dep. Accepts non-normalized vectors. */ export declare function cosine(a: number[], b: number[]): number; /** Bump reuseCount for a flow by name (RFC §6 reuse flywheel). * Phase 1: structural-only; the caller (tool handler) decides whether to * bump based on a `reusedFromSearch` flag. Returns the new count or null if * the flow has no sidecar yet. The actual sidecar write is done by * `bumpReuseInSidecar` in store.ts under withLock. */ export { getFlow }; //# sourceMappingURL=search.d.ts.map