UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

44 lines (43 loc) • 2.76 kB
/** * The words as the model is to read them, or `undefined` when nothing was written: absent, or — after the outer whitespace is dropped — * a text that says nothing by the input path's one definition of that ({@link isBlankInput}: whitespace and control characters only). * The queue the live leg delivers through drops such a text for the same reason, so the two cannot disagree about whether words exist. */ export declare function writtenFeedback(feedback: string | undefined): string | undefined; /** Why written words may not be delivered as the person's: they ride a refusal (a refusal's words are its `reason`), the answer is not * a person's (a machine's text must never reach the model as the user's), or they carry the engine's `<system-reminder>` tag. */ export type UnfitFeedback = "on_a_deny" | "by_a_machine" | "reminder_tag"; /** * The one judge of written words, in the order both faces refuse them: the arm first, then the party, then the tag. `words` is * {@link writtenFeedback}'s output (the caller has already held the value to the string domain); nothing written is never unfit. */ export declare function unfitFeedbackOf(words: string | undefined, arm: { readonly allowed: boolean; readonly byPerson: boolean; }): UnfitFeedback | undefined; /** * The live leg's carrier for the words: queues them so the next model request, after the batch the approved call is part of has * settled its tool results, begins with them as a user message of their own. It never throws — a queue that refuses them reports * the refusal itself — so the resolver that calls it can stay a plain wait on the approver. */ export type ApprovalWordsSeat = (words: string) => Promise<void>; /** What a live answer's `feedback` reads as: the trimmed words (`undefined` when nothing was written), or the sentence the answer is refused in. */ export type LiveWords = { readonly kind: "words"; readonly words: string | undefined; } | { readonly kind: "refused"; readonly message: string; }; /** * The live face's ONE reading of an approver's `feedback` member, composed on the judge above: the string domain first (never coerced, * never read as blank), then {@link writtenFeedback}, then whether the seat can carry words at all, then {@link unfitFeedbackOf}. A * refusal is the approver's defect in the seam's own words, never words quietly dropped behind an approval. `answer` states what the * seam knows: the tool the card is about, the arm, whether a person gave it, and whether this seat has a carrier. */ export declare function liveWordsOf(feedback: unknown, answer: { readonly toolName: string; readonly allowed: boolean; readonly byPerson: boolean; readonly hasCarrier: boolean; }): LiveWords;