/** * The reply ranker: what the caller's latest message does with the question a flow asked — the instructions and the * decoders, zero runtime imports. jsfe asks it at a contextual DISPATCH (`onResponse: "continue"`), passing the request * below to aiCallback as its 4th argument (task 'rank_reply'). The host is the executor: System One (Jev) answers, a * text model covers it (the host's aiCallbackRank), and the CANONICAL reply is a JSON string: { "option": "" }. * * answers the reply answers the question (the default: an open question's reply that clears no option is its answer) * abort the caller withdraws the request and asks for nothing else * new_request the caller clearly asks for something else: a different service, product or action, or an unrelated question * irrelevant the reply means nothing here (a stray word, an unfinished sentence, speech to someone else): the question * is asked again and no flow moves. A reason question does not offer it. * concern the caller doubts the current process is what they need (offered only when a form declares * user_description, passed as `concern`): the form says what it does and how to cancel, then asks again * choice: the reply picks one of the question's declared choices (only when the step declares them); `answers` * is then a reply that picks none of them * * Both executors' instructions come from the same criteria. A host that does not know this task answers the `llm` * instructions with its text model, which is a complete answer. */ export declare const REPLY_OPTIONS: readonly ["answers", "abort", "new_request", "irrelevant"]; /** The fixed options, or `choice:` for a declared choice. */ export type ReplyOption = typeof REPLY_OPTIONS[number] | 'concern' | `choice:${string}`; /** Offered when the question names what its process does (DISPATCH responseConcern, from a form's user_description). */ export declare const CONCERN_OPTION: "concern"; /** A choice the question offers: its key and the words that describe it to the ranker. */ export interface ReplyChoiceParameter { name: string; type: string; description: string; } export interface ReplyChoice { key: string; label: string; route?: 'new_request'; parameters?: ReplyChoiceParameter[]; } export declare const CHOICE_PREFIX = "choice:"; /** An open question's reply that clears no option is its answer (owner decision 2026-10-26). */ export declare const REPLY_DEFAULT: ReplyOption; /** A noul at or above this is a yes. */ export declare const REPLY_YES_THRESHOLD = 0.5; /** * The cut an option must clear, by what a wrong pick costs: an option not listed here takes REPLY_YES_THRESHOLD. Set * from labelled prod replies (owner 2026-10-28), never guessed. */ export declare const REPLY_CUTS: Partial>; /** * The cut another declared choice must clear to be reported beside the pick (`also`): a reply may ask for two of a menu's * facts ("my due date and the amount"). Measured 2026-11-02 on 136 prod replies at the account menu: 0.6 kept those and * dropped the neighbours a single question rates 0.50-0.59. */ export declare const REPLY_ALSO_CUT = 0.6; export interface ReplyTurn { role: 'user' | 'assistant'; content: string; } export interface ReplyRankRequest { task: 'rank_reply'; input: string; conversation: ReplyTurn[]; /** the flow's question and what answers it (the step's responseContext, interpolated) */ question: string; options: ReplyOption[]; /** the question's declared choices, when it offers any */ choices?: ReplyChoice[]; /** the question asks why the caller does not want this (a cancellation's reason): the step's responseReasonFor */ reasonFor?: string; /** what the process does (the step's responseConcern): offers `concern` */ concern?: string; llm: { system: string; user: string; schema: Record; }; systemOne: { state: Record; questions: Record; index: { id: string; option: ReplyOption; }[]; }; } /** * The reply ranker's instructions for both executors. `reasonFor` (what the caller does not want, e.g. "your Acme * Club membership") ranks the reply as an answer to "why don't you want it?": only `answers` or `new_request`, no * choices. */ export declare function buildReplyRank(input: string, conversation: ReplyTurn[], question: string, choices?: ReplyChoice[], { reasonFor, concern }?: { reasonFor?: string; concern?: string; }): ReplyRankRequest; /** A text model's answer as the canonical reply; throws when it names no offered option. */ export declare function decodeReplyRankLlm(text: string, request: ReplyRankRequest): { option: ReplyOption; }; /** * System One's answers as the canonical reply: the highest-rated option that clears its own cut (REPLY_CUTS, else the * threshold), a cleared choice before `answers` and `new_request`; when none does, the default (`answers`: asked again at a choice question, the answer at an open one), with * every option's probability (for logs). Throws if any question is unanswered. */ export declare function decodeReplyRankSystemOne(answers: Record | undefined, request: ReplyRankRequest, { threshold, cuts }?: { threshold?: number; cuts?: Partial>; }): { option: ReplyOption; also?: string[]; scores: Record; fallback: boolean; }; /** Is this jsfe's reply-rank request (a host's aiCallback receives it as the 4th argument)? */ export declare function isReplyRankRequest(request: unknown): request is ReplyRankRequest; //# sourceMappingURL=reply-rank.d.ts.map