/** JSON-compatible context. Callers must exclude cycles and non-finite numbers. */ export type JsonValue = | null | boolean | number | string | readonly JsonValue[] | { readonly [key: string]: JsonValue }; /** Instructions and criteria may use text or structured descriptions. */ export type Description = | string | readonly JsonValue[] | { readonly [key: string]: JsonValue }; export interface QuestionBase { /** Complete question meaning; question IDs are only for correlation. */ readonly instructions: Description; } export interface ChoiceQuestion extends QuestionBase { readonly type: "choice"; /** Non-empty candidate set; keys are stable option IDs. */ readonly options: Readonly>; } export interface ScoreQuestion extends QuestionBase { readonly type: "score"; /** Ordered lowest to highest; each level describes a concrete situation. */ readonly levels: readonly [Description, Description, ...Description[]]; } export interface NoulQuestion extends QuestionBase { readonly type: "noul"; readonly criteria?: { readonly yes: Description; readonly no: Description; }; } export type Question = ChoiceQuestion | ScoreQuestion | NoulQuestion; /** A request must contain at least one question, checked at runtime. */ export type QuestionSet = Readonly>; export interface JudgmentRequest { readonly context: JsonValue; /** Questions share context but cannot consume one another's answers. */ readonly questions: Q; } export interface ChoiceAnswer