/** * Consolidation routes (Wave 4b, ADR-004 stage 9): * POST /consolidation/run -> 200 ConsolidateSummary * GET /consolidation/proposals?status=&kind=&limit=&offset=&min_confidence= * -> { proposals: [...], total } * POST /consolidation/proposals/:id/accept -> 200 proposal | 404 | 409 * POST /consolidation/proposals/:id/reject -> 200 proposal | 404 | 409 * * /run executes the deterministic pass inline (no LLM in v1 — cheap enough * to run synchronously); the `consolidate` job kind wraps the same call for * scheduled runs. * * FEAT-456 SLICE-2: `kind` is an optional second filter on the list route, * needed for the design's `?status=accepted&kind=contradiction` audit query * (§2.4) — `ProposalRepo.list()` already accepts it (proposals.ts). * * #372/#171: `limit`/`offset`/`min_confidence` are additive on top of that * same precedent — fixes #171's "ignored ?limit" and gives operators a way * to page a queue that has grown into the hundreds without pulling every * row (and every winner/loser text) in one response. `total` reflects the * status/kind/min_confidence filters but NOT the limit/offset slice, so a * client can render "showing N of total". */ import type { FastifyInstance } from 'fastify'; import type { DB } from '../../storage/db.js'; import type { Config } from '../../config/config.js'; import { ProposalRepo, type ConsolidationProposal } from '../../consolidate/proposals.js'; export type ProposalResolveOutcome = { ok: true; proposal: ConsolidationProposal; } | { ok: false; status: 404 | 409; error: string; id: string; }; /** * Shared accept/reject resolution — the ONE place that maps * ProposalRepo's thrown errors to (status, body) shapes. Both the * Bearer-gated API route below and the cookie-gated dashboard mutation * route (dashboard-consolidation-html.ts) call this rather than each * reimplementing not-found/conflict handling, so the two surfaces cannot * drift on resolution semantics. */ export declare function resolveProposal(proposals: ProposalRepo, id: string, action: 'accept' | 'reject', acceptOpts?: { bulkAccepted?: boolean; }): ProposalResolveOutcome; export declare function consolidationRoutes(db: DB, config: Config): (app: FastifyInstance) => Promise;