/** * The pure half of a decision call: how a structured-output schema becomes * decision questions, and how the answers become the value the schema * describes. No I/O. See docs/dev/llm/decision-models.md. * * The rules: * a union of string literals, or an enum, is a choice * a boolean is a noul (a yes/no question answered with a probability) * an object is one question per top-level field * Everything else is refused with a failure naming the field. * * The prompt is every question's instructions. For an object field, the * field's own description or name follows the prompt on a second line. */ import type { Message } from "smoltalk"; import { type Result } from "smoltalk"; import type { DecisionAnswer, DecisionQuestion } from "../llmClient.js"; /** The question name used when the annotation is a single value. */ export declare const BARE_QUESTION_NAME = "answer"; export type AnswerType = "choice" | "noul"; export type DecisionPlan = { /** Question name to the question sent. */ questions: Record; /** How the answers turn back into the value the schema describes. */ shape: { kind: "bare"; answerType: AnswerType; } | { kind: "object"; fields: Record; }; }; export declare function planDecision(responseFormat: unknown, prompt: string): Result; export declare function answersToValue(plan: DecisionPlan, answers: Record): Result; /** The thread as a decision model's state: role and text only. Tool calls, * tool results, and attachments are not part of what it reads. */ export declare function messagesToState(messages: Message[]): Array<{ role: string; content: string; }>;