/** * Search routes: * GET /search?q=&type=&repo=&project=&agent=&agentMode=&since=&as_of=&entity=&limit=&preset=&mode=&expand= * { mode? } FEAT-532 L2 (retrieval hardening issue #2): 'keyword'|'semantic'| * 'hybrid' — was silently ignored on this route before; now threaded * into search()'s SearchOpts.mode exactly like POST /recall. * Omitted = 'hybrid'. An out-of-enum value is a 400. * POST /recall { query|text, k|limit, mode?, filters? } filters.as_of: ISO-8601 date-time, * filters.entity: FEAT-402 AC-4, * filters.agentMode: FEAT-426 ('filter'|'boost') * filters.scope: FEAT-532 L2 (private|team|org, array) * { preset? } FEAT-454: named retrieval preset, see src/search/presets.ts * { mode? } FEAT-532 L2: 'keyword'|'semantic'|'hybrid', see * src/search/search.ts's gatherCandidates() doc comment. * Omitted = 'hybrid'. * { expand? } FEAT-550: opt this call into the query-rewrite/expansion * stage (only takes effect when search.queryRewrite.mode * is 'enabled'; omitted/false = pre-FEAT-550 behavior). * POST /remember { text, type, project?, agent?, metadata? } * project/agent (#341): flat top-level canonical fields — * preferred over the deprecated nested metadata.project/ * metadata.agent, which remain accepted for compat. * * #112 (U3-local): `query`/`k` are the pre-ADR-005 legacy field names for * POST /recall; `text`/`limit` are the canonical ADR-005 names * (contracts/schemas/retrieval-query.v1.schema.json). Both spellings are * accepted for exactly one release — drop `query`/`k` next release. * * FEAT-454: `preset` selects a named routing over the existing fusion * weights/filters (default|recent|exact|entity|temporal) — see * src/search/presets.ts for the full semantics and AC-3 400 cases. Omitted * `preset` is `'default'`, byte-identical to pre-FEAT-454 behavior (AC-1). * * FEAT-532 L1: POST /recall's response is now the canonical * astramem-retrieval-result@1 envelope (contracts/schemas/ * retrieval-result.v1.schema.json) — `{ schema, query, hits, total }`, hits * wire-mapped via src/contracts/wire-hit.ts's toWireHit(). BREAKING versus * the pre-FEAT-532 flat `{ hits }` shape: each hit's fusion-leg `source` * (fts|vec|both) is dropped and `capture_source` is renamed to the * canonical `source` (provenance) — a client reading the old `source` * meaning will silently misinterpret the new one. GET /search is * UNCHANGED (still the flat `{ hits }` shape) — only POST /recall adopts * the envelope in this slice. */ import type { FastifyInstance } from 'fastify'; import type { DB } from '../../storage/db.js'; import type { EmbedProvider } from '../../contracts/index.js'; import { type Config } from '../../config/config.js'; export declare function searchRoute(db: DB, embed: EmbedProvider, config?: Config): (app: FastifyInstance) => Promise;