Skip to content
Français

ResponseSpec

import type { ResponseSpec } from "@elie-laloum/outpost";
  • tagRequired
    string
    Tag name without angle brackets. The brief must contain its opening tag, or the dispatch fails with code configuration before the sandbox starts.
  • repairsRequired
    number
    Correction turns allowed after an invalid answer, 0 unless the options set it. Each resumes the same conversation and asks only for the corrected tag.
  • readRequired
    (text: string) => Promise<T>
    Extract the last complete <tag>…</tag> pair from a text, trim it and parse it. Rejects with ResponseError when no complete pair exists or its content is rejected.
export interface ResponseSpec<T> {
  readonly tag: string;
  readonly repairs: number;
  read(text: string): Promise<T>;
}