/** * The decided-gate history — `GET /gates/decided?since=`. * * What a skin needs to show a seat's track record on a kind of step (brainstorm-actionable idea 7) * and to offer "make it a rule" with a preview of what the order would have done (idea 8). Read, * never stored: every row is one `gate.decided` line of the daemon's audit trail (WHO decided, and * what), joined to the engine's gate row for the same `(run, ord)` (the gate's kind and the unit it * reviewed) and to the run (its project, its accepted plan band, the seat that created the work). * * `phase` and `orderApprovable` are the standing-order evaluator's own readings (`gatePhase`, * `orderMayApprove`), so a preview counts exactly the gates an order would have matched. */ import type { FastifyInstance } from 'fastify'; import type { AuditLog } from '../api/audit.js'; import type { SessionView } from '../core/types.js'; /** One engine gate row, as far as the history reads it. */ export interface GateRowFact { session_id: string; ord: number | null; reviewing_ord: number | null; [k: string]: unknown; } export interface DecidedGateRow { runId: string; ord: number | null; decidedAt: number; decision: 'approve' | 'request_changes' | 'reject' | 'edit_plan'; actor: string; byOrder: boolean; gateKind: string | null; phase: string | null; projectId: string | null; band: string | null; creator: { seat: string; phase: string | null; ord: number; } | null; orderApprovable: boolean; } export interface GateHistoryDeps { audit: Pick; views: () => Promise; /** Every engine gate row (any status); `null`/`[]` when the engine cannot say. */ gateRows: () => Promise; projectOf: (runId: string) => string | undefined; /** Approving this run's gate would land doctrine (a steering-author run). */ landsDoctrine: (view: SessionView) => boolean; } /** The band the run's accepted plan landed in (`team_plan.accepted.band`), or undefined. */ export declare function runBand(view: SessionView): string | undefined; /** The preset the run's launch named (`team_plan.preset`); undefined on a user plan or a workflow. */ export declare function runPreset(view: SessionView): string | undefined; /** The run's project: its own filing, else the membership index (the evaluator's reading). */ export declare function runProject(view: SessionView | undefined, runId: string, projectOf: (id: string) => string | undefined): string | undefined; /** * The decision a `gate.decided` line records. A token outside the four named arms reads by the * line's `approve` flag (approve, else reject) — `floor_fix` * (crew#891, wicked-core#782: an approve with a note at a read-only phase's floor gate) IS an * approve, and the escalation arms (`extend`, `targeted`, `accept_partial`, `accept_suggestion`, * `amend_intent`) are all approve-shaped. */ export declare function decisionOf(detail: Record): DecidedGateRow['decision']; export declare function decidedGates(deps: GateHistoryDeps, since: number | undefined): Promise; export declare function registerGateHistoryRoute(app: FastifyInstance, deps: GateHistoryDeps): void; //# sourceMappingURL=history.d.ts.map