export type AnswerScalar = number | boolean; export interface AnswerRule { field: string; op: 'lte' | 'gte' | 'eq'; value: AnswerScalar; } export interface AnswerRecord { id: string; attributes: Record; } export interface AnswerGateOptions { sessionId: string; turn: number; rules: AnswerRule[]; records: AnswerRecord[]; ranking?: { field: string; direction: 'min' | 'max'; }; disclosure?: 'external-data' | 'source-instructions'; } export interface AnswerCatalog { readonly schema: 'warden-answer-catalog/1'; readonly catalogSha256: string; readonly rules: readonly Readonly[]; readonly records: readonly { readonly ref: string; readonly attributes: Readonly>; }[]; readonly ranking?: { readonly field: string; readonly direction: 'min' | 'max'; }; readonly responseSchema: 'warden-selection/1'; } export interface StructuredAnswer { readonly schema: 'warden-selection/1'; readonly catalogSha256: string; readonly selectedRef: string; readonly eligibleRefs: readonly string[]; } export type AnswerGateCode = 'verified' | 'invalid-json' | 'invalid-schema' | 'stale-catalog' | 'unknown-record' | 'incomplete-facts' | 'no-eligible-records' | 'constraint-violation' | 'incomplete-eligible-set' | 'not-optimal'; export interface AnswerGateViolation { readonly recordRef: string; readonly field: string; readonly op: AnswerRule['op']; readonly actual: AnswerScalar; readonly required: AnswerScalar; } export interface AnswerGateDecision { readonly decision: 'allow' | 'deny' | 'unknown'; readonly code: AnswerGateCode; readonly answerSha256: string; readonly feedback: string; readonly violations: readonly AnswerGateViolation[]; readonly answer?: StructuredAnswer; } export interface AnswerGateRequest { readonly attempt: number; readonly catalog: AnswerCatalog; readonly feedback?: string; readonly signal: AbortSignal; } export interface AnswerGateRunOptions { /** Initial proposal plus at most two corrections. Never an unbounded Stop-hook loop. */ maxCorrections?: 0 | 1 | 2; /** Per-generation deadline; no automatic retry on generation/timeout/output errors. */ timeoutMs?: number; signal?: AbortSignal; generate: (request: AnswerGateRequest) => Promise | string; /** One host-owned output boundary; receives only fixed notice + checked data or a withholding notice. */ emit: (rendered: string) => Promise | void; } export interface AnswerGateRunResult { readonly status: 'delivered' | 'withheld' | 'cancelled' | 'generation-error' | 'delivery-uncertain'; readonly attempts: number; readonly decisions: readonly AnswerGateDecision[]; readonly lastCode?: AnswerGateCode; } export interface AnswerGate { readonly catalog: AnswerCatalog; readonly notice: string; /** Host-only mapping into the safe catalog; never forwards source metadata. Not an effect authorization. */ referenceForRecord(sourceId: string): string | undefined; evaluate(raw: string): AnswerGateDecision; /** This gate instance owns one run/output reservation. A repeated or concurrent run is refused. */ run(options: AnswerGateRunOptions): Promise; } /** * The host owns rules, snapshot, context and output. Raw model prose is deliberately unsupported. * Safe aliases replace source IDs/field labels in both the model catalog and every counterexample. */ export declare function createAnswerGate(options: AnswerGateOptions): AnswerGate; //# sourceMappingURL=answer-gate.d.ts.map